UNPKG

monaco-editor

Version:
1,746 lines (1,745 loc) 735 kB
define("vs/editorWorkerHost-DOv8Y9y5", ["require", "exports"], (function(require, exports) { "use strict"; function _interopNamespaceDefault(e) { const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } }); if (e) { for (const k in e) { if (k !== "default") { const d = Object.getOwnPropertyDescriptor(e, k); Object.defineProperty(n, k, d.get ? d : { enumerable: true, get: () => e[k] }); } } } n.default = e; return Object.freeze(n); } function tail(arr) { if (arr.length === 0) { throw new Error("Invalid tail call"); } return [arr.slice(0, arr.length - 1), arr[arr.length - 1]]; } function equals$2(one, other, itemEquals = (a, b) => a === b) { if (one === other) { return true; } if (!one || !other) { return false; } if (one.length !== other.length) { return false; } for (let i = 0, len = one.length; i < len; i++) { if (!itemEquals(one[i], other[i])) { return false; } } return true; } function removeFastWithoutKeepingOrder(array, index) { const last = array.length - 1; if (index < last) { array[index] = array[last]; } array.pop(); } function binarySearch(array, key, comparator) { return binarySearch2(array.length, (i) => comparator(array[i], key)); } function binarySearch2(length, compareToKey) { let low = 0, high = length - 1; while (low <= high) { const mid = (low + high) / 2 | 0; const comp = compareToKey(mid); if (comp < 0) { low = mid + 1; } else if (comp > 0) { high = mid - 1; } else { return mid; } } return -(low + 1); } function quickSelect(nth, data, compare2) { nth = nth | 0; if (nth >= data.length) { throw new TypeError("invalid index"); } const pivotValue = data[Math.floor(data.length * Math.random())]; const lower = []; const higher = []; const pivots = []; for (const value of data) { const val = compare2(value, pivotValue); if (val < 0) { lower.push(value); } else if (val > 0) { higher.push(value); } else { pivots.push(value); } } if (nth < lower.length) { return quickSelect(nth, lower, compare2); } else if (nth < lower.length + pivots.length) { return pivots[0]; } else { return quickSelect(nth - (lower.length + pivots.length), higher, compare2); } } function groupBy(data, compare2) { const result = []; let currentGroup = void 0; for (const element of data.slice(0).sort(compare2)) { if (!currentGroup || compare2(currentGroup[0], element) !== 0) { currentGroup = [element]; result.push(currentGroup); } else { currentGroup.push(element); } } return result; } function* groupAdjacentBy(items, shouldBeGrouped) { let currentGroup; let last; for (const item of items) { if (last !== void 0 && shouldBeGrouped(last, item)) { currentGroup.push(item); } else { if (currentGroup) { yield currentGroup; } currentGroup = [item]; } last = item; } if (currentGroup) { yield currentGroup; } } function forEachAdjacent(arr, f) { for (let i = 0; i <= arr.length; i++) { f(i === 0 ? void 0 : arr[i - 1], i === arr.length ? void 0 : arr[i]); } } function forEachWithNeighbors(arr, f) { for (let i = 0; i < arr.length; i++) { f(i === 0 ? void 0 : arr[i - 1], arr[i], i + 1 === arr.length ? void 0 : arr[i + 1]); } } function coalesce(array) { return array.filter((e) => !!e); } function coalesceInPlace(array) { let to = 0; for (let i = 0; i < array.length; i++) { if (!!array[i]) { array[to] = array[i]; to += 1; } } array.length = to; } function isFalsyOrEmpty(obj) { return !Array.isArray(obj) || obj.length === 0; } function isNonEmptyArray(obj) { return Array.isArray(obj) && obj.length > 0; } function distinct(array, keyFn = (value) => value) { const seen = /* @__PURE__ */ new Set(); return array.filter((element) => { const key = keyFn(element); if (seen.has(key)) { return false; } seen.add(key); return true; }); } function range(arg, to) { let from = typeof to === "number" ? arg : 0; if (typeof to === "number") { from = arg; } else { from = 0; to = arg; } const result = []; if (from <= to) { for (let i = from; i < to; i++) { result.push(i); } } else { for (let i = from; i > to; i--) { result.push(i); } } return result; } function arrayInsert(target, insertIndex, insertArr) { const before = target.slice(0, insertIndex); const after = target.slice(insertIndex); return before.concat(insertArr, after); } function pushToStart(arr, value) { const index = arr.indexOf(value); if (index > -1) { arr.splice(index, 1); arr.unshift(value); } } function pushToEnd(arr, value) { const index = arr.indexOf(value); if (index > -1) { arr.splice(index, 1); arr.push(value); } } function pushMany(arr, items) { for (const item of items) { arr.push(item); } } function mapFilter(array, fn) { const result = []; for (const item of array) { const mapped = fn(item); if (mapped !== void 0) { result.push(mapped); } } return result; } function asArray(x) { return Array.isArray(x) ? x : [x]; } function insertInto(array, start, newItems) { const startIdx = getActualStartIndex(array, start); const originalLength = array.length; const newItemsLength = newItems.length; array.length = originalLength + newItemsLength; for (let i = originalLength - 1; i >= startIdx; i--) { array[i + newItemsLength] = array[i]; } for (let i = 0; i < newItemsLength; i++) { array[i + startIdx] = newItems[i]; } } function splice(array, start, deleteCount, newItems) { const index = getActualStartIndex(array, start); let result = array.splice(index, deleteCount); if (result === void 0) { result = []; } insertInto(array, index, newItems); return result; } function getActualStartIndex(array, start) { return start < 0 ? Math.max(start + array.length, 0) : Math.min(start, array.length); } var CompareResult; (function(CompareResult2) { function isLessThan(result) { return result < 0; } CompareResult2.isLessThan = isLessThan; function isLessThanOrEqual(result) { return result <= 0; } CompareResult2.isLessThanOrEqual = isLessThanOrEqual; function isGreaterThan(result) { return result > 0; } CompareResult2.isGreaterThan = isGreaterThan; function isNeitherLessOrGreaterThan(result) { return result === 0; } CompareResult2.isNeitherLessOrGreaterThan = isNeitherLessOrGreaterThan; CompareResult2.greaterThan = 1; CompareResult2.lessThan = -1; CompareResult2.neitherLessOrGreaterThan = 0; })(CompareResult || (CompareResult = {})); function compareBy(selector, comparator) { return (a, b) => comparator(selector(a), selector(b)); } function tieBreakComparators(...comparators) { return (item1, item2) => { for (const comparator of comparators) { const result = comparator(item1, item2); if (!CompareResult.isNeitherLessOrGreaterThan(result)) { return result; } } return CompareResult.neitherLessOrGreaterThan; }; } const numberComparator = (a, b) => a - b; const booleanComparator = (a, b) => numberComparator(a ? 1 : 0, b ? 1 : 0); function reverseOrder(comparator) { return (a, b) => -comparator(a, b); } function compareUndefinedSmallest(comparator) { return (a, b) => { if (a === void 0) { return b === void 0 ? CompareResult.neitherLessOrGreaterThan : CompareResult.lessThan; } else if (b === void 0) { return CompareResult.greaterThan; } return comparator(a, b); }; } class ArrayQueue { /** * Constructs a queue that is backed by the given array. Runtime is O(1). */ constructor(items) { this.firstIdx = 0; this.items = items; this.lastIdx = this.items.length - 1; } get length() { return this.lastIdx - this.firstIdx + 1; } /** * Consumes elements from the beginning of the queue as long as the predicate returns true. * If no elements were consumed, `null` is returned. Has a runtime of O(result.length). */ takeWhile(predicate) { let startIdx = this.firstIdx; while (startIdx < this.items.length && predicate(this.items[startIdx])) { startIdx++; } const result = startIdx === this.firstIdx ? null : this.items.slice(this.firstIdx, startIdx); this.firstIdx = startIdx; return result; } peek() { if (this.length === 0) { return void 0; } return this.items[this.firstIdx]; } dequeue() { const result = this.items[this.firstIdx]; this.firstIdx++; return result; } takeCount(count) { const result = this.items.slice(this.firstIdx, this.firstIdx + count); this.firstIdx += count; return result; } } const _CallbackIterable = class _CallbackIterable { constructor(iterate) { this.iterate = iterate; } toArray() { const result = []; this.iterate((item) => { result.push(item); return true; }); return result; } filter(predicate) { return new _CallbackIterable((cb) => this.iterate((item) => predicate(item) ? cb(item) : true)); } map(mapFn) { return new _CallbackIterable((cb) => this.iterate((item) => cb(mapFn(item)))); } findLast(predicate) { let result; this.iterate((item) => { if (predicate(item)) { result = item; } return true; }); return result; } findLastMaxBy(comparator) { let result; let first2 = true; this.iterate((item) => { if (first2 || CompareResult.isGreaterThan(comparator(item, result))) { first2 = false; result = item; } return true; }); return result; } }; _CallbackIterable.empty = new _CallbackIterable((_callback) => { }); let CallbackIterable = _CallbackIterable; class Permutation { constructor(_indexMap) { this._indexMap = _indexMap; } /** * Returns a permutation that sorts the given array according to the given compare function. */ static createSortPermutation(arr, compareFn) { const sortIndices = Array.from(arr.keys()).sort((index1, index2) => compareFn(arr[index1], arr[index2])); return new Permutation(sortIndices); } /** * Returns a new array with the elements of the given array re-arranged according to this permutation. */ apply(arr) { return arr.map((_, index) => arr[this._indexMap[index]]); } /** * Returns a new permutation that undoes the re-arrangement of this permutation. */ inverse() { const inverseIndexMap = this._indexMap.slice(); for (let i = 0; i < this._indexMap.length; i++) { inverseIndexMap[this._indexMap[i]] = i; } return new Permutation(inverseIndexMap); } } function sum(array) { return array.reduce((acc, value) => acc + value, 0); } class ErrorHandler { constructor() { this.listeners = []; this.unexpectedErrorHandler = function(e) { setTimeout(() => { if (e.stack) { if (ErrorNoTelemetry.isErrorNoTelemetry(e)) { throw new ErrorNoTelemetry(e.message + "\n\n" + e.stack); } throw new Error(e.message + "\n\n" + e.stack); } throw e; }, 0); }; } emit(e) { this.listeners.forEach((listener) => { listener(e); }); } onUnexpectedError(e) { this.unexpectedErrorHandler(e); this.emit(e); } // For external errors, we don't want the listeners to be called onUnexpectedExternalError(e) { this.unexpectedErrorHandler(e); } } const errorHandler = new ErrorHandler(); function onBugIndicatingError(e) { errorHandler.onUnexpectedError(e); return void 0; } function onUnexpectedError(e) { if (!isCancellationError(e)) { errorHandler.onUnexpectedError(e); } return void 0; } function onUnexpectedExternalError(e) { if (!isCancellationError(e)) { errorHandler.onUnexpectedExternalError(e); } return void 0; } function transformErrorForSerialization(error) { if (error instanceof Error) { const { name, message, cause } = error; const stack = error.stacktrace || error.stack; return { $isError: true, name, message, stack, noTelemetry: ErrorNoTelemetry.isErrorNoTelemetry(error), cause: cause ? transformErrorForSerialization(cause) : void 0, code: error.code }; } return error; } const canceledName = "Canceled"; function isCancellationError(error) { if (error instanceof CancellationError) { return true; } return error instanceof Error && error.name === canceledName && error.message === canceledName; } class CancellationError extends Error { constructor() { super(canceledName); this.name = this.message; } } function canceled() { const error = new Error(canceledName); error.name = error.message; return error; } function illegalArgument(name) { if (name) { return new Error(`Illegal argument: ${name}`); } else { return new Error("Illegal argument"); } } function illegalState(name) { if (name) { return new Error(`Illegal state: ${name}`); } else { return new Error("Illegal state"); } } class NotSupportedError extends Error { constructor(message) { super("NotSupported"); if (message) { this.message = message; } } } class ErrorNoTelemetry extends Error { constructor(msg) { super(msg); this.name = "CodeExpectedError"; } static fromError(err) { if (err instanceof ErrorNoTelemetry) { return err; } const result = new ErrorNoTelemetry(); result.message = err.message; result.stack = err.stack; return result; } static isErrorNoTelemetry(err) { return err.name === "CodeExpectedError"; } } class BugIndicatingError extends Error { constructor(message) { super(message || "An unexpected bug occurred."); Object.setPrototypeOf(this, BugIndicatingError.prototype); } } function ok(value, message) { if (!value) { throw new Error(message ? `Assertion failed (${message})` : "Assertion Failed"); } } function assertNever(value, message = "Unreachable") { throw new Error(message); } function assert(condition, messageOrError = "unexpected state") { if (!condition) { const errorToThrow = typeof messageOrError === "string" ? new BugIndicatingError(`Assertion Failed: ${messageOrError}`) : messageOrError; throw errorToThrow; } } function softAssert(condition, message = "Soft Assertion Failed") { if (!condition) { onUnexpectedError(new BugIndicatingError(message)); } } function assertFn(condition) { if (!condition()) { debugger; condition(); onUnexpectedError(new BugIndicatingError("Assertion Failed")); } } function checkAdjacentItems(items, predicate) { let i = 0; while (i < items.length - 1) { const a = items[i]; const b = items[i + 1]; if (!predicate(a, b)) { return false; } i++; } return true; } function isString(str) { return typeof str === "string"; } function isArrayOf(value, check) { return Array.isArray(value) && value.every(check); } function isObject(obj) { return typeof obj === "object" && obj !== null && !Array.isArray(obj) && !(obj instanceof RegExp) && !(obj instanceof Date); } function isTypedArray(obj) { const TypedArray = Object.getPrototypeOf(Uint8Array); return typeof obj === "object" && obj instanceof TypedArray; } function isNumber(obj) { return typeof obj === "number" && !isNaN(obj); } function isIterable(obj) { return !!obj && typeof obj[Symbol.iterator] === "function"; } function isBoolean(obj) { return obj === true || obj === false; } function isUndefined(obj) { return typeof obj === "undefined"; } function isDefined(arg) { return !isUndefinedOrNull(arg); } function isUndefinedOrNull(obj) { return isUndefined(obj) || obj === null; } function assertType(condition, type) { if (!condition) { throw new Error(type ? `Unexpected type, expected '${type}'` : "Unexpected type"); } } function assertReturnsDefined(arg) { assert(arg !== null && arg !== void 0, "Argument is `undefined` or `null`."); return arg; } function isFunction(obj) { return typeof obj === "function"; } function validateConstraints(args, constraints) { const len = Math.min(args.length, constraints.length); for (let i = 0; i < len; i++) { validateConstraint(args[i], constraints[i]); } } function validateConstraint(arg, constraint) { if (isString(constraint)) { if (typeof arg !== constraint) { throw new Error(`argument does not match constraint: typeof ${constraint}`); } } else if (isFunction(constraint)) { try { if (arg instanceof constraint) { return; } } catch { } if (!isUndefinedOrNull(arg) && arg.constructor === constraint) { return; } if (constraint.length === 1 && constraint.call(void 0, arg) === true) { return; } throw new Error(`argument does not match one of these constraints: arg instanceof constraint, arg.constructor === constraint, nor constraint(arg) === true`); } } function upcast(x) { return x; } function deepClone(obj) { if (!obj || typeof obj !== "object") { return obj; } if (obj instanceof RegExp) { return obj; } const result = Array.isArray(obj) ? [] : {}; Object.entries(obj).forEach(([key, value]) => { result[key] = value && typeof value === "object" ? deepClone(value) : value; }); return result; } function deepFreeze(obj) { if (!obj || typeof obj !== "object") { return obj; } const stack = [obj]; while (stack.length > 0) { const obj2 = stack.shift(); Object.freeze(obj2); for (const key in obj2) { if (_hasOwnProperty.call(obj2, key)) { const prop = obj2[key]; if (typeof prop === "object" && !Object.isFrozen(prop) && !isTypedArray(prop)) { stack.push(prop); } } } } return obj; } const _hasOwnProperty = Object.prototype.hasOwnProperty; function cloneAndChange(obj, changer) { return _cloneAndChange(obj, changer, /* @__PURE__ */ new Set()); } function _cloneAndChange(obj, changer, seen) { if (isUndefinedOrNull(obj)) { return obj; } const changed = changer(obj); if (typeof changed !== "undefined") { return changed; } if (Array.isArray(obj)) { const r1 = []; for (const e of obj) { r1.push(_cloneAndChange(e, changer, seen)); } return r1; } if (isObject(obj)) { if (seen.has(obj)) { throw new Error("Cannot clone recursive data-structure"); } seen.add(obj); const r2 = {}; for (const i2 in obj) { if (_hasOwnProperty.call(obj, i2)) { r2[i2] = _cloneAndChange(obj[i2], changer, seen); } } seen.delete(obj); return r2; } return obj; } function mixin(destination, source, overwrite = true) { if (!isObject(destination)) { return source; } if (isObject(source)) { Object.keys(source).forEach((key) => { if (key in destination) { if (overwrite) { if (isObject(destination[key]) && isObject(source[key])) { mixin(destination[key], source[key], overwrite); } else { destination[key] = source[key]; } } } else { destination[key] = source[key]; } }); } return destination; } function equals$1(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; } if (Array.isArray(one) !== Array.isArray(other)) { return false; } let i; let key; if (Array.isArray(one)) { if (one.length !== other.length) { return false; } for (i = 0; i < one.length; i++) { if (!equals$1(one[i], other[i])) { return false; } } } else { const oneKeys = []; for (key in one) { oneKeys.push(key); } oneKeys.sort(); const otherKeys = []; for (key in other) { otherKeys.push(key); } otherKeys.sort(); if (!equals$1(oneKeys, otherKeys)) { return false; } for (i = 0; i < oneKeys.length; i++) { if (!equals$1(one[oneKeys[i]], other[oneKeys[i]])) { return false; } } } return true; } function getNLSMessages() { return globalThis._VSCODE_NLS_MESSAGES; } function getNLSLanguage() { return globalThis._VSCODE_NLS_LANGUAGE; } const isPseudo = getNLSLanguage() === "pseudo" || typeof document !== "undefined" && document.location && typeof document.location.hash === "string" && document.location.hash.indexOf("pseudo=true") >= 0; function _format$1(message, args) { let result; if (args.length === 0) { result = message; } else { result = message.replace(/\{(\d+)\}/g, (match, rest) => { const index = rest[0]; const arg = args[index]; let result2 = match; if (typeof arg === "string") { result2 = arg; } else if (typeof arg === "number" || typeof arg === "boolean" || arg === void 0 || arg === null) { result2 = String(arg); } return result2; }); } if (isPseudo) { result = "[" + result.replace(/[aouei]/g, "$&$&") + "]"; } return result; } function localize(data, message, ...args) { if (typeof data === "number") { return _format$1(lookupMessage(data, message), args); } return _format$1(message, args); } function lookupMessage(index, fallback) { const message = getNLSMessages()?.[index]; if (typeof message !== "string") { if (typeof fallback === "string") { return fallback; } throw new Error(`!!! NLS MISSING: ${index} !!!`); } return message; } function localize2(data, originalMessage, ...args) { let message; if (typeof data === "number") { message = lookupMessage(data, originalMessage); } else { message = originalMessage; } const value = _format$1(message, args); return { value, original: originalMessage === message ? value : _format$1(originalMessage, args) }; } const LANGUAGE_DEFAULT = "en"; let _isWindows = false; let _isMacintosh = false; let _isLinux = false; let _isNative = false; let _isWeb = false; let _isIOS = false; let _isMobile = false; let _locale = void 0; let _language = LANGUAGE_DEFAULT; let _platformLocale = LANGUAGE_DEFAULT; let _translationsConfigFile = void 0; let _userAgent = void 0; const $globalThis = globalThis; let nodeProcess = void 0; if (typeof $globalThis.vscode !== "undefined" && typeof $globalThis.vscode.process !== "undefined") { nodeProcess = $globalThis.vscode.process; } else if (typeof process !== "undefined" && typeof process?.versions?.node === "string") { nodeProcess = process; } const isElectronProcess = typeof nodeProcess?.versions?.electron === "string"; const isElectronRenderer = isElectronProcess && nodeProcess?.type === "renderer"; if (typeof nodeProcess === "object") { _isWindows = nodeProcess.platform === "win32"; _isMacintosh = nodeProcess.platform === "darwin"; _isLinux = nodeProcess.platform === "linux"; _isLinux && !!nodeProcess.env["SNAP"] && !!nodeProcess.env["SNAP_REVISION"]; !!nodeProcess.env["CI"] || !!nodeProcess.env["BUILD_ARTIFACTSTAGINGDIRECTORY"] || !!nodeProcess.env["GITHUB_WORKSPACE"]; _locale = LANGUAGE_DEFAULT; _language = LANGUAGE_DEFAULT; const rawNlsConfig = nodeProcess.env["VSCODE_NLS_CONFIG"]; if (rawNlsConfig) { try { const nlsConfig = JSON.parse(rawNlsConfig); _locale = nlsConfig.userLocale; _platformLocale = nlsConfig.osLocale; _language = nlsConfig.resolvedLanguage || LANGUAGE_DEFAULT; _translationsConfigFile = nlsConfig.languagePack?.translationsConfigFile; } catch (e) { } } _isNative = true; } else if (typeof navigator === "object" && !isElectronRenderer) { _userAgent = navigator.userAgent; _isWindows = _userAgent.indexOf("Windows") >= 0; _isMacintosh = _userAgent.indexOf("Macintosh") >= 0; _isIOS = (_userAgent.indexOf("Macintosh") >= 0 || _userAgent.indexOf("iPad") >= 0 || _userAgent.indexOf("iPhone") >= 0) && !!navigator.maxTouchPoints && navigator.maxTouchPoints > 0; _isLinux = _userAgent.indexOf("Linux") >= 0; _isMobile = _userAgent?.indexOf("Mobi") >= 0; _isWeb = true; _language = getNLSLanguage() || LANGUAGE_DEFAULT; _locale = navigator.language.toLowerCase(); _platformLocale = _locale; } else { console.error("Unable to resolve platform."); } let _platform = 0; if (_isMacintosh) { _platform = 1; } else if (_isWindows) { _platform = 3; } else if (_isLinux) { _platform = 2; } const isWindows = _isWindows; const isMacintosh = _isMacintosh; const isLinux = _isLinux; const isNative = _isNative; const isWeb = _isWeb; const isWebWorker = _isWeb && typeof $globalThis.importScripts === "function"; const webWorkerOrigin = isWebWorker ? $globalThis.origin : void 0; const isIOS = _isIOS; const isMobile = _isMobile; const platform$1 = _platform; const userAgent = _userAgent; const language = _language; const setTimeout0IsFaster = typeof $globalThis.postMessage === "function" && !$globalThis.importScripts; const setTimeout0 = (() => { if (setTimeout0IsFaster) { const pending = []; $globalThis.addEventListener("message", (e) => { if (e.data && e.data.vscodeScheduleAsyncWork) { for (let i = 0, len = pending.length; i < len; i++) { const candidate = pending[i]; if (candidate.id === e.data.vscodeScheduleAsyncWork) { pending.splice(i, 1); candidate.callback(); return; } } } }); let lastId = 0; return (callback) => { const myId = ++lastId; pending.push({ id: myId, callback }); $globalThis.postMessage({ vscodeScheduleAsyncWork: myId }, "*"); }; } return (callback) => setTimeout(callback); })(); const OS = _isMacintosh || _isIOS ? 2 : _isWindows ? 1 : 3; let _isLittleEndian = true; let _isLittleEndianComputed = false; function isLittleEndian() { if (!_isLittleEndianComputed) { _isLittleEndianComputed = true; const test = new Uint8Array(2); test[0] = 1; test[1] = 2; const view = new Uint16Array(test.buffer); _isLittleEndian = view[0] === (2 << 8) + 1; } return _isLittleEndian; } const isChrome = !!(userAgent && userAgent.indexOf("Chrome") >= 0); const isFirefox = !!(userAgent && userAgent.indexOf("Firefox") >= 0); const isSafari = !!(!isChrome && (userAgent && userAgent.indexOf("Safari") >= 0)); const isEdge = !!(userAgent && userAgent.indexOf("Edg/") >= 0); const isAndroid = !!(userAgent && userAgent.indexOf("Android") >= 0); function createSingleCallFunction(fn, fnDidRunCallback) { const _this = this; let didCall = false; let result; return function() { if (didCall) { return result; } didCall = true; { result = fn.apply(_this, arguments); } return result; }; } exports.Iterable = void 0; (function(Iterable) { function is(thing) { return !!thing && typeof thing === "object" && typeof thing[Symbol.iterator] === "function"; } Iterable.is = is; const _empty2 = Object.freeze([]); function empty() { return _empty2; } Iterable.empty = empty; function* single(element) { yield element; } Iterable.single = single; function wrap(iterableOrElement) { if (is(iterableOrElement)) { return iterableOrElement; } else { return single(iterableOrElement); } } Iterable.wrap = wrap; function from(iterable) { return iterable ?? _empty2; } Iterable.from = from; function* reverse(array) { for (let i = array.length - 1; i >= 0; i--) { yield array[i]; } } Iterable.reverse = reverse; function isEmpty(iterable) { return !iterable || iterable[Symbol.iterator]().next().done === true; } Iterable.isEmpty = isEmpty; function first2(iterable) { return iterable[Symbol.iterator]().next().value; } Iterable.first = first2; function some(iterable, predicate) { let i = 0; for (const element of iterable) { if (predicate(element, i++)) { return true; } } return false; } Iterable.some = some; function every(iterable, predicate) { let i = 0; for (const element of iterable) { if (!predicate(element, i++)) { return false; } } return true; } Iterable.every = every; function find(iterable, predicate) { for (const element of iterable) { if (predicate(element)) { return element; } } return void 0; } Iterable.find = find; function* filter(iterable, predicate) { for (const element of iterable) { if (predicate(element)) { yield element; } } } Iterable.filter = filter; function* map(iterable, fn) { let index = 0; for (const element of iterable) { yield fn(element, index++); } } Iterable.map = map; function* flatMap(iterable, fn) { let index = 0; for (const element of iterable) { yield* fn(element, index++); } } Iterable.flatMap = flatMap; function* concat(...iterables) { for (const item of iterables) { if (isIterable(item)) { yield* item; } else { yield item; } } } Iterable.concat = concat; function reduce(iterable, reducer, initialValue) { let value = initialValue; for (const element of iterable) { value = reducer(value, element); } return value; } Iterable.reduce = reduce; function length(iterable) { let count = 0; for (const _ of iterable) { count++; } return count; } Iterable.length = length; function* slice(arr, from2, to = arr.length) { if (from2 < -arr.length) { from2 = 0; } if (from2 < 0) { from2 += arr.length; } if (to < 0) { to += arr.length; } else if (to > arr.length) { to = arr.length; } for (; from2 < to; from2++) { yield arr[from2]; } } Iterable.slice = slice; function consume(iterable, atMost = Number.POSITIVE_INFINITY) { const consumed = []; if (atMost === 0) { return [consumed, iterable]; } const iterator = iterable[Symbol.iterator](); for (let i = 0; i < atMost; i++) { const next = iterator.next(); if (next.done) { return [consumed, Iterable.empty()]; } consumed.push(next.value); } return [consumed, { [Symbol.iterator]() { return iterator; } }]; } Iterable.consume = consume; async function asyncToArray(iterable) { const result = []; for await (const item of iterable) { result.push(item); } return result; } Iterable.asyncToArray = asyncToArray; async function asyncToArrayFlat(iterable) { let result = []; for await (const item of iterable) { result = result.concat(item); } return result; } Iterable.asyncToArrayFlat = asyncToArrayFlat; })(exports.Iterable || (exports.Iterable = {})); function setParentOfDisposable(child, parent) { } function markAsSingleton(singleton) { return singleton; } function isDisposable(thing) { return typeof thing === "object" && thing !== null && typeof thing.dispose === "function" && thing.dispose.length === 0; } function dispose(arg) { if (exports.Iterable.is(arg)) { const errors = []; for (const d of arg) { if (d) { try { d.dispose(); } catch (e) { errors.push(e); } } } if (errors.length === 1) { throw errors[0]; } else if (errors.length > 1) { throw new AggregateError(errors, "Encountered errors while disposing of store"); } return Array.isArray(arg) ? [] : arg; } else if (arg) { arg.dispose(); return arg; } } function combinedDisposable(...disposables) { const parent = toDisposable(() => dispose(disposables)); return parent; } class FunctionDisposable { constructor(fn) { this._isDisposed = false; this._fn = fn; } dispose() { if (this._isDisposed) { return; } if (!this._fn) { throw new Error(`Unbound disposable context: Need to use an arrow function to preserve the value of this`); } this._isDisposed = true; this._fn(); } } function toDisposable(fn) { return new FunctionDisposable(fn); } const _DisposableStore = class _DisposableStore { constructor() { this._toDispose = /* @__PURE__ */ new Set(); this._isDisposed = false; } /** * Dispose of all registered disposables and mark this object as disposed. * * Any future disposables added to this object will be disposed of on `add`. */ dispose() { if (this._isDisposed) { return; } this._isDisposed = true; this.clear(); } /** * @return `true` if this object has been disposed of. */ get isDisposed() { return this._isDisposed; } /** * Dispose of all registered disposables but do not mark this object as disposed. */ clear() { if (this._toDispose.size === 0) { return; } try { dispose(this._toDispose); } finally { this._toDispose.clear(); } } /** * Add a new {@link IDisposable disposable} to the collection. */ add(o) { if (!o || o === Disposable.None) { return o; } if (o === this) { throw new Error("Cannot register a disposable on itself!"); } if (this._isDisposed) { if (!_DisposableStore.DISABLE_DISPOSED_WARNING) { console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack); } } else { this._toDispose.add(o); } return o; } /** * Deletes a disposable from store and disposes of it. This will not throw or warn and proceed to dispose the * disposable even when the disposable is not part in the store. */ delete(o) { if (!o) { return; } if (o === this) { throw new Error("Cannot dispose a disposable on itself!"); } this._toDispose.delete(o); o.dispose(); } }; _DisposableStore.DISABLE_DISPOSED_WARNING = false; let DisposableStore = _DisposableStore; const _Disposable = class _Disposable { constructor() { this._store = new DisposableStore(); setParentOfDisposable(this._store); } dispose() { this._store.dispose(); } /** * Adds `o` to the collection of disposables managed by this object. */ _register(o) { if (o === this) { throw new Error("Cannot register a disposable on itself!"); } return this._store.add(o); } }; _Disposable.None = Object.freeze({ dispose() { } }); let Disposable = _Disposable; class MutableDisposable { constructor() { this._isDisposed = false; } /** * Get the currently held disposable value, or `undefined` if this MutableDisposable has been disposed */ get value() { return this._isDisposed ? void 0 : this._value; } /** * Set a new disposable value. * * Behaviour: * - If the MutableDisposable has been disposed, the setter is a no-op. * - If the new value is strictly equal to the current value, the setter is a no-op. * - Otherwise the previous value (if any) is disposed and the new value is stored. * * Related helpers: * - clear() resets the value to `undefined` (and disposes the previous value). * - clearAndLeak() returns the old value without disposing it and removes its parent. */ set value(value) { if (this._isDisposed || value === this._value) { return; } this._value?.dispose(); this._value = value; } /** * Resets the stored value and disposed of the previously stored value. */ clear() { this.value = void 0; } dispose() { this._isDisposed = true; this._value?.dispose(); this._value = void 0; } } class RefCountedDisposable { constructor(_disposable) { this._disposable = _disposable; this._counter = 1; } acquire() { this._counter++; return this; } release() { if (--this._counter === 0) { this._disposable.dispose(); } return this; } } class ImmortalReference { constructor(object) { this.object = object; } dispose() { } } class DisposableMap { constructor(store = /* @__PURE__ */ new Map()) { this._isDisposed = false; this._store = store; } /** * Disposes of all stored values and mark this object as disposed. * * Trying to use this object after it has been disposed of is an error. */ dispose() { this._isDisposed = true; this.clearAndDisposeAll(); } /** * Disposes of all stored values and clear the map, but DO NOT mark this object as disposed. */ clearAndDisposeAll() { if (!this._store.size) { return; } try { dispose(this._store.values()); } finally { this._store.clear(); } } get(key) { return this._store.get(key); } set(key, value, skipDisposeOnOverwrite = false) { if (this._isDisposed) { console.warn(new Error("Trying to add a disposable to a DisposableMap that has already been disposed of. The added object will be leaked!").stack); } if (!skipDisposeOnOverwrite) { this._store.get(key)?.dispose(); } this._store.set(key, value); } /** * Delete the value stored for `key` from this map and also dispose of it. */ deleteAndDispose(key) { this._store.get(key)?.dispose(); this._store.delete(key); } keys() { return this._store.keys(); } values() { return this._store.values(); } [Symbol.iterator]() { return this._store[Symbol.iterator](); } } const _Node = class _Node { constructor(element) { this.element = element; this.next = _Node.Undefined; this.prev = _Node.Undefined; } }; _Node.Undefined = new _Node(void 0); let Node = _Node; class LinkedList { constructor() { this._first = Node.Undefined; this._last = Node.Undefined; this._size = 0; } get size() { return this._size; } isEmpty() { return this._first === Node.Undefined; } clear() { let node = this._first; while (node !== Node.Undefined) { const next = node.next; node.prev = Node.Undefined; node.next = Node.Undefined; node = next; } this._first = Node.Undefined; this._last = Node.Undefined; this._size = 0; } unshift(element) { return this._insert(element, false); } push(element) { return this._insert(element, true); } _insert(element, atTheEnd) { const newNode = new Node(element); if (this._first === Node.Undefined) { this._first = newNode; this._last = newNode; } else if (atTheEnd) { const oldLast = this._last; this._last = newNode; newNode.prev = oldLast; oldLast.next = newNode; } else { const oldFirst = this._first; this._first = newNode; newNode.next = oldFirst; oldFirst.prev = newNode; } this._size += 1; let didRemove = false; return () => { if (!didRemove) { didRemove = true; this._remove(newNode); } }; } shift() { if (this._first === Node.Undefined) { return void 0; } else { const res = this._first.element; this._remove(this._first); return res; } } pop() { if (this._last === Node.Undefined) { return void 0; } else { const res = this._last.element; this._remove(this._last); return res; } } _remove(node) { if (node.prev !== Node.Undefined && node.next !== Node.Undefined) { const anchor = node.prev; anchor.next = node.next; node.next.prev = anchor; } else if (node.prev === Node.Undefined && node.next === Node.Undefined) { this._first = Node.Undefined; this._last = Node.Undefined; } else if (node.next === Node.Undefined) { this._last = this._last.prev; this._last.next = Node.Undefined; } else if (node.prev === Node.Undefined) { this._first = this._first.next; this._first.prev = Node.Undefined; } this._size -= 1; } *[Symbol.iterator]() { let node = this._first; while (node !== Node.Undefined) { yield node.element; node = node.next; } } } let safeProcess; const vscodeGlobal = globalThis.vscode; if (typeof vscodeGlobal !== "undefined" && typeof vscodeGlobal.process !== "undefined") { const sandboxProcess = vscodeGlobal.process; safeProcess = { get platform() { return sandboxProcess.platform; }, get arch() { return sandboxProcess.arch; }, get env() { return sandboxProcess.env; }, cwd() { return sandboxProcess.cwd(); } }; } else if (typeof process !== "undefined" && typeof process?.versions?.node === "string") { safeProcess = { get platform() { return process.platform; }, get arch() { return process.arch; }, get env() { return process.env; }, cwd() { return process.env["VSCODE_CWD"] || process.cwd(); } }; } else { safeProcess = { // Supported get platform() { return isWindows ? "win32" : isMacintosh ? "darwin" : "linux"; }, get arch() { return void 0; }, // Unsupported get env() { return {}; }, cwd() { return "/"; } }; } const cwd = safeProcess.cwd; const env = safeProcess.env; const platform = safeProcess.platform; const performanceNow = globalThis.performance.now.bind(globalThis.performance); class StopWatch { static create(highResolution) { return new StopWatch(highResolution); } constructor(highResolution) { this._now = highResolution === false ? Date.now : performanceNow; this._startTime = this._now(); this._stopTime = -1; } stop() { this._stopTime = this._now(); } reset() { this._startTime = this._now(); this._stopTime = -1; } elapsed() { if (this._stopTime !== -1) { return this._stopTime - this._startTime; } return this._now() - this._startTime; } } const _bufferLeakWarnCountThreshold = 100; const _bufferLeakWarnTimeThreshold = 6e4; function _isBufferLeakWarningEnabled() { return !!env["VSCODE_DEV"]; } exports.Event = void 0; (function(Event) { Event.None = () => Disposable.None; function defer(event, flushOnListenerRemove, disposable) { return debounce(event, () => void 0, 0, void 0, flushOnListenerRemove ?? true, void 0, disposable); } Event.defer = defer; function once(event) { return (listener, thisArgs = null, disposables) => { let didFire = false; let result = void 0; result = event((e) => { if (didFire) { return; } else if (result) { result.dispose(); } else { didFire = true; } return listener.call(thisArgs, e); }, null, disposables); if (didFire) { result.dispose(); } return result; }; } Event.once = once; function onceIf(event, condition) { return Event.once(Event.filter(event, condition)); } Event.onceIf = onceIf; function map(event, map2, disposable) { return snapshot((listener, thisArgs = null, disposables) => event((i) => listener.call(thisArgs, map2(i)), null, disposables), disposable); } Event.map = map; function forEach(event, each, disposable) { return snapshot((listener, thisArgs = null, disposables) => event((i) => { each(i); listener.call(thisArgs, i); }, null, disposables), disposable); } Event.forEach = forEach; function filter(event, filter2, disposable) { return snapshot((listener, thisArgs = null, disposables) => event((e) => filter2(e) && listener.call(thisArgs, e), null, disposables), disposable); } Event.filter = filter; function signal(event) { return event; } Event.signal = signal; function any(...events) { return (listener, thisArgs = null, disposables) => { const disposable = combinedDisposable(...events.map((event) => event((e) => listener.call(thisArgs, e)))); return addAndReturnDisposable(disposable, disposables); }; } Event.any = any; function reduce(event, merge, initial, disposable) { let output = initial; return map(event, (e) => { output = merge(output, e); return output; }, disposable); } Event.reduce = reduce; function snapshot(event, disposable) { let listener; const options = { onWillAddFirstListener() { listener = event(emitter.fire, emitter); }, onDidRemoveLastListener() { listener?.dispose(); } }; const emitter = new Emitter(options); disposable?.add(emitter); return emitter.event; } function addAndReturnDisposable(d, store) { if (store instanceof Array) { store.push(d); } else if (store) { store.add(d); } return d; } function debounce(event, merge, delay = 100, leading = false, flushOnListenerRemove = false, leakWarningThreshold, disposable) { let subscription; let output = void 0; let handle = void 0; let numDebouncedCalls = 0; let doFire; const options = { leakWarningThreshold, onWillAddFirstListener() { subscription = event((cur) => { numDebouncedCalls++; output = merge(output, cur); if (leading && !handle) { emitter.fire(output); output = void 0; } doFire = () => { const _output = output; output = void 0; handle = void 0; if (!leading || numDebouncedCalls > 1) { emitter.fire(_output); } numDebouncedCalls = 0; }; if (typeof delay === "number") { if (handle) { clearTimeout(handle); } handle = setTimeout(doFire, delay); } else { if (handle === void 0) { handle = null; queueMicrotask(doFire); } } }); }, onWillRemoveListener() { if (flushOnListenerRemove && numDebouncedCalls > 0) { doFire?.(); } }, onDidRemoveLastListener() { doFire = void 0; subscription.dispose(); }