import { __commonJSMin as e } from "../../../../_virtual/_rolldown/runtime.js";
import { require_ral as t } from "./ral.js";
import { require_is as n } from "./is.js";
import { require_events as r } from "./events.js";
import { require_cancellation as i } from "./cancellation.js";
import { require_messages as a } from "./messages.js";
import { require_linkedMap as o } from "./linkedMap.js";
//#region ../../node_modules/vscode-jsonrpc/lib/common/connection.js
var s = /* @__PURE__ */ e(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.createMessageConnection = e.ConnectionOptions = e.MessageStrategy = e.CancellationStrategy = e.CancellationSenderStrategy = e.CancellationReceiverStrategy = e.RequestCancellationReceiverStrategy = e.IdCancellationReceiverStrategy = e.ConnectionStrategy = e.ConnectionError = e.ConnectionErrors = e.LogTraceNotification = e.SetTraceNotification = e.TraceFormat = e.TraceValues = e.Trace = e.NullLogger = e.ProgressType = e.ProgressToken = void 0;
	var s = t(), c = n(), l = a(), u = o(), d = r(), f = i(), p;
	(function(e) {
		e.type = new l.NotificationType("$/cancelRequest");
	})(p ||= {});
	var m;
	(function(e) {
		function t(e) {
			return typeof e == "string" || typeof e == "number";
		}
		e.is = t;
	})(m || (e.ProgressToken = m = {}));
	var h;
	(function(e) {
		e.type = new l.NotificationType("$/progress");
	})(h ||= {}), e.ProgressType = class {
		constructor() {}
	};
	var ee;
	(function(e) {
		function t(e) {
			return c.func(e);
		}
		e.is = t;
	})(ee ||= {}), e.NullLogger = Object.freeze({
		error: () => {},
		warn: () => {},
		info: () => {},
		log: () => {}
	});
	var g;
	(function(e) {
		e[e.Off = 0] = "Off", e[e.Messages = 1] = "Messages", e[e.Compact = 2] = "Compact", e[e.Verbose = 3] = "Verbose";
	})(g || (e.Trace = g = {}));
	var _;
	(function(e) {
		e.Off = "off", e.Messages = "messages", e.Compact = "compact", e.Verbose = "verbose";
	})(_ || (e.TraceValues = _ = {})), (function(e) {
		function t(t) {
			if (!c.string(t)) return e.Off;
			switch (t = t.toLowerCase(), t) {
				case "off": return e.Off;
				case "messages": return e.Messages;
				case "compact": return e.Compact;
				case "verbose": return e.Verbose;
				default: return e.Off;
			}
		}
		e.fromString = t;
		function n(t) {
			switch (t) {
				case e.Off: return "off";
				case e.Messages: return "messages";
				case e.Compact: return "compact";
				case e.Verbose: return "verbose";
				default: return "off";
			}
		}
		e.toString = n;
	})(g || (e.Trace = g = {}));
	var v;
	(function(e) {
		e.Text = "text", e.JSON = "json";
	})(v || (e.TraceFormat = v = {})), (function(e) {
		function t(t) {
			return c.string(t) ? (t = t.toLowerCase(), t === "json" ? e.JSON : e.Text) : e.Text;
		}
		e.fromString = t;
	})(v || (e.TraceFormat = v = {}));
	var y;
	(function(e) {
		e.type = new l.NotificationType("$/setTrace");
	})(y || (e.SetTraceNotification = y = {}));
	var b;
	(function(e) {
		e.type = new l.NotificationType("$/logTrace");
	})(b || (e.LogTraceNotification = b = {}));
	var x;
	(function(e) {
		e[e.Closed = 1] = "Closed", e[e.Disposed = 2] = "Disposed", e[e.AlreadyListening = 3] = "AlreadyListening";
	})(x || (e.ConnectionErrors = x = {}));
	var S = class e extends Error {
		constructor(t, n) {
			super(n), this.code = t, Object.setPrototypeOf(this, e.prototype);
		}
	};
	e.ConnectionError = S;
	var C;
	(function(e) {
		function t(e) {
			let t = e;
			return t && c.func(t.cancelUndispatched);
		}
		e.is = t;
	})(C || (e.ConnectionStrategy = C = {}));
	var w;
	(function(e) {
		function t(e) {
			let t = e;
			return t && (t.kind === void 0 || t.kind === "id") && c.func(t.createCancellationTokenSource) && (t.dispose === void 0 || c.func(t.dispose));
		}
		e.is = t;
	})(w || (e.IdCancellationReceiverStrategy = w = {}));
	var T;
	(function(e) {
		function t(e) {
			let t = e;
			return t && t.kind === "request" && c.func(t.createCancellationTokenSource) && (t.dispose === void 0 || c.func(t.dispose));
		}
		e.is = t;
	})(T || (e.RequestCancellationReceiverStrategy = T = {}));
	var E;
	(function(e) {
		e.Message = Object.freeze({ createCancellationTokenSource(e) {
			return new f.CancellationTokenSource();
		} });
		function t(e) {
			return w.is(e) || T.is(e);
		}
		e.is = t;
	})(E || (e.CancellationReceiverStrategy = E = {}));
	var D;
	(function(e) {
		e.Message = Object.freeze({
			sendCancellation(e, t) {
				return e.sendNotification(p.type, { id: t });
			},
			cleanup(e) {}
		});
		function t(e) {
			let t = e;
			return t && c.func(t.sendCancellation) && c.func(t.cleanup);
		}
		e.is = t;
	})(D || (e.CancellationSenderStrategy = D = {}));
	var O;
	(function(e) {
		e.Message = Object.freeze({
			receiver: E.Message,
			sender: D.Message
		});
		function t(e) {
			let t = e;
			return t && E.is(t.receiver) && D.is(t.sender);
		}
		e.is = t;
	})(O || (e.CancellationStrategy = O = {}));
	var k;
	(function(e) {
		function t(e) {
			let t = e;
			return t && c.func(t.handleMessage);
		}
		e.is = t;
	})(k || (e.MessageStrategy = k = {}));
	var A;
	(function(e) {
		function t(e) {
			let t = e;
			return t && (O.is(t.cancellationStrategy) || C.is(t.connectionStrategy) || k.is(t.messageStrategy));
		}
		e.is = t;
	})(A || (e.ConnectionOptions = A = {}));
	var j;
	(function(e) {
		e[e.New = 1] = "New", e[e.Listening = 2] = "Listening", e[e.Closed = 3] = "Closed", e[e.Disposed = 4] = "Disposed";
	})(j ||= {});
	function M(t, n, r, i) {
		let a = r === void 0 ? e.NullLogger : r, o = 0, _ = 0, C = 0, T, E = /* @__PURE__ */ new Map(), D, A = /* @__PURE__ */ new Map(), M = /* @__PURE__ */ new Map(), N, P = new u.LinkedMap(), F = /* @__PURE__ */ new Map(), I = /* @__PURE__ */ new Set(), L = /* @__PURE__ */ new Map(), R = g.Off, z = v.Text, B, V = j.New, H = new d.Emitter(), te = new d.Emitter(), ne = new d.Emitter(), re = new d.Emitter(), U = new d.Emitter(), W = i && i.cancellationStrategy ? i.cancellationStrategy : O.Message;
		function ie(e) {
			if (e === null) throw Error("Can't send requests with id null since the response can't be correlated.");
			return "req-" + e.toString();
		}
		function ae(e) {
			return e === null ? "res-unknown-" + (++C).toString() : "res-" + e.toString();
		}
		function oe() {
			return "not-" + (++_).toString();
		}
		function se(e, t) {
			l.Message.isRequest(t) ? e.set(ie(t.id), t) : l.Message.isResponse(t) ? e.set(ae(t.id), t) : e.set(oe(), t);
		}
		function ce(e) {}
		function le() {
			return V === j.Listening;
		}
		function ue() {
			return V === j.Closed;
		}
		function G() {
			return V === j.Disposed;
		}
		function de() {
			(V === j.New || V === j.Listening) && (V = j.Closed, te.fire(void 0));
		}
		function fe(e) {
			H.fire([
				e,
				void 0,
				void 0
			]);
		}
		function pe(e) {
			H.fire(e);
		}
		t.onClose(de), t.onError(fe), n.onClose(de), n.onError(pe);
		function me() {
			N || P.size === 0 || (N = (0, s.default)().timer.setImmediate(() => {
				N = void 0, ge();
			}));
		}
		function he(e) {
			l.Message.isRequest(e) ? ve(e) : l.Message.isNotification(e) ? be(e) : l.Message.isResponse(e) ? ye(e) : xe(e);
		}
		function ge() {
			if (P.size === 0) return;
			let e = P.shift();
			try {
				let t = i?.messageStrategy;
				k.is(t) ? t.handleMessage(e, he) : he(e);
			} finally {
				me();
			}
		}
		let _e = (e) => {
			try {
				if (l.Message.isNotification(e) && e.method === p.type.method) {
					let t = e.params.id, r = ie(t), o = P.get(r);
					if (l.Message.isRequest(o)) {
						let s = i?.connectionStrategy, c = s && s.cancelUndispatched ? s.cancelUndispatched(o, ce) : void 0;
						if (c && (c.error !== void 0 || c.result !== void 0)) {
							P.delete(r), L.delete(t), c.id = o.id, q(c, e.method, Date.now()), n.write(c).catch(() => a.error("Sending response for canceled message failed."));
							return;
						}
					}
					let s = L.get(t);
					if (s !== void 0) {
						s.cancel(), J(e);
						return;
					} else I.add(t);
				}
				se(P, e);
			} finally {
				me();
			}
		};
		function ve(e) {
			if (G()) return;
			function t(t, r, i) {
				let o = {
					jsonrpc: "2.0",
					id: e.id
				};
				t instanceof l.ResponseError ? o.error = t.toJson() : o.result = t === void 0 ? null : t, q(o, r, i), n.write(o).catch(() => a.error("Sending response failed."));
			}
			function r(t, r, i) {
				let o = {
					jsonrpc: "2.0",
					id: e.id,
					error: t.toJson()
				};
				q(o, r, i), n.write(o).catch(() => a.error("Sending response failed."));
			}
			function i(t, r, i) {
				t === void 0 && (t = null);
				let o = {
					jsonrpc: "2.0",
					id: e.id,
					result: t
				};
				q(o, r, i), n.write(o).catch(() => a.error("Sending response failed."));
			}
			we(e);
			let o = E.get(e.method), s, u;
			o && (s = o.type, u = o.handler);
			let d = Date.now();
			if (u || T) {
				let n = e.id ?? String(Date.now()), a = w.is(W.receiver) ? W.receiver.createCancellationTokenSource(n) : W.receiver.createCancellationTokenSource(e);
				e.id !== null && I.has(e.id) && a.cancel(), e.id !== null && L.set(n, a);
				try {
					let o;
					if (u) if (e.params === void 0) {
						if (s !== void 0 && s.numberOfParams !== 0) {
							r(new l.ResponseError(l.ErrorCodes.InvalidParams, `Request ${e.method} defines ${s.numberOfParams} params but received none.`), e.method, d);
							return;
						}
						o = u(a.token);
					} else if (Array.isArray(e.params)) {
						if (s !== void 0 && s.parameterStructures === l.ParameterStructures.byName) {
							r(new l.ResponseError(l.ErrorCodes.InvalidParams, `Request ${e.method} defines parameters by name but received parameters by position`), e.method, d);
							return;
						}
						o = u(...e.params, a.token);
					} else {
						if (s !== void 0 && s.parameterStructures === l.ParameterStructures.byPosition) {
							r(new l.ResponseError(l.ErrorCodes.InvalidParams, `Request ${e.method} defines parameters by position but received parameters by name`), e.method, d);
							return;
						}
						o = u(e.params, a.token);
					}
					else T && (o = T(e.method, e.params, a.token));
					let f = o;
					o ? f.then ? f.then((r) => {
						L.delete(n), t(r, e.method, d);
					}, (t) => {
						L.delete(n), t instanceof l.ResponseError ? r(t, e.method, d) : t && c.string(t.message) ? r(new l.ResponseError(l.ErrorCodes.InternalError, `Request ${e.method} failed with message: ${t.message}`), e.method, d) : r(new l.ResponseError(l.ErrorCodes.InternalError, `Request ${e.method} failed unexpectedly without providing any details.`), e.method, d);
					}) : (L.delete(n), t(o, e.method, d)) : (L.delete(n), i(o, e.method, d));
				} catch (i) {
					L.delete(n), i instanceof l.ResponseError ? t(i, e.method, d) : i && c.string(i.message) ? r(new l.ResponseError(l.ErrorCodes.InternalError, `Request ${e.method} failed with message: ${i.message}`), e.method, d) : r(new l.ResponseError(l.ErrorCodes.InternalError, `Request ${e.method} failed unexpectedly without providing any details.`), e.method, d);
				}
			} else r(new l.ResponseError(l.ErrorCodes.MethodNotFound, `Unhandled method ${e.method}`), e.method, d);
		}
		function ye(e) {
			if (!G()) if (e.id === null) e.error ? a.error(`Received response message without id: Error is: \n${JSON.stringify(e.error, void 0, 4)}`) : a.error("Received response message without id. No further error information provided.");
			else {
				let t = e.id, n = F.get(t);
				if (Te(e, n), n !== void 0) {
					F.delete(t);
					try {
						if (e.error) {
							let t = e.error;
							n.reject(new l.ResponseError(t.code, t.message, t.data));
						} else if (e.result !== void 0) n.resolve(e.result);
						else throw Error("Should never happen.");
					} catch (e) {
						e.message ? a.error(`Response handler '${n.method}' failed with message: ${e.message}`) : a.error(`Response handler '${n.method}' failed unexpectedly.`);
					}
				}
			}
		}
		function be(e) {
			if (G()) return;
			let t, n;
			if (e.method === p.type.method) {
				let t = e.params.id;
				I.delete(t), J(e);
				return;
			} else {
				let r = A.get(e.method);
				r && (n = r.handler, t = r.type);
			}
			if (n || D) try {
				if (J(e), n) if (e.params === void 0) t !== void 0 && t.numberOfParams !== 0 && t.parameterStructures !== l.ParameterStructures.byName && a.error(`Notification ${e.method} defines ${t.numberOfParams} params but received none.`), n();
				else if (Array.isArray(e.params)) {
					let r = e.params;
					e.method === h.type.method && r.length === 2 && m.is(r[0]) ? n({
						token: r[0],
						value: r[1]
					}) : (t !== void 0 && (t.parameterStructures === l.ParameterStructures.byName && a.error(`Notification ${e.method} defines parameters by name but received parameters by position`), t.numberOfParams !== e.params.length && a.error(`Notification ${e.method} defines ${t.numberOfParams} params but received ${r.length} arguments`)), n(...r));
				} else t !== void 0 && t.parameterStructures === l.ParameterStructures.byPosition && a.error(`Notification ${e.method} defines parameters by position but received parameters by name`), n(e.params);
				else D && D(e.method, e.params);
			} catch (t) {
				t.message ? a.error(`Notification handler '${e.method}' failed with message: ${t.message}`) : a.error(`Notification handler '${e.method}' failed unexpectedly.`);
			}
			else ne.fire(e);
		}
		function xe(e) {
			if (!e) {
				a.error("Received empty message.");
				return;
			}
			a.error(`Received message which is neither a response nor a notification message:\n${JSON.stringify(e, null, 4)}`);
			let t = e;
			if (c.string(t.id) || c.number(t.id)) {
				let e = t.id, n = F.get(e);
				n && n.reject(/* @__PURE__ */ Error("The received response has neither a result nor an error property."));
			}
		}
		function K(e) {
			if (e != null) switch (R) {
				case g.Verbose: return JSON.stringify(e, null, 4);
				case g.Compact: return JSON.stringify(e);
				default: return;
			}
		}
		function Se(e) {
			if (!(R === g.Off || !B)) if (z === v.Text) {
				let t;
				(R === g.Verbose || R === g.Compact) && e.params && (t = `Params: ${K(e.params)}\n\n`), B.log(`Sending request '${e.method} - (${e.id})'.`, t);
			} else Y("send-request", e);
		}
		function Ce(e) {
			if (!(R === g.Off || !B)) if (z === v.Text) {
				let t;
				(R === g.Verbose || R === g.Compact) && (t = e.params ? `Params: ${K(e.params)}\n\n` : "No parameters provided.\n\n"), B.log(`Sending notification '${e.method}'.`, t);
			} else Y("send-notification", e);
		}
		function q(e, t, n) {
			if (!(R === g.Off || !B)) if (z === v.Text) {
				let r;
				(R === g.Verbose || R === g.Compact) && (e.error && e.error.data ? r = `Error data: ${K(e.error.data)}\n\n` : e.result ? r = `Result: ${K(e.result)}\n\n` : e.error === void 0 && (r = "No result returned.\n\n")), B.log(`Sending response '${t} - (${e.id})'. Processing request took ${Date.now() - n}ms`, r);
			} else Y("send-response", e);
		}
		function we(e) {
			if (!(R === g.Off || !B)) if (z === v.Text) {
				let t;
				(R === g.Verbose || R === g.Compact) && e.params && (t = `Params: ${K(e.params)}\n\n`), B.log(`Received request '${e.method} - (${e.id})'.`, t);
			} else Y("receive-request", e);
		}
		function J(e) {
			if (!(R === g.Off || !B || e.method === b.type.method)) if (z === v.Text) {
				let t;
				(R === g.Verbose || R === g.Compact) && (t = e.params ? `Params: ${K(e.params)}\n\n` : "No parameters provided.\n\n"), B.log(`Received notification '${e.method}'.`, t);
			} else Y("receive-notification", e);
		}
		function Te(e, t) {
			if (!(R === g.Off || !B)) if (z === v.Text) {
				let n;
				if ((R === g.Verbose || R === g.Compact) && (e.error && e.error.data ? n = `Error data: ${K(e.error.data)}\n\n` : e.result ? n = `Result: ${K(e.result)}\n\n` : e.error === void 0 && (n = "No result returned.\n\n")), t) {
					let r = e.error ? ` Request failed: ${e.error.message} (${e.error.code}).` : "";
					B.log(`Received response '${t.method} - (${e.id})' in ${Date.now() - t.timerStart}ms.${r}`, n);
				} else B.log(`Received response ${e.id} without active response promise.`, n);
			} else Y("receive-response", e);
		}
		function Y(e, t) {
			if (!B || R === g.Off) return;
			let n = {
				isLSPMessage: !0,
				type: e,
				message: t,
				timestamp: Date.now()
			};
			B.log(n);
		}
		function X() {
			if (ue()) throw new S(x.Closed, "Connection is closed.");
			if (G()) throw new S(x.Disposed, "Connection is disposed.");
		}
		function Ee() {
			if (le()) throw new S(x.AlreadyListening, "Connection is already listening");
		}
		function De() {
			if (!le()) throw Error("Call listen() first.");
		}
		function Z(e) {
			return e === void 0 ? null : e;
		}
		function Oe(e) {
			if (e !== null) return e;
		}
		function ke(e) {
			return e != null && !Array.isArray(e) && typeof e == "object";
		}
		function Q(e, t) {
			switch (e) {
				case l.ParameterStructures.auto: return ke(t) ? Oe(t) : [Z(t)];
				case l.ParameterStructures.byName:
					if (!ke(t)) throw Error("Received parameters by name but param is not an object literal.");
					return Oe(t);
				case l.ParameterStructures.byPosition: return [Z(t)];
				default: throw Error(`Unknown parameter structure ${e.toString()}`);
			}
		}
		function Ae(e, t) {
			let n, r = e.numberOfParams;
			switch (r) {
				case 0:
					n = void 0;
					break;
				case 1:
					n = Q(e.parameterStructures, t[0]);
					break;
				default:
					n = [];
					for (let e = 0; e < t.length && e < r; e++) n.push(Z(t[e]));
					if (t.length < r) for (let e = t.length; e < r; e++) n.push(null);
					break;
			}
			return n;
		}
		let $ = {
			sendNotification: (e, ...t) => {
				X();
				let r, i;
				if (c.string(e)) {
					r = e;
					let n = t[0], a = 0, o = l.ParameterStructures.auto;
					l.ParameterStructures.is(n) && (a = 1, o = n);
					let s = t.length, c = s - a;
					switch (c) {
						case 0:
							i = void 0;
							break;
						case 1:
							i = Q(o, t[a]);
							break;
						default:
							if (o === l.ParameterStructures.byName) throw Error(`Received ${c} parameters for 'by Name' notification parameter structure.`);
							i = t.slice(a, s).map((e) => Z(e));
							break;
					}
				} else {
					let n = t;
					r = e.method, i = Ae(e, n);
				}
				let o = {
					jsonrpc: "2.0",
					method: r,
					params: i
				};
				return Ce(o), n.write(o).catch((e) => {
					throw a.error("Sending notification failed."), e;
				});
			},
			onNotification: (e, t) => {
				X();
				let n;
				return c.func(e) ? D = e : t && (c.string(e) ? (n = e, A.set(e, {
					type: void 0,
					handler: t
				})) : (n = e.method, A.set(e.method, {
					type: e,
					handler: t
				}))), { dispose: () => {
					n === void 0 ? D = void 0 : A.delete(n);
				} };
			},
			onProgress: (e, t, n) => {
				if (M.has(t)) throw Error(`Progress handler for token ${t} already registered`);
				return M.set(t, n), { dispose: () => {
					M.delete(t);
				} };
			},
			sendProgress: (e, t, n) => $.sendNotification(h.type, {
				token: t,
				value: n
			}),
			onUnhandledProgress: re.event,
			sendRequest: (e, ...t) => {
				X(), De();
				let r, i, s;
				if (c.string(e)) {
					r = e;
					let n = t[0], a = t[t.length - 1], o = 0, c = l.ParameterStructures.auto;
					l.ParameterStructures.is(n) && (o = 1, c = n);
					let u = t.length;
					f.CancellationToken.is(a) && (--u, s = a);
					let d = u - o;
					switch (d) {
						case 0:
							i = void 0;
							break;
						case 1:
							i = Q(c, t[o]);
							break;
						default:
							if (c === l.ParameterStructures.byName) throw Error(`Received ${d} parameters for 'by Name' request parameter structure.`);
							i = t.slice(o, u).map((e) => Z(e));
							break;
					}
				} else {
					let n = t;
					r = e.method, i = Ae(e, n);
					let a = e.numberOfParams;
					s = f.CancellationToken.is(n[a]) ? n[a] : void 0;
				}
				let u = o++, d;
				s && (d = s.onCancellationRequested(() => {
					let e = W.sender.sendCancellation($, u);
					return e === void 0 ? (a.log(`Received no promise from cancellation strategy when cancelling id ${u}`), Promise.resolve()) : e.catch(() => {
						a.log(`Sending cancellation messages for id ${u} failed`);
					});
				}));
				let p = {
					jsonrpc: "2.0",
					id: u,
					method: r,
					params: i
				};
				return Se(p), typeof W.sender.enableCancellation == "function" && W.sender.enableCancellation(p), new Promise(async (e, t) => {
					let i = {
						method: r,
						timerStart: Date.now(),
						resolve: (t) => {
							e(t), W.sender.cleanup(u), d?.dispose();
						},
						reject: (e) => {
							t(e), W.sender.cleanup(u), d?.dispose();
						}
					};
					try {
						await n.write(p), F.set(u, i);
					} catch (e) {
						throw a.error("Sending request failed."), i.reject(new l.ResponseError(l.ErrorCodes.MessageWriteError, e.message ? e.message : "Unknown reason")), e;
					}
				});
			},
			onRequest: (e, t) => {
				X();
				let n = null;
				return ee.is(e) ? (n = void 0, T = e) : c.string(e) ? (n = null, t !== void 0 && (n = e, E.set(e, {
					handler: t,
					type: void 0
				}))) : t !== void 0 && (n = e.method, E.set(e.method, {
					type: e,
					handler: t
				})), { dispose: () => {
					n !== null && (n === void 0 ? T = void 0 : E.delete(n));
				} };
			},
			hasPendingResponse: () => F.size > 0,
			trace: async (e, t, n) => {
				let r = !1, i = v.Text;
				n !== void 0 && (c.boolean(n) ? r = n : (r = n.sendNotification || !1, i = n.traceFormat || v.Text)), R = e, z = i, B = R === g.Off ? void 0 : t, r && !ue() && !G() && await $.sendNotification(y.type, { value: g.toString(e) });
			},
			onError: H.event,
			onClose: te.event,
			onUnhandledNotification: ne.event,
			onDispose: U.event,
			end: () => {
				n.end();
			},
			dispose: () => {
				if (G()) return;
				V = j.Disposed, U.fire(void 0);
				let e = new l.ResponseError(l.ErrorCodes.PendingResponseRejected, "Pending response rejected since connection got disposed");
				for (let t of F.values()) t.reject(e);
				F = /* @__PURE__ */ new Map(), L = /* @__PURE__ */ new Map(), I = /* @__PURE__ */ new Set(), P = new u.LinkedMap(), c.func(n.dispose) && n.dispose(), c.func(t.dispose) && t.dispose();
			},
			listen: () => {
				X(), Ee(), V = j.Listening, t.listen(_e);
			},
			inspect: () => {
				(0, s.default)().console.log("inspect");
			}
		};
		return $.onNotification(b.type, (e) => {
			if (R === g.Off || !B) return;
			let t = R === g.Verbose || R === g.Compact;
			B.log(e.message, t ? e.verbose : void 0);
		}), $.onNotification(h.type, (e) => {
			let t = M.get(e.token);
			t ? t(e.value) : re.fire(e);
		}), $;
	}
	e.createMessageConnection = M;
}));
//#endregion
export default s();
export { s as require_connection };
