UNPKG

@tcx4c70/coc-csharp

Version:
1,455 lines (1,444 loc) 1.1 MB
"use strict"; var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __commonJS = (cb, mod) => function __require() { return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; }; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( // If the importer is in node compatibility mode or this is not an ESM // file that has been converted to a CommonJS file using a Babel- // compatible transform (i.e. "__esModule" has not been set), then set // "default" to the CommonJS "module.exports" for node compatibility. isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod )); var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // node_modules/tunnel/lib/tunnel.js var require_tunnel = __commonJS({ "node_modules/tunnel/lib/tunnel.js"(exports2) { "use strict"; var net2 = require("net"); var tls = require("tls"); var http2 = require("http"); var https2 = require("https"); var events = require("events"); var assert2 = require("assert"); var util = require("util"); exports2.httpOverHttp = httpOverHttp; exports2.httpsOverHttp = httpsOverHttp; exports2.httpOverHttps = httpOverHttps; exports2.httpsOverHttps = httpsOverHttps; function httpOverHttp(options) { var agent = new TunnelingAgent(options); agent.request = http2.request; return agent; } function httpsOverHttp(options) { var agent = new TunnelingAgent(options); agent.request = http2.request; agent.createSocket = createSecureSocket; agent.defaultPort = 443; return agent; } function httpOverHttps(options) { var agent = new TunnelingAgent(options); agent.request = https2.request; return agent; } function httpsOverHttps(options) { var agent = new TunnelingAgent(options); agent.request = https2.request; agent.createSocket = createSecureSocket; agent.defaultPort = 443; return agent; } function TunnelingAgent(options) { var self2 = this; self2.options = options || {}; self2.proxyOptions = self2.options.proxy || {}; self2.maxSockets = self2.options.maxSockets || http2.Agent.defaultMaxSockets; self2.requests = []; self2.sockets = []; self2.on("free", function onFree(socket, host, port, localAddress) { var options2 = toOptions(host, port, localAddress); for (var i = 0, len = self2.requests.length; i < len; ++i) { var pending = self2.requests[i]; if (pending.host === options2.host && pending.port === options2.port) { self2.requests.splice(i, 1); pending.request.onSocket(socket); return; } } socket.destroy(); self2.removeSocket(socket); }); } util.inherits(TunnelingAgent, events.EventEmitter); TunnelingAgent.prototype.addRequest = function addRequest(req, host, port, localAddress) { var self2 = this; var options = mergeOptions({ request: req }, self2.options, toOptions(host, port, localAddress)); if (self2.sockets.length >= this.maxSockets) { self2.requests.push(options); return; } self2.createSocket(options, function(socket) { socket.on("free", onFree); socket.on("close", onCloseOrRemove); socket.on("agentRemove", onCloseOrRemove); req.onSocket(socket); function onFree() { self2.emit("free", socket, options); } function onCloseOrRemove(err) { self2.removeSocket(socket); socket.removeListener("free", onFree); socket.removeListener("close", onCloseOrRemove); socket.removeListener("agentRemove", onCloseOrRemove); } }); }; TunnelingAgent.prototype.createSocket = function createSocket(options, cb) { var self2 = this; var placeholder = {}; self2.sockets.push(placeholder); var connectOptions = mergeOptions({}, self2.proxyOptions, { method: "CONNECT", path: options.host + ":" + options.port, agent: false, headers: { host: options.host + ":" + options.port } }); if (options.localAddress) { connectOptions.localAddress = options.localAddress; } if (connectOptions.proxyAuth) { connectOptions.headers = connectOptions.headers || {}; connectOptions.headers["Proxy-Authorization"] = "Basic " + new Buffer(connectOptions.proxyAuth).toString("base64"); } debug("making CONNECT request"); var connectReq = self2.request(connectOptions); connectReq.useChunkedEncodingByDefault = false; connectReq.once("response", onResponse); connectReq.once("upgrade", onUpgrade); connectReq.once("connect", onConnect); connectReq.once("error", onError); connectReq.end(); function onResponse(res) { res.upgrade = true; } function onUpgrade(res, socket, head) { process.nextTick(function() { onConnect(res, socket, head); }); } function onConnect(res, socket, head) { connectReq.removeAllListeners(); socket.removeAllListeners(); if (res.statusCode !== 200) { debug( "tunneling socket could not be established, statusCode=%d", res.statusCode ); socket.destroy(); var error = new Error("tunneling socket could not be established, statusCode=" + res.statusCode); error.code = "ECONNRESET"; options.request.emit("error", error); self2.removeSocket(placeholder); return; } if (head.length > 0) { debug("got illegal response body from proxy"); socket.destroy(); var error = new Error("got illegal response body from proxy"); error.code = "ECONNRESET"; options.request.emit("error", error); self2.removeSocket(placeholder); return; } debug("tunneling connection has established"); self2.sockets[self2.sockets.indexOf(placeholder)] = socket; return cb(socket); } function onError(cause) { connectReq.removeAllListeners(); debug( "tunneling socket could not be established, cause=%s\n", cause.message, cause.stack ); var error = new Error("tunneling socket could not be established, cause=" + cause.message); error.code = "ECONNRESET"; options.request.emit("error", error); self2.removeSocket(placeholder); } }; TunnelingAgent.prototype.removeSocket = function removeSocket(socket) { var pos = this.sockets.indexOf(socket); if (pos === -1) { return; } this.sockets.splice(pos, 1); var pending = this.requests.shift(); if (pending) { this.createSocket(pending, function(socket2) { pending.request.onSocket(socket2); }); } }; function createSecureSocket(options, cb) { var self2 = this; TunnelingAgent.prototype.createSocket.call(self2, options, function(socket) { var hostHeader = options.request.getHeader("host"); var tlsOptions = mergeOptions({}, self2.options, { socket, servername: hostHeader ? hostHeader.replace(/:.*$/, "") : options.host }); var secureSocket = tls.connect(0, tlsOptions); self2.sockets[self2.sockets.indexOf(socket)] = secureSocket; cb(secureSocket); }); } function toOptions(host, port, localAddress) { if (typeof host === "string") { return { host, port, localAddress }; } return host; } function mergeOptions(target) { for (var i = 1, len = arguments.length; i < len; ++i) { var overrides = arguments[i]; if (typeof overrides === "object") { var keys = Object.keys(overrides); for (var j = 0, keyLen = keys.length; j < keyLen; ++j) { var k = keys[j]; if (overrides[k] !== void 0) { target[k] = overrides[k]; } } } } return target; } var debug; if (process.env.NODE_DEBUG && /\btunnel\b/.test(process.env.NODE_DEBUG)) { debug = function() { var args = Array.prototype.slice.call(arguments); if (typeof args[0] === "string") { args[0] = "TUNNEL: " + args[0]; } else { args.unshift("TUNNEL:"); } console.error.apply(console, args); }; } else { debug = function() { }; } exports2.debug = debug; } }); // node_modules/tunnel/index.js var require_tunnel2 = __commonJS({ "node_modules/tunnel/index.js"(exports2, module2) { module2.exports = require_tunnel(); } }); // node_modules/ms/index.js var require_ms = __commonJS({ "node_modules/ms/index.js"(exports2, module2) { var s = 1e3; var m = s * 60; var h = m * 60; var d = h * 24; var y = d * 365.25; module2.exports = function(val, options) { options = options || {}; var type = typeof val; if (type === "string" && val.length > 0) { return parse(val); } else if (type === "number" && isNaN(val) === false) { return options.long ? fmtLong(val) : fmtShort(val); } throw new Error( "val is not a non-empty string or a valid number. val=" + JSON.stringify(val) ); }; function parse(str) { str = String(str); if (str.length > 100) { return; } var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec( str ); if (!match) { return; } var n = parseFloat(match[1]); var type = (match[2] || "ms").toLowerCase(); switch (type) { case "years": case "year": case "yrs": case "yr": case "y": return n * y; case "days": case "day": case "d": return n * d; case "hours": case "hour": case "hrs": case "hr": case "h": return n * h; case "minutes": case "minute": case "mins": case "min": case "m": return n * m; case "seconds": case "second": case "secs": case "sec": case "s": return n * s; case "milliseconds": case "millisecond": case "msecs": case "msec": case "ms": return n; default: return void 0; } } function fmtShort(ms) { if (ms >= d) { return Math.round(ms / d) + "d"; } if (ms >= h) { return Math.round(ms / h) + "h"; } if (ms >= m) { return Math.round(ms / m) + "m"; } if (ms >= s) { return Math.round(ms / s) + "s"; } return ms + "ms"; } function fmtLong(ms) { return plural(ms, d, "day") || plural(ms, h, "hour") || plural(ms, m, "minute") || plural(ms, s, "second") || ms + " ms"; } function plural(ms, n, name) { if (ms < n) { return; } if (ms < n * 1.5) { return Math.floor(ms / n) + " " + name; } return Math.ceil(ms / n) + " " + name + "s"; } } }); // node_modules/debug/src/debug.js var require_debug = __commonJS({ "node_modules/debug/src/debug.js"(exports2, module2) { exports2 = module2.exports = createDebug.debug = createDebug["default"] = createDebug; exports2.coerce = coerce; exports2.disable = disable; exports2.enable = enable; exports2.enabled = enabled; exports2.humanize = require_ms(); exports2.names = []; exports2.skips = []; exports2.formatters = {}; var prevTime; function selectColor(namespace) { var hash = 0, i; for (i in namespace) { hash = (hash << 5) - hash + namespace.charCodeAt(i); hash |= 0; } return exports2.colors[Math.abs(hash) % exports2.colors.length]; } function createDebug(namespace) { function debug() { if (!debug.enabled) return; var self2 = debug; var curr = +/* @__PURE__ */ new Date(); var ms = curr - (prevTime || curr); self2.diff = ms; self2.prev = prevTime; self2.curr = curr; prevTime = curr; var args = new Array(arguments.length); for (var i = 0; i < args.length; i++) { args[i] = arguments[i]; } args[0] = exports2.coerce(args[0]); if ("string" !== typeof args[0]) { args.unshift("%O"); } var index = 0; args[0] = args[0].replace(/%([a-zA-Z%])/g, function(match, format) { if (match === "%%") return match; index++; var formatter = exports2.formatters[format]; if ("function" === typeof formatter) { var val = args[index]; match = formatter.call(self2, val); args.splice(index, 1); index--; } return match; }); exports2.formatArgs.call(self2, args); var logFn = debug.log || exports2.log || console.log.bind(console); logFn.apply(self2, args); } debug.namespace = namespace; debug.enabled = exports2.enabled(namespace); debug.useColors = exports2.useColors(); debug.color = selectColor(namespace); if ("function" === typeof exports2.init) { exports2.init(debug); } return debug; } function enable(namespaces) { exports2.save(namespaces); exports2.names = []; exports2.skips = []; var split = (typeof namespaces === "string" ? namespaces : "").split(/[\s,]+/); var len = split.length; for (var i = 0; i < len; i++) { if (!split[i]) continue; namespaces = split[i].replace(/\*/g, ".*?"); if (namespaces[0] === "-") { exports2.skips.push(new RegExp("^" + namespaces.substr(1) + "$")); } else { exports2.names.push(new RegExp("^" + namespaces + "$")); } } } function disable() { exports2.enable(""); } function enabled(name) { var i, len; for (i = 0, len = exports2.skips.length; i < len; i++) { if (exports2.skips[i].test(name)) { return false; } } for (i = 0, len = exports2.names.length; i < len; i++) { if (exports2.names[i].test(name)) { return true; } } return false; } function coerce(val) { if (val instanceof Error) return val.stack || val.message; return val; } } }); // node_modules/debug/src/browser.js var require_browser = __commonJS({ "node_modules/debug/src/browser.js"(exports2, module2) { exports2 = module2.exports = require_debug(); exports2.log = log; exports2.formatArgs = formatArgs; exports2.save = save; exports2.load = load; exports2.useColors = useColors; exports2.storage = "undefined" != typeof chrome && "undefined" != typeof chrome.storage ? chrome.storage.local : localstorage(); exports2.colors = [ "lightseagreen", "forestgreen", "goldenrod", "dodgerblue", "darkorchid", "crimson" ]; function useColors() { if (typeof window !== "undefined" && window.process && window.process.type === "renderer") { return true; } return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // is firebug? http://stackoverflow.com/a/398120/376773 typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || // is firefox >= v31? // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || // double check webkit in userAgent just in case we are in a worker typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/); } exports2.formatters.j = function(v) { try { return JSON.stringify(v); } catch (err) { return "[UnexpectedJSONParseError]: " + err.message; } }; function formatArgs(args) { var useColors2 = this.useColors; args[0] = (useColors2 ? "%c" : "") + this.namespace + (useColors2 ? " %c" : " ") + args[0] + (useColors2 ? "%c " : " ") + "+" + exports2.humanize(this.diff); if (!useColors2) return; var c = "color: " + this.color; args.splice(1, 0, c, "color: inherit"); var index = 0; var lastC = 0; args[0].replace(/%[a-zA-Z%]/g, function(match) { if ("%%" === match) return; index++; if ("%c" === match) { lastC = index; } }); args.splice(lastC, 0, c); } function log() { return "object" === typeof console && console.log && Function.prototype.apply.call(console.log, console, arguments); } function save(namespaces) { try { if (null == namespaces) { exports2.storage.removeItem("debug"); } else { exports2.storage.debug = namespaces; } } catch (e) { } } function load() { var r; try { r = exports2.storage.debug; } catch (e) { } if (!r && typeof process !== "undefined" && "env" in process) { r = process.env.DEBUG; } return r; } exports2.enable(load()); function localstorage() { try { return window.localStorage; } catch (e) { } } } }); // node_modules/debug/src/node.js var require_node = __commonJS({ "node_modules/debug/src/node.js"(exports2, module2) { var tty = require("tty"); var util = require("util"); exports2 = module2.exports = require_debug(); exports2.init = init; exports2.log = log; exports2.formatArgs = formatArgs; exports2.save = save; exports2.load = load; exports2.useColors = useColors; exports2.colors = [6, 2, 3, 4, 5, 1]; exports2.inspectOpts = Object.keys(process.env).filter(function(key) { return /^debug_/i.test(key); }).reduce(function(obj, key) { var prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, function(_, k) { return k.toUpperCase(); }); var val = process.env[key]; if (/^(yes|on|true|enabled)$/i.test(val)) val = true; else if (/^(no|off|false|disabled)$/i.test(val)) val = false; else if (val === "null") val = null; else val = Number(val); obj[prop] = val; return obj; }, {}); var fd = parseInt(process.env.DEBUG_FD, 10) || 2; if (1 !== fd && 2 !== fd) { util.deprecate(function() { }, "except for stderr(2) and stdout(1), any other usage of DEBUG_FD is deprecated. Override debug.log if you want to use a different log function (https://git.io/debug_fd)")(); } var stream2 = 1 === fd ? process.stdout : 2 === fd ? process.stderr : createWritableStdioStream(fd); function useColors() { return "colors" in exports2.inspectOpts ? Boolean(exports2.inspectOpts.colors) : tty.isatty(fd); } exports2.formatters.o = function(v) { this.inspectOpts.colors = this.useColors; return util.inspect(v, this.inspectOpts).split("\n").map(function(str) { return str.trim(); }).join(" "); }; exports2.formatters.O = function(v) { this.inspectOpts.colors = this.useColors; return util.inspect(v, this.inspectOpts); }; function formatArgs(args) { var name = this.namespace; var useColors2 = this.useColors; if (useColors2) { var c = this.color; var prefix = " \x1B[3" + c + ";1m" + name + " \x1B[0m"; args[0] = prefix + args[0].split("\n").join("\n" + prefix); args.push("\x1B[3" + c + "m+" + exports2.humanize(this.diff) + "\x1B[0m"); } else { args[0] = (/* @__PURE__ */ new Date()).toUTCString() + " " + name + " " + args[0]; } } function log() { return stream2.write(util.format.apply(util, arguments) + "\n"); } function save(namespaces) { if (null == namespaces) { delete process.env.DEBUG; } else { process.env.DEBUG = namespaces; } } function load() { return process.env.DEBUG; } function createWritableStdioStream(fd2) { var stream3; var tty_wrap = process.binding("tty_wrap"); switch (tty_wrap.guessHandleType(fd2)) { case "TTY": stream3 = new tty.WriteStream(fd2); stream3._type = "tty"; if (stream3._handle && stream3._handle.unref) { stream3._handle.unref(); } break; case "FILE": var fs4 = require("fs"); stream3 = new fs4.SyncWriteStream(fd2, { autoClose: false }); stream3._type = "fs"; break; case "PIPE": case "TCP": var net2 = require("net"); stream3 = new net2.Socket({ fd: fd2, readable: false, writable: true }); stream3.readable = false; stream3.read = null; stream3._type = "pipe"; if (stream3._handle && stream3._handle.unref) { stream3._handle.unref(); } break; default: throw new Error("Implement me. Unknown stream file type!"); } stream3.fd = fd2; stream3._isStdio = true; return stream3; } function init(debug) { debug.inspectOpts = {}; var keys = Object.keys(exports2.inspectOpts); for (var i = 0; i < keys.length; i++) { debug.inspectOpts[keys[i]] = exports2.inspectOpts[keys[i]]; } } exports2.enable(load()); } }); // node_modules/debug/src/index.js var require_src = __commonJS({ "node_modules/debug/src/index.js"(exports2, module2) { if (typeof process !== "undefined" && process.type === "renderer") { module2.exports = require_browser(); } else { module2.exports = require_node(); } } }); // node_modules/follow-redirects/debug.js var require_debug2 = __commonJS({ "node_modules/follow-redirects/debug.js"(exports2, module2) { var debug; module2.exports = function() { if (!debug) { try { debug = require_src()("follow-redirects"); } catch (error) { } if (typeof debug !== "function") { debug = function() { }; } } debug.apply(null, arguments); }; } }); // node_modules/follow-redirects/index.js var require_follow_redirects = __commonJS({ "node_modules/follow-redirects/index.js"(exports2, module2) { var url = require("url"); var URL2 = url.URL; var http2 = require("http"); var https2 = require("https"); var Writable = require("stream").Writable; var assert2 = require("assert"); var debug = require_debug2(); (function detectUnsupportedEnvironment() { var looksLikeNode = typeof process !== "undefined"; var looksLikeBrowser = typeof window !== "undefined" && typeof document !== "undefined"; var looksLikeV8 = isFunction(Error.captureStackTrace); if (!looksLikeNode && (looksLikeBrowser || !looksLikeV8)) { console.warn("The follow-redirects package should be excluded from browser builds."); } })(); var useNativeURL = false; try { assert2(new URL2("")); } catch (error) { useNativeURL = error.code === "ERR_INVALID_URL"; } var preservedUrlFields = [ "auth", "host", "hostname", "href", "path", "pathname", "port", "protocol", "query", "search", "hash" ]; var events = ["abort", "aborted", "connect", "error", "socket", "timeout"]; var eventHandlers = /* @__PURE__ */ Object.create(null); events.forEach(function(event) { eventHandlers[event] = function(arg1, arg2, arg3) { this._redirectable.emit(event, arg1, arg2, arg3); }; }); var InvalidUrlError = createErrorType( "ERR_INVALID_URL", "Invalid URL", TypeError ); var RedirectionError = createErrorType( "ERR_FR_REDIRECTION_FAILURE", "Redirected request failed" ); var TooManyRedirectsError = createErrorType( "ERR_FR_TOO_MANY_REDIRECTS", "Maximum number of redirects exceeded", RedirectionError ); var MaxBodyLengthExceededError = createErrorType( "ERR_FR_MAX_BODY_LENGTH_EXCEEDED", "Request body larger than maxBodyLength limit" ); var WriteAfterEndError = createErrorType( "ERR_STREAM_WRITE_AFTER_END", "write after end" ); var destroy = Writable.prototype.destroy || noop; function RedirectableRequest(options, responseCallback) { Writable.call(this); this._sanitizeOptions(options); this._options = options; this._ended = false; this._ending = false; this._redirectCount = 0; this._redirects = []; this._requestBodyLength = 0; this._requestBodyBuffers = []; if (responseCallback) { this.on("response", responseCallback); } var self2 = this; this._onNativeResponse = function(response) { try { self2._processResponse(response); } catch (cause) { self2.emit("error", cause instanceof RedirectionError ? cause : new RedirectionError({ cause })); } }; this._performRequest(); } RedirectableRequest.prototype = Object.create(Writable.prototype); RedirectableRequest.prototype.abort = function() { destroyRequest(this._currentRequest); this._currentRequest.abort(); this.emit("abort"); }; RedirectableRequest.prototype.destroy = function(error) { destroyRequest(this._currentRequest, error); destroy.call(this, error); return this; }; RedirectableRequest.prototype.write = function(data, encoding, callback) { if (this._ending) { throw new WriteAfterEndError(); } if (!isString2(data) && !isBuffer(data)) { throw new TypeError("data should be a string, Buffer or Uint8Array"); } if (isFunction(encoding)) { callback = encoding; encoding = null; } if (data.length === 0) { if (callback) { callback(); } return; } if (this._requestBodyLength + data.length <= this._options.maxBodyLength) { this._requestBodyLength += data.length; this._requestBodyBuffers.push({ data, encoding }); this._currentRequest.write(data, encoding, callback); } else { this.emit("error", new MaxBodyLengthExceededError()); this.abort(); } }; RedirectableRequest.prototype.end = function(data, encoding, callback) { if (isFunction(data)) { callback = data; data = encoding = null; } else if (isFunction(encoding)) { callback = encoding; encoding = null; } if (!data) { this._ended = this._ending = true; this._currentRequest.end(null, null, callback); } else { var self2 = this; var currentRequest = this._currentRequest; this.write(data, encoding, function() { self2._ended = true; currentRequest.end(null, null, callback); }); this._ending = true; } }; RedirectableRequest.prototype.setHeader = function(name, value) { this._options.headers[name] = value; this._currentRequest.setHeader(name, value); }; RedirectableRequest.prototype.removeHeader = function(name) { delete this._options.headers[name]; this._currentRequest.removeHeader(name); }; RedirectableRequest.prototype.setTimeout = function(msecs, callback) { var self2 = this; function destroyOnTimeout(socket) { socket.setTimeout(msecs); socket.removeListener("timeout", socket.destroy); socket.addListener("timeout", socket.destroy); } function startTimer(socket) { if (self2._timeout) { clearTimeout(self2._timeout); } self2._timeout = setTimeout(function() { self2.emit("timeout"); clearTimer(); }, msecs); destroyOnTimeout(socket); } function clearTimer() { if (self2._timeout) { clearTimeout(self2._timeout); self2._timeout = null; } self2.removeListener("abort", clearTimer); self2.removeListener("error", clearTimer); self2.removeListener("response", clearTimer); self2.removeListener("close", clearTimer); if (callback) { self2.removeListener("timeout", callback); } if (!self2.socket) { self2._currentRequest.removeListener("socket", startTimer); } } if (callback) { this.on("timeout", callback); } if (this.socket) { startTimer(this.socket); } else { this._currentRequest.once("socket", startTimer); } this.on("socket", destroyOnTimeout); this.on("abort", clearTimer); this.on("error", clearTimer); this.on("response", clearTimer); this.on("close", clearTimer); return this; }; [ "flushHeaders", "getHeader", "setNoDelay", "setSocketKeepAlive" ].forEach(function(method) { RedirectableRequest.prototype[method] = function(a, b) { return this._currentRequest[method](a, b); }; }); ["aborted", "connection", "socket"].forEach(function(property) { Object.defineProperty(RedirectableRequest.prototype, property, { get: function() { return this._currentRequest[property]; } }); }); RedirectableRequest.prototype._sanitizeOptions = function(options) { if (!options.headers) { options.headers = {}; } if (options.host) { if (!options.hostname) { options.hostname = options.host; } delete options.host; } if (!options.pathname && options.path) { var searchPos = options.path.indexOf("?"); if (searchPos < 0) { options.pathname = options.path; } else { options.pathname = options.path.substring(0, searchPos); options.search = options.path.substring(searchPos); } } }; RedirectableRequest.prototype._performRequest = function() { var protocol = this._options.protocol; var nativeProtocol = this._options.nativeProtocols[protocol]; if (!nativeProtocol) { throw new TypeError("Unsupported protocol " + protocol); } if (this._options.agents) { var scheme = protocol.slice(0, -1); this._options.agent = this._options.agents[scheme]; } var request = this._currentRequest = nativeProtocol.request(this._options, this._onNativeResponse); request._redirectable = this; for (var event of events) { request.on(event, eventHandlers[event]); } this._currentUrl = /^\//.test(this._options.path) ? url.format(this._options) : ( // When making a request to a proxy, […] // a client MUST send the target URI in absolute-form […]. this._options.path ); if (this._isRedirect) { var i = 0; var self2 = this; var buffers = this._requestBodyBuffers; (function writeNext(error) { if (request === self2._currentRequest) { if (error) { self2.emit("error", error); } else if (i < buffers.length) { var buffer = buffers[i++]; if (!request.finished) { request.write(buffer.data, buffer.encoding, writeNext); } } else if (self2._ended) { request.end(); } } })(); } }; RedirectableRequest.prototype._processResponse = function(response) { var statusCode = response.statusCode; if (this._options.trackRedirects) { this._redirects.push({ url: this._currentUrl, headers: response.headers, statusCode }); } var location = response.headers.location; if (!location || this._options.followRedirects === false || statusCode < 300 || statusCode >= 400) { response.responseUrl = this._currentUrl; response.redirects = this._redirects; this.emit("response", response); this._requestBodyBuffers = []; return; } destroyRequest(this._currentRequest); response.destroy(); if (++this._redirectCount > this._options.maxRedirects) { throw new TooManyRedirectsError(); } var requestHeaders; var beforeRedirect = this._options.beforeRedirect; if (beforeRedirect) { requestHeaders = Object.assign({ // The Host header was set by nativeProtocol.request Host: response.req.getHeader("host") }, this._options.headers); } var method = this._options.method; if ((statusCode === 301 || statusCode === 302) && this._options.method === "POST" || // RFC7231§6.4.4: The 303 (See Other) status code indicates that // the server is redirecting the user agent to a different resource […] // A user agent can perform a retrieval request targeting that URI // (a GET or HEAD request if using HTTP) […] statusCode === 303 && !/^(?:GET|HEAD)$/.test(this._options.method)) { this._options.method = "GET"; this._requestBodyBuffers = []; removeMatchingHeaders(/^content-/i, this._options.headers); } var currentHostHeader = removeMatchingHeaders(/^host$/i, this._options.headers); var currentUrlParts = parseUrl(this._currentUrl); var currentHost = currentHostHeader || currentUrlParts.host; var currentUrl = /^\w+:/.test(location) ? this._currentUrl : url.format(Object.assign(currentUrlParts, { host: currentHost })); var redirectUrl = resolveUrl(location, currentUrl); debug("redirecting to", redirectUrl.href); this._isRedirect = true; spreadUrlObject(redirectUrl, this._options); if (redirectUrl.protocol !== currentUrlParts.protocol && redirectUrl.protocol !== "https:" || redirectUrl.host !== currentHost && !isSubdomain(redirectUrl.host, currentHost)) { removeMatchingHeaders(/^(?:(?:proxy-)?authorization|cookie)$/i, this._options.headers); } if (isFunction(beforeRedirect)) { var responseDetails = { headers: response.headers, statusCode }; var requestDetails = { url: currentUrl, method, headers: requestHeaders }; beforeRedirect(this._options, responseDetails, requestDetails); this._sanitizeOptions(this._options); } this._performRequest(); }; function wrap(protocols) { var exports3 = { maxRedirects: 21, maxBodyLength: 10 * 1024 * 1024 }; var nativeProtocols = {}; Object.keys(protocols).forEach(function(scheme) { var protocol = scheme + ":"; var nativeProtocol = nativeProtocols[protocol] = protocols[scheme]; var wrappedProtocol = exports3[scheme] = Object.create(nativeProtocol); function request(input, options, callback) { if (isURL(input)) { input = spreadUrlObject(input); } else if (isString2(input)) { input = spreadUrlObject(parseUrl(input)); } else { callback = options; options = validateUrl(input); input = { protocol }; } if (isFunction(options)) { callback = options; options = null; } options = Object.assign({ maxRedirects: exports3.maxRedirects, maxBodyLength: exports3.maxBodyLength }, input, options); options.nativeProtocols = nativeProtocols; if (!isString2(options.host) && !isString2(options.hostname)) { options.hostname = "::1"; } assert2.equal(options.protocol, protocol, "protocol mismatch"); debug("options", options); return new RedirectableRequest(options, callback); } function get(input, options, callback) { var wrappedRequest = wrappedProtocol.request(input, options, callback); wrappedRequest.end(); return wrappedRequest; } Object.defineProperties(wrappedProtocol, { request: { value: request, configurable: true, enumerable: true, writable: true }, get: { value: get, configurable: true, enumerable: true, writable: true } }); }); return exports3; } function noop() { } function parseUrl(input) { var parsed; if (useNativeURL) { parsed = new URL2(input); } else { parsed = validateUrl(url.parse(input)); if (!isString2(parsed.protocol)) { throw new InvalidUrlError({ input }); } } return parsed; } function resolveUrl(relative, base) { return useNativeURL ? new URL2(relative, base) : parseUrl(url.resolve(base, relative)); } function validateUrl(input) { if (/^\[/.test(input.hostname) && !/^\[[:0-9a-f]+\]$/i.test(input.hostname)) { throw new InvalidUrlError({ input: input.href || input }); } if (/^\[/.test(input.host) && !/^\[[:0-9a-f]+\](:\d+)?$/i.test(input.host)) { throw new InvalidUrlError({ input: input.href || input }); } return input; } function spreadUrlObject(urlObject, target) { var spread = target || {}; for (var key of preservedUrlFields) { spread[key] = urlObject[key]; } if (spread.hostname.startsWith("[")) { spread.hostname = spread.hostname.slice(1, -1); } if (spread.port !== "") { spread.port = Number(spread.port); } spread.path = spread.search ? spread.pathname + spread.search : spread.pathname; return spread; } function removeMatchingHeaders(regex, headers) { var lastValue; for (var header in headers) { if (regex.test(header)) { lastValue = headers[header]; delete headers[header]; } } return lastValue === null || typeof lastValue === "undefined" ? void 0 : String(lastValue).trim(); } function createErrorType(code, message, baseClass) { function CustomError(properties) { if (isFunction(Error.captureStackTrace)) { Error.captureStackTrace(this, this.constructor); } Object.assign(this, properties || {}); this.code = code; this.message = this.cause ? message + ": " + this.cause.message : message; } CustomError.prototype = new (baseClass || Error)(); Object.defineProperties(CustomError.prototype, { constructor: { value: CustomError, enumerable: false }, name: { value: "Error [" + code + "]", enumerable: false } }); return CustomError; } function destroyRequest(request, error) { for (var event of events) { request.removeListener(event, eventHandlers[event]); } request.on("error", noop); request.destroy(error); } function isSubdomain(subdomain, domain) { assert2(isString2(subdomain) && isString2(domain)); var dot = subdomain.length - domain.length - 1; return dot > 0 && subdomain[dot] === "." && subdomain.endsWith(domain); } function isString2(value) { return typeof value === "string" || value instanceof String; } function isFunction(value) { return typeof value === "function"; } function isBuffer(value) { return typeof value === "object" && "length" in value; } function isURL(value) { return URL2 && value instanceof URL2; } module2.exports = wrap({ http: http2, https: https2 }); module2.exports.wrap = wrap; } }); // node_modules/coc-utils/out/utils.js var require_utils = __commonJS({ "node_modules/coc-utils/out/utils.js"(exports2) { "use strict"; var __awaiter = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function(resolve) { resolve(value); }); } return new (P || (P = Promise))(function(resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; var __importDefault = exports2 && exports2.__importDefault || function(mod) { return mod && mod.__esModule ? mod : { "default": mod }; }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.httpsGetJson = exports2.httpsGet = exports2.getAgent = exports2.getCurrentSelection = exports2.isWindowsOS = exports2.getTimestampString = exports2.checkIfFileExists = exports2.getPipePath = exports2.ensurePathExists = exports2.sleep = exports2.fileURLToPath = void 0; var fs4 = require("fs"); var os = require("os"); var path5 = require("path"); var coc_nvim_1 = require("coc.nvim"); var coc_nvim_2 = require("coc.nvim"); var tunnel_1 = __importDefault(require_tunnel2()); var follow_redirects_1 = require_follow_redirects(); var url_1 = require("url"); function fileURLToPath(x) { return coc_nvim_2.Uri.parse(x).fsPath; } exports2.fileURLToPath = fileURLToPath; function sleep(ms) { return new Promise((resolve, __) => setTimeout(resolve, ms)); } exports2.sleep = sleep; function ensurePathExists(targetPath) { try { fs4.mkdirSync(targetPath); } catch (e) { if (e.code !== "EEXIST") { throw e; } } } exports2.ensurePathExists = ensurePathExists; function getPipePath(pipeName) { if (os.platform() === "win32") { return "\\\\.\\pipe\\" + pipeName; } else { return path5.join(os.tmpdir(), `CoreFxPipe_${pipeName}`); } } exports2.getPipePath = getPipePath; function checkIfFileExists(filePath) { try { fs4.accessSync(filePath, fs4.constants.R_OK); return true; } catch (e) { return false; } } exports2.checkIfFileExists = checkIfFileExists; function getTimestampString() { const time = /* @__PURE__ */ new Date(); return `[${time.getHours()}:${time.getMinutes()}:${time.getSeconds()}]`; } exports2.getTimestampString = getTimestampString; function isWindowsOS() { return os.platform() === "win32"; } exports2.isWindowsOS = isWindowsOS; function getCurrentSelection(mode) { return __awaiter(this, void 0, void 0, function* () { let doc = yield coc_nvim_1.workspace.document; if (mode === "v" || mode === "V") { let [from] = yield doc.buffer.mark("<"); let [to] = yield doc.buffer.mark(">"); let result = []; for (let i = from; i <= to; ++i) { result.push(doc.getline(i - 1)); } return result; } else if (mode === "n") { let line = yield coc_nvim_1.workspace.nvim.call("line", "."); return [doc.getline(line - 1)]; } else if (mode === "i") { } else if (mode === "t") { } return []; }); } exports2.getCurrentSelection = getCurrentSelection; function getAgent(endpoint) { let key = endpoint.protocol.startsWith("https") ? "HTTPS_PROXY" : "HTTP_PROXY"; let env = process.env[key] || process.env[key.toLowerCase()]; if (env) { let noProxy = process.env.NO_PROXY || process.env.no_proxy; if (noProxy === "*") { env = null; } else if (noProxy) { const hostname = endpoint.hostname.replace(/^\.*/, ".").toLowerCase(); const port = endpoint.port || endpoint.protocol.startsWith("https") ? "443" : "80"; const noProxyList = noProxy.split(","); for (let i = 0, len = noProxyList.length; i < len; i++) { let noProxyItem = noProxyList[i].trim().toLowerCase(); if (noProxyItem.indexOf(":") > -1) { let noProxyItemParts = noProxyItem.split(":", 2); let noProxyHost = noProxyItemParts[0].replace(/^\.*/, "."); let noProxyPort = noProxyItemParts[1]; if (port === noProxyPort && hostname.endsWith(noProxyHost)) { env = null; break; } } else { noProxyItem = noProxyItem.replace(/^\.*/, "."); if (hostname.endsWith(noProxyItem)) { env = null; break; } } } } } let proxy = coc_nvim_1.workspace.getConfiguration("http").get("proxy", ""); if (!proxy && env) { proxy = env; } if (proxy) { proxy = proxy.replace(/^https?:\/\//, "").replace(/\/$/, ""); let auth = proxy.includes("@") ? proxy.split("@", 2)[0] : ""; let parts = auth.length ? proxy.slice(auth.length + 1).split(":") : proxy.split(":"); if (parts.length > 1) { let agent = tunnel_1.default.httpsOverHttp({ proxy: { headers: {}, host: parts[0], port: parseInt(parts[1], 10), proxyAuth: auth } }); return agent; } } return null; } exports2.getAgent = getAgent; function httpsGet(url, cb) { let endpoint = url_1.parse(url); return new Promise((resolve, reject) => { let options = { hostname: endpoint.hostname, port: endpoint.port, path: endpoint.path, method: "GET", agent: getAgent(endpoint) }; const req = follow_redirects_1.https.request(options, (res) => { if (res.statusCode != 200) { reject(new Error(`Invalid response from ${JSON.stringify(url)}: ${res.statusCode}`)); return; } cb(resolve, reject, res); }); req.setHeader("user-agent", "coc.nvim"); req.on("error", reject); req.end(); }); } exports2.httpsGet = httpsGet; function httpsGetJson(url) { return __awaiter(this, void 0, void 0, function* () { let content = yield coc_nvim_2.fetch(url); if (typeof content === "string") { return JSON.parse(content); } else { return content; } }); } exports2.httpsGetJson = httpsGetJson; } }); // node_modules/coc-utils/out/repl.js var require_repl = __commonJS({ "node_modules/coc-utils/out/repl.js"(exports2) { "use strict"; var __awaiter = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function(resolve) { resolve(value); }); } return new (P || (P = Promise))(function(resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.REPLProvider = exports2.REPLProcess = void 0; var coc = require("coc.nvim"); var coc_nvim_1 = require("coc.nvim"); var utils_1 = re