// Shinylive 0.2.3 // Copyright 2023 RStudio, PBC import { Icon, __commonJS, __esm, __export, __privateAdd, __privateMethod, __publicField, __toCommonJS, __toESM, appUrlPrefix, currentScriptDir, editorUrlPrefix, fileContentsToUrlString, inferFiletype, isBinary, modKeySymbol, require_jsx_runtime, require_react, stringToUint8Array } from "./chunk-GWAOPURX.js"; // node_modules/events/events.js var require_events = __commonJS({ "node_modules/events/events.js"(exports, module) { "use strict"; var R = typeof Reflect === "object" ? Reflect : null; var ReflectApply = R && typeof R.apply === "function" ? R.apply : function ReflectApply2(target, receiver, args) { return Function.prototype.apply.call(target, receiver, args); }; var ReflectOwnKeys; if (R && typeof R.ownKeys === "function") { ReflectOwnKeys = R.ownKeys; } else if (Object.getOwnPropertySymbols) { ReflectOwnKeys = function ReflectOwnKeys2(target) { return Object.getOwnPropertyNames(target).concat(Object.getOwnPropertySymbols(target)); }; } else { ReflectOwnKeys = function ReflectOwnKeys2(target) { return Object.getOwnPropertyNames(target); }; } function ProcessEmitWarning(warning) { if (console && console.warn) console.warn(warning); } var NumberIsNaN = Number.isNaN || function NumberIsNaN2(value) { return value !== value; }; function EventEmitter2() { EventEmitter2.init.call(this); } module.exports = EventEmitter2; module.exports.once = once; EventEmitter2.EventEmitter = EventEmitter2; EventEmitter2.prototype._events = void 0; EventEmitter2.prototype._eventsCount = 0; EventEmitter2.prototype._maxListeners = void 0; var defaultMaxListeners = 10; function checkListener(listener) { if (typeof listener !== "function") { throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener); } } Object.defineProperty(EventEmitter2, "defaultMaxListeners", { enumerable: true, get: function() { return defaultMaxListeners; }, set: function(arg) { if (typeof arg !== "number" || arg < 0 || NumberIsNaN(arg)) { throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + arg + "."); } defaultMaxListeners = arg; } }); EventEmitter2.init = function() { if (this._events === void 0 || this._events === Object.getPrototypeOf(this)._events) { this._events = /* @__PURE__ */ Object.create(null); this._eventsCount = 0; } this._maxListeners = this._maxListeners || void 0; }; EventEmitter2.prototype.setMaxListeners = function setMaxListeners(n) { if (typeof n !== "number" || n < 0 || NumberIsNaN(n)) { throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + n + "."); } this._maxListeners = n; return this; }; function _getMaxListeners(that) { if (that._maxListeners === void 0) return EventEmitter2.defaultMaxListeners; return that._maxListeners; } EventEmitter2.prototype.getMaxListeners = function getMaxListeners() { return _getMaxListeners(this); }; EventEmitter2.prototype.emit = function emit(type) { var args = []; for (var i = 1; i < arguments.length; i++) args.push(arguments[i]); var doError = type === "error"; var events = this._events; if (events !== void 0) doError = doError && events.error === void 0; else if (!doError) return false; if (doError) { var er; if (args.length > 0) er = args[0]; if (er instanceof Error) { throw er; } var err2 = new Error("Unhandled error." + (er ? " (" + er.message + ")" : "")); err2.context = er; throw err2; } var handler = events[type]; if (handler === void 0) return false; if (typeof handler === "function") { ReflectApply(handler, this, args); } else { var len = handler.length; var listeners = arrayClone(handler, len); for (var i = 0; i < len; ++i) ReflectApply(listeners[i], this, args); } return true; }; function _addListener(target, type, listener, prepend) { var m; var events; var existing; checkListener(listener); events = target._events; if (events === void 0) { events = target._events = /* @__PURE__ */ Object.create(null); target._eventsCount = 0; } else { if (events.newListener !== void 0) { target.emit( "newListener", type, listener.listener ? listener.listener : listener ); events = target._events; } existing = events[type]; } if (existing === void 0) { existing = events[type] = listener; ++target._eventsCount; } else { if (typeof existing === "function") { existing = events[type] = prepend ? [listener, existing] : [existing, listener]; } else if (prepend) { existing.unshift(listener); } else { existing.push(listener); } m = _getMaxListeners(target); if (m > 0 && existing.length > m && !existing.warned) { existing.warned = true; var w = new Error("Possible EventEmitter memory leak detected. " + existing.length + " " + String(type) + " listeners added. Use emitter.setMaxListeners() to increase limit"); w.name = "MaxListenersExceededWarning"; w.emitter = target; w.type = type; w.count = existing.length; ProcessEmitWarning(w); } } return target; } EventEmitter2.prototype.addListener = function addListener(type, listener) { return _addListener(this, type, listener, false); }; EventEmitter2.prototype.on = EventEmitter2.prototype.addListener; EventEmitter2.prototype.prependListener = function prependListener(type, listener) { return _addListener(this, type, listener, true); }; function onceWrapper() { if (!this.fired) { this.target.removeListener(this.type, this.wrapFn); this.fired = true; if (arguments.length === 0) return this.listener.call(this.target); return this.listener.apply(this.target, arguments); } } function _onceWrap(target, type, listener) { var state = { fired: false, wrapFn: void 0, target, type, listener }; var wrapped = onceWrapper.bind(state); wrapped.listener = listener; state.wrapFn = wrapped; return wrapped; } EventEmitter2.prototype.once = function once2(type, listener) { checkListener(listener); this.on(type, _onceWrap(this, type, listener)); return this; }; EventEmitter2.prototype.prependOnceListener = function prependOnceListener(type, listener) { checkListener(listener); this.prependListener(type, _onceWrap(this, type, listener)); return this; }; EventEmitter2.prototype.removeListener = function removeListener(type, listener) { var list, events, position, i, originalListener; checkListener(listener); events = this._events; if (events === void 0) return this; list = events[type]; if (list === void 0) return this; if (list === listener || list.listener === listener) { if (--this._eventsCount === 0) this._events = /* @__PURE__ */ Object.create(null); else { delete events[type]; if (events.removeListener) this.emit("removeListener", type, list.listener || listener); } } else if (typeof list !== "function") { position = -1; for (i = list.length - 1; i >= 0; i--) { if (list[i] === listener || list[i].listener === listener) { originalListener = list[i].listener; position = i; break; } } if (position < 0) return this; if (position === 0) list.shift(); else { spliceOne(list, position); } if (list.length === 1) events[type] = list[0]; if (events.removeListener !== void 0) this.emit("removeListener", type, originalListener || listener); } return this; }; EventEmitter2.prototype.off = EventEmitter2.prototype.removeListener; EventEmitter2.prototype.removeAllListeners = function removeAllListeners(type) { var listeners, events, i; events = this._events; if (events === void 0) return this; if (events.removeListener === void 0) { if (arguments.length === 0) { this._events = /* @__PURE__ */ Object.create(null); this._eventsCount = 0; } else if (events[type] !== void 0) { if (--this._eventsCount === 0) this._events = /* @__PURE__ */ Object.create(null); else delete events[type]; } return this; } if (arguments.length === 0) { var keys = Object.keys(events); var key; for (i = 0; i < keys.length; ++i) { key = keys[i]; if (key === "removeListener") continue; this.removeAllListeners(key); } this.removeAllListeners("removeListener"); this._events = /* @__PURE__ */ Object.create(null); this._eventsCount = 0; return this; } listeners = events[type]; if (typeof listeners === "function") { this.removeListener(type, listeners); } else if (listeners !== void 0) { for (i = listeners.length - 1; i >= 0; i--) { this.removeListener(type, listeners[i]); } } return this; }; function _listeners(target, type, unwrap) { var events = target._events; if (events === void 0) return []; var evlistener = events[type]; if (evlistener === void 0) return []; if (typeof evlistener === "function") return unwrap ? [evlistener.listener || evlistener] : [evlistener]; return unwrap ? unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length); } EventEmitter2.prototype.listeners = function listeners(type) { return _listeners(this, type, true); }; EventEmitter2.prototype.rawListeners = function rawListeners(type) { return _listeners(this, type, false); }; EventEmitter2.listenerCount = function(emitter, type) { if (typeof emitter.listenerCount === "function") { return emitter.listenerCount(type); } else { return listenerCount.call(emitter, type); } }; EventEmitter2.prototype.listenerCount = listenerCount; function listenerCount(type) { var events = this._events; if (events !== void 0) { var evlistener = events[type]; if (typeof evlistener === "function") { return 1; } else if (evlistener !== void 0) { return evlistener.length; } } return 0; } EventEmitter2.prototype.eventNames = function eventNames() { return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : []; }; function arrayClone(arr, n) { var copy = new Array(n); for (var i = 0; i < n; ++i) copy[i] = arr[i]; return copy; } function spliceOne(list, index) { for (; index + 1 < list.length; index++) list[index] = list[index + 1]; list.pop(); } function unwrapListeners(arr) { var ret = new Array(arr.length); for (var i = 0; i < ret.length; ++i) { ret[i] = arr[i].listener || arr[i]; } return ret; } function once(emitter, name2) { return new Promise(function(resolve, reject) { function errorListener(err2) { emitter.removeListener(name2, resolver); reject(err2); } function resolver() { if (typeof emitter.removeListener === "function") { emitter.removeListener("error", errorListener); } resolve([].slice.call(arguments)); } ; eventTargetAgnosticAddListener(emitter, name2, resolver, { once: true }); if (name2 !== "error") { addErrorHandlerIfEventEmitter(emitter, errorListener, { once: true }); } }); } function addErrorHandlerIfEventEmitter(emitter, handler, flags) { if (typeof emitter.on === "function") { eventTargetAgnosticAddListener(emitter, "error", handler, flags); } } function eventTargetAgnosticAddListener(emitter, name2, listener, flags) { if (typeof emitter.on === "function") { if (flags.once) { emitter.once(name2, listener); } else { emitter.on(name2, listener); } } else if (typeof emitter.addEventListener === "function") { emitter.addEventListener(name2, function wrapListener(arg) { if (flags.once) { emitter.removeEventListener(name2, wrapListener); } listener(arg); }); } else { throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof emitter); } } } }); // node_modules/vscode-jsonrpc/lib/common/is.js var require_is = __commonJS({ "node_modules/vscode-jsonrpc/lib/common/is.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.stringArray = exports.array = exports.func = exports.error = exports.number = exports.string = exports.boolean = void 0; function boolean(value) { return value === true || value === false; } exports.boolean = boolean; function string2(value) { return typeof value === "string" || value instanceof String; } exports.string = string2; function number2(value) { return typeof value === "number" || value instanceof Number; } exports.number = number2; function error(value) { return value instanceof Error; } exports.error = error; function func(value) { return typeof value === "function"; } exports.func = func; function array(value) { return Array.isArray(value); } exports.array = array; function stringArray(value) { return array(value) && value.every((elem) => string2(elem)); } exports.stringArray = stringArray; } }); // node_modules/vscode-jsonrpc/lib/common/messages.js var require_messages = __commonJS({ "node_modules/vscode-jsonrpc/lib/common/messages.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Message = exports.NotificationType9 = exports.NotificationType8 = exports.NotificationType7 = exports.NotificationType6 = exports.NotificationType5 = exports.NotificationType4 = exports.NotificationType3 = exports.NotificationType2 = exports.NotificationType1 = exports.NotificationType0 = exports.NotificationType = exports.RequestType9 = exports.RequestType8 = exports.RequestType7 = exports.RequestType6 = exports.RequestType5 = exports.RequestType4 = exports.RequestType3 = exports.RequestType2 = exports.RequestType1 = exports.RequestType = exports.RequestType0 = exports.AbstractMessageSignature = exports.ParameterStructures = exports.ResponseError = exports.ErrorCodes = void 0; var is = require_is(); var ErrorCodes; (function(ErrorCodes2) { ErrorCodes2.ParseError = -32700; ErrorCodes2.InvalidRequest = -32600; ErrorCodes2.MethodNotFound = -32601; ErrorCodes2.InvalidParams = -32602; ErrorCodes2.InternalError = -32603; ErrorCodes2.jsonrpcReservedErrorRangeStart = -32099; ErrorCodes2.serverErrorStart = -32099; ErrorCodes2.MessageWriteError = -32099; ErrorCodes2.MessageReadError = -32098; ErrorCodes2.PendingResponseRejected = -32097; ErrorCodes2.ConnectionInactive = -32096; ErrorCodes2.ServerNotInitialized = -32002; ErrorCodes2.UnknownErrorCode = -32001; ErrorCodes2.jsonrpcReservedErrorRangeEnd = -32e3; ErrorCodes2.serverErrorEnd = -32e3; })(ErrorCodes || (exports.ErrorCodes = ErrorCodes = {})); var ResponseError = class _ResponseError extends Error { constructor(code, message, data) { super(message); this.code = is.number(code) ? code : ErrorCodes.UnknownErrorCode; this.data = data; Object.setPrototypeOf(this, _ResponseError.prototype); } toJson() { const result = { code: this.code, message: this.message }; if (this.data !== void 0) { result.data = this.data; } return result; } }; exports.ResponseError = ResponseError; var ParameterStructures = class _ParameterStructures { constructor(kind) { this.kind = kind; } static is(value) { return value === _ParameterStructures.auto || value === _ParameterStructures.byName || value === _ParameterStructures.byPosition; } toString() { return this.kind; } }; exports.ParameterStructures = ParameterStructures; ParameterStructures.auto = new ParameterStructures("auto"); ParameterStructures.byPosition = new ParameterStructures("byPosition"); ParameterStructures.byName = new ParameterStructures("byName"); var AbstractMessageSignature = class { constructor(method, numberOfParams) { this.method = method; this.numberOfParams = numberOfParams; } get parameterStructures() { return ParameterStructures.auto; } }; exports.AbstractMessageSignature = AbstractMessageSignature; var RequestType0 = class extends AbstractMessageSignature { constructor(method) { super(method, 0); } }; exports.RequestType0 = RequestType0; var RequestType = class extends AbstractMessageSignature { constructor(method, _parameterStructures = ParameterStructures.auto) { super(method, 1); this._parameterStructures = _parameterStructures; } get parameterStructures() { return this._parameterStructures; } }; exports.RequestType = RequestType; var RequestType1 = class extends AbstractMessageSignature { constructor(method, _parameterStructures = ParameterStructures.auto) { super(method, 1); this._parameterStructures = _parameterStructures; } get parameterStructures() { return this._parameterStructures; } }; exports.RequestType1 = RequestType1; var RequestType2 = class extends AbstractMessageSignature { constructor(method) { super(method, 2); } }; exports.RequestType2 = RequestType2; var RequestType3 = class extends AbstractMessageSignature { constructor(method) { super(method, 3); } }; exports.RequestType3 = RequestType3; var RequestType4 = class extends AbstractMessageSignature { constructor(method) { super(method, 4); } }; exports.RequestType4 = RequestType4; var RequestType5 = class extends AbstractMessageSignature { constructor(method) { super(method, 5); } }; exports.RequestType5 = RequestType5; var RequestType6 = class extends AbstractMessageSignature { constructor(method) { super(method, 6); } }; exports.RequestType6 = RequestType6; var RequestType7 = class extends AbstractMessageSignature { constructor(method) { super(method, 7); } }; exports.RequestType7 = RequestType7; var RequestType8 = class extends AbstractMessageSignature { constructor(method) { super(method, 8); } }; exports.RequestType8 = RequestType8; var RequestType9 = class extends AbstractMessageSignature { constructor(method) { super(method, 9); } }; exports.RequestType9 = RequestType9; var NotificationType = class extends AbstractMessageSignature { constructor(method, _parameterStructures = ParameterStructures.auto) { super(method, 1); this._parameterStructures = _parameterStructures; } get parameterStructures() { return this._parameterStructures; } }; exports.NotificationType = NotificationType; var NotificationType0 = class extends AbstractMessageSignature { constructor(method) { super(method, 0); } }; exports.NotificationType0 = NotificationType0; var NotificationType1 = class extends AbstractMessageSignature { constructor(method, _parameterStructures = ParameterStructures.auto) { super(method, 1); this._parameterStructures = _parameterStructures; } get parameterStructures() { return this._parameterStructures; } }; exports.NotificationType1 = NotificationType1; var NotificationType2 = class extends AbstractMessageSignature { constructor(method) { super(method, 2); } }; exports.NotificationType2 = NotificationType2; var NotificationType3 = class extends AbstractMessageSignature { constructor(method) { super(method, 3); } }; exports.NotificationType3 = NotificationType3; var NotificationType4 = class extends AbstractMessageSignature { constructor(method) { super(method, 4); } }; exports.NotificationType4 = NotificationType4; var NotificationType5 = class extends AbstractMessageSignature { constructor(method) { super(method, 5); } }; exports.NotificationType5 = NotificationType5; var NotificationType6 = class extends AbstractMessageSignature { constructor(method) { super(method, 6); } }; exports.NotificationType6 = NotificationType6; var NotificationType7 = class extends AbstractMessageSignature { constructor(method) { super(method, 7); } }; exports.NotificationType7 = NotificationType7; var NotificationType8 = class extends AbstractMessageSignature { constructor(method) { super(method, 8); } }; exports.NotificationType8 = NotificationType8; var NotificationType9 = class extends AbstractMessageSignature { constructor(method) { super(method, 9); } }; exports.NotificationType9 = NotificationType9; var Message; (function(Message2) { function isRequest(message) { const candidate = message; return candidate && is.string(candidate.method) && (is.string(candidate.id) || is.number(candidate.id)); } Message2.isRequest = isRequest; function isNotification(message) { const candidate = message; return candidate && is.string(candidate.method) && message.id === void 0; } Message2.isNotification = isNotification; function isResponse(message) { const candidate = message; return candidate && (candidate.result !== void 0 || !!candidate.error) && (is.string(candidate.id) || is.number(candidate.id) || candidate.id === null); } Message2.isResponse = isResponse; })(Message || (exports.Message = Message = {})); } }); // node_modules/vscode-jsonrpc/lib/common/linkedMap.js var require_linkedMap = __commonJS({ "node_modules/vscode-jsonrpc/lib/common/linkedMap.js"(exports) { "use strict"; var _a3; Object.defineProperty(exports, "__esModule", { value: true }); exports.LRUCache = exports.LinkedMap = exports.Touch = void 0; var Touch; (function(Touch2) { Touch2.None = 0; Touch2.First = 1; Touch2.AsOld = Touch2.First; Touch2.Last = 2; Touch2.AsNew = Touch2.Last; })(Touch || (exports.Touch = Touch = {})); var LinkedMap = class { constructor() { this[_a3] = "LinkedMap"; this._map = /* @__PURE__ */ 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() { return this._head?.value; } get last() { return this._tail?.value; } has(key) { return this._map.has(key); } get(key, touch = Touch.None) { const item = this._map.get(key); if (!item) { return void 0; } if (touch !== Touch.None) { this.touch(item, touch); } return item.value; } set(key, value, touch = Touch.None) { let item = this._map.get(key); if (item) { item.value = value; if (touch !== Touch.None) { this.touch(item, touch); } } else { item = { key, value, next: void 0, previous: void 0 }; switch (touch) { case Touch.None: this.addItemLast(item); break; case Touch.First: this.addItemFirst(item); break; case Touch.Last: this.addItemLast(item); break; default: this.addItemLast(item); break; } this._map.set(key, item); this._size++; } return this; } delete(key) { return !!this.remove(key); } remove(key) { const item = this._map.get(key); if (!item) { return void 0; } this._map.delete(key); this.removeItem(item); this._size--; return item.value; } shift() { if (!this._head && !this._tail) { return void 0; } if (!this._head || !this._tail) { throw new Error("Invalid list"); } const item = this._head; this._map.delete(item.key); this.removeItem(item); this._size--; return item.value; } forEach(callbackfn, thisArg) { const state = this._state; let current = this._head; while (current) { if (thisArg) { callbackfn.bind(thisArg)(current.value, current.key, this); } else { callbackfn(current.value, current.key, this); } if (this._state !== state) { throw new Error(`LinkedMap got modified during iteration.`); } current = current.next; } } keys() { const state = this._state; let current = this._head; const iterator = { [Symbol.iterator]: () => { return iterator; }, next: () => { if (this._state !== state) { throw new Error(`LinkedMap got modified during iteration.`); } if (current) { const result = { value: current.key, done: false }; current = current.next; return result; } else { return { value: void 0, done: true }; } } }; return iterator; } values() { const state = this._state; let current = this._head; const iterator = { [Symbol.iterator]: () => { return iterator; }, next: () => { if (this._state !== state) { throw new Error(`LinkedMap got modified during iteration.`); } if (current) { const result = { value: current.value, done: false }; current = current.next; return result; } else { return { value: void 0, done: true }; } } }; return iterator; } entries() { const state = this._state; let current = this._head; const iterator = { [Symbol.iterator]: () => { return iterator; }, next: () => { if (this._state !== state) { throw new Error(`LinkedMap got modified during iteration.`); } if (current) { const result = { value: [current.key, current.value], done: false }; current = current.next; return result; } else { return { value: void 0, done: true }; } } }; return iterator; } [(_a3 = Symbol.toStringTag, Symbol.iterator)]() { return this.entries(); } trimOld(newSize) { if (newSize >= this.size) { return; } if (newSize === 0) { this.clear(); return; } let current = this._head; let currentSize = this.size; while (current && currentSize > newSize) { this._map.delete(current.key); current = current.next; currentSize--; } this._head = current; this._size = currentSize; if (current) { current.previous = void 0; } this._state++; } addItemFirst(item) { if (!this._head && !this._tail) { this._tail = item; } else if (!this._head) { throw new Error("Invalid list"); } else { item.next = this._head; this._head.previous = item; } this._head = item; this._state++; } addItemLast(item) { if (!this._head && !this._tail) { this._head = item; } else if (!this._tail) { throw new Error("Invalid list"); } else { item.previous = this._tail; this._tail.next = item; } this._tail = item; this._state++; } removeItem(item) { if (item === this._head && item === this._tail) { this._head = void 0; this._tail = void 0; } else if (item === this._head) { if (!item.next) { throw new Error("Invalid list"); } item.next.previous = void 0; this._head = item.next; } else if (item === this._tail) { if (!item.previous) { throw new Error("Invalid list"); } item.previous.next = void 0; this._tail = item.previous; } else { const next = item.next; const previous = item.previous; if (!next || !previous) { throw new Error("Invalid list"); } next.previous = previous; previous.next = next; } item.next = void 0; item.previous = void 0; this._state++; } touch(item, touch) { if (!this._head || !this._tail) { throw new Error("Invalid list"); } if (touch !== Touch.First && touch !== Touch.Last) { return; } if (touch === Touch.First) { if (item === this._head) { return; } const next = item.next; const previous = item.previous; if (item === this._tail) { previous.next = void 0; this._tail = previous; } else { next.previous = previous; previous.next = next; } item.previous = void 0; item.next = this._head; this._head.previous = item; this._head = item; this._state++; } else if (touch === Touch.Last) { if (item === this._tail) { return; } const next = item.next; const previous = item.previous; if (item === this._head) { next.previous = void 0; this._head = next; } else { next.previous = previous; previous.next = next; } item.next = void 0; item.previous = this._tail; this._tail.next = item; this._tail = item; this._state++; } } toJSON() { const data = []; this.forEach((value, key) => { data.push([key, value]); }); return data; } fromJSON(data) { this.clear(); for (const [key, value] of data) { this.set(key, value); } } }; exports.LinkedMap = LinkedMap; var LRUCache = class extends LinkedMap { constructor(limit, ratio = 1) { super(); this._limit = limit; this._ratio = Math.min(Math.max(0, ratio), 1); } get limit() { return this._limit; } set limit(limit) { this._limit = limit; this.checkTrim(); } get ratio() { return this._ratio; } set ratio(ratio) { this._ratio = Math.min(Math.max(0, ratio), 1); this.checkTrim(); } get(key, touch = Touch.AsNew) { return super.get(key, touch); } peek(key) { return super.get(key, Touch.None); } set(key, value) { super.set(key, value, Touch.Last); this.checkTrim(); return this; } checkTrim() { if (this.size > this._limit) { this.trimOld(Math.round(this._limit * this._ratio)); } } }; exports.LRUCache = LRUCache; } }); // node_modules/vscode-jsonrpc/lib/common/disposable.js var require_disposable = __commonJS({ "node_modules/vscode-jsonrpc/lib/common/disposable.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Disposable = void 0; var Disposable; (function(Disposable2) { function create(func) { return { dispose: func }; } Disposable2.create = create; })(Disposable || (exports.Disposable = Disposable = {})); } }); // node_modules/vscode-jsonrpc/lib/common/ral.js var require_ral = __commonJS({ "node_modules/vscode-jsonrpc/lib/common/ral.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _ral; function RAL() { if (_ral === void 0) { throw new Error(`No runtime abstraction layer installed`); } return _ral; } (function(RAL2) { function install(ral) { if (ral === void 0) { throw new Error(`No runtime abstraction layer provided`); } _ral = ral; } RAL2.install = install; })(RAL || (RAL = {})); exports.default = RAL; } }); // node_modules/vscode-jsonrpc/lib/common/events.js var require_events2 = __commonJS({ "node_modules/vscode-jsonrpc/lib/common/events.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Emitter = exports.Event = void 0; var ral_1 = require_ral(); var Event; (function(Event2) { const _disposable = { dispose() { } }; Event2.None = function() { return _disposable; }; })(Event || (exports.Event = Event = {})); var CallbackList = class { add(callback, context = null, bucket) { if (!this._callbacks) { this._callbacks = []; this._contexts = []; } this._callbacks.push(callback); this._contexts.push(context); if (Array.isArray(bucket)) { bucket.push({ dispose: () => this.remove(callback, context) }); } } remove(callback, context = null) { if (!this._callbacks) { return; } let foundCallbackWithDifferentContext = false; for (let i = 0, len = this._callbacks.length; i < len; i++) { if (this._callbacks[i] === callback) { if (this._contexts[i] === context) { this._callbacks.splice(i, 1); this._contexts.splice(i, 1); return; } else { foundCallbackWithDifferentContext = true; } } } if (foundCallbackWithDifferentContext) { throw new Error("When adding a listener with a context, you should remove it with the same context"); } } invoke(...args) { if (!this._callbacks) { return []; } const ret = [], callbacks = this._callbacks.slice(0), contexts = this._contexts.slice(0); for (let i = 0, len = callbacks.length; i < len; i++) { try { ret.push(callbacks[i].apply(contexts[i], args)); } catch (e) { (0, ral_1.default)().console.error(e); } } return ret; } isEmpty() { return !this._callbacks || this._callbacks.length === 0; } dispose() { this._callbacks = void 0; this._contexts = void 0; } }; var Emitter = class _Emitter { constructor(_options) { this._options = _options; } /** * For the public to allow to subscribe * to events from this Emitter */ get event() { if (!this._event) { this._event = (listener, thisArgs, disposables) => { if (!this._callbacks) { this._callbacks = new CallbackList(); } if (this._options && this._options.onFirstListenerAdd && this._callbacks.isEmpty()) { this._options.onFirstListenerAdd(this); } this._callbacks.add(listener, thisArgs); const result = { dispose: () => { if (!this._callbacks) { return; } this._callbacks.remove(listener, thisArgs); result.dispose = _Emitter._noop; if (this._options && this._options.onLastListenerRemove && this._callbacks.isEmpty()) { this._options.onLastListenerRemove(this); } } }; if (Array.isArray(disposables)) { disposables.push(result); } return result; }; } return this._event; } /** * To be kept private to fire an event to * subscribers */ fire(event) { if (this._callbacks) { this._callbacks.invoke.call(this._callbacks, event); } } dispose() { if (this._callbacks) { this._callbacks.dispose(); this._callbacks = void 0; } } }; exports.Emitter = Emitter; Emitter._noop = function() { }; } }); // node_modules/vscode-jsonrpc/lib/common/cancellation.js var require_cancellation = __commonJS({ "node_modules/vscode-jsonrpc/lib/common/cancellation.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CancellationTokenSource = exports.CancellationToken = void 0; var ral_1 = require_ral(); var Is2 = require_is(); var events_1 = require_events2(); var CancellationToken; (function(CancellationToken2) { CancellationToken2.None = Object.freeze({ isCancellationRequested: false, onCancellationRequested: events_1.Event.None }); CancellationToken2.Cancelled = Object.freeze({ isCancellationRequested: true, onCancellationRequested: events_1.Event.None }); function is(value) { const candidate = value; return candidate && (candidate === CancellationToken2.None || candidate === CancellationToken2.Cancelled || Is2.boolean(candidate.isCancellationRequested) && !!candidate.onCancellationRequested); } CancellationToken2.is = is; })(CancellationToken || (exports.CancellationToken = CancellationToken = {})); var shortcutEvent = Object.freeze(function(callback, context) { const handle = (0, ral_1.default)().timer.setTimeout(callback.bind(context), 0); return { dispose() { handle.dispose(); } }; }); var MutableToken = class { constructor() { this._isCancelled = false; } cancel() { if (!this._isCancelled) { this._isCancelled = true; if (this._emitter) { this._emitter.fire(void 0); this.dispose(); } } } get isCancellationRequested() { return this._isCancelled; } get onCancellationRequested() { if (this._isCancelled) { return shortcutEvent; } if (!this._emitter) { this._emitter = new events_1.Emitter(); } return this._emitter.event; } dispose() { if (this._emitter) { this._emitter.dispose(); this._emitter = void 0; } } }; var CancellationTokenSource = class { get token() { if (!this._token) { this._token = new MutableToken(); } return this._token; } cancel() { if (!this._token) { this._token = CancellationToken.Cancelled; } else { this._token.cancel(); } } dispose() { if (!this._token) { this._token = CancellationToken.None; } else if (this._token instanceof MutableToken) { this._token.dispose(); } } }; exports.CancellationTokenSource = CancellationTokenSource; } }); // node_modules/vscode-jsonrpc/lib/common/sharedArrayCancellation.js var require_sharedArrayCancellation = __commonJS({ "node_modules/vscode-jsonrpc/lib/common/sharedArrayCancellation.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SharedArrayReceiverStrategy = exports.SharedArraySenderStrategy = void 0; var cancellation_1 = require_cancellation(); var CancellationState; (function(CancellationState2) { CancellationState2.Continue = 0; CancellationState2.Cancelled = 1; })(CancellationState || (CancellationState = {})); var SharedArraySenderStrategy = class { constructor() { this.buffers = /* @__PURE__ */ new Map(); } enableCancellation(request) { if (request.id === null) { return; } const buffer = new SharedArrayBuffer(4); const data = new Int32Array(buffer, 0, 1); data[0] = CancellationState.Continue; this.buffers.set(request.id, buffer); request.$cancellationData = buffer; } async sendCancellation(_conn, id2) { const buffer = this.buffers.get(id2); if (buffer === void 0) { return; } const data = new Int32Array(buffer, 0, 1); Atomics.store(data, 0, CancellationState.Cancelled); } cleanup(id2) { this.buffers.delete(id2); } dispose() { this.buffers.clear(); } }; exports.SharedArraySenderStrategy = SharedArraySenderStrategy; var SharedArrayBufferCancellationToken = class { constructor(buffer) { this.data = new Int32Array(buffer, 0, 1); } get isCancellationRequested() { return Atomics.load(this.data, 0) === CancellationState.Cancelled; } get onCancellationRequested() { throw new Error(`Cancellation over SharedArrayBuffer doesn't support cancellation events`); } }; var SharedArrayBufferCancellationTokenSource = class { constructor(buffer) { this.token = new SharedArrayBufferCancellationToken(buffer); } cancel() { } dispose() { } }; var SharedArrayReceiverStrategy = class { constructor() { this.kind = "request"; } createCancellationTokenSource(request) { const buffer = request.$cancellationData; if (buffer === void 0) { return new cancellation_1.CancellationTokenSource(); } return new SharedArrayBufferCancellationTokenSource(buffer); } }; exports.SharedArrayReceiverStrategy = SharedArrayReceiverStrategy; } }); // node_modules/vscode-jsonrpc/lib/common/semaphore.js var require_semaphore = __commonJS({ "node_modules/vscode-jsonrpc/lib/common/semaphore.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Semaphore = void 0; var ral_1 = require_ral(); var Semaphore = class { constructor(capacity = 1) { if (capacity <= 0) { throw new Error("Capacity must be greater than 0"); } this._capacity = capacity; this._active = 0; this._waiting = []; } lock(thunk) { return new Promise((resolve, reject) => { this._waiting.push({ thunk, resolve, reject }); this.runNext(); }); } get active() { return this._active; } runNext() { if (this._waiting.length === 0 || this._active === this._capacity) { return; } (0, ral_1.default)().timer.setImmediate(() => this.doRunNext()); } doRunNext() { if (this._waiting.length === 0 || this._active === this._capacity) { return; } const next = this._waiting.shift(); this._active++; if (this._active > this._capacity) { throw new Error(`To many thunks active`); } try { const result = next.thunk(); if (result instanceof Promise) { result.then((value) => { this._active--; next.resolve(value); this.runNext(); }, (err2) => { this._active--; next.reject(err2); this.runNext(); }); } else { this._active--; next.resolve(result); this.runNext(); } } catch (err2) { this._active--; next.reject(err2); this.runNext(); } } }; exports.Semaphore = Semaphore; } }); // node_modules/vscode-jsonrpc/lib/common/messageReader.js var require_messageReader = __commonJS({ "node_modules/vscode-jsonrpc/lib/common/messageReader.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ReadableStreamMessageReader = exports.AbstractMessageReader = exports.MessageReader = void 0; var ral_1 = require_ral(); var Is2 = require_is(); var events_1 = require_events2(); var semaphore_1 = require_semaphore(); var MessageReader; (function(MessageReader2) { function is(value) { let candidate = value; return candidate && Is2.func(candidate.listen) && Is2.func(candidate.dispose) && Is2.func(candidate.onError) && Is2.func(candidate.onClose) && Is2.func(candidate.onPartialMessage); } MessageReader2.is = is; })(MessageReader || (exports.MessageReader = MessageReader = {})); var AbstractMessageReader2 = class { constructor() { this.errorEmitter = new events_1.Emitter(); this.closeEmitter = new events_1.Emitter(); this.partialMessageEmitter = new events_1.Emitter(); } dispose() { this.errorEmitter.dispose(); this.closeEmitter.dispose(); } get onError() { return this.errorEmitter.event; } fireError(error) { this.errorEmitter.fire(this.asError(error)); } get onClose() { return this.closeEmitter.event; } fireClose() { this.closeEmitter.fire(void 0); } get onPartialMessage() { return this.partialMessageEmitter.event; } firePartialMessage(info) { this.partialMessageEmitter.fire(info); } asError(error) { if (error instanceof Error) { return error; } else { return new Error(`Reader received error. Reason: ${Is2.string(error.message) ? error.message : "unknown"}`); } } }; exports.AbstractMessageReader = AbstractMessageReader2; var ResolvedMessageReaderOptions; (function(ResolvedMessageReaderOptions2) { function fromOptions(options2) { let charset; let result; let contentDecoder; const contentDecoders = /* @__PURE__ */ new Map(); let contentTypeDecoder; const contentTypeDecoders = /* @__PURE__ */ new Map(); if (options2 === void 0 || typeof options2 === "string") { charset = options2 ?? "utf-8"; } else { charset = options2.charset ?? "utf-8"; if (options2.contentDecoder !== void 0) { contentDecoder = options2.contentDecoder; contentDecoders.set(contentDecoder.name, contentDecoder); } if (options2.contentDecoders !== void 0) { for (const decoder of options2.contentDecoders) { contentDecoders.set(decoder.name, decoder); } } if (options2.contentTypeDecoder !== void 0) { contentTypeDecoder = options2.contentTypeDecoder; contentTypeDecoders.set(contentTypeDecoder.name, contentTypeDecoder); } if (options2.contentTypeDecoders !== void 0) { for (const decoder of options2.contentTypeDecoders) { contentTypeDecoders.set(decoder.name, decoder); } } } if (contentTypeDecoder === void 0) { contentTypeDecoder = (0, ral_1.default)().applicationJson.decoder; contentTypeDecoders.set(contentTypeDecoder.name, contentTypeDecoder); } return { charset, contentDecoder, contentDecoders, contentTypeDecoder, contentTypeDecoders }; } ResolvedMessageReaderOptions2.fromOptions = fromOptions; })(ResolvedMessageReaderOptions || (ResolvedMessageReaderOptions = {})); var ReadableStreamMessageReader = class extends AbstractMessageReader2 { constructor(readable, options2) { super(); this.readable = readable; this.options = ResolvedMessageReaderOptions.fromOptions(options2); this.buffer = (0, ral_1.default)().messageBuffer.create(this.options.charset); this._partialMessageTimeout = 1e4; this.nextMessageLength = -1; this.messageToken = 0; this.readSemaphore = new semaphore_1.Semaphore(1); } set partialMessageTimeout(timeout) { this._partialMessageTimeout = timeout; } get partialMessageTimeout() { return this._partialMessageTimeout; } listen(callback) { this.nextMessageLength = -1; this.messageToken = 0; this.partialMessageTimer = void 0; this.callback = callback; const result = this.readable.onData((data) => { this.onData(data); }); this.readable.onError((error) => this.fireError(error)); this.readable.onClose(() => this.fireClose()); return result; } onData(data) { try { this.buffer.append(data); while (true) { if (this.nextMessageLength === -1) { const headers = this.buffer.tryReadHeaders(true); if (!headers) { return; } const contentLength = headers.get("content-length"); if (!contentLength) { this.fireError(new Error(`Header must provide a Content-Length property. ${JSON.stringify(Object.fromEntries(headers))}`)); return; } const length = parseInt(contentLength); if (isNaN(length)) { this.fireError(new Error(`Content-Length value must be a number. Got ${contentLength}`)); return; } this.nextMessageLength = length; } const body = this.buffer.tryReadBody(this.nextMessageLength); if (body === void 0) { this.setPartialMessageTimer(); return; } this.clearPartialMessageTimer(); this.nextMessageLength = -1; this.readSemaphore.lock(async () => { const bytes = this.options.contentDecoder !== void 0 ? await this.options.contentDecoder.decode(body) : body; const message = await this.options.contentTypeDecoder.decode(bytes, this.options); this.callback(message); }).catch((error) => { this.fireError(error); }); } } catch (error) { this.fireError(error); } } clearPartialMessageTimer() { if (this.partialMessageTimer) { this.partialMessageTimer.dispose(); this.partialMessageTimer = void 0; } } setPartialMessageTimer() { this.clearPartialMessageTimer(); if (this._partialMessageTimeout <= 0) { return; } this.partialMessageTimer = (0, ral_1.default)().timer.setTimeout((token, timeout) => { this.partialMessageTimer = void 0; if (token === this.messageToken) { this.firePartialMessage({ messageToken: token, waitingTime: timeout }); this.setPartialMessageTimer(); } }, this._partialMessageTimeout, this.messageToken, this._partialMessageTimeout); } }; exports.ReadableStreamMessageReader = ReadableStreamMessageReader; } }); // node_modules/vscode-jsonrpc/lib/common/messageWriter.js var require_messageWriter = __commonJS({ "node_modules/vscode-jsonrpc/lib/common/messageWriter.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.WriteableStreamMessageWriter = exports.AbstractMessageWriter = exports.MessageWriter = void 0; var ral_1 = require_ral(); var Is2 = require_is(); var semaphore_1 = require_semaphore(); var events_1 = require_events2(); var ContentLength = "Content-Length: "; var CRLF = "\r\n"; var MessageWriter; (function(MessageWriter2) { function is(value) { let candidate = value; return candidate && Is2.func(candidate.dispose) && Is2.func(candidate.onClose) && Is2.func(candidate.onError) && Is2.func(candidate.write); } MessageWriter2.is = is; })(MessageWriter || (exports.MessageWriter = MessageWriter = {})); var AbstractMessageWriter2 = class { constructor() { this.errorEmitter = new events_1.Emitter(); this.closeEmitter = new events_1.Emitter(); } dispose() { this.errorEmitter.dispose(); this.closeEmitter.dispose(); } get onError() { return this.errorEmitter.event; } fireError(error, message, count) { this.errorEmitter.fire([this.asError(error), message, count]); } get onClose() { return this.closeEmitter.event; } fireClose() { this.closeEmitter.fire(void 0); } asError(error) { if (error instanceof Error) { return error; } else { return new Error(`Writer received error. Reason: ${Is2.string(error.message) ? error.message : "unknown"}`); } } }; exports.AbstractMessageWriter = AbstractMessageWriter2; var ResolvedMessageWriterOptions; (function(ResolvedMessageWriterOptions2) { function fromOptions(options2) { if (options2 === void 0 || typeof options2 === "string") { return { charset: options2 ?? "utf-8", contentTypeEncoder: (0, ral_1.default)().applicationJson.encoder }; } else { return { charset: options2.charset ?? "utf-8", contentEncoder: options2.contentEncoder, contentTypeEncoder: options2.contentTypeEncoder ?? (0, ral_1.default)().applicationJson.encoder }; } } ResolvedMessageWriterOptions2.fromOptions = fromOptions; })(ResolvedMessageWriterOptions || (ResolvedMessageWriterOptions = {})); var WriteableStreamMessageWriter = class extends AbstractMessageWriter2 { constructor(writable, options2) { super(); this.writable = writable; this.options = ResolvedMessageWriterOptions.fromOptions(options2); this.errorCount = 0; this.writeSemaphore = new semaphore_1.Semaphore(1); this.writable.onError((error) => this.fireError(error)); this.writable.onClose(() => this.fireClose()); } async write(msg) { return this.writeSemaphore.lock(async () => { const payload = this.options.contentTypeEncoder.encode(msg, this.options).then((buffer) => { if (this.options.contentEncoder !== void 0) { return this.options.contentEncoder.encode(buffer); } else { return buffer; } }); return payload.then((buffer) => { const headers = []; headers.push(ContentLength, buffer.byteLength.toString(), CRLF); headers.push(CRLF); return this.doWrite(msg, headers, buffer); }, (error) => { this.fireError(error); throw error; }); }); } async doWrite(msg, headers, data) { try { await this.writable.write(headers.join(""), "ascii"); return this.writable.write(data); } catch (error) { this.handleError(error, msg); return Promise.reject(error); } } handleError(error, msg) { this.errorCount++; this.fireError(error, msg, this.errorCount); } end() { this.writable.end(); } }; exports.WriteableStreamMessageWriter = WriteableStreamMessageWriter; } }); // node_modules/vscode-jsonrpc/lib/common/messageBuffer.js var require_messageBuffer = __commonJS({ "node_modules/vscode-jsonrpc/lib/common/messageBuffer.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.AbstractMessageBuffer = void 0; var CR = 13; var LF = 10; var CRLF = "\r\n"; var AbstractMessageBuffer = class { constructor(encoding = "utf-8") { this._encoding = encoding; this._chunks = []; this._totalLength = 0; } get encoding() { return this._encoding; } append(chunk) { const toAppend = typeof chunk === "string" ? this.fromString(chunk, this._encoding) : chunk; this._chunks.push(toAppend); this._totalLength += toAppend.byteLength; } tryReadHeaders(lowerCaseKeys = false) { if (this._chunks.length === 0) { return void 0; } let state = 0; let chunkIndex = 0; let offset = 0; let chunkBytesRead = 0; row: while (chunkIndex < this._chunks.length) { const chunk = this._chunks[chunkIndex]; offset = 0; column: while (offset < chunk.length) { const value = chunk[offset]; switch (value) { case CR: switch (state) { case 0: state = 1; break; case 2: state = 3; break; default: state = 0; } break; case LF: switch (state) { case 1: state = 2; break; case 3: state = 4; offset++; break row; default: state = 0; } break; default: state = 0; } offset++; } chunkBytesRead += chunk.byteLength; chunkIndex++; } if (state !== 4) { return void 0; } const buffer = this._read(chunkBytesRead + offset); const result = /* @__PURE__ */ new Map(); const headers = this.toString(buffer, "ascii").split(CRLF); if (headers.length < 2) { return result; } for (let i = 0; i < headers.length - 2; i++) { const header = headers[i]; const index = header.indexOf(":"); if (index === -1) { throw new Error(`Message header must separate key and value using ':' ${header}`); } const key = header.substr(0, index); const value = header.substr(index + 1).trim(); result.set(lowerCaseKeys ? key.toLowerCase() : key, value); } return result; } tryReadBody(length) { if (this._totalLength < length) { return void 0; } return this._read(length); } get numberOfBytes() { return this._totalLength; } _read(byteCount) { if (byteCount === 0) { return this.emptyBuffer(); } if (byteCount > this._totalLength) { throw new Error(`Cannot read so many bytes!`); } if (this._chunks[0].byteLength === byteCount) { const chunk = this._chunks[0]; this._chunks.shift(); this._totalLength -= byteCount; return this.asNative(chunk); } if (this._chunks[0].byteLength > byteCount) { const chunk = this._chunks[0]; const result2 = this.asNative(chunk, byteCount); this._chunks[0] = chunk.slice(byteCount); this._totalLength -= byteCount; return result2; } const result = this.allocNative(byteCount); let resultOffset = 0; let chunkIndex = 0; while (byteCount > 0) { const chunk = this._chunks[chunkIndex]; if (chunk.byteLength > byteCount) { const chunkPart = chunk.slice(0, byteCount); result.set(chunkPart, resultOffset); resultOffset += byteCount; this._chunks[chunkIndex] = chunk.slice(byteCount); this._totalLength -= byteCount; byteCount -= byteCount; } else { result.set(chunk, resultOffset); resultOffset += chunk.byteLength; this._chunks.shift(); this._totalLength -= chunk.byteLength; byteCount -= chunk.byteLength; } } return result; } }; exports.AbstractMessageBuffer = AbstractMessageBuffer; } }); // node_modules/vscode-jsonrpc/lib/common/connection.js var require_connection = __commonJS({ "node_modules/vscode-jsonrpc/lib/common/connection.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.createMessageConnection = exports.ConnectionOptions = exports.MessageStrategy = exports.CancellationStrategy = exports.CancellationSenderStrategy = exports.CancellationReceiverStrategy = exports.RequestCancellationReceiverStrategy = exports.IdCancellationReceiverStrategy = exports.ConnectionStrategy = exports.ConnectionError = exports.ConnectionErrors = exports.LogTraceNotification = exports.SetTraceNotification = exports.TraceFormat = exports.TraceValues = exports.Trace = exports.NullLogger = exports.ProgressType = exports.ProgressToken = void 0; var ral_1 = require_ral(); var Is2 = require_is(); var messages_1 = require_messages(); var linkedMap_1 = require_linkedMap(); var events_1 = require_events2(); var cancellation_1 = require_cancellation(); var CancelNotification; (function(CancelNotification2) { CancelNotification2.type = new messages_1.NotificationType("$/cancelRequest"); })(CancelNotification || (CancelNotification = {})); var ProgressToken; (function(ProgressToken2) { function is(value) { return typeof value === "string" || typeof value === "number"; } ProgressToken2.is = is; })(ProgressToken || (exports.ProgressToken = ProgressToken = {})); var ProgressNotification; (function(ProgressNotification2) { ProgressNotification2.type = new messages_1.NotificationType("$/progress"); })(ProgressNotification || (ProgressNotification = {})); var ProgressType = class { constructor() { } }; exports.ProgressType = ProgressType; var StarRequestHandler; (function(StarRequestHandler2) { function is(value) { return Is2.func(value); } StarRequestHandler2.is = is; })(StarRequestHandler || (StarRequestHandler = {})); exports.NullLogger = Object.freeze({ error: () => { }, warn: () => { }, info: () => { }, log: () => { } }); var Trace; (function(Trace2) { Trace2[Trace2["Off"] = 0] = "Off"; Trace2[Trace2["Messages"] = 1] = "Messages"; Trace2[Trace2["Compact"] = 2] = "Compact"; Trace2[Trace2["Verbose"] = 3] = "Verbose"; })(Trace || (exports.Trace = Trace = {})); var TraceValues; (function(TraceValues2) { TraceValues2.Off = "off"; TraceValues2.Messages = "messages"; TraceValues2.Compact = "compact"; TraceValues2.Verbose = "verbose"; })(TraceValues || (exports.TraceValues = TraceValues = {})); (function(Trace2) { function fromString(value) { if (!Is2.string(value)) { return Trace2.Off; } value = value.toLowerCase(); switch (value) { case "off": return Trace2.Off; case "messages": return Trace2.Messages; case "compact": return Trace2.Compact; case "verbose": return Trace2.Verbose; default: return Trace2.Off; } } Trace2.fromString = fromString; function toString(value) { switch (value) { case Trace2.Off: return "off"; case Trace2.Messages: return "messages"; case Trace2.Compact: return "compact"; case Trace2.Verbose: return "verbose"; default: return "off"; } } Trace2.toString = toString; })(Trace || (exports.Trace = Trace = {})); var TraceFormat; (function(TraceFormat2) { TraceFormat2["Text"] = "text"; TraceFormat2["JSON"] = "json"; })(TraceFormat || (exports.TraceFormat = TraceFormat = {})); (function(TraceFormat2) { function fromString(value) { if (!Is2.string(value)) { return TraceFormat2.Text; } value = value.toLowerCase(); if (value === "json") { return TraceFormat2.JSON; } else { return TraceFormat2.Text; } } TraceFormat2.fromString = fromString; })(TraceFormat || (exports.TraceFormat = TraceFormat = {})); var SetTraceNotification; (function(SetTraceNotification2) { SetTraceNotification2.type = new messages_1.NotificationType("$/setTrace"); })(SetTraceNotification || (exports.SetTraceNotification = SetTraceNotification = {})); var LogTraceNotification; (function(LogTraceNotification2) { LogTraceNotification2.type = new messages_1.NotificationType("$/logTrace"); })(LogTraceNotification || (exports.LogTraceNotification = LogTraceNotification = {})); var ConnectionErrors; (function(ConnectionErrors2) { ConnectionErrors2[ConnectionErrors2["Closed"] = 1] = "Closed"; ConnectionErrors2[ConnectionErrors2["Disposed"] = 2] = "Disposed"; ConnectionErrors2[ConnectionErrors2["AlreadyListening"] = 3] = "AlreadyListening"; })(ConnectionErrors || (exports.ConnectionErrors = ConnectionErrors = {})); var ConnectionError = class _ConnectionError extends Error { constructor(code, message) { super(message); this.code = code; Object.setPrototypeOf(this, _ConnectionError.prototype); } }; exports.ConnectionError = ConnectionError; var ConnectionStrategy; (function(ConnectionStrategy2) { function is(value) { const candidate = value; return candidate && Is2.func(candidate.cancelUndispatched); } ConnectionStrategy2.is = is; })(ConnectionStrategy || (exports.ConnectionStrategy = ConnectionStrategy = {})); var IdCancellationReceiverStrategy; (function(IdCancellationReceiverStrategy2) { function is(value) { const candidate = value; return candidate && (candidate.kind === void 0 || candidate.kind === "id") && Is2.func(candidate.createCancellationTokenSource) && (candidate.dispose === void 0 || Is2.func(candidate.dispose)); } IdCancellationReceiverStrategy2.is = is; })(IdCancellationReceiverStrategy || (exports.IdCancellationReceiverStrategy = IdCancellationReceiverStrategy = {})); var RequestCancellationReceiverStrategy; (function(RequestCancellationReceiverStrategy2) { function is(value) { const candidate = value; return candidate && candidate.kind === "request" && Is2.func(candidate.createCancellationTokenSource) && (candidate.dispose === void 0 || Is2.func(candidate.dispose)); } RequestCancellationReceiverStrategy2.is = is; })(RequestCancellationReceiverStrategy || (exports.RequestCancellationReceiverStrategy = RequestCancellationReceiverStrategy = {})); var CancellationReceiverStrategy; (function(CancellationReceiverStrategy2) { CancellationReceiverStrategy2.Message = Object.freeze({ createCancellationTokenSource(_) { return new cancellation_1.CancellationTokenSource(); } }); function is(value) { return IdCancellationReceiverStrategy.is(value) || RequestCancellationReceiverStrategy.is(value); } CancellationReceiverStrategy2.is = is; })(CancellationReceiverStrategy || (exports.CancellationReceiverStrategy = CancellationReceiverStrategy = {})); var CancellationSenderStrategy; (function(CancellationSenderStrategy2) { CancellationSenderStrategy2.Message = Object.freeze({ sendCancellation(conn, id2) { return conn.sendNotification(CancelNotification.type, { id: id2 }); }, cleanup(_) { } }); function is(value) { const candidate = value; return candidate && Is2.func(candidate.sendCancellation) && Is2.func(candidate.cleanup); } CancellationSenderStrategy2.is = is; })(CancellationSenderStrategy || (exports.CancellationSenderStrategy = CancellationSenderStrategy = {})); var CancellationStrategy; (function(CancellationStrategy2) { CancellationStrategy2.Message = Object.freeze({ receiver: CancellationReceiverStrategy.Message, sender: CancellationSenderStrategy.Message }); function is(value) { const candidate = value; return candidate && CancellationReceiverStrategy.is(candidate.receiver) && CancellationSenderStrategy.is(candidate.sender); } CancellationStrategy2.is = is; })(CancellationStrategy || (exports.CancellationStrategy = CancellationStrategy = {})); var MessageStrategy; (function(MessageStrategy2) { function is(value) { const candidate = value; return candidate && Is2.func(candidate.handleMessage); } MessageStrategy2.is = is; })(MessageStrategy || (exports.MessageStrategy = MessageStrategy = {})); var ConnectionOptions; (function(ConnectionOptions2) { function is(value) { const candidate = value; return candidate && (CancellationStrategy.is(candidate.cancellationStrategy) || ConnectionStrategy.is(candidate.connectionStrategy) || MessageStrategy.is(candidate.messageStrategy)); } ConnectionOptions2.is = is; })(ConnectionOptions || (exports.ConnectionOptions = ConnectionOptions = {})); var ConnectionState; (function(ConnectionState2) { ConnectionState2[ConnectionState2["New"] = 1] = "New"; ConnectionState2[ConnectionState2["Listening"] = 2] = "Listening"; ConnectionState2[ConnectionState2["Closed"] = 3] = "Closed"; ConnectionState2[ConnectionState2["Disposed"] = 4] = "Disposed"; })(ConnectionState || (ConnectionState = {})); function createMessageConnection3(messageReader, messageWriter, _logger, options2) { const logger = _logger !== void 0 ? _logger : exports.NullLogger; let sequenceNumber = 0; let notificationSequenceNumber = 0; let unknownResponseSequenceNumber = 0; const version = "2.0"; let starRequestHandler = void 0; const requestHandlers = /* @__PURE__ */ new Map(); let starNotificationHandler = void 0; const notificationHandlers = /* @__PURE__ */ new Map(); const progressHandlers = /* @__PURE__ */ new Map(); let timer; let messageQueue = new linkedMap_1.LinkedMap(); let responsePromises = /* @__PURE__ */ new Map(); let knownCanceledRequests = /* @__PURE__ */ new Set(); let requestTokens = /* @__PURE__ */ new Map(); let trace = Trace.Off; let traceFormat = TraceFormat.Text; let tracer; let state = ConnectionState.New; const errorEmitter = new events_1.Emitter(); const closeEmitter = new events_1.Emitter(); const unhandledNotificationEmitter = new events_1.Emitter(); const unhandledProgressEmitter = new events_1.Emitter(); const disposeEmitter = new events_1.Emitter(); const cancellationStrategy = options2 && options2.cancellationStrategy ? options2.cancellationStrategy : CancellationStrategy.Message; function createRequestQueueKey(id2) { if (id2 === null) { throw new Error(`Can't send requests with id null since the response can't be correlated.`); } return "req-" + id2.toString(); } function createResponseQueueKey(id2) { if (id2 === null) { return "res-unknown-" + (++unknownResponseSequenceNumber).toString(); } else { return "res-" + id2.toString(); } } function createNotificationQueueKey() { return "not-" + (++notificationSequenceNumber).toString(); } function addMessageToQueue(queue, message) { if (messages_1.Message.isRequest(message)) { queue.set(createRequestQueueKey(message.id), message); } else if (messages_1.Message.isResponse(message)) { queue.set(createResponseQueueKey(message.id), message); } else { queue.set(createNotificationQueueKey(), message); } } function cancelUndispatched(_message) { return void 0; } function isListening() { return state === ConnectionState.Listening; } function isClosed() { return state === ConnectionState.Closed; } function isDisposed() { return state === ConnectionState.Disposed; } function closeHandler() { if (state === ConnectionState.New || state === ConnectionState.Listening) { state = ConnectionState.Closed; closeEmitter.fire(void 0); } } function readErrorHandler(error) { errorEmitter.fire([error, void 0, void 0]); } function writeErrorHandler(data) { errorEmitter.fire(data); } messageReader.onClose(closeHandler); messageReader.onError(readErrorHandler); messageWriter.onClose(closeHandler); messageWriter.onError(writeErrorHandler); function triggerMessageQueue() { if (timer || messageQueue.size === 0) { return; } timer = (0, ral_1.default)().timer.setImmediate(() => { timer = void 0; processMessageQueue(); }); } function handleMessage(message) { if (messages_1.Message.isRequest(message)) { handleRequest(message); } else if (messages_1.Message.isNotification(message)) { handleNotification(message); } else if (messages_1.Message.isResponse(message)) { handleResponse(message); } else { handleInvalidMessage(message); } } function processMessageQueue() { if (messageQueue.size === 0) { return; } const message = messageQueue.shift(); try { const messageStrategy = options2?.messageStrategy; if (MessageStrategy.is(messageStrategy)) { messageStrategy.handleMessage(message, handleMessage); } else { handleMessage(message); } } finally { triggerMessageQueue(); } } const callback = (message) => { try { if (messages_1.Message.isNotification(message) && message.method === CancelNotification.type.method) { const cancelId = message.params.id; const key = createRequestQueueKey(cancelId); const toCancel = messageQueue.get(key); if (messages_1.Message.isRequest(toCancel)) { const strategy = options2?.connectionStrategy; const response = strategy && strategy.cancelUndispatched ? strategy.cancelUndispatched(toCancel, cancelUndispatched) : cancelUndispatched(toCancel); if (response && (response.error !== void 0 || response.result !== void 0)) { messageQueue.delete(key); requestTokens.delete(cancelId); response.id = toCancel.id; traceSendingResponse(response, message.method, Date.now()); messageWriter.write(response).catch(() => logger.error(`Sending response for canceled message failed.`)); return; } } const cancellationToken = requestTokens.get(cancelId); if (cancellationToken !== void 0) { cancellationToken.cancel(); traceReceivedNotification(message); return; } else { knownCanceledRequests.add(cancelId); } } addMessageToQueue(messageQueue, message); } finally { triggerMessageQueue(); } }; function handleRequest(requestMessage) { if (isDisposed()) { return; } function reply(resultOrError, method, startTime2) { const message = { jsonrpc: version, id: requestMessage.id }; if (resultOrError instanceof messages_1.ResponseError) { message.error = resultOrError.toJson(); } else { message.result = resultOrError === void 0 ? null : resultOrError; } traceSendingResponse(message, method, startTime2); messageWriter.write(message).catch(() => logger.error(`Sending response failed.`)); } function replyError(error, method, startTime2) { const message = { jsonrpc: version, id: requestMessage.id, error: error.toJson() }; traceSendingResponse(message, method, startTime2); messageWriter.write(message).catch(() => logger.error(`Sending response failed.`)); } function replySuccess(result, method, startTime2) { if (result === void 0) { result = null; } const message = { jsonrpc: version, id: requestMessage.id, result }; traceSendingResponse(message, method, startTime2); messageWriter.write(message).catch(() => logger.error(`Sending response failed.`)); } traceReceivedRequest(requestMessage); const element = requestHandlers.get(requestMessage.method); let type; let requestHandler; if (element) { type = element.type; requestHandler = element.handler; } const startTime = Date.now(); if (requestHandler || starRequestHandler) { const tokenKey = requestMessage.id ?? String(Date.now()); const cancellationSource = IdCancellationReceiverStrategy.is(cancellationStrategy.receiver) ? cancellationStrategy.receiver.createCancellationTokenSource(tokenKey) : cancellationStrategy.receiver.createCancellationTokenSource(requestMessage); if (requestMessage.id !== null && knownCanceledRequests.has(requestMessage.id)) { cancellationSource.cancel(); } if (requestMessage.id !== null) { requestTokens.set(tokenKey, cancellationSource); } try { let handlerResult; if (requestHandler) { if (requestMessage.params === void 0) { if (type !== void 0 && type.numberOfParams !== 0) { replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InvalidParams, `Request ${requestMessage.method} defines ${type.numberOfParams} params but received none.`), requestMessage.method, startTime); return; } handlerResult = requestHandler(cancellationSource.token); } else if (Array.isArray(requestMessage.params)) { if (type !== void 0 && type.parameterStructures === messages_1.ParameterStructures.byName) { replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InvalidParams, `Request ${requestMessage.method} defines parameters by name but received parameters by position`), requestMessage.method, startTime); return; } handlerResult = requestHandler(...requestMessage.params, cancellationSource.token); } else { if (type !== void 0 && type.parameterStructures === messages_1.ParameterStructures.byPosition) { replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InvalidParams, `Request ${requestMessage.method} defines parameters by position but received parameters by name`), requestMessage.method, startTime); return; } handlerResult = requestHandler(requestMessage.params, cancellationSource.token); } } else if (starRequestHandler) { handlerResult = starRequestHandler(requestMessage.method, requestMessage.params, cancellationSource.token); } const promise = handlerResult; if (!handlerResult) { requestTokens.delete(tokenKey); replySuccess(handlerResult, requestMessage.method, startTime); } else if (promise.then) { promise.then((resultOrError) => { requestTokens.delete(tokenKey); reply(resultOrError, requestMessage.method, startTime); }, (error) => { requestTokens.delete(tokenKey); if (error instanceof messages_1.ResponseError) { replyError(error, requestMessage.method, startTime); } else if (error && Is2.string(error.message)) { replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed with message: ${error.message}`), requestMessage.method, startTime); } else { replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed unexpectedly without providing any details.`), requestMessage.method, startTime); } }); } else { requestTokens.delete(tokenKey); reply(handlerResult, requestMessage.method, startTime); } } catch (error) { requestTokens.delete(tokenKey); if (error instanceof messages_1.ResponseError) { reply(error, requestMessage.method, startTime); } else if (error && Is2.string(error.message)) { replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed with message: ${error.message}`), requestMessage.method, startTime); } else { replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed unexpectedly without providing any details.`), requestMessage.method, startTime); } } } else { replyError(new messages_1.ResponseError(messages_1.ErrorCodes.MethodNotFound, `Unhandled method ${requestMessage.method}`), requestMessage.method, startTime); } } function handleResponse(responseMessage) { if (isDisposed()) { return; } if (responseMessage.id === null) { if (responseMessage.error) { logger.error(`Received response message without id: Error is: ${JSON.stringify(responseMessage.error, void 0, 4)}`); } else { logger.error(`Received response message without id. No further error information provided.`); } } else { const key = responseMessage.id; const responsePromise = responsePromises.get(key); traceReceivedResponse(responseMessage, responsePromise); if (responsePromise !== void 0) { responsePromises.delete(key); try { if (responseMessage.error) { const error = responseMessage.error; responsePromise.reject(new messages_1.ResponseError(error.code, error.message, error.data)); } else if (responseMessage.result !== void 0) { responsePromise.resolve(responseMessage.result); } else { throw new Error("Should never happen."); } } catch (error) { if (error.message) { logger.error(`Response handler '${responsePromise.method}' failed with message: ${error.message}`); } else { logger.error(`Response handler '${responsePromise.method}' failed unexpectedly.`); } } } } } function handleNotification(message) { if (isDisposed()) { return; } let type = void 0; let notificationHandler; if (message.method === CancelNotification.type.method) { const cancelId = message.params.id; knownCanceledRequests.delete(cancelId); traceReceivedNotification(message); return; } else { const element = notificationHandlers.get(message.method); if (element) { notificationHandler = element.handler; type = element.type; } } if (notificationHandler || starNotificationHandler) { try { traceReceivedNotification(message); if (notificationHandler) { if (message.params === void 0) { if (type !== void 0) { if (type.numberOfParams !== 0 && type.parameterStructures !== messages_1.ParameterStructures.byName) { logger.error(`Notification ${message.method} defines ${type.numberOfParams} params but received none.`); } } notificationHandler(); } else if (Array.isArray(message.params)) { const params = message.params; if (message.method === ProgressNotification.type.method && params.length === 2 && ProgressToken.is(params[0])) { notificationHandler({ token: params[0], value: params[1] }); } else { if (type !== void 0) { if (type.parameterStructures === messages_1.ParameterStructures.byName) { logger.error(`Notification ${message.method} defines parameters by name but received parameters by position`); } if (type.numberOfParams !== message.params.length) { logger.error(`Notification ${message.method} defines ${type.numberOfParams} params but received ${params.length} arguments`); } } notificationHandler(...params); } } else { if (type !== void 0 && type.parameterStructures === messages_1.ParameterStructures.byPosition) { logger.error(`Notification ${message.method} defines parameters by position but received parameters by name`); } notificationHandler(message.params); } } else if (starNotificationHandler) { starNotificationHandler(message.method, message.params); } } catch (error) { if (error.message) { logger.error(`Notification handler '${message.method}' failed with message: ${error.message}`); } else { logger.error(`Notification handler '${message.method}' failed unexpectedly.`); } } } else { unhandledNotificationEmitter.fire(message); } } function handleInvalidMessage(message) { if (!message) { logger.error("Received empty message."); return; } logger.error(`Received message which is neither a response nor a notification message: ${JSON.stringify(message, null, 4)}`); const responseMessage = message; if (Is2.string(responseMessage.id) || Is2.number(responseMessage.id)) { const key = responseMessage.id; const responseHandler = responsePromises.get(key); if (responseHandler) { responseHandler.reject(new Error("The received response has neither a result nor an error property.")); } } } function stringifyTrace(params) { if (params === void 0 || params === null) { return void 0; } switch (trace) { case Trace.Verbose: return JSON.stringify(params, null, 4); case Trace.Compact: return JSON.stringify(params); default: return void 0; } } function traceSendingRequest(message) { if (trace === Trace.Off || !tracer) { return; } if (traceFormat === TraceFormat.Text) { let data = void 0; if ((trace === Trace.Verbose || trace === Trace.Compact) && message.params) { data = `Params: ${stringifyTrace(message.params)} `; } tracer.log(`Sending request '${message.method} - (${message.id})'.`, data); } else { logLSPMessage("send-request", message); } } function traceSendingNotification(message) { if (trace === Trace.Off || !tracer) { return; } if (traceFormat === TraceFormat.Text) { let data = void 0; if (trace === Trace.Verbose || trace === Trace.Compact) { if (message.params) { data = `Params: ${stringifyTrace(message.params)} `; } else { data = "No parameters provided.\n\n"; } } tracer.log(`Sending notification '${message.method}'.`, data); } else { logLSPMessage("send-notification", message); } } function traceSendingResponse(message, method, startTime) { if (trace === Trace.Off || !tracer) { return; } if (traceFormat === TraceFormat.Text) { let data = void 0; if (trace === Trace.Verbose || trace === Trace.Compact) { if (message.error && message.error.data) { data = `Error data: ${stringifyTrace(message.error.data)} `; } else { if (message.result) { data = `Result: ${stringifyTrace(message.result)} `; } else if (message.error === void 0) { data = "No result returned.\n\n"; } } } tracer.log(`Sending response '${method} - (${message.id})'. Processing request took ${Date.now() - startTime}ms`, data); } else { logLSPMessage("send-response", message); } } function traceReceivedRequest(message) { if (trace === Trace.Off || !tracer) { return; } if (traceFormat === TraceFormat.Text) { let data = void 0; if ((trace === Trace.Verbose || trace === Trace.Compact) && message.params) { data = `Params: ${stringifyTrace(message.params)} `; } tracer.log(`Received request '${message.method} - (${message.id})'.`, data); } else { logLSPMessage("receive-request", message); } } function traceReceivedNotification(message) { if (trace === Trace.Off || !tracer || message.method === LogTraceNotification.type.method) { return; } if (traceFormat === TraceFormat.Text) { let data = void 0; if (trace === Trace.Verbose || trace === Trace.Compact) { if (message.params) { data = `Params: ${stringifyTrace(message.params)} `; } else { data = "No parameters provided.\n\n"; } } tracer.log(`Received notification '${message.method}'.`, data); } else { logLSPMessage("receive-notification", message); } } function traceReceivedResponse(message, responsePromise) { if (trace === Trace.Off || !tracer) { return; } if (traceFormat === TraceFormat.Text) { let data = void 0; if (trace === Trace.Verbose || trace === Trace.Compact) { if (message.error && message.error.data) { data = `Error data: ${stringifyTrace(message.error.data)} `; } else { if (message.result) { data = `Result: ${stringifyTrace(message.result)} `; } else if (message.error === void 0) { data = "No result returned.\n\n"; } } } if (responsePromise) { const error = message.error ? ` Request failed: ${message.error.message} (${message.error.code}).` : ""; tracer.log(`Received response '${responsePromise.method} - (${message.id})' in ${Date.now() - responsePromise.timerStart}ms.${error}`, data); } else { tracer.log(`Received response ${message.id} without active response promise.`, data); } } else { logLSPMessage("receive-response", message); } } function logLSPMessage(type, message) { if (!tracer || trace === Trace.Off) { return; } const lspMessage = { isLSPMessage: true, type, message, timestamp: Date.now() }; tracer.log(lspMessage); } function throwIfClosedOrDisposed() { if (isClosed()) { throw new ConnectionError(ConnectionErrors.Closed, "Connection is closed."); } if (isDisposed()) { throw new ConnectionError(ConnectionErrors.Disposed, "Connection is disposed."); } } function throwIfListening() { if (isListening()) { throw new ConnectionError(ConnectionErrors.AlreadyListening, "Connection is already listening"); } } function throwIfNotListening() { if (!isListening()) { throw new Error("Call listen() first."); } } function undefinedToNull(param) { if (param === void 0) { return null; } else { return param; } } function nullToUndefined(param) { if (param === null) { return void 0; } else { return param; } } function isNamedParam(param) { return param !== void 0 && param !== null && !Array.isArray(param) && typeof param === "object"; } function computeSingleParam(parameterStructures, param) { switch (parameterStructures) { case messages_1.ParameterStructures.auto: if (isNamedParam(param)) { return nullToUndefined(param); } else { return [undefinedToNull(param)]; } case messages_1.ParameterStructures.byName: if (!isNamedParam(param)) { throw new Error(`Received parameters by name but param is not an object literal.`); } return nullToUndefined(param); case messages_1.ParameterStructures.byPosition: return [undefinedToNull(param)]; default: throw new Error(`Unknown parameter structure ${parameterStructures.toString()}`); } } function computeMessageParams(type, params) { let result; const numberOfParams = type.numberOfParams; switch (numberOfParams) { case 0: result = void 0; break; case 1: result = computeSingleParam(type.parameterStructures, params[0]); break; default: result = []; for (let i = 0; i < params.length && i < numberOfParams; i++) { result.push(undefinedToNull(params[i])); } if (params.length < numberOfParams) { for (let i = params.length; i < numberOfParams; i++) { result.push(null); } } break; } return result; } const connection = { sendNotification: (type, ...args) => { throwIfClosedOrDisposed(); let method; let messageParams; if (Is2.string(type)) { method = type; const first = args[0]; let paramStart = 0; let parameterStructures = messages_1.ParameterStructures.auto; if (messages_1.ParameterStructures.is(first)) { paramStart = 1; parameterStructures = first; } let paramEnd = args.length; const numberOfParams = paramEnd - paramStart; switch (numberOfParams) { case 0: messageParams = void 0; break; case 1: messageParams = computeSingleParam(parameterStructures, args[paramStart]); break; default: if (parameterStructures === messages_1.ParameterStructures.byName) { throw new Error(`Received ${numberOfParams} parameters for 'by Name' notification parameter structure.`); } messageParams = args.slice(paramStart, paramEnd).map((value) => undefinedToNull(value)); break; } } else { const params = args; method = type.method; messageParams = computeMessageParams(type, params); } const notificationMessage = { jsonrpc: version, method, params: messageParams }; traceSendingNotification(notificationMessage); return messageWriter.write(notificationMessage).catch((error) => { logger.error(`Sending notification failed.`); throw error; }); }, onNotification: (type, handler) => { throwIfClosedOrDisposed(); let method; if (Is2.func(type)) { starNotificationHandler = type; } else if (handler) { if (Is2.string(type)) { method = type; notificationHandlers.set(type, { type: void 0, handler }); } else { method = type.method; notificationHandlers.set(type.method, { type, handler }); } } return { dispose: () => { if (method !== void 0) { notificationHandlers.delete(method); } else { starNotificationHandler = void 0; } } }; }, onProgress: (_type, token, handler) => { if (progressHandlers.has(token)) { throw new Error(`Progress handler for token ${token} already registered`); } progressHandlers.set(token, handler); return { dispose: () => { progressHandlers.delete(token); } }; }, sendProgress: (_type, token, value) => { return connection.sendNotification(ProgressNotification.type, { token, value }); }, onUnhandledProgress: unhandledProgressEmitter.event, sendRequest: (type, ...args) => { throwIfClosedOrDisposed(); throwIfNotListening(); let method; let messageParams; let token = void 0; if (Is2.string(type)) { method = type; const first = args[0]; const last = args[args.length - 1]; let paramStart = 0; let parameterStructures = messages_1.ParameterStructures.auto; if (messages_1.ParameterStructures.is(first)) { paramStart = 1; parameterStructures = first; } let paramEnd = args.length; if (cancellation_1.CancellationToken.is(last)) { paramEnd = paramEnd - 1; token = last; } const numberOfParams = paramEnd - paramStart; switch (numberOfParams) { case 0: messageParams = void 0; break; case 1: messageParams = computeSingleParam(parameterStructures, args[paramStart]); break; default: if (parameterStructures === messages_1.ParameterStructures.byName) { throw new Error(`Received ${numberOfParams} parameters for 'by Name' request parameter structure.`); } messageParams = args.slice(paramStart, paramEnd).map((value) => undefinedToNull(value)); break; } } else { const params = args; method = type.method; messageParams = computeMessageParams(type, params); const numberOfParams = type.numberOfParams; token = cancellation_1.CancellationToken.is(params[numberOfParams]) ? params[numberOfParams] : void 0; } const id2 = sequenceNumber++; let disposable; if (token) { disposable = token.onCancellationRequested(() => { const p = cancellationStrategy.sender.sendCancellation(connection, id2); if (p === void 0) { logger.log(`Received no promise from cancellation strategy when cancelling id ${id2}`); return Promise.resolve(); } else { return p.catch(() => { logger.log(`Sending cancellation messages for id ${id2} failed`); }); } }); } const requestMessage = { jsonrpc: version, id: id2, method, params: messageParams }; traceSendingRequest(requestMessage); if (typeof cancellationStrategy.sender.enableCancellation === "function") { cancellationStrategy.sender.enableCancellation(requestMessage); } return new Promise(async (resolve, reject) => { const resolveWithCleanup = (r2) => { resolve(r2); cancellationStrategy.sender.cleanup(id2); disposable?.dispose(); }; const rejectWithCleanup = (r2) => { reject(r2); cancellationStrategy.sender.cleanup(id2); disposable?.dispose(); }; const responsePromise = { method, timerStart: Date.now(), resolve: resolveWithCleanup, reject: rejectWithCleanup }; try { await messageWriter.write(requestMessage); responsePromises.set(id2, responsePromise); } catch (error) { logger.error(`Sending request failed.`); responsePromise.reject(new messages_1.ResponseError(messages_1.ErrorCodes.MessageWriteError, error.message ? error.message : "Unknown reason")); throw error; } }); }, onRequest: (type, handler) => { throwIfClosedOrDisposed(); let method = null; if (StarRequestHandler.is(type)) { method = void 0; starRequestHandler = type; } else if (Is2.string(type)) { method = null; if (handler !== void 0) { method = type; requestHandlers.set(type, { handler, type: void 0 }); } } else { if (handler !== void 0) { method = type.method; requestHandlers.set(type.method, { type, handler }); } } return { dispose: () => { if (method === null) { return; } if (method !== void 0) { requestHandlers.delete(method); } else { starRequestHandler = void 0; } } }; }, hasPendingResponse: () => { return responsePromises.size > 0; }, trace: async (_value, _tracer, sendNotificationOrTraceOptions) => { let _sendNotification = false; let _traceFormat = TraceFormat.Text; if (sendNotificationOrTraceOptions !== void 0) { if (Is2.boolean(sendNotificationOrTraceOptions)) { _sendNotification = sendNotificationOrTraceOptions; } else { _sendNotification = sendNotificationOrTraceOptions.sendNotification || false; _traceFormat = sendNotificationOrTraceOptions.traceFormat || TraceFormat.Text; } } trace = _value; traceFormat = _traceFormat; if (trace === Trace.Off) { tracer = void 0; } else { tracer = _tracer; } if (_sendNotification && !isClosed() && !isDisposed()) { await connection.sendNotification(SetTraceNotification.type, { value: Trace.toString(_value) }); } }, onError: errorEmitter.event, onClose: closeEmitter.event, onUnhandledNotification: unhandledNotificationEmitter.event, onDispose: disposeEmitter.event, end: () => { messageWriter.end(); }, dispose: () => { if (isDisposed()) { return; } state = ConnectionState.Disposed; disposeEmitter.fire(void 0); const error = new messages_1.ResponseError(messages_1.ErrorCodes.PendingResponseRejected, "Pending response rejected since connection got disposed"); for (const promise of responsePromises.values()) { promise.reject(error); } responsePromises = /* @__PURE__ */ new Map(); requestTokens = /* @__PURE__ */ new Map(); knownCanceledRequests = /* @__PURE__ */ new Set(); messageQueue = new linkedMap_1.LinkedMap(); if (Is2.func(messageWriter.dispose)) { messageWriter.dispose(); } if (Is2.func(messageReader.dispose)) { messageReader.dispose(); } }, listen: () => { throwIfClosedOrDisposed(); throwIfListening(); state = ConnectionState.Listening; messageReader.listen(callback); }, inspect: () => { (0, ral_1.default)().console.log("inspect"); } }; connection.onNotification(LogTraceNotification.type, (params) => { if (trace === Trace.Off || !tracer) { return; } const verbose2 = trace === Trace.Verbose || trace === Trace.Compact; tracer.log(params.message, verbose2 ? params.verbose : void 0); }); connection.onNotification(ProgressNotification.type, (params) => { const handler = progressHandlers.get(params.token); if (handler) { handler(params.value); } else { unhandledProgressEmitter.fire(params); } }); return connection; } exports.createMessageConnection = createMessageConnection3; } }); // node_modules/vscode-jsonrpc/lib/common/api.js var require_api = __commonJS({ "node_modules/vscode-jsonrpc/lib/common/api.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ProgressType = exports.ProgressToken = exports.createMessageConnection = exports.NullLogger = exports.ConnectionOptions = exports.ConnectionStrategy = exports.AbstractMessageBuffer = exports.WriteableStreamMessageWriter = exports.AbstractMessageWriter = exports.MessageWriter = exports.ReadableStreamMessageReader = exports.AbstractMessageReader = exports.MessageReader = exports.SharedArrayReceiverStrategy = exports.SharedArraySenderStrategy = exports.CancellationToken = exports.CancellationTokenSource = exports.Emitter = exports.Event = exports.Disposable = exports.LRUCache = exports.Touch = exports.LinkedMap = exports.ParameterStructures = exports.NotificationType9 = exports.NotificationType8 = exports.NotificationType7 = exports.NotificationType6 = exports.NotificationType5 = exports.NotificationType4 = exports.NotificationType3 = exports.NotificationType2 = exports.NotificationType1 = exports.NotificationType0 = exports.NotificationType = exports.ErrorCodes = exports.ResponseError = exports.RequestType9 = exports.RequestType8 = exports.RequestType7 = exports.RequestType6 = exports.RequestType5 = exports.RequestType4 = exports.RequestType3 = exports.RequestType2 = exports.RequestType1 = exports.RequestType0 = exports.RequestType = exports.Message = exports.RAL = void 0; exports.MessageStrategy = exports.CancellationStrategy = exports.CancellationSenderStrategy = exports.CancellationReceiverStrategy = exports.ConnectionError = exports.ConnectionErrors = exports.LogTraceNotification = exports.SetTraceNotification = exports.TraceFormat = exports.TraceValues = exports.Trace = void 0; var messages_1 = require_messages(); Object.defineProperty(exports, "Message", { enumerable: true, get: function() { return messages_1.Message; } }); Object.defineProperty(exports, "RequestType", { enumerable: true, get: function() { return messages_1.RequestType; } }); Object.defineProperty(exports, "RequestType0", { enumerable: true, get: function() { return messages_1.RequestType0; } }); Object.defineProperty(exports, "RequestType1", { enumerable: true, get: function() { return messages_1.RequestType1; } }); Object.defineProperty(exports, "RequestType2", { enumerable: true, get: function() { return messages_1.RequestType2; } }); Object.defineProperty(exports, "RequestType3", { enumerable: true, get: function() { return messages_1.RequestType3; } }); Object.defineProperty(exports, "RequestType4", { enumerable: true, get: function() { return messages_1.RequestType4; } }); Object.defineProperty(exports, "RequestType5", { enumerable: true, get: function() { return messages_1.RequestType5; } }); Object.defineProperty(exports, "RequestType6", { enumerable: true, get: function() { return messages_1.RequestType6; } }); Object.defineProperty(exports, "RequestType7", { enumerable: true, get: function() { return messages_1.RequestType7; } }); Object.defineProperty(exports, "RequestType8", { enumerable: true, get: function() { return messages_1.RequestType8; } }); Object.defineProperty(exports, "RequestType9", { enumerable: true, get: function() { return messages_1.RequestType9; } }); Object.defineProperty(exports, "ResponseError", { enumerable: true, get: function() { return messages_1.ResponseError; } }); Object.defineProperty(exports, "ErrorCodes", { enumerable: true, get: function() { return messages_1.ErrorCodes; } }); Object.defineProperty(exports, "NotificationType", { enumerable: true, get: function() { return messages_1.NotificationType; } }); Object.defineProperty(exports, "NotificationType0", { enumerable: true, get: function() { return messages_1.NotificationType0; } }); Object.defineProperty(exports, "NotificationType1", { enumerable: true, get: function() { return messages_1.NotificationType1; } }); Object.defineProperty(exports, "NotificationType2", { enumerable: true, get: function() { return messages_1.NotificationType2; } }); Object.defineProperty(exports, "NotificationType3", { enumerable: true, get: function() { return messages_1.NotificationType3; } }); Object.defineProperty(exports, "NotificationType4", { enumerable: true, get: function() { return messages_1.NotificationType4; } }); Object.defineProperty(exports, "NotificationType5", { enumerable: true, get: function() { return messages_1.NotificationType5; } }); Object.defineProperty(exports, "NotificationType6", { enumerable: true, get: function() { return messages_1.NotificationType6; } }); Object.defineProperty(exports, "NotificationType7", { enumerable: true, get: function() { return messages_1.NotificationType7; } }); Object.defineProperty(exports, "NotificationType8", { enumerable: true, get: function() { return messages_1.NotificationType8; } }); Object.defineProperty(exports, "NotificationType9", { enumerable: true, get: function() { return messages_1.NotificationType9; } }); Object.defineProperty(exports, "ParameterStructures", { enumerable: true, get: function() { return messages_1.ParameterStructures; } }); var linkedMap_1 = require_linkedMap(); Object.defineProperty(exports, "LinkedMap", { enumerable: true, get: function() { return linkedMap_1.LinkedMap; } }); Object.defineProperty(exports, "LRUCache", { enumerable: true, get: function() { return linkedMap_1.LRUCache; } }); Object.defineProperty(exports, "Touch", { enumerable: true, get: function() { return linkedMap_1.Touch; } }); var disposable_1 = require_disposable(); Object.defineProperty(exports, "Disposable", { enumerable: true, get: function() { return disposable_1.Disposable; } }); var events_1 = require_events2(); Object.defineProperty(exports, "Event", { enumerable: true, get: function() { return events_1.Event; } }); Object.defineProperty(exports, "Emitter", { enumerable: true, get: function() { return events_1.Emitter; } }); var cancellation_1 = require_cancellation(); Object.defineProperty(exports, "CancellationTokenSource", { enumerable: true, get: function() { return cancellation_1.CancellationTokenSource; } }); Object.defineProperty(exports, "CancellationToken", { enumerable: true, get: function() { return cancellation_1.CancellationToken; } }); var sharedArrayCancellation_1 = require_sharedArrayCancellation(); Object.defineProperty(exports, "SharedArraySenderStrategy", { enumerable: true, get: function() { return sharedArrayCancellation_1.SharedArraySenderStrategy; } }); Object.defineProperty(exports, "SharedArrayReceiverStrategy", { enumerable: true, get: function() { return sharedArrayCancellation_1.SharedArrayReceiverStrategy; } }); var messageReader_1 = require_messageReader(); Object.defineProperty(exports, "MessageReader", { enumerable: true, get: function() { return messageReader_1.MessageReader; } }); Object.defineProperty(exports, "AbstractMessageReader", { enumerable: true, get: function() { return messageReader_1.AbstractMessageReader; } }); Object.defineProperty(exports, "ReadableStreamMessageReader", { enumerable: true, get: function() { return messageReader_1.ReadableStreamMessageReader; } }); var messageWriter_1 = require_messageWriter(); Object.defineProperty(exports, "MessageWriter", { enumerable: true, get: function() { return messageWriter_1.MessageWriter; } }); Object.defineProperty(exports, "AbstractMessageWriter", { enumerable: true, get: function() { return messageWriter_1.AbstractMessageWriter; } }); Object.defineProperty(exports, "WriteableStreamMessageWriter", { enumerable: true, get: function() { return messageWriter_1.WriteableStreamMessageWriter; } }); var messageBuffer_1 = require_messageBuffer(); Object.defineProperty(exports, "AbstractMessageBuffer", { enumerable: true, get: function() { return messageBuffer_1.AbstractMessageBuffer; } }); var connection_1 = require_connection(); Object.defineProperty(exports, "ConnectionStrategy", { enumerable: true, get: function() { return connection_1.ConnectionStrategy; } }); Object.defineProperty(exports, "ConnectionOptions", { enumerable: true, get: function() { return connection_1.ConnectionOptions; } }); Object.defineProperty(exports, "NullLogger", { enumerable: true, get: function() { return connection_1.NullLogger; } }); Object.defineProperty(exports, "createMessageConnection", { enumerable: true, get: function() { return connection_1.createMessageConnection; } }); Object.defineProperty(exports, "ProgressToken", { enumerable: true, get: function() { return connection_1.ProgressToken; } }); Object.defineProperty(exports, "ProgressType", { enumerable: true, get: function() { return connection_1.ProgressType; } }); Object.defineProperty(exports, "Trace", { enumerable: true, get: function() { return connection_1.Trace; } }); Object.defineProperty(exports, "TraceValues", { enumerable: true, get: function() { return connection_1.TraceValues; } }); Object.defineProperty(exports, "TraceFormat", { enumerable: true, get: function() { return connection_1.TraceFormat; } }); Object.defineProperty(exports, "SetTraceNotification", { enumerable: true, get: function() { return connection_1.SetTraceNotification; } }); Object.defineProperty(exports, "LogTraceNotification", { enumerable: true, get: function() { return connection_1.LogTraceNotification; } }); Object.defineProperty(exports, "ConnectionErrors", { enumerable: true, get: function() { return connection_1.ConnectionErrors; } }); Object.defineProperty(exports, "ConnectionError", { enumerable: true, get: function() { return connection_1.ConnectionError; } }); Object.defineProperty(exports, "CancellationReceiverStrategy", { enumerable: true, get: function() { return connection_1.CancellationReceiverStrategy; } }); Object.defineProperty(exports, "CancellationSenderStrategy", { enumerable: true, get: function() { return connection_1.CancellationSenderStrategy; } }); Object.defineProperty(exports, "CancellationStrategy", { enumerable: true, get: function() { return connection_1.CancellationStrategy; } }); Object.defineProperty(exports, "MessageStrategy", { enumerable: true, get: function() { return connection_1.MessageStrategy; } }); var ral_1 = require_ral(); exports.RAL = ral_1.default; } }); // node_modules/vscode-jsonrpc/lib/browser/ril.js var require_ril = __commonJS({ "node_modules/vscode-jsonrpc/lib/browser/ril.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var api_1 = require_api(); var MessageBuffer = class _MessageBuffer extends api_1.AbstractMessageBuffer { constructor(encoding = "utf-8") { super(encoding); this.asciiDecoder = new TextDecoder("ascii"); } emptyBuffer() { return _MessageBuffer.emptyBuffer; } fromString(value, _encoding) { return new TextEncoder().encode(value); } toString(value, encoding) { if (encoding === "ascii") { return this.asciiDecoder.decode(value); } else { return new TextDecoder(encoding).decode(value); } } asNative(buffer, length) { if (length === void 0) { return buffer; } else { return buffer.slice(0, length); } } allocNative(length) { return new Uint8Array(length); } }; MessageBuffer.emptyBuffer = new Uint8Array(0); var ReadableStreamWrapper = class { constructor(socket) { this.socket = socket; this._onData = new api_1.Emitter(); this._messageListener = (event) => { const blob = event.data; blob.arrayBuffer().then((buffer) => { this._onData.fire(new Uint8Array(buffer)); }, () => { (0, api_1.RAL)().console.error(`Converting blob to array buffer failed.`); }); }; this.socket.addEventListener("message", this._messageListener); } onClose(listener) { this.socket.addEventListener("close", listener); return api_1.Disposable.create(() => this.socket.removeEventListener("close", listener)); } onError(listener) { this.socket.addEventListener("error", listener); return api_1.Disposable.create(() => this.socket.removeEventListener("error", listener)); } onEnd(listener) { this.socket.addEventListener("end", listener); return api_1.Disposable.create(() => this.socket.removeEventListener("end", listener)); } onData(listener) { return this._onData.event(listener); } }; var WritableStreamWrapper = class { constructor(socket) { this.socket = socket; } onClose(listener) { this.socket.addEventListener("close", listener); return api_1.Disposable.create(() => this.socket.removeEventListener("close", listener)); } onError(listener) { this.socket.addEventListener("error", listener); return api_1.Disposable.create(() => this.socket.removeEventListener("error", listener)); } onEnd(listener) { this.socket.addEventListener("end", listener); return api_1.Disposable.create(() => this.socket.removeEventListener("end", listener)); } write(data, encoding) { if (typeof data === "string") { if (encoding !== void 0 && encoding !== "utf-8") { throw new Error(`In a Browser environments only utf-8 text encoding is supported. But got encoding: ${encoding}`); } this.socket.send(data); } else { this.socket.send(data); } return Promise.resolve(); } end() { this.socket.close(); } }; var _textEncoder = new TextEncoder(); var _ril = Object.freeze({ messageBuffer: Object.freeze({ create: (encoding) => new MessageBuffer(encoding) }), applicationJson: Object.freeze({ encoder: Object.freeze({ name: "application/json", encode: (msg, options2) => { if (options2.charset !== "utf-8") { throw new Error(`In a Browser environments only utf-8 text encoding is supported. But got encoding: ${options2.charset}`); } return Promise.resolve(_textEncoder.encode(JSON.stringify(msg, void 0, 0))); } }), decoder: Object.freeze({ name: "application/json", decode: (buffer, options2) => { if (!(buffer instanceof Uint8Array)) { throw new Error(`In a Browser environments only Uint8Arrays are supported.`); } return Promise.resolve(JSON.parse(new TextDecoder(options2.charset).decode(buffer))); } }) }), stream: Object.freeze({ asReadableStream: (socket) => new ReadableStreamWrapper(socket), asWritableStream: (socket) => new WritableStreamWrapper(socket) }), console, timer: Object.freeze({ setTimeout(callback, ms, ...args) { const handle = setTimeout(callback, ms, ...args); return { dispose: () => clearTimeout(handle) }; }, setImmediate(callback, ...args) { const handle = setTimeout(callback, 0, ...args); return { dispose: () => clearTimeout(handle) }; }, setInterval(callback, ms, ...args) { const handle = setInterval(callback, ms, ...args); return { dispose: () => clearInterval(handle) }; } }) }); function RIL() { return _ril; } (function(RIL2) { function install() { api_1.RAL.install(_ril); } RIL2.install = install; })(RIL || (RIL = {})); exports.default = RIL; } }); // node_modules/vscode-jsonrpc/lib/browser/main.js var require_main = __commonJS({ "node_modules/vscode-jsonrpc/lib/browser/main.js"(exports) { "use strict"; var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) { if (k2 === void 0) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); } : function(o, m, k, k2) { if (k2 === void 0) k2 = k; o[k2] = m[k]; }); var __exportStar = exports && exports.__exportStar || function(m, exports2) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding(exports2, m, p); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.createMessageConnection = exports.BrowserMessageWriter = exports.BrowserMessageReader = void 0; var ril_1 = require_ril(); ril_1.default.install(); var api_1 = require_api(); __exportStar(require_api(), exports); var BrowserMessageReader2 = class extends api_1.AbstractMessageReader { constructor(port) { super(); this._onData = new api_1.Emitter(); this._messageListener = (event) => { this._onData.fire(event.data); }; port.addEventListener("error", (event) => this.fireError(event)); port.onmessage = this._messageListener; } listen(callback) { return this._onData.event(callback); } }; exports.BrowserMessageReader = BrowserMessageReader2; var BrowserMessageWriter2 = class extends api_1.AbstractMessageWriter { constructor(port) { super(); this.port = port; this.errorCount = 0; port.addEventListener("error", (event) => this.fireError(event)); } write(msg) { try { this.port.postMessage(msg); return Promise.resolve(); } catch (error) { this.handleError(error, msg); return Promise.reject(error); } } handleError(error, msg) { this.errorCount++; this.fireError(error, msg, this.errorCount); } end() { } }; exports.BrowserMessageWriter = BrowserMessageWriter2; function createMessageConnection3(reader, writer, logger, options2) { if (logger === void 0) { logger = api_1.NullLogger; } if (api_1.ConnectionStrategy.is(options2)) { options2 = { connectionStrategy: options2 }; } return (0, api_1.createMessageConnection)(reader, writer, logger, options2); } exports.createMessageConnection = createMessageConnection3; } }); // node_modules/vscode-jsonrpc/browser.js var require_browser = __commonJS({ "node_modules/vscode-jsonrpc/browser.js"(exports, module) { "use strict"; module.exports = require_main(); } }); // node_modules/vscode-languageserver-types/lib/esm/main.js var main_exports = {}; __export(main_exports, { AnnotatedTextEdit: () => AnnotatedTextEdit, ChangeAnnotation: () => ChangeAnnotation, ChangeAnnotationIdentifier: () => ChangeAnnotationIdentifier, CodeAction: () => CodeAction, CodeActionContext: () => CodeActionContext, CodeActionKind: () => CodeActionKind, CodeActionTriggerKind: () => CodeActionTriggerKind, CodeDescription: () => CodeDescription, CodeLens: () => CodeLens, Color: () => Color, ColorInformation: () => ColorInformation, ColorPresentation: () => ColorPresentation, Command: () => Command, CompletionItem: () => CompletionItem, CompletionItemKind: () => CompletionItemKind, CompletionItemLabelDetails: () => CompletionItemLabelDetails, CompletionItemTag: () => CompletionItemTag, CompletionList: () => CompletionList, CreateFile: () => CreateFile, DeleteFile: () => DeleteFile, Diagnostic: () => Diagnostic, DiagnosticRelatedInformation: () => DiagnosticRelatedInformation, DiagnosticSeverity: () => DiagnosticSeverity, DiagnosticTag: () => DiagnosticTag, DocumentHighlight: () => DocumentHighlight, DocumentHighlightKind: () => DocumentHighlightKind, DocumentLink: () => DocumentLink, DocumentSymbol: () => DocumentSymbol, DocumentUri: () => DocumentUri, EOL: () => EOL, FoldingRange: () => FoldingRange, FoldingRangeKind: () => FoldingRangeKind, FormattingOptions: () => FormattingOptions, Hover: () => Hover, InlayHint: () => InlayHint, InlayHintKind: () => InlayHintKind, InlayHintLabelPart: () => InlayHintLabelPart, InlineCompletionContext: () => InlineCompletionContext, InlineCompletionItem: () => InlineCompletionItem, InlineCompletionList: () => InlineCompletionList, InlineCompletionTriggerKind: () => InlineCompletionTriggerKind, InlineValueContext: () => InlineValueContext, InlineValueEvaluatableExpression: () => InlineValueEvaluatableExpression, InlineValueText: () => InlineValueText, InlineValueVariableLookup: () => InlineValueVariableLookup, InsertReplaceEdit: () => InsertReplaceEdit, InsertTextFormat: () => InsertTextFormat, InsertTextMode: () => InsertTextMode, Location: () => Location, LocationLink: () => LocationLink, MarkedString: () => MarkedString, MarkupContent: () => MarkupContent, MarkupKind: () => MarkupKind, OptionalVersionedTextDocumentIdentifier: () => OptionalVersionedTextDocumentIdentifier, ParameterInformation: () => ParameterInformation, Position: () => Position, Range: () => Range2, RenameFile: () => RenameFile, SelectedCompletionInfo: () => SelectedCompletionInfo, SelectionRange: () => SelectionRange2, SemanticTokenModifiers: () => SemanticTokenModifiers, SemanticTokenTypes: () => SemanticTokenTypes, SemanticTokens: () => SemanticTokens, SignatureInformation: () => SignatureInformation, StringValue: () => StringValue, SymbolInformation: () => SymbolInformation, SymbolKind: () => SymbolKind, SymbolTag: () => SymbolTag, TextDocument: () => TextDocument, TextDocumentEdit: () => TextDocumentEdit, TextDocumentIdentifier: () => TextDocumentIdentifier, TextDocumentItem: () => TextDocumentItem, TextEdit: () => TextEdit, URI: () => URI, VersionedTextDocumentIdentifier: () => VersionedTextDocumentIdentifier, WorkspaceChange: () => WorkspaceChange, WorkspaceEdit: () => WorkspaceEdit, WorkspaceFolder: () => WorkspaceFolder, WorkspaceSymbol: () => WorkspaceSymbol, integer: () => integer, uinteger: () => uinteger }); var DocumentUri, URI, integer, uinteger, Position, Range2, Location, LocationLink, Color, ColorInformation, ColorPresentation, FoldingRangeKind, FoldingRange, DiagnosticRelatedInformation, DiagnosticSeverity, DiagnosticTag, CodeDescription, Diagnostic, Command, TextEdit, ChangeAnnotation, ChangeAnnotationIdentifier, AnnotatedTextEdit, TextDocumentEdit, CreateFile, RenameFile, DeleteFile, WorkspaceEdit, TextEditChangeImpl, ChangeAnnotations, WorkspaceChange, TextDocumentIdentifier, VersionedTextDocumentIdentifier, OptionalVersionedTextDocumentIdentifier, TextDocumentItem, MarkupKind, MarkupContent, CompletionItemKind, InsertTextFormat, CompletionItemTag, InsertReplaceEdit, InsertTextMode, CompletionItemLabelDetails, CompletionItem, CompletionList, MarkedString, Hover, ParameterInformation, SignatureInformation, DocumentHighlightKind, DocumentHighlight, SymbolKind, SymbolTag, SymbolInformation, WorkspaceSymbol, DocumentSymbol, CodeActionKind, CodeActionTriggerKind, CodeActionContext, CodeAction, CodeLens, FormattingOptions, DocumentLink, SelectionRange2, SemanticTokenTypes, SemanticTokenModifiers, SemanticTokens, InlineValueText, InlineValueVariableLookup, InlineValueEvaluatableExpression, InlineValueContext, InlayHintKind, InlayHintLabelPart, InlayHint, StringValue, InlineCompletionItem, InlineCompletionList, InlineCompletionTriggerKind, SelectedCompletionInfo, InlineCompletionContext, WorkspaceFolder, EOL, TextDocument, FullTextDocument, Is; var init_main = __esm({ "node_modules/vscode-languageserver-types/lib/esm/main.js"() { "use strict"; (function(DocumentUri2) { function is(value) { return typeof value === "string"; } DocumentUri2.is = is; })(DocumentUri || (DocumentUri = {})); (function(URI2) { function is(value) { return typeof value === "string"; } URI2.is = is; })(URI || (URI = {})); (function(integer2) { integer2.MIN_VALUE = -2147483648; integer2.MAX_VALUE = 2147483647; function is(value) { return typeof value === "number" && integer2.MIN_VALUE <= value && value <= integer2.MAX_VALUE; } integer2.is = is; })(integer || (integer = {})); (function(uinteger2) { uinteger2.MIN_VALUE = 0; uinteger2.MAX_VALUE = 2147483647; function is(value) { return typeof value === "number" && uinteger2.MIN_VALUE <= value && value <= uinteger2.MAX_VALUE; } uinteger2.is = is; })(uinteger || (uinteger = {})); (function(Position2) { function create(line, character) { if (line === Number.MAX_VALUE) { line = uinteger.MAX_VALUE; } if (character === Number.MAX_VALUE) { character = uinteger.MAX_VALUE; } return { line, character }; } Position2.create = create; function is(value) { let candidate = value; return Is.objectLiteral(candidate) && Is.uinteger(candidate.line) && Is.uinteger(candidate.character); } Position2.is = is; })(Position || (Position = {})); (function(Range4) { function create(one, two, three, four) { if (Is.uinteger(one) && Is.uinteger(two) && Is.uinteger(three) && Is.uinteger(four)) { return { start: Position.create(one, two), end: Position.create(three, four) }; } else if (Position.is(one) && Position.is(two)) { return { start: one, end: two }; } else { throw new Error(`Range#create called with invalid arguments[${one}, ${two}, ${three}, ${four}]`); } } Range4.create = create; function is(value) { let candidate = value; return Is.objectLiteral(candidate) && Position.is(candidate.start) && Position.is(candidate.end); } Range4.is = is; })(Range2 || (Range2 = {})); (function(Location2) { function create(uri, range) { return { uri, range }; } Location2.create = create; function is(value) { let candidate = value; return Is.objectLiteral(candidate) && Range2.is(candidate.range) && (Is.string(candidate.uri) || Is.undefined(candidate.uri)); } Location2.is = is; })(Location || (Location = {})); (function(LocationLink2) { function create(targetUri, targetRange, targetSelectionRange, originSelectionRange) { return { targetUri, targetRange, targetSelectionRange, originSelectionRange }; } LocationLink2.create = create; function is(value) { let candidate = value; return Is.objectLiteral(candidate) && Range2.is(candidate.targetRange) && Is.string(candidate.targetUri) && Range2.is(candidate.targetSelectionRange) && (Range2.is(candidate.originSelectionRange) || Is.undefined(candidate.originSelectionRange)); } LocationLink2.is = is; })(LocationLink || (LocationLink = {})); (function(Color2) { function create(red, green, blue, alpha) { return { red, green, blue, alpha }; } Color2.create = create; function is(value) { const candidate = value; return Is.objectLiteral(candidate) && Is.numberRange(candidate.red, 0, 1) && Is.numberRange(candidate.green, 0, 1) && Is.numberRange(candidate.blue, 0, 1) && Is.numberRange(candidate.alpha, 0, 1); } Color2.is = is; })(Color || (Color = {})); (function(ColorInformation2) { function create(range, color) { return { range, color }; } ColorInformation2.create = create; function is(value) { const candidate = value; return Is.objectLiteral(candidate) && Range2.is(candidate.range) && Color.is(candidate.color); } ColorInformation2.is = is; })(ColorInformation || (ColorInformation = {})); (function(ColorPresentation2) { function create(label, textEdit, additionalTextEdits) { return { label, textEdit, additionalTextEdits }; } ColorPresentation2.create = create; function is(value) { const candidate = value; return Is.objectLiteral(candidate) && Is.string(candidate.label) && (Is.undefined(candidate.textEdit) || TextEdit.is(candidate)) && (Is.undefined(candidate.additionalTextEdits) || Is.typedArray(candidate.additionalTextEdits, TextEdit.is)); } ColorPresentation2.is = is; })(ColorPresentation || (ColorPresentation = {})); (function(FoldingRangeKind2) { FoldingRangeKind2.Comment = "comment"; FoldingRangeKind2.Imports = "imports"; FoldingRangeKind2.Region = "region"; })(FoldingRangeKind || (FoldingRangeKind = {})); (function(FoldingRange2) { function create(startLine, endLine, startCharacter, endCharacter, kind, collapsedText) { const result = { startLine, endLine }; if (Is.defined(startCharacter)) { result.startCharacter = startCharacter; } if (Is.defined(endCharacter)) { result.endCharacter = endCharacter; } if (Is.defined(kind)) { result.kind = kind; } if (Is.defined(collapsedText)) { result.collapsedText = collapsedText; } return result; } FoldingRange2.create = create; function is(value) { const candidate = value; return Is.objectLiteral(candidate) && Is.uinteger(candidate.startLine) && Is.uinteger(candidate.startLine) && (Is.undefined(candidate.startCharacter) || Is.uinteger(candidate.startCharacter)) && (Is.undefined(candidate.endCharacter) || Is.uinteger(candidate.endCharacter)) && (Is.undefined(candidate.kind) || Is.string(candidate.kind)); } FoldingRange2.is = is; })(FoldingRange || (FoldingRange = {})); (function(DiagnosticRelatedInformation2) { function create(location, message) { return { location, message }; } DiagnosticRelatedInformation2.create = create; function is(value) { let candidate = value; return Is.defined(candidate) && Location.is(candidate.location) && Is.string(candidate.message); } DiagnosticRelatedInformation2.is = is; })(DiagnosticRelatedInformation || (DiagnosticRelatedInformation = {})); (function(DiagnosticSeverity4) { DiagnosticSeverity4.Error = 1; DiagnosticSeverity4.Warning = 2; DiagnosticSeverity4.Information = 3; DiagnosticSeverity4.Hint = 4; })(DiagnosticSeverity || (DiagnosticSeverity = {})); (function(DiagnosticTag3) { DiagnosticTag3.Unnecessary = 1; DiagnosticTag3.Deprecated = 2; })(DiagnosticTag || (DiagnosticTag = {})); (function(CodeDescription2) { function is(value) { const candidate = value; return Is.objectLiteral(candidate) && Is.string(candidate.href); } CodeDescription2.is = is; })(CodeDescription || (CodeDescription = {})); (function(Diagnostic4) { function create(range, message, severity, code, source, relatedInformation) { let result = { range, message }; if (Is.defined(severity)) { result.severity = severity; } if (Is.defined(code)) { result.code = code; } if (Is.defined(source)) { result.source = source; } if (Is.defined(relatedInformation)) { result.relatedInformation = relatedInformation; } return result; } Diagnostic4.create = create; function is(value) { var _a3; let candidate = value; return Is.defined(candidate) && Range2.is(candidate.range) && Is.string(candidate.message) && (Is.number(candidate.severity) || Is.undefined(candidate.severity)) && (Is.integer(candidate.code) || Is.string(candidate.code) || Is.undefined(candidate.code)) && (Is.undefined(candidate.codeDescription) || Is.string((_a3 = candidate.codeDescription) === null || _a3 === void 0 ? void 0 : _a3.href)) && (Is.string(candidate.source) || Is.undefined(candidate.source)) && (Is.undefined(candidate.relatedInformation) || Is.typedArray(candidate.relatedInformation, DiagnosticRelatedInformation.is)); } Diagnostic4.is = is; })(Diagnostic || (Diagnostic = {})); (function(Command3) { function create(title, command2, ...args) { let result = { title, command: command2 }; if (Is.defined(args) && args.length > 0) { result.arguments = args; } return result; } Command3.create = create; function is(value) { let candidate = value; return Is.defined(candidate) && Is.string(candidate.title) && Is.string(candidate.command); } Command3.is = is; })(Command || (Command = {})); (function(TextEdit2) { function replace(range, newText) { return { range, newText }; } TextEdit2.replace = replace; function insert2(position, newText) { return { range: { start: position, end: position }, newText }; } TextEdit2.insert = insert2; function del(range) { return { range, newText: "" }; } TextEdit2.del = del; function is(value) { const candidate = value; return Is.objectLiteral(candidate) && Is.string(candidate.newText) && Range2.is(candidate.range); } TextEdit2.is = is; })(TextEdit || (TextEdit = {})); (function(ChangeAnnotation2) { function create(label, needsConfirmation, description) { const result = { label }; if (needsConfirmation !== void 0) { result.needsConfirmation = needsConfirmation; } if (description !== void 0) { result.description = description; } return result; } ChangeAnnotation2.create = create; function is(value) { const candidate = value; return Is.objectLiteral(candidate) && Is.string(candidate.label) && (Is.boolean(candidate.needsConfirmation) || candidate.needsConfirmation === void 0) && (Is.string(candidate.description) || candidate.description === void 0); } ChangeAnnotation2.is = is; })(ChangeAnnotation || (ChangeAnnotation = {})); (function(ChangeAnnotationIdentifier2) { function is(value) { const candidate = value; return Is.string(candidate); } ChangeAnnotationIdentifier2.is = is; })(ChangeAnnotationIdentifier || (ChangeAnnotationIdentifier = {})); (function(AnnotatedTextEdit2) { function replace(range, newText, annotation) { return { range, newText, annotationId: annotation }; } AnnotatedTextEdit2.replace = replace; function insert2(position, newText, annotation) { return { range: { start: position, end: position }, newText, annotationId: annotation }; } AnnotatedTextEdit2.insert = insert2; function del(range, annotation) { return { range, newText: "", annotationId: annotation }; } AnnotatedTextEdit2.del = del; function is(value) { const candidate = value; return TextEdit.is(candidate) && (ChangeAnnotation.is(candidate.annotationId) || ChangeAnnotationIdentifier.is(candidate.annotationId)); } AnnotatedTextEdit2.is = is; })(AnnotatedTextEdit || (AnnotatedTextEdit = {})); (function(TextDocumentEdit2) { function create(textDocument, edits) { return { textDocument, edits }; } TextDocumentEdit2.create = create; function is(value) { let candidate = value; return Is.defined(candidate) && OptionalVersionedTextDocumentIdentifier.is(candidate.textDocument) && Array.isArray(candidate.edits); } TextDocumentEdit2.is = is; })(TextDocumentEdit || (TextDocumentEdit = {})); (function(CreateFile2) { function create(uri, options2, annotation) { let result = { kind: "create", uri }; if (options2 !== void 0 && (options2.overwrite !== void 0 || options2.ignoreIfExists !== void 0)) { result.options = options2; } if (annotation !== void 0) { result.annotationId = annotation; } return result; } CreateFile2.create = create; function is(value) { let candidate = value; return candidate && candidate.kind === "create" && Is.string(candidate.uri) && (candidate.options === void 0 || (candidate.options.overwrite === void 0 || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === void 0 || Is.boolean(candidate.options.ignoreIfExists))) && (candidate.annotationId === void 0 || ChangeAnnotationIdentifier.is(candidate.annotationId)); } CreateFile2.is = is; })(CreateFile || (CreateFile = {})); (function(RenameFile2) { function create(oldUri, newUri, options2, annotation) { let result = { kind: "rename", oldUri, newUri }; if (options2 !== void 0 && (options2.overwrite !== void 0 || options2.ignoreIfExists !== void 0)) { result.options = options2; } if (annotation !== void 0) { result.annotationId = annotation; } return result; } RenameFile2.create = create; function is(value) { let candidate = value; return candidate && candidate.kind === "rename" && Is.string(candidate.oldUri) && Is.string(candidate.newUri) && (candidate.options === void 0 || (candidate.options.overwrite === void 0 || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === void 0 || Is.boolean(candidate.options.ignoreIfExists))) && (candidate.annotationId === void 0 || ChangeAnnotationIdentifier.is(candidate.annotationId)); } RenameFile2.is = is; })(RenameFile || (RenameFile = {})); (function(DeleteFile2) { function create(uri, options2, annotation) { let result = { kind: "delete", uri }; if (options2 !== void 0 && (options2.recursive !== void 0 || options2.ignoreIfNotExists !== void 0)) { result.options = options2; } if (annotation !== void 0) { result.annotationId = annotation; } return result; } DeleteFile2.create = create; function is(value) { let candidate = value; return candidate && candidate.kind === "delete" && Is.string(candidate.uri) && (candidate.options === void 0 || (candidate.options.recursive === void 0 || Is.boolean(candidate.options.recursive)) && (candidate.options.ignoreIfNotExists === void 0 || Is.boolean(candidate.options.ignoreIfNotExists))) && (candidate.annotationId === void 0 || ChangeAnnotationIdentifier.is(candidate.annotationId)); } DeleteFile2.is = is; })(DeleteFile || (DeleteFile = {})); (function(WorkspaceEdit2) { function is(value) { let candidate = value; return candidate && (candidate.changes !== void 0 || candidate.documentChanges !== void 0) && (candidate.documentChanges === void 0 || candidate.documentChanges.every((change) => { if (Is.string(change.kind)) { return CreateFile.is(change) || RenameFile.is(change) || DeleteFile.is(change); } else { return TextDocumentEdit.is(change); } })); } WorkspaceEdit2.is = is; })(WorkspaceEdit || (WorkspaceEdit = {})); TextEditChangeImpl = class { constructor(edits, changeAnnotations) { this.edits = edits; this.changeAnnotations = changeAnnotations; } insert(position, newText, annotation) { let edit2; let id2; if (annotation === void 0) { edit2 = TextEdit.insert(position, newText); } else if (ChangeAnnotationIdentifier.is(annotation)) { id2 = annotation; edit2 = AnnotatedTextEdit.insert(position, newText, annotation); } else { this.assertChangeAnnotations(this.changeAnnotations); id2 = this.changeAnnotations.manage(annotation); edit2 = AnnotatedTextEdit.insert(position, newText, id2); } this.edits.push(edit2); if (id2 !== void 0) { return id2; } } replace(range, newText, annotation) { let edit2; let id2; if (annotation === void 0) { edit2 = TextEdit.replace(range, newText); } else if (ChangeAnnotationIdentifier.is(annotation)) { id2 = annotation; edit2 = AnnotatedTextEdit.replace(range, newText, annotation); } else { this.assertChangeAnnotations(this.changeAnnotations); id2 = this.changeAnnotations.manage(annotation); edit2 = AnnotatedTextEdit.replace(range, newText, id2); } this.edits.push(edit2); if (id2 !== void 0) { return id2; } } delete(range, annotation) { let edit2; let id2; if (annotation === void 0) { edit2 = TextEdit.del(range); } else if (ChangeAnnotationIdentifier.is(annotation)) { id2 = annotation; edit2 = AnnotatedTextEdit.del(range, annotation); } else { this.assertChangeAnnotations(this.changeAnnotations); id2 = this.changeAnnotations.manage(annotation); edit2 = AnnotatedTextEdit.del(range, id2); } this.edits.push(edit2); if (id2 !== void 0) { return id2; } } add(edit2) { this.edits.push(edit2); } all() { return this.edits; } clear() { this.edits.splice(0, this.edits.length); } assertChangeAnnotations(value) { if (value === void 0) { throw new Error(`Text edit change is not configured to manage change annotations.`); } } }; ChangeAnnotations = class { constructor(annotations) { this._annotations = annotations === void 0 ? /* @__PURE__ */ Object.create(null) : annotations; this._counter = 0; this._size = 0; } all() { return this._annotations; } get size() { return this._size; } manage(idOrAnnotation, annotation) { let id2; if (ChangeAnnotationIdentifier.is(idOrAnnotation)) { id2 = idOrAnnotation; } else { id2 = this.nextId(); annotation = idOrAnnotation; } if (this._annotations[id2] !== void 0) { throw new Error(`Id ${id2} is already in use.`); } if (annotation === void 0) { throw new Error(`No annotation provided for id ${id2}`); } this._annotations[id2] = annotation; this._size++; return id2; } nextId() { this._counter++; return this._counter.toString(); } }; WorkspaceChange = class { constructor(workspaceEdit) { this._textEditChanges = /* @__PURE__ */ Object.create(null); if (workspaceEdit !== void 0) { this._workspaceEdit = workspaceEdit; if (workspaceEdit.documentChanges) { this._changeAnnotations = new ChangeAnnotations(workspaceEdit.changeAnnotations); workspaceEdit.changeAnnotations = this._changeAnnotations.all(); workspaceEdit.documentChanges.forEach((change) => { if (TextDocumentEdit.is(change)) { const textEditChange = new TextEditChangeImpl(change.edits, this._changeAnnotations); this._textEditChanges[change.textDocument.uri] = textEditChange; } }); } else if (workspaceEdit.changes) { Object.keys(workspaceEdit.changes).forEach((key) => { const textEditChange = new TextEditChangeImpl(workspaceEdit.changes[key]); this._textEditChanges[key] = textEditChange; }); } } else { this._workspaceEdit = {}; } } /** * Returns the underlying {@link WorkspaceEdit} literal * use to be returned from a workspace edit operation like rename. */ get edit() { this.initDocumentChanges(); if (this._changeAnnotations !== void 0) { if (this._changeAnnotations.size === 0) { this._workspaceEdit.changeAnnotations = void 0; } else { this._workspaceEdit.changeAnnotations = this._changeAnnotations.all(); } } return this._workspaceEdit; } getTextEditChange(key) { if (OptionalVersionedTextDocumentIdentifier.is(key)) { this.initDocumentChanges(); if (this._workspaceEdit.documentChanges === void 0) { throw new Error("Workspace edit is not configured for document changes."); } const textDocument = { uri: key.uri, version: key.version }; let result = this._textEditChanges[textDocument.uri]; if (!result) { const edits = []; const textDocumentEdit = { textDocument, edits }; this._workspaceEdit.documentChanges.push(textDocumentEdit); result = new TextEditChangeImpl(edits, this._changeAnnotations); this._textEditChanges[textDocument.uri] = result; } return result; } else { this.initChanges(); if (this._workspaceEdit.changes === void 0) { throw new Error("Workspace edit is not configured for normal text edit changes."); } let result = this._textEditChanges[key]; if (!result) { let edits = []; this._workspaceEdit.changes[key] = edits; result = new TextEditChangeImpl(edits); this._textEditChanges[key] = result; } return result; } } initDocumentChanges() { if (this._workspaceEdit.documentChanges === void 0 && this._workspaceEdit.changes === void 0) { this._changeAnnotations = new ChangeAnnotations(); this._workspaceEdit.documentChanges = []; this._workspaceEdit.changeAnnotations = this._changeAnnotations.all(); } } initChanges() { if (this._workspaceEdit.documentChanges === void 0 && this._workspaceEdit.changes === void 0) { this._workspaceEdit.changes = /* @__PURE__ */ Object.create(null); } } createFile(uri, optionsOrAnnotation, options2) { this.initDocumentChanges(); if (this._workspaceEdit.documentChanges === void 0) { throw new Error("Workspace edit is not configured for document changes."); } let annotation; if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) { annotation = optionsOrAnnotation; } else { options2 = optionsOrAnnotation; } let operation; let id2; if (annotation === void 0) { operation = CreateFile.create(uri, options2); } else { id2 = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation); operation = CreateFile.create(uri, options2, id2); } this._workspaceEdit.documentChanges.push(operation); if (id2 !== void 0) { return id2; } } renameFile(oldUri, newUri, optionsOrAnnotation, options2) { this.initDocumentChanges(); if (this._workspaceEdit.documentChanges === void 0) { throw new Error("Workspace edit is not configured for document changes."); } let annotation; if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) { annotation = optionsOrAnnotation; } else { options2 = optionsOrAnnotation; } let operation; let id2; if (annotation === void 0) { operation = RenameFile.create(oldUri, newUri, options2); } else { id2 = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation); operation = RenameFile.create(oldUri, newUri, options2, id2); } this._workspaceEdit.documentChanges.push(operation); if (id2 !== void 0) { return id2; } } deleteFile(uri, optionsOrAnnotation, options2) { this.initDocumentChanges(); if (this._workspaceEdit.documentChanges === void 0) { throw new Error("Workspace edit is not configured for document changes."); } let annotation; if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) { annotation = optionsOrAnnotation; } else { options2 = optionsOrAnnotation; } let operation; let id2; if (annotation === void 0) { operation = DeleteFile.create(uri, options2); } else { id2 = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation); operation = DeleteFile.create(uri, options2, id2); } this._workspaceEdit.documentChanges.push(operation); if (id2 !== void 0) { return id2; } } }; (function(TextDocumentIdentifier2) { function create(uri) { return { uri }; } TextDocumentIdentifier2.create = create; function is(value) { let candidate = value; return Is.defined(candidate) && Is.string(candidate.uri); } TextDocumentIdentifier2.is = is; })(TextDocumentIdentifier || (TextDocumentIdentifier = {})); (function(VersionedTextDocumentIdentifier2) { function create(uri, version) { return { uri, version }; } VersionedTextDocumentIdentifier2.create = create; function is(value) { let candidate = value; return Is.defined(candidate) && Is.string(candidate.uri) && Is.integer(candidate.version); } VersionedTextDocumentIdentifier2.is = is; })(VersionedTextDocumentIdentifier || (VersionedTextDocumentIdentifier = {})); (function(OptionalVersionedTextDocumentIdentifier2) { function create(uri, version) { return { uri, version }; } OptionalVersionedTextDocumentIdentifier2.create = create; function is(value) { let candidate = value; return Is.defined(candidate) && Is.string(candidate.uri) && (candidate.version === null || Is.integer(candidate.version)); } OptionalVersionedTextDocumentIdentifier2.is = is; })(OptionalVersionedTextDocumentIdentifier || (OptionalVersionedTextDocumentIdentifier = {})); (function(TextDocumentItem3) { function create(uri, languageId, version, text) { return { uri, languageId, version, text }; } TextDocumentItem3.create = create; function is(value) { let candidate = value; return Is.defined(candidate) && Is.string(candidate.uri) && Is.string(candidate.languageId) && Is.integer(candidate.version) && Is.string(candidate.text); } TextDocumentItem3.is = is; })(TextDocumentItem || (TextDocumentItem = {})); (function(MarkupKind2) { MarkupKind2.PlainText = "plaintext"; MarkupKind2.Markdown = "markdown"; function is(value) { const candidate = value; return candidate === MarkupKind2.PlainText || candidate === MarkupKind2.Markdown; } MarkupKind2.is = is; })(MarkupKind || (MarkupKind = {})); (function(MarkupContent4) { function is(value) { const candidate = value; return Is.objectLiteral(value) && MarkupKind.is(candidate.kind) && Is.string(candidate.value); } MarkupContent4.is = is; })(MarkupContent || (MarkupContent = {})); (function(CompletionItemKind3) { CompletionItemKind3.Text = 1; CompletionItemKind3.Method = 2; CompletionItemKind3.Function = 3; CompletionItemKind3.Constructor = 4; CompletionItemKind3.Field = 5; CompletionItemKind3.Variable = 6; CompletionItemKind3.Class = 7; CompletionItemKind3.Interface = 8; CompletionItemKind3.Module = 9; CompletionItemKind3.Property = 10; CompletionItemKind3.Unit = 11; CompletionItemKind3.Value = 12; CompletionItemKind3.Enum = 13; CompletionItemKind3.Keyword = 14; CompletionItemKind3.Snippet = 15; CompletionItemKind3.Color = 16; CompletionItemKind3.File = 17; CompletionItemKind3.Reference = 18; CompletionItemKind3.Folder = 19; CompletionItemKind3.EnumMember = 20; CompletionItemKind3.Constant = 21; CompletionItemKind3.Struct = 22; CompletionItemKind3.Event = 23; CompletionItemKind3.Operator = 24; CompletionItemKind3.TypeParameter = 25; })(CompletionItemKind || (CompletionItemKind = {})); (function(InsertTextFormat2) { InsertTextFormat2.PlainText = 1; InsertTextFormat2.Snippet = 2; })(InsertTextFormat || (InsertTextFormat = {})); (function(CompletionItemTag2) { CompletionItemTag2.Deprecated = 1; })(CompletionItemTag || (CompletionItemTag = {})); (function(InsertReplaceEdit2) { function create(newText, insert2, replace) { return { newText, insert: insert2, replace }; } InsertReplaceEdit2.create = create; function is(value) { const candidate = value; return candidate && Is.string(candidate.newText) && Range2.is(candidate.insert) && Range2.is(candidate.replace); } InsertReplaceEdit2.is = is; })(InsertReplaceEdit || (InsertReplaceEdit = {})); (function(InsertTextMode2) { InsertTextMode2.asIs = 1; InsertTextMode2.adjustIndentation = 2; })(InsertTextMode || (InsertTextMode = {})); (function(CompletionItemLabelDetails2) { function is(value) { const candidate = value; return candidate && (Is.string(candidate.detail) || candidate.detail === void 0) && (Is.string(candidate.description) || candidate.description === void 0); } CompletionItemLabelDetails2.is = is; })(CompletionItemLabelDetails || (CompletionItemLabelDetails = {})); (function(CompletionItem3) { function create(label) { return { label }; } CompletionItem3.create = create; })(CompletionItem || (CompletionItem = {})); (function(CompletionList3) { function create(items, isIncomplete) { return { items: items ? items : [], isIncomplete: !!isIncomplete }; } CompletionList3.create = create; })(CompletionList || (CompletionList = {})); (function(MarkedString2) { function fromPlainText(plainText) { return plainText.replace(/[\\`*_{}[\]()#+\-.!]/g, "\\$&"); } MarkedString2.fromPlainText = fromPlainText; function is(value) { const candidate = value; return Is.string(candidate) || Is.objectLiteral(candidate) && Is.string(candidate.language) && Is.string(candidate.value); } MarkedString2.is = is; })(MarkedString || (MarkedString = {})); (function(Hover2) { function is(value) { let candidate = value; return !!candidate && Is.objectLiteral(candidate) && (MarkupContent.is(candidate.contents) || MarkedString.is(candidate.contents) || Is.typedArray(candidate.contents, MarkedString.is)) && (value.range === void 0 || Range2.is(value.range)); } Hover2.is = is; })(Hover || (Hover = {})); (function(ParameterInformation2) { function create(label, documentation) { return documentation ? { label, documentation } : { label }; } ParameterInformation2.create = create; })(ParameterInformation || (ParameterInformation = {})); (function(SignatureInformation2) { function create(label, documentation, ...parameters) { let result = { label }; if (Is.defined(documentation)) { result.documentation = documentation; } if (Is.defined(parameters)) { result.parameters = parameters; } else { result.parameters = []; } return result; } SignatureInformation2.create = create; })(SignatureInformation || (SignatureInformation = {})); (function(DocumentHighlightKind2) { DocumentHighlightKind2.Text = 1; DocumentHighlightKind2.Read = 2; DocumentHighlightKind2.Write = 3; })(DocumentHighlightKind || (DocumentHighlightKind = {})); (function(DocumentHighlight2) { function create(range, kind) { let result = { range }; if (Is.number(kind)) { result.kind = kind; } return result; } DocumentHighlight2.create = create; })(DocumentHighlight || (DocumentHighlight = {})); (function(SymbolKind2) { SymbolKind2.File = 1; SymbolKind2.Module = 2; SymbolKind2.Namespace = 3; SymbolKind2.Package = 4; SymbolKind2.Class = 5; SymbolKind2.Method = 6; SymbolKind2.Property = 7; SymbolKind2.Field = 8; SymbolKind2.Constructor = 9; SymbolKind2.Enum = 10; SymbolKind2.Interface = 11; SymbolKind2.Function = 12; SymbolKind2.Variable = 13; SymbolKind2.Constant = 14; SymbolKind2.String = 15; SymbolKind2.Number = 16; SymbolKind2.Boolean = 17; SymbolKind2.Array = 18; SymbolKind2.Object = 19; SymbolKind2.Key = 20; SymbolKind2.Null = 21; SymbolKind2.EnumMember = 22; SymbolKind2.Struct = 23; SymbolKind2.Event = 24; SymbolKind2.Operator = 25; SymbolKind2.TypeParameter = 26; })(SymbolKind || (SymbolKind = {})); (function(SymbolTag2) { SymbolTag2.Deprecated = 1; })(SymbolTag || (SymbolTag = {})); (function(SymbolInformation2) { function create(name2, kind, range, uri, containerName) { let result = { name: name2, kind, location: { uri, range } }; if (containerName) { result.containerName = containerName; } return result; } SymbolInformation2.create = create; })(SymbolInformation || (SymbolInformation = {})); (function(WorkspaceSymbol2) { function create(name2, kind, uri, range) { return range !== void 0 ? { name: name2, kind, location: { uri, range } } : { name: name2, kind, location: { uri } }; } WorkspaceSymbol2.create = create; })(WorkspaceSymbol || (WorkspaceSymbol = {})); (function(DocumentSymbol2) { function create(name2, detail, kind, range, selectionRange, children) { let result = { name: name2, detail, kind, range, selectionRange }; if (children !== void 0) { result.children = children; } return result; } DocumentSymbol2.create = create; function is(value) { let candidate = value; return candidate && Is.string(candidate.name) && Is.number(candidate.kind) && Range2.is(candidate.range) && Range2.is(candidate.selectionRange) && (candidate.detail === void 0 || Is.string(candidate.detail)) && (candidate.deprecated === void 0 || Is.boolean(candidate.deprecated)) && (candidate.children === void 0 || Array.isArray(candidate.children)) && (candidate.tags === void 0 || Array.isArray(candidate.tags)); } DocumentSymbol2.is = is; })(DocumentSymbol || (DocumentSymbol = {})); (function(CodeActionKind2) { CodeActionKind2.Empty = ""; CodeActionKind2.QuickFix = "quickfix"; CodeActionKind2.Refactor = "refactor"; CodeActionKind2.RefactorExtract = "refactor.extract"; CodeActionKind2.RefactorInline = "refactor.inline"; CodeActionKind2.RefactorRewrite = "refactor.rewrite"; CodeActionKind2.Source = "source"; CodeActionKind2.SourceOrganizeImports = "source.organizeImports"; CodeActionKind2.SourceFixAll = "source.fixAll"; })(CodeActionKind || (CodeActionKind = {})); (function(CodeActionTriggerKind2) { CodeActionTriggerKind2.Invoked = 1; CodeActionTriggerKind2.Automatic = 2; })(CodeActionTriggerKind || (CodeActionTriggerKind = {})); (function(CodeActionContext2) { function create(diagnostics, only, triggerKind) { let result = { diagnostics }; if (only !== void 0 && only !== null) { result.only = only; } if (triggerKind !== void 0 && triggerKind !== null) { result.triggerKind = triggerKind; } return result; } CodeActionContext2.create = create; function is(value) { let candidate = value; return Is.defined(candidate) && Is.typedArray(candidate.diagnostics, Diagnostic.is) && (candidate.only === void 0 || Is.typedArray(candidate.only, Is.string)) && (candidate.triggerKind === void 0 || candidate.triggerKind === CodeActionTriggerKind.Invoked || candidate.triggerKind === CodeActionTriggerKind.Automatic); } CodeActionContext2.is = is; })(CodeActionContext || (CodeActionContext = {})); (function(CodeAction2) { function create(title, kindOrCommandOrEdit, kind) { let result = { title }; let checkKind = true; if (typeof kindOrCommandOrEdit === "string") { checkKind = false; result.kind = kindOrCommandOrEdit; } else if (Command.is(kindOrCommandOrEdit)) { result.command = kindOrCommandOrEdit; } else { result.edit = kindOrCommandOrEdit; } if (checkKind && kind !== void 0) { result.kind = kind; } return result; } CodeAction2.create = create; function is(value) { let candidate = value; return candidate && Is.string(candidate.title) && (candidate.diagnostics === void 0 || Is.typedArray(candidate.diagnostics, Diagnostic.is)) && (candidate.kind === void 0 || Is.string(candidate.kind)) && (candidate.edit !== void 0 || candidate.command !== void 0) && (candidate.command === void 0 || Command.is(candidate.command)) && (candidate.isPreferred === void 0 || Is.boolean(candidate.isPreferred)) && (candidate.edit === void 0 || WorkspaceEdit.is(candidate.edit)); } CodeAction2.is = is; })(CodeAction || (CodeAction = {})); (function(CodeLens2) { function create(range, data) { let result = { range }; if (Is.defined(data)) { result.data = data; } return result; } CodeLens2.create = create; function is(value) { let candidate = value; return Is.defined(candidate) && Range2.is(candidate.range) && (Is.undefined(candidate.command) || Command.is(candidate.command)); } CodeLens2.is = is; })(CodeLens || (CodeLens = {})); (function(FormattingOptions2) { function create(tabSize, insertSpaces) { return { tabSize, insertSpaces }; } FormattingOptions2.create = create; function is(value) { let candidate = value; return Is.defined(candidate) && Is.uinteger(candidate.tabSize) && Is.boolean(candidate.insertSpaces); } FormattingOptions2.is = is; })(FormattingOptions || (FormattingOptions = {})); (function(DocumentLink2) { function create(range, target, data) { return { range, target, data }; } DocumentLink2.create = create; function is(value) { let candidate = value; return Is.defined(candidate) && Range2.is(candidate.range) && (Is.undefined(candidate.target) || Is.string(candidate.target)); } DocumentLink2.is = is; })(DocumentLink || (DocumentLink = {})); (function(SelectionRange3) { function create(range, parent) { return { range, parent }; } SelectionRange3.create = create; function is(value) { let candidate = value; return Is.objectLiteral(candidate) && Range2.is(candidate.range) && (candidate.parent === void 0 || SelectionRange3.is(candidate.parent)); } SelectionRange3.is = is; })(SelectionRange2 || (SelectionRange2 = {})); (function(SemanticTokenTypes2) { SemanticTokenTypes2["namespace"] = "namespace"; SemanticTokenTypes2["type"] = "type"; SemanticTokenTypes2["class"] = "class"; SemanticTokenTypes2["enum"] = "enum"; SemanticTokenTypes2["interface"] = "interface"; SemanticTokenTypes2["struct"] = "struct"; SemanticTokenTypes2["typeParameter"] = "typeParameter"; SemanticTokenTypes2["parameter"] = "parameter"; SemanticTokenTypes2["variable"] = "variable"; SemanticTokenTypes2["property"] = "property"; SemanticTokenTypes2["enumMember"] = "enumMember"; SemanticTokenTypes2["event"] = "event"; SemanticTokenTypes2["function"] = "function"; SemanticTokenTypes2["method"] = "method"; SemanticTokenTypes2["macro"] = "macro"; SemanticTokenTypes2["keyword"] = "keyword"; SemanticTokenTypes2["modifier"] = "modifier"; SemanticTokenTypes2["comment"] = "comment"; SemanticTokenTypes2["string"] = "string"; SemanticTokenTypes2["number"] = "number"; SemanticTokenTypes2["regexp"] = "regexp"; SemanticTokenTypes2["operator"] = "operator"; SemanticTokenTypes2["decorator"] = "decorator"; })(SemanticTokenTypes || (SemanticTokenTypes = {})); (function(SemanticTokenModifiers2) { SemanticTokenModifiers2["declaration"] = "declaration"; SemanticTokenModifiers2["definition"] = "definition"; SemanticTokenModifiers2["readonly"] = "readonly"; SemanticTokenModifiers2["static"] = "static"; SemanticTokenModifiers2["deprecated"] = "deprecated"; SemanticTokenModifiers2["abstract"] = "abstract"; SemanticTokenModifiers2["async"] = "async"; SemanticTokenModifiers2["modification"] = "modification"; SemanticTokenModifiers2["documentation"] = "documentation"; SemanticTokenModifiers2["defaultLibrary"] = "defaultLibrary"; })(SemanticTokenModifiers || (SemanticTokenModifiers = {})); (function(SemanticTokens2) { function is(value) { const candidate = value; return Is.objectLiteral(candidate) && (candidate.resultId === void 0 || typeof candidate.resultId === "string") && Array.isArray(candidate.data) && (candidate.data.length === 0 || typeof candidate.data[0] === "number"); } SemanticTokens2.is = is; })(SemanticTokens || (SemanticTokens = {})); (function(InlineValueText2) { function create(range, text) { return { range, text }; } InlineValueText2.create = create; function is(value) { const candidate = value; return candidate !== void 0 && candidate !== null && Range2.is(candidate.range) && Is.string(candidate.text); } InlineValueText2.is = is; })(InlineValueText || (InlineValueText = {})); (function(InlineValueVariableLookup2) { function create(range, variableName, caseSensitiveLookup) { return { range, variableName, caseSensitiveLookup }; } InlineValueVariableLookup2.create = create; function is(value) { const candidate = value; return candidate !== void 0 && candidate !== null && Range2.is(candidate.range) && Is.boolean(candidate.caseSensitiveLookup) && (Is.string(candidate.variableName) || candidate.variableName === void 0); } InlineValueVariableLookup2.is = is; })(InlineValueVariableLookup || (InlineValueVariableLookup = {})); (function(InlineValueEvaluatableExpression2) { function create(range, expression) { return { range, expression }; } InlineValueEvaluatableExpression2.create = create; function is(value) { const candidate = value; return candidate !== void 0 && candidate !== null && Range2.is(candidate.range) && (Is.string(candidate.expression) || candidate.expression === void 0); } InlineValueEvaluatableExpression2.is = is; })(InlineValueEvaluatableExpression || (InlineValueEvaluatableExpression = {})); (function(InlineValueContext2) { function create(frameId, stoppedLocation) { return { frameId, stoppedLocation }; } InlineValueContext2.create = create; function is(value) { const candidate = value; return Is.defined(candidate) && Range2.is(value.stoppedLocation); } InlineValueContext2.is = is; })(InlineValueContext || (InlineValueContext = {})); (function(InlayHintKind2) { InlayHintKind2.Type = 1; InlayHintKind2.Parameter = 2; function is(value) { return value === 1 || value === 2; } InlayHintKind2.is = is; })(InlayHintKind || (InlayHintKind = {})); (function(InlayHintLabelPart2) { function create(value) { return { value }; } InlayHintLabelPart2.create = create; function is(value) { const candidate = value; return Is.objectLiteral(candidate) && (candidate.tooltip === void 0 || Is.string(candidate.tooltip) || MarkupContent.is(candidate.tooltip)) && (candidate.location === void 0 || Location.is(candidate.location)) && (candidate.command === void 0 || Command.is(candidate.command)); } InlayHintLabelPart2.is = is; })(InlayHintLabelPart || (InlayHintLabelPart = {})); (function(InlayHint2) { function create(position, label, kind) { const result = { position, label }; if (kind !== void 0) { result.kind = kind; } return result; } InlayHint2.create = create; function is(value) { const candidate = value; return Is.objectLiteral(candidate) && Position.is(candidate.position) && (Is.string(candidate.label) || Is.typedArray(candidate.label, InlayHintLabelPart.is)) && (candidate.kind === void 0 || InlayHintKind.is(candidate.kind)) && candidate.textEdits === void 0 || Is.typedArray(candidate.textEdits, TextEdit.is) && (candidate.tooltip === void 0 || Is.string(candidate.tooltip) || MarkupContent.is(candidate.tooltip)) && (candidate.paddingLeft === void 0 || Is.boolean(candidate.paddingLeft)) && (candidate.paddingRight === void 0 || Is.boolean(candidate.paddingRight)); } InlayHint2.is = is; })(InlayHint || (InlayHint = {})); (function(StringValue2) { function createSnippet(value) { return { kind: "snippet", value }; } StringValue2.createSnippet = createSnippet; })(StringValue || (StringValue = {})); (function(InlineCompletionItem2) { function create(insertText, filterText, range, command2) { return { insertText, filterText, range, command: command2 }; } InlineCompletionItem2.create = create; })(InlineCompletionItem || (InlineCompletionItem = {})); (function(InlineCompletionList2) { function create(items) { return { items }; } InlineCompletionList2.create = create; })(InlineCompletionList || (InlineCompletionList = {})); (function(InlineCompletionTriggerKind2) { InlineCompletionTriggerKind2.Invoked = 0; InlineCompletionTriggerKind2.Automatic = 1; })(InlineCompletionTriggerKind || (InlineCompletionTriggerKind = {})); (function(SelectedCompletionInfo2) { function create(range, text) { return { range, text }; } SelectedCompletionInfo2.create = create; })(SelectedCompletionInfo || (SelectedCompletionInfo = {})); (function(InlineCompletionContext2) { function create(triggerKind, selectedCompletionInfo) { return { triggerKind, selectedCompletionInfo }; } InlineCompletionContext2.create = create; })(InlineCompletionContext || (InlineCompletionContext = {})); (function(WorkspaceFolder2) { function is(value) { const candidate = value; return Is.objectLiteral(candidate) && URI.is(candidate.uri) && Is.string(candidate.name); } WorkspaceFolder2.is = is; })(WorkspaceFolder || (WorkspaceFolder = {})); EOL = ["\n", "\r\n", "\r"]; (function(TextDocument2) { function create(uri, languageId, version, content2) { return new FullTextDocument(uri, languageId, version, content2); } TextDocument2.create = create; function is(value) { let candidate = value; return Is.defined(candidate) && Is.string(candidate.uri) && (Is.undefined(candidate.languageId) || Is.string(candidate.languageId)) && Is.uinteger(candidate.lineCount) && Is.func(candidate.getText) && Is.func(candidate.positionAt) && Is.func(candidate.offsetAt) ? true : false; } TextDocument2.is = is; function applyEdits(document2, edits) { let text = document2.getText(); let sortedEdits = mergeSort(edits, (a, b) => { let diff = a.range.start.line - b.range.start.line; if (diff === 0) { return a.range.start.character - b.range.start.character; } return diff; }); let lastModifiedOffset = text.length; for (let i = sortedEdits.length - 1; i >= 0; i--) { let e = sortedEdits[i]; let startOffset = document2.offsetAt(e.range.start); let endOffset = document2.offsetAt(e.range.end); if (endOffset <= lastModifiedOffset) { text = text.substring(0, startOffset) + e.newText + text.substring(endOffset, text.length); } else { throw new Error("Overlapping edit"); } lastModifiedOffset = startOffset; } return text; } TextDocument2.applyEdits = applyEdits; function mergeSort(data, compare2) { if (data.length <= 1) { return data; } const p = data.length / 2 | 0; const left = data.slice(0, p); const right = data.slice(p); mergeSort(left, compare2); mergeSort(right, compare2); let leftIdx = 0; let rightIdx = 0; let i = 0; while (leftIdx < left.length && rightIdx < right.length) { let ret = compare2(left[leftIdx], right[rightIdx]); if (ret <= 0) { data[i++] = left[leftIdx++]; } else { data[i++] = right[rightIdx++]; } } while (leftIdx < left.length) { data[i++] = left[leftIdx++]; } while (rightIdx < right.length) { data[i++] = right[rightIdx++]; } return data; } })(TextDocument || (TextDocument = {})); FullTextDocument = class { constructor(uri, languageId, version, content2) { this._uri = uri; this._languageId = languageId; this._version = version; this._content = content2; this._lineOffsets = void 0; } get uri() { return this._uri; } get languageId() { return this._languageId; } get version() { return this._version; } getText(range) { if (range) { let start = this.offsetAt(range.start); let end = this.offsetAt(range.end); return this._content.substring(start, end); } return this._content; } update(event, version) { this._content = event.text; this._version = version; this._lineOffsets = void 0; } getLineOffsets() { if (this._lineOffsets === void 0) { let lineOffsets = []; let text = this._content; let isLineStart = true; for (let i = 0; i < text.length; i++) { if (isLineStart) { lineOffsets.push(i); isLineStart = false; } let ch = text.charAt(i); isLineStart = ch === "\r" || ch === "\n"; if (ch === "\r" && i + 1 < text.length && text.charAt(i + 1) === "\n") { i++; } } if (isLineStart && text.length > 0) { lineOffsets.push(text.length); } this._lineOffsets = lineOffsets; } return this._lineOffsets; } positionAt(offset) { offset = Math.max(Math.min(offset, this._content.length), 0); let lineOffsets = this.getLineOffsets(); let low = 0, high = lineOffsets.length; if (high === 0) { return Position.create(0, offset); } while (low < high) { let mid = Math.floor((low + high) / 2); if (lineOffsets[mid] > offset) { high = mid; } else { low = mid + 1; } } let line = low - 1; return Position.create(line, offset - lineOffsets[line]); } offsetAt(position) { let lineOffsets = this.getLineOffsets(); if (position.line >= lineOffsets.length) { return this._content.length; } else if (position.line < 0) { return 0; } let lineOffset = lineOffsets[position.line]; let nextLineOffset = position.line + 1 < lineOffsets.length ? lineOffsets[position.line + 1] : this._content.length; return Math.max(Math.min(lineOffset + position.character, nextLineOffset), lineOffset); } get lineCount() { return this.getLineOffsets().length; } }; (function(Is2) { const toString = Object.prototype.toString; function defined(value) { return typeof value !== "undefined"; } Is2.defined = defined; function undefined2(value) { return typeof value === "undefined"; } Is2.undefined = undefined2; function boolean(value) { return value === true || value === false; } Is2.boolean = boolean; function string2(value) { return toString.call(value) === "[object String]"; } Is2.string = string2; function number2(value) { return toString.call(value) === "[object Number]"; } Is2.number = number2; function numberRange(value, min, max) { return toString.call(value) === "[object Number]" && min <= value && value <= max; } Is2.numberRange = numberRange; function integer2(value) { return toString.call(value) === "[object Number]" && -2147483648 <= value && value <= 2147483647; } Is2.integer = integer2; function uinteger2(value) { return toString.call(value) === "[object Number]" && 0 <= value && value <= 2147483647; } Is2.uinteger = uinteger2; function func(value) { return toString.call(value) === "[object Function]"; } Is2.func = func; function objectLiteral(value) { return value !== null && typeof value === "object"; } Is2.objectLiteral = objectLiteral; function typedArray(value, check) { return Array.isArray(value) && value.every(check); } Is2.typedArray = typedArray; })(Is || (Is = {})); } }); // node_modules/vscode-languageserver-protocol/lib/common/messages.js var require_messages2 = __commonJS({ "node_modules/vscode-languageserver-protocol/lib/common/messages.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ProtocolNotificationType = exports.ProtocolNotificationType0 = exports.ProtocolRequestType = exports.ProtocolRequestType0 = exports.RegistrationType = exports.MessageDirection = void 0; var vscode_jsonrpc_1 = require_main(); var MessageDirection; (function(MessageDirection2) { MessageDirection2["clientToServer"] = "clientToServer"; MessageDirection2["serverToClient"] = "serverToClient"; MessageDirection2["both"] = "both"; })(MessageDirection || (exports.MessageDirection = MessageDirection = {})); var RegistrationType = class { constructor(method) { this.method = method; } }; exports.RegistrationType = RegistrationType; var ProtocolRequestType0 = class extends vscode_jsonrpc_1.RequestType0 { constructor(method) { super(method); } }; exports.ProtocolRequestType0 = ProtocolRequestType0; var ProtocolRequestType = class extends vscode_jsonrpc_1.RequestType { constructor(method) { super(method, vscode_jsonrpc_1.ParameterStructures.byName); } }; exports.ProtocolRequestType = ProtocolRequestType; var ProtocolNotificationType0 = class extends vscode_jsonrpc_1.NotificationType0 { constructor(method) { super(method); } }; exports.ProtocolNotificationType0 = ProtocolNotificationType0; var ProtocolNotificationType = class extends vscode_jsonrpc_1.NotificationType { constructor(method) { super(method, vscode_jsonrpc_1.ParameterStructures.byName); } }; exports.ProtocolNotificationType = ProtocolNotificationType; } }); // node_modules/vscode-languageserver-protocol/lib/common/utils/is.js var require_is2 = __commonJS({ "node_modules/vscode-languageserver-protocol/lib/common/utils/is.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.objectLiteral = exports.typedArray = exports.stringArray = exports.array = exports.func = exports.error = exports.number = exports.string = exports.boolean = void 0; function boolean(value) { return value === true || value === false; } exports.boolean = boolean; function string2(value) { return typeof value === "string" || value instanceof String; } exports.string = string2; function number2(value) { return typeof value === "number" || value instanceof Number; } exports.number = number2; function error(value) { return value instanceof Error; } exports.error = error; function func(value) { return typeof value === "function"; } exports.func = func; function array(value) { return Array.isArray(value); } exports.array = array; function stringArray(value) { return array(value) && value.every((elem) => string2(elem)); } exports.stringArray = stringArray; function typedArray(value, check) { return Array.isArray(value) && value.every(check); } exports.typedArray = typedArray; function objectLiteral(value) { return value !== null && typeof value === "object"; } exports.objectLiteral = objectLiteral; } }); // node_modules/vscode-languageserver-protocol/lib/common/protocol.implementation.js var require_protocol_implementation = __commonJS({ "node_modules/vscode-languageserver-protocol/lib/common/protocol.implementation.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ImplementationRequest = void 0; var messages_1 = require_messages2(); var ImplementationRequest; (function(ImplementationRequest2) { ImplementationRequest2.method = "textDocument/implementation"; ImplementationRequest2.messageDirection = messages_1.MessageDirection.clientToServer; ImplementationRequest2.type = new messages_1.ProtocolRequestType(ImplementationRequest2.method); })(ImplementationRequest || (exports.ImplementationRequest = ImplementationRequest = {})); } }); // node_modules/vscode-languageserver-protocol/lib/common/protocol.typeDefinition.js var require_protocol_typeDefinition = __commonJS({ "node_modules/vscode-languageserver-protocol/lib/common/protocol.typeDefinition.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.TypeDefinitionRequest = void 0; var messages_1 = require_messages2(); var TypeDefinitionRequest; (function(TypeDefinitionRequest2) { TypeDefinitionRequest2.method = "textDocument/typeDefinition"; TypeDefinitionRequest2.messageDirection = messages_1.MessageDirection.clientToServer; TypeDefinitionRequest2.type = new messages_1.ProtocolRequestType(TypeDefinitionRequest2.method); })(TypeDefinitionRequest || (exports.TypeDefinitionRequest = TypeDefinitionRequest = {})); } }); // node_modules/vscode-languageserver-protocol/lib/common/protocol.workspaceFolder.js var require_protocol_workspaceFolder = __commonJS({ "node_modules/vscode-languageserver-protocol/lib/common/protocol.workspaceFolder.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.DidChangeWorkspaceFoldersNotification = exports.WorkspaceFoldersRequest = void 0; var messages_1 = require_messages2(); var WorkspaceFoldersRequest; (function(WorkspaceFoldersRequest2) { WorkspaceFoldersRequest2.method = "workspace/workspaceFolders"; WorkspaceFoldersRequest2.messageDirection = messages_1.MessageDirection.serverToClient; WorkspaceFoldersRequest2.type = new messages_1.ProtocolRequestType0(WorkspaceFoldersRequest2.method); })(WorkspaceFoldersRequest || (exports.WorkspaceFoldersRequest = WorkspaceFoldersRequest = {})); var DidChangeWorkspaceFoldersNotification; (function(DidChangeWorkspaceFoldersNotification2) { DidChangeWorkspaceFoldersNotification2.method = "workspace/didChangeWorkspaceFolders"; DidChangeWorkspaceFoldersNotification2.messageDirection = messages_1.MessageDirection.clientToServer; DidChangeWorkspaceFoldersNotification2.type = new messages_1.ProtocolNotificationType(DidChangeWorkspaceFoldersNotification2.method); })(DidChangeWorkspaceFoldersNotification || (exports.DidChangeWorkspaceFoldersNotification = DidChangeWorkspaceFoldersNotification = {})); } }); // node_modules/vscode-languageserver-protocol/lib/common/protocol.configuration.js var require_protocol_configuration = __commonJS({ "node_modules/vscode-languageserver-protocol/lib/common/protocol.configuration.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ConfigurationRequest = void 0; var messages_1 = require_messages2(); var ConfigurationRequest; (function(ConfigurationRequest2) { ConfigurationRequest2.method = "workspace/configuration"; ConfigurationRequest2.messageDirection = messages_1.MessageDirection.serverToClient; ConfigurationRequest2.type = new messages_1.ProtocolRequestType(ConfigurationRequest2.method); })(ConfigurationRequest || (exports.ConfigurationRequest = ConfigurationRequest = {})); } }); // node_modules/vscode-languageserver-protocol/lib/common/protocol.colorProvider.js var require_protocol_colorProvider = __commonJS({ "node_modules/vscode-languageserver-protocol/lib/common/protocol.colorProvider.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ColorPresentationRequest = exports.DocumentColorRequest = void 0; var messages_1 = require_messages2(); var DocumentColorRequest; (function(DocumentColorRequest2) { DocumentColorRequest2.method = "textDocument/documentColor"; DocumentColorRequest2.messageDirection = messages_1.MessageDirection.clientToServer; DocumentColorRequest2.type = new messages_1.ProtocolRequestType(DocumentColorRequest2.method); })(DocumentColorRequest || (exports.DocumentColorRequest = DocumentColorRequest = {})); var ColorPresentationRequest; (function(ColorPresentationRequest2) { ColorPresentationRequest2.method = "textDocument/colorPresentation"; ColorPresentationRequest2.messageDirection = messages_1.MessageDirection.clientToServer; ColorPresentationRequest2.type = new messages_1.ProtocolRequestType(ColorPresentationRequest2.method); })(ColorPresentationRequest || (exports.ColorPresentationRequest = ColorPresentationRequest = {})); } }); // node_modules/vscode-languageserver-protocol/lib/common/protocol.foldingRange.js var require_protocol_foldingRange = __commonJS({ "node_modules/vscode-languageserver-protocol/lib/common/protocol.foldingRange.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.FoldingRangeRefreshRequest = exports.FoldingRangeRequest = void 0; var messages_1 = require_messages2(); var FoldingRangeRequest; (function(FoldingRangeRequest2) { FoldingRangeRequest2.method = "textDocument/foldingRange"; FoldingRangeRequest2.messageDirection = messages_1.MessageDirection.clientToServer; FoldingRangeRequest2.type = new messages_1.ProtocolRequestType(FoldingRangeRequest2.method); })(FoldingRangeRequest || (exports.FoldingRangeRequest = FoldingRangeRequest = {})); var FoldingRangeRefreshRequest; (function(FoldingRangeRefreshRequest2) { FoldingRangeRefreshRequest2.method = `workspace/foldingRange/refresh`; FoldingRangeRefreshRequest2.messageDirection = messages_1.MessageDirection.serverToClient; FoldingRangeRefreshRequest2.type = new messages_1.ProtocolRequestType0(FoldingRangeRefreshRequest2.method); })(FoldingRangeRefreshRequest || (exports.FoldingRangeRefreshRequest = FoldingRangeRefreshRequest = {})); } }); // node_modules/vscode-languageserver-protocol/lib/common/protocol.declaration.js var require_protocol_declaration = __commonJS({ "node_modules/vscode-languageserver-protocol/lib/common/protocol.declaration.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.DeclarationRequest = void 0; var messages_1 = require_messages2(); var DeclarationRequest; (function(DeclarationRequest2) { DeclarationRequest2.method = "textDocument/declaration"; DeclarationRequest2.messageDirection = messages_1.MessageDirection.clientToServer; DeclarationRequest2.type = new messages_1.ProtocolRequestType(DeclarationRequest2.method); })(DeclarationRequest || (exports.DeclarationRequest = DeclarationRequest = {})); } }); // node_modules/vscode-languageserver-protocol/lib/common/protocol.selectionRange.js var require_protocol_selectionRange = __commonJS({ "node_modules/vscode-languageserver-protocol/lib/common/protocol.selectionRange.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SelectionRangeRequest = void 0; var messages_1 = require_messages2(); var SelectionRangeRequest; (function(SelectionRangeRequest2) { SelectionRangeRequest2.method = "textDocument/selectionRange"; SelectionRangeRequest2.messageDirection = messages_1.MessageDirection.clientToServer; SelectionRangeRequest2.type = new messages_1.ProtocolRequestType(SelectionRangeRequest2.method); })(SelectionRangeRequest || (exports.SelectionRangeRequest = SelectionRangeRequest = {})); } }); // node_modules/vscode-languageserver-protocol/lib/common/protocol.progress.js var require_protocol_progress = __commonJS({ "node_modules/vscode-languageserver-protocol/lib/common/protocol.progress.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.WorkDoneProgressCancelNotification = exports.WorkDoneProgressCreateRequest = exports.WorkDoneProgress = void 0; var vscode_jsonrpc_1 = require_main(); var messages_1 = require_messages2(); var WorkDoneProgress; (function(WorkDoneProgress2) { WorkDoneProgress2.type = new vscode_jsonrpc_1.ProgressType(); function is(value) { return value === WorkDoneProgress2.type; } WorkDoneProgress2.is = is; })(WorkDoneProgress || (exports.WorkDoneProgress = WorkDoneProgress = {})); var WorkDoneProgressCreateRequest; (function(WorkDoneProgressCreateRequest2) { WorkDoneProgressCreateRequest2.method = "window/workDoneProgress/create"; WorkDoneProgressCreateRequest2.messageDirection = messages_1.MessageDirection.serverToClient; WorkDoneProgressCreateRequest2.type = new messages_1.ProtocolRequestType(WorkDoneProgressCreateRequest2.method); })(WorkDoneProgressCreateRequest || (exports.WorkDoneProgressCreateRequest = WorkDoneProgressCreateRequest = {})); var WorkDoneProgressCancelNotification; (function(WorkDoneProgressCancelNotification2) { WorkDoneProgressCancelNotification2.method = "window/workDoneProgress/cancel"; WorkDoneProgressCancelNotification2.messageDirection = messages_1.MessageDirection.clientToServer; WorkDoneProgressCancelNotification2.type = new messages_1.ProtocolNotificationType(WorkDoneProgressCancelNotification2.method); })(WorkDoneProgressCancelNotification || (exports.WorkDoneProgressCancelNotification = WorkDoneProgressCancelNotification = {})); } }); // node_modules/vscode-languageserver-protocol/lib/common/protocol.callHierarchy.js var require_protocol_callHierarchy = __commonJS({ "node_modules/vscode-languageserver-protocol/lib/common/protocol.callHierarchy.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CallHierarchyOutgoingCallsRequest = exports.CallHierarchyIncomingCallsRequest = exports.CallHierarchyPrepareRequest = void 0; var messages_1 = require_messages2(); var CallHierarchyPrepareRequest; (function(CallHierarchyPrepareRequest2) { CallHierarchyPrepareRequest2.method = "textDocument/prepareCallHierarchy"; CallHierarchyPrepareRequest2.messageDirection = messages_1.MessageDirection.clientToServer; CallHierarchyPrepareRequest2.type = new messages_1.ProtocolRequestType(CallHierarchyPrepareRequest2.method); })(CallHierarchyPrepareRequest || (exports.CallHierarchyPrepareRequest = CallHierarchyPrepareRequest = {})); var CallHierarchyIncomingCallsRequest; (function(CallHierarchyIncomingCallsRequest2) { CallHierarchyIncomingCallsRequest2.method = "callHierarchy/incomingCalls"; CallHierarchyIncomingCallsRequest2.messageDirection = messages_1.MessageDirection.clientToServer; CallHierarchyIncomingCallsRequest2.type = new messages_1.ProtocolRequestType(CallHierarchyIncomingCallsRequest2.method); })(CallHierarchyIncomingCallsRequest || (exports.CallHierarchyIncomingCallsRequest = CallHierarchyIncomingCallsRequest = {})); var CallHierarchyOutgoingCallsRequest; (function(CallHierarchyOutgoingCallsRequest2) { CallHierarchyOutgoingCallsRequest2.method = "callHierarchy/outgoingCalls"; CallHierarchyOutgoingCallsRequest2.messageDirection = messages_1.MessageDirection.clientToServer; CallHierarchyOutgoingCallsRequest2.type = new messages_1.ProtocolRequestType(CallHierarchyOutgoingCallsRequest2.method); })(CallHierarchyOutgoingCallsRequest || (exports.CallHierarchyOutgoingCallsRequest = CallHierarchyOutgoingCallsRequest = {})); } }); // node_modules/vscode-languageserver-protocol/lib/common/protocol.semanticTokens.js var require_protocol_semanticTokens = __commonJS({ "node_modules/vscode-languageserver-protocol/lib/common/protocol.semanticTokens.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SemanticTokensRefreshRequest = exports.SemanticTokensRangeRequest = exports.SemanticTokensDeltaRequest = exports.SemanticTokensRequest = exports.SemanticTokensRegistrationType = exports.TokenFormat = void 0; var messages_1 = require_messages2(); var TokenFormat; (function(TokenFormat2) { TokenFormat2.Relative = "relative"; })(TokenFormat || (exports.TokenFormat = TokenFormat = {})); var SemanticTokensRegistrationType; (function(SemanticTokensRegistrationType2) { SemanticTokensRegistrationType2.method = "textDocument/semanticTokens"; SemanticTokensRegistrationType2.type = new messages_1.RegistrationType(SemanticTokensRegistrationType2.method); })(SemanticTokensRegistrationType || (exports.SemanticTokensRegistrationType = SemanticTokensRegistrationType = {})); var SemanticTokensRequest; (function(SemanticTokensRequest2) { SemanticTokensRequest2.method = "textDocument/semanticTokens/full"; SemanticTokensRequest2.messageDirection = messages_1.MessageDirection.clientToServer; SemanticTokensRequest2.type = new messages_1.ProtocolRequestType(SemanticTokensRequest2.method); SemanticTokensRequest2.registrationMethod = SemanticTokensRegistrationType.method; })(SemanticTokensRequest || (exports.SemanticTokensRequest = SemanticTokensRequest = {})); var SemanticTokensDeltaRequest; (function(SemanticTokensDeltaRequest2) { SemanticTokensDeltaRequest2.method = "textDocument/semanticTokens/full/delta"; SemanticTokensDeltaRequest2.messageDirection = messages_1.MessageDirection.clientToServer; SemanticTokensDeltaRequest2.type = new messages_1.ProtocolRequestType(SemanticTokensDeltaRequest2.method); SemanticTokensDeltaRequest2.registrationMethod = SemanticTokensRegistrationType.method; })(SemanticTokensDeltaRequest || (exports.SemanticTokensDeltaRequest = SemanticTokensDeltaRequest = {})); var SemanticTokensRangeRequest; (function(SemanticTokensRangeRequest2) { SemanticTokensRangeRequest2.method = "textDocument/semanticTokens/range"; SemanticTokensRangeRequest2.messageDirection = messages_1.MessageDirection.clientToServer; SemanticTokensRangeRequest2.type = new messages_1.ProtocolRequestType(SemanticTokensRangeRequest2.method); SemanticTokensRangeRequest2.registrationMethod = SemanticTokensRegistrationType.method; })(SemanticTokensRangeRequest || (exports.SemanticTokensRangeRequest = SemanticTokensRangeRequest = {})); var SemanticTokensRefreshRequest; (function(SemanticTokensRefreshRequest2) { SemanticTokensRefreshRequest2.method = `workspace/semanticTokens/refresh`; SemanticTokensRefreshRequest2.messageDirection = messages_1.MessageDirection.serverToClient; SemanticTokensRefreshRequest2.type = new messages_1.ProtocolRequestType0(SemanticTokensRefreshRequest2.method); })(SemanticTokensRefreshRequest || (exports.SemanticTokensRefreshRequest = SemanticTokensRefreshRequest = {})); } }); // node_modules/vscode-languageserver-protocol/lib/common/protocol.showDocument.js var require_protocol_showDocument = __commonJS({ "node_modules/vscode-languageserver-protocol/lib/common/protocol.showDocument.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ShowDocumentRequest = void 0; var messages_1 = require_messages2(); var ShowDocumentRequest; (function(ShowDocumentRequest2) { ShowDocumentRequest2.method = "window/showDocument"; ShowDocumentRequest2.messageDirection = messages_1.MessageDirection.serverToClient; ShowDocumentRequest2.type = new messages_1.ProtocolRequestType(ShowDocumentRequest2.method); })(ShowDocumentRequest || (exports.ShowDocumentRequest = ShowDocumentRequest = {})); } }); // node_modules/vscode-languageserver-protocol/lib/common/protocol.linkedEditingRange.js var require_protocol_linkedEditingRange = __commonJS({ "node_modules/vscode-languageserver-protocol/lib/common/protocol.linkedEditingRange.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.LinkedEditingRangeRequest = void 0; var messages_1 = require_messages2(); var LinkedEditingRangeRequest; (function(LinkedEditingRangeRequest2) { LinkedEditingRangeRequest2.method = "textDocument/linkedEditingRange"; LinkedEditingRangeRequest2.messageDirection = messages_1.MessageDirection.clientToServer; LinkedEditingRangeRequest2.type = new messages_1.ProtocolRequestType(LinkedEditingRangeRequest2.method); })(LinkedEditingRangeRequest || (exports.LinkedEditingRangeRequest = LinkedEditingRangeRequest = {})); } }); // node_modules/vscode-languageserver-protocol/lib/common/protocol.fileOperations.js var require_protocol_fileOperations = __commonJS({ "node_modules/vscode-languageserver-protocol/lib/common/protocol.fileOperations.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.WillDeleteFilesRequest = exports.DidDeleteFilesNotification = exports.DidRenameFilesNotification = exports.WillRenameFilesRequest = exports.DidCreateFilesNotification = exports.WillCreateFilesRequest = exports.FileOperationPatternKind = void 0; var messages_1 = require_messages2(); var FileOperationPatternKind; (function(FileOperationPatternKind2) { FileOperationPatternKind2.file = "file"; FileOperationPatternKind2.folder = "folder"; })(FileOperationPatternKind || (exports.FileOperationPatternKind = FileOperationPatternKind = {})); var WillCreateFilesRequest; (function(WillCreateFilesRequest2) { WillCreateFilesRequest2.method = "workspace/willCreateFiles"; WillCreateFilesRequest2.messageDirection = messages_1.MessageDirection.clientToServer; WillCreateFilesRequest2.type = new messages_1.ProtocolRequestType(WillCreateFilesRequest2.method); })(WillCreateFilesRequest || (exports.WillCreateFilesRequest = WillCreateFilesRequest = {})); var DidCreateFilesNotification; (function(DidCreateFilesNotification2) { DidCreateFilesNotification2.method = "workspace/didCreateFiles"; DidCreateFilesNotification2.messageDirection = messages_1.MessageDirection.clientToServer; DidCreateFilesNotification2.type = new messages_1.ProtocolNotificationType(DidCreateFilesNotification2.method); })(DidCreateFilesNotification || (exports.DidCreateFilesNotification = DidCreateFilesNotification = {})); var WillRenameFilesRequest; (function(WillRenameFilesRequest2) { WillRenameFilesRequest2.method = "workspace/willRenameFiles"; WillRenameFilesRequest2.messageDirection = messages_1.MessageDirection.clientToServer; WillRenameFilesRequest2.type = new messages_1.ProtocolRequestType(WillRenameFilesRequest2.method); })(WillRenameFilesRequest || (exports.WillRenameFilesRequest = WillRenameFilesRequest = {})); var DidRenameFilesNotification; (function(DidRenameFilesNotification2) { DidRenameFilesNotification2.method = "workspace/didRenameFiles"; DidRenameFilesNotification2.messageDirection = messages_1.MessageDirection.clientToServer; DidRenameFilesNotification2.type = new messages_1.ProtocolNotificationType(DidRenameFilesNotification2.method); })(DidRenameFilesNotification || (exports.DidRenameFilesNotification = DidRenameFilesNotification = {})); var DidDeleteFilesNotification; (function(DidDeleteFilesNotification2) { DidDeleteFilesNotification2.method = "workspace/didDeleteFiles"; DidDeleteFilesNotification2.messageDirection = messages_1.MessageDirection.clientToServer; DidDeleteFilesNotification2.type = new messages_1.ProtocolNotificationType(DidDeleteFilesNotification2.method); })(DidDeleteFilesNotification || (exports.DidDeleteFilesNotification = DidDeleteFilesNotification = {})); var WillDeleteFilesRequest; (function(WillDeleteFilesRequest2) { WillDeleteFilesRequest2.method = "workspace/willDeleteFiles"; WillDeleteFilesRequest2.messageDirection = messages_1.MessageDirection.clientToServer; WillDeleteFilesRequest2.type = new messages_1.ProtocolRequestType(WillDeleteFilesRequest2.method); })(WillDeleteFilesRequest || (exports.WillDeleteFilesRequest = WillDeleteFilesRequest = {})); } }); // node_modules/vscode-languageserver-protocol/lib/common/protocol.moniker.js var require_protocol_moniker = __commonJS({ "node_modules/vscode-languageserver-protocol/lib/common/protocol.moniker.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.MonikerRequest = exports.MonikerKind = exports.UniquenessLevel = void 0; var messages_1 = require_messages2(); var UniquenessLevel; (function(UniquenessLevel2) { UniquenessLevel2.document = "document"; UniquenessLevel2.project = "project"; UniquenessLevel2.group = "group"; UniquenessLevel2.scheme = "scheme"; UniquenessLevel2.global = "global"; })(UniquenessLevel || (exports.UniquenessLevel = UniquenessLevel = {})); var MonikerKind; (function(MonikerKind2) { MonikerKind2.$import = "import"; MonikerKind2.$export = "export"; MonikerKind2.local = "local"; })(MonikerKind || (exports.MonikerKind = MonikerKind = {})); var MonikerRequest; (function(MonikerRequest2) { MonikerRequest2.method = "textDocument/moniker"; MonikerRequest2.messageDirection = messages_1.MessageDirection.clientToServer; MonikerRequest2.type = new messages_1.ProtocolRequestType(MonikerRequest2.method); })(MonikerRequest || (exports.MonikerRequest = MonikerRequest = {})); } }); // node_modules/vscode-languageserver-protocol/lib/common/protocol.typeHierarchy.js var require_protocol_typeHierarchy = __commonJS({ "node_modules/vscode-languageserver-protocol/lib/common/protocol.typeHierarchy.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.TypeHierarchySubtypesRequest = exports.TypeHierarchySupertypesRequest = exports.TypeHierarchyPrepareRequest = void 0; var messages_1 = require_messages2(); var TypeHierarchyPrepareRequest; (function(TypeHierarchyPrepareRequest2) { TypeHierarchyPrepareRequest2.method = "textDocument/prepareTypeHierarchy"; TypeHierarchyPrepareRequest2.messageDirection = messages_1.MessageDirection.clientToServer; TypeHierarchyPrepareRequest2.type = new messages_1.ProtocolRequestType(TypeHierarchyPrepareRequest2.method); })(TypeHierarchyPrepareRequest || (exports.TypeHierarchyPrepareRequest = TypeHierarchyPrepareRequest = {})); var TypeHierarchySupertypesRequest; (function(TypeHierarchySupertypesRequest2) { TypeHierarchySupertypesRequest2.method = "typeHierarchy/supertypes"; TypeHierarchySupertypesRequest2.messageDirection = messages_1.MessageDirection.clientToServer; TypeHierarchySupertypesRequest2.type = new messages_1.ProtocolRequestType(TypeHierarchySupertypesRequest2.method); })(TypeHierarchySupertypesRequest || (exports.TypeHierarchySupertypesRequest = TypeHierarchySupertypesRequest = {})); var TypeHierarchySubtypesRequest; (function(TypeHierarchySubtypesRequest2) { TypeHierarchySubtypesRequest2.method = "typeHierarchy/subtypes"; TypeHierarchySubtypesRequest2.messageDirection = messages_1.MessageDirection.clientToServer; TypeHierarchySubtypesRequest2.type = new messages_1.ProtocolRequestType(TypeHierarchySubtypesRequest2.method); })(TypeHierarchySubtypesRequest || (exports.TypeHierarchySubtypesRequest = TypeHierarchySubtypesRequest = {})); } }); // node_modules/vscode-languageserver-protocol/lib/common/protocol.inlineValue.js var require_protocol_inlineValue = __commonJS({ "node_modules/vscode-languageserver-protocol/lib/common/protocol.inlineValue.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.InlineValueRefreshRequest = exports.InlineValueRequest = void 0; var messages_1 = require_messages2(); var InlineValueRequest; (function(InlineValueRequest2) { InlineValueRequest2.method = "textDocument/inlineValue"; InlineValueRequest2.messageDirection = messages_1.MessageDirection.clientToServer; InlineValueRequest2.type = new messages_1.ProtocolRequestType(InlineValueRequest2.method); })(InlineValueRequest || (exports.InlineValueRequest = InlineValueRequest = {})); var InlineValueRefreshRequest; (function(InlineValueRefreshRequest2) { InlineValueRefreshRequest2.method = `workspace/inlineValue/refresh`; InlineValueRefreshRequest2.messageDirection = messages_1.MessageDirection.serverToClient; InlineValueRefreshRequest2.type = new messages_1.ProtocolRequestType0(InlineValueRefreshRequest2.method); })(InlineValueRefreshRequest || (exports.InlineValueRefreshRequest = InlineValueRefreshRequest = {})); } }); // node_modules/vscode-languageserver-protocol/lib/common/protocol.inlayHint.js var require_protocol_inlayHint = __commonJS({ "node_modules/vscode-languageserver-protocol/lib/common/protocol.inlayHint.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.InlayHintRefreshRequest = exports.InlayHintResolveRequest = exports.InlayHintRequest = void 0; var messages_1 = require_messages2(); var InlayHintRequest; (function(InlayHintRequest2) { InlayHintRequest2.method = "textDocument/inlayHint"; InlayHintRequest2.messageDirection = messages_1.MessageDirection.clientToServer; InlayHintRequest2.type = new messages_1.ProtocolRequestType(InlayHintRequest2.method); })(InlayHintRequest || (exports.InlayHintRequest = InlayHintRequest = {})); var InlayHintResolveRequest; (function(InlayHintResolveRequest2) { InlayHintResolveRequest2.method = "inlayHint/resolve"; InlayHintResolveRequest2.messageDirection = messages_1.MessageDirection.clientToServer; InlayHintResolveRequest2.type = new messages_1.ProtocolRequestType(InlayHintResolveRequest2.method); })(InlayHintResolveRequest || (exports.InlayHintResolveRequest = InlayHintResolveRequest = {})); var InlayHintRefreshRequest; (function(InlayHintRefreshRequest2) { InlayHintRefreshRequest2.method = `workspace/inlayHint/refresh`; InlayHintRefreshRequest2.messageDirection = messages_1.MessageDirection.serverToClient; InlayHintRefreshRequest2.type = new messages_1.ProtocolRequestType0(InlayHintRefreshRequest2.method); })(InlayHintRefreshRequest || (exports.InlayHintRefreshRequest = InlayHintRefreshRequest = {})); } }); // node_modules/vscode-languageserver-protocol/lib/common/protocol.diagnostic.js var require_protocol_diagnostic = __commonJS({ "node_modules/vscode-languageserver-protocol/lib/common/protocol.diagnostic.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.DiagnosticRefreshRequest = exports.WorkspaceDiagnosticRequest = exports.DocumentDiagnosticRequest = exports.DocumentDiagnosticReportKind = exports.DiagnosticServerCancellationData = void 0; var vscode_jsonrpc_1 = require_main(); var Is2 = require_is2(); var messages_1 = require_messages2(); var DiagnosticServerCancellationData; (function(DiagnosticServerCancellationData2) { function is(value) { const candidate = value; return candidate && Is2.boolean(candidate.retriggerRequest); } DiagnosticServerCancellationData2.is = is; })(DiagnosticServerCancellationData || (exports.DiagnosticServerCancellationData = DiagnosticServerCancellationData = {})); var DocumentDiagnosticReportKind; (function(DocumentDiagnosticReportKind2) { DocumentDiagnosticReportKind2.Full = "full"; DocumentDiagnosticReportKind2.Unchanged = "unchanged"; })(DocumentDiagnosticReportKind || (exports.DocumentDiagnosticReportKind = DocumentDiagnosticReportKind = {})); var DocumentDiagnosticRequest; (function(DocumentDiagnosticRequest2) { DocumentDiagnosticRequest2.method = "textDocument/diagnostic"; DocumentDiagnosticRequest2.messageDirection = messages_1.MessageDirection.clientToServer; DocumentDiagnosticRequest2.type = new messages_1.ProtocolRequestType(DocumentDiagnosticRequest2.method); DocumentDiagnosticRequest2.partialResult = new vscode_jsonrpc_1.ProgressType(); })(DocumentDiagnosticRequest || (exports.DocumentDiagnosticRequest = DocumentDiagnosticRequest = {})); var WorkspaceDiagnosticRequest; (function(WorkspaceDiagnosticRequest2) { WorkspaceDiagnosticRequest2.method = "workspace/diagnostic"; WorkspaceDiagnosticRequest2.messageDirection = messages_1.MessageDirection.clientToServer; WorkspaceDiagnosticRequest2.type = new messages_1.ProtocolRequestType(WorkspaceDiagnosticRequest2.method); WorkspaceDiagnosticRequest2.partialResult = new vscode_jsonrpc_1.ProgressType(); })(WorkspaceDiagnosticRequest || (exports.WorkspaceDiagnosticRequest = WorkspaceDiagnosticRequest = {})); var DiagnosticRefreshRequest; (function(DiagnosticRefreshRequest2) { DiagnosticRefreshRequest2.method = `workspace/diagnostic/refresh`; DiagnosticRefreshRequest2.messageDirection = messages_1.MessageDirection.serverToClient; DiagnosticRefreshRequest2.type = new messages_1.ProtocolRequestType0(DiagnosticRefreshRequest2.method); })(DiagnosticRefreshRequest || (exports.DiagnosticRefreshRequest = DiagnosticRefreshRequest = {})); } }); // node_modules/vscode-languageserver-protocol/lib/common/protocol.notebook.js var require_protocol_notebook = __commonJS({ "node_modules/vscode-languageserver-protocol/lib/common/protocol.notebook.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.DidCloseNotebookDocumentNotification = exports.DidSaveNotebookDocumentNotification = exports.DidChangeNotebookDocumentNotification = exports.NotebookCellArrayChange = exports.DidOpenNotebookDocumentNotification = exports.NotebookDocumentSyncRegistrationType = exports.NotebookDocument = exports.NotebookCell = exports.ExecutionSummary = exports.NotebookCellKind = void 0; var vscode_languageserver_types_1 = (init_main(), __toCommonJS(main_exports)); var Is2 = require_is2(); var messages_1 = require_messages2(); var NotebookCellKind; (function(NotebookCellKind2) { NotebookCellKind2.Markup = 1; NotebookCellKind2.Code = 2; function is(value) { return value === 1 || value === 2; } NotebookCellKind2.is = is; })(NotebookCellKind || (exports.NotebookCellKind = NotebookCellKind = {})); var ExecutionSummary; (function(ExecutionSummary2) { function create(executionOrder, success) { const result = { executionOrder }; if (success === true || success === false) { result.success = success; } return result; } ExecutionSummary2.create = create; function is(value) { const candidate = value; return Is2.objectLiteral(candidate) && vscode_languageserver_types_1.uinteger.is(candidate.executionOrder) && (candidate.success === void 0 || Is2.boolean(candidate.success)); } ExecutionSummary2.is = is; function equals(one, other) { if (one === other) { return true; } if (one === null || one === void 0 || other === null || other === void 0) { return false; } return one.executionOrder === other.executionOrder && one.success === other.success; } ExecutionSummary2.equals = equals; })(ExecutionSummary || (exports.ExecutionSummary = ExecutionSummary = {})); var NotebookCell; (function(NotebookCell2) { function create(kind, document2) { return { kind, document: document2 }; } NotebookCell2.create = create; function is(value) { const candidate = value; return Is2.objectLiteral(candidate) && NotebookCellKind.is(candidate.kind) && vscode_languageserver_types_1.DocumentUri.is(candidate.document) && (candidate.metadata === void 0 || Is2.objectLiteral(candidate.metadata)); } NotebookCell2.is = is; function diff(one, two) { const result = /* @__PURE__ */ new Set(); if (one.document !== two.document) { result.add("document"); } if (one.kind !== two.kind) { result.add("kind"); } if (one.executionSummary !== two.executionSummary) { result.add("executionSummary"); } if ((one.metadata !== void 0 || two.metadata !== void 0) && !equalsMetadata(one.metadata, two.metadata)) { result.add("metadata"); } if ((one.executionSummary !== void 0 || two.executionSummary !== void 0) && !ExecutionSummary.equals(one.executionSummary, two.executionSummary)) { result.add("executionSummary"); } return result; } NotebookCell2.diff = diff; function equalsMetadata(one, other) { if (one === other) { return true; } if (one === null || one === void 0 || other === null || other === void 0) { return false; } if (typeof one !== typeof other) { return false; } if (typeof one !== "object") { return false; } const oneArray = Array.isArray(one); const otherArray = Array.isArray(other); if (oneArray !== otherArray) { return false; } if (oneArray && otherArray) { if (one.length !== other.length) { return false; } for (let i = 0; i < one.length; i++) { if (!equalsMetadata(one[i], other[i])) { return false; } } } if (Is2.objectLiteral(one) && Is2.objectLiteral(other)) { const oneKeys = Object.keys(one); const otherKeys = Object.keys(other); if (oneKeys.length !== otherKeys.length) { return false; } oneKeys.sort(); otherKeys.sort(); if (!equalsMetadata(oneKeys, otherKeys)) { return false; } for (let i = 0; i < oneKeys.length; i++) { const prop = oneKeys[i]; if (!equalsMetadata(one[prop], other[prop])) { return false; } } } return true; } })(NotebookCell || (exports.NotebookCell = NotebookCell = {})); var NotebookDocument; (function(NotebookDocument2) { function create(uri, notebookType, version, cells) { return { uri, notebookType, version, cells }; } NotebookDocument2.create = create; function is(value) { const candidate = value; return Is2.objectLiteral(candidate) && Is2.string(candidate.uri) && vscode_languageserver_types_1.integer.is(candidate.version) && Is2.typedArray(candidate.cells, NotebookCell.is); } NotebookDocument2.is = is; })(NotebookDocument || (exports.NotebookDocument = NotebookDocument = {})); var NotebookDocumentSyncRegistrationType; (function(NotebookDocumentSyncRegistrationType2) { NotebookDocumentSyncRegistrationType2.method = "notebookDocument/sync"; NotebookDocumentSyncRegistrationType2.messageDirection = messages_1.MessageDirection.clientToServer; NotebookDocumentSyncRegistrationType2.type = new messages_1.RegistrationType(NotebookDocumentSyncRegistrationType2.method); })(NotebookDocumentSyncRegistrationType || (exports.NotebookDocumentSyncRegistrationType = NotebookDocumentSyncRegistrationType = {})); var DidOpenNotebookDocumentNotification; (function(DidOpenNotebookDocumentNotification2) { DidOpenNotebookDocumentNotification2.method = "notebookDocument/didOpen"; DidOpenNotebookDocumentNotification2.messageDirection = messages_1.MessageDirection.clientToServer; DidOpenNotebookDocumentNotification2.type = new messages_1.ProtocolNotificationType(DidOpenNotebookDocumentNotification2.method); DidOpenNotebookDocumentNotification2.registrationMethod = NotebookDocumentSyncRegistrationType.method; })(DidOpenNotebookDocumentNotification || (exports.DidOpenNotebookDocumentNotification = DidOpenNotebookDocumentNotification = {})); var NotebookCellArrayChange; (function(NotebookCellArrayChange2) { function is(value) { const candidate = value; return Is2.objectLiteral(candidate) && vscode_languageserver_types_1.uinteger.is(candidate.start) && vscode_languageserver_types_1.uinteger.is(candidate.deleteCount) && (candidate.cells === void 0 || Is2.typedArray(candidate.cells, NotebookCell.is)); } NotebookCellArrayChange2.is = is; function create(start, deleteCount, cells) { const result = { start, deleteCount }; if (cells !== void 0) { result.cells = cells; } return result; } NotebookCellArrayChange2.create = create; })(NotebookCellArrayChange || (exports.NotebookCellArrayChange = NotebookCellArrayChange = {})); var DidChangeNotebookDocumentNotification; (function(DidChangeNotebookDocumentNotification2) { DidChangeNotebookDocumentNotification2.method = "notebookDocument/didChange"; DidChangeNotebookDocumentNotification2.messageDirection = messages_1.MessageDirection.clientToServer; DidChangeNotebookDocumentNotification2.type = new messages_1.ProtocolNotificationType(DidChangeNotebookDocumentNotification2.method); DidChangeNotebookDocumentNotification2.registrationMethod = NotebookDocumentSyncRegistrationType.method; })(DidChangeNotebookDocumentNotification || (exports.DidChangeNotebookDocumentNotification = DidChangeNotebookDocumentNotification = {})); var DidSaveNotebookDocumentNotification; (function(DidSaveNotebookDocumentNotification2) { DidSaveNotebookDocumentNotification2.method = "notebookDocument/didSave"; DidSaveNotebookDocumentNotification2.messageDirection = messages_1.MessageDirection.clientToServer; DidSaveNotebookDocumentNotification2.type = new messages_1.ProtocolNotificationType(DidSaveNotebookDocumentNotification2.method); DidSaveNotebookDocumentNotification2.registrationMethod = NotebookDocumentSyncRegistrationType.method; })(DidSaveNotebookDocumentNotification || (exports.DidSaveNotebookDocumentNotification = DidSaveNotebookDocumentNotification = {})); var DidCloseNotebookDocumentNotification; (function(DidCloseNotebookDocumentNotification2) { DidCloseNotebookDocumentNotification2.method = "notebookDocument/didClose"; DidCloseNotebookDocumentNotification2.messageDirection = messages_1.MessageDirection.clientToServer; DidCloseNotebookDocumentNotification2.type = new messages_1.ProtocolNotificationType(DidCloseNotebookDocumentNotification2.method); DidCloseNotebookDocumentNotification2.registrationMethod = NotebookDocumentSyncRegistrationType.method; })(DidCloseNotebookDocumentNotification || (exports.DidCloseNotebookDocumentNotification = DidCloseNotebookDocumentNotification = {})); } }); // node_modules/vscode-languageserver-protocol/lib/common/protocol.inlineCompletion.js var require_protocol_inlineCompletion = __commonJS({ "node_modules/vscode-languageserver-protocol/lib/common/protocol.inlineCompletion.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.InlineCompletionRequest = void 0; var messages_1 = require_messages2(); var InlineCompletionRequest; (function(InlineCompletionRequest2) { InlineCompletionRequest2.method = "textDocument/inlineCompletion"; InlineCompletionRequest2.messageDirection = messages_1.MessageDirection.clientToServer; InlineCompletionRequest2.type = new messages_1.ProtocolRequestType(InlineCompletionRequest2.method); })(InlineCompletionRequest || (exports.InlineCompletionRequest = InlineCompletionRequest = {})); } }); // node_modules/vscode-languageserver-protocol/lib/common/protocol.js var require_protocol = __commonJS({ "node_modules/vscode-languageserver-protocol/lib/common/protocol.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.WorkspaceSymbolRequest = exports.CodeActionResolveRequest = exports.CodeActionRequest = exports.DocumentSymbolRequest = exports.DocumentHighlightRequest = exports.ReferencesRequest = exports.DefinitionRequest = exports.SignatureHelpRequest = exports.SignatureHelpTriggerKind = exports.HoverRequest = exports.CompletionResolveRequest = exports.CompletionRequest = exports.CompletionTriggerKind = exports.PublishDiagnosticsNotification = exports.WatchKind = exports.RelativePattern = exports.FileChangeType = exports.DidChangeWatchedFilesNotification = exports.WillSaveTextDocumentWaitUntilRequest = exports.WillSaveTextDocumentNotification = exports.TextDocumentSaveReason = exports.DidSaveTextDocumentNotification = exports.DidCloseTextDocumentNotification = exports.DidChangeTextDocumentNotification = exports.TextDocumentContentChangeEvent = exports.DidOpenTextDocumentNotification = exports.TextDocumentSyncKind = exports.TelemetryEventNotification = exports.LogMessageNotification = exports.ShowMessageRequest = exports.ShowMessageNotification = exports.MessageType = exports.DidChangeConfigurationNotification = exports.ExitNotification = exports.ShutdownRequest = exports.InitializedNotification = exports.InitializeErrorCodes = exports.InitializeRequest = exports.WorkDoneProgressOptions = exports.TextDocumentRegistrationOptions = exports.StaticRegistrationOptions = exports.PositionEncodingKind = exports.FailureHandlingKind = exports.ResourceOperationKind = exports.UnregistrationRequest = exports.RegistrationRequest = exports.DocumentSelector = exports.NotebookCellTextDocumentFilter = exports.NotebookDocumentFilter = exports.TextDocumentFilter = void 0; exports.MonikerRequest = exports.MonikerKind = exports.UniquenessLevel = exports.WillDeleteFilesRequest = exports.DidDeleteFilesNotification = exports.WillRenameFilesRequest = exports.DidRenameFilesNotification = exports.WillCreateFilesRequest = exports.DidCreateFilesNotification = exports.FileOperationPatternKind = exports.LinkedEditingRangeRequest = exports.ShowDocumentRequest = exports.SemanticTokensRegistrationType = exports.SemanticTokensRefreshRequest = exports.SemanticTokensRangeRequest = exports.SemanticTokensDeltaRequest = exports.SemanticTokensRequest = exports.TokenFormat = exports.CallHierarchyPrepareRequest = exports.CallHierarchyOutgoingCallsRequest = exports.CallHierarchyIncomingCallsRequest = exports.WorkDoneProgressCancelNotification = exports.WorkDoneProgressCreateRequest = exports.WorkDoneProgress = exports.SelectionRangeRequest = exports.DeclarationRequest = exports.FoldingRangeRefreshRequest = exports.FoldingRangeRequest = exports.ColorPresentationRequest = exports.DocumentColorRequest = exports.ConfigurationRequest = exports.DidChangeWorkspaceFoldersNotification = exports.WorkspaceFoldersRequest = exports.TypeDefinitionRequest = exports.ImplementationRequest = exports.ApplyWorkspaceEditRequest = exports.ExecuteCommandRequest = exports.PrepareRenameRequest = exports.RenameRequest = exports.PrepareSupportDefaultBehavior = exports.DocumentOnTypeFormattingRequest = exports.DocumentRangesFormattingRequest = exports.DocumentRangeFormattingRequest = exports.DocumentFormattingRequest = exports.DocumentLinkResolveRequest = exports.DocumentLinkRequest = exports.CodeLensRefreshRequest = exports.CodeLensResolveRequest = exports.CodeLensRequest = exports.WorkspaceSymbolResolveRequest = void 0; exports.InlineCompletionRequest = exports.DidCloseNotebookDocumentNotification = exports.DidSaveNotebookDocumentNotification = exports.DidChangeNotebookDocumentNotification = exports.NotebookCellArrayChange = exports.DidOpenNotebookDocumentNotification = exports.NotebookDocumentSyncRegistrationType = exports.NotebookDocument = exports.NotebookCell = exports.ExecutionSummary = exports.NotebookCellKind = exports.DiagnosticRefreshRequest = exports.WorkspaceDiagnosticRequest = exports.DocumentDiagnosticRequest = exports.DocumentDiagnosticReportKind = exports.DiagnosticServerCancellationData = exports.InlayHintRefreshRequest = exports.InlayHintResolveRequest = exports.InlayHintRequest = exports.InlineValueRefreshRequest = exports.InlineValueRequest = exports.TypeHierarchySupertypesRequest = exports.TypeHierarchySubtypesRequest = exports.TypeHierarchyPrepareRequest = void 0; var messages_1 = require_messages2(); var vscode_languageserver_types_1 = (init_main(), __toCommonJS(main_exports)); var Is2 = require_is2(); var protocol_implementation_1 = require_protocol_implementation(); Object.defineProperty(exports, "ImplementationRequest", { enumerable: true, get: function() { return protocol_implementation_1.ImplementationRequest; } }); var protocol_typeDefinition_1 = require_protocol_typeDefinition(); Object.defineProperty(exports, "TypeDefinitionRequest", { enumerable: true, get: function() { return protocol_typeDefinition_1.TypeDefinitionRequest; } }); var protocol_workspaceFolder_1 = require_protocol_workspaceFolder(); Object.defineProperty(exports, "WorkspaceFoldersRequest", { enumerable: true, get: function() { return protocol_workspaceFolder_1.WorkspaceFoldersRequest; } }); Object.defineProperty(exports, "DidChangeWorkspaceFoldersNotification", { enumerable: true, get: function() { return protocol_workspaceFolder_1.DidChangeWorkspaceFoldersNotification; } }); var protocol_configuration_1 = require_protocol_configuration(); Object.defineProperty(exports, "ConfigurationRequest", { enumerable: true, get: function() { return protocol_configuration_1.ConfigurationRequest; } }); var protocol_colorProvider_1 = require_protocol_colorProvider(); Object.defineProperty(exports, "DocumentColorRequest", { enumerable: true, get: function() { return protocol_colorProvider_1.DocumentColorRequest; } }); Object.defineProperty(exports, "ColorPresentationRequest", { enumerable: true, get: function() { return protocol_colorProvider_1.ColorPresentationRequest; } }); var protocol_foldingRange_1 = require_protocol_foldingRange(); Object.defineProperty(exports, "FoldingRangeRequest", { enumerable: true, get: function() { return protocol_foldingRange_1.FoldingRangeRequest; } }); Object.defineProperty(exports, "FoldingRangeRefreshRequest", { enumerable: true, get: function() { return protocol_foldingRange_1.FoldingRangeRefreshRequest; } }); var protocol_declaration_1 = require_protocol_declaration(); Object.defineProperty(exports, "DeclarationRequest", { enumerable: true, get: function() { return protocol_declaration_1.DeclarationRequest; } }); var protocol_selectionRange_1 = require_protocol_selectionRange(); Object.defineProperty(exports, "SelectionRangeRequest", { enumerable: true, get: function() { return protocol_selectionRange_1.SelectionRangeRequest; } }); var protocol_progress_1 = require_protocol_progress(); Object.defineProperty(exports, "WorkDoneProgress", { enumerable: true, get: function() { return protocol_progress_1.WorkDoneProgress; } }); Object.defineProperty(exports, "WorkDoneProgressCreateRequest", { enumerable: true, get: function() { return protocol_progress_1.WorkDoneProgressCreateRequest; } }); Object.defineProperty(exports, "WorkDoneProgressCancelNotification", { enumerable: true, get: function() { return protocol_progress_1.WorkDoneProgressCancelNotification; } }); var protocol_callHierarchy_1 = require_protocol_callHierarchy(); Object.defineProperty(exports, "CallHierarchyIncomingCallsRequest", { enumerable: true, get: function() { return protocol_callHierarchy_1.CallHierarchyIncomingCallsRequest; } }); Object.defineProperty(exports, "CallHierarchyOutgoingCallsRequest", { enumerable: true, get: function() { return protocol_callHierarchy_1.CallHierarchyOutgoingCallsRequest; } }); Object.defineProperty(exports, "CallHierarchyPrepareRequest", { enumerable: true, get: function() { return protocol_callHierarchy_1.CallHierarchyPrepareRequest; } }); var protocol_semanticTokens_1 = require_protocol_semanticTokens(); Object.defineProperty(exports, "TokenFormat", { enumerable: true, get: function() { return protocol_semanticTokens_1.TokenFormat; } }); Object.defineProperty(exports, "SemanticTokensRequest", { enumerable: true, get: function() { return protocol_semanticTokens_1.SemanticTokensRequest; } }); Object.defineProperty(exports, "SemanticTokensDeltaRequest", { enumerable: true, get: function() { return protocol_semanticTokens_1.SemanticTokensDeltaRequest; } }); Object.defineProperty(exports, "SemanticTokensRangeRequest", { enumerable: true, get: function() { return protocol_semanticTokens_1.SemanticTokensRangeRequest; } }); Object.defineProperty(exports, "SemanticTokensRefreshRequest", { enumerable: true, get: function() { return protocol_semanticTokens_1.SemanticTokensRefreshRequest; } }); Object.defineProperty(exports, "SemanticTokensRegistrationType", { enumerable: true, get: function() { return protocol_semanticTokens_1.SemanticTokensRegistrationType; } }); var protocol_showDocument_1 = require_protocol_showDocument(); Object.defineProperty(exports, "ShowDocumentRequest", { enumerable: true, get: function() { return protocol_showDocument_1.ShowDocumentRequest; } }); var protocol_linkedEditingRange_1 = require_protocol_linkedEditingRange(); Object.defineProperty(exports, "LinkedEditingRangeRequest", { enumerable: true, get: function() { return protocol_linkedEditingRange_1.LinkedEditingRangeRequest; } }); var protocol_fileOperations_1 = require_protocol_fileOperations(); Object.defineProperty(exports, "FileOperationPatternKind", { enumerable: true, get: function() { return protocol_fileOperations_1.FileOperationPatternKind; } }); Object.defineProperty(exports, "DidCreateFilesNotification", { enumerable: true, get: function() { return protocol_fileOperations_1.DidCreateFilesNotification; } }); Object.defineProperty(exports, "WillCreateFilesRequest", { enumerable: true, get: function() { return protocol_fileOperations_1.WillCreateFilesRequest; } }); Object.defineProperty(exports, "DidRenameFilesNotification", { enumerable: true, get: function() { return protocol_fileOperations_1.DidRenameFilesNotification; } }); Object.defineProperty(exports, "WillRenameFilesRequest", { enumerable: true, get: function() { return protocol_fileOperations_1.WillRenameFilesRequest; } }); Object.defineProperty(exports, "DidDeleteFilesNotification", { enumerable: true, get: function() { return protocol_fileOperations_1.DidDeleteFilesNotification; } }); Object.defineProperty(exports, "WillDeleteFilesRequest", { enumerable: true, get: function() { return protocol_fileOperations_1.WillDeleteFilesRequest; } }); var protocol_moniker_1 = require_protocol_moniker(); Object.defineProperty(exports, "UniquenessLevel", { enumerable: true, get: function() { return protocol_moniker_1.UniquenessLevel; } }); Object.defineProperty(exports, "MonikerKind", { enumerable: true, get: function() { return protocol_moniker_1.MonikerKind; } }); Object.defineProperty(exports, "MonikerRequest", { enumerable: true, get: function() { return protocol_moniker_1.MonikerRequest; } }); var protocol_typeHierarchy_1 = require_protocol_typeHierarchy(); Object.defineProperty(exports, "TypeHierarchyPrepareRequest", { enumerable: true, get: function() { return protocol_typeHierarchy_1.TypeHierarchyPrepareRequest; } }); Object.defineProperty(exports, "TypeHierarchySubtypesRequest", { enumerable: true, get: function() { return protocol_typeHierarchy_1.TypeHierarchySubtypesRequest; } }); Object.defineProperty(exports, "TypeHierarchySupertypesRequest", { enumerable: true, get: function() { return protocol_typeHierarchy_1.TypeHierarchySupertypesRequest; } }); var protocol_inlineValue_1 = require_protocol_inlineValue(); Object.defineProperty(exports, "InlineValueRequest", { enumerable: true, get: function() { return protocol_inlineValue_1.InlineValueRequest; } }); Object.defineProperty(exports, "InlineValueRefreshRequest", { enumerable: true, get: function() { return protocol_inlineValue_1.InlineValueRefreshRequest; } }); var protocol_inlayHint_1 = require_protocol_inlayHint(); Object.defineProperty(exports, "InlayHintRequest", { enumerable: true, get: function() { return protocol_inlayHint_1.InlayHintRequest; } }); Object.defineProperty(exports, "InlayHintResolveRequest", { enumerable: true, get: function() { return protocol_inlayHint_1.InlayHintResolveRequest; } }); Object.defineProperty(exports, "InlayHintRefreshRequest", { enumerable: true, get: function() { return protocol_inlayHint_1.InlayHintRefreshRequest; } }); var protocol_diagnostic_1 = require_protocol_diagnostic(); Object.defineProperty(exports, "DiagnosticServerCancellationData", { enumerable: true, get: function() { return protocol_diagnostic_1.DiagnosticServerCancellationData; } }); Object.defineProperty(exports, "DocumentDiagnosticReportKind", { enumerable: true, get: function() { return protocol_diagnostic_1.DocumentDiagnosticReportKind; } }); Object.defineProperty(exports, "DocumentDiagnosticRequest", { enumerable: true, get: function() { return protocol_diagnostic_1.DocumentDiagnosticRequest; } }); Object.defineProperty(exports, "WorkspaceDiagnosticRequest", { enumerable: true, get: function() { return protocol_diagnostic_1.WorkspaceDiagnosticRequest; } }); Object.defineProperty(exports, "DiagnosticRefreshRequest", { enumerable: true, get: function() { return protocol_diagnostic_1.DiagnosticRefreshRequest; } }); var protocol_notebook_1 = require_protocol_notebook(); Object.defineProperty(exports, "NotebookCellKind", { enumerable: true, get: function() { return protocol_notebook_1.NotebookCellKind; } }); Object.defineProperty(exports, "ExecutionSummary", { enumerable: true, get: function() { return protocol_notebook_1.ExecutionSummary; } }); Object.defineProperty(exports, "NotebookCell", { enumerable: true, get: function() { return protocol_notebook_1.NotebookCell; } }); Object.defineProperty(exports, "NotebookDocument", { enumerable: true, get: function() { return protocol_notebook_1.NotebookDocument; } }); Object.defineProperty(exports, "NotebookDocumentSyncRegistrationType", { enumerable: true, get: function() { return protocol_notebook_1.NotebookDocumentSyncRegistrationType; } }); Object.defineProperty(exports, "DidOpenNotebookDocumentNotification", { enumerable: true, get: function() { return protocol_notebook_1.DidOpenNotebookDocumentNotification; } }); Object.defineProperty(exports, "NotebookCellArrayChange", { enumerable: true, get: function() { return protocol_notebook_1.NotebookCellArrayChange; } }); Object.defineProperty(exports, "DidChangeNotebookDocumentNotification", { enumerable: true, get: function() { return protocol_notebook_1.DidChangeNotebookDocumentNotification; } }); Object.defineProperty(exports, "DidSaveNotebookDocumentNotification", { enumerable: true, get: function() { return protocol_notebook_1.DidSaveNotebookDocumentNotification; } }); Object.defineProperty(exports, "DidCloseNotebookDocumentNotification", { enumerable: true, get: function() { return protocol_notebook_1.DidCloseNotebookDocumentNotification; } }); var protocol_inlineCompletion_1 = require_protocol_inlineCompletion(); Object.defineProperty(exports, "InlineCompletionRequest", { enumerable: true, get: function() { return protocol_inlineCompletion_1.InlineCompletionRequest; } }); var TextDocumentFilter; (function(TextDocumentFilter2) { function is(value) { const candidate = value; return Is2.string(candidate) || (Is2.string(candidate.language) || Is2.string(candidate.scheme) || Is2.string(candidate.pattern)); } TextDocumentFilter2.is = is; })(TextDocumentFilter || (exports.TextDocumentFilter = TextDocumentFilter = {})); var NotebookDocumentFilter; (function(NotebookDocumentFilter2) { function is(value) { const candidate = value; return Is2.objectLiteral(candidate) && (Is2.string(candidate.notebookType) || Is2.string(candidate.scheme) || Is2.string(candidate.pattern)); } NotebookDocumentFilter2.is = is; })(NotebookDocumentFilter || (exports.NotebookDocumentFilter = NotebookDocumentFilter = {})); var NotebookCellTextDocumentFilter; (function(NotebookCellTextDocumentFilter2) { function is(value) { const candidate = value; return Is2.objectLiteral(candidate) && (Is2.string(candidate.notebook) || NotebookDocumentFilter.is(candidate.notebook)) && (candidate.language === void 0 || Is2.string(candidate.language)); } NotebookCellTextDocumentFilter2.is = is; })(NotebookCellTextDocumentFilter || (exports.NotebookCellTextDocumentFilter = NotebookCellTextDocumentFilter = {})); var DocumentSelector; (function(DocumentSelector2) { function is(value) { if (!Array.isArray(value)) { return false; } for (let elem of value) { if (!Is2.string(elem) && !TextDocumentFilter.is(elem) && !NotebookCellTextDocumentFilter.is(elem)) { return false; } } return true; } DocumentSelector2.is = is; })(DocumentSelector || (exports.DocumentSelector = DocumentSelector = {})); var RegistrationRequest2; (function(RegistrationRequest3) { RegistrationRequest3.method = "client/registerCapability"; RegistrationRequest3.messageDirection = messages_1.MessageDirection.serverToClient; RegistrationRequest3.type = new messages_1.ProtocolRequestType(RegistrationRequest3.method); })(RegistrationRequest2 || (exports.RegistrationRequest = RegistrationRequest2 = {})); var UnregistrationRequest; (function(UnregistrationRequest2) { UnregistrationRequest2.method = "client/unregisterCapability"; UnregistrationRequest2.messageDirection = messages_1.MessageDirection.serverToClient; UnregistrationRequest2.type = new messages_1.ProtocolRequestType(UnregistrationRequest2.method); })(UnregistrationRequest || (exports.UnregistrationRequest = UnregistrationRequest = {})); var ResourceOperationKind; (function(ResourceOperationKind2) { ResourceOperationKind2.Create = "create"; ResourceOperationKind2.Rename = "rename"; ResourceOperationKind2.Delete = "delete"; })(ResourceOperationKind || (exports.ResourceOperationKind = ResourceOperationKind = {})); var FailureHandlingKind; (function(FailureHandlingKind2) { FailureHandlingKind2.Abort = "abort"; FailureHandlingKind2.Transactional = "transactional"; FailureHandlingKind2.TextOnlyTransactional = "textOnlyTransactional"; FailureHandlingKind2.Undo = "undo"; })(FailureHandlingKind || (exports.FailureHandlingKind = FailureHandlingKind = {})); var PositionEncodingKind; (function(PositionEncodingKind2) { PositionEncodingKind2.UTF8 = "utf-8"; PositionEncodingKind2.UTF16 = "utf-16"; PositionEncodingKind2.UTF32 = "utf-32"; })(PositionEncodingKind || (exports.PositionEncodingKind = PositionEncodingKind = {})); var StaticRegistrationOptions; (function(StaticRegistrationOptions2) { function hasId(value) { const candidate = value; return candidate && Is2.string(candidate.id) && candidate.id.length > 0; } StaticRegistrationOptions2.hasId = hasId; })(StaticRegistrationOptions || (exports.StaticRegistrationOptions = StaticRegistrationOptions = {})); var TextDocumentRegistrationOptions; (function(TextDocumentRegistrationOptions2) { function is(value) { const candidate = value; return candidate && (candidate.documentSelector === null || DocumentSelector.is(candidate.documentSelector)); } TextDocumentRegistrationOptions2.is = is; })(TextDocumentRegistrationOptions || (exports.TextDocumentRegistrationOptions = TextDocumentRegistrationOptions = {})); var WorkDoneProgressOptions; (function(WorkDoneProgressOptions2) { function is(value) { const candidate = value; return Is2.objectLiteral(candidate) && (candidate.workDoneProgress === void 0 || Is2.boolean(candidate.workDoneProgress)); } WorkDoneProgressOptions2.is = is; function hasWorkDoneProgress(value) { const candidate = value; return candidate && Is2.boolean(candidate.workDoneProgress); } WorkDoneProgressOptions2.hasWorkDoneProgress = hasWorkDoneProgress; })(WorkDoneProgressOptions || (exports.WorkDoneProgressOptions = WorkDoneProgressOptions = {})); var InitializeRequest2; (function(InitializeRequest3) { InitializeRequest3.method = "initialize"; InitializeRequest3.messageDirection = messages_1.MessageDirection.clientToServer; InitializeRequest3.type = new messages_1.ProtocolRequestType(InitializeRequest3.method); })(InitializeRequest2 || (exports.InitializeRequest = InitializeRequest2 = {})); var InitializeErrorCodes; (function(InitializeErrorCodes2) { InitializeErrorCodes2.unknownProtocolVersion = 1; })(InitializeErrorCodes || (exports.InitializeErrorCodes = InitializeErrorCodes = {})); var InitializedNotification2; (function(InitializedNotification3) { InitializedNotification3.method = "initialized"; InitializedNotification3.messageDirection = messages_1.MessageDirection.clientToServer; InitializedNotification3.type = new messages_1.ProtocolNotificationType(InitializedNotification3.method); })(InitializedNotification2 || (exports.InitializedNotification = InitializedNotification2 = {})); var ShutdownRequest; (function(ShutdownRequest2) { ShutdownRequest2.method = "shutdown"; ShutdownRequest2.messageDirection = messages_1.MessageDirection.clientToServer; ShutdownRequest2.type = new messages_1.ProtocolRequestType0(ShutdownRequest2.method); })(ShutdownRequest || (exports.ShutdownRequest = ShutdownRequest = {})); var ExitNotification; (function(ExitNotification2) { ExitNotification2.method = "exit"; ExitNotification2.messageDirection = messages_1.MessageDirection.clientToServer; ExitNotification2.type = new messages_1.ProtocolNotificationType0(ExitNotification2.method); })(ExitNotification || (exports.ExitNotification = ExitNotification = {})); var DidChangeConfigurationNotification; (function(DidChangeConfigurationNotification2) { DidChangeConfigurationNotification2.method = "workspace/didChangeConfiguration"; DidChangeConfigurationNotification2.messageDirection = messages_1.MessageDirection.clientToServer; DidChangeConfigurationNotification2.type = new messages_1.ProtocolNotificationType(DidChangeConfigurationNotification2.method); })(DidChangeConfigurationNotification || (exports.DidChangeConfigurationNotification = DidChangeConfigurationNotification = {})); var MessageType; (function(MessageType2) { MessageType2.Error = 1; MessageType2.Warning = 2; MessageType2.Info = 3; MessageType2.Log = 4; MessageType2.Debug = 5; })(MessageType || (exports.MessageType = MessageType = {})); var ShowMessageNotification; (function(ShowMessageNotification2) { ShowMessageNotification2.method = "window/showMessage"; ShowMessageNotification2.messageDirection = messages_1.MessageDirection.serverToClient; ShowMessageNotification2.type = new messages_1.ProtocolNotificationType(ShowMessageNotification2.method); })(ShowMessageNotification || (exports.ShowMessageNotification = ShowMessageNotification = {})); var ShowMessageRequest; (function(ShowMessageRequest2) { ShowMessageRequest2.method = "window/showMessageRequest"; ShowMessageRequest2.messageDirection = messages_1.MessageDirection.serverToClient; ShowMessageRequest2.type = new messages_1.ProtocolRequestType(ShowMessageRequest2.method); })(ShowMessageRequest || (exports.ShowMessageRequest = ShowMessageRequest = {})); var LogMessageNotification2; (function(LogMessageNotification3) { LogMessageNotification3.method = "window/logMessage"; LogMessageNotification3.messageDirection = messages_1.MessageDirection.serverToClient; LogMessageNotification3.type = new messages_1.ProtocolNotificationType(LogMessageNotification3.method); })(LogMessageNotification2 || (exports.LogMessageNotification = LogMessageNotification2 = {})); var TelemetryEventNotification; (function(TelemetryEventNotification2) { TelemetryEventNotification2.method = "telemetry/event"; TelemetryEventNotification2.messageDirection = messages_1.MessageDirection.serverToClient; TelemetryEventNotification2.type = new messages_1.ProtocolNotificationType(TelemetryEventNotification2.method); })(TelemetryEventNotification || (exports.TelemetryEventNotification = TelemetryEventNotification = {})); var TextDocumentSyncKind; (function(TextDocumentSyncKind2) { TextDocumentSyncKind2.None = 0; TextDocumentSyncKind2.Full = 1; TextDocumentSyncKind2.Incremental = 2; })(TextDocumentSyncKind || (exports.TextDocumentSyncKind = TextDocumentSyncKind = {})); var DidOpenTextDocumentNotification2; (function(DidOpenTextDocumentNotification3) { DidOpenTextDocumentNotification3.method = "textDocument/didOpen"; DidOpenTextDocumentNotification3.messageDirection = messages_1.MessageDirection.clientToServer; DidOpenTextDocumentNotification3.type = new messages_1.ProtocolNotificationType(DidOpenTextDocumentNotification3.method); })(DidOpenTextDocumentNotification2 || (exports.DidOpenTextDocumentNotification = DidOpenTextDocumentNotification2 = {})); var TextDocumentContentChangeEvent2; (function(TextDocumentContentChangeEvent3) { function isIncremental(event) { let candidate = event; return candidate !== void 0 && candidate !== null && typeof candidate.text === "string" && candidate.range !== void 0 && (candidate.rangeLength === void 0 || typeof candidate.rangeLength === "number"); } TextDocumentContentChangeEvent3.isIncremental = isIncremental; function isFull(event) { let candidate = event; return candidate !== void 0 && candidate !== null && typeof candidate.text === "string" && candidate.range === void 0 && candidate.rangeLength === void 0; } TextDocumentContentChangeEvent3.isFull = isFull; })(TextDocumentContentChangeEvent2 || (exports.TextDocumentContentChangeEvent = TextDocumentContentChangeEvent2 = {})); var DidChangeTextDocumentNotification2; (function(DidChangeTextDocumentNotification3) { DidChangeTextDocumentNotification3.method = "textDocument/didChange"; DidChangeTextDocumentNotification3.messageDirection = messages_1.MessageDirection.clientToServer; DidChangeTextDocumentNotification3.type = new messages_1.ProtocolNotificationType(DidChangeTextDocumentNotification3.method); })(DidChangeTextDocumentNotification2 || (exports.DidChangeTextDocumentNotification = DidChangeTextDocumentNotification2 = {})); var DidCloseTextDocumentNotification2; (function(DidCloseTextDocumentNotification3) { DidCloseTextDocumentNotification3.method = "textDocument/didClose"; DidCloseTextDocumentNotification3.messageDirection = messages_1.MessageDirection.clientToServer; DidCloseTextDocumentNotification3.type = new messages_1.ProtocolNotificationType(DidCloseTextDocumentNotification3.method); })(DidCloseTextDocumentNotification2 || (exports.DidCloseTextDocumentNotification = DidCloseTextDocumentNotification2 = {})); var DidSaveTextDocumentNotification; (function(DidSaveTextDocumentNotification2) { DidSaveTextDocumentNotification2.method = "textDocument/didSave"; DidSaveTextDocumentNotification2.messageDirection = messages_1.MessageDirection.clientToServer; DidSaveTextDocumentNotification2.type = new messages_1.ProtocolNotificationType(DidSaveTextDocumentNotification2.method); })(DidSaveTextDocumentNotification || (exports.DidSaveTextDocumentNotification = DidSaveTextDocumentNotification = {})); var TextDocumentSaveReason; (function(TextDocumentSaveReason2) { TextDocumentSaveReason2.Manual = 1; TextDocumentSaveReason2.AfterDelay = 2; TextDocumentSaveReason2.FocusOut = 3; })(TextDocumentSaveReason || (exports.TextDocumentSaveReason = TextDocumentSaveReason = {})); var WillSaveTextDocumentNotification; (function(WillSaveTextDocumentNotification2) { WillSaveTextDocumentNotification2.method = "textDocument/willSave"; WillSaveTextDocumentNotification2.messageDirection = messages_1.MessageDirection.clientToServer; WillSaveTextDocumentNotification2.type = new messages_1.ProtocolNotificationType(WillSaveTextDocumentNotification2.method); })(WillSaveTextDocumentNotification || (exports.WillSaveTextDocumentNotification = WillSaveTextDocumentNotification = {})); var WillSaveTextDocumentWaitUntilRequest; (function(WillSaveTextDocumentWaitUntilRequest2) { WillSaveTextDocumentWaitUntilRequest2.method = "textDocument/willSaveWaitUntil"; WillSaveTextDocumentWaitUntilRequest2.messageDirection = messages_1.MessageDirection.clientToServer; WillSaveTextDocumentWaitUntilRequest2.type = new messages_1.ProtocolRequestType(WillSaveTextDocumentWaitUntilRequest2.method); })(WillSaveTextDocumentWaitUntilRequest || (exports.WillSaveTextDocumentWaitUntilRequest = WillSaveTextDocumentWaitUntilRequest = {})); var DidChangeWatchedFilesNotification; (function(DidChangeWatchedFilesNotification2) { DidChangeWatchedFilesNotification2.method = "workspace/didChangeWatchedFiles"; DidChangeWatchedFilesNotification2.messageDirection = messages_1.MessageDirection.clientToServer; DidChangeWatchedFilesNotification2.type = new messages_1.ProtocolNotificationType(DidChangeWatchedFilesNotification2.method); })(DidChangeWatchedFilesNotification || (exports.DidChangeWatchedFilesNotification = DidChangeWatchedFilesNotification = {})); var FileChangeType; (function(FileChangeType2) { FileChangeType2.Created = 1; FileChangeType2.Changed = 2; FileChangeType2.Deleted = 3; })(FileChangeType || (exports.FileChangeType = FileChangeType = {})); var RelativePattern; (function(RelativePattern2) { function is(value) { const candidate = value; return Is2.objectLiteral(candidate) && (vscode_languageserver_types_1.URI.is(candidate.baseUri) || vscode_languageserver_types_1.WorkspaceFolder.is(candidate.baseUri)) && Is2.string(candidate.pattern); } RelativePattern2.is = is; })(RelativePattern || (exports.RelativePattern = RelativePattern = {})); var WatchKind; (function(WatchKind2) { WatchKind2.Create = 1; WatchKind2.Change = 2; WatchKind2.Delete = 4; })(WatchKind || (exports.WatchKind = WatchKind = {})); var PublishDiagnosticsNotification2; (function(PublishDiagnosticsNotification3) { PublishDiagnosticsNotification3.method = "textDocument/publishDiagnostics"; PublishDiagnosticsNotification3.messageDirection = messages_1.MessageDirection.serverToClient; PublishDiagnosticsNotification3.type = new messages_1.ProtocolNotificationType(PublishDiagnosticsNotification3.method); })(PublishDiagnosticsNotification2 || (exports.PublishDiagnosticsNotification = PublishDiagnosticsNotification2 = {})); var CompletionTriggerKind2; (function(CompletionTriggerKind3) { CompletionTriggerKind3.Invoked = 1; CompletionTriggerKind3.TriggerCharacter = 2; CompletionTriggerKind3.TriggerForIncompleteCompletions = 3; })(CompletionTriggerKind2 || (exports.CompletionTriggerKind = CompletionTriggerKind2 = {})); var CompletionRequest2; (function(CompletionRequest3) { CompletionRequest3.method = "textDocument/completion"; CompletionRequest3.messageDirection = messages_1.MessageDirection.clientToServer; CompletionRequest3.type = new messages_1.ProtocolRequestType(CompletionRequest3.method); })(CompletionRequest2 || (exports.CompletionRequest = CompletionRequest2 = {})); var CompletionResolveRequest; (function(CompletionResolveRequest2) { CompletionResolveRequest2.method = "completionItem/resolve"; CompletionResolveRequest2.messageDirection = messages_1.MessageDirection.clientToServer; CompletionResolveRequest2.type = new messages_1.ProtocolRequestType(CompletionResolveRequest2.method); })(CompletionResolveRequest || (exports.CompletionResolveRequest = CompletionResolveRequest = {})); var HoverRequest2; (function(HoverRequest3) { HoverRequest3.method = "textDocument/hover"; HoverRequest3.messageDirection = messages_1.MessageDirection.clientToServer; HoverRequest3.type = new messages_1.ProtocolRequestType(HoverRequest3.method); })(HoverRequest2 || (exports.HoverRequest = HoverRequest2 = {})); var SignatureHelpTriggerKind; (function(SignatureHelpTriggerKind2) { SignatureHelpTriggerKind2.Invoked = 1; SignatureHelpTriggerKind2.TriggerCharacter = 2; SignatureHelpTriggerKind2.ContentChange = 3; })(SignatureHelpTriggerKind || (exports.SignatureHelpTriggerKind = SignatureHelpTriggerKind = {})); var SignatureHelpRequest2; (function(SignatureHelpRequest3) { SignatureHelpRequest3.method = "textDocument/signatureHelp"; SignatureHelpRequest3.messageDirection = messages_1.MessageDirection.clientToServer; SignatureHelpRequest3.type = new messages_1.ProtocolRequestType(SignatureHelpRequest3.method); })(SignatureHelpRequest2 || (exports.SignatureHelpRequest = SignatureHelpRequest2 = {})); var DefinitionRequest; (function(DefinitionRequest2) { DefinitionRequest2.method = "textDocument/definition"; DefinitionRequest2.messageDirection = messages_1.MessageDirection.clientToServer; DefinitionRequest2.type = new messages_1.ProtocolRequestType(DefinitionRequest2.method); })(DefinitionRequest || (exports.DefinitionRequest = DefinitionRequest = {})); var ReferencesRequest; (function(ReferencesRequest2) { ReferencesRequest2.method = "textDocument/references"; ReferencesRequest2.messageDirection = messages_1.MessageDirection.clientToServer; ReferencesRequest2.type = new messages_1.ProtocolRequestType(ReferencesRequest2.method); })(ReferencesRequest || (exports.ReferencesRequest = ReferencesRequest = {})); var DocumentHighlightRequest; (function(DocumentHighlightRequest2) { DocumentHighlightRequest2.method = "textDocument/documentHighlight"; DocumentHighlightRequest2.messageDirection = messages_1.MessageDirection.clientToServer; DocumentHighlightRequest2.type = new messages_1.ProtocolRequestType(DocumentHighlightRequest2.method); })(DocumentHighlightRequest || (exports.DocumentHighlightRequest = DocumentHighlightRequest = {})); var DocumentSymbolRequest; (function(DocumentSymbolRequest2) { DocumentSymbolRequest2.method = "textDocument/documentSymbol"; DocumentSymbolRequest2.messageDirection = messages_1.MessageDirection.clientToServer; DocumentSymbolRequest2.type = new messages_1.ProtocolRequestType(DocumentSymbolRequest2.method); })(DocumentSymbolRequest || (exports.DocumentSymbolRequest = DocumentSymbolRequest = {})); var CodeActionRequest; (function(CodeActionRequest2) { CodeActionRequest2.method = "textDocument/codeAction"; CodeActionRequest2.messageDirection = messages_1.MessageDirection.clientToServer; CodeActionRequest2.type = new messages_1.ProtocolRequestType(CodeActionRequest2.method); })(CodeActionRequest || (exports.CodeActionRequest = CodeActionRequest = {})); var CodeActionResolveRequest; (function(CodeActionResolveRequest2) { CodeActionResolveRequest2.method = "codeAction/resolve"; CodeActionResolveRequest2.messageDirection = messages_1.MessageDirection.clientToServer; CodeActionResolveRequest2.type = new messages_1.ProtocolRequestType(CodeActionResolveRequest2.method); })(CodeActionResolveRequest || (exports.CodeActionResolveRequest = CodeActionResolveRequest = {})); var WorkspaceSymbolRequest; (function(WorkspaceSymbolRequest2) { WorkspaceSymbolRequest2.method = "workspace/symbol"; WorkspaceSymbolRequest2.messageDirection = messages_1.MessageDirection.clientToServer; WorkspaceSymbolRequest2.type = new messages_1.ProtocolRequestType(WorkspaceSymbolRequest2.method); })(WorkspaceSymbolRequest || (exports.WorkspaceSymbolRequest = WorkspaceSymbolRequest = {})); var WorkspaceSymbolResolveRequest; (function(WorkspaceSymbolResolveRequest2) { WorkspaceSymbolResolveRequest2.method = "workspaceSymbol/resolve"; WorkspaceSymbolResolveRequest2.messageDirection = messages_1.MessageDirection.clientToServer; WorkspaceSymbolResolveRequest2.type = new messages_1.ProtocolRequestType(WorkspaceSymbolResolveRequest2.method); })(WorkspaceSymbolResolveRequest || (exports.WorkspaceSymbolResolveRequest = WorkspaceSymbolResolveRequest = {})); var CodeLensRequest; (function(CodeLensRequest2) { CodeLensRequest2.method = "textDocument/codeLens"; CodeLensRequest2.messageDirection = messages_1.MessageDirection.clientToServer; CodeLensRequest2.type = new messages_1.ProtocolRequestType(CodeLensRequest2.method); })(CodeLensRequest || (exports.CodeLensRequest = CodeLensRequest = {})); var CodeLensResolveRequest; (function(CodeLensResolveRequest2) { CodeLensResolveRequest2.method = "codeLens/resolve"; CodeLensResolveRequest2.messageDirection = messages_1.MessageDirection.clientToServer; CodeLensResolveRequest2.type = new messages_1.ProtocolRequestType(CodeLensResolveRequest2.method); })(CodeLensResolveRequest || (exports.CodeLensResolveRequest = CodeLensResolveRequest = {})); var CodeLensRefreshRequest; (function(CodeLensRefreshRequest2) { CodeLensRefreshRequest2.method = `workspace/codeLens/refresh`; CodeLensRefreshRequest2.messageDirection = messages_1.MessageDirection.serverToClient; CodeLensRefreshRequest2.type = new messages_1.ProtocolRequestType0(CodeLensRefreshRequest2.method); })(CodeLensRefreshRequest || (exports.CodeLensRefreshRequest = CodeLensRefreshRequest = {})); var DocumentLinkRequest; (function(DocumentLinkRequest2) { DocumentLinkRequest2.method = "textDocument/documentLink"; DocumentLinkRequest2.messageDirection = messages_1.MessageDirection.clientToServer; DocumentLinkRequest2.type = new messages_1.ProtocolRequestType(DocumentLinkRequest2.method); })(DocumentLinkRequest || (exports.DocumentLinkRequest = DocumentLinkRequest = {})); var DocumentLinkResolveRequest; (function(DocumentLinkResolveRequest2) { DocumentLinkResolveRequest2.method = "documentLink/resolve"; DocumentLinkResolveRequest2.messageDirection = messages_1.MessageDirection.clientToServer; DocumentLinkResolveRequest2.type = new messages_1.ProtocolRequestType(DocumentLinkResolveRequest2.method); })(DocumentLinkResolveRequest || (exports.DocumentLinkResolveRequest = DocumentLinkResolveRequest = {})); var DocumentFormattingRequest; (function(DocumentFormattingRequest2) { DocumentFormattingRequest2.method = "textDocument/formatting"; DocumentFormattingRequest2.messageDirection = messages_1.MessageDirection.clientToServer; DocumentFormattingRequest2.type = new messages_1.ProtocolRequestType(DocumentFormattingRequest2.method); })(DocumentFormattingRequest || (exports.DocumentFormattingRequest = DocumentFormattingRequest = {})); var DocumentRangeFormattingRequest; (function(DocumentRangeFormattingRequest2) { DocumentRangeFormattingRequest2.method = "textDocument/rangeFormatting"; DocumentRangeFormattingRequest2.messageDirection = messages_1.MessageDirection.clientToServer; DocumentRangeFormattingRequest2.type = new messages_1.ProtocolRequestType(DocumentRangeFormattingRequest2.method); })(DocumentRangeFormattingRequest || (exports.DocumentRangeFormattingRequest = DocumentRangeFormattingRequest = {})); var DocumentRangesFormattingRequest; (function(DocumentRangesFormattingRequest2) { DocumentRangesFormattingRequest2.method = "textDocument/rangesFormatting"; DocumentRangesFormattingRequest2.messageDirection = messages_1.MessageDirection.clientToServer; DocumentRangesFormattingRequest2.type = new messages_1.ProtocolRequestType(DocumentRangesFormattingRequest2.method); })(DocumentRangesFormattingRequest || (exports.DocumentRangesFormattingRequest = DocumentRangesFormattingRequest = {})); var DocumentOnTypeFormattingRequest; (function(DocumentOnTypeFormattingRequest2) { DocumentOnTypeFormattingRequest2.method = "textDocument/onTypeFormatting"; DocumentOnTypeFormattingRequest2.messageDirection = messages_1.MessageDirection.clientToServer; DocumentOnTypeFormattingRequest2.type = new messages_1.ProtocolRequestType(DocumentOnTypeFormattingRequest2.method); })(DocumentOnTypeFormattingRequest || (exports.DocumentOnTypeFormattingRequest = DocumentOnTypeFormattingRequest = {})); var PrepareSupportDefaultBehavior; (function(PrepareSupportDefaultBehavior2) { PrepareSupportDefaultBehavior2.Identifier = 1; })(PrepareSupportDefaultBehavior || (exports.PrepareSupportDefaultBehavior = PrepareSupportDefaultBehavior = {})); var RenameRequest; (function(RenameRequest2) { RenameRequest2.method = "textDocument/rename"; RenameRequest2.messageDirection = messages_1.MessageDirection.clientToServer; RenameRequest2.type = new messages_1.ProtocolRequestType(RenameRequest2.method); })(RenameRequest || (exports.RenameRequest = RenameRequest = {})); var PrepareRenameRequest; (function(PrepareRenameRequest2) { PrepareRenameRequest2.method = "textDocument/prepareRename"; PrepareRenameRequest2.messageDirection = messages_1.MessageDirection.clientToServer; PrepareRenameRequest2.type = new messages_1.ProtocolRequestType(PrepareRenameRequest2.method); })(PrepareRenameRequest || (exports.PrepareRenameRequest = PrepareRenameRequest = {})); var ExecuteCommandRequest; (function(ExecuteCommandRequest2) { ExecuteCommandRequest2.method = "workspace/executeCommand"; ExecuteCommandRequest2.messageDirection = messages_1.MessageDirection.clientToServer; ExecuteCommandRequest2.type = new messages_1.ProtocolRequestType(ExecuteCommandRequest2.method); })(ExecuteCommandRequest || (exports.ExecuteCommandRequest = ExecuteCommandRequest = {})); var ApplyWorkspaceEditRequest; (function(ApplyWorkspaceEditRequest2) { ApplyWorkspaceEditRequest2.method = "workspace/applyEdit"; ApplyWorkspaceEditRequest2.messageDirection = messages_1.MessageDirection.serverToClient; ApplyWorkspaceEditRequest2.type = new messages_1.ProtocolRequestType("workspace/applyEdit"); })(ApplyWorkspaceEditRequest || (exports.ApplyWorkspaceEditRequest = ApplyWorkspaceEditRequest = {})); } }); // node_modules/vscode-languageserver-protocol/lib/common/connection.js var require_connection2 = __commonJS({ "node_modules/vscode-languageserver-protocol/lib/common/connection.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.createProtocolConnection = void 0; var vscode_jsonrpc_1 = require_main(); function createProtocolConnection(input, output, logger, options2) { if (vscode_jsonrpc_1.ConnectionStrategy.is(options2)) { options2 = { connectionStrategy: options2 }; } return (0, vscode_jsonrpc_1.createMessageConnection)(input, output, logger, options2); } exports.createProtocolConnection = createProtocolConnection; } }); // node_modules/vscode-languageserver-protocol/lib/common/api.js var require_api2 = __commonJS({ "node_modules/vscode-languageserver-protocol/lib/common/api.js"(exports) { "use strict"; var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) { if (k2 === void 0) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); } : function(o, m, k, k2) { if (k2 === void 0) k2 = k; o[k2] = m[k]; }); var __exportStar = exports && exports.__exportStar || function(m, exports2) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding(exports2, m, p); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.LSPErrorCodes = exports.createProtocolConnection = void 0; __exportStar(require_main(), exports); __exportStar((init_main(), __toCommonJS(main_exports)), exports); __exportStar(require_messages2(), exports); __exportStar(require_protocol(), exports); var connection_1 = require_connection2(); Object.defineProperty(exports, "createProtocolConnection", { enumerable: true, get: function() { return connection_1.createProtocolConnection; } }); var LSPErrorCodes; (function(LSPErrorCodes2) { LSPErrorCodes2.lspReservedErrorRangeStart = -32899; LSPErrorCodes2.RequestFailed = -32803; LSPErrorCodes2.ServerCancelled = -32802; LSPErrorCodes2.ContentModified = -32801; LSPErrorCodes2.RequestCancelled = -32800; LSPErrorCodes2.lspReservedErrorRangeEnd = -32800; })(LSPErrorCodes || (exports.LSPErrorCodes = LSPErrorCodes = {})); } }); // node_modules/vscode-languageserver-protocol/lib/browser/main.js var require_main2 = __commonJS({ "node_modules/vscode-languageserver-protocol/lib/browser/main.js"(exports) { "use strict"; var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) { if (k2 === void 0) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); } : function(o, m, k, k2) { if (k2 === void 0) k2 = k; o[k2] = m[k]; }); var __exportStar = exports && exports.__exportStar || function(m, exports2) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding(exports2, m, p); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.createProtocolConnection = void 0; var browser_1 = require_browser(); __exportStar(require_browser(), exports); __exportStar(require_api2(), exports); function createProtocolConnection(reader, writer, logger, options2) { return (0, browser_1.createMessageConnection)(reader, writer, logger, options2); } exports.createProtocolConnection = createProtocolConnection; } }); // node_modules/dompurify/dist/purify.js var require_purify = __commonJS({ "node_modules/dompurify/dist/purify.js"(exports, module) { (function(global, factory) { typeof exports === "object" && typeof module !== "undefined" ? module.exports = factory() : typeof define === "function" && define.amd ? define(factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, global.DOMPurify = factory()); })(exports, function() { "use strict"; const { entries, setPrototypeOf, isFrozen, getPrototypeOf, getOwnPropertyDescriptor } = Object; let { freeze, seal, create } = Object; let { apply, construct } = typeof Reflect !== "undefined" && Reflect; if (!freeze) { freeze = function freeze2(x) { return x; }; } if (!seal) { seal = function seal2(x) { return x; }; } if (!apply) { apply = function apply2(fun, thisValue, args) { return fun.apply(thisValue, args); }; } if (!construct) { construct = function construct2(Func, args) { return new Func(...args); }; } const arrayForEach = unapply(Array.prototype.forEach); const arrayPop = unapply(Array.prototype.pop); const arrayPush = unapply(Array.prototype.push); const stringToLowerCase = unapply(String.prototype.toLowerCase); const stringToString = unapply(String.prototype.toString); const stringMatch = unapply(String.prototype.match); const stringReplace = unapply(String.prototype.replace); const stringIndexOf = unapply(String.prototype.indexOf); const stringTrim = unapply(String.prototype.trim); const regExpTest = unapply(RegExp.prototype.test); const typeErrorCreate = unconstruct(TypeError); function unapply(func) { return function(thisArg) { for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { args[_key - 1] = arguments[_key]; } return apply(func, thisArg, args); }; } function unconstruct(func) { return function() { for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { args[_key2] = arguments[_key2]; } return construct(func, args); }; } function addToSet(set, array) { let transformCaseFunc = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : stringToLowerCase; if (setPrototypeOf) { setPrototypeOf(set, null); } let l = array.length; while (l--) { let element = array[l]; if (typeof element === "string") { const lcElement = transformCaseFunc(element); if (lcElement !== element) { if (!isFrozen(array)) { array[l] = lcElement; } element = lcElement; } } set[element] = true; } return set; } function clone(object) { const newObject = create(null); for (const [property, value] of entries(object)) { if (getOwnPropertyDescriptor(object, property) !== void 0) { newObject[property] = value; } } return newObject; } function lookupGetter(object, prop) { while (object !== null) { const desc = getOwnPropertyDescriptor(object, prop); if (desc) { if (desc.get) { return unapply(desc.get); } if (typeof desc.value === "function") { return unapply(desc.value); } } object = getPrototypeOf(object); } function fallbackValue(element) { console.warn("fallback value for", element); return null; } return fallbackValue; } const html$1 = freeze(["a", "abbr", "acronym", "address", "area", "article", "aside", "audio", "b", "bdi", "bdo", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "decorator", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "element", "em", "fieldset", "figcaption", "figure", "font", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "marquee", "menu", "menuitem", "meter", "nav", "nobr", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "section", "select", "shadow", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "tt", "u", "ul", "var", "video", "wbr"]); const svg$1 = freeze(["svg", "a", "altglyph", "altglyphdef", "altglyphitem", "animatecolor", "animatemotion", "animatetransform", "circle", "clippath", "defs", "desc", "ellipse", "filter", "font", "g", "glyph", "glyphref", "hkern", "image", "line", "lineargradient", "marker", "mask", "metadata", "mpath", "path", "pattern", "polygon", "polyline", "radialgradient", "rect", "stop", "style", "switch", "symbol", "text", "textpath", "title", "tref", "tspan", "view", "vkern"]); const svgFilters = freeze(["feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence"]); const svgDisallowed = freeze(["animate", "color-profile", "cursor", "discard", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignobject", "hatch", "hatchpath", "mesh", "meshgradient", "meshpatch", "meshrow", "missing-glyph", "script", "set", "solidcolor", "unknown", "use"]); const mathMl$1 = freeze(["math", "menclose", "merror", "mfenced", "mfrac", "mglyph", "mi", "mlabeledtr", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msup", "msubsup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover", "mprescripts"]); const mathMlDisallowed = freeze(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]); const text = freeze(["#text"]); const html2 = freeze(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "nonce", "noshade", "novalidate", "nowrap", "open", "optimum", "pattern", "placeholder", "playsinline", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "xmlns", "slot"]); const svg2 = freeze(["accent-height", "accumulate", "additive", "alignment-baseline", "ascent", "attributename", "attributetype", "azimuth", "basefrequency", "baseline-shift", "begin", "bias", "by", "class", "clip", "clippathunits", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "cx", "cy", "d", "dx", "dy", "diffuseconstant", "direction", "display", "divisor", "dur", "edgemode", "elevation", "end", "fill", "fill-opacity", "fill-rule", "filter", "filterunits", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "fx", "fy", "g1", "g2", "glyph-name", "glyphref", "gradientunits", "gradienttransform", "height", "href", "id", "image-rendering", "in", "in2", "k", "k1", "k2", "k3", "k4", "kerning", "keypoints", "keysplines", "keytimes", "lang", "lengthadjust", "letter-spacing", "kernelmatrix", "kernelunitlength", "lighting-color", "local", "marker-end", "marker-mid", "marker-start", "markerheight", "markerunits", "markerwidth", "maskcontentunits", "maskunits", "max", "mask", "media", "method", "mode", "min", "name", "numoctaves", "offset", "operator", "opacity", "order", "orient", "orientation", "origin", "overflow", "paint-order", "path", "pathlength", "patterncontentunits", "patterntransform", "patternunits", "points", "preservealpha", "preserveaspectratio", "primitiveunits", "r", "rx", "ry", "radius", "refx", "refy", "repeatcount", "repeatdur", "restart", "result", "rotate", "scale", "seed", "shape-rendering", "specularconstant", "specularexponent", "spreadmethod", "startoffset", "stddeviation", "stitchtiles", "stop-color", "stop-opacity", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke", "stroke-width", "style", "surfacescale", "systemlanguage", "tabindex", "targetx", "targety", "transform", "transform-origin", "text-anchor", "text-decoration", "text-rendering", "textlength", "type", "u1", "u2", "unicode", "values", "viewbox", "visibility", "version", "vert-adv-y", "vert-origin-x", "vert-origin-y", "width", "word-spacing", "wrap", "writing-mode", "xchannelselector", "ychannelselector", "x", "x1", "x2", "xmlns", "y", "y1", "y2", "z", "zoomandpan"]); const mathMl = freeze(["accent", "accentunder", "align", "bevelled", "close", "columnsalign", "columnlines", "columnspan", "denomalign", "depth", "dir", "display", "displaystyle", "encoding", "fence", "frame", "height", "href", "id", "largeop", "length", "linethickness", "lspace", "lquote", "mathbackground", "mathcolor", "mathsize", "mathvariant", "maxsize", "minsize", "movablelimits", "notation", "numalign", "open", "rowalign", "rowlines", "rowspacing", "rowspan", "rspace", "rquote", "scriptlevel", "scriptminsize", "scriptsizemultiplier", "selection", "separator", "separators", "stretchy", "subscriptshift", "supscriptshift", "symmetric", "voffset", "width", "xmlns"]); const xml = freeze(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]); const MUSTACHE_EXPR = seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm); const ERB_EXPR = seal(/<%[\w\W]*|[\w\W]*%>/gm); const TMPLIT_EXPR = seal(/\${[\w\W]*}/gm); const DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]/); const ARIA_ATTR = seal(/^aria-[\-\w]+$/); const IS_ALLOWED_URI = seal( /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i // eslint-disable-line no-useless-escape ); const IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i); const ATTR_WHITESPACE = seal( /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g // eslint-disable-line no-control-regex ); const DOCTYPE_NAME = seal(/^html$/i); var EXPRESSIONS = /* @__PURE__ */ Object.freeze({ __proto__: null, MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR, DATA_ATTR, ARIA_ATTR, IS_ALLOWED_URI, IS_SCRIPT_OR_DATA, ATTR_WHITESPACE, DOCTYPE_NAME }); const getGlobal = function getGlobal2() { return typeof window === "undefined" ? null : window; }; const _createTrustedTypesPolicy = function _createTrustedTypesPolicy2(trustedTypes, purifyHostElement) { if (typeof trustedTypes !== "object" || typeof trustedTypes.createPolicy !== "function") { return null; } let suffix = null; const ATTR_NAME = "data-tt-policy-suffix"; if (purifyHostElement && purifyHostElement.hasAttribute(ATTR_NAME)) { suffix = purifyHostElement.getAttribute(ATTR_NAME); } const policyName = "dompurify" + (suffix ? "#" + suffix : ""); try { return trustedTypes.createPolicy(policyName, { createHTML(html3) { return html3; }, createScriptURL(scriptUrl) { return scriptUrl; } }); } catch (_) { console.warn("TrustedTypes policy " + policyName + " could not be created."); return null; } }; function createDOMPurify() { let window2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : getGlobal(); const DOMPurify2 = (root) => createDOMPurify(root); DOMPurify2.version = "3.0.6"; DOMPurify2.removed = []; if (!window2 || !window2.document || window2.document.nodeType !== 9) { DOMPurify2.isSupported = false; return DOMPurify2; } let { document: document2 } = window2; const originalDocument = document2; const currentScript = originalDocument.currentScript; const { DocumentFragment, HTMLTemplateElement, Node, Element: Element2, NodeFilter, NamedNodeMap = window2.NamedNodeMap || window2.MozNamedAttrMap, HTMLFormElement, DOMParser, trustedTypes } = window2; const ElementPrototype = Element2.prototype; const cloneNode = lookupGetter(ElementPrototype, "cloneNode"); const getNextSibling = lookupGetter(ElementPrototype, "nextSibling"); const getChildNodes = lookupGetter(ElementPrototype, "childNodes"); const getParentNode = lookupGetter(ElementPrototype, "parentNode"); if (typeof HTMLTemplateElement === "function") { const template = document2.createElement("template"); if (template.content && template.content.ownerDocument) { document2 = template.content.ownerDocument; } } let trustedTypesPolicy; let emptyHTML = ""; const { implementation, createNodeIterator, createDocumentFragment, getElementsByTagName } = document2; const { importNode } = originalDocument; let hooks = {}; DOMPurify2.isSupported = typeof entries === "function" && typeof getParentNode === "function" && implementation && implementation.createHTMLDocument !== void 0; const { MUSTACHE_EXPR: MUSTACHE_EXPR2, ERB_EXPR: ERB_EXPR2, TMPLIT_EXPR: TMPLIT_EXPR2, DATA_ATTR: DATA_ATTR2, ARIA_ATTR: ARIA_ATTR2, IS_SCRIPT_OR_DATA: IS_SCRIPT_OR_DATA2, ATTR_WHITESPACE: ATTR_WHITESPACE2 } = EXPRESSIONS; let { IS_ALLOWED_URI: IS_ALLOWED_URI$1 } = EXPRESSIONS; let ALLOWED_TAGS = null; const DEFAULT_ALLOWED_TAGS = addToSet({}, [...html$1, ...svg$1, ...svgFilters, ...mathMl$1, ...text]); let ALLOWED_ATTR = null; const DEFAULT_ALLOWED_ATTR = addToSet({}, [...html2, ...svg2, ...mathMl, ...xml]); let CUSTOM_ELEMENT_HANDLING = Object.seal(create(null, { tagNameCheck: { writable: true, configurable: false, enumerable: true, value: null }, attributeNameCheck: { writable: true, configurable: false, enumerable: true, value: null }, allowCustomizedBuiltInElements: { writable: true, configurable: false, enumerable: true, value: false } })); let FORBID_TAGS = null; let FORBID_ATTR = null; let ALLOW_ARIA_ATTR = true; let ALLOW_DATA_ATTR = true; let ALLOW_UNKNOWN_PROTOCOLS = false; let ALLOW_SELF_CLOSE_IN_ATTR = true; let SAFE_FOR_TEMPLATES = false; let WHOLE_DOCUMENT = false; let SET_CONFIG = false; let FORCE_BODY = false; let RETURN_DOM = false; let RETURN_DOM_FRAGMENT = false; let RETURN_TRUSTED_TYPE = false; let SANITIZE_DOM = true; let SANITIZE_NAMED_PROPS = false; const SANITIZE_NAMED_PROPS_PREFIX = "user-content-"; let KEEP_CONTENT = true; let IN_PLACE = false; let USE_PROFILES = {}; let FORBID_CONTENTS = null; const DEFAULT_FORBID_CONTENTS = addToSet({}, ["annotation-xml", "audio", "colgroup", "desc", "foreignobject", "head", "iframe", "math", "mi", "mn", "mo", "ms", "mtext", "noembed", "noframes", "noscript", "plaintext", "script", "style", "svg", "template", "thead", "title", "video", "xmp"]); let DATA_URI_TAGS = null; const DEFAULT_DATA_URI_TAGS = addToSet({}, ["audio", "video", "img", "source", "image", "track"]); let URI_SAFE_ATTRIBUTES = null; const DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]); const MATHML_NAMESPACE = "http://www.w3.org/1998/Math/MathML"; const SVG_NAMESPACE = "http://www.w3.org/2000/svg"; const HTML_NAMESPACE = "http://www.w3.org/1999/xhtml"; let NAMESPACE = HTML_NAMESPACE; let IS_EMPTY_INPUT = false; let ALLOWED_NAMESPACES = null; const DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [MATHML_NAMESPACE, SVG_NAMESPACE, HTML_NAMESPACE], stringToString); let PARSER_MEDIA_TYPE = null; const SUPPORTED_PARSER_MEDIA_TYPES = ["application/xhtml+xml", "text/html"]; const DEFAULT_PARSER_MEDIA_TYPE = "text/html"; let transformCaseFunc = null; let CONFIG = null; const formElement = document2.createElement("form"); const isRegexOrFunction = function isRegexOrFunction2(testValue) { return testValue instanceof RegExp || testValue instanceof Function; }; const _parseConfig = function _parseConfig2() { let cfg = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; if (CONFIG && CONFIG === cfg) { return; } if (!cfg || typeof cfg !== "object") { cfg = {}; } cfg = clone(cfg); PARSER_MEDIA_TYPE = // eslint-disable-next-line unicorn/prefer-includes SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? PARSER_MEDIA_TYPE = DEFAULT_PARSER_MEDIA_TYPE : PARSER_MEDIA_TYPE = cfg.PARSER_MEDIA_TYPE; transformCaseFunc = PARSER_MEDIA_TYPE === "application/xhtml+xml" ? stringToString : stringToLowerCase; ALLOWED_TAGS = "ALLOWED_TAGS" in cfg ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS; ALLOWED_ATTR = "ALLOWED_ATTR" in cfg ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR; ALLOWED_NAMESPACES = "ALLOWED_NAMESPACES" in cfg ? addToSet({}, cfg.ALLOWED_NAMESPACES, stringToString) : DEFAULT_ALLOWED_NAMESPACES; URI_SAFE_ATTRIBUTES = "ADD_URI_SAFE_ATTR" in cfg ? addToSet( clone(DEFAULT_URI_SAFE_ATTRIBUTES), // eslint-disable-line indent cfg.ADD_URI_SAFE_ATTR, // eslint-disable-line indent transformCaseFunc // eslint-disable-line indent ) : DEFAULT_URI_SAFE_ATTRIBUTES; DATA_URI_TAGS = "ADD_DATA_URI_TAGS" in cfg ? addToSet( clone(DEFAULT_DATA_URI_TAGS), // eslint-disable-line indent cfg.ADD_DATA_URI_TAGS, // eslint-disable-line indent transformCaseFunc // eslint-disable-line indent ) : DEFAULT_DATA_URI_TAGS; FORBID_CONTENTS = "FORBID_CONTENTS" in cfg ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS; FORBID_TAGS = "FORBID_TAGS" in cfg ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : {}; FORBID_ATTR = "FORBID_ATTR" in cfg ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : {}; USE_PROFILES = "USE_PROFILES" in cfg ? cfg.USE_PROFILES : false; ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false; ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false; ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false; ALLOW_SELF_CLOSE_IN_ATTR = cfg.ALLOW_SELF_CLOSE_IN_ATTR !== false; SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false; WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false; RETURN_DOM = cfg.RETURN_DOM || false; RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false; RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false; FORCE_BODY = cfg.FORCE_BODY || false; SANITIZE_DOM = cfg.SANITIZE_DOM !== false; SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false; KEEP_CONTENT = cfg.KEEP_CONTENT !== false; IN_PLACE = cfg.IN_PLACE || false; IS_ALLOWED_URI$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI; NAMESPACE = cfg.NAMESPACE || HTML_NAMESPACE; CUSTOM_ELEMENT_HANDLING = cfg.CUSTOM_ELEMENT_HANDLING || {}; if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck)) { CUSTOM_ELEMENT_HANDLING.tagNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck; } if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)) { CUSTOM_ELEMENT_HANDLING.attributeNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck; } if (cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements === "boolean") { CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements; } if (SAFE_FOR_TEMPLATES) { ALLOW_DATA_ATTR = false; } if (RETURN_DOM_FRAGMENT) { RETURN_DOM = true; } if (USE_PROFILES) { ALLOWED_TAGS = addToSet({}, [...text]); ALLOWED_ATTR = []; if (USE_PROFILES.html === true) { addToSet(ALLOWED_TAGS, html$1); addToSet(ALLOWED_ATTR, html2); } if (USE_PROFILES.svg === true) { addToSet(ALLOWED_TAGS, svg$1); addToSet(ALLOWED_ATTR, svg2); addToSet(ALLOWED_ATTR, xml); } if (USE_PROFILES.svgFilters === true) { addToSet(ALLOWED_TAGS, svgFilters); addToSet(ALLOWED_ATTR, svg2); addToSet(ALLOWED_ATTR, xml); } if (USE_PROFILES.mathMl === true) { addToSet(ALLOWED_TAGS, mathMl$1); addToSet(ALLOWED_ATTR, mathMl); addToSet(ALLOWED_ATTR, xml); } } if (cfg.ADD_TAGS) { if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) { ALLOWED_TAGS = clone(ALLOWED_TAGS); } addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc); } if (cfg.ADD_ATTR) { if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) { ALLOWED_ATTR = clone(ALLOWED_ATTR); } addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc); } if (cfg.ADD_URI_SAFE_ATTR) { addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc); } if (cfg.FORBID_CONTENTS) { if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) { FORBID_CONTENTS = clone(FORBID_CONTENTS); } addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc); } if (KEEP_CONTENT) { ALLOWED_TAGS["#text"] = true; } if (WHOLE_DOCUMENT) { addToSet(ALLOWED_TAGS, ["html", "head", "body"]); } if (ALLOWED_TAGS.table) { addToSet(ALLOWED_TAGS, ["tbody"]); delete FORBID_TAGS.tbody; } if (cfg.TRUSTED_TYPES_POLICY) { if (typeof cfg.TRUSTED_TYPES_POLICY.createHTML !== "function") { throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.'); } if (typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL !== "function") { throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.'); } trustedTypesPolicy = cfg.TRUSTED_TYPES_POLICY; emptyHTML = trustedTypesPolicy.createHTML(""); } else { if (trustedTypesPolicy === void 0) { trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, currentScript); } if (trustedTypesPolicy !== null && typeof emptyHTML === "string") { emptyHTML = trustedTypesPolicy.createHTML(""); } } if (freeze) { freeze(cfg); } CONFIG = cfg; }; const MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ["mi", "mo", "mn", "ms", "mtext"]); const HTML_INTEGRATION_POINTS = addToSet({}, ["foreignobject", "desc", "title", "annotation-xml"]); const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ["title", "style", "font", "a", "script"]); const ALL_SVG_TAGS = addToSet({}, svg$1); addToSet(ALL_SVG_TAGS, svgFilters); addToSet(ALL_SVG_TAGS, svgDisallowed); const ALL_MATHML_TAGS = addToSet({}, mathMl$1); addToSet(ALL_MATHML_TAGS, mathMlDisallowed); const _checkValidNamespace = function _checkValidNamespace2(element) { let parent = getParentNode(element); if (!parent || !parent.tagName) { parent = { namespaceURI: NAMESPACE, tagName: "template" }; } const tagName = stringToLowerCase(element.tagName); const parentTagName = stringToLowerCase(parent.tagName); if (!ALLOWED_NAMESPACES[element.namespaceURI]) { return false; } if (element.namespaceURI === SVG_NAMESPACE) { if (parent.namespaceURI === HTML_NAMESPACE) { return tagName === "svg"; } if (parent.namespaceURI === MATHML_NAMESPACE) { return tagName === "svg" && (parentTagName === "annotation-xml" || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]); } return Boolean(ALL_SVG_TAGS[tagName]); } if (element.namespaceURI === MATHML_NAMESPACE) { if (parent.namespaceURI === HTML_NAMESPACE) { return tagName === "math"; } if (parent.namespaceURI === SVG_NAMESPACE) { return tagName === "math" && HTML_INTEGRATION_POINTS[parentTagName]; } return Boolean(ALL_MATHML_TAGS[tagName]); } if (element.namespaceURI === HTML_NAMESPACE) { if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) { return false; } if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) { return false; } return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]); } if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && ALLOWED_NAMESPACES[element.namespaceURI]) { return true; } return false; }; const _forceRemove = function _forceRemove2(node) { arrayPush(DOMPurify2.removed, { element: node }); try { node.parentNode.removeChild(node); } catch (_) { node.remove(); } }; const _removeAttribute = function _removeAttribute2(name2, node) { try { arrayPush(DOMPurify2.removed, { attribute: node.getAttributeNode(name2), from: node }); } catch (_) { arrayPush(DOMPurify2.removed, { attribute: null, from: node }); } node.removeAttribute(name2); if (name2 === "is" && !ALLOWED_ATTR[name2]) { if (RETURN_DOM || RETURN_DOM_FRAGMENT) { try { _forceRemove(node); } catch (_) { } } else { try { node.setAttribute(name2, ""); } catch (_) { } } } }; const _initDocument = function _initDocument2(dirty) { let doc2 = null; let leadingWhitespace = null; if (FORCE_BODY) { dirty = "" + dirty; } else { const matches = stringMatch(dirty, /^[\r\n\t ]+/); leadingWhitespace = matches && matches[0]; } if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && NAMESPACE === HTML_NAMESPACE) { dirty = '' + dirty + ""; } const dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty; if (NAMESPACE === HTML_NAMESPACE) { try { doc2 = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE); } catch (_) { } } if (!doc2 || !doc2.documentElement) { doc2 = implementation.createDocument(NAMESPACE, "template", null); try { doc2.documentElement.innerHTML = IS_EMPTY_INPUT ? emptyHTML : dirtyPayload; } catch (_) { } } const body = doc2.body || doc2.documentElement; if (dirty && leadingWhitespace) { body.insertBefore(document2.createTextNode(leadingWhitespace), body.childNodes[0] || null); } if (NAMESPACE === HTML_NAMESPACE) { return getElementsByTagName.call(doc2, WHOLE_DOCUMENT ? "html" : "body")[0]; } return WHOLE_DOCUMENT ? doc2.documentElement : body; }; const _createNodeIterator = function _createNodeIterator2(root) { return createNodeIterator.call( root.ownerDocument || root, root, // eslint-disable-next-line no-bitwise NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT, null ); }; const _isClobbered = function _isClobbered2(elm) { return elm instanceof HTMLFormElement && (typeof elm.nodeName !== "string" || typeof elm.textContent !== "string" || typeof elm.removeChild !== "function" || !(elm.attributes instanceof NamedNodeMap) || typeof elm.removeAttribute !== "function" || typeof elm.setAttribute !== "function" || typeof elm.namespaceURI !== "string" || typeof elm.insertBefore !== "function" || typeof elm.hasChildNodes !== "function"); }; const _isNode = function _isNode2(object) { return typeof Node === "function" && object instanceof Node; }; const _executeHook = function _executeHook2(entryPoint, currentNode, data) { if (!hooks[entryPoint]) { return; } arrayForEach(hooks[entryPoint], (hook) => { hook.call(DOMPurify2, currentNode, data, CONFIG); }); }; const _sanitizeElements = function _sanitizeElements2(currentNode) { let content2 = null; _executeHook("beforeSanitizeElements", currentNode, null); if (_isClobbered(currentNode)) { _forceRemove(currentNode); return true; } const tagName = transformCaseFunc(currentNode.nodeName); _executeHook("uponSanitizeElement", currentNode, { tagName, allowedTags: ALLOWED_TAGS }); if (currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(/<[/\w]/g, currentNode.innerHTML) && regExpTest(/<[/\w]/g, currentNode.textContent)) { _forceRemove(currentNode); return true; } if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) { if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) { if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) { return false; } if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) { return false; } } if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) { const parentNode = getParentNode(currentNode) || currentNode.parentNode; const childNodes = getChildNodes(currentNode) || currentNode.childNodes; if (childNodes && parentNode) { const childCount = childNodes.length; for (let i = childCount - 1; i >= 0; --i) { parentNode.insertBefore(cloneNode(childNodes[i], true), getNextSibling(currentNode)); } } } _forceRemove(currentNode); return true; } if (currentNode instanceof Element2 && !_checkValidNamespace(currentNode)) { _forceRemove(currentNode); return true; } if ((tagName === "noscript" || tagName === "noembed" || tagName === "noframes") && regExpTest(/<\/no(script|embed|frames)/i, currentNode.innerHTML)) { _forceRemove(currentNode); return true; } if (SAFE_FOR_TEMPLATES && currentNode.nodeType === 3) { content2 = currentNode.textContent; arrayForEach([MUSTACHE_EXPR2, ERB_EXPR2, TMPLIT_EXPR2], (expr) => { content2 = stringReplace(content2, expr, " "); }); if (currentNode.textContent !== content2) { arrayPush(DOMPurify2.removed, { element: currentNode.cloneNode() }); currentNode.textContent = content2; } } _executeHook("afterSanitizeElements", currentNode, null); return false; }; const _isValidAttribute = function _isValidAttribute2(lcTag, lcName, value) { if (SANITIZE_DOM && (lcName === "id" || lcName === "name") && (value in document2 || value in formElement)) { return false; } if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR2, lcName)) ; else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR2, lcName)) ; else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) { if ( // First condition does a very basic check if a) it's basically a valid custom element tagname AND // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck // and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck _isBasicCustomElement(lcTag) && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(lcTag)) && (CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName) || CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.attributeNameCheck(lcName)) || // Alternative, second condition checks if it's an `is`-attribute, AND // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck lcName === "is" && CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, value) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(value)) ) ; else { return false; } } else if (URI_SAFE_ATTRIBUTES[lcName]) ; else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE2, ""))) ; else if ((lcName === "src" || lcName === "xlink:href" || lcName === "href") && lcTag !== "script" && stringIndexOf(value, "data:") === 0 && DATA_URI_TAGS[lcTag]) ; else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA2, stringReplace(value, ATTR_WHITESPACE2, ""))) ; else if (value) { return false; } else ; return true; }; const _isBasicCustomElement = function _isBasicCustomElement2(tagName) { return tagName.indexOf("-") > 0; }; const _sanitizeAttributes = function _sanitizeAttributes2(currentNode) { _executeHook("beforeSanitizeAttributes", currentNode, null); const { attributes } = currentNode; if (!attributes) { return; } const hookEvent = { attrName: "", attrValue: "", keepAttr: true, allowedAttributes: ALLOWED_ATTR }; let l = attributes.length; while (l--) { const attr = attributes[l]; const { name: name2, namespaceURI, value: attrValue } = attr; const lcName = transformCaseFunc(name2); let value = name2 === "value" ? attrValue : stringTrim(attrValue); hookEvent.attrName = lcName; hookEvent.attrValue = value; hookEvent.keepAttr = true; hookEvent.forceKeepAttr = void 0; _executeHook("uponSanitizeAttribute", currentNode, hookEvent); value = hookEvent.attrValue; if (hookEvent.forceKeepAttr) { continue; } _removeAttribute(name2, currentNode); if (!hookEvent.keepAttr) { continue; } if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(/\/>/i, value)) { _removeAttribute(name2, currentNode); continue; } if (SAFE_FOR_TEMPLATES) { arrayForEach([MUSTACHE_EXPR2, ERB_EXPR2, TMPLIT_EXPR2], (expr) => { value = stringReplace(value, expr, " "); }); } const lcTag = transformCaseFunc(currentNode.nodeName); if (!_isValidAttribute(lcTag, lcName, value)) { continue; } if (SANITIZE_NAMED_PROPS && (lcName === "id" || lcName === "name")) { _removeAttribute(name2, currentNode); value = SANITIZE_NAMED_PROPS_PREFIX + value; } if (trustedTypesPolicy && typeof trustedTypes === "object" && typeof trustedTypes.getAttributeType === "function") { if (namespaceURI) ; else { switch (trustedTypes.getAttributeType(lcTag, lcName)) { case "TrustedHTML": { value = trustedTypesPolicy.createHTML(value); break; } case "TrustedScriptURL": { value = trustedTypesPolicy.createScriptURL(value); break; } } } } try { if (namespaceURI) { currentNode.setAttributeNS(namespaceURI, name2, value); } else { currentNode.setAttribute(name2, value); } arrayPop(DOMPurify2.removed); } catch (_) { } } _executeHook("afterSanitizeAttributes", currentNode, null); }; const _sanitizeShadowDOM = function _sanitizeShadowDOM2(fragment) { let shadowNode = null; const shadowIterator = _createNodeIterator(fragment); _executeHook("beforeSanitizeShadowDOM", fragment, null); while (shadowNode = shadowIterator.nextNode()) { _executeHook("uponSanitizeShadowNode", shadowNode, null); if (_sanitizeElements(shadowNode)) { continue; } if (shadowNode.content instanceof DocumentFragment) { _sanitizeShadowDOM2(shadowNode.content); } _sanitizeAttributes(shadowNode); } _executeHook("afterSanitizeShadowDOM", fragment, null); }; DOMPurify2.sanitize = function(dirty) { let cfg = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; let body = null; let importedNode = null; let currentNode = null; let returnNode = null; IS_EMPTY_INPUT = !dirty; if (IS_EMPTY_INPUT) { dirty = ""; } if (typeof dirty !== "string" && !_isNode(dirty)) { if (typeof dirty.toString === "function") { dirty = dirty.toString(); if (typeof dirty !== "string") { throw typeErrorCreate("dirty is not a string, aborting"); } } else { throw typeErrorCreate("toString is not a function"); } } if (!DOMPurify2.isSupported) { return dirty; } if (!SET_CONFIG) { _parseConfig(cfg); } DOMPurify2.removed = []; if (typeof dirty === "string") { IN_PLACE = false; } if (IN_PLACE) { if (dirty.nodeName) { const tagName = transformCaseFunc(dirty.nodeName); if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) { throw typeErrorCreate("root node is forbidden and cannot be sanitized in-place"); } } } else if (dirty instanceof Node) { body = _initDocument(""); importedNode = body.ownerDocument.importNode(dirty, true); if (importedNode.nodeType === 1 && importedNode.nodeName === "BODY") { body = importedNode; } else if (importedNode.nodeName === "HTML") { body = importedNode; } else { body.appendChild(importedNode); } } else { if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT && // eslint-disable-next-line unicorn/prefer-includes dirty.indexOf("<") === -1) { return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(dirty) : dirty; } body = _initDocument(dirty); if (!body) { return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : ""; } } if (body && FORCE_BODY) { _forceRemove(body.firstChild); } const nodeIterator = _createNodeIterator(IN_PLACE ? dirty : body); while (currentNode = nodeIterator.nextNode()) { if (_sanitizeElements(currentNode)) { continue; } if (currentNode.content instanceof DocumentFragment) { _sanitizeShadowDOM(currentNode.content); } _sanitizeAttributes(currentNode); } if (IN_PLACE) { return dirty; } if (RETURN_DOM) { if (RETURN_DOM_FRAGMENT) { returnNode = createDocumentFragment.call(body.ownerDocument); while (body.firstChild) { returnNode.appendChild(body.firstChild); } } else { returnNode = body; } if (ALLOWED_ATTR.shadowroot || ALLOWED_ATTR.shadowrootmode) { returnNode = importNode.call(originalDocument, returnNode, true); } return returnNode; } let serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML; if (WHOLE_DOCUMENT && ALLOWED_TAGS["!doctype"] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name)) { serializedHTML = "\n" + serializedHTML; } if (SAFE_FOR_TEMPLATES) { arrayForEach([MUSTACHE_EXPR2, ERB_EXPR2, TMPLIT_EXPR2], (expr) => { serializedHTML = stringReplace(serializedHTML, expr, " "); }); } return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(serializedHTML) : serializedHTML; }; DOMPurify2.setConfig = function() { let cfg = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; _parseConfig(cfg); SET_CONFIG = true; }; DOMPurify2.clearConfig = function() { CONFIG = null; SET_CONFIG = false; }; DOMPurify2.isValidAttribute = function(tag, attr, value) { if (!CONFIG) { _parseConfig({}); } const lcTag = transformCaseFunc(tag); const lcName = transformCaseFunc(attr); return _isValidAttribute(lcTag, lcName, value); }; DOMPurify2.addHook = function(entryPoint, hookFunction) { if (typeof hookFunction !== "function") { return; } hooks[entryPoint] = hooks[entryPoint] || []; arrayPush(hooks[entryPoint], hookFunction); }; DOMPurify2.removeHook = function(entryPoint) { if (hooks[entryPoint]) { return arrayPop(hooks[entryPoint]); } }; DOMPurify2.removeHooks = function(entryPoint) { if (hooks[entryPoint]) { hooks[entryPoint] = []; } }; DOMPurify2.removeAllHooks = function() { hooks = {}; }; return DOMPurify2; } var purify = createDOMPurify(); return purify; }); } }); // node_modules/@codemirror/state/dist/index.js var Text2 = class _Text { /** Get the line description around the given position. */ lineAt(pos) { if (pos < 0 || pos > this.length) throw new RangeError(`Invalid position ${pos} in document of length ${this.length}`); return this.lineInner(pos, false, 1, 0); } /** Get the description for the given (1-based) line number. */ line(n) { if (n < 1 || n > this.lines) throw new RangeError(`Invalid line number ${n} in ${this.lines}-line document`); return this.lineInner(n, true, 1, 0); } /** Replace a range of the text with the given content. */ replace(from, to, text) { let parts = []; this.decompose( 0, from, parts, 2 /* Open.To */ ); if (text.length) text.decompose( 0, text.length, parts, 1 | 2 /* Open.To */ ); this.decompose( to, this.length, parts, 1 /* Open.From */ ); return TextNode.from(parts, this.length - (to - from) + text.length); } /** Append another document to this one. */ append(other) { return this.replace(this.length, this.length, other); } /** Retrieve the text between the given points. */ slice(from, to = this.length) { let parts = []; this.decompose(from, to, parts, 0); return TextNode.from(parts, to - from); } /** Test whether this text is equal to another instance. */ eq(other) { if (other == this) return true; if (other.length != this.length || other.lines != this.lines) return false; let start = this.scanIdentical(other, 1), end = this.length - this.scanIdentical(other, -1); let a = new RawTextCursor(this), b = new RawTextCursor(other); for (let skip = start, pos = start; ; ) { a.next(skip); b.next(skip); skip = 0; if (a.lineBreak != b.lineBreak || a.done != b.done || a.value != b.value) return false; pos += a.value.length; if (a.done || pos >= end) return true; } } /** Iterate over the text. When `dir` is `-1`, iteration happens from end to start. This will return lines and the breaks between them as separate strings. */ iter(dir = 1) { return new RawTextCursor(this, dir); } /** Iterate over a range of the text. When `from` > `to`, the iterator will run in reverse. */ iterRange(from, to = this.length) { return new PartialTextCursor(this, from, to); } /** Return a cursor that iterates over the given range of lines, _without_ returning the line breaks between, and yielding empty strings for empty lines. When `from` and `to` are given, they should be 1-based line numbers. */ iterLines(from, to) { let inner; if (from == null) { inner = this.iter(); } else { if (to == null) to = this.lines + 1; let start = this.line(from).from; inner = this.iterRange(start, Math.max(start, to == this.lines + 1 ? this.length : to <= 1 ? 0 : this.line(to - 1).to)); } return new LineCursor(inner); } /** Return the document as a string, using newline characters to separate lines. */ toString() { return this.sliceString(0); } /** Convert the document to an array of lines (which can be deserialized again via [`Text.of`](https://codemirror.net/6/docs/ref/#state.Text^of)). */ toJSON() { let lines = []; this.flatten(lines); return lines; } /** @internal */ constructor() { } /** Create a `Text` instance for the given array of lines. */ static of(text) { if (text.length == 0) throw new RangeError("A document must have at least one line"); if (text.length == 1 && !text[0]) return _Text.empty; return text.length <= 32 ? new TextLeaf(text) : TextNode.from(TextLeaf.split(text, [])); } }; var TextLeaf = class _TextLeaf extends Text2 { constructor(text, length = textLength(text)) { super(); this.text = text; this.length = length; } get lines() { return this.text.length; } get children() { return null; } lineInner(target, isLine, line, offset) { for (let i = 0; ; i++) { let string2 = this.text[i], end = offset + string2.length; if ((isLine ? line : end) >= target) return new Line(offset, end, line, string2); offset = end + 1; line++; } } decompose(from, to, target, open) { let text = from <= 0 && to >= this.length ? this : new _TextLeaf(sliceText(this.text, from, to), Math.min(to, this.length) - Math.max(0, from)); if (open & 1) { let prev = target.pop(); let joined = appendText(text.text, prev.text.slice(), 0, text.length); if (joined.length <= 32) { target.push(new _TextLeaf(joined, prev.length + text.length)); } else { let mid = joined.length >> 1; target.push(new _TextLeaf(joined.slice(0, mid)), new _TextLeaf(joined.slice(mid))); } } else { target.push(text); } } replace(from, to, text) { if (!(text instanceof _TextLeaf)) return super.replace(from, to, text); let lines = appendText(this.text, appendText(text.text, sliceText(this.text, 0, from)), to); let newLen = this.length + text.length - (to - from); if (lines.length <= 32) return new _TextLeaf(lines, newLen); return TextNode.from(_TextLeaf.split(lines, []), newLen); } sliceString(from, to = this.length, lineSep = "\n") { let result = ""; for (let pos = 0, i = 0; pos <= to && i < this.text.length; i++) { let line = this.text[i], end = pos + line.length; if (pos > from && i) result += lineSep; if (from < end && to > pos) result += line.slice(Math.max(0, from - pos), to - pos); pos = end + 1; } return result; } flatten(target) { for (let line of this.text) target.push(line); } scanIdentical() { return 0; } static split(text, target) { let part = [], len = -1; for (let line of text) { part.push(line); len += line.length + 1; if (part.length == 32) { target.push(new _TextLeaf(part, len)); part = []; len = -1; } } if (len > -1) target.push(new _TextLeaf(part, len)); return target; } }; var TextNode = class _TextNode extends Text2 { constructor(children, length) { super(); this.children = children; this.length = length; this.lines = 0; for (let child of children) this.lines += child.lines; } lineInner(target, isLine, line, offset) { for (let i = 0; ; i++) { let child = this.children[i], end = offset + child.length, endLine = line + child.lines - 1; if ((isLine ? endLine : end) >= target) return child.lineInner(target, isLine, line, offset); offset = end + 1; line = endLine + 1; } } decompose(from, to, target, open) { for (let i = 0, pos = 0; pos <= to && i < this.children.length; i++) { let child = this.children[i], end = pos + child.length; if (from <= end && to >= pos) { let childOpen = open & ((pos <= from ? 1 : 0) | (end >= to ? 2 : 0)); if (pos >= from && end <= to && !childOpen) target.push(child); else child.decompose(from - pos, to - pos, target, childOpen); } pos = end + 1; } } replace(from, to, text) { if (text.lines < this.lines) for (let i = 0, pos = 0; i < this.children.length; i++) { let child = this.children[i], end = pos + child.length; if (from >= pos && to <= end) { let updated = child.replace(from - pos, to - pos, text); let totalLines = this.lines - child.lines + updated.lines; if (updated.lines < totalLines >> 5 - 1 && updated.lines > totalLines >> 5 + 1) { let copy = this.children.slice(); copy[i] = updated; return new _TextNode(copy, this.length - (to - from) + text.length); } return super.replace(pos, end, updated); } pos = end + 1; } return super.replace(from, to, text); } sliceString(from, to = this.length, lineSep = "\n") { let result = ""; for (let i = 0, pos = 0; i < this.children.length && pos <= to; i++) { let child = this.children[i], end = pos + child.length; if (pos > from && i) result += lineSep; if (from < end && to > pos) result += child.sliceString(from - pos, to - pos, lineSep); pos = end + 1; } return result; } flatten(target) { for (let child of this.children) child.flatten(target); } scanIdentical(other, dir) { if (!(other instanceof _TextNode)) return 0; let length = 0; let [iA, iB, eA, eB] = dir > 0 ? [0, 0, this.children.length, other.children.length] : [this.children.length - 1, other.children.length - 1, -1, -1]; for (; ; iA += dir, iB += dir) { if (iA == eA || iB == eB) return length; let chA = this.children[iA], chB = other.children[iB]; if (chA != chB) return length + chA.scanIdentical(chB, dir); length += chA.length + 1; } } static from(children, length = children.reduce((l, ch) => l + ch.length + 1, -1)) { let lines = 0; for (let ch of children) lines += ch.lines; if (lines < 32) { let flat = []; for (let ch of children) ch.flatten(flat); return new TextLeaf(flat, length); } let chunk = Math.max( 32, lines >> 5 /* Tree.BranchShift */ ), maxChunk = chunk << 1, minChunk = chunk >> 1; let chunked = [], currentLines = 0, currentLen = -1, currentChunk = []; function add2(child) { let last; if (child.lines > maxChunk && child instanceof _TextNode) { for (let node of child.children) add2(node); } else if (child.lines > minChunk && (currentLines > minChunk || !currentLines)) { flush(); chunked.push(child); } else if (child instanceof TextLeaf && currentLines && (last = currentChunk[currentChunk.length - 1]) instanceof TextLeaf && child.lines + last.lines <= 32) { currentLines += child.lines; currentLen += child.length + 1; currentChunk[currentChunk.length - 1] = new TextLeaf(last.text.concat(child.text), last.length + 1 + child.length); } else { if (currentLines + child.lines > chunk) flush(); currentLines += child.lines; currentLen += child.length + 1; currentChunk.push(child); } } function flush() { if (currentLines == 0) return; chunked.push(currentChunk.length == 1 ? currentChunk[0] : _TextNode.from(currentChunk, currentLen)); currentLen = -1; currentLines = currentChunk.length = 0; } for (let child of children) add2(child); flush(); return chunked.length == 1 ? chunked[0] : new _TextNode(chunked, length); } }; Text2.empty = /* @__PURE__ */ new TextLeaf([""], 0); function textLength(text) { let length = -1; for (let line of text) length += line.length + 1; return length; } function appendText(text, target, from = 0, to = 1e9) { for (let pos = 0, i = 0, first = true; i < text.length && pos <= to; i++) { let line = text[i], end = pos + line.length; if (end >= from) { if (end > to) line = line.slice(0, to - pos); if (pos < from) line = line.slice(from - pos); if (first) { target[target.length - 1] += line; first = false; } else target.push(line); } pos = end + 1; } return target; } function sliceText(text, from, to) { return appendText(text, [""], from, to); } var RawTextCursor = class { constructor(text, dir = 1) { this.dir = dir; this.done = false; this.lineBreak = false; this.value = ""; this.nodes = [text]; this.offsets = [dir > 0 ? 1 : (text instanceof TextLeaf ? text.text.length : text.children.length) << 1]; } nextInner(skip, dir) { this.done = this.lineBreak = false; for (; ; ) { let last = this.nodes.length - 1; let top2 = this.nodes[last], offsetValue = this.offsets[last], offset = offsetValue >> 1; let size = top2 instanceof TextLeaf ? top2.text.length : top2.children.length; if (offset == (dir > 0 ? size : 0)) { if (last == 0) { this.done = true; this.value = ""; return this; } if (dir > 0) this.offsets[last - 1]++; this.nodes.pop(); this.offsets.pop(); } else if ((offsetValue & 1) == (dir > 0 ? 0 : 1)) { this.offsets[last] += dir; if (skip == 0) { this.lineBreak = true; this.value = "\n"; return this; } skip--; } else if (top2 instanceof TextLeaf) { let next = top2.text[offset + (dir < 0 ? -1 : 0)]; this.offsets[last] += dir; if (next.length > Math.max(0, skip)) { this.value = skip == 0 ? next : dir > 0 ? next.slice(skip) : next.slice(0, next.length - skip); return this; } skip -= next.length; } else { let next = top2.children[offset + (dir < 0 ? -1 : 0)]; if (skip > next.length) { skip -= next.length; this.offsets[last] += dir; } else { if (dir < 0) this.offsets[last]--; this.nodes.push(next); this.offsets.push(dir > 0 ? 1 : (next instanceof TextLeaf ? next.text.length : next.children.length) << 1); } } } } next(skip = 0) { if (skip < 0) { this.nextInner(-skip, -this.dir); skip = this.value.length; } return this.nextInner(skip, this.dir); } }; var PartialTextCursor = class { constructor(text, start, end) { this.value = ""; this.done = false; this.cursor = new RawTextCursor(text, start > end ? -1 : 1); this.pos = start > end ? text.length : 0; this.from = Math.min(start, end); this.to = Math.max(start, end); } nextInner(skip, dir) { if (dir < 0 ? this.pos <= this.from : this.pos >= this.to) { this.value = ""; this.done = true; return this; } skip += Math.max(0, dir < 0 ? this.pos - this.to : this.from - this.pos); let limit = dir < 0 ? this.pos - this.from : this.to - this.pos; if (skip > limit) skip = limit; limit -= skip; let { value } = this.cursor.next(skip); this.pos += (value.length + skip) * dir; this.value = value.length <= limit ? value : dir < 0 ? value.slice(value.length - limit) : value.slice(0, limit); this.done = !this.value; return this; } next(skip = 0) { if (skip < 0) skip = Math.max(skip, this.from - this.pos); else if (skip > 0) skip = Math.min(skip, this.to - this.pos); return this.nextInner(skip, this.cursor.dir); } get lineBreak() { return this.cursor.lineBreak && this.value != ""; } }; var LineCursor = class { constructor(inner) { this.inner = inner; this.afterBreak = true; this.value = ""; this.done = false; } next(skip = 0) { let { done, lineBreak, value } = this.inner.next(skip); if (done) { this.done = true; this.value = ""; } else if (lineBreak) { if (this.afterBreak) { this.value = ""; } else { this.afterBreak = true; this.next(); } } else { this.value = value; this.afterBreak = false; } return this; } get lineBreak() { return false; } }; if (typeof Symbol != "undefined") { Text2.prototype[Symbol.iterator] = function() { return this.iter(); }; RawTextCursor.prototype[Symbol.iterator] = PartialTextCursor.prototype[Symbol.iterator] = LineCursor.prototype[Symbol.iterator] = function() { return this; }; } var Line = class { /** @internal */ constructor(from, to, number2, text) { this.from = from; this.to = to; this.number = number2; this.text = text; } /** The length of the line (not including any line break after it). */ get length() { return this.to - this.from; } }; var extend = /* @__PURE__ */ "lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map((s) => s ? parseInt(s, 36) : 1); for (let i = 1; i < extend.length; i++) extend[i] += extend[i - 1]; function isExtendingChar(code) { for (let i = 1; i < extend.length; i += 2) if (extend[i] > code) return extend[i - 1] <= code; return false; } function isRegionalIndicator(code) { return code >= 127462 && code <= 127487; } var ZWJ = 8205; function findClusterBreak(str, pos, forward = true, includeExtending = true) { return (forward ? nextClusterBreak : prevClusterBreak)(str, pos, includeExtending); } function nextClusterBreak(str, pos, includeExtending) { if (pos == str.length) return pos; if (pos && surrogateLow(str.charCodeAt(pos)) && surrogateHigh(str.charCodeAt(pos - 1))) pos--; let prev = codePointAt(str, pos); pos += codePointSize(prev); while (pos < str.length) { let next = codePointAt(str, pos); if (prev == ZWJ || next == ZWJ || includeExtending && isExtendingChar(next)) { pos += codePointSize(next); prev = next; } else if (isRegionalIndicator(next)) { let countBefore = 0, i = pos - 2; while (i >= 0 && isRegionalIndicator(codePointAt(str, i))) { countBefore++; i -= 2; } if (countBefore % 2 == 0) break; else pos += 2; } else { break; } } return pos; } function prevClusterBreak(str, pos, includeExtending) { while (pos > 0) { let found = nextClusterBreak(str, pos - 2, includeExtending); if (found < pos) return found; pos--; } return 0; } function surrogateLow(ch) { return ch >= 56320 && ch < 57344; } function surrogateHigh(ch) { return ch >= 55296 && ch < 56320; } function codePointAt(str, pos) { let code0 = str.charCodeAt(pos); if (!surrogateHigh(code0) || pos + 1 == str.length) return code0; let code1 = str.charCodeAt(pos + 1); if (!surrogateLow(code1)) return code0; return (code0 - 55296 << 10) + (code1 - 56320) + 65536; } function fromCodePoint(code) { if (code <= 65535) return String.fromCharCode(code); code -= 65536; return String.fromCharCode((code >> 10) + 55296, (code & 1023) + 56320); } function codePointSize(code) { return code < 65536 ? 1 : 2; } var DefaultSplit = /\r\n?|\n/; var MapMode = /* @__PURE__ */ function(MapMode2) { MapMode2[MapMode2["Simple"] = 0] = "Simple"; MapMode2[MapMode2["TrackDel"] = 1] = "TrackDel"; MapMode2[MapMode2["TrackBefore"] = 2] = "TrackBefore"; MapMode2[MapMode2["TrackAfter"] = 3] = "TrackAfter"; return MapMode2; }(MapMode || (MapMode = {})); var ChangeDesc = class _ChangeDesc { // Sections are encoded as pairs of integers. The first is the // length in the current document, and the second is -1 for // unaffected sections, and the length of the replacement content // otherwise. So an insertion would be (0, n>0), a deletion (n>0, // 0), and a replacement two positive numbers. /** @internal */ constructor(sections) { this.sections = sections; } /** The length of the document before the change. */ get length() { let result = 0; for (let i = 0; i < this.sections.length; i += 2) result += this.sections[i]; return result; } /** The length of the document after the change. */ get newLength() { let result = 0; for (let i = 0; i < this.sections.length; i += 2) { let ins = this.sections[i + 1]; result += ins < 0 ? this.sections[i] : ins; } return result; } /** False when there are actual changes in this set. */ get empty() { return this.sections.length == 0 || this.sections.length == 2 && this.sections[1] < 0; } /** Iterate over the unchanged parts left by these changes. `posA` provides the position of the range in the old document, `posB` the new position in the changed document. */ iterGaps(f) { for (let i = 0, posA = 0, posB = 0; i < this.sections.length; ) { let len = this.sections[i++], ins = this.sections[i++]; if (ins < 0) { f(posA, posB, len); posB += len; } else { posB += ins; } posA += len; } } /** Iterate over the ranges changed by these changes. (See [`ChangeSet.iterChanges`](https://codemirror.net/6/docs/ref/#state.ChangeSet.iterChanges) for a variant that also provides you with the inserted text.) `fromA`/`toA` provides the extent of the change in the starting document, `fromB`/`toB` the extent of the replacement in the changed document. When `individual` is true, adjacent changes (which are kept separate for [position mapping](https://codemirror.net/6/docs/ref/#state.ChangeDesc.mapPos)) are reported separately. */ iterChangedRanges(f, individual = false) { iterChanges(this, f, individual); } /** Get a description of the inverted form of these changes. */ get invertedDesc() { let sections = []; for (let i = 0; i < this.sections.length; ) { let len = this.sections[i++], ins = this.sections[i++]; if (ins < 0) sections.push(len, ins); else sections.push(ins, len); } return new _ChangeDesc(sections); } /** Compute the combined effect of applying another set of changes after this one. The length of the document after this set should match the length before `other`. */ composeDesc(other) { return this.empty ? other : other.empty ? this : composeSets(this, other); } /** Map this description, which should start with the same document as `other`, over another set of changes, so that it can be applied after it. When `before` is true, map as if the changes in `other` happened before the ones in `this`. */ mapDesc(other, before = false) { return other.empty ? this : mapSet(this, other, before); } mapPos(pos, assoc = -1, mode = MapMode.Simple) { let posA = 0, posB = 0; for (let i = 0; i < this.sections.length; ) { let len = this.sections[i++], ins = this.sections[i++], endA = posA + len; if (ins < 0) { if (endA > pos) return posB + (pos - posA); posB += len; } else { if (mode != MapMode.Simple && endA >= pos && (mode == MapMode.TrackDel && posA < pos && endA > pos || mode == MapMode.TrackBefore && posA < pos || mode == MapMode.TrackAfter && endA > pos)) return null; if (endA > pos || endA == pos && assoc < 0 && !len) return pos == posA || assoc < 0 ? posB : posB + ins; posB += ins; } posA = endA; } if (pos > posA) throw new RangeError(`Position ${pos} is out of range for changeset of length ${posA}`); return posB; } /** Check whether these changes touch a given range. When one of the changes entirely covers the range, the string `"cover"` is returned. */ touchesRange(from, to = from) { for (let i = 0, pos = 0; i < this.sections.length && pos <= to; ) { let len = this.sections[i++], ins = this.sections[i++], end = pos + len; if (ins >= 0 && pos <= to && end >= from) return pos < from && end > to ? "cover" : true; pos = end; } return false; } /** @internal */ toString() { let result = ""; for (let i = 0; i < this.sections.length; ) { let len = this.sections[i++], ins = this.sections[i++]; result += (result ? " " : "") + len + (ins >= 0 ? ":" + ins : ""); } return result; } /** Serialize this change desc to a JSON-representable value. */ toJSON() { return this.sections; } /** Create a change desc from its JSON representation (as produced by [`toJSON`](https://codemirror.net/6/docs/ref/#state.ChangeDesc.toJSON). */ static fromJSON(json) { if (!Array.isArray(json) || json.length % 2 || json.some((a) => typeof a != "number")) throw new RangeError("Invalid JSON representation of ChangeDesc"); return new _ChangeDesc(json); } /** @internal */ static create(sections) { return new _ChangeDesc(sections); } }; var ChangeSet = class _ChangeSet extends ChangeDesc { constructor(sections, inserted) { super(sections); this.inserted = inserted; } /** Apply the changes to a document, returning the modified document. */ apply(doc2) { if (this.length != doc2.length) throw new RangeError("Applying change set to a document with the wrong length"); iterChanges(this, (fromA, toA, fromB, _toB, text) => doc2 = doc2.replace(fromB, fromB + (toA - fromA), text), false); return doc2; } mapDesc(other, before = false) { return mapSet(this, other, before, true); } /** Given the document as it existed _before_ the changes, return a change set that represents the inverse of this set, which could be used to go from the document created by the changes back to the document as it existed before the changes. */ invert(doc2) { let sections = this.sections.slice(), inserted = []; for (let i = 0, pos = 0; i < sections.length; i += 2) { let len = sections[i], ins = sections[i + 1]; if (ins >= 0) { sections[i] = ins; sections[i + 1] = len; let index = i >> 1; while (inserted.length < index) inserted.push(Text2.empty); inserted.push(len ? doc2.slice(pos, pos + len) : Text2.empty); } pos += len; } return new _ChangeSet(sections, inserted); } /** Combine two subsequent change sets into a single set. `other` must start in the document produced by `this`. If `this` goes `docA` → `docB` and `other` represents `docB` → `docC`, the returned value will represent the change `docA` → `docC`. */ compose(other) { return this.empty ? other : other.empty ? this : composeSets(this, other, true); } /** Given another change set starting in the same document, maps this change set over the other, producing a new change set that can be applied to the document produced by applying `other`. When `before` is `true`, order changes as if `this` comes before `other`, otherwise (the default) treat `other` as coming first. Given two changes `A` and `B`, `A.compose(B.map(A))` and `B.compose(A.map(B, true))` will produce the same document. This provides a basic form of [operational transformation](https://en.wikipedia.org/wiki/Operational_transformation), and can be used for collaborative editing. */ map(other, before = false) { return other.empty ? this : mapSet(this, other, before, true); } /** Iterate over the changed ranges in the document, calling `f` for each, with the range in the original document (`fromA`-`toA`) and the range that replaces it in the new document (`fromB`-`toB`). When `individual` is true, adjacent changes are reported separately. */ iterChanges(f, individual = false) { iterChanges(this, f, individual); } /** Get a [change description](https://codemirror.net/6/docs/ref/#state.ChangeDesc) for this change set. */ get desc() { return ChangeDesc.create(this.sections); } /** @internal */ filter(ranges) { let resultSections = [], resultInserted = [], filteredSections = []; let iter = new SectionIter(this); done: for (let i = 0, pos = 0; ; ) { let next = i == ranges.length ? 1e9 : ranges[i++]; while (pos < next || pos == next && iter.len == 0) { if (iter.done) break done; let len = Math.min(iter.len, next - pos); addSection(filteredSections, len, -1); let ins = iter.ins == -1 ? -1 : iter.off == 0 ? iter.ins : 0; addSection(resultSections, len, ins); if (ins > 0) addInsert(resultInserted, resultSections, iter.text); iter.forward(len); pos += len; } let end = ranges[i++]; while (pos < end) { if (iter.done) break done; let len = Math.min(iter.len, end - pos); addSection(resultSections, len, -1); addSection(filteredSections, len, iter.ins == -1 ? -1 : iter.off == 0 ? iter.ins : 0); iter.forward(len); pos += len; } } return { changes: new _ChangeSet(resultSections, resultInserted), filtered: ChangeDesc.create(filteredSections) }; } /** Serialize this change set to a JSON-representable value. */ toJSON() { let parts = []; for (let i = 0; i < this.sections.length; i += 2) { let len = this.sections[i], ins = this.sections[i + 1]; if (ins < 0) parts.push(len); else if (ins == 0) parts.push([len]); else parts.push([len].concat(this.inserted[i >> 1].toJSON())); } return parts; } /** Create a change set for the given changes, for a document of the given length, using `lineSep` as line separator. */ static of(changes, length, lineSep) { let sections = [], inserted = [], pos = 0; let total = null; function flush(force = false) { if (!force && !sections.length) return; if (pos < length) addSection(sections, length - pos, -1); let set = new _ChangeSet(sections, inserted); total = total ? total.compose(set.map(total)) : set; sections = []; inserted = []; pos = 0; } function process2(spec) { if (Array.isArray(spec)) { for (let sub of spec) process2(sub); } else if (spec instanceof _ChangeSet) { if (spec.length != length) throw new RangeError(`Mismatched change set length (got ${spec.length}, expected ${length})`); flush(); total = total ? total.compose(spec.map(total)) : spec; } else { let { from, to = from, insert: insert2 } = spec; if (from > to || from < 0 || to > length) throw new RangeError(`Invalid change range ${from} to ${to} (in doc of length ${length})`); let insText = !insert2 ? Text2.empty : typeof insert2 == "string" ? Text2.of(insert2.split(lineSep || DefaultSplit)) : insert2; let insLen = insText.length; if (from == to && insLen == 0) return; if (from < pos) flush(); if (from > pos) addSection(sections, from - pos, -1); addSection(sections, to - from, insLen); addInsert(inserted, sections, insText); pos = to; } } process2(changes); flush(!total); return total; } /** Create an empty changeset of the given length. */ static empty(length) { return new _ChangeSet(length ? [length, -1] : [], []); } /** Create a changeset from its JSON representation (as produced by [`toJSON`](https://codemirror.net/6/docs/ref/#state.ChangeSet.toJSON). */ static fromJSON(json) { if (!Array.isArray(json)) throw new RangeError("Invalid JSON representation of ChangeSet"); let sections = [], inserted = []; for (let i = 0; i < json.length; i++) { let part = json[i]; if (typeof part == "number") { sections.push(part, -1); } else if (!Array.isArray(part) || typeof part[0] != "number" || part.some((e, i2) => i2 && typeof e != "string")) { throw new RangeError("Invalid JSON representation of ChangeSet"); } else if (part.length == 1) { sections.push(part[0], 0); } else { while (inserted.length < i) inserted.push(Text2.empty); inserted[i] = Text2.of(part.slice(1)); sections.push(part[0], inserted[i].length); } } return new _ChangeSet(sections, inserted); } /** @internal */ static createSet(sections, inserted) { return new _ChangeSet(sections, inserted); } }; function addSection(sections, len, ins, forceJoin = false) { if (len == 0 && ins <= 0) return; let last = sections.length - 2; if (last >= 0 && ins <= 0 && ins == sections[last + 1]) sections[last] += len; else if (len == 0 && sections[last] == 0) sections[last + 1] += ins; else if (forceJoin) { sections[last] += len; sections[last + 1] += ins; } else sections.push(len, ins); } function addInsert(values2, sections, value) { if (value.length == 0) return; let index = sections.length - 2 >> 1; if (index < values2.length) { values2[values2.length - 1] = values2[values2.length - 1].append(value); } else { while (values2.length < index) values2.push(Text2.empty); values2.push(value); } } function iterChanges(desc, f, individual) { let inserted = desc.inserted; for (let posA = 0, posB = 0, i = 0; i < desc.sections.length; ) { let len = desc.sections[i++], ins = desc.sections[i++]; if (ins < 0) { posA += len; posB += len; } else { let endA = posA, endB = posB, text = Text2.empty; for (; ; ) { endA += len; endB += ins; if (ins && inserted) text = text.append(inserted[i - 2 >> 1]); if (individual || i == desc.sections.length || desc.sections[i + 1] < 0) break; len = desc.sections[i++]; ins = desc.sections[i++]; } f(posA, endA, posB, endB, text); posA = endA; posB = endB; } } } function mapSet(setA, setB, before, mkSet = false) { let sections = [], insert2 = mkSet ? [] : null; let a = new SectionIter(setA), b = new SectionIter(setB); for (let inserted = -1; ; ) { if (a.ins == -1 && b.ins == -1) { let len = Math.min(a.len, b.len); addSection(sections, len, -1); a.forward(len); b.forward(len); } else if (b.ins >= 0 && (a.ins < 0 || inserted == a.i || a.off == 0 && (b.len < a.len || b.len == a.len && !before))) { let len = b.len; addSection(sections, b.ins, -1); while (len) { let piece = Math.min(a.len, len); if (a.ins >= 0 && inserted < a.i && a.len <= piece) { addSection(sections, 0, a.ins); if (insert2) addInsert(insert2, sections, a.text); inserted = a.i; } a.forward(piece); len -= piece; } b.next(); } else if (a.ins >= 0) { let len = 0, left = a.len; while (left) { if (b.ins == -1) { let piece = Math.min(left, b.len); len += piece; left -= piece; b.forward(piece); } else if (b.ins == 0 && b.len < left) { left -= b.len; b.next(); } else { break; } } addSection(sections, len, inserted < a.i ? a.ins : 0); if (insert2 && inserted < a.i) addInsert(insert2, sections, a.text); inserted = a.i; a.forward(a.len - left); } else if (a.done && b.done) { return insert2 ? ChangeSet.createSet(sections, insert2) : ChangeDesc.create(sections); } else { throw new Error("Mismatched change set lengths"); } } } function composeSets(setA, setB, mkSet = false) { let sections = []; let insert2 = mkSet ? [] : null; let a = new SectionIter(setA), b = new SectionIter(setB); for (let open = false; ; ) { if (a.done && b.done) { return insert2 ? ChangeSet.createSet(sections, insert2) : ChangeDesc.create(sections); } else if (a.ins == 0) { addSection(sections, a.len, 0, open); a.next(); } else if (b.len == 0 && !b.done) { addSection(sections, 0, b.ins, open); if (insert2) addInsert(insert2, sections, b.text); b.next(); } else if (a.done || b.done) { throw new Error("Mismatched change set lengths"); } else { let len = Math.min(a.len2, b.len), sectionLen = sections.length; if (a.ins == -1) { let insB = b.ins == -1 ? -1 : b.off ? 0 : b.ins; addSection(sections, len, insB, open); if (insert2 && insB) addInsert(insert2, sections, b.text); } else if (b.ins == -1) { addSection(sections, a.off ? 0 : a.len, len, open); if (insert2) addInsert(insert2, sections, a.textBit(len)); } else { addSection(sections, a.off ? 0 : a.len, b.off ? 0 : b.ins, open); if (insert2 && !b.off) addInsert(insert2, sections, b.text); } open = (a.ins > len || b.ins >= 0 && b.len > len) && (open || sections.length > sectionLen); a.forward2(len); b.forward(len); } } } var SectionIter = class { constructor(set) { this.set = set; this.i = 0; this.next(); } next() { let { sections } = this.set; if (this.i < sections.length) { this.len = sections[this.i++]; this.ins = sections[this.i++]; } else { this.len = 0; this.ins = -2; } this.off = 0; } get done() { return this.ins == -2; } get len2() { return this.ins < 0 ? this.len : this.ins; } get text() { let { inserted } = this.set, index = this.i - 2 >> 1; return index >= inserted.length ? Text2.empty : inserted[index]; } textBit(len) { let { inserted } = this.set, index = this.i - 2 >> 1; return index >= inserted.length && !len ? Text2.empty : inserted[index].slice(this.off, len == null ? void 0 : this.off + len); } forward(len) { if (len == this.len) this.next(); else { this.len -= len; this.off += len; } } forward2(len) { if (this.ins == -1) this.forward(len); else if (len == this.ins) this.next(); else { this.ins -= len; this.off += len; } } }; var SelectionRange = class _SelectionRange { constructor(from, to, flags) { this.from = from; this.to = to; this.flags = flags; } /** The anchor of the range—the side that doesn't move when you extend it. */ get anchor() { return this.flags & 32 ? this.to : this.from; } /** The head of the range, which is moved when the range is [extended](https://codemirror.net/6/docs/ref/#state.SelectionRange.extend). */ get head() { return this.flags & 32 ? this.from : this.to; } /** True when `anchor` and `head` are at the same position. */ get empty() { return this.from == this.to; } /** If this is a cursor that is explicitly associated with the character on one of its sides, this returns the side. -1 means the character before its position, 1 the character after, and 0 means no association. */ get assoc() { return this.flags & 8 ? -1 : this.flags & 16 ? 1 : 0; } /** The bidirectional text level associated with this cursor, if any. */ get bidiLevel() { let level = this.flags & 7; return level == 7 ? null : level; } /** The goal column (stored vertical offset) associated with a cursor. This is used to preserve the vertical position when [moving](https://codemirror.net/6/docs/ref/#view.EditorView.moveVertically) across lines of different length. */ get goalColumn() { let value = this.flags >> 6; return value == 16777215 ? void 0 : value; } /** Map this range through a change, producing a valid range in the updated document. */ map(change, assoc = -1) { let from, to; if (this.empty) { from = to = change.mapPos(this.from, assoc); } else { from = change.mapPos(this.from, 1); to = change.mapPos(this.to, -1); } return from == this.from && to == this.to ? this : new _SelectionRange(from, to, this.flags); } /** Extend this range to cover at least `from` to `to`. */ extend(from, to = from) { if (from <= this.anchor && to >= this.anchor) return EditorSelection.range(from, to); let head = Math.abs(from - this.anchor) > Math.abs(to - this.anchor) ? from : to; return EditorSelection.range(this.anchor, head); } /** Compare this range to another range. */ eq(other) { return this.anchor == other.anchor && this.head == other.head; } /** Return a JSON-serializable object representing the range. */ toJSON() { return { anchor: this.anchor, head: this.head }; } /** Convert a JSON representation of a range to a `SelectionRange` instance. */ static fromJSON(json) { if (!json || typeof json.anchor != "number" || typeof json.head != "number") throw new RangeError("Invalid JSON representation for SelectionRange"); return EditorSelection.range(json.anchor, json.head); } /** @internal */ static create(from, to, flags) { return new _SelectionRange(from, to, flags); } }; var EditorSelection = class _EditorSelection { constructor(ranges, mainIndex) { this.ranges = ranges; this.mainIndex = mainIndex; } /** Map a selection through a change. Used to adjust the selection position for changes. */ map(change, assoc = -1) { if (change.empty) return this; return _EditorSelection.create(this.ranges.map((r2) => r2.map(change, assoc)), this.mainIndex); } /** Compare this selection to another selection. */ eq(other) { if (this.ranges.length != other.ranges.length || this.mainIndex != other.mainIndex) return false; for (let i = 0; i < this.ranges.length; i++) if (!this.ranges[i].eq(other.ranges[i])) return false; return true; } /** Get the primary selection range. Usually, you should make sure your code applies to _all_ ranges, by using methods like [`changeByRange`](https://codemirror.net/6/docs/ref/#state.EditorState.changeByRange). */ get main() { return this.ranges[this.mainIndex]; } /** Make sure the selection only has one range. Returns a selection holding only the main range from this selection. */ asSingle() { return this.ranges.length == 1 ? this : new _EditorSelection([this.main], 0); } /** Extend this selection with an extra range. */ addRange(range, main = true) { return _EditorSelection.create([range].concat(this.ranges), main ? 0 : this.mainIndex + 1); } /** Replace a given range with another range, and then normalize the selection to merge and sort ranges if necessary. */ replaceRange(range, which = this.mainIndex) { let ranges = this.ranges.slice(); ranges[which] = range; return _EditorSelection.create(ranges, this.mainIndex); } /** Convert this selection to an object that can be serialized to JSON. */ toJSON() { return { ranges: this.ranges.map((r2) => r2.toJSON()), main: this.mainIndex }; } /** Create a selection from a JSON representation. */ static fromJSON(json) { if (!json || !Array.isArray(json.ranges) || typeof json.main != "number" || json.main >= json.ranges.length) throw new RangeError("Invalid JSON representation for EditorSelection"); return new _EditorSelection(json.ranges.map((r2) => SelectionRange.fromJSON(r2)), json.main); } /** Create a selection holding a single range. */ static single(anchor, head = anchor) { return new _EditorSelection([_EditorSelection.range(anchor, head)], 0); } /** Sort and merge the given set of ranges, creating a valid selection. */ static create(ranges, mainIndex = 0) { if (ranges.length == 0) throw new RangeError("A selection needs at least one range"); for (let pos = 0, i = 0; i < ranges.length; i++) { let range = ranges[i]; if (range.empty ? range.from <= pos : range.from < pos) return _EditorSelection.normalized(ranges.slice(), mainIndex); pos = range.to; } return new _EditorSelection(ranges, mainIndex); } /** Create a cursor selection range at the given position. You can safely ignore the optional arguments in most situations. */ static cursor(pos, assoc = 0, bidiLevel, goalColumn) { return SelectionRange.create(pos, pos, (assoc == 0 ? 0 : assoc < 0 ? 8 : 16) | (bidiLevel == null ? 7 : Math.min(6, bidiLevel)) | (goalColumn !== null && goalColumn !== void 0 ? goalColumn : 16777215) << 6); } /** Create a selection range. */ static range(anchor, head, goalColumn, bidiLevel) { let flags = (goalColumn !== null && goalColumn !== void 0 ? goalColumn : 16777215) << 6 | (bidiLevel == null ? 7 : Math.min(6, bidiLevel)); return head < anchor ? SelectionRange.create(head, anchor, 32 | 16 | flags) : SelectionRange.create(anchor, head, (head > anchor ? 8 : 0) | flags); } /** @internal */ static normalized(ranges, mainIndex = 0) { let main = ranges[mainIndex]; ranges.sort((a, b) => a.from - b.from); mainIndex = ranges.indexOf(main); for (let i = 1; i < ranges.length; i++) { let range = ranges[i], prev = ranges[i - 1]; if (range.empty ? range.from <= prev.to : range.from < prev.to) { let from = prev.from, to = Math.max(range.to, prev.to); if (i <= mainIndex) mainIndex--; ranges.splice(--i, 2, range.anchor > range.head ? _EditorSelection.range(to, from) : _EditorSelection.range(from, to)); } } return new _EditorSelection(ranges, mainIndex); } }; function checkSelection(selection, docLength) { for (let range of selection.ranges) if (range.to > docLength) throw new RangeError("Selection points outside of document"); } var nextID = 0; var Facet = class _Facet { constructor(combine, compareInput, compare2, isStatic, enables) { this.combine = combine; this.compareInput = compareInput; this.compare = compare2; this.isStatic = isStatic; this.id = nextID++; this.default = combine([]); this.extensions = typeof enables == "function" ? enables(this) : enables; } /** Returns a facet reader for this facet, which can be used to [read](https://codemirror.net/6/docs/ref/#state.EditorState.facet) it but not to define values for it. */ get reader() { return this; } /** Define a new facet. */ static define(config2 = {}) { return new _Facet(config2.combine || ((a) => a), config2.compareInput || ((a, b) => a === b), config2.compare || (!config2.combine ? sameArray : (a, b) => a === b), !!config2.static, config2.enables); } /** Returns an extension that adds the given value to this facet. */ of(value) { return new FacetProvider([], this, 0, value); } /** Create an extension that computes a value for the facet from a state. You must take care to declare the parts of the state that this value depends on, since your function is only called again for a new state when one of those parts changed. In cases where your value depends only on a single field, you'll want to use the [`from`](https://codemirror.net/6/docs/ref/#state.Facet.from) method instead. */ compute(deps, get) { if (this.isStatic) throw new Error("Can't compute a static facet"); return new FacetProvider(deps, this, 1, get); } /** Create an extension that computes zero or more values for this facet from a state. */ computeN(deps, get) { if (this.isStatic) throw new Error("Can't compute a static facet"); return new FacetProvider(deps, this, 2, get); } from(field, get) { if (!get) get = (x) => x; return this.compute([field], (state) => get(state.field(field))); } }; function sameArray(a, b) { return a == b || a.length == b.length && a.every((e, i) => e === b[i]); } var FacetProvider = class { constructor(dependencies, facet, type, value) { this.dependencies = dependencies; this.facet = facet; this.type = type; this.value = value; this.id = nextID++; } dynamicSlot(addresses) { var _a3; let getter = this.value; let compare2 = this.facet.compareInput; let id2 = this.id, idx = addresses[id2] >> 1, multi = this.type == 2; let depDoc = false, depSel = false, depAddrs = []; for (let dep of this.dependencies) { if (dep == "doc") depDoc = true; else if (dep == "selection") depSel = true; else if ((((_a3 = addresses[dep.id]) !== null && _a3 !== void 0 ? _a3 : 1) & 1) == 0) depAddrs.push(addresses[dep.id]); } return { create(state) { state.values[idx] = getter(state); return 1; }, update(state, tr) { if (depDoc && tr.docChanged || depSel && (tr.docChanged || tr.selection) || ensureAll(state, depAddrs)) { let newVal = getter(state); if (multi ? !compareArray(newVal, state.values[idx], compare2) : !compare2(newVal, state.values[idx])) { state.values[idx] = newVal; return 1; } } return 0; }, reconfigure: (state, oldState) => { let newVal, oldAddr = oldState.config.address[id2]; if (oldAddr != null) { let oldVal = getAddr(oldState, oldAddr); if (this.dependencies.every((dep) => { return dep instanceof Facet ? oldState.facet(dep) === state.facet(dep) : dep instanceof StateField ? oldState.field(dep, false) == state.field(dep, false) : true; }) || (multi ? compareArray(newVal = getter(state), oldVal, compare2) : compare2(newVal = getter(state), oldVal))) { state.values[idx] = oldVal; return 0; } } else { newVal = getter(state); } state.values[idx] = newVal; return 1; } }; } }; function compareArray(a, b, compare2) { if (a.length != b.length) return false; for (let i = 0; i < a.length; i++) if (!compare2(a[i], b[i])) return false; return true; } function ensureAll(state, addrs) { let changed = false; for (let addr of addrs) if (ensureAddr(state, addr) & 1) changed = true; return changed; } function dynamicFacetSlot(addresses, facet, providers) { let providerAddrs = providers.map((p) => addresses[p.id]); let providerTypes = providers.map((p) => p.type); let dynamic = providerAddrs.filter((p) => !(p & 1)); let idx = addresses[facet.id] >> 1; function get(state) { let values2 = []; for (let i = 0; i < providerAddrs.length; i++) { let value = getAddr(state, providerAddrs[i]); if (providerTypes[i] == 2) for (let val of value) values2.push(val); else values2.push(value); } return facet.combine(values2); } return { create(state) { for (let addr of providerAddrs) ensureAddr(state, addr); state.values[idx] = get(state); return 1; }, update(state, tr) { if (!ensureAll(state, dynamic)) return 0; let value = get(state); if (facet.compare(value, state.values[idx])) return 0; state.values[idx] = value; return 1; }, reconfigure(state, oldState) { let depChanged = ensureAll(state, providerAddrs); let oldProviders = oldState.config.facets[facet.id], oldValue = oldState.facet(facet); if (oldProviders && !depChanged && sameArray(providers, oldProviders)) { state.values[idx] = oldValue; return 0; } let value = get(state); if (facet.compare(value, oldValue)) { state.values[idx] = oldValue; return 0; } state.values[idx] = value; return 1; } }; } var initField = /* @__PURE__ */ Facet.define({ static: true }); var StateField = class _StateField { constructor(id2, createF, updateF, compareF, spec) { this.id = id2; this.createF = createF; this.updateF = updateF; this.compareF = compareF; this.spec = spec; this.provides = void 0; } /** Define a state field. */ static define(config2) { let field = new _StateField(nextID++, config2.create, config2.update, config2.compare || ((a, b) => a === b), config2); if (config2.provide) field.provides = config2.provide(field); return field; } create(state) { let init = state.facet(initField).find((i) => i.field == this); return ((init === null || init === void 0 ? void 0 : init.create) || this.createF)(state); } /** @internal */ slot(addresses) { let idx = addresses[this.id] >> 1; return { create: (state) => { state.values[idx] = this.create(state); return 1; }, update: (state, tr) => { let oldVal = state.values[idx]; let value = this.updateF(oldVal, tr); if (this.compareF(oldVal, value)) return 0; state.values[idx] = value; return 1; }, reconfigure: (state, oldState) => { if (oldState.config.address[this.id] != null) { state.values[idx] = oldState.field(this); return 0; } state.values[idx] = this.create(state); return 1; } }; } /** Returns an extension that enables this field and overrides the way it is initialized. Can be useful when you need to provide a non-default starting value for the field. */ init(create) { return [this, initField.of({ field: this, create })]; } /** State field instances can be used as [`Extension`](https://codemirror.net/6/docs/ref/#state.Extension) values to enable the field in a given state. */ get extension() { return this; } }; var Prec_ = { lowest: 4, low: 3, default: 2, high: 1, highest: 0 }; function prec(value) { return (ext) => new PrecExtension(ext, value); } var Prec = { /** The highest precedence level, for extensions that should end up near the start of the precedence ordering. */ highest: /* @__PURE__ */ prec(Prec_.highest), /** A higher-than-default precedence, for extensions that should come before those with default precedence. */ high: /* @__PURE__ */ prec(Prec_.high), /** The default precedence, which is also used for extensions without an explicit precedence. */ default: /* @__PURE__ */ prec(Prec_.default), /** A lower-than-default precedence. */ low: /* @__PURE__ */ prec(Prec_.low), /** The lowest precedence level. Meant for things that should end up near the end of the extension order. */ lowest: /* @__PURE__ */ prec(Prec_.lowest) }; var PrecExtension = class { constructor(inner, prec2) { this.inner = inner; this.prec = prec2; } }; var Compartment = class _Compartment { /** Create an instance of this compartment to add to your [state configuration](https://codemirror.net/6/docs/ref/#state.EditorStateConfig.extensions). */ of(ext) { return new CompartmentInstance(this, ext); } /** Create an [effect](https://codemirror.net/6/docs/ref/#state.TransactionSpec.effects) that reconfigures this compartment. */ reconfigure(content2) { return _Compartment.reconfigure.of({ compartment: this, extension: content2 }); } /** Get the current content of the compartment in the state, or `undefined` if it isn't present. */ get(state) { return state.config.compartments.get(this); } }; var CompartmentInstance = class { constructor(compartment, inner) { this.compartment = compartment; this.inner = inner; } }; var Configuration = class _Configuration { constructor(base2, compartments, dynamicSlots, address, staticValues, facets) { this.base = base2; this.compartments = compartments; this.dynamicSlots = dynamicSlots; this.address = address; this.staticValues = staticValues; this.facets = facets; this.statusTemplate = []; while (this.statusTemplate.length < dynamicSlots.length) this.statusTemplate.push( 0 /* SlotStatus.Unresolved */ ); } staticFacet(facet) { let addr = this.address[facet.id]; return addr == null ? facet.default : this.staticValues[addr >> 1]; } static resolve(base2, compartments, oldState) { let fields = []; let facets = /* @__PURE__ */ Object.create(null); let newCompartments = /* @__PURE__ */ new Map(); for (let ext of flatten(base2, compartments, newCompartments)) { if (ext instanceof StateField) fields.push(ext); else (facets[ext.facet.id] || (facets[ext.facet.id] = [])).push(ext); } let address = /* @__PURE__ */ Object.create(null); let staticValues = []; let dynamicSlots = []; for (let field of fields) { address[field.id] = dynamicSlots.length << 1; dynamicSlots.push((a) => field.slot(a)); } let oldFacets = oldState === null || oldState === void 0 ? void 0 : oldState.config.facets; for (let id2 in facets) { let providers = facets[id2], facet = providers[0].facet; let oldProviders = oldFacets && oldFacets[id2] || []; if (providers.every( (p) => p.type == 0 /* Provider.Static */ )) { address[facet.id] = staticValues.length << 1 | 1; if (sameArray(oldProviders, providers)) { staticValues.push(oldState.facet(facet)); } else { let value = facet.combine(providers.map((p) => p.value)); staticValues.push(oldState && facet.compare(value, oldState.facet(facet)) ? oldState.facet(facet) : value); } } else { for (let p of providers) { if (p.type == 0) { address[p.id] = staticValues.length << 1 | 1; staticValues.push(p.value); } else { address[p.id] = dynamicSlots.length << 1; dynamicSlots.push((a) => p.dynamicSlot(a)); } } address[facet.id] = dynamicSlots.length << 1; dynamicSlots.push((a) => dynamicFacetSlot(a, facet, providers)); } } let dynamic = dynamicSlots.map((f) => f(address)); return new _Configuration(base2, newCompartments, dynamic, address, staticValues, facets); } }; function flatten(extension, compartments, newCompartments) { let result = [[], [], [], [], []]; let seen = /* @__PURE__ */ new Map(); function inner(ext, prec2) { let known = seen.get(ext); if (known != null) { if (known <= prec2) return; let found = result[known].indexOf(ext); if (found > -1) result[known].splice(found, 1); if (ext instanceof CompartmentInstance) newCompartments.delete(ext.compartment); } seen.set(ext, prec2); if (Array.isArray(ext)) { for (let e of ext) inner(e, prec2); } else if (ext instanceof CompartmentInstance) { if (newCompartments.has(ext.compartment)) throw new RangeError(`Duplicate use of compartment in extensions`); let content2 = compartments.get(ext.compartment) || ext.inner; newCompartments.set(ext.compartment, content2); inner(content2, prec2); } else if (ext instanceof PrecExtension) { inner(ext.inner, ext.prec); } else if (ext instanceof StateField) { result[prec2].push(ext); if (ext.provides) inner(ext.provides, prec2); } else if (ext instanceof FacetProvider) { result[prec2].push(ext); if (ext.facet.extensions) inner(ext.facet.extensions, Prec_.default); } else { let content2 = ext.extension; if (!content2) throw new Error(`Unrecognized extension value in extension set (${ext}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`); inner(content2, prec2); } } inner(extension, Prec_.default); return result.reduce((a, b) => a.concat(b)); } function ensureAddr(state, addr) { if (addr & 1) return 2; let idx = addr >> 1; let status = state.status[idx]; if (status == 4) throw new Error("Cyclic dependency between fields and/or facets"); if (status & 2) return status; state.status[idx] = 4; let changed = state.computeSlot(state, state.config.dynamicSlots[idx]); return state.status[idx] = 2 | changed; } function getAddr(state, addr) { return addr & 1 ? state.config.staticValues[addr >> 1] : state.values[addr >> 1]; } var languageData = /* @__PURE__ */ Facet.define(); var allowMultipleSelections = /* @__PURE__ */ Facet.define({ combine: (values2) => values2.some((v) => v), static: true }); var lineSeparator = /* @__PURE__ */ Facet.define({ combine: (values2) => values2.length ? values2[0] : void 0, static: true }); var changeFilter = /* @__PURE__ */ Facet.define(); var transactionFilter = /* @__PURE__ */ Facet.define(); var transactionExtender = /* @__PURE__ */ Facet.define(); var readOnly = /* @__PURE__ */ Facet.define({ combine: (values2) => values2.length ? values2[0] : false }); var Annotation = class { /** @internal */ constructor(type, value) { this.type = type; this.value = value; } /** Define a new type of annotation. */ static define() { return new AnnotationType(); } }; var AnnotationType = class { /** Create an instance of this annotation. */ of(value) { return new Annotation(this, value); } }; var StateEffectType = class { /** @internal */ constructor(map) { this.map = map; } /** Create a [state effect](https://codemirror.net/6/docs/ref/#state.StateEffect) instance of this type. */ of(value) { return new StateEffect(this, value); } }; var StateEffect = class _StateEffect { /** @internal */ constructor(type, value) { this.type = type; this.value = value; } /** Map this effect through a position mapping. Will return `undefined` when that ends up deleting the effect. */ map(mapping) { let mapped = this.type.map(this.value, mapping); return mapped === void 0 ? void 0 : mapped == this.value ? this : new _StateEffect(this.type, mapped); } /** Tells you whether this effect object is of a given [type](https://codemirror.net/6/docs/ref/#state.StateEffectType). */ is(type) { return this.type == type; } /** Define a new effect type. The type parameter indicates the type of values that his effect holds. It should be a type that doesn't include `undefined`, since that is used in [mapping](https://codemirror.net/6/docs/ref/#state.StateEffect.map) to indicate that an effect is removed. */ static define(spec = {}) { return new StateEffectType(spec.map || ((v) => v)); } /** Map an array of effects through a change set. */ static mapEffects(effects, mapping) { if (!effects.length) return effects; let result = []; for (let effect of effects) { let mapped = effect.map(mapping); if (mapped) result.push(mapped); } return result; } }; StateEffect.reconfigure = /* @__PURE__ */ StateEffect.define(); StateEffect.appendConfig = /* @__PURE__ */ StateEffect.define(); var Transaction = class _Transaction { constructor(startState, changes, selection, effects, annotations, scrollIntoView3) { this.startState = startState; this.changes = changes; this.selection = selection; this.effects = effects; this.annotations = annotations; this.scrollIntoView = scrollIntoView3; this._doc = null; this._state = null; if (selection) checkSelection(selection, changes.newLength); if (!annotations.some((a) => a.type == _Transaction.time)) this.annotations = annotations.concat(_Transaction.time.of(Date.now())); } /** @internal */ static create(startState, changes, selection, effects, annotations, scrollIntoView3) { return new _Transaction(startState, changes, selection, effects, annotations, scrollIntoView3); } /** The new document produced by the transaction. Contrary to [`.state`](https://codemirror.net/6/docs/ref/#state.Transaction.state)`.doc`, accessing this won't force the entire new state to be computed right away, so it is recommended that [transaction filters](https://codemirror.net/6/docs/ref/#state.EditorState^transactionFilter) use this getter when they need to look at the new document. */ get newDoc() { return this._doc || (this._doc = this.changes.apply(this.startState.doc)); } /** The new selection produced by the transaction. If [`this.selection`](https://codemirror.net/6/docs/ref/#state.Transaction.selection) is undefined, this will [map](https://codemirror.net/6/docs/ref/#state.EditorSelection.map) the start state's current selection through the changes made by the transaction. */ get newSelection() { return this.selection || this.startState.selection.map(this.changes); } /** The new state created by the transaction. Computed on demand (but retained for subsequent access), so it is recommended not to access it in [transaction filters](https://codemirror.net/6/docs/ref/#state.EditorState^transactionFilter) when possible. */ get state() { if (!this._state) this.startState.applyTransaction(this); return this._state; } /** Get the value of the given annotation type, if any. */ annotation(type) { for (let ann of this.annotations) if (ann.type == type) return ann.value; return void 0; } /** Indicates whether the transaction changed the document. */ get docChanged() { return !this.changes.empty; } /** Indicates whether this transaction reconfigures the state (through a [configuration compartment](https://codemirror.net/6/docs/ref/#state.Compartment) or with a top-level configuration [effect](https://codemirror.net/6/docs/ref/#state.StateEffect^reconfigure). */ get reconfigured() { return this.startState.config != this.state.config; } /** Returns true if the transaction has a [user event](https://codemirror.net/6/docs/ref/#state.Transaction^userEvent) annotation that is equal to or more specific than `event`. For example, if the transaction has `"select.pointer"` as user event, `"select"` and `"select.pointer"` will match it. */ isUserEvent(event) { let e = this.annotation(_Transaction.userEvent); return !!(e && (e == event || e.length > event.length && e.slice(0, event.length) == event && e[event.length] == ".")); } }; Transaction.time = /* @__PURE__ */ Annotation.define(); Transaction.userEvent = /* @__PURE__ */ Annotation.define(); Transaction.addToHistory = /* @__PURE__ */ Annotation.define(); Transaction.remote = /* @__PURE__ */ Annotation.define(); function joinRanges(a, b) { let result = []; for (let iA = 0, iB = 0; ; ) { let from, to; if (iA < a.length && (iB == b.length || b[iB] >= a[iA])) { from = a[iA++]; to = a[iA++]; } else if (iB < b.length) { from = b[iB++]; to = b[iB++]; } else return result; if (!result.length || result[result.length - 1] < from) result.push(from, to); else if (result[result.length - 1] < to) result[result.length - 1] = to; } } function mergeTransaction(a, b, sequential) { var _a3; let mapForA, mapForB, changes; if (sequential) { mapForA = b.changes; mapForB = ChangeSet.empty(b.changes.length); changes = a.changes.compose(b.changes); } else { mapForA = b.changes.map(a.changes); mapForB = a.changes.mapDesc(b.changes, true); changes = a.changes.compose(mapForA); } return { changes, selection: b.selection ? b.selection.map(mapForB) : (_a3 = a.selection) === null || _a3 === void 0 ? void 0 : _a3.map(mapForA), effects: StateEffect.mapEffects(a.effects, mapForA).concat(StateEffect.mapEffects(b.effects, mapForB)), annotations: a.annotations.length ? a.annotations.concat(b.annotations) : b.annotations, scrollIntoView: a.scrollIntoView || b.scrollIntoView }; } function resolveTransactionInner(state, spec, docSize) { let sel = spec.selection, annotations = asArray(spec.annotations); if (spec.userEvent) annotations = annotations.concat(Transaction.userEvent.of(spec.userEvent)); return { changes: spec.changes instanceof ChangeSet ? spec.changes : ChangeSet.of(spec.changes || [], docSize, state.facet(lineSeparator)), selection: sel && (sel instanceof EditorSelection ? sel : EditorSelection.single(sel.anchor, sel.head)), effects: asArray(spec.effects), annotations, scrollIntoView: !!spec.scrollIntoView }; } function resolveTransaction(state, specs, filter) { let s = resolveTransactionInner(state, specs.length ? specs[0] : {}, state.doc.length); if (specs.length && specs[0].filter === false) filter = false; for (let i = 1; i < specs.length; i++) { if (specs[i].filter === false) filter = false; let seq = !!specs[i].sequential; s = mergeTransaction(s, resolveTransactionInner(state, specs[i], seq ? s.changes.newLength : state.doc.length), seq); } let tr = Transaction.create(state, s.changes, s.selection, s.effects, s.annotations, s.scrollIntoView); return extendTransaction(filter ? filterTransaction(tr) : tr); } function filterTransaction(tr) { let state = tr.startState; let result = true; for (let filter of state.facet(changeFilter)) { let value = filter(tr); if (value === false) { result = false; break; } if (Array.isArray(value)) result = result === true ? value : joinRanges(result, value); } if (result !== true) { let changes, back; if (result === false) { back = tr.changes.invertedDesc; changes = ChangeSet.empty(state.doc.length); } else { let filtered = tr.changes.filter(result); changes = filtered.changes; back = filtered.filtered.mapDesc(filtered.changes).invertedDesc; } tr = Transaction.create(state, changes, tr.selection && tr.selection.map(back), StateEffect.mapEffects(tr.effects, back), tr.annotations, tr.scrollIntoView); } let filters = state.facet(transactionFilter); for (let i = filters.length - 1; i >= 0; i--) { let filtered = filters[i](tr); if (filtered instanceof Transaction) tr = filtered; else if (Array.isArray(filtered) && filtered.length == 1 && filtered[0] instanceof Transaction) tr = filtered[0]; else tr = resolveTransaction(state, asArray(filtered), false); } return tr; } function extendTransaction(tr) { let state = tr.startState, extenders = state.facet(transactionExtender), spec = tr; for (let i = extenders.length - 1; i >= 0; i--) { let extension = extenders[i](tr); if (extension && Object.keys(extension).length) spec = mergeTransaction(spec, resolveTransactionInner(state, extension, tr.changes.newLength), true); } return spec == tr ? tr : Transaction.create(state, tr.changes, tr.selection, spec.effects, spec.annotations, spec.scrollIntoView); } var none = []; function asArray(value) { return value == null ? none : Array.isArray(value) ? value : [value]; } var CharCategory = /* @__PURE__ */ function(CharCategory2) { CharCategory2[CharCategory2["Word"] = 0] = "Word"; CharCategory2[CharCategory2["Space"] = 1] = "Space"; CharCategory2[CharCategory2["Other"] = 2] = "Other"; return CharCategory2; }(CharCategory || (CharCategory = {})); var nonASCIISingleCaseWordChar = /[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/; var wordChar; try { wordChar = /* @__PURE__ */ new RegExp("[\\p{Alphabetic}\\p{Number}_]", "u"); } catch (_) { } function hasWordChar(str) { if (wordChar) return wordChar.test(str); for (let i = 0; i < str.length; i++) { let ch = str[i]; if (/\w/.test(ch) || ch > "\x80" && (ch.toUpperCase() != ch.toLowerCase() || nonASCIISingleCaseWordChar.test(ch))) return true; } return false; } function makeCategorizer(wordChars) { return (char) => { if (!/\S/.test(char)) return CharCategory.Space; if (hasWordChar(char)) return CharCategory.Word; for (let i = 0; i < wordChars.length; i++) if (char.indexOf(wordChars[i]) > -1) return CharCategory.Word; return CharCategory.Other; }; } var EditorState = class _EditorState { constructor(config2, doc2, selection, values2, computeSlot, tr) { this.config = config2; this.doc = doc2; this.selection = selection; this.values = values2; this.status = config2.statusTemplate.slice(); this.computeSlot = computeSlot; if (tr) tr._state = this; for (let i = 0; i < this.config.dynamicSlots.length; i++) ensureAddr(this, i << 1); this.computeSlot = null; } field(field, require2 = true) { let addr = this.config.address[field.id]; if (addr == null) { if (require2) throw new RangeError("Field is not present in this state"); return void 0; } ensureAddr(this, addr); return getAddr(this, addr); } /** Create a [transaction](https://codemirror.net/6/docs/ref/#state.Transaction) that updates this state. Any number of [transaction specs](https://codemirror.net/6/docs/ref/#state.TransactionSpec) can be passed. Unless [`sequential`](https://codemirror.net/6/docs/ref/#state.TransactionSpec.sequential) is set, the [changes](https://codemirror.net/6/docs/ref/#state.TransactionSpec.changes) (if any) of each spec are assumed to start in the _current_ document (not the document produced by previous specs), and its [selection](https://codemirror.net/6/docs/ref/#state.TransactionSpec.selection) and [effects](https://codemirror.net/6/docs/ref/#state.TransactionSpec.effects) are assumed to refer to the document created by its _own_ changes. The resulting transaction contains the combined effect of all the different specs. For [selection](https://codemirror.net/6/docs/ref/#state.TransactionSpec.selection), later specs take precedence over earlier ones. */ update(...specs) { return resolveTransaction(this, specs, true); } /** @internal */ applyTransaction(tr) { let conf = this.config, { base: base2, compartments } = conf; for (let effect of tr.effects) { if (effect.is(Compartment.reconfigure)) { if (conf) { compartments = /* @__PURE__ */ new Map(); conf.compartments.forEach((val, key) => compartments.set(key, val)); conf = null; } compartments.set(effect.value.compartment, effect.value.extension); } else if (effect.is(StateEffect.reconfigure)) { conf = null; base2 = effect.value; } else if (effect.is(StateEffect.appendConfig)) { conf = null; base2 = asArray(base2).concat(effect.value); } } let startValues; if (!conf) { conf = Configuration.resolve(base2, compartments, this); let intermediateState = new _EditorState(conf, this.doc, this.selection, conf.dynamicSlots.map(() => null), (state, slot) => slot.reconfigure(state, this), null); startValues = intermediateState.values; } else { startValues = tr.startState.values.slice(); } new _EditorState(conf, tr.newDoc, tr.newSelection, startValues, (state, slot) => slot.update(state, tr), tr); } /** Create a [transaction spec](https://codemirror.net/6/docs/ref/#state.TransactionSpec) that replaces every selection range with the given content. */ replaceSelection(text) { if (typeof text == "string") text = this.toText(text); return this.changeByRange((range) => ({ changes: { from: range.from, to: range.to, insert: text }, range: EditorSelection.cursor(range.from + text.length) })); } /** Create a set of changes and a new selection by running the given function for each range in the active selection. The function can return an optional set of changes (in the coordinate space of the start document), plus an updated range (in the coordinate space of the document produced by the call's own changes). This method will merge all the changes and ranges into a single changeset and selection, and return it as a [transaction spec](https://codemirror.net/6/docs/ref/#state.TransactionSpec), which can be passed to [`update`](https://codemirror.net/6/docs/ref/#state.EditorState.update). */ changeByRange(f) { let sel = this.selection; let result1 = f(sel.ranges[0]); let changes = this.changes(result1.changes), ranges = [result1.range]; let effects = asArray(result1.effects); for (let i = 1; i < sel.ranges.length; i++) { let result = f(sel.ranges[i]); let newChanges = this.changes(result.changes), newMapped = newChanges.map(changes); for (let j = 0; j < i; j++) ranges[j] = ranges[j].map(newMapped); let mapBy = changes.mapDesc(newChanges, true); ranges.push(result.range.map(mapBy)); changes = changes.compose(newMapped); effects = StateEffect.mapEffects(effects, newMapped).concat(StateEffect.mapEffects(asArray(result.effects), mapBy)); } return { changes, selection: EditorSelection.create(ranges, sel.mainIndex), effects }; } /** Create a [change set](https://codemirror.net/6/docs/ref/#state.ChangeSet) from the given change description, taking the state's document length and line separator into account. */ changes(spec = []) { if (spec instanceof ChangeSet) return spec; return ChangeSet.of(spec, this.doc.length, this.facet(_EditorState.lineSeparator)); } /** Using the state's [line separator](https://codemirror.net/6/docs/ref/#state.EditorState^lineSeparator), create a [`Text`](https://codemirror.net/6/docs/ref/#state.Text) instance from the given string. */ toText(string2) { return Text2.of(string2.split(this.facet(_EditorState.lineSeparator) || DefaultSplit)); } /** Return the given range of the document as a string. */ sliceDoc(from = 0, to = this.doc.length) { return this.doc.sliceString(from, to, this.lineBreak); } /** Get the value of a state [facet](https://codemirror.net/6/docs/ref/#state.Facet). */ facet(facet) { let addr = this.config.address[facet.id]; if (addr == null) return facet.default; ensureAddr(this, addr); return getAddr(this, addr); } /** Convert this state to a JSON-serializable object. When custom fields should be serialized, you can pass them in as an object mapping property names (in the resulting object, which should not use `doc` or `selection`) to fields. */ toJSON(fields) { let result = { doc: this.sliceDoc(), selection: this.selection.toJSON() }; if (fields) for (let prop in fields) { let value = fields[prop]; if (value instanceof StateField && this.config.address[value.id] != null) result[prop] = value.spec.toJSON(this.field(fields[prop]), this); } return result; } /** Deserialize a state from its JSON representation. When custom fields should be deserialized, pass the same object you passed to [`toJSON`](https://codemirror.net/6/docs/ref/#state.EditorState.toJSON) when serializing as third argument. */ static fromJSON(json, config2 = {}, fields) { if (!json || typeof json.doc != "string") throw new RangeError("Invalid JSON representation for EditorState"); let fieldInit = []; if (fields) for (let prop in fields) { if (Object.prototype.hasOwnProperty.call(json, prop)) { let field = fields[prop], value = json[prop]; fieldInit.push(field.init((state) => field.spec.fromJSON(value, state))); } } return _EditorState.create({ doc: json.doc, selection: EditorSelection.fromJSON(json.selection), extensions: config2.extensions ? fieldInit.concat([config2.extensions]) : fieldInit }); } /** Create a new state. You'll usually only need this when initializing an editor—updated states are created by applying transactions. */ static create(config2 = {}) { let configuration = Configuration.resolve(config2.extensions || [], /* @__PURE__ */ new Map()); let doc2 = config2.doc instanceof Text2 ? config2.doc : Text2.of((config2.doc || "").split(configuration.staticFacet(_EditorState.lineSeparator) || DefaultSplit)); let selection = !config2.selection ? EditorSelection.single(0) : config2.selection instanceof EditorSelection ? config2.selection : EditorSelection.single(config2.selection.anchor, config2.selection.head); checkSelection(selection, doc2.length); if (!configuration.staticFacet(allowMultipleSelections)) selection = selection.asSingle(); return new _EditorState(configuration, doc2, selection, configuration.dynamicSlots.map(() => null), (state, slot) => slot.create(state), null); } /** The size (in columns) of a tab in the document, determined by the [`tabSize`](https://codemirror.net/6/docs/ref/#state.EditorState^tabSize) facet. */ get tabSize() { return this.facet(_EditorState.tabSize); } /** Get the proper [line-break](https://codemirror.net/6/docs/ref/#state.EditorState^lineSeparator) string for this state. */ get lineBreak() { return this.facet(_EditorState.lineSeparator) || "\n"; } /** Returns true when the editor is [configured](https://codemirror.net/6/docs/ref/#state.EditorState^readOnly) to be read-only. */ get readOnly() { return this.facet(readOnly); } /** Look up a translation for the given phrase (via the [`phrases`](https://codemirror.net/6/docs/ref/#state.EditorState^phrases) facet), or return the original string if no translation is found. If additional arguments are passed, they will be inserted in place of markers like `$1` (for the first value) and `$2`, etc. A single `$` is equivalent to `$1`, and `$$` will produce a literal dollar sign. */ phrase(phrase2, ...insert2) { for (let map of this.facet(_EditorState.phrases)) if (Object.prototype.hasOwnProperty.call(map, phrase2)) { phrase2 = map[phrase2]; break; } if (insert2.length) phrase2 = phrase2.replace(/\$(\$|\d*)/g, (m, i) => { if (i == "$") return "$"; let n = +(i || 1); return !n || n > insert2.length ? m : insert2[n - 1]; }); return phrase2; } /** Find the values for a given language data field, provided by the the [`languageData`](https://codemirror.net/6/docs/ref/#state.EditorState^languageData) facet. Examples of language data fields are... - [`"commentTokens"`](https://codemirror.net/6/docs/ref/#commands.CommentTokens) for specifying comment syntax. - [`"autocomplete"`](https://codemirror.net/6/docs/ref/#autocomplete.autocompletion^config.override) for providing language-specific completion sources. - [`"wordChars"`](https://codemirror.net/6/docs/ref/#state.EditorState.charCategorizer) for adding characters that should be considered part of words in this language. - [`"closeBrackets"`](https://codemirror.net/6/docs/ref/#autocomplete.CloseBracketConfig) controls bracket closing behavior. */ languageDataAt(name2, pos, side = -1) { let values2 = []; for (let provider of this.facet(languageData)) { for (let result of provider(this, pos, side)) { if (Object.prototype.hasOwnProperty.call(result, name2)) values2.push(result[name2]); } } return values2; } /** Return a function that can categorize strings (expected to represent a single [grapheme cluster](https://codemirror.net/6/docs/ref/#state.findClusterBreak)) into one of: - Word (contains an alphanumeric character or a character explicitly listed in the local language's `"wordChars"` language data, which should be a string) - Space (contains only whitespace) - Other (anything else) */ charCategorizer(at) { return makeCategorizer(this.languageDataAt("wordChars", at).join("")); } /** Find the word at the given position, meaning the range containing all [word](https://codemirror.net/6/docs/ref/#state.CharCategory.Word) characters around it. If no word characters are adjacent to the position, this returns null. */ wordAt(pos) { let { text, from, length } = this.doc.lineAt(pos); let cat = this.charCategorizer(pos); let start = pos - from, end = pos - from; while (start > 0) { let prev = findClusterBreak(text, start, false); if (cat(text.slice(prev, start)) != CharCategory.Word) break; start = prev; } while (end < length) { let next = findClusterBreak(text, end); if (cat(text.slice(end, next)) != CharCategory.Word) break; end = next; } return start == end ? null : EditorSelection.range(start + from, end + from); } }; EditorState.allowMultipleSelections = allowMultipleSelections; EditorState.tabSize = /* @__PURE__ */ Facet.define({ combine: (values2) => values2.length ? values2[0] : 4 }); EditorState.lineSeparator = lineSeparator; EditorState.readOnly = readOnly; EditorState.phrases = /* @__PURE__ */ Facet.define({ compare(a, b) { let kA = Object.keys(a), kB = Object.keys(b); return kA.length == kB.length && kA.every((k) => a[k] == b[k]); } }); EditorState.languageData = languageData; EditorState.changeFilter = changeFilter; EditorState.transactionFilter = transactionFilter; EditorState.transactionExtender = transactionExtender; Compartment.reconfigure = /* @__PURE__ */ StateEffect.define(); function combineConfig(configs, defaults4, combine = {}) { let result = {}; for (let config2 of configs) for (let key of Object.keys(config2)) { let value = config2[key], current = result[key]; if (current === void 0) result[key] = value; else if (current === value || value === void 0) ; else if (Object.hasOwnProperty.call(combine, key)) result[key] = combine[key](current, value); else throw new Error("Config merge conflict for field " + key); } for (let key in defaults4) if (result[key] === void 0) result[key] = defaults4[key]; return result; } var RangeValue = class { /** Compare this value with another value. Used when comparing rangesets. The default implementation compares by identity. Unless you are only creating a fixed number of unique instances of your value type, it is a good idea to implement this properly. */ eq(other) { return this == other; } /** Create a [range](https://codemirror.net/6/docs/ref/#state.Range) with this value. */ range(from, to = from) { return Range.create(from, to, this); } }; RangeValue.prototype.startSide = RangeValue.prototype.endSide = 0; RangeValue.prototype.point = false; RangeValue.prototype.mapMode = MapMode.TrackDel; var Range = class _Range { constructor(from, to, value) { this.from = from; this.to = to; this.value = value; } /** @internal */ static create(from, to, value) { return new _Range(from, to, value); } }; function cmpRange(a, b) { return a.from - b.from || a.value.startSide - b.value.startSide; } var Chunk = class _Chunk { constructor(from, to, value, maxPoint) { this.from = from; this.to = to; this.value = value; this.maxPoint = maxPoint; } get length() { return this.to[this.to.length - 1]; } // Find the index of the given position and side. Use the ranges' // `from` pos when `end == false`, `to` when `end == true`. findIndex(pos, side, end, startAt = 0) { let arr = end ? this.to : this.from; for (let lo = startAt, hi = arr.length; ; ) { if (lo == hi) return lo; let mid = lo + hi >> 1; let diff = arr[mid] - pos || (end ? this.value[mid].endSide : this.value[mid].startSide) - side; if (mid == lo) return diff >= 0 ? lo : hi; if (diff >= 0) hi = mid; else lo = mid + 1; } } between(offset, from, to, f) { for (let i = this.findIndex(from, -1e9, true), e = this.findIndex(to, 1e9, false, i); i < e; i++) if (f(this.from[i] + offset, this.to[i] + offset, this.value[i]) === false) return false; } map(offset, changes) { let value = [], from = [], to = [], newPos = -1, maxPoint = -1; for (let i = 0; i < this.value.length; i++) { let val = this.value[i], curFrom = this.from[i] + offset, curTo = this.to[i] + offset, newFrom, newTo; if (curFrom == curTo) { let mapped = changes.mapPos(curFrom, val.startSide, val.mapMode); if (mapped == null) continue; newFrom = newTo = mapped; if (val.startSide != val.endSide) { newTo = changes.mapPos(curFrom, val.endSide); if (newTo < newFrom) continue; } } else { newFrom = changes.mapPos(curFrom, val.startSide); newTo = changes.mapPos(curTo, val.endSide); if (newFrom > newTo || newFrom == newTo && val.startSide > 0 && val.endSide <= 0) continue; } if ((newTo - newFrom || val.endSide - val.startSide) < 0) continue; if (newPos < 0) newPos = newFrom; if (val.point) maxPoint = Math.max(maxPoint, newTo - newFrom); value.push(val); from.push(newFrom - newPos); to.push(newTo - newPos); } return { mapped: value.length ? new _Chunk(from, to, value, maxPoint) : null, pos: newPos }; } }; var RangeSet = class _RangeSet { constructor(chunkPos, chunk, nextLayer, maxPoint) { this.chunkPos = chunkPos; this.chunk = chunk; this.nextLayer = nextLayer; this.maxPoint = maxPoint; } /** @internal */ static create(chunkPos, chunk, nextLayer, maxPoint) { return new _RangeSet(chunkPos, chunk, nextLayer, maxPoint); } /** @internal */ get length() { let last = this.chunk.length - 1; return last < 0 ? 0 : Math.max(this.chunkEnd(last), this.nextLayer.length); } /** The number of ranges in the set. */ get size() { if (this.isEmpty) return 0; let size = this.nextLayer.size; for (let chunk of this.chunk) size += chunk.value.length; return size; } /** @internal */ chunkEnd(index) { return this.chunkPos[index] + this.chunk[index].length; } /** Update the range set, optionally adding new ranges or filtering out existing ones. (Note: The type parameter is just there as a kludge to work around TypeScript variance issues that prevented `RangeSet` from being a subtype of `RangeSet` when `X` is a subtype of `Y`.) */ update(updateSpec) { let { add: add2 = [], sort = false, filterFrom = 0, filterTo = this.length } = updateSpec; let filter = updateSpec.filter; if (add2.length == 0 && !filter) return this; if (sort) add2 = add2.slice().sort(cmpRange); if (this.isEmpty) return add2.length ? _RangeSet.of(add2) : this; let cur2 = new LayerCursor(this, null, -1).goto(0), i = 0, spill = []; let builder = new RangeSetBuilder(); while (cur2.value || i < add2.length) { if (i < add2.length && (cur2.from - add2[i].from || cur2.startSide - add2[i].value.startSide) >= 0) { let range = add2[i++]; if (!builder.addInner(range.from, range.to, range.value)) spill.push(range); } else if (cur2.rangeIndex == 1 && cur2.chunkIndex < this.chunk.length && (i == add2.length || this.chunkEnd(cur2.chunkIndex) < add2[i].from) && (!filter || filterFrom > this.chunkEnd(cur2.chunkIndex) || filterTo < this.chunkPos[cur2.chunkIndex]) && builder.addChunk(this.chunkPos[cur2.chunkIndex], this.chunk[cur2.chunkIndex])) { cur2.nextChunk(); } else { if (!filter || filterFrom > cur2.to || filterTo < cur2.from || filter(cur2.from, cur2.to, cur2.value)) { if (!builder.addInner(cur2.from, cur2.to, cur2.value)) spill.push(Range.create(cur2.from, cur2.to, cur2.value)); } cur2.next(); } } return builder.finishInner(this.nextLayer.isEmpty && !spill.length ? _RangeSet.empty : this.nextLayer.update({ add: spill, filter, filterFrom, filterTo })); } /** Map this range set through a set of changes, return the new set. */ map(changes) { if (changes.empty || this.isEmpty) return this; let chunks = [], chunkPos = [], maxPoint = -1; for (let i = 0; i < this.chunk.length; i++) { let start = this.chunkPos[i], chunk = this.chunk[i]; let touch = changes.touchesRange(start, start + chunk.length); if (touch === false) { maxPoint = Math.max(maxPoint, chunk.maxPoint); chunks.push(chunk); chunkPos.push(changes.mapPos(start)); } else if (touch === true) { let { mapped, pos } = chunk.map(start, changes); if (mapped) { maxPoint = Math.max(maxPoint, mapped.maxPoint); chunks.push(mapped); chunkPos.push(pos); } } } let next = this.nextLayer.map(changes); return chunks.length == 0 ? next : new _RangeSet(chunkPos, chunks, next || _RangeSet.empty, maxPoint); } /** Iterate over the ranges that touch the region `from` to `to`, calling `f` for each. There is no guarantee that the ranges will be reported in any specific order. When the callback returns `false`, iteration stops. */ between(from, to, f) { if (this.isEmpty) return; for (let i = 0; i < this.chunk.length; i++) { let start = this.chunkPos[i], chunk = this.chunk[i]; if (to >= start && from <= start + chunk.length && chunk.between(start, from - start, to - start, f) === false) return; } this.nextLayer.between(from, to, f); } /** Iterate over the ranges in this set, in order, including all ranges that end at or after `from`. */ iter(from = 0) { return HeapCursor.from([this]).goto(from); } /** @internal */ get isEmpty() { return this.nextLayer == this; } /** Iterate over the ranges in a collection of sets, in order, starting from `from`. */ static iter(sets, from = 0) { return HeapCursor.from(sets).goto(from); } /** Iterate over two groups of sets, calling methods on `comparator` to notify it of possible differences. */ static compare(oldSets, newSets, textDiff, comparator, minPointSize = -1) { let a = oldSets.filter((set) => set.maxPoint > 0 || !set.isEmpty && set.maxPoint >= minPointSize); let b = newSets.filter((set) => set.maxPoint > 0 || !set.isEmpty && set.maxPoint >= minPointSize); let sharedChunks = findSharedChunks(a, b, textDiff); let sideA = new SpanCursor(a, sharedChunks, minPointSize); let sideB = new SpanCursor(b, sharedChunks, minPointSize); textDiff.iterGaps((fromA, fromB, length) => compare(sideA, fromA, sideB, fromB, length, comparator)); if (textDiff.empty && textDiff.length == 0) compare(sideA, 0, sideB, 0, 0, comparator); } /** Compare the contents of two groups of range sets, returning true if they are equivalent in the given range. */ static eq(oldSets, newSets, from = 0, to) { if (to == null) to = 1e9 - 1; let a = oldSets.filter((set) => !set.isEmpty && newSets.indexOf(set) < 0); let b = newSets.filter((set) => !set.isEmpty && oldSets.indexOf(set) < 0); if (a.length != b.length) return false; if (!a.length) return true; let sharedChunks = findSharedChunks(a, b); let sideA = new SpanCursor(a, sharedChunks, 0).goto(from), sideB = new SpanCursor(b, sharedChunks, 0).goto(from); for (; ; ) { if (sideA.to != sideB.to || !sameValues(sideA.active, sideB.active) || sideA.point && (!sideB.point || !sideA.point.eq(sideB.point))) return false; if (sideA.to > to) return true; sideA.next(); sideB.next(); } } /** Iterate over a group of range sets at the same time, notifying the iterator about the ranges covering every given piece of content. Returns the open count (see [`SpanIterator.span`](https://codemirror.net/6/docs/ref/#state.SpanIterator.span)) at the end of the iteration. */ static spans(sets, from, to, iterator, minPointSize = -1) { let cursor = new SpanCursor(sets, null, minPointSize).goto(from), pos = from; let openRanges = cursor.openStart; for (; ; ) { let curTo = Math.min(cursor.to, to); if (cursor.point) { let active = cursor.activeForPoint(cursor.to); let openCount = cursor.pointFrom < from ? active.length + 1 : Math.min(active.length, openRanges); iterator.point(pos, curTo, cursor.point, active, openCount, cursor.pointRank); openRanges = Math.min(cursor.openEnd(curTo), active.length); } else if (curTo > pos) { iterator.span(pos, curTo, cursor.active, openRanges); openRanges = cursor.openEnd(curTo); } if (cursor.to > to) return openRanges + (cursor.point && cursor.to > to ? 1 : 0); pos = cursor.to; cursor.next(); } } /** Create a range set for the given range or array of ranges. By default, this expects the ranges to be _sorted_ (by start position and, if two start at the same position, `value.startSide`). You can pass `true` as second argument to cause the method to sort them. */ static of(ranges, sort = false) { let build = new RangeSetBuilder(); for (let range of ranges instanceof Range ? [ranges] : sort ? lazySort(ranges) : ranges) build.add(range.from, range.to, range.value); return build.finish(); } }; RangeSet.empty = /* @__PURE__ */ new RangeSet([], [], null, -1); function lazySort(ranges) { if (ranges.length > 1) for (let prev = ranges[0], i = 1; i < ranges.length; i++) { let cur2 = ranges[i]; if (cmpRange(prev, cur2) > 0) return ranges.slice().sort(cmpRange); prev = cur2; } return ranges; } RangeSet.empty.nextLayer = RangeSet.empty; var RangeSetBuilder = class _RangeSetBuilder { finishChunk(newArrays) { this.chunks.push(new Chunk(this.from, this.to, this.value, this.maxPoint)); this.chunkPos.push(this.chunkStart); this.chunkStart = -1; this.setMaxPoint = Math.max(this.setMaxPoint, this.maxPoint); this.maxPoint = -1; if (newArrays) { this.from = []; this.to = []; this.value = []; } } /** Create an empty builder. */ constructor() { this.chunks = []; this.chunkPos = []; this.chunkStart = -1; this.last = null; this.lastFrom = -1e9; this.lastTo = -1e9; this.from = []; this.to = []; this.value = []; this.maxPoint = -1; this.setMaxPoint = -1; this.nextLayer = null; } /** Add a range. Ranges should be added in sorted (by `from` and `value.startSide`) order. */ add(from, to, value) { if (!this.addInner(from, to, value)) (this.nextLayer || (this.nextLayer = new _RangeSetBuilder())).add(from, to, value); } /** @internal */ addInner(from, to, value) { let diff = from - this.lastTo || value.startSide - this.last.endSide; if (diff <= 0 && (from - this.lastFrom || value.startSide - this.last.startSide) < 0) throw new Error("Ranges must be added sorted by `from` position and `startSide`"); if (diff < 0) return false; if (this.from.length == 250) this.finishChunk(true); if (this.chunkStart < 0) this.chunkStart = from; this.from.push(from - this.chunkStart); this.to.push(to - this.chunkStart); this.last = value; this.lastFrom = from; this.lastTo = to; this.value.push(value); if (value.point) this.maxPoint = Math.max(this.maxPoint, to - from); return true; } /** @internal */ addChunk(from, chunk) { if ((from - this.lastTo || chunk.value[0].startSide - this.last.endSide) < 0) return false; if (this.from.length) this.finishChunk(true); this.setMaxPoint = Math.max(this.setMaxPoint, chunk.maxPoint); this.chunks.push(chunk); this.chunkPos.push(from); let last = chunk.value.length - 1; this.last = chunk.value[last]; this.lastFrom = chunk.from[last] + from; this.lastTo = chunk.to[last] + from; return true; } /** Finish the range set. Returns the new set. The builder can't be used anymore after this has been called. */ finish() { return this.finishInner(RangeSet.empty); } /** @internal */ finishInner(next) { if (this.from.length) this.finishChunk(false); if (this.chunks.length == 0) return next; let result = RangeSet.create(this.chunkPos, this.chunks, this.nextLayer ? this.nextLayer.finishInner(next) : next, this.setMaxPoint); this.from = null; return result; } }; function findSharedChunks(a, b, textDiff) { let inA = /* @__PURE__ */ new Map(); for (let set of a) for (let i = 0; i < set.chunk.length; i++) if (set.chunk[i].maxPoint <= 0) inA.set(set.chunk[i], set.chunkPos[i]); let shared = /* @__PURE__ */ new Set(); for (let set of b) for (let i = 0; i < set.chunk.length; i++) { let known = inA.get(set.chunk[i]); if (known != null && (textDiff ? textDiff.mapPos(known) : known) == set.chunkPos[i] && !(textDiff === null || textDiff === void 0 ? void 0 : textDiff.touchesRange(known, known + set.chunk[i].length))) shared.add(set.chunk[i]); } return shared; } var LayerCursor = class { constructor(layer2, skip, minPoint, rank = 0) { this.layer = layer2; this.skip = skip; this.minPoint = minPoint; this.rank = rank; } get startSide() { return this.value ? this.value.startSide : 0; } get endSide() { return this.value ? this.value.endSide : 0; } goto(pos, side = -1e9) { this.chunkIndex = this.rangeIndex = 0; this.gotoInner(pos, side, false); return this; } gotoInner(pos, side, forward) { while (this.chunkIndex < this.layer.chunk.length) { let next = this.layer.chunk[this.chunkIndex]; if (!(this.skip && this.skip.has(next) || this.layer.chunkEnd(this.chunkIndex) < pos || next.maxPoint < this.minPoint)) break; this.chunkIndex++; forward = false; } if (this.chunkIndex < this.layer.chunk.length) { let rangeIndex = this.layer.chunk[this.chunkIndex].findIndex(pos - this.layer.chunkPos[this.chunkIndex], side, true); if (!forward || this.rangeIndex < rangeIndex) this.setRangeIndex(rangeIndex); } this.next(); } forward(pos, side) { if ((this.to - pos || this.endSide - side) < 0) this.gotoInner(pos, side, true); } next() { for (; ; ) { if (this.chunkIndex == this.layer.chunk.length) { this.from = this.to = 1e9; this.value = null; break; } else { let chunkPos = this.layer.chunkPos[this.chunkIndex], chunk = this.layer.chunk[this.chunkIndex]; let from = chunkPos + chunk.from[this.rangeIndex]; this.from = from; this.to = chunkPos + chunk.to[this.rangeIndex]; this.value = chunk.value[this.rangeIndex]; this.setRangeIndex(this.rangeIndex + 1); if (this.minPoint < 0 || this.value.point && this.to - this.from >= this.minPoint) break; } } } setRangeIndex(index) { if (index == this.layer.chunk[this.chunkIndex].value.length) { this.chunkIndex++; if (this.skip) { while (this.chunkIndex < this.layer.chunk.length && this.skip.has(this.layer.chunk[this.chunkIndex])) this.chunkIndex++; } this.rangeIndex = 0; } else { this.rangeIndex = index; } } nextChunk() { this.chunkIndex++; this.rangeIndex = 0; this.next(); } compare(other) { return this.from - other.from || this.startSide - other.startSide || this.rank - other.rank || this.to - other.to || this.endSide - other.endSide; } }; var HeapCursor = class _HeapCursor { constructor(heap) { this.heap = heap; } static from(sets, skip = null, minPoint = -1) { let heap = []; for (let i = 0; i < sets.length; i++) { for (let cur2 = sets[i]; !cur2.isEmpty; cur2 = cur2.nextLayer) { if (cur2.maxPoint >= minPoint) heap.push(new LayerCursor(cur2, skip, minPoint, i)); } } return heap.length == 1 ? heap[0] : new _HeapCursor(heap); } get startSide() { return this.value ? this.value.startSide : 0; } goto(pos, side = -1e9) { for (let cur2 of this.heap) cur2.goto(pos, side); for (let i = this.heap.length >> 1; i >= 0; i--) heapBubble(this.heap, i); this.next(); return this; } forward(pos, side) { for (let cur2 of this.heap) cur2.forward(pos, side); for (let i = this.heap.length >> 1; i >= 0; i--) heapBubble(this.heap, i); if ((this.to - pos || this.value.endSide - side) < 0) this.next(); } next() { if (this.heap.length == 0) { this.from = this.to = 1e9; this.value = null; this.rank = -1; } else { let top2 = this.heap[0]; this.from = top2.from; this.to = top2.to; this.value = top2.value; this.rank = top2.rank; if (top2.value) top2.next(); heapBubble(this.heap, 0); } } }; function heapBubble(heap, index) { for (let cur2 = heap[index]; ; ) { let childIndex = (index << 1) + 1; if (childIndex >= heap.length) break; let child = heap[childIndex]; if (childIndex + 1 < heap.length && child.compare(heap[childIndex + 1]) >= 0) { child = heap[childIndex + 1]; childIndex++; } if (cur2.compare(child) < 0) break; heap[childIndex] = cur2; heap[index] = child; index = childIndex; } } var SpanCursor = class { constructor(sets, skip, minPoint) { this.minPoint = minPoint; this.active = []; this.activeTo = []; this.activeRank = []; this.minActive = -1; this.point = null; this.pointFrom = 0; this.pointRank = 0; this.to = -1e9; this.endSide = 0; this.openStart = -1; this.cursor = HeapCursor.from(sets, skip, minPoint); } goto(pos, side = -1e9) { this.cursor.goto(pos, side); this.active.length = this.activeTo.length = this.activeRank.length = 0; this.minActive = -1; this.to = pos; this.endSide = side; this.openStart = -1; this.next(); return this; } forward(pos, side) { while (this.minActive > -1 && (this.activeTo[this.minActive] - pos || this.active[this.minActive].endSide - side) < 0) this.removeActive(this.minActive); this.cursor.forward(pos, side); } removeActive(index) { remove(this.active, index); remove(this.activeTo, index); remove(this.activeRank, index); this.minActive = findMinIndex(this.active, this.activeTo); } addActive(trackOpen) { let i = 0, { value, to, rank } = this.cursor; while (i < this.activeRank.length && this.activeRank[i] <= rank) i++; insert(this.active, i, value); insert(this.activeTo, i, to); insert(this.activeRank, i, rank); if (trackOpen) insert(trackOpen, i, this.cursor.from); this.minActive = findMinIndex(this.active, this.activeTo); } // After calling this, if `this.point` != null, the next range is a // point. Otherwise, it's a regular range, covered by `this.active`. next() { let from = this.to, wasPoint = this.point; this.point = null; let trackOpen = this.openStart < 0 ? [] : null; for (; ; ) { let a = this.minActive; if (a > -1 && (this.activeTo[a] - this.cursor.from || this.active[a].endSide - this.cursor.startSide) < 0) { if (this.activeTo[a] > from) { this.to = this.activeTo[a]; this.endSide = this.active[a].endSide; break; } this.removeActive(a); if (trackOpen) remove(trackOpen, a); } else if (!this.cursor.value) { this.to = this.endSide = 1e9; break; } else if (this.cursor.from > from) { this.to = this.cursor.from; this.endSide = this.cursor.startSide; break; } else { let nextVal = this.cursor.value; if (!nextVal.point) { this.addActive(trackOpen); this.cursor.next(); } else if (wasPoint && this.cursor.to == this.to && this.cursor.from < this.cursor.to) { this.cursor.next(); } else { this.point = nextVal; this.pointFrom = this.cursor.from; this.pointRank = this.cursor.rank; this.to = this.cursor.to; this.endSide = nextVal.endSide; this.cursor.next(); this.forward(this.to, this.endSide); break; } } } if (trackOpen) { this.openStart = 0; for (let i = trackOpen.length - 1; i >= 0 && trackOpen[i] < from; i--) this.openStart++; } } activeForPoint(to) { if (!this.active.length) return this.active; let active = []; for (let i = this.active.length - 1; i >= 0; i--) { if (this.activeRank[i] < this.pointRank) break; if (this.activeTo[i] > to || this.activeTo[i] == to && this.active[i].endSide >= this.point.endSide) active.push(this.active[i]); } return active.reverse(); } openEnd(to) { let open = 0; for (let i = this.activeTo.length - 1; i >= 0 && this.activeTo[i] > to; i--) open++; return open; } }; function compare(a, startA, b, startB, length, comparator) { a.goto(startA); b.goto(startB); let endB = startB + length; let pos = startB, dPos = startB - startA; for (; ; ) { let diff = a.to + dPos - b.to || a.endSide - b.endSide; let end = diff < 0 ? a.to + dPos : b.to, clipEnd = Math.min(end, endB); if (a.point || b.point) { if (!(a.point && b.point && (a.point == b.point || a.point.eq(b.point)) && sameValues(a.activeForPoint(a.to), b.activeForPoint(b.to)))) comparator.comparePoint(pos, clipEnd, a.point, b.point); } else { if (clipEnd > pos && !sameValues(a.active, b.active)) comparator.compareRange(pos, clipEnd, a.active, b.active); } if (end > endB) break; pos = end; if (diff <= 0) a.next(); if (diff >= 0) b.next(); } } function sameValues(a, b) { if (a.length != b.length) return false; for (let i = 0; i < a.length; i++) if (a[i] != b[i] && !a[i].eq(b[i])) return false; return true; } function remove(array, index) { for (let i = index, e = array.length - 1; i < e; i++) array[i] = array[i + 1]; array.pop(); } function insert(array, index, value) { for (let i = array.length - 1; i >= index; i--) array[i + 1] = array[i]; array[index] = value; } function findMinIndex(value, array) { let found = -1, foundPos = 1e9; for (let i = 0; i < array.length; i++) if ((array[i] - foundPos || value[i].endSide - value[found].endSide) < 0) { found = i; foundPos = array[i]; } return found; } function countColumn(string2, tabSize, to = string2.length) { let n = 0; for (let i = 0; i < to; ) { if (string2.charCodeAt(i) == 9) { n += tabSize - n % tabSize; i++; } else { n++; i = findClusterBreak(string2, i); } } return n; } function findColumn(string2, col, tabSize, strict) { for (let i = 0, n = 0; ; ) { if (n >= col) return i; if (i == string2.length) break; n += string2.charCodeAt(i) == 9 ? tabSize - n % tabSize : 1; i = findClusterBreak(string2, i); } return strict === true ? -1 : string2.length; } // node_modules/style-mod/src/style-mod.js var C = "\u037C"; var COUNT = typeof Symbol == "undefined" ? "__" + C : Symbol.for(C); var SET = typeof Symbol == "undefined" ? "__styleSet" + Math.floor(Math.random() * 1e8) : Symbol("styleSet"); var top = typeof globalThis != "undefined" ? globalThis : typeof window != "undefined" ? window : {}; var StyleModule = class { // :: (Object