"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
require("../../common/languages/languageConfigurationRegistry.js");
require("./standaloneCodeEditorService.js");
require("./standaloneLayoutService.js");
require("../../../platform/undoRedo/common/undoRedoService.js");
require("../../common/services/languageFeatureDebounce.js");
const strings = require("../../../base/common/strings.js");
const dom = require("../../../base/browser/dom.js");
const keyboardEvent = require("../../../base/browser/keyboardEvent.js");
const event = require("../../../base/common/event.js");
const keybindings = require("../../../base/common/keybindings.js");
const lifecycle = require("../../../base/common/lifecycle.js");
const platform = require("../../../base/common/platform.js");
const severity = require("../../../base/common/severity.js");
const uri = require("../../../base/common/uri.js");
const bulkEditService = require("../../browser/services/bulkEditService.js");
const editorConfigurationSchema = require("../../common/config/editorConfigurationSchema.js");
const editOperation = require("../../common/core/editOperation.js");
const position = require("../../common/core/position.js");
const range = require("../../common/core/range.js");
const model = require("../../common/services/model.js");
const resolverService = require("../../common/services/resolverService.js");
const textResourceConfiguration = require("../../common/services/textResourceConfiguration.js");
const commands = require("../../../platform/commands/common/commands.js");
const configuration = require("../../../platform/configuration/common/configuration.js");
const configurationModels = require("../../../platform/configuration/common/configurationModels.js");
const contextkey = require("../../../platform/contextkey/common/contextkey.js");
const dialogs = require("../../../platform/dialogs/common/dialogs.js");
const instantiation = require("../../../platform/instantiation/common/instantiation.js");
const abstractKeybindingService = require("../../../platform/keybinding/common/abstractKeybindingService.js");
const keybinding = require("../../../platform/keybinding/common/keybinding.js");
const keybindingResolver = require("../../../platform/keybinding/common/keybindingResolver.js");
const keybindingsRegistry = require("../../../platform/keybinding/common/keybindingsRegistry.js");
const resolvedKeybindingItem = require("../../../platform/keybinding/common/resolvedKeybindingItem.js");
const usLayoutResolvedKeybinding = require("../../../platform/keybinding/common/usLayoutResolvedKeybinding.js");
const label = require("../../../platform/label/common/label.js");
const notification = require("../../../platform/notification/common/notification.js");
const progress = require("../../../platform/progress/common/progress.js");
const telemetry = require("../../../platform/telemetry/common/telemetry.js");
const workspace = require("../../../platform/workspace/common/workspace.js");
const layoutService = require("../../../platform/layout/browser/layoutService.js");
const standaloneStrings = require("../../common/standaloneStrings.js");
const codeEditorService = require("../../browser/services/codeEditorService.js");
const log = require("../../../platform/log/common/log.js");
const workspaceTrust = require("../../../platform/workspace/common/workspaceTrust.js");
const contextView = require("../../../platform/contextview/browser/contextView.js");
const contextViewService = require("../../../platform/contextview/browser/contextViewService.js");
const languageService = require("../../common/services/languageService.js");
const contextMenuService = require("../../../platform/contextview/browser/contextMenuService.js");
const themeService = require("../../../platform/theme/common/themeService.js");
const extensions = require("../../../platform/instantiation/common/extensions.js");
const openerService = require("../../browser/services/openerService.js");
const editorWorker = require("../../common/services/editorWorker.js");
const editorWorkerService = require("../../browser/services/editorWorkerService.js");
const language = require("../../common/languages/language.js");
const markerDecorationsService = require("../../common/services/markerDecorationsService.js");
const markerDecorations = require("../../common/services/markerDecorations.js");
const modelService = require("../../common/services/modelService.js");
const standaloneQuickInputService = require("./quickInput/standaloneQuickInputService.js");
const standaloneThemeService = require("./standaloneThemeService.js");
const standaloneTheme = require("../common/standaloneTheme.js");
const accessibilityService = require("../../../platform/accessibility/browser/accessibilityService.js");
const accessibility = require("../../../platform/accessibility/common/accessibility.js");
const actions = require("../../../platform/actions/common/actions.js");
const menuService = require("../../../platform/actions/common/menuService.js");
const clipboardService = require("../../../platform/clipboard/browser/clipboardService.js");
const clipboardService$1 = require("../../../platform/clipboard/common/clipboardService.js");
const contextKeyService = require("../../../platform/contextkey/browser/contextKeyService.js");
const descriptors = require("../../../platform/instantiation/common/descriptors.js");
const instantiationService = require("../../../platform/instantiation/common/instantiationService.js");
const serviceCollection = require("../../../platform/instantiation/common/serviceCollection.js");
const listService = require("../../../platform/list/browser/listService.js");
const markers = require("../../../platform/markers/common/markers.js");
const markerService = require("../../../platform/markers/common/markerService.js");
const opener = require("../../../platform/opener/common/opener.js");
const quickInput = require("../../../platform/quickinput/common/quickInput.js");
const storage = require("../../../platform/storage/common/storage.js");
require("../../common/services/languageFeaturesService.js");
var __decorate = globalThis && globalThis.__decorate || function(decorators, target, key, desc) {
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
    r = Reflect.decorate(decorators, target, key, desc);
  else
    for (var i = decorators.length - 1; i >= 0; i--)
      if (d = decorators[i])
        r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __param = globalThis && globalThis.__param || function(paramIndex, decorator) {
  return function(target, key) {
    decorator(target, key, paramIndex);
  };
};
var __awaiter = globalThis && globalThis.__awaiter || function(thisArg, _arguments, P, generator) {
  function adopt(value) {
    return value instanceof P ? value : new P(function(resolve) {
      resolve(value);
    });
  }
  return new (P || (P = Promise))(function(resolve, reject) {
    function fulfilled(value) {
      try {
        step(generator.next(value));
      } catch (e) {
        reject(e);
      }
    }
    function rejected(value) {
      try {
        step(generator["throw"](value));
      } catch (e) {
        reject(e);
      }
    }
    function step(result) {
      result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
    }
    step((generator = generator.apply(thisArg, _arguments || [])).next());
  });
};
class SimpleModel {
  constructor(model2) {
    this.disposed = false;
    this.model = model2;
    this._onWillDispose = new event.Emitter();
  }
  get textEditorModel() {
    return this.model;
  }
  dispose() {
    this.disposed = true;
    this._onWillDispose.fire();
  }
}
let StandaloneTextModelService = class StandaloneTextModelService2 {
  constructor(modelService2) {
    this.modelService = modelService2;
  }
  createModelReference(resource) {
    const model2 = this.modelService.getModel(resource);
    if (!model2) {
      return Promise.reject(new Error(`Model not found`));
    }
    return Promise.resolve(new lifecycle.ImmortalReference(new SimpleModel(model2)));
  }
};
StandaloneTextModelService = __decorate([
  __param(0, model.IModelService)
], StandaloneTextModelService);
class StandaloneEditorProgressService {
  show() {
    return StandaloneEditorProgressService.NULL_PROGRESS_RUNNER;
  }
  showWhile(promise, delay) {
    return __awaiter(this, void 0, void 0, function* () {
      yield promise;
    });
  }
}
StandaloneEditorProgressService.NULL_PROGRESS_RUNNER = {
  done: () => {
  },
  total: () => {
  },
  worked: () => {
  }
};
class StandaloneDialogService {
  confirm(confirmation) {
    return this.doConfirm(confirmation).then((confirmed) => {
      return {
        confirmed,
        checkboxChecked: false
        // unsupported
      };
    });
  }
  doConfirm(confirmation) {
    let messageText = confirmation.message;
    if (confirmation.detail) {
      messageText = messageText + "\n\n" + confirmation.detail;
    }
    return Promise.resolve(window.confirm(messageText));
  }
  show(severity2, message, buttons, options) {
    return Promise.resolve({ choice: 0 });
  }
}
class StandaloneNotificationService {
  info(message) {
    return this.notify({ severity: severity.default.Info, message });
  }
  warn(message) {
    return this.notify({ severity: severity.default.Warning, message });
  }
  error(error) {
    return this.notify({ severity: severity.default.Error, message: error });
  }
  notify(notification2) {
    switch (notification2.severity) {
      case severity.default.Error:
        console.error(notification2.message);
        break;
      case severity.default.Warning:
        console.warn(notification2.message);
        break;
      default:
        console.log(notification2.message);
        break;
    }
    return StandaloneNotificationService.NO_OP;
  }
  status(message, options) {
    return lifecycle.Disposable.None;
  }
}
StandaloneNotificationService.NO_OP = new notification.NoOpNotification();
exports.StandaloneCommandService = class StandaloneCommandService {
  constructor(instantiationService2) {
    this._onWillExecuteCommand = new event.Emitter();
    this._onDidExecuteCommand = new event.Emitter();
    this.onWillExecuteCommand = this._onWillExecuteCommand.event;
    this.onDidExecuteCommand = this._onDidExecuteCommand.event;
    this._instantiationService = instantiationService2;
  }
  executeCommand(id, ...args) {
    const command = commands.CommandsRegistry.getCommand(id);
    if (!command) {
      return Promise.reject(new Error(`command '${id}' not found`));
    }
    try {
      this._onWillExecuteCommand.fire({ commandId: id, args });
      const result = this._instantiationService.invokeFunction.apply(this._instantiationService, [command.handler, ...args]);
      this._onDidExecuteCommand.fire({ commandId: id, args });
      return Promise.resolve(result);
    } catch (err) {
      return Promise.reject(err);
    }
  }
};
exports.StandaloneCommandService = __decorate([
  __param(0, instantiation.IInstantiationService)
], exports.StandaloneCommandService);
exports.StandaloneKeybindingService = class StandaloneKeybindingService extends abstractKeybindingService.AbstractKeybindingService {
  constructor(contextKeyService2, commandService, telemetryService, notificationService, logService, codeEditorService2) {
    super(contextKeyService2, commandService, telemetryService, notificationService, logService);
    this._cachedResolver = null;
    this._dynamicKeybindings = [];
    this._domNodeListeners = [];
    const addContainer = (domNode) => {
      const disposables = new lifecycle.DisposableStore();
      disposables.add(dom.addDisposableListener(domNode, dom.EventType.KEY_DOWN, (e) => {
        const keyEvent = new keyboardEvent.StandardKeyboardEvent(e);
        const shouldPreventDefault = this._dispatch(keyEvent, keyEvent.target);
        if (shouldPreventDefault) {
          keyEvent.preventDefault();
          keyEvent.stopPropagation();
        }
      }));
      disposables.add(dom.addDisposableListener(domNode, dom.EventType.KEY_UP, (e) => {
        const keyEvent = new keyboardEvent.StandardKeyboardEvent(e);
        const shouldPreventDefault = this._singleModifierDispatch(keyEvent, keyEvent.target);
        if (shouldPreventDefault) {
          keyEvent.preventDefault();
        }
      }));
      this._domNodeListeners.push(new DomNodeListeners(domNode, disposables));
    };
    const removeContainer = (domNode) => {
      for (let i = 0; i < this._domNodeListeners.length; i++) {
        const domNodeListeners = this._domNodeListeners[i];
        if (domNodeListeners.domNode === domNode) {
          this._domNodeListeners.splice(i, 1);
          domNodeListeners.dispose();
        }
      }
    };
    const addCodeEditor = (codeEditor) => {
      if (codeEditor.getOption(
        54
        /* inDiffEditor */
      )) {
        return;
      }
      addContainer(codeEditor.getContainerDomNode());
    };
    const removeCodeEditor = (codeEditor) => {
      if (codeEditor.getOption(
        54
        /* inDiffEditor */
      )) {
        return;
      }
      removeContainer(codeEditor.getContainerDomNode());
    };
    this._register(codeEditorService2.onCodeEditorAdd(addCodeEditor));
    this._register(codeEditorService2.onCodeEditorRemove(removeCodeEditor));
    codeEditorService2.listCodeEditors().forEach(addCodeEditor);
    const addDiffEditor = (diffEditor) => {
      addContainer(diffEditor.getContainerDomNode());
    };
    const removeDiffEditor = (diffEditor) => {
      removeContainer(diffEditor.getContainerDomNode());
    };
    this._register(codeEditorService2.onDiffEditorAdd(addDiffEditor));
    this._register(codeEditorService2.onDiffEditorRemove(removeDiffEditor));
    codeEditorService2.listDiffEditors().forEach(addDiffEditor);
  }
  addDynamicKeybinding(commandId, _keybinding, handler, when) {
    const keybinding2 = keybindings.createKeybinding(_keybinding, platform.OS);
    const toDispose = new lifecycle.DisposableStore();
    if (keybinding2) {
      this._dynamicKeybindings.push({
        keybinding: keybinding2.parts,
        command: commandId,
        when,
        weight1: 1e3,
        weight2: 0,
        extensionId: null,
        isBuiltinExtension: false
      });
      toDispose.add(lifecycle.toDisposable(() => {
        for (let i = 0; i < this._dynamicKeybindings.length; i++) {
          const kb = this._dynamicKeybindings[i];
          if (kb.command === commandId) {
            this._dynamicKeybindings.splice(i, 1);
            this.updateResolver({
              source: 1
              /* Default */
            });
            return;
          }
        }
      }));
    }
    toDispose.add(commands.CommandsRegistry.registerCommand(commandId, handler));
    this.updateResolver({
      source: 1
      /* Default */
    });
    return toDispose;
  }
  updateResolver(event2) {
    this._cachedResolver = null;
    this._onDidUpdateKeybindings.fire(event2);
  }
  _getResolver() {
    if (!this._cachedResolver) {
      const defaults = this._toNormalizedKeybindingItems(keybindingsRegistry.KeybindingsRegistry.getDefaultKeybindings(), true);
      const overrides = this._toNormalizedKeybindingItems(this._dynamicKeybindings, false);
      this._cachedResolver = new keybindingResolver.KeybindingResolver(defaults, overrides, (str) => this._log(str));
    }
    return this._cachedResolver;
  }
  _documentHasFocus() {
    return document.hasFocus();
  }
  _toNormalizedKeybindingItems(items, isDefault) {
    const result = [];
    let resultLen = 0;
    for (const item of items) {
      const when = item.when || void 0;
      const keybinding2 = item.keybinding;
      if (!keybinding2) {
        result[resultLen++] = new resolvedKeybindingItem.ResolvedKeybindingItem(void 0, item.command, item.commandArgs, when, isDefault, null, false);
      } else {
        const resolvedKeybindings = usLayoutResolvedKeybinding.USLayoutResolvedKeybinding.resolveUserBinding(keybinding2, platform.OS);
        for (const resolvedKeybinding of resolvedKeybindings) {
          result[resultLen++] = new resolvedKeybindingItem.ResolvedKeybindingItem(resolvedKeybinding, item.command, item.commandArgs, when, isDefault, null, false);
        }
      }
    }
    return result;
  }
  resolveKeyboardEvent(keyboardEvent2) {
    const keybinding2 = new keybindings.SimpleKeybinding(keyboardEvent2.ctrlKey, keyboardEvent2.shiftKey, keyboardEvent2.altKey, keyboardEvent2.metaKey, keyboardEvent2.keyCode).toChord();
    return new usLayoutResolvedKeybinding.USLayoutResolvedKeybinding(keybinding2, platform.OS);
  }
};
exports.StandaloneKeybindingService = __decorate([
  __param(0, contextkey.IContextKeyService),
  __param(1, commands.ICommandService),
  __param(2, telemetry.ITelemetryService),
  __param(3, notification.INotificationService),
  __param(4, log.ILogService),
  __param(5, codeEditorService.ICodeEditorService)
], exports.StandaloneKeybindingService);
class DomNodeListeners extends lifecycle.Disposable {
  constructor(domNode, disposables) {
    super();
    this.domNode = domNode;
    this._register(disposables);
  }
}
function isConfigurationOverrides(thing) {
  return thing && typeof thing === "object" && (!thing.overrideIdentifier || typeof thing.overrideIdentifier === "string") && (!thing.resource || thing.resource instanceof uri.URI);
}
class StandaloneConfigurationService {
  constructor() {
    this._onDidChangeConfiguration = new event.Emitter();
    this.onDidChangeConfiguration = this._onDidChangeConfiguration.event;
    this._configuration = new configurationModels.Configuration(new configurationModels.DefaultConfigurationModel(), new configurationModels.ConfigurationModel());
  }
  getValue(arg1, arg2) {
    const section = typeof arg1 === "string" ? arg1 : void 0;
    const overrides = isConfigurationOverrides(arg1) ? arg1 : isConfigurationOverrides(arg2) ? arg2 : {};
    return this._configuration.getValue(section, overrides, void 0);
  }
  updateValues(values) {
    const previous = { data: this._configuration.toData() };
    const changedKeys = [];
    for (const entry of values) {
      const [key, value] = entry;
      if (this.getValue(key) === value) {
        continue;
      }
      this._configuration.updateValue(key, value);
      changedKeys.push(key);
    }
    if (changedKeys.length > 0) {
      const configurationChangeEvent = new configurationModels.ConfigurationChangeEvent({ keys: changedKeys, overrides: [] }, previous, this._configuration);
      configurationChangeEvent.source = 7;
      configurationChangeEvent.sourceConfig = null;
      this._onDidChangeConfiguration.fire(configurationChangeEvent);
    }
    return Promise.resolve();
  }
  updateValue(key, value, arg3, arg4) {
    return this.updateValues([[key, value]]);
  }
  inspect(key, options = {}) {
    return this._configuration.inspect(key, options, void 0);
  }
}
let StandaloneResourceConfigurationService = class StandaloneResourceConfigurationService2 {
  constructor(configurationService) {
    this.configurationService = configurationService;
    this._onDidChangeConfiguration = new event.Emitter();
    this.configurationService.onDidChangeConfiguration((e) => {
      this._onDidChangeConfiguration.fire({ affectedKeys: e.affectedKeys, affectsConfiguration: (resource, configuration2) => e.affectsConfiguration(configuration2) });
    });
  }
  getValue(resource, arg2, arg3) {
    const position$1 = position.Position.isIPosition(arg2) ? arg2 : null;
    const section = position$1 ? typeof arg3 === "string" ? arg3 : void 0 : typeof arg2 === "string" ? arg2 : void 0;
    if (typeof section === "undefined") {
      return this.configurationService.getValue();
    }
    return this.configurationService.getValue(section);
  }
};
StandaloneResourceConfigurationService = __decorate([
  __param(0, configuration.IConfigurationService)
], StandaloneResourceConfigurationService);
let StandaloneResourcePropertiesService = class StandaloneResourcePropertiesService2 {
  constructor(configurationService) {
    this.configurationService = configurationService;
  }
  getEOL(resource, language2) {
    const eol = this.configurationService.getValue("files.eol", { overrideIdentifier: language2, resource });
    if (eol && typeof eol === "string" && eol !== "auto") {
      return eol;
    }
    return platform.isLinux || platform.isMacintosh ? "\n" : "\r\n";
  }
};
StandaloneResourcePropertiesService = __decorate([
  __param(0, configuration.IConfigurationService)
], StandaloneResourcePropertiesService);
class StandaloneTelemetryService {
  publicLog(eventName, data) {
    return Promise.resolve(void 0);
  }
  publicLog2(eventName, data) {
    return this.publicLog(eventName, data);
  }
}
class StandaloneWorkspaceContextService {
  constructor() {
    const resource = uri.URI.from({ scheme: StandaloneWorkspaceContextService.SCHEME, authority: "model", path: "/" });
    this.workspace = { id: "4064f6ec-cb38-4ad0-af64-ee6467e63c82", folders: [new workspace.WorkspaceFolder({ uri: resource, name: "", index: 0 })] };
  }
  getWorkspace() {
    return this.workspace;
  }
}
StandaloneWorkspaceContextService.SCHEME = "inmemory";
function updateConfigurationService(configurationService, source, isDiffEditor) {
  if (!source) {
    return;
  }
  if (!(configurationService instanceof StandaloneConfigurationService)) {
    return;
  }
  const toUpdate = [];
  Object.keys(source).forEach((key) => {
    if (editorConfigurationSchema.isEditorConfigurationKey(key)) {
      toUpdate.push([`editor.${key}`, source[key]]);
    }
    if (isDiffEditor && editorConfigurationSchema.isDiffEditorConfigurationKey(key)) {
      toUpdate.push([`diffEditor.${key}`, source[key]]);
    }
  });
  if (toUpdate.length > 0) {
    configurationService.updateValues(toUpdate);
  }
}
let StandaloneBulkEditService = class StandaloneBulkEditService2 {
  constructor(_modelService) {
    this._modelService = _modelService;
  }
  hasPreviewHandler() {
    return false;
  }
  apply(edits, _options) {
    return __awaiter(this, void 0, void 0, function* () {
      const textEdits = /* @__PURE__ */ new Map();
      for (let edit of edits) {
        if (!(edit instanceof bulkEditService.ResourceTextEdit)) {
          throw new Error("bad edit - only text edits are supported");
        }
        const model2 = this._modelService.getModel(edit.resource);
        if (!model2) {
          throw new Error("bad edit - model not found");
        }
        if (typeof edit.versionId === "number" && model2.getVersionId() !== edit.versionId) {
          throw new Error("bad state - model changed in the meantime");
        }
        let array = textEdits.get(model2);
        if (!array) {
          array = [];
          textEdits.set(model2, array);
        }
        array.push(editOperation.EditOperation.replaceMove(range.Range.lift(edit.textEdit.range), edit.textEdit.text));
      }
      let totalEdits = 0;
      let totalFiles = 0;
      for (const [model2, edits2] of textEdits) {
        model2.pushStackElement();
        model2.pushEditOperations([], edits2, () => []);
        model2.pushStackElement();
        totalFiles += 1;
        totalEdits += edits2.length;
      }
      return {
        ariaSummary: strings.format(standaloneStrings.StandaloneServicesNLS.bulkEditServiceSummary, totalEdits, totalFiles)
      };
    });
  }
};
StandaloneBulkEditService = __decorate([
  __param(0, model.IModelService)
], StandaloneBulkEditService);
class StandaloneUriLabelService {
  getUriLabel(resource, options) {
    if (resource.scheme === "file") {
      return resource.fsPath;
    }
    return resource.path;
  }
}
let StandaloneContextViewService = class StandaloneContextViewService2 extends contextViewService.ContextViewService {
  constructor(layoutService2, _codeEditorService) {
    super(layoutService2);
    this._codeEditorService = _codeEditorService;
  }
  showContextView(delegate, container, shadowRoot) {
    if (!container) {
      const codeEditor = this._codeEditorService.getFocusedCodeEditor() || this._codeEditorService.getActiveCodeEditor();
      if (codeEditor) {
        container = codeEditor.getContainerDomNode();
      }
    }
    return super.showContextView(delegate, container, shadowRoot);
  }
};
StandaloneContextViewService = __decorate([
  __param(0, layoutService.ILayoutService),
  __param(1, codeEditorService.ICodeEditorService)
], StandaloneContextViewService);
class StandaloneWorkspaceTrustManagementService {
  constructor() {
    this._neverEmitter = new event.Emitter();
    this.onDidChangeTrust = this._neverEmitter.event;
  }
  isWorkspaceTrusted() {
    return true;
  }
}
class StandaloneLanguageService extends languageService.LanguageService {
  constructor() {
    super();
  }
}
class StandaloneLogService extends log.LogService {
  constructor() {
    super(new log.ConsoleLogger());
  }
}
let StandaloneContextMenuService = class StandaloneContextMenuService2 extends contextMenuService.ContextMenuService {
  constructor(telemetryService, notificationService, contextViewService2, keybindingService, themeService2) {
    super(telemetryService, notificationService, contextViewService2, keybindingService, themeService2);
    this.configure({ blockMouse: false });
  }
};
StandaloneContextMenuService = __decorate([
  __param(0, telemetry.ITelemetryService),
  __param(1, notification.INotificationService),
  __param(2, contextView.IContextViewService),
  __param(3, keybinding.IKeybindingService),
  __param(4, themeService.IThemeService)
], StandaloneContextMenuService);
extensions.registerSingleton(configuration.IConfigurationService, StandaloneConfigurationService);
extensions.registerSingleton(textResourceConfiguration.ITextResourceConfigurationService, StandaloneResourceConfigurationService);
extensions.registerSingleton(textResourceConfiguration.ITextResourcePropertiesService, StandaloneResourcePropertiesService);
extensions.registerSingleton(workspace.IWorkspaceContextService, StandaloneWorkspaceContextService);
extensions.registerSingleton(label.ILabelService, StandaloneUriLabelService);
extensions.registerSingleton(telemetry.ITelemetryService, StandaloneTelemetryService);
extensions.registerSingleton(dialogs.IDialogService, StandaloneDialogService);
extensions.registerSingleton(notification.INotificationService, StandaloneNotificationService);
extensions.registerSingleton(markers.IMarkerService, markerService.MarkerService);
extensions.registerSingleton(language.ILanguageService, StandaloneLanguageService);
extensions.registerSingleton(standaloneTheme.IStandaloneThemeService, standaloneThemeService.StandaloneThemeService);
extensions.registerSingleton(log.ILogService, StandaloneLogService);
extensions.registerSingleton(model.IModelService, modelService.ModelService);
extensions.registerSingleton(markerDecorations.IMarkerDecorationsService, markerDecorationsService.MarkerDecorationsService);
extensions.registerSingleton(contextkey.IContextKeyService, contextKeyService.ContextKeyService);
extensions.registerSingleton(progress.IEditorProgressService, StandaloneEditorProgressService);
extensions.registerSingleton(storage.IStorageService, storage.InMemoryStorageService);
extensions.registerSingleton(editorWorker.IEditorWorkerService, editorWorkerService.EditorWorkerService);
extensions.registerSingleton(bulkEditService.IBulkEditService, StandaloneBulkEditService);
extensions.registerSingleton(workspaceTrust.IWorkspaceTrustManagementService, StandaloneWorkspaceTrustManagementService);
extensions.registerSingleton(resolverService.ITextModelService, StandaloneTextModelService);
extensions.registerSingleton(accessibility.IAccessibilityService, accessibilityService.AccessibilityService);
extensions.registerSingleton(listService.IListService, listService.ListService);
extensions.registerSingleton(commands.ICommandService, exports.StandaloneCommandService);
extensions.registerSingleton(keybinding.IKeybindingService, exports.StandaloneKeybindingService);
extensions.registerSingleton(quickInput.IQuickInputService, standaloneQuickInputService.StandaloneQuickInputService);
extensions.registerSingleton(contextView.IContextViewService, StandaloneContextViewService);
extensions.registerSingleton(opener.IOpenerService, openerService.OpenerService);
extensions.registerSingleton(clipboardService$1.IClipboardService, clipboardService.BrowserClipboardService);
extensions.registerSingleton(contextView.IContextMenuService, StandaloneContextMenuService);
extensions.registerSingleton(actions.IMenuService, menuService.MenuService);
exports.StandaloneServices = void 0;
(function(StandaloneServices) {
  const serviceCollection$1 = new serviceCollection.ServiceCollection();
  for (const [id, descriptor] of extensions.getSingletonServiceDescriptors()) {
    serviceCollection$1.set(id, descriptor);
  }
  const instantiationService$1 = new instantiationService.InstantiationService(serviceCollection$1, true);
  serviceCollection$1.set(instantiation.IInstantiationService, instantiationService$1);
  function get(serviceId) {
    const r = serviceCollection$1.get(serviceId);
    if (!r) {
      throw new Error("Missing service " + serviceId);
    }
    if (r instanceof descriptors.SyncDescriptor) {
      return instantiationService$1.invokeFunction((accessor) => accessor.get(serviceId));
    } else {
      return r;
    }
  }
  StandaloneServices.get = get;
  let initialized = false;
  function initialize(overrides) {
    if (initialized) {
      return instantiationService$1;
    }
    initialized = true;
    for (const [id, descriptor] of extensions.getSingletonServiceDescriptors()) {
      if (!serviceCollection$1.get(id)) {
        serviceCollection$1.set(id, descriptor);
      }
    }
    for (const serviceId in overrides) {
      if (overrides.hasOwnProperty(serviceId)) {
        const serviceIdentifier = instantiation.createDecorator(serviceId);
        const r = serviceCollection$1.get(serviceIdentifier);
        if (r instanceof descriptors.SyncDescriptor) {
          serviceCollection$1.set(serviceIdentifier, overrides[serviceId]);
        }
      }
    }
    return instantiationService$1;
  }
  StandaloneServices.initialize = initialize;
})(exports.StandaloneServices || (exports.StandaloneServices = {}));
exports.StandaloneConfigurationService = StandaloneConfigurationService;
exports.StandaloneNotificationService = StandaloneNotificationService;
exports.updateConfigurationService = updateConfigurationService;
