"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
exports.DocumentUri = void 0;
(function(DocumentUri) {
  function is(value) {
    return typeof value === "string";
  }
  DocumentUri.is = is;
})(exports.DocumentUri || (exports.DocumentUri = {}));
exports.URI = void 0;
(function(URI) {
  function is(value) {
    return typeof value === "string";
  }
  URI.is = is;
})(exports.URI || (exports.URI = {}));
exports.integer = void 0;
(function(integer) {
  integer.MIN_VALUE = -2147483648;
  integer.MAX_VALUE = 2147483647;
  function is(value) {
    return typeof value === "number" && integer.MIN_VALUE <= value && value <= integer.MAX_VALUE;
  }
  integer.is = is;
})(exports.integer || (exports.integer = {}));
exports.uinteger = void 0;
(function(uinteger) {
  uinteger.MIN_VALUE = 0;
  uinteger.MAX_VALUE = 2147483647;
  function is(value) {
    return typeof value === "number" && uinteger.MIN_VALUE <= value && value <= uinteger.MAX_VALUE;
  }
  uinteger.is = is;
})(exports.uinteger || (exports.uinteger = {}));
exports.Position = void 0;
(function(Position) {
  function create(line, character) {
    if (line === Number.MAX_VALUE) {
      line = exports.uinteger.MAX_VALUE;
    }
    if (character === Number.MAX_VALUE) {
      character = exports.uinteger.MAX_VALUE;
    }
    return { line, character };
  }
  Position.create = create;
  function is(value) {
    let candidate = value;
    return Is.objectLiteral(candidate) && Is.uinteger(candidate.line) && Is.uinteger(candidate.character);
  }
  Position.is = is;
})(exports.Position || (exports.Position = {}));
exports.Range = void 0;
(function(Range) {
  function create(one, two, three, four) {
    if (Is.uinteger(one) && Is.uinteger(two) && Is.uinteger(three) && Is.uinteger(four)) {
      return { start: exports.Position.create(one, two), end: exports.Position.create(three, four) };
    } else if (exports.Position.is(one) && exports.Position.is(two)) {
      return { start: one, end: two };
    } else {
      throw new Error(`Range#create called with invalid arguments[${one}, ${two}, ${three}, ${four}]`);
    }
  }
  Range.create = create;
  function is(value) {
    let candidate = value;
    return Is.objectLiteral(candidate) && exports.Position.is(candidate.start) && exports.Position.is(candidate.end);
  }
  Range.is = is;
})(exports.Range || (exports.Range = {}));
exports.Location = void 0;
(function(Location) {
  function create(uri, range) {
    return { uri, range };
  }
  Location.create = create;
  function is(value) {
    let candidate = value;
    return Is.objectLiteral(candidate) && exports.Range.is(candidate.range) && (Is.string(candidate.uri) || Is.undefined(candidate.uri));
  }
  Location.is = is;
})(exports.Location || (exports.Location = {}));
exports.LocationLink = void 0;
(function(LocationLink) {
  function create(targetUri, targetRange, targetSelectionRange, originSelectionRange) {
    return { targetUri, targetRange, targetSelectionRange, originSelectionRange };
  }
  LocationLink.create = create;
  function is(value) {
    let candidate = value;
    return Is.objectLiteral(candidate) && exports.Range.is(candidate.targetRange) && Is.string(candidate.targetUri) && exports.Range.is(candidate.targetSelectionRange) && (exports.Range.is(candidate.originSelectionRange) || Is.undefined(candidate.originSelectionRange));
  }
  LocationLink.is = is;
})(exports.LocationLink || (exports.LocationLink = {}));
exports.Color = void 0;
(function(Color) {
  function create(red, green, blue, alpha) {
    return {
      red,
      green,
      blue,
      alpha
    };
  }
  Color.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);
  }
  Color.is = is;
})(exports.Color || (exports.Color = {}));
exports.ColorInformation = void 0;
(function(ColorInformation) {
  function create(range, color) {
    return {
      range,
      color
    };
  }
  ColorInformation.create = create;
  function is(value) {
    const candidate = value;
    return Is.objectLiteral(candidate) && exports.Range.is(candidate.range) && exports.Color.is(candidate.color);
  }
  ColorInformation.is = is;
})(exports.ColorInformation || (exports.ColorInformation = {}));
exports.ColorPresentation = void 0;
(function(ColorPresentation) {
  function create(label, textEdit, additionalTextEdits) {
    return {
      label,
      textEdit,
      additionalTextEdits
    };
  }
  ColorPresentation.create = create;
  function is(value) {
    const candidate = value;
    return Is.objectLiteral(candidate) && Is.string(candidate.label) && (Is.undefined(candidate.textEdit) || exports.TextEdit.is(candidate)) && (Is.undefined(candidate.additionalTextEdits) || Is.typedArray(candidate.additionalTextEdits, exports.TextEdit.is));
  }
  ColorPresentation.is = is;
})(exports.ColorPresentation || (exports.ColorPresentation = {}));
exports.FoldingRangeKind = void 0;
(function(FoldingRangeKind) {
  FoldingRangeKind.Comment = "comment";
  FoldingRangeKind.Imports = "imports";
  FoldingRangeKind.Region = "region";
})(exports.FoldingRangeKind || (exports.FoldingRangeKind = {}));
exports.FoldingRange = void 0;
(function(FoldingRange) {
  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;
  }
  FoldingRange.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));
  }
  FoldingRange.is = is;
})(exports.FoldingRange || (exports.FoldingRange = {}));
exports.DiagnosticRelatedInformation = void 0;
(function(DiagnosticRelatedInformation) {
  function create(location, message) {
    return {
      location,
      message
    };
  }
  DiagnosticRelatedInformation.create = create;
  function is(value) {
    let candidate = value;
    return Is.defined(candidate) && exports.Location.is(candidate.location) && Is.string(candidate.message);
  }
  DiagnosticRelatedInformation.is = is;
})(exports.DiagnosticRelatedInformation || (exports.DiagnosticRelatedInformation = {}));
exports.DiagnosticSeverity = void 0;
(function(DiagnosticSeverity) {
  DiagnosticSeverity.Error = 1;
  DiagnosticSeverity.Warning = 2;
  DiagnosticSeverity.Information = 3;
  DiagnosticSeverity.Hint = 4;
})(exports.DiagnosticSeverity || (exports.DiagnosticSeverity = {}));
exports.DiagnosticTag = void 0;
(function(DiagnosticTag) {
  DiagnosticTag.Unnecessary = 1;
  DiagnosticTag.Deprecated = 2;
})(exports.DiagnosticTag || (exports.DiagnosticTag = {}));
exports.CodeDescription = void 0;
(function(CodeDescription) {
  function is(value) {
    const candidate = value;
    return Is.objectLiteral(candidate) && Is.string(candidate.href);
  }
  CodeDescription.is = is;
})(exports.CodeDescription || (exports.CodeDescription = {}));
exports.Diagnostic = void 0;
(function(Diagnostic) {
  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;
  }
  Diagnostic.create = create;
  function is(value) {
    var _a;
    let candidate = value;
    return Is.defined(candidate) && exports.Range.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((_a = candidate.codeDescription) === null || _a === void 0 ? void 0 : _a.href)) && (Is.string(candidate.source) || Is.undefined(candidate.source)) && (Is.undefined(candidate.relatedInformation) || Is.typedArray(candidate.relatedInformation, exports.DiagnosticRelatedInformation.is));
  }
  Diagnostic.is = is;
})(exports.Diagnostic || (exports.Diagnostic = {}));
exports.Command = void 0;
(function(Command) {
  function create(title, command, ...args) {
    let result = { title, command };
    if (Is.defined(args) && args.length > 0) {
      result.arguments = args;
    }
    return result;
  }
  Command.create = create;
  function is(value) {
    let candidate = value;
    return Is.defined(candidate) && Is.string(candidate.title) && Is.string(candidate.command);
  }
  Command.is = is;
})(exports.Command || (exports.Command = {}));
exports.TextEdit = void 0;
(function(TextEdit) {
  function replace(range, newText) {
    return { range, newText };
  }
  TextEdit.replace = replace;
  function insert(position, newText) {
    return { range: { start: position, end: position }, newText };
  }
  TextEdit.insert = insert;
  function del(range) {
    return { range, newText: "" };
  }
  TextEdit.del = del;
  function is(value) {
    const candidate = value;
    return Is.objectLiteral(candidate) && Is.string(candidate.newText) && exports.Range.is(candidate.range);
  }
  TextEdit.is = is;
})(exports.TextEdit || (exports.TextEdit = {}));
exports.ChangeAnnotation = void 0;
(function(ChangeAnnotation) {
  function create(label, needsConfirmation, description) {
    const result = { label };
    if (needsConfirmation !== void 0) {
      result.needsConfirmation = needsConfirmation;
    }
    if (description !== void 0) {
      result.description = description;
    }
    return result;
  }
  ChangeAnnotation.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);
  }
  ChangeAnnotation.is = is;
})(exports.ChangeAnnotation || (exports.ChangeAnnotation = {}));
exports.ChangeAnnotationIdentifier = void 0;
(function(ChangeAnnotationIdentifier) {
  function is(value) {
    const candidate = value;
    return Is.string(candidate);
  }
  ChangeAnnotationIdentifier.is = is;
})(exports.ChangeAnnotationIdentifier || (exports.ChangeAnnotationIdentifier = {}));
exports.AnnotatedTextEdit = void 0;
(function(AnnotatedTextEdit) {
  function replace(range, newText, annotation) {
    return { range, newText, annotationId: annotation };
  }
  AnnotatedTextEdit.replace = replace;
  function insert(position, newText, annotation) {
    return { range: { start: position, end: position }, newText, annotationId: annotation };
  }
  AnnotatedTextEdit.insert = insert;
  function del(range, annotation) {
    return { range, newText: "", annotationId: annotation };
  }
  AnnotatedTextEdit.del = del;
  function is(value) {
    const candidate = value;
    return exports.TextEdit.is(candidate) && (exports.ChangeAnnotation.is(candidate.annotationId) || exports.ChangeAnnotationIdentifier.is(candidate.annotationId));
  }
  AnnotatedTextEdit.is = is;
})(exports.AnnotatedTextEdit || (exports.AnnotatedTextEdit = {}));
exports.TextDocumentEdit = void 0;
(function(TextDocumentEdit) {
  function create(textDocument, edits) {
    return { textDocument, edits };
  }
  TextDocumentEdit.create = create;
  function is(value) {
    let candidate = value;
    return Is.defined(candidate) && exports.OptionalVersionedTextDocumentIdentifier.is(candidate.textDocument) && Array.isArray(candidate.edits);
  }
  TextDocumentEdit.is = is;
})(exports.TextDocumentEdit || (exports.TextDocumentEdit = {}));
exports.CreateFile = void 0;
(function(CreateFile) {
  function create(uri, options, annotation) {
    let result = {
      kind: "create",
      uri
    };
    if (options !== void 0 && (options.overwrite !== void 0 || options.ignoreIfExists !== void 0)) {
      result.options = options;
    }
    if (annotation !== void 0) {
      result.annotationId = annotation;
    }
    return result;
  }
  CreateFile.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 || exports.ChangeAnnotationIdentifier.is(candidate.annotationId));
  }
  CreateFile.is = is;
})(exports.CreateFile || (exports.CreateFile = {}));
exports.RenameFile = void 0;
(function(RenameFile) {
  function create(oldUri, newUri, options, annotation) {
    let result = {
      kind: "rename",
      oldUri,
      newUri
    };
    if (options !== void 0 && (options.overwrite !== void 0 || options.ignoreIfExists !== void 0)) {
      result.options = options;
    }
    if (annotation !== void 0) {
      result.annotationId = annotation;
    }
    return result;
  }
  RenameFile.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 || exports.ChangeAnnotationIdentifier.is(candidate.annotationId));
  }
  RenameFile.is = is;
})(exports.RenameFile || (exports.RenameFile = {}));
exports.DeleteFile = void 0;
(function(DeleteFile) {
  function create(uri, options, annotation) {
    let result = {
      kind: "delete",
      uri
    };
    if (options !== void 0 && (options.recursive !== void 0 || options.ignoreIfNotExists !== void 0)) {
      result.options = options;
    }
    if (annotation !== void 0) {
      result.annotationId = annotation;
    }
    return result;
  }
  DeleteFile.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 || exports.ChangeAnnotationIdentifier.is(candidate.annotationId));
  }
  DeleteFile.is = is;
})(exports.DeleteFile || (exports.DeleteFile = {}));
exports.WorkspaceEdit = void 0;
(function(WorkspaceEdit) {
  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 exports.CreateFile.is(change) || exports.RenameFile.is(change) || exports.DeleteFile.is(change);
      } else {
        return exports.TextDocumentEdit.is(change);
      }
    }));
  }
  WorkspaceEdit.is = is;
})(exports.WorkspaceEdit || (exports.WorkspaceEdit = {}));
exports.TextDocumentIdentifier = void 0;
(function(TextDocumentIdentifier) {
  function create(uri) {
    return { uri };
  }
  TextDocumentIdentifier.create = create;
  function is(value) {
    let candidate = value;
    return Is.defined(candidate) && Is.string(candidate.uri);
  }
  TextDocumentIdentifier.is = is;
})(exports.TextDocumentIdentifier || (exports.TextDocumentIdentifier = {}));
exports.VersionedTextDocumentIdentifier = void 0;
(function(VersionedTextDocumentIdentifier) {
  function create(uri, version) {
    return { uri, version };
  }
  VersionedTextDocumentIdentifier.create = create;
  function is(value) {
    let candidate = value;
    return Is.defined(candidate) && Is.string(candidate.uri) && Is.integer(candidate.version);
  }
  VersionedTextDocumentIdentifier.is = is;
})(exports.VersionedTextDocumentIdentifier || (exports.VersionedTextDocumentIdentifier = {}));
exports.OptionalVersionedTextDocumentIdentifier = void 0;
(function(OptionalVersionedTextDocumentIdentifier) {
  function create(uri, version) {
    return { uri, version };
  }
  OptionalVersionedTextDocumentIdentifier.create = create;
  function is(value) {
    let candidate = value;
    return Is.defined(candidate) && Is.string(candidate.uri) && (candidate.version === null || Is.integer(candidate.version));
  }
  OptionalVersionedTextDocumentIdentifier.is = is;
})(exports.OptionalVersionedTextDocumentIdentifier || (exports.OptionalVersionedTextDocumentIdentifier = {}));
exports.TextDocumentItem = void 0;
(function(TextDocumentItem) {
  function create(uri, languageId, version, text) {
    return { uri, languageId, version, text };
  }
  TextDocumentItem.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);
  }
  TextDocumentItem.is = is;
})(exports.TextDocumentItem || (exports.TextDocumentItem = {}));
exports.MarkupKind = void 0;
(function(MarkupKind) {
  MarkupKind.PlainText = "plaintext";
  MarkupKind.Markdown = "markdown";
  function is(value) {
    const candidate = value;
    return candidate === MarkupKind.PlainText || candidate === MarkupKind.Markdown;
  }
  MarkupKind.is = is;
})(exports.MarkupKind || (exports.MarkupKind = {}));
exports.MarkupContent = void 0;
(function(MarkupContent) {
  function is(value) {
    const candidate = value;
    return Is.objectLiteral(value) && exports.MarkupKind.is(candidate.kind) && Is.string(candidate.value);
  }
  MarkupContent.is = is;
})(exports.MarkupContent || (exports.MarkupContent = {}));
exports.CompletionItemKind = void 0;
(function(CompletionItemKind) {
  CompletionItemKind.Text = 1;
  CompletionItemKind.Method = 2;
  CompletionItemKind.Function = 3;
  CompletionItemKind.Constructor = 4;
  CompletionItemKind.Field = 5;
  CompletionItemKind.Variable = 6;
  CompletionItemKind.Class = 7;
  CompletionItemKind.Interface = 8;
  CompletionItemKind.Module = 9;
  CompletionItemKind.Property = 10;
  CompletionItemKind.Unit = 11;
  CompletionItemKind.Value = 12;
  CompletionItemKind.Enum = 13;
  CompletionItemKind.Keyword = 14;
  CompletionItemKind.Snippet = 15;
  CompletionItemKind.Color = 16;
  CompletionItemKind.File = 17;
  CompletionItemKind.Reference = 18;
  CompletionItemKind.Folder = 19;
  CompletionItemKind.EnumMember = 20;
  CompletionItemKind.Constant = 21;
  CompletionItemKind.Struct = 22;
  CompletionItemKind.Event = 23;
  CompletionItemKind.Operator = 24;
  CompletionItemKind.TypeParameter = 25;
})(exports.CompletionItemKind || (exports.CompletionItemKind = {}));
exports.InsertTextFormat = void 0;
(function(InsertTextFormat) {
  InsertTextFormat.PlainText = 1;
  InsertTextFormat.Snippet = 2;
})(exports.InsertTextFormat || (exports.InsertTextFormat = {}));
exports.CompletionItemTag = void 0;
(function(CompletionItemTag) {
  CompletionItemTag.Deprecated = 1;
})(exports.CompletionItemTag || (exports.CompletionItemTag = {}));
exports.InsertReplaceEdit = void 0;
(function(InsertReplaceEdit) {
  function create(newText, insert, replace) {
    return { newText, insert, replace };
  }
  InsertReplaceEdit.create = create;
  function is(value) {
    const candidate = value;
    return candidate && Is.string(candidate.newText) && exports.Range.is(candidate.insert) && exports.Range.is(candidate.replace);
  }
  InsertReplaceEdit.is = is;
})(exports.InsertReplaceEdit || (exports.InsertReplaceEdit = {}));
exports.InsertTextMode = void 0;
(function(InsertTextMode) {
  InsertTextMode.asIs = 1;
  InsertTextMode.adjustIndentation = 2;
})(exports.InsertTextMode || (exports.InsertTextMode = {}));
exports.CompletionItemLabelDetails = void 0;
(function(CompletionItemLabelDetails) {
  function is(value) {
    const candidate = value;
    return candidate && (Is.string(candidate.detail) || candidate.detail === void 0) && (Is.string(candidate.description) || candidate.description === void 0);
  }
  CompletionItemLabelDetails.is = is;
})(exports.CompletionItemLabelDetails || (exports.CompletionItemLabelDetails = {}));
exports.CompletionItem = void 0;
(function(CompletionItem) {
  function create(label) {
    return { label };
  }
  CompletionItem.create = create;
})(exports.CompletionItem || (exports.CompletionItem = {}));
exports.CompletionList = void 0;
(function(CompletionList) {
  function create(items, isIncomplete) {
    return { items: items ? items : [], isIncomplete: !!isIncomplete };
  }
  CompletionList.create = create;
})(exports.CompletionList || (exports.CompletionList = {}));
exports.MarkedString = void 0;
(function(MarkedString) {
  function fromPlainText(plainText) {
    return plainText.replace(/[\\`*_{}[\]()#+\-.!]/g, "\\$&");
  }
  MarkedString.fromPlainText = fromPlainText;
  function is(value) {
    const candidate = value;
    return Is.string(candidate) || Is.objectLiteral(candidate) && Is.string(candidate.language) && Is.string(candidate.value);
  }
  MarkedString.is = is;
})(exports.MarkedString || (exports.MarkedString = {}));
exports.Hover = void 0;
(function(Hover) {
  function is(value) {
    let candidate = value;
    return !!candidate && Is.objectLiteral(candidate) && (exports.MarkupContent.is(candidate.contents) || exports.MarkedString.is(candidate.contents) || Is.typedArray(candidate.contents, exports.MarkedString.is)) && (value.range === void 0 || exports.Range.is(value.range));
  }
  Hover.is = is;
})(exports.Hover || (exports.Hover = {}));
exports.ParameterInformation = void 0;
(function(ParameterInformation) {
  function create(label, documentation) {
    return documentation ? { label, documentation } : { label };
  }
  ParameterInformation.create = create;
})(exports.ParameterInformation || (exports.ParameterInformation = {}));
exports.SignatureInformation = void 0;
(function(SignatureInformation) {
  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;
  }
  SignatureInformation.create = create;
})(exports.SignatureInformation || (exports.SignatureInformation = {}));
exports.DocumentHighlightKind = void 0;
(function(DocumentHighlightKind) {
  DocumentHighlightKind.Text = 1;
  DocumentHighlightKind.Read = 2;
  DocumentHighlightKind.Write = 3;
})(exports.DocumentHighlightKind || (exports.DocumentHighlightKind = {}));
exports.DocumentHighlight = void 0;
(function(DocumentHighlight) {
  function create(range, kind) {
    let result = { range };
    if (Is.number(kind)) {
      result.kind = kind;
    }
    return result;
  }
  DocumentHighlight.create = create;
})(exports.DocumentHighlight || (exports.DocumentHighlight = {}));
exports.SymbolKind = void 0;
(function(SymbolKind) {
  SymbolKind.File = 1;
  SymbolKind.Module = 2;
  SymbolKind.Namespace = 3;
  SymbolKind.Package = 4;
  SymbolKind.Class = 5;
  SymbolKind.Method = 6;
  SymbolKind.Property = 7;
  SymbolKind.Field = 8;
  SymbolKind.Constructor = 9;
  SymbolKind.Enum = 10;
  SymbolKind.Interface = 11;
  SymbolKind.Function = 12;
  SymbolKind.Variable = 13;
  SymbolKind.Constant = 14;
  SymbolKind.String = 15;
  SymbolKind.Number = 16;
  SymbolKind.Boolean = 17;
  SymbolKind.Array = 18;
  SymbolKind.Object = 19;
  SymbolKind.Key = 20;
  SymbolKind.Null = 21;
  SymbolKind.EnumMember = 22;
  SymbolKind.Struct = 23;
  SymbolKind.Event = 24;
  SymbolKind.Operator = 25;
  SymbolKind.TypeParameter = 26;
})(exports.SymbolKind || (exports.SymbolKind = {}));
exports.SymbolTag = void 0;
(function(SymbolTag) {
  SymbolTag.Deprecated = 1;
})(exports.SymbolTag || (exports.SymbolTag = {}));
exports.SymbolInformation = void 0;
(function(SymbolInformation) {
  function create(name, kind, range, uri, containerName) {
    let result = {
      name,
      kind,
      location: { uri, range }
    };
    if (containerName) {
      result.containerName = containerName;
    }
    return result;
  }
  SymbolInformation.create = create;
})(exports.SymbolInformation || (exports.SymbolInformation = {}));
exports.WorkspaceSymbol = void 0;
(function(WorkspaceSymbol) {
  function create(name, kind, uri, range) {
    return range !== void 0 ? { name, kind, location: { uri, range } } : { name, kind, location: { uri } };
  }
  WorkspaceSymbol.create = create;
})(exports.WorkspaceSymbol || (exports.WorkspaceSymbol = {}));
exports.DocumentSymbol = void 0;
(function(DocumentSymbol) {
  function create(name, detail, kind, range, selectionRange, children) {
    let result = {
      name,
      detail,
      kind,
      range,
      selectionRange
    };
    if (children !== void 0) {
      result.children = children;
    }
    return result;
  }
  DocumentSymbol.create = create;
  function is(value) {
    let candidate = value;
    return candidate && Is.string(candidate.name) && Is.number(candidate.kind) && exports.Range.is(candidate.range) && exports.Range.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));
  }
  DocumentSymbol.is = is;
})(exports.DocumentSymbol || (exports.DocumentSymbol = {}));
exports.CodeActionKind = void 0;
(function(CodeActionKind) {
  CodeActionKind.Empty = "";
  CodeActionKind.QuickFix = "quickfix";
  CodeActionKind.Refactor = "refactor";
  CodeActionKind.RefactorExtract = "refactor.extract";
  CodeActionKind.RefactorInline = "refactor.inline";
  CodeActionKind.RefactorRewrite = "refactor.rewrite";
  CodeActionKind.Source = "source";
  CodeActionKind.SourceOrganizeImports = "source.organizeImports";
  CodeActionKind.SourceFixAll = "source.fixAll";
})(exports.CodeActionKind || (exports.CodeActionKind = {}));
exports.CodeActionTriggerKind = void 0;
(function(CodeActionTriggerKind) {
  CodeActionTriggerKind.Invoked = 1;
  CodeActionTriggerKind.Automatic = 2;
})(exports.CodeActionTriggerKind || (exports.CodeActionTriggerKind = {}));
exports.CodeActionContext = void 0;
(function(CodeActionContext) {
  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;
  }
  CodeActionContext.create = create;
  function is(value) {
    let candidate = value;
    return Is.defined(candidate) && Is.typedArray(candidate.diagnostics, exports.Diagnostic.is) && (candidate.only === void 0 || Is.typedArray(candidate.only, Is.string)) && (candidate.triggerKind === void 0 || candidate.triggerKind === exports.CodeActionTriggerKind.Invoked || candidate.triggerKind === exports.CodeActionTriggerKind.Automatic);
  }
  CodeActionContext.is = is;
})(exports.CodeActionContext || (exports.CodeActionContext = {}));
exports.CodeAction = void 0;
(function(CodeAction) {
  function create(title, kindOrCommandOrEdit, kind) {
    let result = { title };
    let checkKind = true;
    if (typeof kindOrCommandOrEdit === "string") {
      checkKind = false;
      result.kind = kindOrCommandOrEdit;
    } else if (exports.Command.is(kindOrCommandOrEdit)) {
      result.command = kindOrCommandOrEdit;
    } else {
      result.edit = kindOrCommandOrEdit;
    }
    if (checkKind && kind !== void 0) {
      result.kind = kind;
    }
    return result;
  }
  CodeAction.create = create;
  function is(value) {
    let candidate = value;
    return candidate && Is.string(candidate.title) && (candidate.diagnostics === void 0 || Is.typedArray(candidate.diagnostics, exports.Diagnostic.is)) && (candidate.kind === void 0 || Is.string(candidate.kind)) && (candidate.edit !== void 0 || candidate.command !== void 0) && (candidate.command === void 0 || exports.Command.is(candidate.command)) && (candidate.isPreferred === void 0 || Is.boolean(candidate.isPreferred)) && (candidate.edit === void 0 || exports.WorkspaceEdit.is(candidate.edit));
  }
  CodeAction.is = is;
})(exports.CodeAction || (exports.CodeAction = {}));
exports.CodeLens = void 0;
(function(CodeLens) {
  function create(range, data) {
    let result = { range };
    if (Is.defined(data)) {
      result.data = data;
    }
    return result;
  }
  CodeLens.create = create;
  function is(value) {
    let candidate = value;
    return Is.defined(candidate) && exports.Range.is(candidate.range) && (Is.undefined(candidate.command) || exports.Command.is(candidate.command));
  }
  CodeLens.is = is;
})(exports.CodeLens || (exports.CodeLens = {}));
exports.FormattingOptions = void 0;
(function(FormattingOptions) {
  function create(tabSize, insertSpaces) {
    return { tabSize, insertSpaces };
  }
  FormattingOptions.create = create;
  function is(value) {
    let candidate = value;
    return Is.defined(candidate) && Is.uinteger(candidate.tabSize) && Is.boolean(candidate.insertSpaces);
  }
  FormattingOptions.is = is;
})(exports.FormattingOptions || (exports.FormattingOptions = {}));
exports.DocumentLink = void 0;
(function(DocumentLink) {
  function create(range, target, data) {
    return { range, target, data };
  }
  DocumentLink.create = create;
  function is(value) {
    let candidate = value;
    return Is.defined(candidate) && exports.Range.is(candidate.range) && (Is.undefined(candidate.target) || Is.string(candidate.target));
  }
  DocumentLink.is = is;
})(exports.DocumentLink || (exports.DocumentLink = {}));
exports.SelectionRange = void 0;
(function(SelectionRange) {
  function create(range, parent) {
    return { range, parent };
  }
  SelectionRange.create = create;
  function is(value) {
    let candidate = value;
    return Is.objectLiteral(candidate) && exports.Range.is(candidate.range) && (candidate.parent === void 0 || SelectionRange.is(candidate.parent));
  }
  SelectionRange.is = is;
})(exports.SelectionRange || (exports.SelectionRange = {}));
exports.SemanticTokenTypes = void 0;
(function(SemanticTokenTypes) {
  SemanticTokenTypes["namespace"] = "namespace";
  SemanticTokenTypes["type"] = "type";
  SemanticTokenTypes["class"] = "class";
  SemanticTokenTypes["enum"] = "enum";
  SemanticTokenTypes["interface"] = "interface";
  SemanticTokenTypes["struct"] = "struct";
  SemanticTokenTypes["typeParameter"] = "typeParameter";
  SemanticTokenTypes["parameter"] = "parameter";
  SemanticTokenTypes["variable"] = "variable";
  SemanticTokenTypes["property"] = "property";
  SemanticTokenTypes["enumMember"] = "enumMember";
  SemanticTokenTypes["event"] = "event";
  SemanticTokenTypes["function"] = "function";
  SemanticTokenTypes["method"] = "method";
  SemanticTokenTypes["macro"] = "macro";
  SemanticTokenTypes["keyword"] = "keyword";
  SemanticTokenTypes["modifier"] = "modifier";
  SemanticTokenTypes["comment"] = "comment";
  SemanticTokenTypes["string"] = "string";
  SemanticTokenTypes["number"] = "number";
  SemanticTokenTypes["regexp"] = "regexp";
  SemanticTokenTypes["operator"] = "operator";
  SemanticTokenTypes["decorator"] = "decorator";
})(exports.SemanticTokenTypes || (exports.SemanticTokenTypes = {}));
exports.SemanticTokenModifiers = void 0;
(function(SemanticTokenModifiers) {
  SemanticTokenModifiers["declaration"] = "declaration";
  SemanticTokenModifiers["definition"] = "definition";
  SemanticTokenModifiers["readonly"] = "readonly";
  SemanticTokenModifiers["static"] = "static";
  SemanticTokenModifiers["deprecated"] = "deprecated";
  SemanticTokenModifiers["abstract"] = "abstract";
  SemanticTokenModifiers["async"] = "async";
  SemanticTokenModifiers["modification"] = "modification";
  SemanticTokenModifiers["documentation"] = "documentation";
  SemanticTokenModifiers["defaultLibrary"] = "defaultLibrary";
})(exports.SemanticTokenModifiers || (exports.SemanticTokenModifiers = {}));
exports.SemanticTokens = void 0;
(function(SemanticTokens) {
  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");
  }
  SemanticTokens.is = is;
})(exports.SemanticTokens || (exports.SemanticTokens = {}));
exports.InlineValueText = void 0;
(function(InlineValueText) {
  function create(range, text) {
    return { range, text };
  }
  InlineValueText.create = create;
  function is(value) {
    const candidate = value;
    return candidate !== void 0 && candidate !== null && exports.Range.is(candidate.range) && Is.string(candidate.text);
  }
  InlineValueText.is = is;
})(exports.InlineValueText || (exports.InlineValueText = {}));
exports.InlineValueVariableLookup = void 0;
(function(InlineValueVariableLookup) {
  function create(range, variableName, caseSensitiveLookup) {
    return { range, variableName, caseSensitiveLookup };
  }
  InlineValueVariableLookup.create = create;
  function is(value) {
    const candidate = value;
    return candidate !== void 0 && candidate !== null && exports.Range.is(candidate.range) && Is.boolean(candidate.caseSensitiveLookup) && (Is.string(candidate.variableName) || candidate.variableName === void 0);
  }
  InlineValueVariableLookup.is = is;
})(exports.InlineValueVariableLookup || (exports.InlineValueVariableLookup = {}));
exports.InlineValueEvaluatableExpression = void 0;
(function(InlineValueEvaluatableExpression) {
  function create(range, expression) {
    return { range, expression };
  }
  InlineValueEvaluatableExpression.create = create;
  function is(value) {
    const candidate = value;
    return candidate !== void 0 && candidate !== null && exports.Range.is(candidate.range) && (Is.string(candidate.expression) || candidate.expression === void 0);
  }
  InlineValueEvaluatableExpression.is = is;
})(exports.InlineValueEvaluatableExpression || (exports.InlineValueEvaluatableExpression = {}));
exports.InlineValueContext = void 0;
(function(InlineValueContext) {
  function create(frameId, stoppedLocation) {
    return { frameId, stoppedLocation };
  }
  InlineValueContext.create = create;
  function is(value) {
    const candidate = value;
    return Is.defined(candidate) && exports.Range.is(value.stoppedLocation);
  }
  InlineValueContext.is = is;
})(exports.InlineValueContext || (exports.InlineValueContext = {}));
exports.InlayHintKind = void 0;
(function(InlayHintKind) {
  InlayHintKind.Type = 1;
  InlayHintKind.Parameter = 2;
  function is(value) {
    return value === 1 || value === 2;
  }
  InlayHintKind.is = is;
})(exports.InlayHintKind || (exports.InlayHintKind = {}));
exports.InlayHintLabelPart = void 0;
(function(InlayHintLabelPart) {
  function create(value) {
    return { value };
  }
  InlayHintLabelPart.create = create;
  function is(value) {
    const candidate = value;
    return Is.objectLiteral(candidate) && (candidate.tooltip === void 0 || Is.string(candidate.tooltip) || exports.MarkupContent.is(candidate.tooltip)) && (candidate.location === void 0 || exports.Location.is(candidate.location)) && (candidate.command === void 0 || exports.Command.is(candidate.command));
  }
  InlayHintLabelPart.is = is;
})(exports.InlayHintLabelPart || (exports.InlayHintLabelPart = {}));
exports.InlayHint = void 0;
(function(InlayHint) {
  function create(position, label, kind) {
    const result = { position, label };
    if (kind !== void 0) {
      result.kind = kind;
    }
    return result;
  }
  InlayHint.create = create;
  function is(value) {
    const candidate = value;
    return Is.objectLiteral(candidate) && exports.Position.is(candidate.position) && (Is.string(candidate.label) || Is.typedArray(candidate.label, exports.InlayHintLabelPart.is)) && (candidate.kind === void 0 || exports.InlayHintKind.is(candidate.kind)) && candidate.textEdits === void 0 || Is.typedArray(candidate.textEdits, exports.TextEdit.is) && (candidate.tooltip === void 0 || Is.string(candidate.tooltip) || exports.MarkupContent.is(candidate.tooltip)) && (candidate.paddingLeft === void 0 || Is.boolean(candidate.paddingLeft)) && (candidate.paddingRight === void 0 || Is.boolean(candidate.paddingRight));
  }
  InlayHint.is = is;
})(exports.InlayHint || (exports.InlayHint = {}));
exports.StringValue = void 0;
(function(StringValue) {
  function createSnippet(value) {
    return { kind: "snippet", value };
  }
  StringValue.createSnippet = createSnippet;
})(exports.StringValue || (exports.StringValue = {}));
exports.InlineCompletionItem = void 0;
(function(InlineCompletionItem) {
  function create(insertText, filterText, range, command) {
    return { insertText, filterText, range, command };
  }
  InlineCompletionItem.create = create;
})(exports.InlineCompletionItem || (exports.InlineCompletionItem = {}));
exports.InlineCompletionList = void 0;
(function(InlineCompletionList) {
  function create(items) {
    return { items };
  }
  InlineCompletionList.create = create;
})(exports.InlineCompletionList || (exports.InlineCompletionList = {}));
exports.InlineCompletionTriggerKind = void 0;
(function(InlineCompletionTriggerKind) {
  InlineCompletionTriggerKind.Invoked = 0;
  InlineCompletionTriggerKind.Automatic = 1;
})(exports.InlineCompletionTriggerKind || (exports.InlineCompletionTriggerKind = {}));
exports.SelectedCompletionInfo = void 0;
(function(SelectedCompletionInfo) {
  function create(range, text) {
    return { range, text };
  }
  SelectedCompletionInfo.create = create;
})(exports.SelectedCompletionInfo || (exports.SelectedCompletionInfo = {}));
exports.InlineCompletionContext = void 0;
(function(InlineCompletionContext) {
  function create(triggerKind, selectedCompletionInfo) {
    return { triggerKind, selectedCompletionInfo };
  }
  InlineCompletionContext.create = create;
})(exports.InlineCompletionContext || (exports.InlineCompletionContext = {}));
exports.WorkspaceFolder = void 0;
(function(WorkspaceFolder) {
  function is(value) {
    const candidate = value;
    return Is.objectLiteral(candidate) && exports.URI.is(candidate.uri) && Is.string(candidate.name);
  }
  WorkspaceFolder.is = is;
})(exports.WorkspaceFolder || (exports.WorkspaceFolder = {}));
exports.TextDocument = void 0;
(function(TextDocument) {
  function create(uri, languageId, version, content) {
    return new FullTextDocument(uri, languageId, version, content);
  }
  TextDocument.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;
  }
  TextDocument.is = is;
  function applyEdits(document, edits) {
    let text = document.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 = document.offsetAt(e.range.start);
      let endOffset = document.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;
  }
  TextDocument.applyEdits = applyEdits;
  function mergeSort(data, compare) {
    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, compare);
    mergeSort(right, compare);
    let leftIdx = 0;
    let rightIdx = 0;
    let i = 0;
    while (leftIdx < left.length && rightIdx < right.length) {
      let ret = compare(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;
  }
})(exports.TextDocument || (exports.TextDocument = {}));
class FullTextDocument {
  constructor(uri, languageId, version, content) {
    this._uri = uri;
    this._languageId = languageId;
    this._version = version;
    this._content = content;
    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 exports.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 exports.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;
  }
}
var Is;
(function(Is2) {
  const toString = Object.prototype.toString;
  function defined(value) {
    return typeof value !== "undefined";
  }
  Is2.defined = defined;
  function undefined$1(value) {
    return typeof value === "undefined";
  }
  Is2.undefined = undefined$1;
  function boolean(value) {
    return value === true || value === false;
  }
  Is2.boolean = boolean;
  function string(value) {
    return toString.call(value) === "[object String]";
  }
  Is2.string = string;
  function number(value) {
    return toString.call(value) === "[object Number]";
  }
  Is2.number = number;
  function numberRange(value, min, max) {
    return toString.call(value) === "[object Number]" && min <= value && value <= max;
  }
  Is2.numberRange = numberRange;
  function integer(value) {
    return toString.call(value) === "[object Number]" && -2147483648 <= value && value <= 2147483647;
  }
  Is2.integer = integer;
  function uinteger(value) {
    return toString.call(value) === "[object Number]" && 0 <= value && value <= 2147483647;
  }
  Is2.uinteger = uinteger;
  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 = {}));
//# sourceMappingURL=lib-esm-main.cjs.map
