UNPKG

mermaid

Version:

Markdown-ish syntax for generating flowcharts, mindmaps, sequence diagrams, class diagrams, gantt charts, git graphs and more.

1,588 lines (1,576 loc) 714 kB
import { assign_default, clone_default, compact_default, defaults_default, difference_default, dropRight_default, drop_default, every_default, filter_default, find_default, flatMap_default, flatten_default, forEach_default, groupBy_default, has_default, head_default, includes_default, indexOf_default, isRegExp_default, isString_default, isUndefined_default, keys_default, last_default, map_default, min_default, noop_default, pickBy_default, reduce_default, reject_default, some_default, uniqBy_default, uniq_default, values_default } from "./chunk-TGZYFRKZ.mjs"; import { isEmpty_default } from "./chunk-GRZAG2UZ.mjs"; import { identity_default, isArray_default, isFunction_default, isObject_default } from "./chunk-HD3LK5B5.mjs"; import { __commonJS, __export, __name, __reExport, __toESM } from "./chunk-DLQEHMXD.mjs"; // ../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/ral.js var require_ral = __commonJS({ "../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/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; } __name(RAL, "RAL"); (function(RAL2) { function install(ral) { if (ral === void 0) { throw new Error(`No runtime abstraction layer provided`); } _ral = ral; } __name(install, "install"); RAL2.install = install; })(RAL || (RAL = {})); exports.default = RAL; } }); // ../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/is.js var require_is = __commonJS({ "../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/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; } __name(boolean, "boolean"); exports.boolean = boolean; function string(value) { return typeof value === "string" || value instanceof String; } __name(string, "string"); exports.string = string; function number(value) { return typeof value === "number" || value instanceof Number; } __name(number, "number"); exports.number = number; function error(value) { return value instanceof Error; } __name(error, "error"); exports.error = error; function func(value) { return typeof value === "function"; } __name(func, "func"); exports.func = func; function array(value) { return Array.isArray(value); } __name(array, "array"); exports.array = array; function stringArray(value) { return array(value) && value.every((elem) => string(elem)); } __name(stringArray, "stringArray"); exports.stringArray = stringArray; } }); // ../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/events.js var require_events = __commonJS({ "../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/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 { static { __name(this, "CallbackList"); } 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: /* @__PURE__ */ __name(() => this.remove(callback, context), "dispose") }); } } 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 Emitter3 = class _Emitter { static { __name(this, "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: /* @__PURE__ */ __name(() => { 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); } }, "dispose") }; 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 = Emitter3; Emitter3._noop = function() { }; } }); // ../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/cancellation.js var require_cancellation = __commonJS({ "../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/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_events(); var CancellationToken11; (function(CancellationToken12) { CancellationToken12.None = Object.freeze({ isCancellationRequested: false, onCancellationRequested: events_1.Event.None }); CancellationToken12.Cancelled = Object.freeze({ isCancellationRequested: true, onCancellationRequested: events_1.Event.None }); function is(value) { const candidate = value; return candidate && (candidate === CancellationToken12.None || candidate === CancellationToken12.Cancelled || Is2.boolean(candidate.isCancellationRequested) && !!candidate.onCancellationRequested); } __name(is, "is"); CancellationToken12.is = is; })(CancellationToken11 || (exports.CancellationToken = CancellationToken11 = {})); 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 { static { __name(this, "MutableToken"); } 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 CancellationTokenSource3 = class { static { __name(this, "CancellationTokenSource"); } get token() { if (!this._token) { this._token = new MutableToken(); } return this._token; } cancel() { if (!this._token) { this._token = CancellationToken11.Cancelled; } else { this._token.cancel(); } } dispose() { if (!this._token) { this._token = CancellationToken11.None; } else if (this._token instanceof MutableToken) { this._token.dispose(); } } }; exports.CancellationTokenSource = CancellationTokenSource3; } }); // ../../node_modules/.pnpm/langium@3.3.1/node_modules/langium/lib/index.js var lib_exports = {}; __export(lib_exports, { AbstractAstReflection: () => AbstractAstReflection, AbstractCstNode: () => AbstractCstNode, AbstractLangiumParser: () => AbstractLangiumParser, AbstractParserErrorMessageProvider: () => AbstractParserErrorMessageProvider, AbstractThreadedAsyncParser: () => AbstractThreadedAsyncParser, AstUtils: () => ast_utils_exports, BiMap: () => BiMap, Cancellation: () => cancellation_exports, CompositeCstNodeImpl: () => CompositeCstNodeImpl, ContextCache: () => ContextCache, CstNodeBuilder: () => CstNodeBuilder, CstUtils: () => cst_utils_exports, DEFAULT_TOKENIZE_OPTIONS: () => DEFAULT_TOKENIZE_OPTIONS, DONE_RESULT: () => DONE_RESULT, DatatypeSymbol: () => DatatypeSymbol, DefaultAstNodeDescriptionProvider: () => DefaultAstNodeDescriptionProvider, DefaultAstNodeLocator: () => DefaultAstNodeLocator, DefaultAsyncParser: () => DefaultAsyncParser, DefaultCommentProvider: () => DefaultCommentProvider, DefaultConfigurationProvider: () => DefaultConfigurationProvider, DefaultDocumentBuilder: () => DefaultDocumentBuilder, DefaultDocumentValidator: () => DefaultDocumentValidator, DefaultHydrator: () => DefaultHydrator, DefaultIndexManager: () => DefaultIndexManager, DefaultJsonSerializer: () => DefaultJsonSerializer, DefaultLangiumDocumentFactory: () => DefaultLangiumDocumentFactory, DefaultLangiumDocuments: () => DefaultLangiumDocuments, DefaultLexer: () => DefaultLexer, DefaultLexerErrorMessageProvider: () => DefaultLexerErrorMessageProvider, DefaultLinker: () => DefaultLinker, DefaultNameProvider: () => DefaultNameProvider, DefaultReferenceDescriptionProvider: () => DefaultReferenceDescriptionProvider, DefaultReferences: () => DefaultReferences, DefaultScopeComputation: () => DefaultScopeComputation, DefaultScopeProvider: () => DefaultScopeProvider, DefaultServiceRegistry: () => DefaultServiceRegistry, DefaultTokenBuilder: () => DefaultTokenBuilder, DefaultValueConverter: () => DefaultValueConverter, DefaultWorkspaceLock: () => DefaultWorkspaceLock, DefaultWorkspaceManager: () => DefaultWorkspaceManager, Deferred: () => Deferred, Disposable: () => Disposable, DisposableCache: () => DisposableCache, DocumentCache: () => DocumentCache, DocumentState: () => DocumentState, DocumentValidator: () => DocumentValidator, EMPTY_SCOPE: () => EMPTY_SCOPE, EMPTY_STREAM: () => EMPTY_STREAM, EmptyFileSystem: () => EmptyFileSystem, EmptyFileSystemProvider: () => EmptyFileSystemProvider, ErrorWithLocation: () => ErrorWithLocation, GrammarAST: () => ast_exports, GrammarUtils: () => grammar_utils_exports, IndentationAwareLexer: () => IndentationAwareLexer, IndentationAwareTokenBuilder: () => IndentationAwareTokenBuilder, JSDocDocumentationProvider: () => JSDocDocumentationProvider, LangiumCompletionParser: () => LangiumCompletionParser, LangiumParser: () => LangiumParser, LangiumParserErrorMessageProvider: () => LangiumParserErrorMessageProvider, LeafCstNodeImpl: () => LeafCstNodeImpl, LexingMode: () => LexingMode, MapScope: () => MapScope, Module: () => Module, MultiMap: () => MultiMap, OperationCancelled: () => OperationCancelled, ParserWorker: () => ParserWorker, Reduction: () => Reduction, RegExpUtils: () => regexp_utils_exports, RootCstNodeImpl: () => RootCstNodeImpl, SimpleCache: () => SimpleCache, StreamImpl: () => StreamImpl, StreamScope: () => StreamScope, TextDocument: () => TextDocument2, TreeStreamImpl: () => TreeStreamImpl, URI: () => URI2, UriUtils: () => UriUtils, ValidationCategory: () => ValidationCategory, ValidationRegistry: () => ValidationRegistry, ValueConverter: () => ValueConverter, WorkspaceCache: () => WorkspaceCache, assertUnreachable: () => assertUnreachable, createCompletionParser: () => createCompletionParser, createDefaultCoreModule: () => createDefaultCoreModule, createDefaultSharedCoreModule: () => createDefaultSharedCoreModule, createGrammarConfig: () => createGrammarConfig, createLangiumParser: () => createLangiumParser, createParser: () => createParser, delayNextTick: () => delayNextTick, diagnosticData: () => diagnosticData, eagerLoad: () => eagerLoad, getDiagnosticRange: () => getDiagnosticRange, indentationBuilderDefaultOptions: () => indentationBuilderDefaultOptions, inject: () => inject, interruptAndCheck: () => interruptAndCheck, isAstNode: () => isAstNode, isAstNodeDescription: () => isAstNodeDescription, isAstNodeWithComment: () => isAstNodeWithComment, isCompositeCstNode: () => isCompositeCstNode, isIMultiModeLexerDefinition: () => isIMultiModeLexerDefinition, isJSDoc: () => isJSDoc, isLeafCstNode: () => isLeafCstNode, isLinkingError: () => isLinkingError, isNamed: () => isNamed, isOperationCancelled: () => isOperationCancelled, isReference: () => isReference, isRootCstNode: () => isRootCstNode, isTokenTypeArray: () => isTokenTypeArray, isTokenTypeDictionary: () => isTokenTypeDictionary, loadGrammarFromJson: () => loadGrammarFromJson, parseJSDoc: () => parseJSDoc, prepareLangiumParser: () => prepareLangiumParser, setInterruptionPeriod: () => setInterruptionPeriod, startCancelableOperation: () => startCancelableOperation, stream: () => stream, toDiagnosticData: () => toDiagnosticData, toDiagnosticSeverity: () => toDiagnosticSeverity }); // ../../node_modules/.pnpm/langium@3.3.1/node_modules/langium/lib/utils/cst-utils.js var cst_utils_exports = {}; __export(cst_utils_exports, { DefaultNameRegexp: () => DefaultNameRegexp, RangeComparison: () => RangeComparison, compareRange: () => compareRange, findCommentNode: () => findCommentNode, findDeclarationNodeAtOffset: () => findDeclarationNodeAtOffset, findLeafNodeAtOffset: () => findLeafNodeAtOffset, findLeafNodeBeforeOffset: () => findLeafNodeBeforeOffset, flattenCst: () => flattenCst, getInteriorNodes: () => getInteriorNodes, getNextNode: () => getNextNode, getPreviousNode: () => getPreviousNode, getStartlineNode: () => getStartlineNode, inRange: () => inRange, isChildNode: () => isChildNode, isCommentNode: () => isCommentNode, streamCst: () => streamCst, toDocumentSegment: () => toDocumentSegment, tokenToRange: () => tokenToRange }); // ../../node_modules/.pnpm/langium@3.3.1/node_modules/langium/lib/syntax-tree.js function isAstNode(obj) { return typeof obj === "object" && obj !== null && typeof obj.$type === "string"; } __name(isAstNode, "isAstNode"); function isReference(obj) { return typeof obj === "object" && obj !== null && typeof obj.$refText === "string"; } __name(isReference, "isReference"); function isAstNodeDescription(obj) { return typeof obj === "object" && obj !== null && typeof obj.name === "string" && typeof obj.type === "string" && typeof obj.path === "string"; } __name(isAstNodeDescription, "isAstNodeDescription"); function isLinkingError(obj) { return typeof obj === "object" && obj !== null && isAstNode(obj.container) && isReference(obj.reference) && typeof obj.message === "string"; } __name(isLinkingError, "isLinkingError"); var AbstractAstReflection = class { static { __name(this, "AbstractAstReflection"); } constructor() { this.subtypes = {}; this.allSubtypes = {}; } isInstance(node, type) { return isAstNode(node) && this.isSubtype(node.$type, type); } isSubtype(subtype, supertype) { if (subtype === supertype) { return true; } let nested = this.subtypes[subtype]; if (!nested) { nested = this.subtypes[subtype] = {}; } const existing = nested[supertype]; if (existing !== void 0) { return existing; } else { const result = this.computeIsSubtype(subtype, supertype); nested[supertype] = result; return result; } } getAllSubTypes(type) { const existing = this.allSubtypes[type]; if (existing) { return existing; } else { const allTypes = this.getAllTypes(); const types = []; for (const possibleSubType of allTypes) { if (this.isSubtype(possibleSubType, type)) { types.push(possibleSubType); } } this.allSubtypes[type] = types; return types; } } }; function isCompositeCstNode(node) { return typeof node === "object" && node !== null && Array.isArray(node.content); } __name(isCompositeCstNode, "isCompositeCstNode"); function isLeafCstNode(node) { return typeof node === "object" && node !== null && typeof node.tokenType === "object"; } __name(isLeafCstNode, "isLeafCstNode"); function isRootCstNode(node) { return isCompositeCstNode(node) && typeof node.fullText === "string"; } __name(isRootCstNode, "isRootCstNode"); // ../../node_modules/.pnpm/langium@3.3.1/node_modules/langium/lib/utils/stream.js var StreamImpl = class _StreamImpl { static { __name(this, "StreamImpl"); } constructor(startFn, nextFn) { this.startFn = startFn; this.nextFn = nextFn; } iterator() { const iterator = { state: this.startFn(), next: /* @__PURE__ */ __name(() => this.nextFn(iterator.state), "next"), [Symbol.iterator]: () => iterator }; return iterator; } [Symbol.iterator]() { return this.iterator(); } isEmpty() { const iterator = this.iterator(); return Boolean(iterator.next().done); } count() { const iterator = this.iterator(); let count = 0; let next = iterator.next(); while (!next.done) { count++; next = iterator.next(); } return count; } toArray() { const result = []; const iterator = this.iterator(); let next; do { next = iterator.next(); if (next.value !== void 0) { result.push(next.value); } } while (!next.done); return result; } toSet() { return new Set(this); } toMap(keyFn, valueFn) { const entryStream = this.map((element) => [ keyFn ? keyFn(element) : element, valueFn ? valueFn(element) : element ]); return new Map(entryStream); } toString() { return this.join(); } concat(other) { return new _StreamImpl(() => ({ first: this.startFn(), firstDone: false, iterator: other[Symbol.iterator]() }), (state) => { let result; if (!state.firstDone) { do { result = this.nextFn(state.first); if (!result.done) { return result; } } while (!result.done); state.firstDone = true; } do { result = state.iterator.next(); if (!result.done) { return result; } } while (!result.done); return DONE_RESULT; }); } join(separator = ",") { const iterator = this.iterator(); let value = ""; let result; let addSeparator = false; do { result = iterator.next(); if (!result.done) { if (addSeparator) { value += separator; } value += toString(result.value); } addSeparator = true; } while (!result.done); return value; } indexOf(searchElement, fromIndex = 0) { const iterator = this.iterator(); let index = 0; let next = iterator.next(); while (!next.done) { if (index >= fromIndex && next.value === searchElement) { return index; } next = iterator.next(); index++; } return -1; } every(predicate) { const iterator = this.iterator(); let next = iterator.next(); while (!next.done) { if (!predicate(next.value)) { return false; } next = iterator.next(); } return true; } some(predicate) { const iterator = this.iterator(); let next = iterator.next(); while (!next.done) { if (predicate(next.value)) { return true; } next = iterator.next(); } return false; } forEach(callbackfn) { const iterator = this.iterator(); let index = 0; let next = iterator.next(); while (!next.done) { callbackfn(next.value, index); next = iterator.next(); index++; } } map(callbackfn) { return new _StreamImpl(this.startFn, (state) => { const { done, value } = this.nextFn(state); if (done) { return DONE_RESULT; } else { return { done: false, value: callbackfn(value) }; } }); } filter(predicate) { return new _StreamImpl(this.startFn, (state) => { let result; do { result = this.nextFn(state); if (!result.done && predicate(result.value)) { return result; } } while (!result.done); return DONE_RESULT; }); } nonNullable() { return this.filter((e) => e !== void 0 && e !== null); } reduce(callbackfn, initialValue) { const iterator = this.iterator(); let previousValue = initialValue; let next = iterator.next(); while (!next.done) { if (previousValue === void 0) { previousValue = next.value; } else { previousValue = callbackfn(previousValue, next.value); } next = iterator.next(); } return previousValue; } reduceRight(callbackfn, initialValue) { return this.recursiveReduce(this.iterator(), callbackfn, initialValue); } recursiveReduce(iterator, callbackfn, initialValue) { const next = iterator.next(); if (next.done) { return initialValue; } const previousValue = this.recursiveReduce(iterator, callbackfn, initialValue); if (previousValue === void 0) { return next.value; } return callbackfn(previousValue, next.value); } find(predicate) { const iterator = this.iterator(); let next = iterator.next(); while (!next.done) { if (predicate(next.value)) { return next.value; } next = iterator.next(); } return void 0; } findIndex(predicate) { const iterator = this.iterator(); let index = 0; let next = iterator.next(); while (!next.done) { if (predicate(next.value)) { return index; } next = iterator.next(); index++; } return -1; } includes(searchElement) { const iterator = this.iterator(); let next = iterator.next(); while (!next.done) { if (next.value === searchElement) { return true; } next = iterator.next(); } return false; } flatMap(callbackfn) { return new _StreamImpl(() => ({ this: this.startFn() }), (state) => { do { if (state.iterator) { const next = state.iterator.next(); if (next.done) { state.iterator = void 0; } else { return next; } } const { done, value } = this.nextFn(state.this); if (!done) { const mapped = callbackfn(value); if (isIterable(mapped)) { state.iterator = mapped[Symbol.iterator](); } else { return { done: false, value: mapped }; } } } while (state.iterator); return DONE_RESULT; }); } flat(depth) { if (depth === void 0) { depth = 1; } if (depth <= 0) { return this; } const stream2 = depth > 1 ? this.flat(depth - 1) : this; return new _StreamImpl(() => ({ this: stream2.startFn() }), (state) => { do { if (state.iterator) { const next = state.iterator.next(); if (next.done) { state.iterator = void 0; } else { return next; } } const { done, value } = stream2.nextFn(state.this); if (!done) { if (isIterable(value)) { state.iterator = value[Symbol.iterator](); } else { return { done: false, value }; } } } while (state.iterator); return DONE_RESULT; }); } head() { const iterator = this.iterator(); const result = iterator.next(); if (result.done) { return void 0; } return result.value; } tail(skipCount = 1) { return new _StreamImpl(() => { const state = this.startFn(); for (let i = 0; i < skipCount; i++) { const next = this.nextFn(state); if (next.done) { return state; } } return state; }, this.nextFn); } limit(maxSize) { return new _StreamImpl(() => ({ size: 0, state: this.startFn() }), (state) => { state.size++; if (state.size > maxSize) { return DONE_RESULT; } return this.nextFn(state.state); }); } distinct(by) { return new _StreamImpl(() => ({ set: /* @__PURE__ */ new Set(), internalState: this.startFn() }), (state) => { let result; do { result = this.nextFn(state.internalState); if (!result.done) { const value = by ? by(result.value) : result.value; if (!state.set.has(value)) { state.set.add(value); return result; } } } while (!result.done); return DONE_RESULT; }); } exclude(other, key) { const otherKeySet = /* @__PURE__ */ new Set(); for (const item of other) { const value = key ? key(item) : item; otherKeySet.add(value); } return this.filter((e) => { const ownKey = key ? key(e) : e; return !otherKeySet.has(ownKey); }); } }; function toString(item) { if (typeof item === "string") { return item; } if (typeof item === "undefined") { return "undefined"; } if (typeof item.toString === "function") { return item.toString(); } return Object.prototype.toString.call(item); } __name(toString, "toString"); function isIterable(obj) { return !!obj && typeof obj[Symbol.iterator] === "function"; } __name(isIterable, "isIterable"); var EMPTY_STREAM = new StreamImpl(() => void 0, () => DONE_RESULT); var DONE_RESULT = Object.freeze({ done: true, value: void 0 }); function stream(...collections) { if (collections.length === 1) { const collection = collections[0]; if (collection instanceof StreamImpl) { return collection; } if (isIterable(collection)) { return new StreamImpl(() => collection[Symbol.iterator](), (iterator) => iterator.next()); } if (typeof collection.length === "number") { return new StreamImpl(() => ({ index: 0 }), (state) => { if (state.index < collection.length) { return { done: false, value: collection[state.index++] }; } else { return DONE_RESULT; } }); } } if (collections.length > 1) { return new StreamImpl(() => ({ collIndex: 0, arrIndex: 0 }), (state) => { do { if (state.iterator) { const next = state.iterator.next(); if (!next.done) { return next; } state.iterator = void 0; } if (state.array) { if (state.arrIndex < state.array.length) { return { done: false, value: state.array[state.arrIndex++] }; } state.array = void 0; state.arrIndex = 0; } if (state.collIndex < collections.length) { const collection = collections[state.collIndex++]; if (isIterable(collection)) { state.iterator = collection[Symbol.iterator](); } else if (collection && typeof collection.length === "number") { state.array = collection; } } } while (state.iterator || state.array || state.collIndex < collections.length); return DONE_RESULT; }); } return EMPTY_STREAM; } __name(stream, "stream"); var TreeStreamImpl = class extends StreamImpl { static { __name(this, "TreeStreamImpl"); } constructor(root, children, options) { super(() => ({ iterators: (options === null || options === void 0 ? void 0 : options.includeRoot) ? [[root][Symbol.iterator]()] : [children(root)[Symbol.iterator]()], pruned: false }), (state) => { if (state.pruned) { state.iterators.pop(); state.pruned = false; } while (state.iterators.length > 0) { const iterator = state.iterators[state.iterators.length - 1]; const next = iterator.next(); if (next.done) { state.iterators.pop(); } else { state.iterators.push(children(next.value)[Symbol.iterator]()); return next; } } return DONE_RESULT; }); } iterator() { const iterator = { state: this.startFn(), next: /* @__PURE__ */ __name(() => this.nextFn(iterator.state), "next"), prune: /* @__PURE__ */ __name(() => { iterator.state.pruned = true; }, "prune"), [Symbol.iterator]: () => iterator }; return iterator; } }; var Reduction; (function(Reduction2) { function sum(stream2) { return stream2.reduce((a, b) => a + b, 0); } __name(sum, "sum"); Reduction2.sum = sum; function product(stream2) { return stream2.reduce((a, b) => a * b, 0); } __name(product, "product"); Reduction2.product = product; function min(stream2) { return stream2.reduce((a, b) => Math.min(a, b)); } __name(min, "min"); Reduction2.min = min; function max(stream2) { return stream2.reduce((a, b) => Math.max(a, b)); } __name(max, "max"); Reduction2.max = max; })(Reduction || (Reduction = {})); // ../../node_modules/.pnpm/langium@3.3.1/node_modules/langium/lib/utils/cst-utils.js function streamCst(node) { return new TreeStreamImpl(node, (element) => { if (isCompositeCstNode(element)) { return element.content; } else { return []; } }, { includeRoot: true }); } __name(streamCst, "streamCst"); function flattenCst(node) { return streamCst(node).filter(isLeafCstNode); } __name(flattenCst, "flattenCst"); function isChildNode(child, parent) { while (child.container) { child = child.container; if (child === parent) { return true; } } return false; } __name(isChildNode, "isChildNode"); function tokenToRange(token) { return { start: { character: token.startColumn - 1, line: token.startLine - 1 }, end: { character: token.endColumn, // endColumn uses the correct index line: token.endLine - 1 } }; } __name(tokenToRange, "tokenToRange"); function toDocumentSegment(node) { if (!node) { return void 0; } const { offset, end, range } = node; return { range, offset, end, length: end - offset }; } __name(toDocumentSegment, "toDocumentSegment"); var RangeComparison; (function(RangeComparison2) { RangeComparison2[RangeComparison2["Before"] = 0] = "Before"; RangeComparison2[RangeComparison2["After"] = 1] = "After"; RangeComparison2[RangeComparison2["OverlapFront"] = 2] = "OverlapFront"; RangeComparison2[RangeComparison2["OverlapBack"] = 3] = "OverlapBack"; RangeComparison2[RangeComparison2["Inside"] = 4] = "Inside"; RangeComparison2[RangeComparison2["Outside"] = 5] = "Outside"; })(RangeComparison || (RangeComparison = {})); function compareRange(range, to) { if (range.end.line < to.start.line || range.end.line === to.start.line && range.end.character <= to.start.character) { return RangeComparison.Before; } else if (range.start.line > to.end.line || range.start.line === to.end.line && range.start.character >= to.end.character) { return RangeComparison.After; } const startInside = range.start.line > to.start.line || range.start.line === to.start.line && range.start.character >= to.start.character; const endInside = range.end.line < to.end.line || range.end.line === to.end.line && range.end.character <= to.end.character; if (startInside && endInside) { return RangeComparison.Inside; } else if (startInside) { return RangeComparison.OverlapBack; } else if (endInside) { return RangeComparison.OverlapFront; } else { return RangeComparison.Outside; } } __name(compareRange, "compareRange"); function inRange(range, to) { const comparison = compareRange(range, to); return comparison > RangeComparison.After; } __name(inRange, "inRange"); var DefaultNameRegexp = /^[\w\p{L}]$/u; function findDeclarationNodeAtOffset(cstNode, offset, nameRegexp = DefaultNameRegexp) { if (cstNode) { if (offset > 0) { const localOffset = offset - cstNode.offset; const textAtOffset = cstNode.text.charAt(localOffset); if (!nameRegexp.test(textAtOffset)) { offset--; } } return findLeafNodeAtOffset(cstNode, offset); } return void 0; } __name(findDeclarationNodeAtOffset, "findDeclarationNodeAtOffset"); function findCommentNode(cstNode, commentNames) { if (cstNode) { const previous = getPreviousNode(cstNode, true); if (previous && isCommentNode(previous, commentNames)) { return previous; } if (isRootCstNode(cstNode)) { const endIndex = cstNode.content.findIndex((e) => !e.hidden); for (let i = endIndex - 1; i >= 0; i--) { const child = cstNode.content[i]; if (isCommentNode(child, commentNames)) { return child; } } } } return void 0; } __name(findCommentNode, "findCommentNode"); function isCommentNode(cstNode, commentNames) { return isLeafCstNode(cstNode) && commentNames.includes(cstNode.tokenType.name); } __name(isCommentNode, "isCommentNode"); function findLeafNodeAtOffset(node, offset) { if (isLeafCstNode(node)) { return node; } else if (isCompositeCstNode(node)) { const searchResult = binarySearch(node, offset, false); if (searchResult) { return findLeafNodeAtOffset(searchResult, offset); } } return void 0; } __name(findLeafNodeAtOffset, "findLeafNodeAtOffset"); function findLeafNodeBeforeOffset(node, offset) { if (isLeafCstNode(node)) { return node; } else if (isCompositeCstNode(node)) { const searchResult = binarySearch(node, offset, true); if (searchResult) { return findLeafNodeBeforeOffset(searchResult, offset); } } return void 0; } __name(findLeafNodeBeforeOffset, "findLeafNodeBeforeOffset"); function binarySearch(node, offset, closest) { let left = 0; let right = node.content.length - 1; let closestNode = void 0; while (left <= right) { const middle = Math.floor((left + right) / 2); const middleNode = node.content[middle]; if (middleNode.offset <= offset && middleNode.end > offset) { return middleNode; } if (middleNode.end <= offset) { closestNode = closest ? middleNode : void 0; left = middle + 1; } else { right = middle - 1; } } return closestNode; } __name(binarySearch, "binarySearch"); function getPreviousNode(node, hidden = true) { while (node.container) { const parent = node.container; let index = parent.content.indexOf(node); while (index > 0) { index--; const previous = parent.content[index]; if (hidden || !previous.hidden) { return previous; } } node = parent; } return void 0; } __name(getPreviousNode, "getPreviousNode"); function getNextNode(node, hidden = true) { while (node.container) { const parent = node.container; let index = parent.content.indexOf(node); const last = parent.content.length - 1; while (index < last) { index++; const next = parent.content[index]; if (hidden || !next.hidden) { return next; } } node = parent; } return void 0; } __name(getNextNode, "getNextNode"); function getStartlineNode(node) { if (node.range.start.character === 0) { return node; } const line = node.range.start.line; let last = node; let index; while (node.container) { const parent = node.container; const selfIndex = index !== null && index !== void 0 ? index : parent.content.indexOf(node); if (selfIndex === 0) { node = parent; index = void 0; } else { index = selfIndex - 1; node = parent.content[index]; } if (node.range.start.line !== line) { break; } last = node; } return last; } __name(getStartlineNode, "getStartlineNode"); function getInteriorNodes(start, end) { const commonParent = getCommonParent(start, end); if (!commonParent) { return []; } return commonParent.parent.content.slice(commonParent.a + 1, commonParent.b); } __name(getInteriorNodes, "getInteriorNodes"); function getCommonParent(a, b) { const aParents = getParentChain(a); const bParents = getParentChain(b); let current; for (let i = 0; i < aParents.length && i < bParents.length; i++) { const aParent = aParents[i]; const bParent = bParents[i]; if (aParent.parent === bParent.parent) { current = { parent: aParent.parent, a: aParent.index, b: bParent.index }; } else { break; } } return current; } __name(getCommonParent, "getCommonParent"); function getParentChain(node) { const chain = []; while (node.container) { const parent = node.container; const index = parent.content.indexOf(node); chain.push({ parent, index }); node = parent; } return chain.reverse(); } __name(getParentChain, "getParentChain"); // ../../node_modules/.pnpm/langium@3.3.1/node_modules/langium/lib/utils/grammar-utils.js var grammar_utils_exports = {}; __export(grammar_utils_exports, { findAssignment: () => findAssignment, findNameAssignment: () => findNameAssignment, findNodeForKeyword: () => findNodeForKeyword, findNodeForProperty: () => findNodeForProperty, findNodesForKeyword: () => findNodesForKeyword, findNodesForKeywordInternal: () => findNodesForKeywordInternal, findNodesForProperty: () => findNodesForProperty, getActionAtElement: () => getActionAtElement, getActionType: () => getActionType, getAllReachableRules: () => getAllReachableRules, getCrossReferenceTerminal: () => getCrossReferenceTerminal, getEntryRule: () => getEntryRule, getExplicitRuleType: () => getExplicitRuleType, getHiddenRules: () => getHiddenRules, getRuleType: () => getRuleType, getRuleTypeName: () => getRuleTypeName, getTypeName: () => getTypeName, isArrayCardinality: () => isArrayCardinality, isArrayOperator: () => isArrayOperator, isCommentTerminal: () => isCommentTerminal, isDataType: () => isDataType, isDataTypeRule: () => isDataTypeRule, isOptionalCardinality: () => isOptionalCardinality, terminalRegex: () => terminalRegex }); // ../../node_modules/.pnpm/langium@3.3.1/node_modules/langium/lib/utils/errors.js var ErrorWithLocation = class extends Error { static { __name(this, "ErrorWithLocation"); } constructor(node, message) { super(node ? `${message} at ${node.range.start.line}:${node.range.start.character}` : message); } }; function assertUnreachable(_) { throw new Error("Error! The input value was not handled."); } __name(assertUnreachable, "assertUnreachable"); // ../../node_modules/.pnpm/langium@3.3.1/node_modules/langium/lib/languages/generated/ast.js var ast_exports = {}; __export(ast_exports, { AbstractElement: () => AbstractElement, AbstractRule: () => AbstractRule, AbstractType: () => AbstractType, Action: () => Action, Alternatives: () => Alternatives, ArrayLiteral: () => ArrayLiteral, ArrayType: () => ArrayType, Assignment: () => Assignment, BooleanLiteral: () => BooleanLiteral, CharacterRange: () => CharacterRange, Condition: () => Condition, Conjunction: () => Conjunction, CrossReference: () => CrossReference, Disjunction: () => Disjunction, EndOfFile: () => EndOfFile, Grammar: () => Grammar, GrammarImport: () => GrammarImport, Group: () => Group, InferredType: () => InferredType, Interface: () => Interface, Keyword: () => Keyword, LangiumGrammarAstReflection: () => LangiumGrammarAstReflection, LangiumGrammarTerminals: () => LangiumGrammarTerminals, NamedArgument: () => NamedArgument, NegatedToken: () => NegatedToken, Negation: () => Negation, NumberLiteral: () => NumberLiteral, Parameter: () => Parameter, ParameterReference: () => ParameterReference, ParserRule: () => ParserRule, ReferenceType: () => ReferenceType, RegexToken: () => RegexToken, ReturnType: () => ReturnType, RuleCall: () => RuleCall, SimpleType: () => SimpleType, StringLiteral: () => StringLiteral, TerminalAlternatives: () => TerminalAlternatives, TerminalGroup: () => TerminalGroup, TerminalRule: () => TerminalRule, TerminalRuleCall: () => TerminalRuleCall, Type: () => Type, TypeAttribute: () => TypeAttribute, TypeDefinition: () => TypeDefinition, UnionType: () => UnionType, UnorderedGroup: () => UnorderedGroup, UntilToken: () => UntilToken, ValueLiteral: () => ValueLiteral, Wildcard: () => Wildcard, isAbstractElement: () => isAbstractElement, isAbstractRule: () => isAbstractRule, isAbstractType: () => isAbstractType, isAction: () => isAction, isAlternatives: () => isAlternatives, isArrayLiteral: () => isArrayLiteral, isArrayType: () => isArrayType, isAssignment: () => isAssignment, isBooleanLiteral: () => isBooleanLiteral, isCharacterRange: () => isCharacterRange, isCondition: () => isCondition, isConjunction: () => isConjunction, isCrossReference: () => isCrossReference, isDisjunction: () => isDisjunction, isEndOfFile: () => isEndOfFile, isFeatureName: () => isFeatureName, isGrammar: () => isGrammar, isGrammarImport: () => isGrammarImport, isGroup: () => isGroup, isInferredType: () => isInferredType, isInterface: () => isInterface, isKeyword: () => isKeyword, isNamedArgument: () => isNamedArgument, isNegatedToken: () => isNegatedToken, isNegation: () => isNegation, isNumberLiteral: () => isNumberLiteral, isParameter: () => isParameter, isParameterReference: () => isParameterReference, isParserRule: () => isParserRule, isPrimitiveType: () => isPrimitiveType, isReferenceType: () => isReferenceType, isRegexToken: () => isRegexToken, isReturnType: () => isReturnType, isRuleCall: () => isRuleCall, isSimpleType: () => isSimpleType, isStringLiteral: () => isStringLiteral, isTerminalAlternatives: () => isTerminalAlternatives, isTerminalGroup: () => isTerminalGroup, isTerminalRule: () => isTerminalRule, isTerminalRuleCall: () => isTerminalRuleCall, isType: () => isType, isTypeAttribute: () => isTypeAttribute, isTypeDefinition: () => isTypeDefinition, isUnionType: () => isUnionType, isUnorderedGroup: () => isUnorderedGroup, isUntilToken: () => isUntilToken, isValueLiteral: () => isValueLiteral, isWildcard: () => isWildcard, reflection: () => reflection }); var LangiumGrammarTerminals = { ID: /\^?[_a-zA-Z][\w_]*/, STRING: /"(\\.|[^"\\])*"|'(\\.|[^'\\])*'/, NUMBER: /NaN|-?((\d*\.\d+|\d+)([Ee][+-]?\d+)?|Infinity)/, RegexLiteral: /\/(?![*+?])(?:[^\r\n\[/\\]|\\.|\[(?:[^\r\n\]\\]|\\.)*\])+\/[a-z]*/, WS: /\s+/, ML_COMMENT: /\/\*[\s\S]*?\*\//, SL_COMMENT: /\/\/[^\n\r]*/ }; var AbstractRule = "AbstractRule"; function isAbstractRule(item) { return reflection.isInstance(item, AbstractRule); } __name(isAbstractRule, "isAbstractRule"); var AbstractType = "AbstractType"; function isAbstractType(item) { return reflection.isInstance(item, AbstractType); } __name(isAbstractType, "isAbstractType"); var Condition = "Condition"; function isCondition(item) { return reflection.isInstance(item, Condition); } __name(isCondition, "isCondition"); function isFeatureName(item) { return isPrimitiveType(item) || item === "current" || item === "entry" || item === "extends" || item === "false" || item === "fragment" || item === "grammar" || item === "hidden" || item === "import" || item === "interface" || item === "returns" || item === "terminal" || item === "true" || item === "type" || item === "infer" || item === "infers" || item === "with" || typeof item === "string" && /\^?[_a-zA-Z][\w_]*/.test(item); } __name(isFeatureName, "isFeatureName"); function isPrimitiveType(item) { return item === "string" || item === "number" || item === "boolean" || item === "Date" || item === "bigint"; } __name(isPrimitiveType, "isPrimitiveType"); var TypeDefinition = "TypeDefinition"; function isTypeDefinition(item) { return reflection.isInstance(item, TypeDefinition); } __name(isTypeDefinition, "isTypeDefinition"); var ValueLiteral = "ValueLiteral"; function isValueLiteral(item) { return reflection.isInstance(item, ValueLiteral); } __name(isValueLiteral, "isValueLiteral"); var AbstractElement = "AbstractElement"; function isAbstractElement(item) { return reflection.isInstance(item, AbstractElement); } __name(isAbstractElement, "isAbstractElement"); var ArrayLiteral = "ArrayLiteral"; function isArrayLiteral(item) { return reflection.isInstance(item, ArrayLiteral); } __name(isArrayLiteral, "isArrayLiteral"); var ArrayType = "ArrayType"; function isArrayType(item) { return reflection.isInstance(item, ArrayType); } __name(isArrayType, "isArrayType"); var BooleanLiteral = "BooleanLiteral"; function isBooleanLiteral(item) { return reflection.isInstance(item, BooleanLiteral); } __name(isBooleanLiteral, "isBooleanLiteral"); var Conjunction = "Conjunction"; function isConjunction(item) { return reflection.isInstance(item, Conjunction); } __name(isConjunction, "isConjunction"); var Disjunction = "Disjunction"; function isDisjunction(item) { return reflection.isInstance(item, Disjunction); } __name(isDisjunction, "isDisjunction"); var Grammar = "Grammar"; function isGrammar(item) { return reflection.isInstance(item, Grammar); } __name(isGrammar, "isGrammar"); var GrammarImport = "GrammarImport"; function isGrammarImport(item) { return reflection.isInstance(item, GrammarImport); } __name(isGrammarImport, "isGrammarImport"); var InferredType = "InferredType"; function isInferredType(item) { return reflection.isInstance(item, InferredType); } __name(isInferredType, "isInferredType"); var Interface = "Interface"; function isInterface(item) { return reflection.isInstance(item, Interface); } __name(isInterface, "isInterface"); var NamedArgument = "NamedArgument"; function isNamedArgument(item) { return reflection.isInstance(item, NamedArgument); } __name(isNamedArgument, "isNamedArgument"); var Negation = "Negation"; function isNegation(item) { return reflection.isInstance(item, Negation); } __name(isNegation, "isNegation"); var NumberLiteral = "NumberLiteral"; function isNumberLiteral(item) { return reflection.isInstance(item, NumberLiteral); } __name(isNumberLiteral, "isNumberLiteral"); var Parameter = "Parameter"; function isParameter(item) { return reflection.isInstance(item, Parameter); } __name(isParameter, "isParameter"); var ParameterReference = "ParameterReference"; function isParameterReference(item) { return reflection.isInstance(item, ParameterReference); } __name(isParameterReference, "isParameterReference"); var ParserRule = "ParserRule"; function isParserRule(item) { return reflection.isInstance(item, ParserRule); } __name(isParserRule, "isParserRule"); var ReferenceType = "ReferenceType"; function isReferenceType(item) { return reflection.isInstance(item, ReferenceType); } __name(isReferenceType, "isReferenceType"); var ReturnType = "ReturnType"; function isReturnType(item) { return reflection.isInstance(item,