"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const dom = require("../../../base/browser/dom.js");
const event = require("../../../base/common/event.js");
const lifecycle = require("../../../base/common/lifecycle.js");
const keybinding = require("../../keybinding/common/keybinding.js");
const notification = require("../../notification/common/notification.js");
const telemetry = require("../../telemetry/common/telemetry.js");
const themeService = require("../../theme/common/themeService.js");
const contextMenuHandler = require("./contextMenuHandler.js");
const contextView = require("./contextView.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);
  };
};
exports.ContextMenuService = class ContextMenuService extends lifecycle.Disposable {
  constructor(telemetryService, notificationService, contextViewService, keybindingService, themeService2) {
    super();
    this._onDidShowContextMenu = new event.Emitter();
    this._onDidHideContextMenu = new event.Emitter();
    this.contextMenuHandler = new contextMenuHandler.ContextMenuHandler(contextViewService, telemetryService, notificationService, keybindingService, themeService2);
  }
  configure(options) {
    this.contextMenuHandler.configure(options);
  }
  // ContextMenu
  showContextMenu(delegate) {
    this.contextMenuHandler.showContextMenu(Object.assign(Object.assign({}, delegate), { onHide: (didCancel) => {
      if (delegate.onHide) {
        delegate.onHide(didCancel);
      }
      this._onDidHideContextMenu.fire();
    } }));
    dom.ModifierKeyEmitter.getInstance().resetKeyStatus();
    this._onDidShowContextMenu.fire();
  }
};
exports.ContextMenuService = __decorate([
  __param(0, telemetry.ITelemetryService),
  __param(1, notification.INotificationService),
  __param(2, contextView.IContextViewService),
  __param(3, keybinding.IKeybindingService),
  __param(4, themeService.IThemeService)
], exports.ContextMenuService);
