1
0
Fork 0
mirror of synced 2024-11-14 21:18:58 -05:00
ultimate-vim/sources_non_forked/coc.nvim/build/index.js

338 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)
}
})();
2022-05-27 03:57:56 -04:00
var Qte=Object.create;var Wh=Object.defineProperty,Kte=Object.defineProperties,zte=Object.getOwnPropertyDescriptor,Vte=Object.getOwnPropertyDescriptors,eie=Object.getOwnPropertyNames,bR=Object.getOwnPropertySymbols,tie=Object.getPrototypeOf,vR=Object.prototype.hasOwnProperty,iie=Object.prototype.propertyIsEnumerable;var yR=(n,e,t)=>e in n?Wh(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,ge=(n,e)=>{for(var t in e||(e={}))vR.call(e,t)&&yR(n,t,e[t]);if(bR)for(var t of bR(e))iie.call(e,t)&&yR(n,t,e[t]);return n},Ba=(n,e)=>Kte(n,Vte(e)),wR=n=>Wh(n,"__esModule",{value:!0});var _=(n,e)=>()=>(n&&(e=n(n=0)),e);var m=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),xs=(n,e)=>{for(var t in e)Wh(n,t,{get:e[t],enumerable:!0})},DR=(n,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of eie(e))!vR.call(n,r)&&(t||r!=="default")&&Wh(n,r,{get:()=>e[r],enumerable:!(i=zte(e,r))||i.enumerable});return n},C=(n,e)=>DR(wR(Wh(n!=null?Qte(tie(n)):{},"default",!e&&n&&n.__esModule?{get:()=>n.default,enumerable:!0}:{value:n,enumerable:!0})),n),Ha=(n=>(e,t)=>n&&n.get(e)||(t=DR(wR({}),e,1),n&&n.set(e,t),t))(typeof WeakMap!="undefined"?new WeakMap:0);var CR=m(($Te,xR)=>{var pu=1e3,mu=pu*60,bu=mu*60,qa=bu*24,nie=qa*7,rie=qa*365.25;xR.exports=function(n,e){e=e||{};var t=typeof n;if(t==="string"&&n.length>0)return oie(n);if(t==="number"&&isFinite(n))return e.long?aie(n):sie(n);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(n))};function oie(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*rie;case"weeks":case"week":case"w":return t*nie;case"days":case"day":case"d":return t*qa;case"hours":case"hour":case"hrs":case"hr":case"h":return t*bu;case"minutes":case"minute":case"mins":case"min":case"m":return t*mu;case"seconds":case"second":case"secs":case"sec":case"s":return t*pu;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return t;default:return}}}}function sie(n){var e=Math.abs(n);return e>=qa?Math.round(n/qa)+"d":e>=bu?Math.round(n/bu)+"h":e>=mu?Math.round(n/mu)+"m":e>=pu?Math.round(n/pu)+"s":n+"ms"}function aie(n){var e=Math.abs(n);return e>=qa?mp(n,e,qa,"day"):e>=bu?mp(n,e,bu,"hour"):e>=mu?mp(n,e,mu,"minute"):e>=pu?mp(n,e,pu,"second"):n+" ms"}function mp(n,e,t,i){var r=e>=t*1.5;return Math.round(n/t)+" "+i+(r?"s":"")}});var kx=m((XTe,SR)=>{function lie(n){t.debug=t,t.default=t,t.coerce=l,t.disable=o,t.enable=r,t.enabled=s,t.humanize=CR(),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 v=p,w=Number(new Date),D=w-(h||w);v.diff=D,v.prev=h,v.curr=w,h=w,b[0]=t.coerce(b[0]),typeof b[0]!="string"&&b.unshift("%O");let S=0;b[0]=b[0].replace(/%([a-zA-Z%])/g,(I,j)=>{if(I==="%%")return"%";S++;let W=t.formatters[j];if(typeof W=="function"){let N=b[S];I=W.call(v,N),b.splice(S,1),S--}return I}),t.formatArgs.call(v,b),(v.log||t.log).apply(v,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
2022-05-18 13:29:28 -04:00
`).join(`
2022-05-27 03:57:56 -04:00
`+o),n.push(r+"m+"+vp.exports.humanize(this.diff)+"\x1B[0m")}else n[0]=wie()+e+" "+n[0]}function wie(){return fi.inspectOpts.hideDate?"":new Date().toISOString()+" "}function Die(...n){return process.stderr.write(yp.format(...n)+`
`)}function xie(n){n?process.env.DEBUG=n:delete process.env.DEBUG}function Cie(){return process.env.DEBUG}function Sie(n){n.inspectOpts={};let e=Object.keys(fi.inspectOpts);for(let t=0;t<e.length;t++)n.inspectOpts[e[t]]=fi.inspectOpts[e[t]]}vp.exports=kx()(fi);var{formatters:LR}=vp.exports;LR.o=function(n){return this.inspectOpts.colors=this.useColors,yp.inspect(n,this.inspectOpts).split(`
`).map(e=>e.trim()).join(" ")};LR.O=function(n){return this.inspectOpts.colors=this.useColors,yp.inspect(n,this.inspectOpts)}});var At=m((QTe,_x)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?_x.exports=TR():_x.exports=FR()});var jR=m((KTe,IR)=>{"use strict";IR.exports=Tie;function yu(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 kie(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]=yu(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]=yu(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]=yu(a):o[s]=i(a)}return o}}function kie(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]=yu(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]=yu(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]=yu(u);else{var c=e.indexOf(u);c!==-1?a[l]=t[c]:a[l]=o(u)}}return e.pop(),t.pop(),a}}});var Wa=m((zTe,NR)=>{var Eie=require("util"),Ya=At()("log4js:configuration"),wp=[],Dp=[],AR=n=>!n,OR=n=>n&&typeof n=="object"&&!Array.isArray(n),Pie=n=>/^[A-Za-z][A-Za-z0-9_]*$/g.test(n),_ie=n=>n&&typeof n=="number"&&Number.isInteger(n),Rie=n=>{Dp.push(n),Ya(`Added listener, now ${Dp.length} listeners`)},Lie=n=>{wp.push(n),Ya(`Added pre-processing listener, now ${wp.length} listeners`)},MR=(n,e,t)=>{(Array.isArray(e)?e:[e]).forEach(r=>{if(r)throw new Error(`Problem with log4js configuration: (${Eie.inspect(n,{depth:5})}) - ${t}`)})},Fie=n=>{Ya("New configuration to be validated: ",n),MR(n,AR(OR(n)),"must be an object."),Ya(`Calling pre-processing listeners (${wp.length})`),wp.forEach(e=>e(n)),Ya("Configuration pre-processing f
`)}}function Kie(n,e){let t=e.colouredLayout;return n.layout&&(t=e.layout(n.layout.type,n.layout)),Qie(t,n.timezoneOffset)}xL.configure=Kie});var TL=m((lke,SL)=>{function zie(n,e){return t=>{process.stderr.write(`${n(t,e)}
`)}}function Vie(n,e){let t=e.colouredLayout;return n.layout&&(t=e.layout(n.layout.type,n.layout)),zie(t,n.timezoneOffset)}SL.exports.configure=Vie});var EL=m((uke,kL)=>{function ene(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 tne(n,e,t,i){let r=t(n.appender);return ene(n.level,n.maxLevel,r,i)}kL.exports.configure=tne});var RL=m((cke,_L)=>{var PL=At()("log4js:categoryFilter");function ine(n,e){return typeof n=="string"&&(n=[n]),t=>{PL(`Checking ${t.categoryName} against ${n}`),n.indexOf(t.categoryName)===-1&&(PL("Not excluded, sending to appender"),e(t))}}function nne(n,e,t){let i=t(n.appender);return ine(n.exclude,i)}_L.exports.configure=nne});var IL=m((hke,FL)=>{var LL=At()("log4js:noLogFilter");function rne(n){return n.filter(t=>t!=null&&t!=="")}function one(n,e){return t=>{LL(`Checking data: ${t.data} against filters: ${n}`),typeof n=="string"&&(n=[n]),n=rne(n);let i=new RegExp(n.join("|"),"i");(n.length===0||t.data.findIndex(r=>i.test(r))<0)&&(LL("Not excluded, sending to appender"),e(t))}}function sne(n,e,t){let i=t(n.appender);return one(n.exclude,i)}FL.exports.configure=sne});var gt=m(Ax=>{"use strict";Ax.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})};Ax.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 AL=m((gke,jL)=>{var Ts=require("constants"),ane=process.cwd,Ep=null,lne=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return Ep||(Ep=ane.call(process)),Ep};try{process.cwd()}catch{}typeof process.chdir=="function"&&(Ox=process.chdir,process.chdir=function(n){Ep=null,Ox.call(process,n)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,Ox));var Ox;jL.exports=une;function une(n){Ts.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(){}),lne==="win32"&&(n.rename=function(c){return function(h,d,g){var f=Date.now(),p=0;c(h,d,function b(v){if(v&&(v.code==="EACCES"||v.code==="EPERM")&&Date.now()-f<6e4){setTimeout(function(){n.stat(d,function(w,D){w&&w.code==="ENOENT"?c(h,d,b):g(v)})},p),p<100&&(p+=10);return}g&&g(v)})}}(n.rename)),n.read=function(c){function h(d,g,f,p,b,v){var w;if(v&&typeof v=="function"){var D=0;w=function(S,L,I){if(S&&S.code==="EAGAIN"&&D<10)return D++,c.call(n,d,g,f,p,b,w);v.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(v){if(v.code==="EAGAIN"&&b<10){b++;continue}throw v}}}(n.readSync);function e(c){c.lchmod=function(h,d,g){c.open(h,Ts.O_WRONLY|Ts.O_SYMLINK,d,function(f,p){if(f){g&&g(f);return}c.fchmod(p,d,function(b){c.close(p,function(v){g&&g(b||v)})})})},c.lchmodSync=function(h,d){var g=c.openSync(h,Ts.O_WRONLY|Ts.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){Ts.hasOwnProperty("O_SYMLINK")?(c.lutimes=function(h,d,g,f){c.open(h,Ts.O_SYMLINK,function(p,b){if(p){f&&f(p);return}c.futimes(b,d,g,function(v){c.close(b,function(w){f&&f(v||w)})
GFS4: `),console.error(n)});pi[pr]||(qL=global[pr]||[],YL(pi,qL),pi.close=function(n){function e(t,i){return n.call(pi,t,function(r){r||ks(),typeof i=="function"&&i.apply(this,arguments)})}return Object.defineProperty(e,_p,{value:n}),e}(pi.close),pi.closeSync=function(n){function e(t){n.apply(pi,arguments),ks()}return Object.defineProperty(e,_p,{value:n}),e}(pi.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){Qh(pi[pr]),require("assert").equal(pi[pr].length,0)}));var qL;global[pr]||YL(global,pi[pr]);Nx.exports=Mx(pne(pi));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!pi.__patched&&(Nx.exports=Mx(pi),pi.__patched=!0);function Mx(n){gne(n),n.gracefulify=Mx,n.createReadStream=L,n.createWriteStream=I;var e=n.readFile;n.readFile=t;function t(N,B,F){return typeof B=="function"&&(F=B,B=null),M(N,B,F);function M(J,K,le){return e(J,K,function(je){je&&(je.code==="EMFILE"||je.code==="ENFILE")?wu([M,[J,K,le]]):(typeof le=="function"&&le.apply(this,arguments),ks())})}}var i=n.writeFile;n.writeFile=r;function r(N,B,F,M){return typeof F=="function"&&(M=F,F=null),J(N,B,F,M);function J(K,le,je,Re){return i(K,le,je,function(Ve){Ve&&(Ve.code==="EMFILE"||Ve.code==="ENFILE")?wu([J,[K,le,je,Re]]):(typeof Re=="function"&&Re.apply(this,arguments),ks())})}}var o=n.appendFile;o&&(n.appendFile=s);function s(N,B,F,M){return typeof F=="function"&&(M=F,F=null),J(N,B,F,M);function J(K,le,je,Re){return o(K,le,je,function(Ve){Ve&&(Ve.code==="EMFILE"||Ve.code==="ENFILE")?wu([J,[K,le,je,Re]]):(typeof Re=="function"&&Re.apply(this,arguments),ks())})}}var a=n.copyFile;a&&(n.copyFile=l);function l(N,B,F,M){return typeof F=="function"&&(M=F,F=0),a(N,B,F,function(J){J&&(J.code==="EMFILE"||J.code==="ENFILE")?wu([a,[N,B,F,M]]):(typeof M=="function"&&M.apply(this,arguments),ks())})}var u=n.readdir;n.readdir=c;function c(N,B,F){var M=[N];return typeof B!="function"?M.push(B):F=B,M.push(J),h(M);function J(K,le){le&&le.sort&&le.sort(),K&&(K.code==="EMFILE"||K.code==="ENFILE")?wu([h,[M]]):(typeof F=="function"&&F.apply(this,arguments),ks())}}function h(N){return u.apply(n,N)}if(process.version.substr(0,4)==="v0.8"){var d=fne(n);v=d.ReadStream,D=d.WriteStream}var g=n.ReadStream;g&&(v.prototype=Object.create(g.prototype),v.prototype.open=w);var f=n.WriteStream;f&&(D.prototype=Object.create(f.prototype),D.prototype.open=S),Object.defineProperty(n,"ReadStream",{get:function(){return v},set:function(N){v=N},enumerable:!0,configurable:!0}),Object.defineProperty(n,"WriteStream",{get:function(){return D},set:function(N){D=N},enumerable:!0,configurable:!0});var p=v;Object.defineProperty(n,"FileReadStream",{get:function(){return p},set:function(N){p=N},enumerable:!0,configurable:!0});var b=D;Object.defineProperty(n,"FileWriteStream",{get:function(){return b},set:function(N){b=N},enumerable:!0,configurable:!0});function v(N,B){return this instanceof v?(g.apply(this,arguments),this):v.apply(Object.create(v.prototype),arguments)}function w(){var N=this;W(N.path,N.flags,N.mode,function(B,F){B?(N.autoClose&&N.destroy(),N.emit("error",B)):(N.fd=F,N.emit("open",F),N.read())})}function D(N,B){return this instanceof D?(f.apply(this,arguments),this):D.apply(Object.create(D.prototype),arguments)}function S(){var N=this;W(N.path,N.flags,N.mode,function(B,F){B?(N.destroy(),N.emit("error",B)):(N.fd=F,N.emit("open",F))})}function L(N,B){return new n.ReadStream(N,B)}function I(N,B){return new n.WriteStream(N,B)}var j=n.open;n.open=W;function W(N,B,F,M){return typeof F=="function"&&(M=F,F=null),J(N,B,F,M);function J(K,le,je,Re){return j(K,le,je,function(Ve,kt){Ve&&(Ve.code==="EMFILE"||Ve.code==="ENFILE")?wu([J,[K,le,je,Re]]):(typeof Re=="function"&&Re.apply(this,arguments),ks())})}}return n}function wu(n){Qh("ENQUEUE",n[0].name,n[1]),pi[pr].push(n)}function ks(){var n=pi[pr].shift();n&&(Qh("RETRY",n[0].name,n[1]),n[0].apply(null,n[1]))}});var Xa=m(Es=>{"use strict";var WL=gt().fromCallback,Pn=Qe(),bne=["access","appendFile","chmod","chown","close","copyFile","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchmod","lchown","link","lstat",
2022-05-18 13:29:28 -04:00
2022-05-27 03:57:56 -04:00
see https://github.com/jprichardson/node-fs-extra/issues/269`);let{srcStat:i,destStat:r}=Vh.checkPathsSync(n,e,"copy",t);return Vh.checkParentPathsSync(n,i,e,"copy"),Lne(r,n,e,t)}function Lne(n,e,t,i){if(i.filter&&!i.filter(e,t))return;let r=zh.dirname(t);return Si.existsSync(r)||Pne(r),tF(n,e,t,i)}function Fne(n,e,t,i){if(!(i.filter&&!i.filter(e,t)))return tF(n,e,t,i)}function tF(n,e,t,i){let o=(i.dereference?Si.statSync:Si.lstatSync)(e);if(o.isDirectory())return Bne(o,n,e,t,i);if(o.isFile()||o.isCharacterDevice()||o.isBlockDevice())return Ine(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 Ine(n,e,t,i,r){return e?jne(n,t,i,r):iF(n,t,i,r)}function jne(n,e,t,i){if(i.overwrite)return Si.unlinkSync(t),iF(n,e,t,i);if(i.errorOnExist)throw new Error(`'${t}' already exists`)}function iF(n,e,t,i){return Si.copyFileSync(e,t),i.preserveTimestamps&&Ane(n.mode,e,t),Zx(t,n.mode)}function Ane(n,e,t){return One(n)&&Mne(t,n),Nne(e,t)}function One(n){return(n&128)===0}function Mne(n,e){return Zx(n,e|128)}function Zx(n,e){return Si.chmodSync(n,e)}function Nne(n,e){let t=Si.statSync(n);return _ne(e,t.atime,t.mtime)}function Bne(n,e,t,i,r){return e?nF(t,i,r):Hne(n.mode,t,i,r)}function Hne(n,e,t,i){return Si.mkdirSync(t),nF(e,t,i),Zx(t,n)}function nF(n,e,t){Si.readdirSync(n).forEach(i=>qne(i,n,e,t))}function qne(n,e,t,i){let r=zh.join(e,n),o=zh.join(t,n),{destStat:s}=Vh.checkPathsSync(r,o,"copy",i);return Fne(s,r,o,i)}function Yne(n,e,t,i){let r=Si.readlinkSync(e);if(i.dereference&&(r=zh.resolve(process.cwd(),r)),n){let o;try{o=Si.readlinkSync(t)}catch(s){if(s.code==="EINVAL"||s.code==="UNKNOWN")return Si.symlinkSync(r,t);throw s}if(i.dereference&&(o=zh.resolve(process.cwd(),o)),Vh.isSrcSubdir(r,o))throw new Error(`Cannot copy '${r}' to a subdirectory of itself, '${o}'.`);if(Si.statSync(t).isDirectory()&&Vh.isSrcSubdir(o,r))throw new Error(`Cannot overwrite '${o}' with '${r}'.`);return Wne(r,t)}else return Si.symlinkSync(r,t)}function Wne(n,e){return Si.unlinkSync(e),Si.symlinkSync(n,e)}rF.exports=Rne});var Jx=m((Ske,sF)=>{"use strict";sF.exports={copySync:oF()}});var Ps=m((Tke,lF)=>{"use strict";var Zne=gt().fromPromise,aF=Xa();function Jne(n){return aF.access(n).then(()=>!0).catch(()=>!1)}lF.exports={pathExists:Zne(Jne),pathExistsSync:aF.existsSync}});var mF=m((kke,pF)=>{"use strict";var rn=Qe(),ed=require("path"),$ne=mr().mkdirs,Xne=Ps().pathExists,Une=Yx().utimesMillis,td=Ua();function Gne(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;
2022-05-18 13:29:28 -04:00
2022-05-27 03:57:56 -04:00
see https://github.com/jprichardson/node-fs-extra/issues/269`),td.checkPaths(n,e,"copy",t,(r,o)=>{if(r)return i(r);let{srcStat:s,destStat:a}=o;td.checkParentPaths(n,s,e,"copy",l=>l?i(l):t.filter?hF(uF,a,n,e,t,i):uF(a,n,e,t,i))})}function uF(n,e,t,i,r){let o=ed.dirname(t);Xne(o,(s,a)=>{if(s)return r(s);if(a)return Lp(n,e,t,i,r);$ne(o,l=>l?r(l):Lp(n,e,t,i,r))})}function hF(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 Qne(n,e,t,i,r){return i.filter?hF(Lp,n,e,t,i,r):Lp(n,e,t,i,r)}function Lp(n,e,t,i,r){(i.dereference?rn.stat:rn.lstat)(e,(s,a)=>s?r(s):a.isDirectory()?nre(a,n,e,t,i,r):a.isFile()||a.isCharacterDevice()||a.isBlockDevice()?Kne(a,n,e,t,i,r):a.isSymbolicLink()?sre(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 Kne(n,e,t,i,r,o){return e?zne(n,t,i,r,o):dF(n,t,i,r,o)}function zne(n,e,t,i,r){if(i.overwrite)rn.unlink(t,o=>o?r(o):dF(n,e,t,i,r));else return i.errorOnExist?r(new Error(`'${t}' already exists`)):r()}function dF(n,e,t,i,r){rn.copyFile(e,t,o=>o?r(o):i.preserveTimestamps?Vne(n.mode,e,t,r):Fp(t,n.mode,r))}function Vne(n,e,t,i){return ere(n)?tre(t,n,r=>r?i(r):cF(n,e,t,i)):cF(n,e,t,i)}function ere(n){return(n&128)===0}function tre(n,e,t){return Fp(n,e|128,t)}function cF(n,e,t,i){ire(e,t,r=>r?i(r):Fp(t,n,i))}function Fp(n,e,t){return rn.chmod(n,e,t)}function ire(n,e,t){rn.stat(n,(i,r)=>i?t(i):Une(e,r.atime,r.mtime,t))}function nre(n,e,t,i,r,o){return e?gF(t,i,r,o):rre(n.mode,t,i,r,o)}function rre(n,e,t,i,r){rn.mkdir(t,o=>{if(o)return r(o);gF(e,t,i,s=>s?r(s):Fp(t,n,r))})}function gF(n,e,t,i){rn.readdir(n,(r,o)=>r?i(r):fF(o,n,e,t,i))}function fF(n,e,t,i,r){let o=n.pop();return o?ore(n,o,e,t,i,r):r()}function ore(n,e,t,i,r,o){let s=ed.join(t,e),a=ed.join(i,e);td.checkPaths(s,a,"copy",r,(l,u)=>{if(l)return o(l);let{destStat:c}=u;Qne(c,s,a,r,h=>h?o(h):fF(n,t,i,r,o))})}function sre(n,e,t,i,r){rn.readlink(e,(o,s)=>{if(o)return r(o);if(i.dereference&&(s=ed.resolve(process.cwd(),s)),n)rn.readlink(t,(a,l)=>a?a.code==="EINVAL"||a.code==="UNKNOWN"?rn.symlink(s,t,r):r(a):(i.dereference&&(l=ed.resolve(process.cwd(),l)),td.isSrcSubdir(s,l)?r(new Error(`Cannot copy '${s}' to a subdirectory of itself, '${l}'.`)):n.isDirectory()&&td.isSrcSubdir(l,s)?r(new Error(`Cannot overwrite '${l}' with '${s}'.`)):are(s,t,r)));else return rn.symlink(s,t,r)})}function are(n,e,t){rn.unlink(e,i=>i?t(i):rn.symlink(n,e,t))}pF.exports=Gne});var $x=m((Eke,bF)=>{"use strict";var lre=gt().fromCallback;bF.exports={copy:lre(mF())}});var kF=m((Pke,TF)=>{"use strict";var yF=Qe(),xF=require("path"),ot=require("assert"),id=process.platform==="win32";function CF(n){["unlink","chmod","stat","lstat","rmdir","readdir"].forEach(t=>{n[t]=n[t]||yF[t],t=t+"Sync",n[t]=n[t]||yF[t]}),n.maxBusyTries=n.maxBusyTries||3}function Xx(n,e,t){let i=0;typeof e=="function"&&(t=e,e={}),ot(n,"rimraf: missing path"),ot.strictEqual(typeof n,"string","rimraf: path should be a string"),ot.strictEqual(typeof t,"function","rimraf: callback function required"),ot(e,"rimraf: invalid options argument provided"),ot.strictEqual(typeof e,"object","rimraf: options should be object"),CF(e),vF(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(()=>vF(n,e,r),s)}o.code==="ENOENT"&&(o=null)}t(o)})}function vF(n,e,t){ot(n),ot(e),ot(typeof t=="function"),e.lstat(n,(i,r)=>{if(i&&i.code==="ENOENT")return t(null);if(i&&i.code==="EPERM"&&id)return wF(n,e,i,t);if(r&&r.isDirectory())return Ip(n,e,i,t);e.unlink(n,o=>{if(o){if(o.code==="ENOENT")return t(null);if(o.code==="EPERM")return id?wF(n,e,o,t):Ip(n,e,o,t);if(o.code==="EISDIR")return Ip(n,e,o,t)}return t(o)})})}function wF(n,e,t,i){ot(n),ot(e),ot(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()?Ip(n,e,t,i):e.unlink(n,i)})})}function DF(n,e,t){let i;ot(n),ot(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 Nre(n){return Buffer.isBuffer(n)&&(n=n.toString("utf8")),n.replace(/^\uFEFF/,"")}aI.exports={stringify:Mre,stripBom:Nre}});var Ux=m((Nke,cI)=>{var Su;try{Su=Qe()}catch{Su=require("fs")}var Bp=gt(),{stringify:lI,stripBom:uI}=Cu();async function Bre(n,e={}){typeof e=="string"&&(e={encoding:e});let t=e.fs||Su,i="throws"in e?e.throws:!0,r=await Bp.fromCallback(t.readFile)(n,e);r=uI(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 Hre=Bp.fromPromise(Bre);function qre(n,e={}){typeof e=="string"&&(e={encoding:e});let t=e.fs||Su,i="throws"in e?e.throws:!0;try{let r=t.readFileSync(n,e);return r=uI(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||Su,r=lI(e,t);await Bp.fromCallback(i.writeFile)(n,r,t)}var Wre=Bp.fromPromise(Yre);function Zre(n,e,t={}){let i=t.fs||Su,r=lI(e,t);return i.writeFileSync(n,r,t)}var Jre={readFile:Hre,readFileSync:qre,writeFile:Wre,writeFileSync:Zre};cI.exports=Jre});var dI=m((Bke,hI)=>{"use strict";var Hp=Ux();hI.exports={readJson:Hp.readFile,readJsonSync:Hp.readFileSync,writeJson:Hp.writeFile,writeJsonSync:Hp.writeFileSync}});var qp=m((Hke,pI)=>{"use strict";var $re=gt().fromCallback,od=Qe(),gI=require("path"),fI=mr(),Xre=Ps().pathExists;function Ure(n,e,t,i){typeof t=="function"&&(i=t,t="utf8");let r=gI.dirname(n);Xre(r,(o,s)=>{if(o)return i(o);if(s)return od.writeFile(n,e,t,i);fI.mkdirs(r,a=>{if(a)return i(a);od.writeFile(n,e,t,i)})})}function Gre(n,...e){let t=gI.dirname(n);if(od.existsSync(t))return od.writeFileSync(n,...e);fI.mkdirsSync(t),od.writeFileSync(n,...e)}pI.exports={outputFile:$re(Ure),outputFileSync:Gre}});var bI=m((qke,mI)=>{"use strict";var{stringify:Qre}=Cu(),{outputFile:Kre}=qp();async function zre(n,e,t={}){let i=Qre(e,t);await Kre(n,i,t)}mI.exports=zre});var vI=m((Yke,yI)=>{"use strict";var{stringify:Vre}=Cu(),{outputFileSync:eoe}=qp();function toe(n,e,t){let i=Vre(e,t);eoe(n,i,t)}yI.exports=toe});var DI=m((Wke,wI)=>{"use strict";var ioe=gt().fromPromise,Yi=dI();Yi.outputJson=ioe(bI());Yi.outputJsonSync=vI();Yi.outputJSON=Yi.outputJson;Yi.outputJSONSync=Yi.outputJsonSync;Yi.writeJSON=Yi.writeJson;Yi.writeJSONSync=Yi.writeJsonSync;Yi.readJSON=Yi.readJson;Yi.readJSONSync=Yi.readJsonSync;wI.exports=Yi});var kI=m((Zke,TI)=>{"use strict";var CI=Qe(),Qx=require("path"),noe=Jx().copySync,SI=nd().removeSync,roe=mr().mkdirpSync,xI=Ua();function ooe(n,e,t){t=t||{};let i=t.overwrite||t.clobber||!1,{srcStat:r,isChangingCase:o=!1}=xI.checkPathsSync(n,e,"move",t);return xI.checkParentPathsSync(n,r,e,"move"),soe(e)||roe(Qx.dirname(e)),aoe(n,e,i,o)}function soe(n){let e=Qx.dirname(n);return Qx.parse(e).root===e}function aoe(n,e,t,i){if(i)return Gx(n,e,t);if(t)return SI(e),Gx(n,e,t);if(CI.existsSync(e))throw new Error("dest already exists.");return Gx(n,e,t)}function Gx(n,e,t){try{CI.renameSync(n,e)}catch(i){if(i.code!=="EXDEV")throw i;return loe(n,e,t)}}function loe(n,e,t){return noe(n,e,{overwrite:t,errorOnExist:!0}),SI(n)}TI.exports=ooe});var PI=m((Jke,EI)=>{"use strict";EI.exports={moveSync:kI()}});var II=m(($ke,FI)=>{"use strict";var uoe=Qe(),zx=require("path"),coe=$x().copy,LI=nd().remove,hoe=mr().mkdirp,doe=Ps().pathExists,_I=Ua();function goe(n,e,t,i){typeof t=="function"&&(i=t,t={});let r=t.overwrite||t.clobber||!1;_I.checkPaths(n,e,"move",t,(o,s)=>{if(o)return i(o);let{srcStat:a,isChangingCase:l=!1}=s;_I.checkParentPaths(n,a,e,"move",u=>{if(u)return i(u);if(foe(e))return RI(n,e,r,l,i);hoe(zx.dirname(e),c=>c?i(c):RI(n,e,r,l,i))})})}function foe(n){let e=zx.dirname(n);return zx.parse(e).root===e}function RI(n,e,t,i,r){if(i)return Kx(n,e,t,r);if(t)return LI(e,o=>o?r(o):Kx(n,e,t,r));doe(e,(o,s)=>o?r(o):s?r(new Error("dest already exists.")):Kx(n,e,t,r))}function Kx(n,e,t,i){uoe.rename(n,e,r=>r?r.code!=="EXDEV"?i(r):poe(n,e,t,i):i())}function poe(n,e,t,i){coe(n,e,{overwrite:t,errorOnExist:!0},o=>o?i(o):LI(n,i))}FI.exports=
`;function uj(n,e){if(Jr.existsSync(n))return;let t=Jr.openSync(n,e.flags,e.mode);Jr.closeSync(t)}var cj=class{constructor(e,t,i,r){_o("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=Jr.statSync(a).size}catch{uj(a,r)}return l}this.currentSize=s(this.filename)}shouldRoll(){return _o("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(`^${Tu.basename(e)}`);function r(u){return i.test(u)}function o(u){return parseInt(u.substring(`${Tu.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(_o(`Index of ${u} is ${c}`),t.backups===0)Jr.truncateSync(e,0);else if(c<t.backups){try{Jr.unlinkSync(`${e}.${c+1}`)}catch{}_o(`Renaming ${u} -> ${e}.${c+1}`),Jr.renameSync(Tu.join(Tu.dirname(e),u),`${e}.${c+1}`)}}function l(){_o("Renaming the old files"),Jr.readdirSync(Tu.dirname(e)).filter(r).sort(s).reverse().forEach(a)}_o("Rolling, rolling, rolling"),l()}write(e,t){let i=this;function r(){_o("writing the chunk to the file"),i.currentSize+=e.length,Jr.appendFileSync(i.filename,e)}_o("in write"),this.shouldRoll()&&(this.currentSize=0,this.roll(this.filename)),r()}};function $oe(n,e,t,i,r,o){_o("fileSync appender created"),n=Tu.normalize(n),i=!i&&i!==0?5:i;function s(l,u,c){let h;return u?h=new cj(l,u,c,o):h=(d=>(uj(d,o),{write(g){Jr.appendFileSync(d,g)}}))(l),h}let a=s(n,t,i);return l=>{a.write(e(l,r)+Joe)}}function Xoe(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 $oe(n.filename,t,n.maxLogSize,n.backups,n.timezoneOffset,i)}hj.exports.configure=Xoe});var fj=m((sEe,gj)=>{var $r=At()("log4js:tcp"),Uoe=require("net");function Goe(n,e){let t=!1,i=[],r,o=3,s="__LOG4JS__";function a(h){$r("Writing log event to socket"),t=r.write(`${e(h)}${s}`,"utf8")}function l(){let h;for($r("emptying buffer");h=i.shift();)a(h)}function u(){$r(`appender creating socket to ${n.host||"localhost"}:${n.port||5e3}`),s=`${n.endMsg||"__LOG4JS__"}`,r=Uoe.createConnection(n.port||5e3,n.host||"localhost"),r.on("connect",()=>{$r("socket connected"),l(),t=!0}),r.on("drain",()=>{$r("drain event received, emptying buffer"),t=!0,l()}),r.on("timeout",r.end.bind(r)),r.on("error",h=>{$r("connection error",h),t=!1,l()}),r.on("close",u)}u();function c(h){t?a(h):($r("buffering log event because it cannot write at the moment"),i.push(h))}return c.shutdown=function(h){$r("shutdown called"),i.length&&o?($r("buffer has items, waiting 100ms to empty"),o-=1,setTimeout(()=>{c.shutdown(h)},100)):(r.removeAllListeners("close"),r.end(h))},c}function Qoe(n,e){$r(`configure with config = ${n}`);let t=function(i){return i.serialise()};return n.layout&&(t=e.layout(n.layout.type,n.layout)),Goe(n,t)}gj.exports.configure=Qoe});var nC=m((aEe,iC)=>{var Koe=require("path"),Qa=At()("log4js:appenders"),Jn=Wa(),pj=kp(),zoe=$a(),Voe=Lx(),ese=vL(),yr=new Map;yr.set("console",DL());yr.set("stdout",CL());yr.set("stderr",TL());yr.set("logLevelFilter",EL());yr.set("categoryFilter",RL());yr.set("noLogFilter",IL());yr.set("file",sj());yr.set("dateFile",lj());yr.set("fileSync",dj());yr.set("tcp",fj());var ad=new Map,tC=(n,e)=>{Qa("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}},tse=(n,e)=>yr.get(n)||tC(`./${n}`,e)||tC(n,e)||""||tC(Koe.join(process.cwd(),n),e),Up=new Set,mj=(n,e)=>{if(ad.has(n))return ad.get(n);if(!e.appenders[n])return!1;if(Up.has(n))throw new Error(`Dependency loop detected for appender ${n}.`);Up.add(n),Qa(`Creating appender ${n}`);let t=ise(n,e);return Up.delete(n),ad.set(n,t),t},ise=(n,e)=>{let t=e.appenders[n],i=t.type.configure?t.type:tse(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=dse.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 Kp=class{constructor(e){if(!e)throw new Error("No category provided.");this.category=e,this.context={},this.parseCallStack=gse,Cj(`Logger created (${this.category}, ${this.level})`)}get level(){return Ro.getLevel(Qp.getLevelForCategory(this.category),Ro.TRACE)}set level(e){Qp.setLevelForCategory(this.category,Ro.getLevel(e,this.level))}get useCallStack(){return Qp.getEnableCallStackForCategory(this.category)}set useCallStack(e){Qp.setEnableCallStackForCategory(this.category,e===!0)}log(e,...t){let i=Ro.getLevel(e);i||(this._log(Ro.WARN,"log4js:logger.log: invalid value for log-level as first parameter given: ",e),i=Ro.INFO),this.isLevelEnabled(i)&&this._log(i,t)}isLevelEnabled(e){return this.level.isLessThanOrEqualTo(e)}_log(e,t){Cj(`sending log data (${e}) to appenders`);let i=new use(this.category,e,t,this.context,this.useCallStack&&this.parseCallStack(new Error));cse.send(i)}addContext(e,t){this.context[e]=t}removeContext(e){delete this.context[e]}clearContext(){this.context={}}setParseCallStackFunction(e){this.parseCallStack=e}};function Sj(n){let e=Ro.getLevel(n),i=e.toString().toLowerCase().replace(/_([a-z])/g,o=>o[1].toUpperCase()),r=i[0].toUpperCase()+i.slice(1);Kp.prototype[`is${r}Enabled`]=function(){return this.isLevelEnabled(e)},Kp.prototype[i]=function(...o){this.log(e,...o)}}Ro.levels.forEach(Sj);hse.addListener(()=>{Ro.levels.forEach(Sj)});Tj.exports=Kp});var _j=m((cEe,Pj)=>{var ku=$a(),fse=':remote-addr - - ":method :url HTTP/:http-version" :status :content-length ":referrer" ":user-agent"';function pse(n){return n.originalUrl||n.url}function mse(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:pse(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 Ej(n,e){for(let t=0;t<e.length;t++)n=n.replace(e[t].token,e[t].replacement);return n}function bse(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 yse(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=ku.getLevel(r.level,i))}return i}Pj.exports=function(e,t){typeof t=="string"||typeof t=="function"?t={format:t}:t=t||{};let i=e,r=ku.getLevel(t.level,ku.INFO),o=t.format||fse,s=bse(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=ku.INFO,l.statusCode>=300&&(r=ku.WARN),l.statusCode>=400&&(r=ku.ERROR)),r=yse(l.statusCode,r,t.statusRules);let d=mse(a,l,t.tokens||[]);if(t.context&&i.addContext("res",l),typeof o=="function"){let g=o(a,l,f=>Ej(f,d));g&&i.log(r,g)}else i.log(r,Ej(o,d));t.context&&i.remove
2022-05-18 13:29:28 -04:00
2022-05-27 03:57:56 -04:00
see https://github.com/jprichardson/node-fs-extra/issues/269`);let{srcStat:i,destStat:r}=dd.checkPathsSync(n,e,"copy");return dd.checkParentPathsSync(n,i,e,"copy"),Use(r,n,e,t)}function Use(n,e,t,i){if(i.filter&&!i.filter(e,t))return;let r=hd.dirname(t);return Ti.existsSync(r)||Jse(r),e1(n,e,t,i)}function e1(n,e,t,i){if(!(i.filter&&!i.filter(e,t)))return Gse(n,e,t,i)}function Gse(n,e,t,i){let o=(i.dereference?Ti.statSync:Ti.lstatSync)(e);if(o.isDirectory())return iae(o,n,e,t,i);if(o.isFile()||o.isCharacterDevice()||o.isBlockDevice())return Qse(o,n,e,t,i);if(o.isSymbolicLink())return oae(n,e,t,i)}function Qse(n,e,t,i,r){return e?Kse(n,t,i,r):t1(n,t,i,r)}function Kse(n,e,t,i){if(i.overwrite)return Ti.unlinkSync(t),t1(n,e,t,i);if(i.errorOnExist)throw new Error(`'${t}' already exists`)}function t1(n,e,t,i){return Ti.copyFileSync(e,t),i.preserveTimestamps&&zse(n.mode,e,t),fC(t,n.mode)}function zse(n,e,t){return Vse(n)&&eae(t,n),tae(e,t)}function Vse(n){return(n&128)===0}function eae(n,e){return fC(n,e|128)}function fC(n,e){return Ti.chmodSync(n,e)}function tae(n,e){let t=Ti.statSync(n);return $se(e,t.atime,t.mtime)}function iae(n,e,t,i,r){if(!e)return nae(n.mode,t,i,r);if(e&&!e.isDirectory())throw new Error(`Cannot overwrite non-directory '${i}' with directory '${t}'.`);return i1(t,i,r)}function nae(n,e,t,i){return Ti.mkdirSync(t),i1(e,t,i),fC(t,n)}function i1(n,e,t){Ti.readdirSync(n).forEach(i=>rae(i,n,e,t))}function rae(n,e,t,i){let r=hd.join(e,n),o=hd.join(t,n),{destStat:s}=dd.checkPathsSync(r,o,"copy");return e1(s,r,o,i)}function oae(n,e,t,i){let r=Ti.readlinkSync(e);if(i.dereference&&(r=hd.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=hd.resolve(process.cwd(),o)),dd.isSrcSubdir(r,o))throw new Error(`Cannot copy '${r}' to a subdirectory of itself, '${o}'.`);if(Ti.statSync(t).isDirectory()&&dd.isSrcSubdir(o,r))throw new Error(`Cannot overwrite '${o}' with '${r}'.`);return sae(r,t)}else return Ti.symlinkSync(r,t)}function sae(n,e){return Ti.unlinkSync(e),Ti.symlinkSync(n,e)}n1.exports=Xse});var pC=m((wEe,o1)=>{"use strict";o1.exports={copySync:r1()}});var Os=m((DEe,a1)=>{"use strict";var aae=gt().fromPromise,s1=ud();function lae(n){return s1.access(n).then(()=>!0).catch(()=>!1)}a1.exports={pathExists:aae(lae),pathExistsSync:s1.existsSync}});var m1=m((xEe,p1)=>{"use strict";var sn=Qe(),gd=require("path"),uae=vr().mkdirs,cae=Os().pathExists,hae=hC().utimesMillis,fd=cd();function dae(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;
2022-05-18 13:29:28 -04:00
2022-05-27 03:57:56 -04:00
see https://github.com/jprichardson/node-fs-extra/issues/269`),fd.checkPaths(n,e,"copy",(r,o)=>{if(r)return i(r);let{srcStat:s,destStat:a}=o;fd.checkParentPaths(n,s,e,"copy",l=>l?i(l):t.filter?h1(l1,a,n,e,t,i):l1(a,n,e,t,i))})}function l1(n,e,t,i,r){let o=gd.dirname(t);cae(o,(s,a)=>{if(s)return r(s);if(a)return mC(n,e,t,i,r);uae(o,l=>l?r(l):mC(n,e,t,i,r))})}function h1(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 mC(n,e,t,i,r){return i.filter?h1(u1,n,e,t,i,r):u1(n,e,t,i,r)}function u1(n,e,t,i,r){(i.dereference?sn.stat:sn.lstat)(e,(s,a)=>{if(s)return r(s);if(a.isDirectory())return vae(a,n,e,t,i,r);if(a.isFile()||a.isCharacterDevice()||a.isBlockDevice())return gae(a,n,e,t,i,r);if(a.isSymbolicLink())return xae(n,e,t,i,r)})}function gae(n,e,t,i,r,o){return e?fae(n,t,i,r,o):d1(n,t,i,r,o)}function fae(n,e,t,i,r){if(i.overwrite)sn.unlink(t,o=>o?r(o):d1(n,e,t,i,r));else return i.errorOnExist?r(new Error(`'${t}' already exists`)):r()}function d1(n,e,t,i,r){sn.copyFile(e,t,o=>o?r(o):i.preserveTimestamps?pae(n.mode,e,t,r):im(t,n.mode,r))}function pae(n,e,t,i){return mae(n)?bae(t,n,r=>r?i(r):c1(n,e,t,i)):c1(n,e,t,i)}function mae(n){return(n&128)===0}function bae(n,e,t){return im(n,e|128,t)}function c1(n,e,t,i){yae(e,t,r=>r?i(r):im(t,n,i))}function im(n,e,t){return sn.chmod(n,e,t)}function yae(n,e,t){sn.stat(n,(i,r)=>i?t(i):hae(e,r.atime,r.mtime,t))}function vae(n,e,t,i,r,o){return e?e&&!e.isDirectory()?o(new Error(`Cannot overwrite non-directory '${i}' with directory '${t}'.`)):g1(t,i,r,o):wae(n.mode,t,i,r,o)}function wae(n,e,t,i,r){sn.mkdir(t,o=>{if(o)return r(o);g1(e,t,i,s=>s?r(s):im(t,n,r))})}function g1(n,e,t,i){sn.readdir(n,(r,o)=>r?i(r):f1(o,n,e,t,i))}function f1(n,e,t,i,r){let o=n.pop();return o?Dae(n,o,e,t,i,r):r()}function Dae(n,e,t,i,r,o){let s=gd.join(t,e),a=gd.join(i,e);fd.checkPaths(s,a,"copy",(l,u)=>{if(l)return o(l);let{destStat:c}=u;mC(c,s,a,r,h=>h?o(h):f1(n,t,i,r,o))})}function xae(n,e,t,i,r){sn.readlink(e,(o,s)=>{if(o)return r(o);if(i.dereference&&(s=gd.resolve(process.cwd(),s)),n)sn.readlink(t,(a,l)=>a?a.code==="EINVAL"||a.code==="UNKNOWN"?sn.symlink(s,t,r):r(a):(i.dereference&&(l=gd.resolve(process.cwd(),l)),fd.isSrcSubdir(s,l)?r(new Error(`Cannot copy '${s}' to a subdirectory of itself, '${l}'.`)):n.isDirectory()&&fd.isSrcSubdir(l,s)?r(new Error(`Cannot overwrite '${l}' with '${s}'.`)):Cae(s,t,r)));else return sn.symlink(s,t,r)})}function Cae(n,e,t){sn.unlink(e,i=>i?t(i):sn.symlink(n,e,t))}p1.exports=dae});var bC=m((CEe,b1)=>{"use strict";var Sae=gt().fromCallback;b1.exports={copy:Sae(m1())}});var k1=m((SEe,T1)=>{"use strict";var y1=Qe(),x1=require("path"),st=require("assert"),pd=process.platform==="win32";function C1(n){["unlink","chmod","stat","lstat","rmdir","readdir"].forEach(t=>{n[t]=n[t]||y1[t],t=t+"Sync",n[t]=n[t]||y1[t]}),n.maxBusyTries=n.maxBusyTries||3}function yC(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"),C1(e),v1(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(()=>v1(n,e,r),s)}o.code==="ENOENT"&&(o=null)}t(o)})}function v1(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"&&pd)return w1(n,e,i,t);if(r&&r.isDirectory())return nm(n,e,i,t);e.unlink(n,o=>{if(o){if(o.code==="ENOENT")return t(null);if(o.code==="EPERM")return pd?w1(n,e,o,t):nm(n,e,o,t);if(o.code==="EISDIR")return nm(n,e,o,t)}return t(o)})})}function w1(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()?nm(n,e,t,i):e.unlink(n,i)})})}function D1(n,e,t){let i;st(n),st(e);try{e.chmodSync(n,438)}catch(r){if(r.code==="ENOENT")return;throw t}try{i
2022-05-18 13:29:28 -04:00
`+i.split(/\r?\n/).slice(3).join(`
2022-05-27 03:57:56 -04:00
`),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?[Fce?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))}};km.BaseApi=mM});var _d=m(Em=>{"use strict";Object.defineProperty(Em,"__esModule",{value:!0});Em.Buffer=void 0;var Ice=Pd(),bM=class extends Ice.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){DM!="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){DM!="trace"||this.stream==null||this.stream.write(this.getText("trace",e,t))}};function Zce(n){return new CM(n)}Ys.createLogger=Zce});var rS=m(nS=>{"use strict";Object.defineProperty(nS,"__esModule",{value:!0});var Jce=require("events"),$ce=Wu(),SM=process.env.NODE_CLIENT_LOG_LEVEL=="debug",Fd=(0,$ce.createLogger)("transport"),TM=class extends Jce.EventEmitter{constructor(e){super();this.logger=e,this.pauseLevel=0,this.paused=new Map}debug(e,...t){!SM||Fd.debug(e,...t)}info(e,...t){Fd.info(e,...t)}debugMessage(e){if(!SM)return;let t=e[0];t==0?Fd.debug("receive request:",e.slice(1)):t==1||(t==2?Fd.debug("receive notification:",e.slice(1)):Fd.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])}};nS.default=TM});var PM=m(Un=>{"use strict";var Xce=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]}),Uce=Un&&Un.__setModuleDefault||(Object.create?function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}:function(n,e){n.default=e}),Gce=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)&&Xce(e,n,t);return Uce(e,n),e},kM=Un&&Un.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(Un,"__esModule",{value:!0});Un.NvimTransport=void 0;var Ao=Gce(gM()),Qce=kM(pM()),Kce=wM(),zce=kM(rS()),EM=class extends zce.default{constructor(e){super(e);this.pending=new Map,this.nextRequestId=1,this.attached=!1;let t=this.setupCodec();this.encodeStream=Ao.createEncodeStream({codec:t}),this.decodeStream=Ao.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=Ao.createCodec();return Kce.Metadata.forEach(({constructor:t},i)=>{e.addExtPacker(i,t,r=>Ao.encode(r.data)),e.addExtUnpacker(i,r=>new t({transport:this,client:this.client,data:Ao.decode(r)}))}),this.codec=e,this.codec}attach(e,t,i){this.encodeStream=this.encodeStream.pipe(e);let r=new Qce.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{Zu.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()}};Id.default=RM});var IM=m(oS=>{"use strict";Object.defineProperty(oS,"__esModule",{value:!0});var ihe=Wu(),_Pe=(0,ihe.createLogger)("request"),nhe=process.env.COC_NVIM=="1"?"coc#api#call":"nvim#api#call",FM=class{constructor(e,t,i){this.connection=e,this.cb=t,this.id=i}request(e,t=[]){this.method=e,this.connection.call(nhe,[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)}}};oS.default=FM});var AM=m(Ju=>{"use strict";var sS=Ju&&Ju.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(Ju,"__esModule",{value:!0});Ju.VimTransport=void 0;var rhe=sS(rS()),ohe=sS(LM()),she=sS(IM()),jM=class extends rhe.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 ohe.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 she.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])}}}};Ju.VimTransport=jM});var MM=m(Rm=>{"use strict";Object.defineProperty(Rm,"__esModule",{value:!0});Rm.Neovim=void 0;var ahe=Pd(),lhe=_d(),uhe=Ld(),che=Rd(),hhe=process.env.VIM_NODE_RPC=="1",OM=class extends ahe.BaseApi{constructor(){super(...arguments);this.prefix="nvim_",this.Buffer=lhe.Buffer,this.Window=che.Window,this.Tabpage=uhe.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):hhe?(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()}};Rm.Neovim=OM});var Fm=m($u=>{"use strict";Object.defineProperty($u,"__esModule",{value:!0});$u.NeovimClient=$u.AsyncResponse=void 0;var dhe=PM(),ghe=AM(),fhe=MM(),phe=_d(),mhe=Rd(),bhe=Ld(),yhe=Wu(),NM=(0,yhe.createLogger)("client"),Lm=process.env.VIM_NODE_RPC=="1",aS=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)}}};$u.AsyncResponse=aS;var BM=class extends fhe.Neovim{constructor(e){super({});this.logger=e,this.requestId=1,this.responses=new Map,this.attachedBuffers=new Map,this.isVim=Lm,Object.defineProperty(this,"client",{value:this});let t=Lm?new ghe.VimTransport(e):new dhe.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 phe.Buffer({transport:this.transport,data:e,client:this})}createWindow(e){return new mhe.Window({transport:this.transport,data:e,client:this})}createTabpage(e){return new bhe.Tabpage({transport:this.transport,data:e,client:this})}send(e){this.transport.send(e)}redrawVim(e){!Lm||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 aS(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
`,WM=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 Rhe:switch(e){case 0:e=1;break;case 2:e=3;break;default:e=0}break;case Lhe: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(Fhe);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}};jm.AbstractMessageBuffer=WM});var GM=m(gS=>{"use strict";Object.defineProperty(gS,"__esModule",{value:!0});var Ihe=Oo(),JM=require("util"),ll=hS(),jhe=ZM(),Od=class extends jhe.AbstractMessageBuffer{constructor(e="utf-8"){super(e)}emptyBuffer(){return Od.emptyBuffer}fromString(e,t){return Buffer.from(e,t)}toString(e,t){return e instanceof Buffer?e.toString(t):new JM.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)}};Od.emptyBuffer=Buffer.allocUnsafe(0);var $M=class{constructor(e){this.stream=e}onClose(e){return this.stream.on("close",e),ll.Disposable.create(()=>this.stream.off("close",e))}onError(e){return this.stream.on("error",e),ll.Disposable.create(()=>this.stream.off("error",e))}onEnd(e){return this.stream.on("end",e),ll.Disposable.create(()=>this.stream.off("end",e))}onData(e){return this.stream.on("data",e),ll.Disposable.create(()=>this.stream.off("data",e))}},XM=class{constructor(e){this.stream=e}onClose(e){return this.stream.on("close",e),ll.Disposable.create(()=>this.stream.off("close",e))}onError(e){return this.stream.on("error",e),ll.Disposable.create(()=>this.stream.off("error",e))}onEnd(e){return this.stream.on("end",e),ll.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()}},UM=Object.freeze({messageBuffer:Object.freeze({create:n=>new Od(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 JM.TextDecoder(e.charset).decode(n)))}catch(t){return Promise.reject(t)}}})}),stream:Object.freeze({asReadableStream:n=>new $M(n),asWritableStream:n=>new XM(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 dS(){return UM}(function(n){function e(){Ihe.default.install(UM)}n.install=e})(dS||(dS={}));gS.def
`,Khe;(function(n){function e(t){let i=t;return i&&Nd.func(i.dispose)&&Nd.func(i.onClose)&&Nd.func(i.onError)&&Nd.func(i.write)}n.is=e})(Khe=No.MessageWriter||(No.MessageWriter={}));var CS=class{constructor(){this.errorEmitter=new _N.Emitter,this.closeEmitter=new _N.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: ${Nd.string(e.message)?e.message:"unknown"}`)}};No.AbstractMessageWriter=CS;var xS;(function(n){function e(t){var i,r;return t===void 0||typeof t=="string"?{charset:t!=null?t:"utf-8",contentTypeEncoder:PN.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:PN.default().applicationJson.encoder}}n.fromOptions=e})(xS||(xS={}));var LN=class extends CS{constructor(e,t){super();this.writable=e,this.options=xS.fromOptions(t),this.errorCount=0,this.writeSemaphore=new Ghe.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(Qhe,i.byteLength.toString(),RN),r.push(RN),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()}};No.WriteableStreamMessageWriter=LN});var jN=m(Bo=>{"use strict";Object.defineProperty(Bo,"__esModule",{value:!0});Bo.LRUCache=Bo.LinkedMap=Bo.Touch=void 0;var $i;(function(n){n.None=0,n.First=1,n.AsOld=n.First,n.Last=2,n.AsNew=n.Last})($i=Bo.Touch||(Bo.Touch={}));var SS=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=$i.None){let i=this._map.get(e);if(!!i)return t!==$i.None&&this.touch(i,t),i.value}set(e,t,i=$i.None){let r=this._map.get(e);if(r)r.value=t,i!==$i.None&&this.touch(r,i);else{switch(r={key:e,value:t,next:void 0,previous:void 0},i){case $i.None:this.addItemLast(r);break;case $i.First:this.addItemFirst(r);break;case $i.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(P.error,void 0,4)}`):r.error("Received response message without id. No further error information provided.");else{let $=String(P.id),G=b[$];if(kn(P,G),G){delete b[$];try{if(P.error){let ce=P.error;G.reject(new me.ResponseError(ce.code,ce.message,ce.data))}else if(P.result!==void 0)G.resolve(P.result);else throw new Error("Should never happen.")}catch(ce){ce.message?r.error(`Response handler '${G.method}' failed with message: ${ce.message}`):r.error(`Response handler '${G.method}' failed unexpectedly.`)}}}}function Le(P){if(kt())return;let $,G;if(P.method===Hd.type.method)G=ce=>{let Ye=ce.id,It=v[String(Ye)];It&&It.cancel()};else{let ce=d[P.method];ce&&(G=ce.handler,$=ce.type)}if(G||h)try{fr(P),G?P.params===void 0?($!==void 0&&$.numberOfParams!==0&&$.parameterStructures!==me.ParameterStructures.byName&&r.error(`Notification ${P.method} defines ${$.numberOfParams} params but recevied none.`),G()):Array.isArray(P.params)?($!==void 0&&($.parameterStructures===me.ParameterStructures.byName&&r.error(`Notification ${P.method} defines parameters by name but received parameters by position`),$.numberOfParams!==P.params.length&&r.error(`Notification ${P.method} defines ${$.numberOfParams} params but received ${P.params.length} argumennts`)),G(...P.params)):($!==void 0&&$.parameterStructures===me.ParameterStructures.byPosition&&r.error(`Notification ${P.method} defines parameters by position but received parameters by name`),G(P.params)):h&&h(P.method,P.params)}catch(ce){ce.message?r.error(`Notification handler '${P.method}' failed with message: ${ce.message}`):r.error(`Notification handler '${P.method}' failed unexpectedly.`)}else W.fire(P)}function Se(P){if(!P){r.error("Received empty message.");return}r.error(`Received message which is neither a response nor a notification message:
${JSON.stringify(P,null,4)}`);let $=P;if(ai.string($.id)||ai.number($.id)){let G=String($.id),ce=b[G];ce&&ce.reject(new Error("The received response has neither a result nor an error property."))}}function Te(P){if(!(w===Zt.Off||!S))if(D===Dr.Text){let $;w===Zt.Verbose&&P.params&&($=`Params: ${JSON.stringify(P.params,null,4)}
2022-05-18 13:29:28 -04:00
2022-05-27 03:57:56 -04:00
`),S.log(`Sending request '${P.method} - (${P.id})'.`,$)}else vs("send-request",P)}function Fe(P){if(!(w===Zt.Off||!S))if(D===Dr.Text){let $;w===Zt.Verbose&&(P.params?$=`Params: ${JSON.stringify(P.params,null,4)}
2022-05-18 13:29:28 -04:00
`:$=`No parameters provided.
2022-05-27 03:57:56 -04:00
`),S.log(`Sending notification '${P.method}'.`,$)}else vs("send-notification",P)}function Ft(P,$,G){if(!(w===Zt.Off||!S))if(D===Dr.Text){let ce;w===Zt.Verbose&&(P.error&&P.error.data?ce=`Error data: ${JSON.stringify(P.error.data,null,4)}
2022-05-18 13:29:28 -04:00
2022-05-27 03:57:56 -04:00
`:P.result?ce=`Result: ${JSON.stringify(P.result,null,4)}
2022-05-18 13:29:28 -04:00
2022-05-27 03:57:56 -04:00
`:P.error===void 0&&(ce=`No result returned.
2022-05-18 13:29:28 -04:00
2022-05-27 03:57:56 -04:00
`)),S.log(`Sending response '${$} - (${P.id})'. Processing request took ${Date.now()-G}ms`,ce)}else vs("send-response",P)}function gr(P){if(!(w===Zt.Off||!S))if(D===Dr.Text){let $;w===Zt.Verbose&&P.params&&($=`Params: ${JSON.stringify(P.params,null,4)}
2022-05-18 13:29:28 -04:00
2022-05-27 03:57:56 -04:00
`),S.log(`Received request '${P.method} - (${P.id})'.`,$)}else vs("receive-request",P)}function fr(P){if(!(w===Zt.Off||!S||P.method===ES.type.method))if(D===Dr.Text){let $;w===Zt.Verbose&&(P.params?$=`Params: ${JSON.stringify(P.params,null,4)}
2022-05-18 13:29:28 -04:00
`:$=`No parameters provided.
2022-05-27 03:57:56 -04:00
`),S.log(`Received notification '${P.method}'.`,$)}else vs("receive-notification",P)}function kn(P,$){if(!(w===Zt.Off||!S))if(D===Dr.Text){let G;if(w===Zt.Verbose&&(P.error&&P.error.data?G=`Error data: ${JSON.stringify(P.error.data,null,4)}
2022-05-18 13:29:28 -04:00
2022-05-19 10:14:37 -04:00
`:P.result?G=`Result: ${JSON.stringify(P.result,null,4)}
2022-05-18 13:29:28 -04:00
2022-05-19 10:14:37 -04:00
`:P.error===void 0&&(G=`No result returned.
2022-05-18 13:29:28 -04:00
2022-05-27 03:57:56 -04:00
`)),$){let ce=P.error?` Request failed: ${P.error.message} (${P.error.code}).`:"";S.log(`Received response '${$.method} - (${P.id})' in ${Date.now()-$.timerStart}ms.${ce}`,G)}else S.log(`Received response ${P.id} without active response promise.`,G)}else vs("receive-response",P)}function vs(P,$){if(!S||w===Zt.Off)return;let G={isLSPMessage:!0,type:P,message:$,timestamp:Date.now()};S.log(G)}function ws(){if(Ve())throw new dl(Nm.Closed,"Connection is closed.");if(kt())throw new dl(Nm.Disposed,"Connection is disposed.")}function Ute(){if(Re())throw new dl(Nm.AlreadyListening,"Connection is already listening")}function Gte(){if(!Re())throw new Error("Call listen() first.")}function Yh(P){return P===void 0?null:P}function fR(P){if(P!==null)return P}function pR(P){return P!=null&&!Array.isArray(P)&&typeof P=="object"}function Tx(P,$){switch(P){case me.ParameterStructures.auto:return pR($)?fR($):[Yh($)];case me.ParameterStructures.byName:if(!pR($))throw new Error("Recevied parameters by name but param is not an object literal.");return fR($);case me.ParameterStructures.byPosition:return[Yh($)];default:throw new Error(`Unknown parameter structure ${P.toString()}`)}}function mR(P,$){let G,ce=P.numberOfParams;switch(ce){case 0:G=void 0;break;case 1:G=Tx(P.parameterStructures,$[0]);break;default:G=[];for(let Ye=0;Ye<$.length&&Ye<ce;Ye++)G.push(Yh($[Ye]));if($.length<ce)for(let Ye=$.length;Ye<ce;Ye++)G.push(null);break}return G}let fu={sendNotification:(P,...$)=>{ws();let G,ce;if(ai.string(P)){G=P;let It=$[0],Qt=0,ri=me.ParameterStructures.auto;me.ParameterStructures.is(It)&&(Qt=1,ri=It);let $e=$.length,jt=$e-Qt;switch(jt){case 0:ce=void 0;break;case 1:ce=Tx(ri,$[Qt]);break;default:if(ri===me.ParameterStructures.byName)throw new Error(`Recevied ${jt} parameters for 'by Name' notification parameter structure.`);ce=$.slice(Qt,$e).map(Xe=>Yh(Xe));break}}else{let It=$;G=P.method,ce=mR(P,It)}let Ye={jsonrpc:l,method:G,params:ce};Fe(Ye),e.write(Ye)},onNotification:(P,$)=>{ws();let G;return ai.func(P)?h=P:$&&(ai.string(P)?(G=P,d[P]={type:void 0,handler:$}):(G=P.method,d[P.method]={type:P,handler:$})),{dispose:()=>{G!==void 0?delete d[G]:h=void 0}}},onProgress:(P,$,G)=>{if(g.has($))throw new Error(`Progress handler for token ${$} already registered`);return g.set($,G),{dispose:()=>{g.delete($)}}},sendProgress:(P,$,G)=>{fu.sendNotification(Bm.type,{token:$,value:G})},onUnhandledProgress:N.event,sendRequest:(P,...$)=>{ws(),Gte();let G,ce,Ye;if(ai.string(P)){G=P;let $e=$[0],jt=$[$.length-1],Xe=0,Kt=me.ParameterStructures.auto;me.ParameterStructures.is($e)&&(Xe=1,Kt=$e);let nn=$.length;TS.CancellationToken.is(jt)&&(nn=nn-1,Ye=jt);let Na=nn-Xe;switch(Na){case 0:ce=void 0;break;case 1:ce=Tx(Kt,$[Xe]);break;default:if(Kt===me.ParameterStructures.byName)throw new Error(`Recevied ${Na} parameters for 'by Name' request parameter structure.`);ce=$.slice(Xe,nn).map(Ds=>Yh(Ds));break}}else{let $e=$;G=P.method,ce=mR(P,$e);let jt=P.numberOfParams;Ye=TS.CancellationToken.is($e[jt])?$e[jt]:void 0}let It=o++,Qt;return Ye&&(Qt=Ye.onCancellationRequested(()=>{F.sender.sendCancellation(fu,It)})),new Promise(($e,jt)=>{let Xe={jsonrpc:l,id:It,method:G,params:ce},Kt=Ds=>{$e(Ds),F.sender.cleanup(It),Qt==null||Qt.dispose()},nn=Ds=>{jt(Ds),F.sender.cleanup(It),Qt==null||Qt.dispose()},Na={method:G,timerStart:Date.now(),resolve:Kt,reject:nn};Te(Xe);try{e.write(Xe)}catch(Ds){Na.reject(new me.ResponseError(me.ErrorCodes.MessageWriteError,Ds.message?Ds.message:"Unknown reason")),Na=null}Na&&(b[String(It)]=Na)})},onRequest:(P,$)=>{ws();let G=null;return kS.is(P)?(G=void 0,u=P):ai.string(P)?(G=null,$!==void 0&&(G=P,c[P]={handler:$,type:void 0})):$!==void 0&&(G=P.method,c[P.method]={type:P,handler:$}),{dispose:()=>{G!==null&&(G!==void 0?delete c[G]:u=void 0)}}},trace:(P,$,G)=>{let ce=!1,Ye=Dr.Text;G!==void 0&&(ai.boolean(G)?ce=G:(ce=G.sendNotification||!1,Ye=G.traceFormat||Dr.Text)),w=P,D=Ye,w===Zt.Off?S=void 0:S=$,ce&&!Ve()&&!kt()&&fu.sendNotification(NN.type,{value:Zt.toString(P)})},onError:I.event,onClose:j.event,onUnhandledNotification:W.event,onDispose:B.event,end:()=>
2022-05-18 13:29:28 -04:00
`,`\r
2022-05-27 03:57:56 -04:00
`,"\r"];(function(n){function e(o,s,a,l){return new bde(o,s,a,l)}n.create=e;function t(o){var s=o;return!!(Y.defined(s)&&Y.string(s.uri)&&(Y.undefined(s.languageId)||Y.string(s.languageId))&&Y.uinteger(s.lineCount)&&Y.func(s.getText)&&Y.func(s.positionAt)&&Y.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}})(y0||(y0={}));bde=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===`
2022-05-18 13:29:28 -04:00
`,o==="\r"&&r+1<t.length&&t.charAt(r+1)===`
2022-05-27 03:57:56 -04:00
`&&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 Vt.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 Vt.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})(Y||(Y={}))});var li=m(Qn=>{"use strict";Object.defineProperty(Qn,"__esModule",{value:!0});Qn.ProtocolNotificationType=Qn.ProtocolNotificationType0=Qn.ProtocolRequestType=Qn.ProtocolRequestType0=Qn.RegistrationType=void 0;var ic=Vu(),QN=class{constructor(e){this.method=e}};Qn.RegistrationType=QN;var KN=class extends ic.RequestType0{constructor(e){super(e)}};Qn.ProtocolRequestType0=KN;var zN=class extends ic.RequestType{constructor(e){super(e,ic.ParameterStructures.byName)}};Qn.ProtocolRequestType=zN;var VN=class extends ic.NotificationType0{constructor(e){super(e)}};Qn.ProtocolNotificationType0=VN;var eB=class extends ic.NotificationType{constructor(e){super(e,ic.ParameterStructures.byName)}};Qn.ProtocolNotificationType=eB});var nB=m(Jt=>{"use strict";Object.defineProperty(Jt,"__esModule",{value:!0});Jt.objectLiteral=Jt.typedArray=Jt.stringArray=Jt.array=Jt.func=Jt.error=Jt.number=Jt.string=Jt.boolean=void 0;function yde(n){return n===!0||n===!1}Jt.boolean=yde;function tB(n){return typeof n=="string"||n instanceof String}Jt.string=tB;function vde(n){return typeof n=="number"||n instanceof Number}Jt.number=vde;function wde(n){return n instanceof Error}Jt.error=wde;function Dde(n){return typeof n=="function"}Jt.func=Dde;function iB(n){return Array.isArray(n)}Jt.array=iB;function xde(n){return iB(n)&&n.every(e=>tB(e))}Jt.stringArray=xde;function Cde(n,e){return Array.isArray(n)&&n.every(e)}Jt.typedArray=Cde;function Sde(n){return n!==null&&typeof n=="object"}Jt.objectLiteral=Sde});var rB=m(Jd=>{"use strict";Object.defineProperty(Jd,"__esModule",{value:!0});Jd.ImplementationRequest=void 0;var Tde=li(),kde;(function(n){n.method="textDocument/implementation",n.type=new Tde.ProtocolRequestType(n.method)})(kde=Jd.ImplementationRequest||(Jd.ImplementationRequest={}))});var oB=m($d=>{"use strict";Object.defineProperty($d,"__esModule",{value:!0});$d.TypeDefinitionRequest=void 0;var Ede=li(),Pde;(function(n){n.method="textDocument/typeDefinition",n.type=new Ede.ProtocolRequestType(n.method)})(Pde=$d.TypeDefinitionRequest||($d.TypeDefinitionRequest={}))});var aB=m($s=>{"use strict";Object.defineProperty($s,"__esModule",{value:!0});$s.DidChangeWorkspaceFoldersNotification=$s.WorkspaceFoldersRequest=void 0;var sB=li(),_de;(function(n){n.type=new sB.ProtocolRequestType0("workspace/workspaceFolders")})(_de=$s.WorkspaceFoldersRequest||($s.WorkspaceFoldersRequest={}));var Rde;(function(n){n.type=new sB.ProtocolNotificationType("workspace/didChangeWorkspaceFolders")})(Rde=$s.DidChangeWorkspaceFoldersNotification||($s.DidChangeWorkspaceFoldersNotification={}))});var lB=m(Xd=>{"use str
2022-05-18 13:29:28 -04:00
${s}
2022-05-27 03:57:56 -04:00
${l}`));return}i(a)})})}function lc(n,e){let t=(0,uH.default)(e,100);try{let i=cH.default.watch(n,{persistent:!0,recursive:!1,encoding:"utf8"},()=>{t()});return pl.Disposable.create(()=>{t.clear(),i.close()})}catch{return pl.Disposable.create(()=>{t.clear()})}}function fH(n){try{return process.kill(n,0)==!0}catch(e){return e.code==="EPERM"}}function R0(n){return n=="n"||n=="o"||n=="x"||n=="v"?"<C-U>":n=="i"?"<C-o>":n=="s"?"<Esc>":""}function og(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 lH,uH,cH,hH,_0,pl,dH,L_e,Er,z=_(()=>{"use strict";lH=require("child_process"),uH=C(Pi()),cH=C(require("fs")),hH=C(S0()),_0=C(require("path")),pl=C(H());we();dH=C(ig());ac();L_e=q()("util-index"),Er="coc-settings.json"});function uc(n){return n&&typeof n.word=="string"&&n.user_data!==""}function Kn(n){return typeof n=="boolean"}function Ee(n){return typeof n=="string"}function eb(n){return typeof n=="number"}function Qs(n){return typeof n=="function"}function Pt(n){return n!=null&&typeof n=="object"&&!Array.isArray(n)&&!(n instanceof RegExp)&&!(n instanceof Date)}function pH(n){if(!Pt(n))return!1;for(let e in n)if(upe.call(n,e))return!1;return!0}function L0(n,e){return Array.isArray(n)&&n.every(e)}var upe,In=_(()=>{"use strict";upe=Object.prototype.hasOwnProperty});function Pr(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]=Pr(n[t]):e[t]=n[t]}),e}function mH(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(cpe.call(t,i)){let r=t[i];typeof r=="object"&&!Object.isFrozen(r)&&e.push(r)}}return n}function F0(n,e,t=!0){return Pt(n)?(Pt(e)&&Object.keys(e).forEach(i=>{i in n?t&&(Pt(n[i])&&Pt(e[i])?F0(n[i],e[i],t):n[i]=e[i]):n[i]=e[i]}),n):e}function Pe(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(!Pe(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(),!Pe(r,o))return!1;for(t=0;t<r.length;t++)if(!Pe(n[r[t]],e[r[t]]))return!1}return!0}var cpe,Ht=_(()=>{"use strict";In();cpe=Object.prototype.hasOwnProperty});function bH(n){return n>=97&&n<=122?1:n>=65&&n<=90?2:0}function yH(n,e){let t=e==0?0:bH(n[e-1]);for(let i=e;i<n.length;i++){let r=bH(n[i]);if(r>0&&r!=t)return[i,n[i]];t=r}}function vH(n,e){let t=[];for(let i=0;i<n.length;i++)n[i]==e&&t.push(i);return t}function Q(n){return Buffer.byteLength(n)}function hn(n){return(n==null?void 0:n.length)>0?n[0].toUpperCase()+n.slice(1):""}function Ze(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 et(n,e,t){return Buffer.from(n,"utf8").slice(e,t).toString("utf8")}function hc(n){let e=n.charCodeAt(0);return e>128?!1:!!(e==95||e>=48&&e<=57||I0(e))}function I0(n){return n>=65&&n<=90||n>=97&&n<=122}function wH(n,e){return e&&n.endsWith(`
2022-05-18 13:29:28 -04:00
`)?n.slice(0,-1).split(`
`):n.split(`
2022-05-27 03:57:56 -04:00
`)}var _e=_(()=>{"use strict"});var dc,hpe,DH,E,ae=_(()=>{"use strict";dc=C(H());z();Ht();_e();hpe=q()("events"),DH=class{constructor(){this.handlers=new Map;this._recentInserts=[];this._lastChange=0;this._insertMode=!1;this._pumAlignTop=!1;this._pumVisible=!1;this.completing=!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(()=>{Z(i),r(void 0)},t);i.push(dc.Disposable.create(()=>{clearTimeout(o)}))}else dc.CancellationToken.is(t)&&t.onCancellationRequested(()=>{Z(i),r(void 0)},null,i);e.forEach(o=>{this.on(o,(...s)=>{Z(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=et((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&&Pe(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;hpe.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 dc.Disposable.create(()=>{Z(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=dc.Disposable.create(()=>{let l=o.indexOf(s);l!==-1&&o.splice(l,1)});return Array.isArray(r)&&r.push(a),a}}},E=new DH});function PH(){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 dpe(n){gc=n}function ui(n,e){if(e){if(gpe.test(n))return n.replace(fpe,xH)}else if(ppe.test(n))return n.replace(mpe,xH);return n}function _H(n){return n.replace(ype,(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 lt(n,e){n=n.source||n,e=e||"";let t={replace:(i,r)=>(r=r.source||r,r=r.replace(vpe,"$1"),n=n.replace(i,r),t),getRegex:()=>new RegExp(n,e)};return t}function CH(n,e,t){if(n){let i;try{i=decodeURIComponent(_H(t)).replace(wpe,"").toLowerCase()}catch{return null}if(i.indexOf("javascript:")===0||i.indexOf("vbscript:")===0||i.indexOf("data:")===0)return null}e&&!Dpe.test(t)&&(t=Tpe(e,t));try{t=encodeURI(t).replace(/%25/g,"%")}catch{return null}return t}function Tpe(n,e){tb[" "+n]||(xpe.test(n)?tb[" "+n]=n+"/":tb[
2022-05-18 13:29:28 -04:00
`).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(`
2022-05-27 03:57:56 -04:00
`)}function Ppe(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 EH(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 fe(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=_r({},fe.defaults,e||{}),RH(e),t){let i=e.highlight,r;try{r=zr.lex(n,e)}catch(a){return t(a)}let o=function(a){let l;if(!a)try{e.walkTokens&&fe.walkTokens(r,e.walkTokens),l=Vr.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;fe.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=zr.lex(n,e);return e.walkTokens&&fe.walkTokens(i,e.walkTokens),Vr.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>"+ui(i.message+"",!0)+"</pre>";throw i}}var gc,gpe,fpe,ppe,mpe,bpe,xH,ype,vpe,wpe,Dpe,tb,xpe,Cpe,Spe,nb,rb,he,ee,zr,ob,j0,A0,Vr,B_e,H_e,q_e,Y_e,W_e,Z_e,J_e,LH=_(()=>{gc=PH();gpe=/[&<>"']/,fpe=/[&<>"']/g,ppe=/[<>"']|&(?!#?\w+;)/,mpe=/[<>"']|&(?!#?\w+;)/g,bpe={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},xH=n=>bpe[n];ype=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;vpe=/(^|[^\[])\^/g;wpe=/[^\w:]/g,Dpe=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;tb={},xpe=/^[^:]+:\/*[^/]*$/,Cpe=/^([^:]+:)[\s\S]*$/,Spe=/^([^:]+:\/*[^/]*)[\s\S]*$/;nb={exec:function(){}};rb=class{constructor(e){this.options=e||gc}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:ib(i,`
`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let i=t[0],r=Epe(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=ib(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,v={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(`
2022-05-18 13:29:28 -04:00
`,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+`
2022-05-27 03:57:56 -04:00
`,e=e.substring(h.length+1),f=!0),!f){let S=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," ")),!S.test(c));){if(c.search(/[^ ]/)>=s||!c.trim())g+=`
2022-05-18 13:29:28 -04:00
`+c.slice(s);else if(!l)g+=`
`+c;else break;!l&&!c.trim()&&(l=!0),i+=d+`
2022-05-27 03:57:56 -04:00
`,e=e.substring(d.length+1)}}v.loose||(u?v.loose=!0:/\n *\n *$/.test(i)&&(u=!0)),this.options.gfm&&(r=/^\[[ xX]\] /.exec(g),r&&(o=r[0]!=="[ ] ",g=g.replace(/^\[[ xX]\] +/,""))),v.items.push({type:"list_item",raw:i,task:!!r,checked:o,loose:!1,text:g}),v.raw+=i}v.items[v.items.length-1].raw=i.trimRight(),v.items[v.items.length-1].text=g.trimRight(),v.raw=v.raw.trimRight();let D=v.items.length;for(a=0;a<D;a++){this.lexer.state.top=!1,v.items[a].tokens=this.lexer.blockTokens(v.items[a].text,[]);let S=v.items[a].tokens.filter(I=>I.type==="space"),L=S.every(I=>{let j=I.raw.split(""),W=0;for(let N of j)if(N===`
`&&(W+=1),W>1)return!0;return!1});!v.loose&&S.length&&L&&(v.loose=!0,v.items[a].loose=!0)}return v}}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]):ui(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:SH(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]=SH(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:ui(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]):ui(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=ib(i.slice(0,-1),"\\");if((i.length-s.length)%2===0)return}else{let s=kpe(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)),kH(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 kH(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=ui(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=ui(this.options.mangle?t(i[1]):i[1]),o="mailto:"+r):(r=ui(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=ui(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=ui(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]):ui(i[0]):i[0]:r=ui(this.options.smartypants?t(i[0]):i[0]),{type:"text",raw:i[0],text:r}}}},he={newline:/^(?: *(?:\n|$))+/,code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,fenc
]`).replace("lheading",he.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});ee={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:nb,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:nb,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,punctuation:/^([\spunctuation])/};ee._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~";ee.punctuation=lt(ee.punctuation).replace(/punctuation/g,ee._punctuation).getRegex();ee.blockSkip=/\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g;ee.escapedEmSt=/\\\*|\\_/g;ee._comment=lt(he._comment).replace("(?:-->|$)","-->").getRegex();ee.emStrong.lDelim=lt(ee.emStrong.lDelim).replace(/punct/g,ee._punctuation).getRegex();ee.emStrong.rDelimAst=lt(ee.emStrong.rDelimAst,"g").replace(/punct/g,ee._punctuation).getRegex();ee.emStrong.rDelimUnd=lt(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=lt(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=lt(ee.tag).replace("comment",ee._comment).replace("attribute",ee._attribute).getRegex();ee._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;ee._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/;ee._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;ee.link=lt(ee.link).replace("label",ee._label).replace("href",ee._href).replace("title",ee._title).getRegex();ee.reflink=lt(ee.reflink).replace("label",ee._label).replace("ref",he._label).getRegex();ee.nolink=lt(ee.nolink).replace("ref",he._label).getRegex();ee.reflinkSearch=lt(ee.reflinkSearch,"g").replace("reflink",ee.reflink).replace("nolink",ee.nolink).getRegex();ee.normal=_r({},ee);ee.pedantic=_r({},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:lt(/^!?\[(label)\]\((.*?)\)/).replace("label",ee._label).getRegex(),reflink:lt(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ee._label).getRegex()});ee.gfm=_r({},ee.normal,{escape:lt(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=lt(ee.gfm.url,"i").replace("email",ee.gfm._extended_email).getRegex();ee.breaks=_r({},ee.gfm,{br:lt(ee.br).
2022-05-18 13:29:28 -04:00
`).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+=`
2022-05-27 03:57:56 -04:00
`+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)+"["+TH("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)+"["+TH("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,EH)){e=e.substring(i.raw.length),t.push(i);continue}if(!this.state.inLink&&(i=this.tokenizer.url(e,EH))){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,Ppe)){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}},ob=class{constructor(e){this.options=e||gc}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+ui(r,!0)+'">'+(i?e:ui(e,!0))+`</code></pre>
`:"<pre><code>"+(i?e:ui(e,!0))+`</code></pre>
2022-05-18 13:29:28 -04:00
`}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+`>
2022-05-27 03:57:56 -04:00
`}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=CH(this.options.sanitize,this.options.baseUrl,e),e===null)return i;let r='<a href="'+ui(e)+'"';return t&&(r+=' title="'+t+'"'),r+=">"+i+"</a>",r}image(e,t,i){if(e=CH(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}},j0=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""}},A0=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)}},Vr=class{constructor(e){this.options=e||gc,this.options.renderer=this.options.renderer||new ob,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new j0,this.slugger=new A0}static parse(e,t){return new Vr(t).parse(e)}static parseInline(e,t){return new Vr(t).parseInline(e)}parse(e,t=!0){let i="",r,o,s,a,l,u,c,h,d,g,f,p,b,v,w,D,S,L,I,j=e.length;for(r=0;r<j;r++){if(g=e[r],this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[g.type]&&(I=this.options.extensions.renderers[g.type].call({parser:this},g),I!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(g.type))){i+=I||"";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,_H(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],D=w.checked,S=w.task,v="",w.task&&(L=this.renderer.checkbox(D),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}):v+=L),v+=this.parse(w.tokens,b),d+=this.renderer.listitem(v,S,D);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<j&&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}};fe.options=fe.setOptions=function(n){return _r(fe.defaults,n),dpe(fe.defaults),fe};fe.getDefaults=PH;fe.defaults=gc;fe.use=function(...n){let e=_r({},...n),t=fe.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=fe.defaults.renderer||new ob;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=fe.defaults.tokenizer||new rb;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=fe.defaults.walkTokens;e.walkTokens=function(s){r.walkTokens.call(this,s),o&&o.call(this,s)}}i&&(e.extensions=t),fe.setOptions(e)})};fe.walkTokens=function(n,e){for(let t of n)switch(e.call(fe,t),t.type){case"table":{for(let i of t.header)fe.walkTokens(i.tokens,e);for(let i of t.rows)for(let r of i)fe.walkTokens(r.tokens,e);break}case"list":{fe.walkTokens(t.items,e);break}default:fe.defaults.extensions&&fe.defaults.extensions.childTokens&&fe.defaults.extensions.childTokens[t.type]?fe.defaults.extensions.childTokens[t.type].forEach(function(i){fe.walkTokens(t[i],e)}):t.tokens&&fe.walkTokens(t.tokens,e)}};fe.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=_r({},fe.defaults,e||{}),RH(e);try{let t=zr.lexInline(n,e);return e.walkTokens&&fe.walkTokens(t,e.walkTokens),Vr.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>"+ui(t.message+"",!0)+"</pre>";throw t}};fe.Parser=Vr;fe.parser=Vr.parse;fe.Renderer=ob;fe.TextRenderer=j0;fe.Lexer=zr;fe.lexer=zr.lex;fe.Tokenizer=rb;fe.Slugger=A0;fe.parse=fe;B_e=fe.options,H_e=fe.setOptions,q_e=fe.use,Y_e=fe.walkTokens,W_e=fe.parseInline,Z_e=Vr.parse,J_e=zr.lex});var AH=m((X_e,jH)=>{var IH={};jH.exports=IH;var FH={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(FH).forEach(function(n){var e=FH[n],t=IH[n]=[];t.open="\x1B["+e[0]+"m",t.close="\x1B["+e[1]+"m"})});var MH=m((U_e,OH)=>{var sg=process.argv;OH.exports=function(){return sg.indexOf("--no-color")!==-1||sg.indexOf("--color=false")!==-1?!1:sg.indexOf("--color")!==-1||sg.indexOf("--color=true")!==-1||sg.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 BH=m((G_e,NH)=>{NH.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 qH=m((Q_e,HH)=>{HH.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 sq=m((oRe,N0)=>{var Bpe=nq(),ml=oq(),M0=ml.repeat,Hpe=ml.truncate,qpe=ml.pad;function ag(n){this.options=ml.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)}ag.prototype.__proto__=Array.prototype;ag.prototype.__defineGetter__("width",function(){var n=this.toString().split(`
`);return n.length?n[0].length:0});ag.prototype.render;ag.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(v){if(typeof v=="object"&&v.length)u(v);else{var w=Object.keys(v)[0],D=v[w];s[0]=Math.max(s[0]||0,c(w)||0),typeof D=="object"&&D.length?u(D,1):s[1]=Math.max(s[1]||0,c(D)||0)}})}a=(s.length==1?s[0]:s.reduce(function(v,w){return v+w}))+s.length+1;function u(v,D){var D=D||0;v.forEach(function(S,L){s[L+D]=Math.max(s[L+D]||0,c(S)||0)})}function c(v){return typeof v=="object"&&v.width!=null?v.width:(typeof v=="object"?ml.strlen(v.text):ml.strlen(v))+(t["padding-left"]||0)+(t["padding-right"]||0)}function h(I,w,D,S){var L=0,I=w+M0(I,a-2)+D;return s.forEach(function(j,W){W!=s.length-1&&(L+=j+1,I=I.substr(0,L)+S+I.substr(L+1))}),f(e.style.border,I)}function d(){var v=h(r.top,r["top-left"]||r.top,r["top-right"]||r.top,r["top-mid"]);v&&(n+=v+`
`)}function g(v,w){var D=[],S=0;if(!Array.isArray(v)&&typeof v=="object"){var L=Object.keys(v)[0],I=v[L],j=!0;Array.isArray(I)?(v=I,v.unshift(L)):v=[L,I]}v.forEach(function(B,F){var M=B.toString().split(`
`).reduce(function(K,le){return K.push(p(le,F)),K},[]),J=M.length;J>S&&(S=J),D.push({contents:M,height:J})});var W=new Array(S);D.forEach(function(B,F){B.contents.forEach(function(K,le){W[le]||(W[le]=[]),(w||j&&F===0&&e.style.head)&&(K=f(e.style.head,K)),W[le].push(K)});for(var M=B.height,J=S;M<J;M++)W[M]||(W[M]=[]),W[M].push(p("",F))});var N="";return W.forEach(function(B,F){N.length>0&&(N+=`
`+f(e.style.border,r.left)),N+=B.join(f(e.style.border,r.middle))+f(e.style.border,r.right)}),f(e.style.border,r.left)+N}function f(v,w){return w?(v.forEach(function(D){w=Bpe[D](w)}),w):""}function p(D,w){var D=String(typeof D=="object"&&D.text?D.text:D),S=ml.strlen(D),L=s[w]-(t["padding-left"]||0)-(t["padding-right"]||0),I=e.colAligns[w]||"left";return M0(" ",t["padding-left"]||0)+(S==L?D:S<L?qpe(D,L+(D.length-S)," ",I=="left"?"right":I=="middle"?"both":"left"):o?Hpe(D,L,o):D)+M0(" ",t["padding-right"]||0)}i.length&&(d(),n+=g(i,t.head)+`
`),this.length&&this.forEach(function(v,w){if(!i.length&&w==0)d();else if(!t.compact||w<!!i.length||v.length==0){var D=h(r.mid,r["left-mid"],r["right-mid"],r["mid-mid"]);D&&(n+=D+`
`)}v.hasOwnProperty("length")&&!v.length||(n+=g(v)+`
`)});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};N0.exports=ag;N0.exports.version="0.0.1"});var cq=m((sRe,uq)=>{"use strict";var aq=(n=0)=>e=>`\x1B[${38+n};5;${e}m`,lq=(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=aq(),e.color.ansi16m=lq(),e.bgColor.ansi256=aq(10),e.bgColor.ansi16m=lq(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(uq,"exports",{enumerable:!0,get:Ype})});function hq(n){return`${vi.default.gray.open}${n}${vi.default.gray.close}`}function B0(n){return`${vi.default.magenta.open}${n}${vi.default.magenta.close}`}function dq(n){return`${vi.default.bold.open}${n}${vi.default.bold.close}`}function H0(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 fq(n){return`${vi.default.italic.open}${n}${vi.default.italic.close}`}function pq(n){return`${vi.default.yellow.open}${n}${vi.default.yellow.close}`}function q0(n){return`${vi.default.blue.open}${n}${vi.default.blue.close}`}var vi,mq=_(()=>{"use strict";vi=C(cq())});function Rr(n){return n}function Xpe(n){return hq(n.replace(/(<([^>]+)>)/ig,""))}function bq(n,e){return e?n.replace($pe,/\n/g):n}function Gpe(n,e){return e.replace(/(^|\n)(.+)/g,"$1"+n+"$2")}function Qpe(n,e){return e&&n+e.split(`
2022-05-18 13:29:28 -04:00
`).join(`
2022-05-27 03:57:56 -04:00
`+n)}function Vpe(n,e){let t=new RegExp("(\\S(?: | )?)((?:"+e+")+)("+Cq+"(?:.*)+)$","gm");return n.replace(t,`$1
`+e+"$2$3")}function Tq(n){return" ".repeat(n.length)}function eme(n,e){return Sq(e,n)?e:Tq(Z0)+e}function tme(n,e){let t=eme.bind(null,e);return n.split(`
2022-05-18 13:29:28 -04:00
`).filter(Rr).map(t).join(`
2022-05-27 03:57:56 -04:00
`)}function ime(n,e,t){return Sq(e,n)?{num:t+1,line:e.replace(Z0,yq(t+1))}:{num:t,line:Tq(yq(t))+e}}function nme(n,e){let t=ime.bind(null,e),i=0;return n.split(`
2022-05-18 13:29:28 -04:00
`).filter(Rr).map(r=>{let o=t(r,i);return i=o.num,o.line}).join(`
2022-05-27 03:57:56 -04:00
`)}function rme(n,e,t){return n=n.trim(),n=e?nme(n,t):tme(n,t),n}function lg(n){return n+`
2022-05-18 13:29:28 -04:00
2022-05-27 03:57:56 -04:00
`}function ome(n){return n.replace(Jpe,":")}function vq(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(Zpe,"").split(Dq);i.push(o.splice(0,o.length-1))}),i}function kq(n){return n.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}function sme(n){return n.replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#39;/g,"'")}var wq,aRe,Dq,W0,Zpe,xq,Jpe,$pe,Upe,Kpe,zpe,Cq,Sq,Z0,yq,Y0,Eq,J0,Pq=_(()=>{"use strict";wq=C(sq());mq();aRe=q()("markdown-renderer"),Dq="^*||*^",W0="*|*|*|*",Zpe=new RegExp(kq(W0),"g"),xq="*#COLON|*",Jpe=new RegExp(kq(xq),"g"),$pe="\r";Upe={code:Rr,blockquote:Rr,html:Xpe,heading:B0,firstHeading:B0,hr:Rr,listitem:Rr,list:rme,table:Rr,paragraph:Rr,strong:dq,em:fq,codespan:pq,del:gq,link:H0,href:H0,text:Rr,unescape:!0,emoji:!1,width:80,showSectionPrefix:!0,tab:2,tableOptions:{}};Kpe="\\*",zpe="\\d+\\.",Cq="(?:"+[Kpe,zpe].join("|")+")";Sq=function(n,e){return n.match("^(?:"+e+")*"+Cq)};Z0="* ";yq=function(n){return n+". "};Y0=new Map,Eq=class{constructor(e={},t={}){this.options=e;this.highlightOptions=t;this.o=Object.assign({},Upe,e),this.tab=" ",this.tableSettings=this.o.tableOptions,this.unescape=this.o.unescape?sme:Rr,this.highlightOptions=t||{},this.transform=this.compose(ome,this.unescape)}text(e){return this.o.text(e)}code(e,t,i){return"``` "+t+`
`+e+"\n```\n"}blockquote(e){return lg(this.o.blockquote(Qpe(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,lg(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),lg(Vpe(Gpe(this.tab,e),this.tab))}listitem(e){let t=this.compose(this.o.listitem,this.transform);return e.indexOf(`
2022-05-18 13:29:28 -04:00
`)!==-1&&(e=e.trim()),`
2022-05-27 03:57:56 -04:00
`+Z0+t(e)}checkbox(e){return"["+(e?"X":" ")+"] "}paragraph(e){return e=this.compose(this.o.paragraph,this.transform)(e),lg(e)}table(e,t){let i=new wq.default(Object.assign({},{head:vq(e)[0]},this.tableSettings));return vq(t,this.transform).forEach(function(r){i.push(r)}),lg(this.o.table(i.toString()))}tablerow(e){return W0+e+W0+`
`}tablecell(e,t){return e+Dq}strong(e){return this.o.strong(e)}em(e){return e=bq(e,this.o.reflowText),this.o.em(e)}codespan(e){return e=bq(e,this.o.reflowText),this.o.codespan(e.replace(/:/g,xq))}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&&Y0.set(i,e),i&&i!=e)return q0(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 Y0.entries())e.push(`${q0(t)}: ${i}`);return Y0.clear(),e}},J0=Eq});function mc(n,e=!1){let t=ug(n),i=[],r="";for(let o of t){if(!o.text)continue;let{foreground:s,background:a}=o,l=Q(r),u=[l,l+Q(o.text)];if(s&&a){let c=`CocList${hn(s)}${hn(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${hn(s)}`:c=`CocListFg${hn(s)}`,i.push({span:u,hlGroup:c})}else if(a){let c=`CocListBg${hn(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 ug(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=>{_q[u]?s.foreground=_q[u]:Rq[u]?s.background=Rq[u]:u==39?delete s.foreground:u==49?delete s.background:Lq[u]?s[Lq[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 _q,Rq,Lq,bc=_(()=>{"use strict";_e();_q={30:"black",31:"red",32:"green",33:"yellow",34:"blue",35:"magenta",36:"cyan",37:"white",90:"grey"},Rq={40:"black",41:"red",42:"green",43:"yellow",44:"blue",45:"magenta",46:"cyan",47:"white"},Lq={1:"bold",3:"italic",4:"underline",9:"strikethrough"}});var Iq=m((hRe,Fq)=>{"use strict";Fq.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 cg=m((dRe,jq)=>{"use strict";var ame=Iq();jq.exports=n=>typeof n=="string"?n.replace(ame(),""):n});function sb(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=cme(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/);lme.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=ume(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 ume(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=Q(c.slice(0,o-a));i.push({colStart:0,colEnd:h,lnum:u+e,hlGroup:"CocUnderline"}),l=!1;break}else{let h=Q(c);i.push({colStart:0,colEnd:h,lnum:u+e,hlGroup:"CocUnderline"})}else if(a+c.length>r){l=!0;let h=Q(c.slice(0,r-a));if(a+c.length>o){let d=Q(c.slice(0,o-a));l=!1,i.push({colStart:h,colEnd:d,lnum:u+e,hlGroup:"CocUnderline"});break}else{let d=Q(c);i.push({colStart:h,colEnd:d,lnum:u+e,hlGroup:"CocUnderline"})}}a=a+c.length+1}return i}function cme(n,e){fe.setOpt
2022-05-18 13:29:28 -04:00
`+c.join(`
2022-05-27 03:57:56 -04:00
`)),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,Aq.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=mc(g,!0);if(f.highlights)for(let p of f.highlights){let{hlGroup:b,span:v}=p;i.push({hlGroup:b,lnum:o,colStart:v[0],colEnd:v[1]})}t.push(f.line),o++}return{lines:t,highlights:i,codes:r}}var Aq,lme,bRe,$0=_(()=>{"use strict";LH();Pq();bc();_e();Aq=C(cg()),lme=["Error","Warning","Info","Hint"],bRe=q()("markdown-index")});var ei,eo=_(()=>{"use strict";ei=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 Oq,Mq,hme,kRe,ci,Zo=_(()=>{"use strict";Oq=C(Pi()),Mq=C(H());ae();$0();z();eo();Ht();hme=process.env.VIM_NODE_RPC=="1",kRe=q()("model-float"),ci=class{constructor(e){this.nvim=e;this.winid=0;this._bufnr=0;this.mutex=new ei;this.disposables=[];this.onCursorMoved=(0,Oq.default)(this._onCursorMoved.bind(this),100)}bindEvents(e,t){let i=["InsertLeave","InsertEnter","BufEnter"];for(let r of i)E.on(r,o=>{o!=this._bufnr&&this.close()},null,this.disposables);E.on("MenuPopupChanged",()=>{E.pumAlignTop==t&&this.close()},null,this.disposables),this.disposables.push(Mq.Disposable.create(()=>{this.onCursorMoved.clear()})),E.on("CursorMoved",this.onCursorMoved.bind(this,e),this,this.disposables),E.on("CursorMovedI",this.onCursorMoved.bind(this,e),this,this.disposables)}unbind(){this.disposables.length&&(Z(this.disposables),this.disposables=[])}_onCursorMoved(e,t,i){if(t!=this._bufnr&&!(t==this.targetBufnr&&Pe(i,this.cursor))&&(e||t!=this.targetBufnr||!E.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}=sb(e),a={pumAlignTop:E.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"]};hme||(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 I=w.type==="*"?Q0:w.type==="?"?G0:"\\"+w.type;r=!0,i=i.slice(0,w.reStart)+I+"\\("+L}f(),o&&(i+="\\\\");var j=!1;switch(i.charAt(0)){case".":case"[":case"(":j=!0}for(var W=a.length-1;W>-1;W--){var N=a[W],B=i.slice(0,N.reStart),F=i.slice(N.reStart,N.reEnd-8),M=i.slice(N.reEnd-8,N.reEnd),J=i.slice(N.reEnd);M+=J;var K=B.split("(").length-1,le=J;for(p=0;p<K;p++)le=le.replace(/\)[+*?]?/,"");J=le;var je="";J===""&&e!==ab&&(je="$");var Re=B+F+J+je+M;i=Re}if(i!==""&&r&&(i="(?=.)"+i),j&&(i=d+i),e===ab)return[i,r];if(!r)return Lme(n);var Ve=t.nocase?"i":"";try{var kt=new RegExp("^"+i+"$",Ve)}catch{return new RegExp("$.")}return kt._glob=n,kt._src=i,kt}zn.makeRe=function(n,e){return new hi(n,e||{}).makeRe()};hi.prototype.makeRe=_me;function _me(){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?Q0:e.dot?xme:Cme,i=e.nocase?"i":"",r=n.map(function(o){return o.map(function(s){return s===K0?t:typeof s=="string"?Fme(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}zn.match=function(n,e,t){t=t||{};var i=new hi(e,t);return n=n.filter(function(r){return i.match(r)}),i.options.nonull&&!n.length&&n.push(e),n};hi.prototype.match=Rme;function Rme(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;hg.sep!=="/"&&(n=n.split(hg.sep).join("/")),n=n.split(i2),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}hi.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===K0){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(`
2022-05-18 13:29:28 -04:00
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(`
2022-05-27 03:57:56 -04:00
>>> 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 Lme(n){return n.replace(/\\(.)/g,"$1")}function Fme(n){return n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}});var o2=m(z0=>{var bl=require("path"),Vs=process.platform==="win32",zs=require("fs"),Ime=process.env.NODE_DEBUG&&/fs/.test(process.env.NODE_DEBUG);function jme(){var n;if(Ime){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 Ame(n){return typeof n=="function"?n:jme()}var FRe=bl.normalize;Vs?Jo=/(.*?)(?:[\/\\]+|$)/g:Jo=/(.*?)(?:[\/]+|$)/g;var Jo;Vs?dg=/^(?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?[\\\/]*/:dg=/^[\/]*/;var dg;z0.realpathSync=function(e,t){if(e=bl.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=dg.exec(e);s=b[0].length,a=b[0],l=b[0],u="",Vs&&!o[l]&&(zs.lstatSync(l),o[l]=!0)}for(;s<e.length;){Jo.lastIndex=s;var h=Jo.exec(e);if(u=a,a+=h[0],l=u+h[1],s=Jo.lastIndex,!(o[l]||t&&t[l]===l)){var d;if(t&&Object.prototype.hasOwnProperty.call(t,l))d=t[l];else{var g=zs.lstatSync(l);if(!g.isSymbolicLink()){o[l]=!0,t&&(t[l]=l);continue}var f=null;if(!Vs){var p=g.dev.toString(32)+":"+g.ino.toString(32);r.hasOwnProperty(p)&&(f=r[p])}f===null&&(zs.statSync(l),f=zs.readlinkSync(l)),d=bl.resolve(u,f),t&&(t[l]=d),Vs||(r[p]=f)}e=bl.resolve(d,e.slice(s)),c()}}return t&&(t[i]=e),e};z0.realpath=function(e,t,i){if(typeof i!="function"&&(i=Ame(t),t=null),e=bl.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=dg.exec(e);a=b[0].length,l=b[0],u=b[0],c="",Vs&&!s[u]?zs.lstat(u,function(v){if(v)return i(v);s[u]=!0,d()}):process.nextTick(d)}function d(){if(a>=e.length)return t&&(t[r]=e),i(null,e);Jo.lastIndex=a;var b=Jo.exec(e);return c=l,l+=b[0],u=c+b[1],a=Jo.lastIndex,s[u]||t&&t[u]===u?process.nextTick(d):t&&Object.prototype.hasOwnProperty.call(t,u)?p(t[u]):zs.lstat(u,g)}function g(b,v){if(b)return i(b);if(!v.isSymbolicLink())return s[u]=!0,t&&(t[u]=u),process.nextTick(d);if(!Vs){var w=v.dev.toString(32)+":"+v.ino.toString(32);if(o.hasOwnProperty(w))return f(null,o[w],u)}zs.stat(u,function(D){if(D)return i(D);zs.readlink(u,function(S,L){Vs||(o[w]=L),f(S,L)})})}function f(b,v,w){if(b)return i(b);var D=bl.resolve(c,v);t&&(t[w]=D),p(D)}function p(b){e=bl.resolve(b,e.slice(a)),h()}}});var iT=m((jRe,u2)=>{u2.exports=ea;ea.realpath=ea;ea.sync=tT;ea.realpathSync=tT;ea.monkeypatch=Mme;ea.unmonkeypatch=Nme;var vc=require("fs"),V0=vc.realpath,eT=vc.realpathSync,Ome=process.version,s2=/^v[0-5]\./.test(Ome),a2=o2();function l2(n){return n&&n.syscall==="realpath"&&(n.code==="ELOOP"||n.code==="ENOMEM"||n.code==="ENAMETOOLONG")}function ea(n,e,t){if(s2)return V0(n,e,t);typeof e=="function"&&(t=e,e=null),V0(n,e,function(i,r){l2(i)?a2.realpath(n,e,t):t(i,r)})}function tT(n,e){if(s2)return eT(n,e);try{return eT(n,e)}catch(t){if(l2(t))return a2.realpathSync(n,e);throw t}}function Mme(){vc.realpath=ea,vc.realpathSync=tT}function Nme(){vc.realpath=V0,vc.realpathSync=eT}});var c2=m((ARe,nT)=>{typeof Object.create=="function"?nT.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:nT.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 h2=m((ORe,oT)=>{try{if(rT=require("util"),typeof rT.inherits!="function")throw"";oT.exports=rT.inherits}catch{oT.exports=c2()}var rT});var ub=m((MRe,lb)=>{"use strict";function d2(n){return n.charAt(0)==="/"}funct
See: https://github.com/isaacs/node-glob/issues/167`);return new ti(n,e).found}function ti(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 ti))return new ti(n,e);if(Gme(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()}ti.prototype._finish=function(){if(y2(this instanceof ti),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=Ume.realpathSync(r,n.realpathCache);i[o]=!0}catch(s){if(s.syscall==="stat")i[n._makeAbs(r)]=!0;else throw s}})}yl.finish(this)};ti.prototype._process=function(n,e,t){y2(this instanceof ti);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=".":((cb(r)||cb(n.join("/")))&&(!r||!cb(r))&&(r="/"+r),s=r);var a=this._makeAbs(s);if(!Qme(this,s)){var l=o[0]===b2.GLOBSTAR;l?this._processGlobStar(r,s,a,o,e,t):this._processReaddir(r,s,a,o,e,t)}};ti.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=lT.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)}}}};ti.prototype._emitMatch=function(n,e){if(!Kme(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)}}};ti.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};ti.prototype._readdir=function(n,e){var t;if(e&&!uT(this.symlinks,n))return this._readdirInGlobStar(n);if(uT(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}};ti.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};ti.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}};ti.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)}}}};ti.prototype._processSimple=function(n,e){var t=this._stat(n);if(this.matches[e]||(this.matches[e]=Object.create(null)),!!t){if(n&&cb(n)&&!this.nomount){var i=/[\/\\]$/.test(n);n.charAt(0)==="/"?n=lT.join(this.root,n):(n=lT.resolve(this.root,n),i&&(n+="/"))}process.platform==="win32"&&(n=n.replace(/\\/g,"/")),this._emitMatch(e,n)}};ti.prototype._stat=function(n){var e=this._makeAbs(n),t=n.slice(-1)==="/";if(n.length>this.maxLength)return!1;if(!this.stat&&uT(this.cache,e)){var s=this.cache[e];if(Array.isArray(s)&&(s="DIR
2022-05-18 13:29:28 -04:00
`)}_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+`
2022-05-27 03:57:56 -04:00
`)}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 tLe,W2,$o,vb=_(()=>{"use strict";ae();Y2();tLe=q()("core-channels"),W2=class{constructor(){this.outputChannels=new Map;this.bufnrs=new Map;this.disposable=E.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 yb(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()}},$o=new W2});var nLe,wb,Z2=_(()=>{"use strict";nLe=q()("model-terminal"),wb=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 CT,fbe,Db,J2=_(()=>{"use strict";Z2();CT=C(H());z();ae();fbe=q()("core-terminals"),Db=class{constructor(){this._terminals=new Map;this.disposables=[];this._onDidOpenTerminal=new CT.Emitter;this._onDidCloseTerminal=new CT.Emitter;this.onDidCloseTerminal=this._onDidCloseTerminal.event;this.onDidOpenTerminal=this._onDidOpenTerminal.event;E.on("BufUnload",e=>{if(this._terminals.has(e)){fbe.debug("terminal detach",e);let t=this._terminals.get(e);this._onDidCloseTerminal.fire(t),this._terminals.delete(e)}},null,this.disposables),E.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 wb(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 Q2(n,e){if(e==="line"){let i=await n.call("line",["."]);return Sc.Range.create(i-1,0,i,0)}if(e==="cursor"){let[i,r]=await n.eval("coc#cursor#position()");return Sc.Range.create(i,r,i,r)}let t=await n.call("coc#cursor#get_selection",[e==="char"?1:0]);return t?Sc.Range.create(t[0],t[1],t[2],t[3]):null}async function K2(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?Q(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=Q(h)}else u=r.line,l=s.length>0?Q(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 Sc,pbe,Sb=_(()=>{"use strict";Sc=C(H());_e();pbe=process.env.VIM_NODE_RPC=="1"});var Tb,TT=_(()=>{Tb="0.0.81"});var yg,vg,kb,Eb,wg,Pb,Fr=_(()=>{"use strict";yg=(i=>(i[i.Buffer=0]="Buffer",i[i.LanguageServer=1]="LanguageServer",i[i.Global=2]="Global",i))(yg||{}),vg=(i=>(i[i.Native=0]="Native",i[i.Remote=1]="Remote",i[i.Service=2]="Service",i))(vg||{}),kb=(i=>(i[i.More=0]="More",i[i.Warning=1]="Warning",i[i.Error=2]="Error",i))(kb||{}),Eb=(i=>(i[i.Global=0]="Global",i[i.User=1]="User",i[i.Workspace=2]="Workspace",i))(Eb||{}),wg=(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))(wg||{}),Pb=(r=>(r[r.Unknown=0]="Unknown",r[r.File=1]="File",r[r.Directory=2]="Directory",r[r.SymbolicLink=64]="SymbolicLink",r))(Pb||{})});function kT(n,e){if(n.length<=1)return n;let t=n.length/2|0,i=n.slice(0,t),r=n.slice(t);kT(i,e),kT(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 z2(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 V2(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 bbe(n){let e=V2(n.range);return e!==n.range?{newText:n.newText,range:e}:n}var Tc,jn,kc=_(()=>{"use strict";Tc=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(Tc.isIncremental(i)){let r=V2(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=z2(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(Tc.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=z2(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:D+="\r";break;case 116:D+=" ";break;case 117:var j=d(4,!0);j>=0?D+=String.fromCharCode(j):h=4;break;default:h=5}S=i;continue}if(L>=0&&L<=31)if(Dg(L)){D+=n.substring(S,i),h=2;break}else h=6;i++}return D}function b(){if(r="",h=0,o=i,l=a,c=u,i>=t)return o=t,s=17;var D=n.charCodeAt(i);if(ET(D)){do i++,r+=String.fromCharCode(D),D=n.charCodeAt(i);while(ET(D));return s=15}if(Dg(D))return i++,r+=String.fromCharCode(D),D===13&&n.charCodeAt(i)===10&&(i++,r+=`
`),a++,u=i,s=14;switch(D){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 S=i-1;if(n.charCodeAt(i+1)===47){for(i+=2;i<t&&!Dg(n.charCodeAt(i));)i++;return r=n.substring(S,i),s=12}if(n.charCodeAt(i+1)===42){i+=2;for(var L=t-1,I=!1;i<L;){var j=n.charCodeAt(i);if(j===42&&n.charCodeAt(i+1)===47){i+=2,I=!0;break}i++,Dg(j)&&(j===13&&n.charCodeAt(i)===10&&i++,a++,u=i)}return I||(i++,h=1),r=n.substring(S,i),s=13}return r+=String.fromCharCode(D),i++,s=16;case 45:if(r+=String.fromCharCode(D),i++,i===t||!Ec(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&&v(D);)i++,D=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(D),i++,s=16}}function v(D){if(ET(D)||Dg(D))return!1;switch(D){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return!1}return!0}function w(){var D;do D=b();while(D>=12&&D<=15);return D}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 ET(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 Dg(n){return n===10||n===13||n===8232||n===8233}function Ec(n){return n>=48&&n<=57}var _b=_(()=>{"use strict"});function _T(n,e,t){var i,r,o,s,a;if(e){for(s=e.offset,a=s+e.length,o=s;o>0&&!Cg(n,o-1);)o--;for(var l=a;l<n.length&&!Cg(n,l);)l++;r=n.substring(o,l),i=vbe(r,t)}else r=n,i=0,o=0,s=0,a=n.length;var u=wbe(t,n),c=!1,h=0,d;t.insertSpaces?d=PT(" ",t.tabSize||4):d=" ";var g=xg(r,!1),f=!1;function p(){return u+PT(d,i+h)}function b(){var M=g.scan();for(c=!1;M===15||M===14;)c=c||M===14,M=g.scan();return f=M===16||g.getTokenError()!==0,M}var v=[];function w(M,J,K){!f&&(!e||J<a&&K>s)&&n.substring(J,K)!==M&&v.push({offset:J,length:K-J,content:M})}var D=b();if(D!==17){var S=g.getTokenOffset()+o,L=PT(d,i);w(L,o,S)}for(;D!==17;){for(var I=g.getTokenOffset()+g.getTokenLength()+o,j=b(),W="",N=!1;!c&&(j===12||j===13);){var B=g.getTokenOffset()+o;w(" ",I,B),I=g.getTokenOffset()+g.getTokenLength()+o,N=j===12,W=N?p():"",j=b()}if(j===2)D!==1&&(h--,W=p());else if(j===4)D!==3&&(h--,W=p());else{switch(D){case 3:case 1:h++,W=p();break;case 5:case 12:W=p();break;case 13:c?W=p():N||(W=" ");break;case 6:N||(W=" ");break;case 10:if(j===6){N||(W="");break}case 7:case 8:case 9:case 11:case 2:case 4:j===12||j===13?N||(W=" "):j!==5&&j!==17&&(f=!0);break;case 16:f=!0;break}c&&(j===12||j===13)&&(W=p())}j===17&&(W=t.insertFinalNewline?u:"");var F=g.getTokenOffset()+o;w(W,I,F),D=j}return v}function PT(n,e){for(var t="",i=0;i<e;i++)t+=n;return t}function vbe(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 wbe(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)===`
2022-05-18 13:29:28 -04:00
`?`\r
`:"\r";if(i===`
`)return`
`}return n&&n.eol||`
2022-05-27 03:57:56 -04:00
`}function Cg(n,e){return`\r
`.indexOf(n.charAt(e))!==-1}var RT=_(()=>{"use strict";_b()});function eY(n,e,t){e===void 0&&(e=[]),t===void 0&&(t=Sg.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 FT(n,a,t),r[0]}function LT(n,e,t){e===void 0&&(e=[]),t===void 0&&(t=Sg.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:xbe(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})}};FT(n,s,t);var a=i.children[0];return a&&delete a.parent,a}function Rb(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 FT(n,e,t){t===void 0&&(t=Sg.DEFAULT);var i=xg(n,!1);function r(N){return N?function(){return N(i.getTokenOffset(),i.getTokenLength(),i.getTokenStartLine(),i.getTokenStartCharacter())}:function(){return!0}}function o(N){return N?function(B){return N(B,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 v(){for(;;){var N=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(N){case 12:case 13:p?w(10):g();break;case 16:w(1);break;case 15:case 14:break;default:return N}}}function w(N,B,F){if(B===void 0&&(B=[]),F===void 0&&(F=[]),f(N),B.length+F.length>0)for(var M=i.getToken();M!==17;){if(B.indexOf(M)!==-1){v();break}else if(F.indexOf(M)!==-1)break;M=v()}}function D(N){var B=i.getTokenValue();return N?h(B):a(B),v(),!0}function S(){switch(i.getToken()){case 11:var N=i.getTokenValue(),B=Number(N);isNaN(B)&&(w(2),B=0),h(B);break;case 7:h(null);break;case 8:h(!0);break;case 9:h(!1);break;default:return!1}return v(),!0}function L(){return i.getToken()!==10?(w(3,[],[2,5]),!1):(D(!1),i.getToken()===6?(d(":"),v(),W()||w(4,[],[2,5])):w(5,[],[2,5]),!0)}function I(){s(),v();for(var N=!1;i.getToken()!==2&&i.getToken()!==17;){if(i.getToken()===5){if(N||w(4,[],[]),d(","),v(),i.getToken()===2&&b)break}else N&&w(6,[],[]);L()||w(4,[],[2,5]),N=!0}return l(),i.getToken()!==2?w(7,[2],[]):v(),!0}function j(){u(),v();for(var N=!1;i.getToken()!==4&&i.getToken()!==17;){if(i.getToken()===5){if(N||w(4,[],[]),d(","),v(),i.getToken()===4&&b)break}else N&&w(6,[],[]);W()||w(4,[],[4,5]),N=!0}return c(),i.getToken()!==4?w(8,[4],[]):v(),!0}function W(){switch(i.getToken()){case 3:return j();case 1:return I();case 10:return D(!0);default:return S()}}return v(),i.getToken()===17?t.allowEmptyContent?!0
2022-05-18 13:29:28 -04:00
augroup coc_dynamic_autocmd
autocmd!
${i.join(`
`)}
2022-05-27 03:57:56 -04:00
augroup end`;if(this.nvim.hasFunction("nvim_exec"))this.nvim.exec(r,!1);else{let o=YT.default.join(process.env.TMPDIR||mY.default.tmpdir(),`coc.nvim-${process.pid}.vim`);qT.default.mkdirSync(o,{recursive:!0});let s=YT.default.join(o,`coc-${process.pid}.vim`);qT.default.writeFileSync(s,r,"utf8");let a=`source ${s}`;this.env.isCygwin&&Wo.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),Z(this.disposables)}}});var Cl,Bb,vY=_(()=>{"use strict";Cl=C(H());we();ae();z();Bb=class{constructor(e){this.documents=e;this.disposables=[];this.providers=new Map;this._onDidProviderChange=new Cl.Emitter;this.onDidProviderChange=this._onDidProviderChange.event}attach(e){this.nvim=e,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 Cl.CancellationTokenSource,o=await Promise.resolve(i.provideTextDocumentContent(O.parse(t),r.token)),s=await this.nvim.buffer;await s.setLines(o.split(/\r?\n/),{start:0,end:-1,strictIndexing:!1}),process.nextTick(()=>{E.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 Cl.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),Cl.Disposable.create(()=>{this.providers.delete(e),Z(i),this._onDidProviderChange.fire()})}dispose(){Z(this.disposables),this._onDidProviderChange.dispose(),this.providers.clear()}}});var xY=m((yFe,Hb)=>{"use strict";Hb.exports=jbe;Hb.exports.format=wY;Hb.exports.parse=DY;var Lbe=/\B(?=(\d{3})+(?!\d))/g,Fbe=/(?:\.0*|(\.[^0]+)0+)$/,na={b:1,kb:1<<10,mb:1<<20,gb:1<<30,tb:Math.pow(1024,4),pb:Math.pow(1024,5)},Ibe=/^((-|\+)?(\d+(?:\.\d+)?)) *(kb|mb|gb|tb|pb)$/i;function jbe(n,e){return typeof n=="string"?DY(n):typeof n=="number"?wY(n,e):null}function wY(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||!na[a.toLowerCase()])&&(t>=na.pb?a="PB":t>=na.tb?a="TB":t>=na.gb?a="GB":t>=na.mb?a="MB":t>=na.kb?a="KB":a="B");var l=n/na[a.toLowerCase()],u=l.toFixed(o);return s||(u=u.replace(Fbe,"$1")),i&&(u=u.replace(Lbe,i)),u+r+a}function DY(n){if(typeof n=="number"&&!isNaN(n))return n;if(typeof n!="string")return null;var e=Ibe.exec(n),t,i="b";return e?(t=parseFloat(e[1]),i=e[4].toLowerCase()):(t=parseInt(n,10),i="b"),Math.floor(na[i]*t)}});var _g=m((vFe,_Y)=>{var io=-1,Ir=1,gn=0;function Pg(n,e,t,i){if(n===e)return n?[[gn,n]]:[];if(t!=null){var r=Bbe(n,e,t);if(r)return r}var o=ZT(n,e),s=n.substring(0,o);n=n.substring(o),e=e.substring(o),o=JT(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=Abe(n,e);return s&&l.unshift([gn,s]),a&&l.push([gn,a]),SY(l,i),l}function Abe(n,e){var t;if(!n)return[[Ir,e]];if(!e)return[[io,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)],[gn,r],[Ir,i.substring(o+r.length)]],n.length>e.length&&(t[0][0]=t[2][0]=io),t;if(r.length===1)return[[io,n],[Ir,e]];var s=Mbe(n,e);if(s){var a=s[0],l=s[1],u=s[2],c=s[3],h=s[4],d=Pg(a,u),g=Pg(l,c);return d.concat([[gn,h]],g)}return Obe(n,e)}function Obe(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 v=-b+d;v<=b-g;v+=2){var w=o+v,D;v===-b||v!==b&&a[w-1]<a[w+1]?D=a[w+1]:D=a[w-1]+1;for(var S=D-v;D<t&&S<i&&n.charAt(D)===e.charAt(S);)D++,S++;if(a[w]=D,D>t)g+=2;else if(S>i)d+=2;else if(h){var L=o+c-v;if(L>=0&&L<s&&l[L]!==-1){var I=t-l[L];
2022-05-18 13:29:28 -04:00
`)+`
2022-05-27 03:57:56 -04:00
`:"";if(!(d.length===0&&a===r-c))return un.replace(Ne.create(a,0,r-c,0),d)}var Yb,xFe,$T=_(()=>{"use strict";Yb=C(_g());Ur();_e();xFe=q()("util-diff")});function ra(n){let{newText:e}=n,t=Wb(n.range),i=t.end.line-t.start.line;return e.split(/\r?\n/).length-i-1}function Wb(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 Rg(n,e){if(n.length<=1)return n;let t=n.length/2|0,i=n.slice(0,t),r=n.slice(t);Rg(i,e),Rg(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 IY(n){let{changes:e,documentChanges:t}=n;return!(t&&t.length||e&&Object.keys(e).length)}function jY(n,e){var i;let t=[];for(let r of n){let o=Lg(r);o&&!t.includes(o)&&((i=e[o])==null?void 0:i.needsConfirmation)&&t.push(o)}return t}function Lg(n){let e;return er.TextDocumentEdit.is(n)?er.AnnotatedTextEdit.is(n.edits[0])&&(e=n.edits[0].annotationId):e=n.annotationId,e}function AY(n){if(n.documentChanges)return n.documentChanges;let e=[];if(n.changes)for(let[t,i]of Object.entries(n.changes))e.push({textDocument:{uri:t,version:null},edits:i});return e}function OY(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=N2(a.range);if(o){if(M2(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,`
2022-05-19 10:14:37 -04:00
`));let c=De(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(`
2022-05-27 03:57:56 -04:00
`)){l=l.slice(0,-1);let h=n.lines[i.line-1];u.end=er.Position.create(i.line-1,h.length)}else l.length==0&&(o=u.start);t.push({range:u,newText:l})}}return Rg(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 MY(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(`
2022-05-18 13:29:28 -04:00
`)&&(g=g.slice(0,-1)),[...c.slice(0,l.line),...g.split(`
`)]):[...c.slice(0,l.line),...g.split(`
2022-05-27 03:57:56 -04:00
`),...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 wH(o,n.eol)}function NY(n,e){return e.map(t=>{var c,h;let{start:i,end:r}=t.range,o=(c=n[i.line])!=null?c:"",s=Q(o.slice(0,i.character)),a=r.line==i.line?o:(h=n[r.line])!=null?h:"",l=Q(a.slice(0,r.character)),{newText:u}=t;return[u.length>0?u.split(`
`):[],i.line,s,r.line,l]})}function Zb(n,e){let{range:t,newText:i}=e;if(De(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 Hbe(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 Jb(n,e){let t=er.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+=ra(o);continue}De(o.range.end,t)>0||(o.range.end.line==t.line?t=Hbe(t,o):(i=!0,t.line+=ra(o)))}return t}function XT(n,e){let t=0;for(let i of e){let r=Wb(i.range);De(r.end,n)<=0&&(t+=ra(i))}return t}function BY(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=qbe(i,er.Position.create(a,l),t);return er.TextEdit.replace(er.Range.create(i,r),u)}function qbe(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 er,no=_(()=>{"use strict";er=C(H());yt();_e()});var UT,FFe,tr,Fg,HY=_(()=>{"use strict";UT=C(H());z();kc();FFe=q()("model-chars"),tr=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 tr(65,90)),i.push(new tr(97,122));else if(r=="@-@")i.push(new tr(64));else if(/^([A-Za-z])-([A-Za-z])$/.test(r)){let o=r.match(/^([A-Za-z])-([A-Za-z])$/);i.push(new tr(o[1].charCodeAt(0),o[2].charCodeAt(0)))}else if(/^\d+-\d+$/.test(r)){let o=r.match(/^(\d+)-(\d+)$/);i.push(new tr(Number(o[1]),Number(o[2])))}else if(/^\d+$/.test(r))i.push(new tr(Number(r)));else{let o=r.charCodeAt(0);i.some(s=>s.contains(o))||i.push(new tr(o))}return i}contains(e){return e>=this.start&&e<=this.end}},Fg=class{constructor(e){this.ranges=[];e&&(this.ranges=tr.fromKeywordOption(e))}addKeyword(e){let t=e.charCodeAt(0),{ranges:i}=this;i.some(r=>r.contains(t))||i.push(new tr(t))}clone(){let e=new Fg;return e.ranges=this.ranges.slice(),e}setKeywordOption(e){this.ranges=tr.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 Qr(),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 v=i[a-1].length;if(p-v<r){b=!0;break}a=a-1,p-=v}if(!b)for(;s<=e.line;){let v=i[s].length;if(p-v<r)break;p-=v,s+=1}l=i.slice(s,a).join(`
`)}e=UT.Position.create(e.line-s,e.character),t=UT.Position.create(t.line-s,t.character);let u=jn.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 v=l.substring(g,p);o.set(v,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 v=p==h-1?p+1:p,w=l.substring(g,v),D=o.get(w)||0,S=h-p+(v-g);S!==d&&o.set(w,Math.max(D,S/d))}f=b}return o}}});var GT,QT,qY=_(()=>{"use strict";GT=C(H()),QT=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 GT.Range.create(this._line,0,this._line,this._text.length)}get rangeIncludingLineBreak(){return this._isLastLine?this.range:GT.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 $b,Ig,YY=_(()=>{"use strict";$b=C(H());qY();Ig=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(`
2022-05-18 13:29:28 -04:00
`)+(this.eol?`
2022-05-27 03:57:56 -04:00
`:"")),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?$b.Position.create(e,0):$b.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=$b.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 QT(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 KT(n){E.fire("BufDetach",[n])}function Rc(n){E.fire("LinesChanged",[n])}var zT,ir,VFe,Xb,WY=_(()=>{"use strict";zT=C(Pi()),ir=C(H());we();ae();$T();z();Ht();yt();_e();no();HY();YY();VFe=q()("model-document"),Xb=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 ir.Emitter;this.onDocumentChange=this._onDocumentChange.event;this.fireContentChanges=(0,zT.default)(()=>{this._fireContentChanges()},global.__TEST__?20:150),this.fetchContent=(0,zT.default)(()=>{this._fetchContent()},100),this.init(r)}get content(){return this.syncLines.join(`
2022-05-18 13:29:28 -04:00
`)+(this.eol?`
2022-05-27 03:57:56 -04:00
`:"")}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:{let t=this.env.filetypeMap;return String(t[e]||e)}}}get schema(){return O.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=Vm(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||KT(this.bufnr)},t=>{KT(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,Rc(t.id),E.pumvisible)return;this.fireContentChanges()}},this.disposables),this.buffer.listen("detach",()=>{KT(this.bufnr)},this.disposables)}get dirty(){return this.lines!==this.syncLines}get hasChanged(){return this.dirty?!Pe(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}=E,u;if(a&&a.bufnr==this.bufnr){let c=(s=this.lines[a.lnum-1])!=null?s:"";u=ir.Position.create(a.lnum-1,yi(c,a.col-1))}e=FY(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 b,v;if(Array.isArray(arguments[1])&&(e=arguments[1]),!this._attached||e.length===0)return;this._forceSync();let r=this.textDocument;if(e=OY(r,e),e.length===0)return;let o=MY(r,e);if(!o)return;let s=r.lines,a=RY(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=NY(s,e));let h,d=E.bufnr==this.bufnr,g;if(i&&d&&!l){let w=ir.Position.is(i)?i:void 0;if(i===!0&&this.bufnr===((b=E.cursor)==null?void 0:b.bufnr)){let{col:D,lnum:S}=E.cursor;w=ir.Position.create(S-1,yi(this.lines[S-1],D-1))}if(w){let D=Jb(w,e);if(De(w,D)!==0){let S=(v=o[D.line])!=null?v:"",L=Ze(S,D.character)+1;h=[D.line+1,L]}g=Ze(this.lines[w.line],w.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]:BY(e,s,o);await gH(),this.lines=o,Rc(this.bufnr),this.fireContentChanges.clear(),this._fireContentChanges(f);let p=ir.Range.create(a.start,0,a.start+a.replacement.length,0);return ir.TextEdit.replace(
`)+`
`)}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#ui#change_lines",[this.bufnr,t],!0),this.nvim.redrawVim(),this.lines=i,Rc(this.bufnr),this._forceSync())}_forceSync(){this.fireContentChanges.clear(),this._fireContentChanges()}forceSync(){global.hasOwnProperty("__TEST__")&&this._forceSync()}getOffset(e,t){return this.textDocument.offsetAt({line:e-1,character:t})}isWord(e){return this.chars.isKeyword(e)}async matchWords(e){return await this.chars.matchLines(this.textDocument.lines,2,e)}getWordRangeAtPosition(e,t,i=!0){let r=this.chars.clone();if(t&&t.length)for(let u of t)r.addKeyword(u);let o=this.getline(e.line,i),s=o[e.character];if(s==null||!r.isKeywordChar(s))return null;let a=e.character,l=e.character+1;for(;a>=0;){let u=o[a-1];if(!u||!r.isKeywordChar(u))break;a=a-1}for(;l<=o.length;){let u=o[l];if(!u||!r.isKeywordChar(u))break;l=l+1}return ir.Range.create(e.line,a,e.line,l)}createTextDocument(e,t){let{uri:i,languageId:r,eol:o}=this;return this._textDocument=new Ig(i,r,e,t,this.bufnr,o)}async _fetchContent(e){if(!this.env.isVim||!this._attached)return;let{nvim:t,bufnr:i,changedtick:r}=this,o=await t.call("coc#util#get_buf_lines",[i,r]);this._noFetch=!0,o?(this._changedtick=o.changedtick,this.lines=o.lines,Rc(this.bufnr),e?this._forceSync():this.fireContentChanges()):e&&this._forceSync()}changeLine(e,t,i){if(this.lines[e-1]===void 0)return;let o=this.lines.slice();o[e-1]=t,this.lines=o,Rc(this.bufnr),this._changedtick=i}async patchChange(e){if(!!this._attached)if(this.env.isVim)if(e){let t=await this.nvim.call("coc#util#get_changeinfo",[]);if(t.bufnr!==this.bufnr)return;if(t.changedtick<this._changedtick){this._forceSync();return}let{lnum:i,line:r,changedtick:o}=t,s=this.getline(i-1);if(this._changedtick=o,s==r)this._forceSync();else{let a=this.lines.slice();a[i-1]=r,this.lines=a,Rc(this.bufnr),this._forceSync()}}else this.fetchContent.clear(),await this._fetchContent(!0);else this._changedtick=await this.buffer.getVar("changedtick"),this._forceSync()}getSymbolRanges(e){let{version:t,filetype:i,uri:r}=this,o=new Ig(r,i,t,this.lines,this.bufnr,this.eol),s=[],a=o.getText(),l="";for(let u=0,c=a.length;u<c;u++){let h=a[u];if(h=="-"&&l.length==0)continue;let d=this.chars.isKeywordChar(h);d&&(l=l+h),l.length>0&&!d&&l==e&&s.push(ir.Range.create(o.positionAt(u-l.length),o.positionAt(u))),d||(l="")}return s}fixStartcol(e,t){let i=this.getline(e.line);if(!i)return null;let{character:r}=e,o=i.slice(0,r),s=Q(o),{chars:a}=this;for(let l=o.length-1;l>=0;l--){let u=o[l];if(u==" "||!a.isKeywordChar(u)&&!t.includes(u))break;s=s-Q(u)}return s}addHighlights(e,t,i,r={}){let{start:o,end:s}=i;if(!Ct(i))for(let a=o.line;a<=s.line;a++){let l=this.getline(a,!1),u=a==o.line?Ze(l,o.character):0,c=a==s.line?Ze(l,s.character):global.Buffer.byteLength(l);u>=c||e.push(Object.assign({hlGroup:t,lnum:a,colStart:u,colEnd:c},r))}}getline(e,t=!0){return t?this.lines[e]||"":this.syncLines[e]||""}getLines(e,t){return this.lines.slice(e!=null?e:0,t!=null?t:this.lines.length)}getDocumentContent(){let e=this.lines.join(`
2022-05-18 13:29:28 -04:00
`);return this.eol?e+`
2022-05-27 03:57:56 -04:00
`: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=et(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 Ig(this.uri,this.languageId,1,t,this.bufnr,this.eol)}setIskeyword(e){let t=this.chars=new Fg(e),i=this.getVar("additional_keywords",[]);if(i&&Array.isArray(i))for(let r of i)t.addKeyword(r)}detach(){this._disposed||(Z(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 bt(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 ZY,VT,ek,Sl,fn,Ub,Gb,JY=_(()=>{"use strict";ZY=C(xY()),VT=C(require("fs")),ek=C(require("os")),Sl=C(require("path")),fn=C(H());we();ae();WY();z();Je();_e();Ub=q()("core-documents"),Gb=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 fn.Emitter;this._onDidCloseDocument=new fn.Emitter;this._onDidChangeDocument=new fn.Emitter;this._onDidSaveDocument=new fn.Emitter;this._onWillSaveDocument=new fn.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=ZY.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))),E.on("BufDetach",this.onBufDetach,this,this.disposables),E.on("VimLeavePre",()=>{this.resolveCurrent(void 0)},null,this.disposables),E.on("WinEnter",c=>{this.winids.add(c)},null,this.disposables),E.on("BufWinEnter",(c,h)=>{this.winids.add(h)},null,this.disposables),E.on("DirChanged",c=>{this._cwd=c},null,this.disposables),E.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)||E.fire("BufUnload",[d]);for(let d of this.winids)h.includes(d)||E.fire("WinClosed",[d]);this.winids=new Set(h)},null,this.disposables);let u=c=>{this._bufnr=c,this.createDocument(c)};E.on("CursorMoved",u,null,this.disposables),E.on("CursorMovedI",u,null,this.disposables),E.on("BufUnload",this.onBufUnload,this,this.disposables),E.on("BufEnter",this.onBufEnter,this,this.disposables),E.on("BufCreate",this.onBufCreate,this,this.disposables),E.on("TermOpen",this.onBufCreate,this,this.disposables),E.on("BufWritePost",this.onBufWritePost,this,this.disposables),E.on("BufWritePre",this.onBufWritePre,this,this.disposables),E.on("FileType",this.onFileTypeChange,this,this.disposables),E.fire("BufEnter",[a]),E.fire("BufWinEnter",[a,s]),E.on("BufEnter",c=>{this.createDocument(c)},null,thi
2022-05-18 13:29:28 -04:00
`)+`
2022-05-27 03:57:56 -04:00
`}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(),Z(this.disposables)}}});function jg(){return $Y.default.randomBytes(16)}var $Y,tk=_(()=>{$Y=C(require("crypto"))});function Wbe(n,e){var t=e||0,i=XY;return[i[n[t++]],i[n[t++]],i[n[t++]],i[n[t++]],"-",i[n[t++]],i[n[t++]],"-",i[n[t++]],i[n[t++]],"-",i[n[t++]],i[n[t++]],"-",i[n[t++]],i[n[t++]],i[n[t++]],i[n[t++]],i[n[t++]],i[n[t++]]].join("")}var XY,Ag,Qb,ik=_(()=>{XY=[];for(Ag=0;Ag<256;++Ag)XY[Ag]=(Ag+256).toString(16).substr(1);Qb=Wbe});function Zbe(n,e,t){var i=e&&t||0,r=e||[];n=n||{};var o=n.node||UY,s=n.clockseq!==void 0?n.clockseq:nk;if(o==null||s==null){var a=n.random||(n.rng||jg)();o==null&&(o=UY=[a[0]|1,a[1],a[2],a[3],a[4],a[5]]),s==null&&(s=nk=(a[6]<<8|a[7])&16383)}var l=n.msecs!==void 0?n.msecs:new Date().getTime(),u=n.nsecs!==void 0?n.nsecs:ok+1,c=l-rk+(u-ok)/1e4;if(c<0&&n.clockseq===void 0&&(s=s+1&16383),(c<0||l>rk)&&n.nsecs===void 0&&(u=0),u>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");rk=l,ok=u,nk=s,l+=122192928e5;var h=((l&268435455)*1e4+u)%4294967296;r[i++]=h>>>24&255,r[i++]=h>>>16&255,r[i++]=h>>>8&255,r[i++]=h&255;var d=l/4294967296*1e4&268435455;r[i++]=d>>>8&255,r[i++]=d&255,r[i++]=d>>>24&15|16,r[i++]=d>>>16&255,r[i++]=s>>>8|128,r[i++]=s&255;for(var g=0;g<6;++g)r[i+g]=o[g];return e||Qb(r)}var UY,nk,rk,ok,Uo,GY=_(()=>{tk();ik();rk=0,ok=0;Uo=Zbe});function Jbe(n,e,t){var i=e&&t||0;typeof n=="string"&&(e=n==="binary"?new Array(16):null,n=null),n=n||{};var r=n.random||(n.rng||jg)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,e)for(var o=0;o<16;++o)e[i+o]=r[o];return e||Qb(r)}var oe,QY=_(()=>{tk();ik();oe=Jbe});var Oe=_(()=>{GY();QY()});var Li,oa=_(()=>{"use strict";bc();_e();Li=class{constructor(){this.lines=[];this._highlights=[]}addLine(e,t){if(e.includes(`
`)){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:Q(e),hlGroup:t}),e.includes("\x1B")){let i=mc(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=Q(i);r.hlGroup&&this._highlights.push({lnum:t,colStart:o,colEnd:o+Q(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(e.includes(`
`)){let o=e.split(`
`);this.addText(o[0],t);for(let s of o.slice(1))this.addLine(s,t);return}if(t){let o=Q(r);this._highlights.push({lnum:i.length?i.length-1:0,colStart:o,colEnd:o+Q(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 Xbe(n,e){var i,r;let t=new Map;for(let o of n){let s=(i=Lg(o))!=null?i:null,a=s&&(r=e[s].label)!=null?r:null,l=t.get(a);l?l.push(o):t.set(a,[o])}return t}var Og,Kb,AIe,$be,zb,KY=_(()=>{"use strict";Og=C(_g()),Kb=C(require("path"));Ur();we();ae();z();Je();no();oa();AIe=q()("mdoe-editInspect"),$be=0,zb=class{constructor(e,t){this.nvim=e;this.keymaps=t;this.disposables=[];this.items=[];this.renameMap=new Map;E.on("BufUnload",i=>{i==this.bufnr&&this.dispose()},null,this.disposables)}addFile(e,t,i){this.items.push({index:t.length,filepath:e,lnum:i})}async show(e){var c,h;let{nvim:t}=this,i=$be++;t.pauseNotification(),t.command(`tabe +setl\\ buftype=nofile CocWorkspaceEdit${i}`,!0),t.command("setl bufhidden=wipe nolist",!0),t.command("setl nobuflisted wrap undolevels=-1 filetype=cocedits noswapfile",!0),await t.resumeNotification(!0);let r=await t.buffer,o=await t.call("getcwd");this.bufnr=r.id;let s=d=>{let g=O.parse(d).fsPath;return Ae(o,g,!0)?Kb.default.relative(o,g):g},a=d=>Kb.default.isAbsolute(d)?d:Kb.default.join(o,d),l=new Li,u=Xbe((c=e.edit.documentChanges)!=null?c:[],(h=e.edit.changeAnnotations)!=null?h:{});for(let[d,g]of u.entries()){d&&(l.addLine(d,"MoreMsg"),l.addLine(""));for(let f of g)if(Ws.is(f)){let p=e.changes[f.textDocument.uri],b=s(f.textDocument.uri);l.addTexts([{text:"Change",hlGroup:"Title"},{text:" "},{text:b,hlGroup:"Directory"},{text:`:${p.lnum}`,hlGroup:"LineNr"}]),this.addFile(b,l,p.lnum),l.addLine(""),this.addChangedLines(l,p,b,p.lnum),l.addLine("")}else if(Zs.is(f)||qo.is(f)){let p=qo.is(f)?"Delete":"Create",b=s(f.uri);l.addTexts([{text:p,hlGroup:"Title"},{text:" "},{text:b,hlGroup:"Directory"}]),this.addFile(b,l),l.addLine("")}else if(Js.is(f)){let p=s(f.oldUri),b=s(f.newUri);l.addTexts([{text:"Rename",hlGroup:"Title"},{text:" "},{text:p,hlGroup:"Directory"},{text:"->",hlGroup:"Comment"},{text:b,hlGroup:"Directory"}]),this.renameMap.set(p,b),this.addFile(b,l),l.addLine("")}}t.pauseNotification(),l.render(r),r.setOption("modifiable",!1,!0),await t.resumeNotification(!0),this.disposables.push(this.keymaps.registerLocalKeymap("n","<CR>",async()=>{var v;let d=await t.call("line","."),g=await t.call("col","."),f;for(let w=this.items.length-1;w>=0;w--){let D=this.items[w];if(d>=D.index){f=D;break}}if(!f)return;let p=O.file(a(f.filepath)).toString(),b=this.renameMap.has(f.filepath)?this.renameMap.get(f.filepath):f.filepath;if(await t.call("coc#util#open_file",["tab drop",a(b)]),typeof f.lnum=="number"){let D=((v=e.edit.documentChanges)!=null?v:[]).find(L=>Ws.is(L)&&L.textDocument.uri==p),S=f.lnum;if(D){let L=Rg(D.edits,(j,W)=>{let N=j.range.start.line-W.range.start.line;return N===0?j.range.start.character-W.range.start.character:N});S=Jb(Vt.create(S-1,0),L).line+1}await t.call("cursor",[S,g])}t.redrawVim()},!0)),this.disposables.push(this.keymaps.registerLocalKeymap("n","<esc>",async()=>{t.command("bwipeout!",!0)},!0))}addChangedLines(e,t,i,r){let o=(0,Og.default)(t.oldLines.join(`
`),t.newLines.join(`
`));for(let s=0;s<o.length;s++){let a=o[s];if(a[0]==Og.default.EQUAL){let l=a[1];if(!l.includes(`
`))e.addText(l);else{let u=l.split(`
`);e.addText(u[0]);let c=r+u.length-1;e.addLine(""),e.addTexts([{text:"Change",hlGroup:"Title"},{text:" "},{text:i,hlGroup:"Directory"},{text:`:${c}`,hlGroup:"LineNr"}]),this.addFile(i,e,c),e.addLine("");let h=u[u.length-1];h.length>0&&e.addText(h)}r+=l.split(`
`).length-1}else a[0]==Og.default.DELETE?(r+=a[1].split(`
`).length-1,e.addText(a[1],"DiffDelete")):a[0]==Og.default.INSERT&&e.addText(a[1],"DiffAdd")}}dispose(){Z(this.disposables)}}});function sk(n){return n?new Error(`Illegal argument: ${n}`):new Error("Illegal argument")}function ak(n){return new Error(`File ${n} already exists`)}function Vb(n){return new Error(`File ${n} not exists`)}function zY(n){return new Error(`${n} should not be called in an asynchronize manner`)}function ey(n){return new Error(`Change of ${n} not supported`)}var lk=_(()=>{"use strict"});function Qbe(n,e,t){let i=jr.default.join(n,e);if(typeof t!="string"){let r=t.baseUri.fsPath;if(!Ae(r,i))return!1;let o=jr.default.relative(r,i);return(0,uk.default)(o,t.pattern,{dot:!0})}return(0,uk.default)(e,t,{dot:!0})}function ty(n){return O.parse(n).fsPath}var ct,VY,uk,iy,jr,eW,St,Gbe,ny,tW=_(()=>{"use strict";ct=C(Rn()),VY=C(hb()),uk=C(Vn()),iy=C(require("os")),jr=C(require("path")),eW=require("util");Oe();St=C(H());we();ae();KY();lk();Je();_e();no();Sb();Gbe=q()("core-files"),ny=class{constructor(e,t,i,r){this.documents=e;this.configurations=t;this.workspaceFolderControl=i;this.keymaps=r;this.operationTimeout=500;this._onDidCreateFiles=new St.Emitter;this._onDidRenameFiles=new St.Emitter;this._onDidDeleteFiles=new St.Emitter;this._onWillCreateFiles=new St.Emitter;this._onWillRenameFiles=new St.Emitter;this._onWillDeleteFiles=new St.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,i){this.nvim=e,this.env=t,this.window=i}async openTextDocument(e){e=typeof e=="string"?O.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(!ct.default.existsSync(e.fsPath))throw Vb(e.fsPath);ct.default.accessSync(e.fsPath,ct.default.constants.R_OK)}return i=="untitled"?(await this.nvim.call("coc#util#open_file",["tab drop",e.path]),await this.documents.document):await this.loadResource(e.toString())}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=Q(u.slice(0,t.character))+1;s.call("cursor",[t.line+1,c],!0)}await s.resumeNotification(!0)}else{let{fsPath:u,scheme:c}=O.parse(e),h=t==null?null:[t.line,t.character];if(c=="file"){let d=mg(jr.default.normalize(u));await this.nvim.call("coc#util#jump",[o,d,h])}else iy.default.platform()=="win32"&&(e=e.replace(/\/?/,"?")),await this.nvim.call("coc#util#jump",[o,e,h])}}async openResource(e){let{nvim:t}=this,i=O.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)}async loadResource(e){let t=this.documents.getDocument(e);if(t)return t;let r=this.configurations.getConfiguration("workspace").get("openResourceCommand","tab drop"),o=O.parse(e),s=o.scheme==="file"?o.fsPath:e,a;if(r){let l=await this.nvim.call("win_getid");a=await this.nvim.call("coc#util#open_file",[r,s]),await this.nvim.call("win_gotoid",[l])}else a=(await this.nvim.call("coc#ui#open_files",[[s]]))[0];return await this.documents.createDocument(a)}async loadResources(e){let{documents:t}=this,i=e.map(o=>{let s=O.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 createFile(e,t={},i){let{nvim:r}=this,o=ct.default.existsSync(e);if(o&&!t.overwrite&&!t.ignoreIfExists)throw ak(e);if(!o||t.overwrite){let s=new St.CancellationTokenSource;await this.fireWaitUntilEvent(this._onWillCreateFiles,{
`)?w.slice(0,-1).split(`
`):w.split(`
`)},r.push(async()=>{let S=this.documents.getDocument(f);!S||!S.attached||S.version!==v||(await S.applyEdits([b]),d.version=S.version)})}}else St.CreateFile.is(h)?await this.createFile(ty(h.uri),h.options,r):St.DeleteFile.is(h)?await this.deleteFile(ty(h.uri),h.options,r):St.RenameFile.is(h)&&await this.renameFile(ty(h.oldUri),ty(h.newUri),h.options,r);if(r.length===0)return!0;t||(this.editState={edit:{documentChanges:i,changeAnnotations:e.changeAnnotations},changes:u,recovers:r,applied:!0}),this.nvim.redrawVim()}catch(s){return Gbe.error("Error on applyEdits:",e,s),await this.undoChanges(r),t||this.window.showErrorMessage(`Error on applyEdits: ${s}`),!1}return t||o||this.window.showInformationMessage("Use ':wa' to save changes or ':CocCommand workspace.inspectEdit' to inspect."),!0}async undoChanges(e){for(;e.length>0;)await e.pop()()}async inspectEdit(){if(!this.editState){this.window.showWarningMessage("No workspace edit to inspect");return}await new zb(this.nvim,this.keymaps).show(this.editState)}async undoWorkspaceEdit(){let{editState:e}=this;if(!e||!e.applied){this.window.showWarningMessage("No workspace edit to undo");return}e.applied=!1,await this.undoChanges(e.recovers)}async redoWorkspaceEdit(){let{editState:e}=this;if(!e||e.applied){this.window.showWarningMessage("No workspace edit to redo");return}this.editState=void 0,await this.applyEdit(e.edit)}validateChanges(e){let{documents:t}=this;for(let i of e)if(St.TextDocumentEdit.is(i)){let{uri:r,version:o}=i.textDocument,s=t.getDocument(r);if(typeof o=="number"&&o>0){if(!s)throw new Error(`File ${r} not loaded`);if(s.version!=o)throw new Error(`${r} changed before apply edit`)}else if(!s&&!bg(r))throw ey(O.parse(r).scheme)}else if(St.CreateFile.is(i)||St.DeleteFile.is(i)){if(!bg(i.uri))throw ey(O.parse(i.uri).scheme)}else if(St.RenameFile.is(i)&&(!bg(i.oldUri)||!bg(i.newUri)))throw ey(O.parse(i.oldUri).scheme)}async findFiles(e,t,i,r){let o=this.workspaceFolderControl.workspaceFolders;if((r==null?void 0:r.isCancellationRequested)||!o.length||i===0)return[];i=i!=null?i:1/0;let s=o.map(u=>O.parse(u.uri).fsPath);if(typeof e!="string"){let u=e.baseUri.fsPath;s=s.filter(c=>Ae(u,c,!0))}let a=typeof e=="string"?e:e.pattern,l=[];for(let u of s){if(l.length>=i)break;let c=await(0,eW.promisify)(VY.default)(a,{dot:!0,cwd:u,nodir:!0,absolute:!1});if(r!=null&&r.isCancellationRequested)return[];for(let h of c)if(!(t&&Qbe(u,h,t))&&(l.push(O.file(jr.default.join(u,h))),l.length===i))break}return l}async fireWaitUntilEvent(e,t,i){let r=!0,o=[];e.fire(Ba(ge({},t),{waitUntil:s=>{if(!r)throw zY("waitUntil");let a=new Promise(u=>{setTimeout(u,this.operationTimeout)}),l=Promise.race([s,a]).then(u=>{if(u&&St.WorkspaceEdit.is(u))return this.applyEdit(u,!0)});o.push(l)}})),r=!1,await Promise.all(o)}}});function ck(n,e){for(let t of e)if(n.includes(t))return!0;return!1}function iW(n,e,t=0){let i=-1;for(let r=t;r<n.length;r++)if(n[r]===e){i=r;break}return i}function ry(n,e){let t=[[],[]];for(let i of n)e(i)?t[0].push(i):t[1].push(i);return t}function nW(n,e){let t=[[],[]];return n.forEach(i=>{e(i)?t[0].push(i):t[1].push(i)}),t}function sa(n,e){if(!e)return n.filter((i,r)=>n.indexOf(i)===r);let t=Object.create(null);return n.filter(i=>{let r=e(i);return t[r]?!1:(t[r]=!0,!0)})}var Go=_(()=>{"use strict"});var sW=m((eje,oW)=>{var hk=4294967296,rW=[];for(Lc=0;Lc<256;Lc++)rW[Lc]=(Lc>15?"":"0")+Lc.toString(16);var Lc,Mg=oW.exports=function(n,e){n instanceof Buffer?(this.buffer=n,this.offset=e||0):Object.prototype.toString.call(n)=="[object Uint8Array]"?(this.buffer=new Buffer(n),this.offset=e||0):(this.buffer=this.buffer||new Buffer(8),this.offset=0,this.setValue.apply(this,arguments))};Mg.MAX_INT=Math.pow(2,53);Mg.MIN_INT=-Math.pow(2,53);Mg.prototype={constructor:Mg,_2scomp:function(){for(var n=this.buffer,e=this.offset,t=1,i=e+7;i>=e;i--){var r=(n[i]^255)+t;n[i]=r&255,t=r>>8}},setValue:function(n,e){var t=!1;if(arguments.length==1)if(typeof n=="number"){if(t=n<0,n=Math.abs(n),e=n%hk,n=n/hk,n>hk)throw new RangeError(n+" is outside Int64 range");n=n|0}else if(typeof n=="string")n=(n+"").replace
`)),e[e.length-1]==""&&(e=e.slice(0,-1)),sa(e)}catch{return[]}}loadSync(){if(!ca.default.existsSync(this.file))return[];try{let e=ca.default.readFileSync(this.file,"utf8");return e=e.trim(),e.length?e.trim().split(`
`):[]}catch{return[]}}async add(e){let t;try{t=ca.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 ca.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 ca.default.writeFile(this.file,t.join(`
`),"utf8")}async clean(){try{await ca.default.unlink(this.file)}catch{}}}});var Iy,jy,JZ=_(()=>{"use strict";Iy=C(H());ae();z();jy=class{constructor(e,t){this.nvim=e;this.id=t;this.disposables=[];this._onExit=new Iy.Emitter;this._onStderr=new Iy.Emitter;this._onStdout=new Iy.Emitter;this.onExit=this._onExit.event;this.onStdout=this._onStdout.event;this.onStderr=this._onStderr.event;E.on("TaskExit",(i,r)=>{i==this.id&&this._onExit.fire(r)},null,this.disposables),E.on("TaskStderr",(i,r)=>{i==this.id&&this._onStderr.fire(r)},null,this.disposables),E.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(),Z(this.disposables)}}});var UZ,Bk,ha,$Z,XZ,vwe,GZ,y,V=_(()=>{"use strict";UZ=C(Rn()),Bk=C(require("os")),ha=C(require("path"));we();TT();gY();pY();yY();vb();vY();JY();tW();_W();OZ();MZ();NZ();Sb();BZ();qZ();WZ();ae();ZZ();Mk();sf();JZ();z();$Z=30,XZ=q()("workspace"),vwe=["showMessage","runTerminalCommand","openTerminal","showQuickpick","menuPick","openLocalConfig","showPrompt","createStatusBarItem","createOutputChannel","showOutputChannel","requestInput","echoLines","getCursorPosition","moveTo","getOffset","getSelectedRange","selectRange","createTerminal"],GZ=class{constructor(){this.version=Tb;let e=ha.default.normalize(process.env.COC_VIMCONFIG)||ha.default.join(Bk.default.homedir(),".vim"),t=ha.default.join(e,Er);this.configurations=new Xo(t,new Mb(this)),this.workspaceFolderControl=new Ly(this.configurations);let i=this.documentsManager=new Gb(this.configurations,this.workspaceFolderControl);this.contentProvider=new Bb(i),this.watchers=new _y,this.autocmds=new Nb(this.contentProvider,this.watchers),this.keymaps=new Ey(i),this.locations=new Py(this.configurations,i,this.contentProvider),this.files=new ny(i,this.configurations,this.workspaceFolderControl,this.keymaps),this.editors=new Ry(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 qg(this.workspaceFolderControl,r)}async init(e){let{nvim:t}=this;for(let o of vwe)Object.defineProperty(this,o,{get:()=>(...s)=>{let a=`
2022-05-18 13:29:28 -04:00
`+Error().stack.split(`
`).slice(2,4).join(`
2022-05-27 03:57:56 -04:00
`);return XZ.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=`
2022-05-18 13:29:28 -04:00
`+Error().stack.split(`
`).slice(2,4).join(`
2022-05-27 03:57:56 -04:00
`);return XZ.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!=$Z&&t.echoError(`API version ${this._env.apiversion} is not ${$Z}, 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,e),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=$o.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 E.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=>O.parse(e.uri).fsPath)}get channelNames(){return $o.names}get pluginRoot(){return ha.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 FZ(e)}getConfigFile(e){return this.configurations.getConfigFile(e)}has(e){return LZ(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 Ak(e,t.uri,t.languageId)}createFileSystemWatcher(e,t,i,r){return this.fileSystemWatchers.createFileSystemWatcher(e,t,i,r)}getWatchmanPath(){return IZ(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 ro(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(O.parse(e))}readFile(e){return this.documentsManager.readFile(e)}async getCurrentState(){let e=await this.document,t=await xb(this.nvim);return{document:e.textDocument,position:t}}async getFormatOptions(e){return this.documentsManager.getFormatOptions(e)}resolveModule(e){return AZ(e)}async runCommand(e,t,i){return t=t||this.cwd,Kr(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 jy(this.nvim,e)}createDatabase(e){let t;global.hasOwnProperty("__TEST__")?(t=ha.default.join(Bk.default.tmpdir(),`coc-${process.pid}`),UZ.default.mkdirpSync(t)):t=ha.def
`,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}};vv.parse=(n,e,t)=>new vv(SDe(TDe(n),e),t);var SDe=(n,e)=>e?Object.keys(n).reduce((t,i)=>(t[i]=n[i],t),e):n,TDe=n=>n.replace(/\n$/,"").split(`
`).reduce(kDe,Object.create(null)),kDe=(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};J$.exports=vv});var Gc=m((zBe,$$)=>{$$.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 Dv=m((VBe,X$)=>{"use strict";X$.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 vE=m((eHe,U$)=>{"use strict";var xv=["|","<",">","?",":"],yE=xv.map(n=>String.fromCharCode(61440+n.charCodeAt(0))),EDe=new Map(xv.map((n,e)=>[n,yE[e]])),PDe=new Map(yE.map((n,e)=>[n,xv[e]]));U$.exports={encode:n=>xv.reduce((e,t)=>e.split(t).join(EDe.get(t)),n),decode:n=>yE.reduce((e,t)=>e.split(t).join(PDe.get(t)),n)}});var wE=m((tHe,Q$)=>{var{isAbsolute:_De,parse:G$}=require("path").win32;Q$.exports=n=>{let e="",t=G$(n);for(;_De(n)||t.root;){let i=n.charAt(0)==="/"&&n.slice(0,4)!=="//?/"?"/":t.root;n=n.substr(i.length),e+=i,t=G$(n)}return[e,n]}});var z$=m((iHe,K$)=>{"use strict";K$.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 _E=m((oHe,gX)=>{"use strict";var oX=Zc(),sX=wv(),aX=Uc(),so=require("fs"),V$=require("path"),oo=$c(),RDe=Gc(),lX=(n,e)=>e?(n=oo(n).replace(/^\.(\/|$)/,""),RDe(e)+"/"+n):oo(n),LDe=16*1024*1024,eX=Symbol("process"),tX=Symbol("file"),iX=Symbol("directory"),xE=Symbol("symlink"),nX=Symbol("hardlink"),pf=Symbol("header"),Cv=Symbol("read"),CE=Symbol("lstat"),Sv=Symbol("onlstat"),SE=Symbol("onread"),TE=Symbol("onreadlink"),kE=Symbol("openfile"),EE=Symbol("onopenfile"),ba=Symbol("close"),Tv=Symbol("mode"),PE=Symbol("awaitDrain"),DE=Symbol("ondrain"),ao=Symbol("prefix"),rX=Symbol("hadError"),uX=Dv(),FDe=vE(),cX=wE(),hX=z$(),kv=uX(class extends oX{constructor(e,t){t=t||{};super(t);if(typeof e!="string")throw new TypeError("path is required");this.path=oo(e),this.portable=!!t.portable,this.myuid=process.getuid&&process.getuid()||0,this.myuser=process.env.USER||"",this.maxReadSize=t.maxReadSize||LDe,this.linkCache=t.linkCache||new Map,this.statCache=t.statCache||new Map,this.preservePaths=!!t.preservePaths,this.cwd=oo(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?oo(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]=cX(this.path);r&&(this.path=o,i=r)}this.win32=!!t.win32||process.platform==="win32",this.win32&&(this.path=FDe.decode(this.path.replace(/\\/g,"/")),e=e.replace(/\\/g,"/")),this.absolute=oo(t.absolute||V$.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[Sv](this.statCache.get(this.absolute)):this[CE]()}emit(e,...t){return e==="error"&&(this[rX]=!0),super.emit(e,...t)}[CE](){so.lstat(this.absolute,(e,t)=>{if(e)return this.emit("error",e);this[Sv](t)})}[Sv](e){this.statCache.set(this.absolute,e),this.stat=e,e.isFile()||(e.size=0),this.type=jDe(e),this.emit("stat",e),this[eX]()}[eX](){switch(this.type){case"File":return this[tX]();case"Directory":return this[iX]();case"SymbolicLink":return this[xE]();default:return this.end()}}[Tv](e){return hX(e,this.type==="Directory",this.portable)}[ao](e){return lX(e,this.prefix)}[pf](){this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.header=new aX({path:this[ao](this.path),linkpat
`).some(e=>e.indexOf("(https.js:")!==-1||e.indexOf("node:https:")!==-1)}function sw(n,e){return new sw.Agent(n,e)}(function(n){class e extends GCe.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:EP()?443:80}set defaultPort(i){this.explicitDefaultPort=i}get protocol(){return typeof this.explicitProtocol=="string"?this.explicitProtocol:EP()?"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=EP()),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),zCe(g)){Rf("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?(Rf("Converting legacy callback function to promise"),this.promisifiedCallback=KCe.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{Rf("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){Rf("Freeing socket %o %o",i.constructor.name,r),i.destroy()}destroy(){Rf("Destroying agent %o",this.constructor.name)}}n.Agent=e,n.prototype=n.Agent.prototype})(sw||(sw={}));X8.exports=sw});var G8=m(Jl=>{"use strict";var VCe=Jl&&Jl.__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())})},Lf=Jl&&Jl.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(Jl,"__esModule",{value:!0});var eSe=Lf(require("net")),tSe=Lf(require("tls")),RP=Lf(require("url")),iSe=Lf(At()),nSe=Lf(Z8()),rSe=_P(),Pa=(0,iSe.default)("http-proxy-agent");function oSe(n){return typeof n=="string"?/^https:?$/i.test(n):!1}var U8=class extends rSe.Agent{constructor(e){let t;if(typeof e=="string"?t=RP.default.parse(e):t=e,!t)throw new Error("an HTTP(S) proxy server `host` and `port` must be specified!");Pa("Creating new HttpProxyAgent instance: %o",t);super(t);let i=Object.assign({},t);this.secureProxy=t.secureProxy||oSe(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 VCe(this,void 0,void 0,function*(){let{proxy:i,secureProxy:r}=this,o=RP.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)
2022-05-18 13:29:28 -04:00
\r
2022-05-27 03:57:56 -04:00
`)+4,e.output[0]=e._header+a.substring(l),Pa("Output buffer: %o",e.output)):e.outputData&&e.outputData.length>0&&(Pa("Patching connection write() output buffer with updated header"),a=e.outputData[0].data,l=a.indexOf(`\r
2022-05-18 13:29:28 -04:00
\r
2022-05-27 03:57:56 -04:00
`)+4,e.outputData[0].data=e._header+a.substring(l),Pa("Output buffer: %o",e.outputData[0].data))}return yield(0,nSe.default)(s,"connect"),s})}};Jl.default=U8});var K8=m((IP,Q8)=>{"use strict";var sSe=IP&&IP.__importDefault||function(n){return n&&n.__esModule?n:{default:n}},LP=sSe(G8());function FP(n){return new LP.default(n)}(function(n){n.HttpProxyAgent=LP.default,n.prototype=LP.default.prototype})(FP||(FP={}));Q8.exports=FP});var z8=m(If=>{"use strict";var aSe=If&&If.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(If,"__esModule",{value:!0});var lSe=aSe(At()),Ff=lSe.default("https-proxy-agent:parse-proxy-response");function uSe(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){Ff("onclose had error %o",h)}function l(){Ff("onend")}function u(h){s(),Ff("onerror %o",h),t(h)}function c(h){r.push(h),i+=h.length;let d=Buffer.concat(r,i);if(d.indexOf(`\r
2022-05-18 13:29:28 -04:00
\r
2022-05-27 03:57:56 -04:00
`)===-1){Ff("have not received end of HTTP headers yet..."),o();return}let f=d.toString("ascii",0,d.indexOf(`\r
`)),p=+f.split(" ")[1];Ff("got proxy server response: %o",f),e({statusCode:p,buffered:d})}n.on("error",u),n.on("close",a),n.on("end",l),o()})}If.default=uSe});var iG=m($l=>{"use strict";var cSe=$l&&$l.__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())})},dh=$l&&$l.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty($l,"__esModule",{value:!0});var V8=dh(require("net")),eG=dh(require("tls")),hSe=dh(require("url")),dSe=dh(require("assert")),gSe=dh(At()),fSe=_P(),pSe=dh(z8()),jf=gSe.default("https-proxy-agent:agent"),tG=class extends fSe.Agent{constructor(e){let t;if(typeof e=="string"?t=hSe.default.parse(e):t=e,!t)throw new Error("an HTTP(S) proxy server `host` and `port` must be specified!");jf("creating new HttpsProxyAgent instance: %o",t);super(t);let i=Object.assign({},t);this.secureProxy=t.secureProxy||ySe(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 cSe(this,void 0,void 0,function*(){let{proxy:i,secureProxy:r}=this,o;r?(jf("Creating `tls.Socket`: %o",i),o=eG.default.connect(i)):(jf("Creating `net.Socket`: %o",i),o=V8.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;bSe(c,h)||(u+=`:${c}`),s.Host=u,s.Connection="close";for(let b of Object.keys(s))l+=`${b}: ${s[b]}\r
`;let d=pSe.default(o);o.write(`${l}\r
`);let{statusCode:g,buffered:f}=yield d;if(g===200){if(e.once("socket",mSe),t.secureEndpoint){let b=t.servername||t.host;if(!b)throw new Error('Could not determine "servername"');return jf("Upgrading socket connection to TLS"),eG.default.connect(Object.assign(Object.assign({},vSe(t,"host","hostname","path","port")),{socket:o,servername:b}))}return o}o.destroy();let p=new V8.default.Socket;return p.readable=!0,e.once("socket",b=>{jf("replaying proxy buffer for failed request"),dSe.default(b.listenerCount("data")>0),b.push(f),b.push(null)}),p})}};$l.default=tG;function mSe(n){n.resume()}function bSe(n,e){return Boolean(!e&&n===80||e&&n===443)}function ySe(n){return typeof n=="string"?/^https:?$/i.test(n):!1}function vSe(n,...e){let t={},i;for(i in n)e.includes(i)||(t[i]=n[i]);return t}});var rG=m((OP,nG)=>{"use strict";var wSe=OP&&OP.__importDefault||function(n){return n&&n.__esModule?n:{default:n}},jP=wSe(iG());function AP(n){return new jP.default(n)}(function(n){n.HttpsProxyAgent=jP.default,n.prototype=jP.default.prototype})(AP||(AP={}));nG.exports=AP});var sG=m(($He,oG)=>{"use strict";var DSe=["aborted","complete","headers","httpVersion","httpVersionMinor","httpVersionMajor","method","rawHeaders","rawTrailers","setTimeout","socket","statusCode","statusMessage","trailers","url"];oG.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(DSe)),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 lG=m((XHe,aG)=>{"use strict";var{Transform:xSe,PassThrough:CSe}=require("stream"),MP=require("zlib"),SSe=sG();aG.exports=n=>{let e=(n.headers["content-encoding"]||"").toLowerCase();if(!["gzip","deflate","br"].includes(e))return n;let t=e==="br";if(t&&typeof MP.createBrotliDecompress!="function")return n.destroy(new Error("Brotli is not supported on Node.js < 12")),n;let i=!0,r=new xSe({transform(a,l,u){i=!1,u(null,a)},flush(a){a()}}),o=new CSe({autoDestroy:!1,destroy(a,l){n.destroy(),l(a)}}),s=t?MP.createBrotliDecompress():MP.createUnzip();return s.once("error",a=>{if(i&&!n.readable){o.end();return}o.destroy(a)}),SSe(n,o),n.pipe(r).pipe(s).pipe(o),o}});function TSe(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 kSe(n,e){let t=e.proxyUrl||TSe(n);if(t){let i=(0,NP.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 fG.info(`Using proxy ${t} from ${e.proxyUrl?"configuration":"system environment"} for ${n.hostname}:`),n.protocol==="http:"?(0,hG.default)(r):(0,dG.default)(r)}return null}function BP(n,e={}){let t=y.getConfiguration("http"),{data:i}=e,r=PSe(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,cG.stringify)(e.query)}`);let s=Object.assign(e.headers||{},{"Proxy-Authorization":o.proxyAuthorization}),a=(0,NP.parse)(n),l=kSe(a,o),u={method:e.method||"GET",hostname:a.hostname,port:a.port?parseInt(a.port,10):a.protocol==="
2022-05-18 13:29:28 -04:00
`+Error().stack.split(`
`).slice(2,4).join(`
2022-05-27 03:57:56 -04:00
`);if(ho.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 JP(250),this._onReady=new Promise((u,c)=>{this._onReadyCallbacks=new QP(u,c)}),this._onStop=void 0,this._stateChangeEmitter=new x.Emitter,this._trace=x.Trace.Off,this._tracer={log:(u,c)=>{Ee(u)?this.logTrace(u,c):this.logObjectTrace(u)}},this._syncedDocuments=new Map;let a=y.getConfiguration("coc.preferences");this._markdownSupport=a.get("enableMarkdown",!0),this.registerBuiltinFeatures()}get supportedMarkupKind(){return this._markdownSupport?[x.MarkupKind.Markdown,x.MarkupKind.PlainText]:[x.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==x.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=k.createOutputChannel(e||this._name)}return this._outputChannel}get diagnostics(){return this._diagnostics}createDefaultErrorHandler(e){return new WG(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 x.ResponseError){let t=e;return` Message: ${t.message}
2022-05-18 13:29:28 -04:00
Code: ${t.code} ${t.data?`
2022-05-27 03:57:56 -04:00
`+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."),x.Disposable.create(()=>{});if(this._onReadyCallbacks.isUsed&&(this._onReady=new Promise((e,t)=>{this._onReadyCallbacks=new QP(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=A.createDiagnosticCollection(t))}return this.state=1,this.resolveConnection().then(e=>(e.onLogMessage(t=>{let i;switch(t.type){case x.MessageType.Error:i="error",this.error(t.message);break;case x.MessageType.Warning:i="warning",this.warn(t.message);break;case x.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 x.MessageType.Error:k.showErrorMessage(t.message);break;case x.MessageType.Warning:k.showWarningMessage(t.message);break;case x.MessageType.Info:k.showInformationMessage(t.message);break;default:k.showInformationMessage(t.message)}}),e.onRequest(x.ShowMessageRequest.type,t=>{let i;switch(t.type){case x.MessageType.Error:i=k.showErrorMessage.bind(k);break;case x.MessageType.Warning:i=k.showWarningMessage.bind(k);break;case x.MessageType.Info:i=k.showInformationMessage.bind(k);break;default:i=k.showInformationMessage.bind(k)}let r=t.actions||[];return i(t.message,...r).then(o=>o==null?null:o)}),e.onRequest(x.ShowDocumentRequest.type,async t=>{var o;let i=async s=>{try{if(s.external===!0||/^https?:\/\//.test(s.uri))return await y.openResource(s.uri),{success:!0};{let{selection:a,takeFocus:l}=s;return l===!1?await y.loadFile(s.uri):(await y.jumpTo(s.uri,a==null?void 0:a.start),De(a.start,a.end)!=0&&await k.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)}),x.Disposable.create(()=>{this.needsStop()&&this.stop()})}resolveConnection(){return this._connectionPromise||(this._connectionPromise=this.createConnection()),this._connectionPromise}resolveRootPath(){if(this._clientOptions.workspaceFolder)return O.parse(this._clientOptions.workspaceFolder.uri).fsPath;let{ignoredRootPaths:e}=this._clientOptions,t=y.getConfiguration(this.id),i=t.get("rootPatterns",[]),r=t.get("requireRootPattern",!1),o;if(i&&i.length){let a=y.getDocument(y.bufnr);if(a&&a.schema=="file"){let l=UP.default.dirname(O.parse(a.uri).fsPath);o=fb(l,i,y.cwd)}}if(r&&!o)return!1;let s=o||y.rootPath||y.cwd;return ii(s,qG.default.homedir())||Array.isArray(e)&&e.some(a=>ii(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
2022-05-18 13:29:28 -04:00
Related diagnostics:
2022-05-27 03:57:56 -04:00
`;for(let l of s.relatedInformation){let u=UP.default.basename(O.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(x.Diagnostic.create(l.location.range,l.message,x.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)=>{ho.error("connection error:",i,r),this.handleConnectionError(i,r,o)},t=()=>{this.handleConnectionClosed()};return this.createMessageTransports(this._clientOptions.stdioEncoding||"utf8").then(i=>HSe(i.reader,i.writer,e,t,this._clientOptions.connectionOptions))}handleConnectionClosed(){if(this.state===5){ho.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){y.onDidChangeConfiguration(t=>{t.affectsConfiguration(this._id)&&this.refreshTrace(e,!0)},null,this._listeners)}refreshTrace(e,t=!1){let i=y.getConfiguration(this._id),r=x.Trace.Off,o=x.TraceFormat.Text;if(i){let s=i.get("trace.server","off");typeof s=="string"?r=x.Trace.fromString(s):(r=x.Trace.fromString(i.get("trace.server.verbosity","off")),o=x.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(x.DidChangeWatchedFilesNotification.type.method).registerRaw(qe(),i)}registerFeatures(e){for(let t of e)this.registerFeature(t)}registerFeature(e){if(this._features.push(e),GP.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 p6(this)),this.registerFeature(new $G(this,this._syncedDocuments)),this.registerFeature(new UG(this)),this.registerFeature(new XG(this,this._syncedDocuments)),e.includes("willSave")||this.registerFeature(new GG(this)),e.includes("willSaveWaitUntil")||this.registerFeature(new QG(this)),e.includes("didSave")||this.registerFeature(new KG(this)),e.includes("fileSystemWatcher")||this.registerFeature(new zG(this,t=>this.notifyFileEvent(t))),e.includes("completion")||this.registerFeature(new e6(this)),e.includes("hover")||this.registerFeature(new t6(this)),e.includes("signatureHelp")||this.registerFeature(new i6(this)),e.includes("references")||this.registerFeature(new r6(this)),e.includes("definition")||this.registerFeature(new n6(this)),e.includes("documentHighlight")||this.registerFeature(new o6(this)),e.includes("documentSymbol")||this.registerFeature(new s6(this)),e.includes("codeAction")||this.registerFeature(new l6(this)),e.includes("workspaceSymbol")||this.registerFeature(new a6(this)),e.includes("codeLens")||this.registerFeature(new u6(this)),e.includes("documentFormatting")||this.registerFeature(new c6(this)),e.includes("documentRangeFormatting")||this.registerFeature(new h6(this)),e.includes("documentOnTypeFormatting")||this.registerFeature(new d6(this)),e.includes("rename")||this.registerFeature(new g6(this)),e.includes("documentLink")||this.registerFeature(new f6(this)),e.includes("executeCommand")||this.registerFeature(new m6(this))}fillIni
2022-05-18 13:29:28 -04:00
`)?i:i+`
2022-05-27 03:57:56 -04:00
`)}},T_=class{constructor(e,t){this._client=e;this._setting=t;this._listeners=[]}start(){return y.onDidChangeConfiguration(e=>{e.affectsConfiguration(this._setting)&&this.onDidChangeConfiguration()},null,this._listeners),this.onDidChangeConfiguration(),{dispose:()=>{Z(this._listeners),this._client.needsStop()&&this._client.stop()}}}onDidChangeConfiguration(){let e=this._setting.indexOf("."),t=e>=0?this._setting.substr(0,e):this._setting,i=e>=0?this._setting.substr(e+1):void 0,r=i?y.getConfiguration(t).get(i,!0):y.getConfiguration(t);r&&this._client.needsStart()?this._client.start():!r&&this._client.needsStop()&&this._client.stop()}},WSe={createAll:n=>[]}});function ZSe(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 JSe(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 $Se(n,e,t){let{command:i,module:r,port:o,args:s,filetypes:a}=t;if(s=s||[],!a)return k.showMessage(`Wrong configuration of LS "${e}", filetypes not found`,"error"),null;if(!i&&!r&&!o)return k.showMessage(`Wrong configuration of LS "${e}", no command or module specified.`,"error"),null;let l;if(r){if(r=y.expand(r),!N6.default.existsSync(r))return k.showMessage(`Module file "${r}" not found for LS "${e}"`,"error"),null;l={module:r,runtime:t.runtime||process.execPath,args:s,transport:USe(t),options:GSe(t)}}else i?l={command:i,args:s,options:QSe(t)}:o&&(l=()=>new Promise((g,f)=>{let p=new B6.default.Socket,b=t.host||"127.0.0.1";Kl.info(`languageserver "${n}" connecting to ${b}:${o}`),p.connect(o,b,()=>{g({reader:p,writer:p})}),p.on("error",v=>{f(new Error(`Connection error for ${n}: ${v.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=>y.expand(g)),disableSnippetCompletion:c,disableDynamicRegister:!!t.disableDynamicRegister,disabledFeatures:u,formatterPriority:t.formatterPriority||0,documentSelector:q6(t.filetypes,t.additionalSchemes),revealOutputChannelOn:XSe(t.revealOutputChannelOn),synchronize:{configurationSection:`${n}.settings`},diagnosticCollectionName:e,outputChannelName:n,stdioEncoding:t.stdioEncoding||"utf8",progressOnInitialization:t.progressOnInitialization!==!1,initializationOptions:t.initializationOptions||{}},l]}function XSe(n){switch(n){case"info":return 1;case"warn":return 2;case"error":return 3;case"never":return 4;default:return 4}}function q6(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 USe(n){let{transport:e,transportPort:t}=n;return!e||e=="ipc"?1:e=="stdio"?0:e=="pipe"?2:{kind:3,port:t}}function GSe(n){return{cwd:n.cwd,execArgv:n.execArgv||[],env:n.env||void 0}}function QSe(n){return{cwd:n.cwd,detached:!!n.detached,shell:!!n.shell,env:n.env||void 0}}function O6(n){switch(n){case 2:return"running";case 3:return"starting";case 1:return"stopped";default:return"unknown"}}var M6,N6,B6,yh,Kl,H6,Ni,Zf=_(()=>{"use strict";M6=require("events"),N6=C(require("fs")),B6=C(require("net")),yh=C(H());k_();Fr();z();ke();V();Kl=q()("services");H6=class extends M6.EventEmitter{constructor(){super(...arguments);this.registered=new Map;this.disposables=[]}init(){y.onDidOpenTextDocument(e=>{this.start(e)},null,this.disposables),y.onDidChangeConfiguration(e=>{e.affectsConfiguration("languageserver")&&this.createCustomServices()},null,this.disposables),this.createCustomServices()}dispose(){this.removeAllListeners(),Z(this.disposables);for(let e of this.registered.values())e.dispose()}regist(e){let{id:t}=e;if(t||Kl.error("invalid service configuration. ",e.name),!this.registered.get(t))return this.registered.set(t,e),Kl.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){k.showMessage(`Not a language client: ${e}`,"error");return}i.client.onNotification(t,async o=>{y.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 bt(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 yh.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 yh.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"?q6(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=y.getConfiguration().get("languageserver",{})[e];if(!c||c.enable===!1)return;let h=$Se(i,e,c);if(!h)return;s=new Wf(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=O6(h),f=O6(d);Kl.info(`${s.name} state change: ${g} => ${f}`)},null,r),a=!0}l.state=1,Kl.debug(`starting service: ${i}`);let u=s.start();return r.push(u),new Promise(c=>{s.onReady().then(()=>{o.fire(void 0),c()},h=>{k.showMessage(`Server ${i} failed to start: ${h}`,"error"),Kl.error(`Server ${i} failed to start:`,h),l.state=2,c()})})},dispose:async()=>{o.dispose(),Z(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)}};Ni=new H6});var Y6,zl,vh,Iw=_(()=>{"use strict";V();ke();Y6=require("events"),zl=["<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>"],vh=class extends Y6.EventEmitter{constructor(){super();this.configuration=y.getConfiguration("list"),this.disposable=y.onDidChangeConfiguration(e=>{e.affectsConfiguration("list")&&(this.configuration=y.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(zl.includes(e))return e;let t=zl.find(i=>i.toLowerCase()==e.toLowerCase());return t||(k.showMessage(`Configured key "${e}" not supported.`,"error"),null)}}});var H$e,jw,W6=_(()=>{"use strict";ke();Iw();H$e=q()("list-mappings"),jw=class{constructor(e,t,i){this.manager=e;this.nvim=t;th
`)&&(t=e.label=t.replace(/\r?\n/g," ")),t.includes(u0e)){let{line:r,highlights:o}=mc(t);e.label=r,Array.isArray(e.ansiHighlights)||(e.ansiHighlights=o)}return e.converted=!0,e}dispose(){this.stop()}}});var __,l4,h0e,kXe,Yw,u4=_(()=>{"use strict";__=C(Pi()),l4=C(H());mo();oa();z();ke();V();X6();G6();a4();h0e=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],kXe=q()("list-session"),Yw=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 Nw(e,i.name,r,s),this.history=new Mw(t,i.name),this.worker=new qw(e,i,t,r,{interactiveDebounceTime:s.get("interactiveDebounceTime",100),extendedSearchMode:s.get("extendedSearchMode",!0)}),this.interactiveDebounceTime=s.get("interactiveDebounceTime",100);let a=(0,__.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,__.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(),y.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(l4.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=h0e[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=y.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=y.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 k.showMenuPicker(r,{title:"Choose action",shortcuts:!0}),c=c+1,y.isVim&&await bt(10),this.prompt.start()):(await e.call("coc#prompt#stop_prompt",["list"]),c=await e.call("confirm"
`)]),await bt(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){k.showErrorMessage(`Action ${e} not found`);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=y.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}=y;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 bt(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=P_(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 Li;if(o.addLine("NAME","Label"),o.addLine(` ${e.name} - ${e.description||""}
2022-05-18 13:29:28 -04:00
`),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(`
`)+`
2022-05-27 03:57:56 -04:00
`)}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=y.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:y.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),Z(this.disposables),this.worker.dispose(),this.ui.dispose()}}});var c4,h4,d4,d0e,Ww,g4=_(()=>{"use strict";c4=require("child_process"),h4=require("events"),d4=C(require("readline"));z();V();d0e=q()("list-commandTask"),Ww=class extends h4.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 J4=m((U8e,Z4)=>{Z4.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 X4=m((G8e,$4)=>{$4.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 G4=m((Q8e,U4)=>{U4.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"
2022-05-18 13:29:28 -04:00
`,`
2022-05-27 03:57:56 -04:00
`,"","","","",""," ","%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 WQ=m((wGe,YQ)=>{YQ.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 JQ=m((DGe,ZQ)=>{ZQ.exports=["[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]"]});var XQ=m((xGe,$Q)=>{$Q.exports=["[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]
`)}function RV(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("${Qf(a)}", ${o}, ${s}, context)`),r}async function Th(n,e){try{await n.command(`pyx ${T0e(e.join(`
2022-05-18 13:29:28 -04:00
`))}`)}catch(t){let i=new Error(t instanceof Error?t.message:t.toString());throw i.stack=`Error on execute python code:
${e.join(`
`)}
2022-05-27 03:57:56 -04:00
`+(t instanceof Error?t.stack:t),i}}function Kf(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]=`"${Qf(o)}"`;return`t = (${i.join(",")},)`}function T0e(n,e=!1){if(!S0e&&e===!1)return n;let t=["import traceback, vim","vim.vars['errmsg'] = ''","try:"];return t.push(...n.split(`
2022-05-18 13:29:28 -04:00
`).map(i=>" "+i)),t.push("except Exception as e:"),t.push(" vim.vars['errmsg'] = traceback.format_exc()"),t.join(`
2022-05-27 03:57:56 -04:00
`)}function Qf(n){return n.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\t/g,"\\t").replace(/\n/g,"\\n")}function LV(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(E0e.test(n))throw new Error("pattern (?id/name)yes-pattern|no-pattern not supported");return n.replace(L0e,(e,t)=>e=="\\A"?"^":e.startsWith("(?#")?"":e.startsWith("(?P<")?"(?"+e.slice(3):e.startsWith("(?P=")?`\\k<${t}>`:"")}var EV,PV,gQe,S0e,k0e,E0e,P0e,_0e,R0e,L0e,F_=_(()=>{"use strict";EV=require("child_process"),PV=require("util"),gQe=q()("snippets-eval"),S0e=process.env.VIM_NODE_RPC=="1";k0e=/\\A/,E0e=/\(\?\(\w+\).+\|/,P0e=/\(\?#.*?\)/,_0e=/\(\?P<\w+>.*?\)/,R0e=/\(\?P=(\w+)\)/,L0e=new RegExp(`${P0e.source}|${k0e.source}|${_0e.source}|${R0e.source}`,"g")});function FV(n,e){let t=[...n];for(;t.length>0;){let i=t.shift();if(!e(i))break;t.unshift(...i.children)}}function A0e(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(j0e.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 IV,F0e,I0e,Br,I_,cs,wt,us,j_,nt,zf,sD,Vf,hr,Do,ep,Fa,j0e,aD=_(()=>{"use strict";IV=C(TV());Go();kV();_e();F_();F0e=q()("snippets-parser"),I0e=["d","g","i","m","s","u","y"],Br=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=Br._table[i],typeof r=="number")return this.pos+=1,{type:r,pos:e,len:1};if(Br.isDigitCharacter(i)){r=8;do t+=1,i=this.value.charCodeAt(e+t);while(Br.isDigitCharacter(i));return this.pos+=t,{type:r,pos:e,len:t}}if(Br.isVariableCharacter(i)){r=9;do i=this.value.charCodeAt(e+ ++t);while(Br.isVariableCharacter(i)||Br.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 Br._table[i]>"u"&&!Br.isDigitCharacter(i)&&!Br.isVariableCharacter(i));return this.pos+=t,{type:r,pos:e,len:t}}},I_=Br;I_._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};cs=class{constructor(){this._children=[]}appendChild(e){return e instanceof wt&&this._children[this._children.length-1]instanceof wt?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 ep)return e;e=e.parent}}toString(){return this.children.reduce((e,t)=>e+t.toString(),"")}len(){return 0}},wt=class extends cs{constructor(e){super();this.value=e}static escape(e){return e.replace(/\$|}|\\/g,"\\$&")}toString(){return this.value}toTextmateString(){return wt.escape(this.value)}len(){return this.value.length}clone(){return new wt(this.value)}},us=class extends cs{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 nt)return this.parent.index}async resolve(e){if(!this.code.length)return;let t=await _V(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 us(this.code,this.kind,this.value)}},j_=class extends cs{},nt=class extends j_{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 zf?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 nt(this.index);return this.transform&&(e.transform=this.transform.clone()),e._children=this.children.map(t=>t.clone()),e}},zf=class extends cs{constructor(){super(...arguments);this.options=[]}appendChild(e){return e instanceof wt&&(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 wt){let u=l.toString().split(/\r?\n/);i=u[u.length-1].match(/^\s*/)[0]}return!0});let r=t.split(`
2022-05-18 13:29:28 -04:00
`),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(`
2022-05-27 03:57:56 -04:00
`)}return this.transform&&(t=this.transform.resolve(t||"")),t!==void 0?(this._children=[new wt(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 Do(this.name,this.resolved);return this.transform&&(e.transform=this.transform.clone()),e._children=this.children.map(t=>t.clone()),e}};ep=class extends cs{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 nt&&s!==o.value&&this.onPlaceholderUpdate(o.parent)})})),i.length){let o=Kf(this.values);await Th(e,[...t,o]);for(let a of i){let l=a.value;await a.resolve(e),l!==a.value&&a.parent instanceof nt&&(this.onPlaceholderUpdate(a.parent),await Th(e,[Kf(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 nt)i=t.index;else for(;t.parent;){if(t instanceof nt){i=t.index;break}t=t.parent}if(i===void 0)return;let r=this.getDependentPyIndexBlocks(i);await Th(e,[Kf(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 nt&&this.onPlaceholderUpdate(t.parent),await Th(e,[Kf(this.values)]))}get placeholderInfo(){if(!this._placeholders){let e=[],t=[],i=[],r=[];this.walk(o=>{if(o instanceof nt)r.push(o);else if(o instanceof Do){let s=o.name.charCodeAt(0);(s<65||s>90)&&e.push(o)}else o instanceof us&&(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]=nW(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 nt?t.index:this.maxIndexNumber+1,[s,a]=i,l=r?oD(r):void 0,u=new Fa(!!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 nt&&p.index>o){let b=p.index;p.index=p.index+c,d.set(b,p.index)
2022-05-18 13:29:28 -04:00
`:"";if(r.indexOf(`
2022-05-27 03:57:56 -04:00
`)==-1){let s=new us(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 us(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 wt(t)),this._accept(void 0),!0}return!1}},j0e=[":","(",")","{","}"]});function A_(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))),Bi.TextEdit.replace(Bi.Range.create(s,a),h)}function jV(n,e,t){let i=Bi.Range.create(n,Ri(n,t));return ut(e,i)==0}function AV(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 OV(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=Bi.Position.create(s+o,a.length-l.length)}else if(a!==e.lines[s]){r=void 0;break}}return r}function MV(n,e,t){var a,l;let i=[],r=[],o=n.split(`
2022-05-18 13:29:28 -04:00
`),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(`
2022-05-27 03:57:56 -04:00
`)]}function NV(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 BV(n){return!!(/^\s/.test(n)||n.indexOf(`
`)!==-1)}var Bi,PQe,lD,O_=_(()=>{"use strict";Bi=C(H());kc();yt();no();F_();aD();PQe=q()("snippets-snipet"),lD=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?oD(e):void 0,o=new Fa(!!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=RV(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 nt){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(Bi.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 Bi.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=>_i(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=Bi.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:Zb(t,Bi.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=jn.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,M_,0,-1],!0),this._onCancelEvent.fire(void 0),hs.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=Q(r.getline(o.line).slice(0,o.character))+1,u=this.current=e.marker;if(u instanceof nt&&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?(hs.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(M_);let r=this.snippet.getRanges(e);r.length&&i.highlightRanges(M_,"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.start,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 k.getCursorPosition();this.snippet&&ut(e,this.snippet.range)!=0&&(hs.info("Cursor insert out of range, cancelling snippet session"),this.deactivate())}findPlaceholder(e){let{placeholder:t}=this;return t&&_i(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||Pe(i.lines,o.lines))return;let{range:s,text:a}=this.snippet;e&&!_i(e.range,s)&&(e=void 0);let l=OV(s.end,i,o);if(!l){hs.info("Content change after snippet, cancel snippet session"),this.deactivate();return}if(!AV(s.start,i,o)){let v=o.getText(Hi.Range.create(Hi.Position.create(0,0),l));if(v.endsWith(a)){let w=o.positionAt(v.length-a.length);this.snippet.resetStartPosition(w),this.textDocument=o,hs.info("Content change before snippet, reset snippet position");return}hs.info("Before and snippet body changed, cancel snippet session"),this.deactivate();return}let c=this.tokenSource=new Hi.Cancellat
`),filetype:"txt"}]:[];await e.show(l,{modes:["n"]})}},500)),global.__TEST__)return;this.checkExtensions();let t=y.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&&k.showMessage("Updating extensions, checkout output:///extensions for details.","more");let o=this.installBuffer=new af(!0,e,t?this.outputChannel:void 0);o.setExtensions(r.map(l=>l.id)),await o.show(y.nvim);let s=gw(this.npm,this.modulesFolder);await og(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)}checkExtensions(){let{globalExtensions:e}=y.env;if(e&&e.length){let t=this.filterGlobalExtensions(e);this.installExtensions(t)}}get installer(){return gw(this.npm,this.modulesFolder)}async installExtensions(e=[]){let{npm:t}=this;if(!t||!e.length)return;e=sa(e);let i=this.installBuffer=new af;i.setExtensions(e),await i.show(y.nvim);let r=gw(this.npm,this.modulesFolder);await og(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(),s.match(/(.+)@([^/]+)$/)!=null&&this.lockExtension(l,!0)},l=>{i.addMessage(s,l.message),i.finishProgress(s,!1),tn.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=y.getConfiguration("npm").get("binPath","npm");e=y.expand(e);for(let t of[e,"yarnpkg","yarn","npm"])try{return nee.default.sync(t)}catch{continue}return k.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 lockExtension(e,t){let i=`extension.${e}.locked`,r=await this.db.fetch(i);t=t===void 0?!r:t,t?this.db.push(i,!0):this.db.delete(i)}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 bt(200)}async reloadExtension(e){let t=this.extensions.get(e);if(!t){k.showMessage(`Extension ${e} not registered`,"error");return}if(t.type==3){k.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):k.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){le
2022-05-18 13:29:28 -04:00
${a.message}
2022-05-27 03:57:56 -04:00
${a.stack}`)});return}let r=[],o=!1,s=()=>{if(!o)return o=!0,Z(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=>{k.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(y.languageIds.has(l[1])||y.filetypes.has(l[1])){await s();return}y.onDidOpenTextDocument(c=>{let h=y.getDocument(c.bufnr);(c.languageId==l[1]||h.filetype==l[1])&&s()},null,r)}else if(u=="onCommand")re.onCommandList.push(l[1]),E.on("Command",async c=>{c==l[1]&&(await s(),await bt(500))},null,r);else if(u=="workspaceContains"){let c=async()=>{let d=y.workspaceFolders.map(g=>O.parse(g.uri).fsPath);for(let g of d)for(let f of l[1].split(/\s+/))if(await j2(g,f))return await s(),!0;return!1};if(y.onDidChangeWorkspaceFolders(c,null,r),await c())return}else if(u=="onFileSystem"){for(let c of y.documents)if(O.parse(c.uri).scheme==l[1]){await s();return}y.onDidOpenTextDocument(c=>{O.parse(c.uri).scheme==l[1]&&s()},null,r)}else k.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}|${y.rootPath}`),asAbsolutePath:f=>Ie.default.join(e,f),storagePath:Ie.default.join(this.root,`${r}-data`),logger:ree(r)};if(!l)try{let f=!(t.engines||{}).hasOwnProperty("coc");l=zV(r,a,f)}catch(f){tn.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=>{tn.error(`Error on active extension ${r}: ${b.message}`,b),p(b)})}catch(b){tn.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,Z(u),u.splice(0,u.length),u=[],l&&l.deactivate))try{return Promise.resolve(l.deactivate()).catch(g=>{tn.error(`Error on ${r} deactivate: `,g)})}catch(g){tn.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,v={};for(let w of Object.keys(b)){let D=b[w].default;D!=null&&(v[w]=D)}y.configurations.extendsDefaults(v)}if(f&&f.length)for(let b of f)y.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||!Pt(o))throw new Error(`invalid engines in ${t}`);if(s&&!pt.default.existsSync(Ie.default.join(e,s)))throw new Error(`main
`])})}get nvim(){return y.nvim}createNativeSources(){this.disposables.push((fee(),Ha(gee)).regist(this.sourceMap,this.keywords)),this.disposables.push((bee(),Ha(mee)).regist(this.sourceMap,this.keywords)),this.disposables.push((xee(),Ha(Dee)).regist(this.sourceMap))}createLanguageSource(e,t,i,r,o,s,a){let l=new pD(e,t,r,i,o||[],a||[],s,this.completeConfig);return Cee.debug("created service source",e),this.sourceMap.set(e,l),{dispose:()=>{this.sourceMap.delete(e)}}}async createVimSourceExtension(e,t){let i=DD.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 k.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 mD({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){k.showMessage(`Error on create vim source ${i}: ${r}`,"error")}}createRemoteSources(){let{runtimepath:e}=y.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=DD.default.join(e,"autoload/coc/source"),i=await qt(t);if(i&&i.isDirectory()){let r=await Tee.default.promisify(See.default.readdir)(t);r=r.filter(s=>s.endsWith(".vim"));let o=r.map(s=>DD.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=et(e.line,0,e.colnr-1),o=e.input==""&&!!e.triggerCharacter,s=Vm(e.filepath,e.bufnr,"",y.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&&!ck(s,r)||u&&r.every(h=>y.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&&!ck(l,s)||c&&s.every(d=>y.match(c,{uri:i,languageId:d})==0)?!1:this.checkTrigger(a,e,o)})}addSource(e){let{name:t}=e;return this.names.includes(t)&&Cee.warn(`Recreate source ${t}`),this.sourceMap.set(t,e),rt.Disposable.create(()=>{this.sourceMap.delete(t)})}removeSource(e){let t=ty
`)==-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,X_,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:Q(this.message),lnum:0}),o.push(this.message),o.push("")),this.title){if(s.push({hlGroup:"CocTreeTitle",colStart:0,colEnd:Q(this.title),lnum:o.length}),this.description){let a=Q(this.title)+1;s.push({hlGroup:"Comment",colStart:a,colEnd:a+Q(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||!y.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:U_+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:Q(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=k.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){this.checkDialog("withProgress");let i=Error().stack,r=new ED(this.nvim,{task:t,title:e.title,cancellable:e.cancellable}),s=y.getConfiguration("notification").get("minProgressWidth",30),a=new Promise(l=>{r.onDidFinish(l)});return await r.show(Object.assign(this.getNotificationPreference(i),{minWidth:s})),await a}createTreeView(e,t){let i=(LD(),Ha(Jee)).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,v)=>b.lnum-v.lnum);let l=[],u=y.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 v=p.get(b[1]);v?v.push(b):p.set(b[1],[b])}),a.length>0){let b=Array.isArray(r)?r[0]:0;for(let v=b;v<=f;v++){let w=p.get(v)||[],D=[];for(let S=d;S<=g;S++){let L=i[S];if(L.lnum==v)d=S+1,D.push(L);else{d=S;break}}D.length==0?w.length&&(u?c.push(...w.map(S=>S[4])):l.push(v)):w.length==0?h.push(...D.map(S=>Q_(S))):(D.length!=w.length||!D.every((S,L)=>dTe(S,w[L])))&&(u?c.push(...w.map(S=>S[4])):l.push(v),h.push(...D.map(S=>Q_(S))))}}for(let b=d;b<=g;b++)h.push(Q_(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 y.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 Li;i.addLine("Provider state","Title"),i.addLine("");for(let r of hTe){let o=A.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,s)=>{let a={kind:e,content:t,buttons:i.map((u,c)=>({text:u,index:c})),callback:u=>{o(u)}};new su(this.nvim,a).show(this.getNotificationPreference(r)).catch(s)})}parseSource(e,t=2){let i=e.split(/\r?\n/).slice(t)[0];if(!i)return;i=i.replace(/^\s*at\s*/,"");let r;if(i.endsWith(")")){let a=i.match(/(\((.*?):\d+:\d+\))$/);a&&(r=a[2])}else{let a=i.match(/(.*?):\d+:\d+$/);a&&(r=a[1])}if(!r)return;let o=(mo(),Ha(see)).default.getExtensionsInfo(),s=o.find(a=>ii(a.filepath,r));if(s)return s.name.startsWith("single")?Ph.default.basename(s.filepath):s.name;if(s=o.find(a=>Ae(a.directory,r)),s)return s.name;if(Ae(uTe,r))return"coc.nvim"}get dialogPreference(){let e=y.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=y.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=y.getConfiguration("notification");return{broder:i.get("border",!0),focusable:i.get("focusable",!0),marginRight:i.get("marginRight",10),timeout:i.get("timeout",10),maxWidth:i.get("maxWidth"),maxHeight:i.get("maxHeight"),highlight:i.get("highlightGroup"),winblend:i.get("winblend"),source:t}}checkDialog(e){if(!y.e
`)[0],a=_h(e.severity).slice(0,1).toUpperCase();return{bufnr:n,lnum:i.line+1,end_lnum:r.line+1,col:Array.isArray(t)?Ze((l=t[i.line])!=null?l:"",i.character)+1:i.character+1,end_col:Array.isArray(t)?Ze((u=t[r.line])!=null?u:"",r.character)+1:r.character+1,text:`[${o}${e.code?" "+e.code:""}] ${s} [${a}]`,type:a}}function ID(n,e){if((n.severity||1)!=(e.severity||1))return(n.severity||1)-(e.severity||1);let t=De(n.range.start,e.range.start);return t!=0?t:n.source>e.source?1:-1}function Qee(n){let e=n.tags||[];if(e.includes(Nt.DiagnosticTag.Deprecated))return"CocDeprecatedHighlight";if(e.includes(Nt.DiagnosticTag.Unnecessary))return"CocUnusedHighlight";switch(n.severity){case Nt.DiagnosticSeverity.Warning:return"CocWarningHighlight";case Nt.DiagnosticSeverity.Information:return"CocInfoHighlight";case Nt.DiagnosticSeverity.Hint:return"CocHintHighlight";default:return"CocErrorHighlight"}}var Nt,V_=_(()=>{"use strict";Nt=C(H());yt();_e()});var tte,jD,gTe,Kee,zee,Vee,ete,eR,ite=_(()=>{"use strict";tte=C(Pi()),jD=C(H());ae();Ht();yt();V();V_();gTe=q()("diagnostic-buffer"),Kee="CocDiagnostic",zee="diagnostic",Vee=["CocErrorHighlight","CocWarningHighlight","CocInfoHighlight","CocHintHighlight","CocDeprecatedHighlight","CocUnusedHighlight"],ete=global.hasOwnProperty("__TEST__")?"MockAleResults":"ale#other_source#ShowResults",eR=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,tte.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(zee+e)}clearSigns(e){this.buffer.unplaceSign({group:Kee+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:Uee(r.severity)}});this.nvim.call(ete,[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&&Pe(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(E.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=[];gTe.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)lp.debug("no affected ranges"),this.ranges.forEach(s=>{s.adjustFromEdit({range:r,newText:i})}),this.doHighlights();else if(o.length==1&&_i(r,o[0].range)){if(lp.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)){lp.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{lp.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(ra(fs.TextEdit.replace(e,t))!=0||!_i(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 fs.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;lp.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(),Z(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=BD(e,t.range,t.newText),a=sp(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=ap(u,this.ranges,e);u.move(c*a)}this.doHighlights()}applyComposedEdit(e,t){var v,w,D;let i=(0,Ih.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]!=Ih.default.EQUAL||!l[1].startsWith(e[0].slice(0,o))))return this.cancel(),!1;let u=0,c=!1,h=[];for(let S=0;S<i.length;S++){let[L,I]=i[S];if(S==0&&o>0&&(I=I.slice(o)),L==Ih.default.EQUAL){if(u+=I.length,u>a)break}else if(L==Ih.default.DELETE){let j=u;if(u+=I.length,u>a){c=!0;break}h.push({offset:j,remove:I})}else{let j=i[S-1];j&&j[0]==Ih.default.DELETE?h[h.length-1].add=I:h.push({offset:u,add:I})}}if(c||!h.length)return this.cancel(),!1;let d=jn.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:(v=h[0].add)!=null?v:""};else if(bTe(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,(D=h[1].add)!=null?D:""]};else{let S=r.text,L="",I="",j=h[0].offset;for(let W of h){if(W.offset>j+L.length){let N=S.slice(j+L.length,W.offset);L+=N,I+=N}W.add&&(I+=W.add),W.remove&&(L+=W.remove)}g={offset:j,remove:L.length,insert:I}}let f=this.ranges.map(S=>{let L=S.position.line-s,{start:I,end:j}=S.range,W=fs.Range.create(L,I.character,L,j.character);return S.applyChange(g),fs.TextEdit.replace(W,S.text)});if(jn.applyEdits(d,f)!==t.join(`
`))return this.cancel(),!1;let b=sp(g);if(b!=0)for(let S of this.ranges){let L=ap(S,this.ranges);S.move(L*b)}return this.doHighlights(),!0}};function bTe(n,e){return!(n.length!=2||n[0].offset!=0||n[1].offset+(n[1].remove?n[1].remove.length:0)!==e)}var fit=q()("cursors"),qD=class{constructor(e){this.nvim=e;this.sessionsMap=new Map;this.disposables=[];y.onDidCloseTextDocument(t=>{let i=this.getSession(t.bufnr);!i||(this.sessionsMap.delete(t.bufnr),i.cancel())},null,this.disposables)}cancel(e){let t=y.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=y.getAttachedDocument(e),{nvim:o}=this,s=this.createSession(r),a=await k.getCursorPosition(),l;if(t=="operator"){await o.command(`normal! ${i=="line"?"'[":"`["}`);let u=await k.getCursorPosition();await o.command(`normal! ${i=="line"?"']":"`]"}`);let c=await k.getCursorPosition();await k.moveTo(a);let h=De(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=oR(r,jh.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=jh.Range.create(a.line,Math.max(0,u.length-1),a.line,u.length):l=jh.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=jh.Range.create(a.line,u.length-1,a.line,u.length):l=jh.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 k.getSelectedRange(i);if(!u)return;let c=i==""?pte(r,u):oR(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 HD(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=y.getAttachedDocument(i);return this.createSession(r).addRanges(e)}reset(){for(let e of this.sessionsMap.values())e.cancel();this.sessionsMap.clear()}};eu();ae();mo();var wx=C(H());ae();Ce();z();ke();V();var Ah=C(H());Di();eu();Ce();ke();V();var xit=q()("handler-codeActions"),YD=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=Ah.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){k.showMessage(`No${i?" "+i:""} code action available`,"warning");return}let l=await k.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,[Ah.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||Ah.Range.create(0,0,e.lineCount,0);let o={diagnostics:Lt.getDiagnosticsInRange(e.textDocument,t)};i&&Array.isArray(i)&&(o.only=i);let s=await this.handler.withRequestToken("code action",a=>A.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 y.floatSupported?y.getConfiguration("coc.preferences").get("floatActions",!0):!1}async doCodeAction(e,t){let
`,e),i){let r=await t.call("line",".")-1,o=y.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&&xte.has(l)){let u=a.trim()[0];if(u&&xte.get(l)==u){let c=[],h=await y.getFormatOptions(o.uri),d=h.insertSpaces?" ".repeat(h.tabSize):" ",g=a.match(/^\s*/)[0],f=ps.Position.create(r-1,s.length);if(o.filetype=="vim"){let p=`
`+g+d;c.push({range:ps.Range.create(r,g.length,r,g.length),newText:" \\ "}),p=p+"\\ ",c.push({range:ps.Range.create(f,f),newText:p}),await o.applyEdits(c),await k.moveTo(ps.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 k.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=ps.Range.create(s-1,0,s-1+a,0)}let r=await y.getFormatOptions(e.uri),o=await this.handler.withRequestToken("Format range",s=>A.provideDocumentRangeFormattingEdits(e.textDocument,i,r,s));return o&&o.length>0?(await e.applyEdits(o,!1,!0),0):-1}};var uu=C(H());ae();Ce();z();V();var jnt=q()("documentHighlight"),QD=class{constructor(e,t){this.nvim=e;this.handler=t;this.disposables=[];this.highlights=new Map;E.on(["CursorMoved","CursorMovedI"],()=>{this.cancel(),this.clearHighlights()},null,this.disposables),this.getConfiguration(),y.onDidChangeConfiguration(this.getConfiguration,this,this.disposables)}getConfiguration(e){let t=y.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=y.getDocument(e);return!(!i||!i.attached||t||!A.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=y.getDocument(t),a=await this.getHighlights(s,uu.Position.create(r[0],r[1]));if(!a)return;let l={};for(let c of a){if(!c.range)continue;let h=c.kind==uu.DocumentHighlightKind.Text?"CocHighlightText":c.kind==uu.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 uu.CancellationTokenSource,s=this.timer=setTimeout(()=>{o.token.isCancellationRequested||o.cancel()},this.config.timeout),a=await A.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(),Z(this.disposables)}};var Cte=C(require("fs")),ms=C(H());we();Ce();Zo();z();Je();V();var Znt=q()("handler-hover"),KD=class{constructor(e,t){this.nvim=e;this.handler=t;this.disposables=[];this.documentLines=[];this.hasProvider=!1;this.excludeImages=!0;this.loadConfiguration(),y.onDidChangeConfiguration(this.loadConfiguration,this,this.disposables),this.hoverFactory=new ci(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(y.registerTextDocumentContentProvider("coc",t))}loadConfiguration(e){if(!e||e.affectsConfiguration("hover")){let t=y.getConfiguration("hover"),i=t.get("target","float");this.config={floatConfig:t.get("floatConfig",{}),autoHide:t.get("autoHide",!0),target:i=="float"&&!y.floatSupported?"preview":i,previewMaxHeight:t.get("previewMaxHeight",12)},this.config.target=="preview"&&this.registerProvider();let r=y.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=>A.getHover(t.textDocument,i,a),!0);if(o==null||!o.length)return!1;let s=o.find(a=>ms.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=>A.getHover(t.textDocument,i,s),!0);if(!(r!=null&&r.length))return!1;let o=await this.handler.withRequestToken("definitionHover",s=>A.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 xTe(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(DTe(s)){i.push(s);continue}let{contents:a}=s;if(Array.isArray(a))for(let l of a)typeof l=="string"?cp(i,l,"markdown",r):cp(i,l.value,l.language,r);else ms.MarkedString.is(a)?typeof a=="string"?cp(i,a,"markdown",r):cp(i,a.value,a.language,r):ms.MarkupContent.is(a)&&cp(i,a.value,ng(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 ms.CancellationTokenSource,o=await A.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)}):ms.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),Z(this.disposables)}};function cp(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 DTe(n){return n?typeof n.filetype=="string"&&typeof n.content=="string":!1}async function xTe(n,e,t){let i=y.getDocument(n);if(i)return i.getLines(e,t+1);let r=O.parse(n).fsPath;return Cte.default.existsSync(r)?await ia(r,e,t):[]}var cu=C(H());ae();Ce();Zo();z();yt();ke();V();var ert=q()("handler-links"),CTe=/CocAction(Async)?\(["']openLink["']\)/,zD=class{constructor(e,t){this.nvim=e;this.handler=t;this.disposables=[];this.setConfiguration(),y.onDidChangeConfiguration(this.setConfiguration,this,this.disposables),this.floatFactory=new ci(e),E.on("CursorHold",async()=>{!this._tooltip||!e.hasFunction("nvim_get_keymap")||await this.showTooltip()},null,this.disposables),E.on(["CursorMoved","InsertEnter"],()=>{this.cancel()},null,this.disposables)}setConfiguration(e){if(!e||e.affectsConfiguration("links")){let t=y.getConfiguration("links");this._tooltip=t.get("tooltip",!1)}}async showTooltip(){let{nvim:e,floatFactory:t}=this,r=(await e.getKeymap("n")).find(u=>CTe.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(!A.hasProvider("documentLink",e.textDocument))return[];let t=this.tokenSource=new cu.CancellationTokenSource,i=await A.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 y.openResource(e.target)}async getCurrentLink(){let e=await this.getLinks(),t=await k.getCursorPosition();if(e&&e.length){for(let a of e)if(ut(t,a.range)==0){if(!a.target){let l=this.tokenSource=this.tokenSource||new cu.CancellationTokenSource;if(a=await A.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=cu.DocumentLink.create(cu.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(),Z(this.disposables)}};var qr=C(H());we();Ce();Zf();V();var urt=q()("handler-hover"),VD=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 A.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 A.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 A.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 A.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 A.getReferences(t.textDocument,{includeDeclar
`)))}else{l.push(u);let f=this.getDeleteRange(c);a.push(Ge.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+=XT(Ge.Position.create(r,0),e)}}async getFileChanges(){let e=[],t=await this.buffer.lines;t.push(Yr);let i=[],r,o;for(let s=0;s<t.length;s++){let a=t[s];if(a.startsWith(Yr)){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 Li,a=[];for(let c of e){let h=[];for(let d of c.ranges){s.addLine(Yr),s.addLine(Yr);let g=o+s.length;s.addText(`${Ae(t,c.filepath)?hp.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(S=>TTe(S,p)));let{lines:b,start:v,end:w,highlights:D}=d;b||(b=await this.getLines(c.filepath,v,w)),h.push({lines:b,lnum:g,start:v,highlights:D}),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 k.cursors.addRanges(a)}catch(o){this.changing=!1,STe.error("Error on add file item:",o)}r()}findRange(e,t){let r=this.fileItems.find(o=>ii(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);Pe(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 k.showInformationMessage("No change."),await i.setOption("modified",!1),!1;let s={};for(let a of o){let l=O.file(a.filepath).toString(),u=s[l]||[];u.push({range:Ge.Range.create(a.start,0,a.end,0),newText:a.lines.join(`
2022-05-18 13:29:28 -04:00
`)+`
2022-05-27 03:57:56 -04:00
`}),s[l]=u}this.changing=!0,await y.applyEdit({changes:s}),this.changing=!1;for(let a of this.fileItems){let l=O.file(this.getAbsolutePath(a.filepath)).toString(),u=s[l];u&&u.length>0&&a.ranges.forEach(c=>{c.start+=XT(Ge.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=O.file(e).toString(),o=y.getDocument(r);return o?o.getLines(t,i):await ia(e,t,i-1)}getAbsolutePath(e){return hp.default.isAbsolute(e)?e:hp.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?hp.default.relative(s,u.filepath):u.filepath}`,h=Q(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=Ge.Position.create(o,0);break}let a=t.getline(s);if(a===Yr){r=Ge.Position.create(s+1,0);break}if(s!=i&&a.startsWith(Yr)){r=Ge.Position.create(s,0);break}}return Ge.Range.create(Ge.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=Ge.Position.create(s,a.length);break}if(t.getline(s+1).startsWith("\u3000")){r=Ge.Position.create(s,a.length);break}}return Ge.Range.create(Ge.Position.create(i,0),r)}get valid(){return this.buffer.valid}get buffer(){return this.nvim.createBuffer(this.bufnr)}get document(){return y.getDocument(this.bufnr)}dispose(){this._disposed=!0,Z(this.disposables)}};function TTe(n,e){let{start:t,end:i}=n;return Ge.Range.create(t.line-e,t.character,i.line-e,i.character)}function kTe(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(Yr)){let g=o[s.start.line].slice(0,s.start.character);if(g==c){r=g+u.slice(0,-1).join(`
2022-05-18 13:29:28 -04:00
`)+`
2022-05-27 03:57:56 -04:00
`;let{start:f,end:p}=s;l[0].range=Ge.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(Yr)&&h==d&&s.start.character==0&&s.end.character==0){r=h+`
2022-05-18 13:29:28 -04:00
`+u.slice(0,-2).join(`
`)+`
2022-05-27 03:57:56 -04:00
`;let{start:g,end:f}=s;l[0].range=Ge.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(Yr)&&h==c){l[0].text=h+u.slice(0,-1).join(`
2022-05-18 13:29:28 -04:00
`)+`
2022-05-27 03:57:56 -04:00
`;let{start:d,end:g}=s;l[0].range=Ge.Range.create(d.line,0,g.line,0)}}return{contentChanges:l,bufnr:t,textDocument:i,original:r,originalLines:o}}var Ste=require("child_process"),Tte=require("events"),cR=C(require("path")),kte=C(require("readline"));Ur();oa();bc();eo();ke();var ETe=q()("handler-search"),PTe=["--color","ansi","--colors","path:fg:black","--colors","line:fg:green","--colors","match:fg:red","--no-messages","--heading","-n"],_Te="\x1B",Ete=class extends Tte.EventEmitter{start(e,t,i){this.process=(0,Ste.spawn)(e,t,{cwd:i}),this.process.on("error",c=>{this.emit("error",c.message)});let r=kte.default.createInterface(this.process.stdout),o,s,a=[],l=[],u=!0;r.on("line",c=>{if(c.includes(_Te)){let h=ug(c);if(h[0].foreground=="black"){s={filepath:cR.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 v of h){if(v.foreground=="red"){let w=g-o,D=p.length-f;l.push(Ne.create(w,D,w,D+v.text.length))}p+=v.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()}},ix=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(PTe,e),u=RTe(e);u&&l.pop(),l.push("--",u?cR.default.isAbsolute(u)?u:`./${u.replace(/^\.\//,"")}`:"./"),this.task=new Ete,this.task.start(o,l,t);let c=new ei,h=0,d=0,g=Date.now(),f=[],p=async()=>{if(f.length==0)return;let b=f.slice();f=[];let v=await c.acquire();try{await i.addFileItems(b)}catch(w){ETe.error(w)}v()};return new Promise((b,v)=>{let w=setInterval(p,300);this.task.on("item",async D=>{h++,d=d+D.ranges.reduce((S,L)=>S+L.highlights.length,0),f.push(D)}),this.task.on("error",D=>{clearInterval(w),k.showMessage(`Error on command "${o}": ${D}`,"error"),this.task=null,v(new Error(D))}),this.task.on("end",async()=>{clearInterval(w);try{await p(),(await c.acquire())(),this.task.removeAllListeners(),this.task=null;let S=i.buffer;if(S){if(r.pauseNotification(),h==0)S.setLines(["No match found"],{start:1,end:2,strictIndexing:!1},!0),S.addHighlight({line:1,srcId:-1,colEnd:-1,colStart:0,hlGroup:"Error"}),S.setOption("modified",!1,!0);else{let L=new Li;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(S,1,2)}S.setOption("modified",!1,!0),r.resumeNotification(!1,!0)}}catch(D){v(D);return}b()})})}abort(){var e;(e=this.task)==null||e.dispose()}};function RTe(n){if(n.length<2)return;let e=n.length;if(!n[e-1].startsWith("-")&&!n[e-2].startsWith("-"))return n[e-1]}var eot=q()("handler-refactor"),LTe="__coc_refactor__",FTe=0,nx=class{constructor(e,t){this.nvim=e;this.handler=t;this.buffers=new Map;this.disposables=[];this._onCreate=new Mh.Emitter;this.onCreate=this._onCreate.event;this.setConfiguration(),y.onDidChangeConfiguration(this.setConfiguration,this,this.disposables),E.on("BufUnload",i=>{let r=this.buffers.get(i);r&&(r.dispose(),this.buffers.delete(i))},null,this.disposables),y.onDidChangeTextDocument(i=>{let r=this.buffers.get(i.bufnr);r&&r.onChange(i)},null,this.disposables)}async init(){y.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=y.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: ${l.join(", ")}
Highlight group: ${s.hlGroup||""}`,highlights:u}];await this.floatFactory.show(c,{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,l;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 Li;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",lx),r.addLine("");try{i.checkState();let u=(a=i.highlights)!=null?a:[];r.addLine("The number of semantic tokens: "),r.addText(String(u.length),"Number"),r.addLine(""),r.addLine("Semantic highlight groups used by current buffer",lx),r.addLine("");let c=sa(u.filter(g=>g.hlGroup!=null).map(({hlGroup:g})=>g));for(let g of c)r.addTexts([{text:"-",hlGroup:"Comment"},{text:" "},{text:g,hlGroup:g}]);r.addLine(""),r.addLine("Tokens types that current Language Server supported:",lx),r.addLine("");let h=y.getDocument(i.bufnr),d=(l=A.getLegend(h.textDocument))!=null?l:A.getLegend(h.textDocument,!0);if(d.tokenTypes.length){for(let g of[...new Set(d.tokenTypes)]){let f=Bh+hn(g);r.addTexts([{text:"-",hlGroup:"Comment"},{text:" "},{text:f,hlGroup:f}])}r.addLine("")}else r.addLine("No token types supported","Comment"),r.addLine("");if(r.addLine("Tokens modifiers that current Language Server supported:",lx),r.addLine(""),d.tokenModifiers.length){for(let g of[...new Set(d.tokenModifiers)]){let f=Bh+hn(g);r.addTexts([{text:"-",hlGroup:"Comment"},{text:" "},{text:f,hlGroup:f}])}r.addLine("")}else r.addLine("No token modifiers exist","Comment"),r.addLine("")}catch(u){r.addLine(u instanceof Error?u.message:u.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(),Z(this.disposables)}};var gp=C(H());ae();Ce();Zo();z();_e();V();var Tst=q()("handler-signature"),cx=class{constructor(e,t){this.nvim=e;this.handler=t;this.disposables=[];this.signatureFactory=new ci(e),this.loadConfiguration(),this.disposables.push(this.signatureFactory),y.onDidChangeConfiguration(this.loadConfiguration,this,this.disposables),E.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),E.on(["InsertLeave","BufEnter"],()=>{var i;(i=this.tokenSource)==null||i.cancel()},null,this.disposables),E.on("TextChangedI",()=>{this.config.hideOnChange&&this.signatureFactory.close()},null,this.disposables),E.on("TextInsert",async(i,r,o)=>{if(!this.config.trigger)return;let s=this.getTextDocument(i);!s||!A.shouldTriggerSignatureHelp(s.textDocument,o)||await this._triggerSignatureHelp(s,{line:r.lnum-1,character:r.pre.length},!1)},null,this.disposables)}getTextDocument(e){let t=y.getDocument(e);if(!(!t||t.isCommandLine||!t.attached))return t}loadConfiguration(e){if(!e||e.affectsConfiguration("signature")){let t=y.getConfiguration("signature"),i=t.get("target","float");i=="float"&&!y.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 A.hasProvider("signature",e.textDocument)?
2022-05-19 10:14:37 -04:00
`)||!Ct(r))));if(o.length==1&&_i(r,o[0].range)){if(i.includes(`
2022-05-27 03:57:56 -04:00
`)){this.cancelEdit();return}HTe.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=y.getDocument(i);r.filter(c=>c!==e&&c.position.line==e.position.line).forEach(c=>c.adjustFromEdit(t));let a=BD(e,t.range,t.newText),l=sp(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=ap(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(E.pumvisible||!y.isAttached(e))return;let i=y.getDocument(e);if(!y.getConfiguration("coc.preferences",i.uri).get("enableLinkedEditing",!1)||!A.hasProvider("linkedEditing",i.textDocument))return;let s=yi(i.getline(t[0]-1),t[1]-1),a=mx.Position.create(t[0]-1,s);if(this.ranges){if(this.ranges.some(l=>ut(a,l.range)==0))return;this.cancelEdit()}this.enable(i,a)}async enable(e,t){let i=e.textDocument,o=(this.tokenSource=new mx.CancellationTokenSource).token,s=await this.nvim.window,a=await A.provideLinkedEdits(i,t,o);if(o.isCancellationRequested||!a||a.ranges.length==0)return;let l=a.ranges.map(u=>new Fh(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)}};ae();Ce();V();var qte=C(Pi()),qh=C(H());Ce();Zk();yt();var qTe=global.hasOwnProperty("__TEST__")?10:100,YTe="CocInlayHint",yx=class{constructor(e,t,i){this.nvim=e;this.doc=t;this.config=i;this.regions=new hu;this.currentHints=[];this._onDidRefresh=new qh.Emitter;this.onDidRefresh=this._onDidRefresh.event;this.render=(0,qte.default)(()=>{this.renderRange()},qTe),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(),!A.hasProvider("inlayHint",this.doc.textDocument))return;this.tokenSource=new qh.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=qh.Range.create(t[0]-1,0,t[1],0),r=await A.provideInlayHints(this.doc.textDocument,i,e);r==null||e.isCancellationRequested||(this.regions.add(t[0],t[1]),this.currentHints=this.currentHints.filter(o=>ut(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=[[lv(l),YTe]];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 vx=class{constructor(e,t){this.config={};e.createNamespace("coc-inlayHint").then(i=>{this.config.srcId=i}),this.buffers=y.registerBufferSync(i=>{if(!!y.has("nvim-0.5.0"))return new yx(e,i,this.config)}),t.addDisposable(this.buffers),t.addDisposable(A.onDidInlayHintRefresh(async i=>{for(let r of this.buffers.items)y.match(i,r.doc.textDocument)&&(r.clearCache(),A.hasProvider("inlayHint",r.doc.textDocument)?await r.renderRange():r.clearVirtualText())})),t.addDisposable(E.on("CursorMoved",i=>{this.refresh(i)})),t.addDisposable(E.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),Cx.error("unhandledRejection ",e,n)});
2022-05-18 13:29:28 -04:00
/*!
* 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
*/