"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const errors = require("../../../base/common/errors.js");
const keybindingLabels = require("../../../base/common/keybindingLabels.js");
const keybindings = require("../../../base/common/keybindings.js");
class BaseResolvedKeybinding extends keybindings.ResolvedKeybinding {
  constructor(os, parts) {
    super();
    if (parts.length === 0) {
      throw errors.illegalArgument(`parts`);
    }
    this._os = os;
    this._parts = parts;
  }
  getLabel() {
    return keybindingLabels.UILabelProvider.toLabel(this._os, this._parts, (keybinding) => this._getLabel(keybinding));
  }
  getAriaLabel() {
    return keybindingLabels.AriaLabelProvider.toLabel(this._os, this._parts, (keybinding) => this._getAriaLabel(keybinding));
  }
  getElectronAccelerator() {
    if (this._parts.length > 1) {
      return null;
    }
    if (this._parts[0].isDuplicateModifierCase()) {
      return null;
    }
    return keybindingLabels.ElectronAcceleratorLabelProvider.toLabel(this._os, this._parts, (keybinding) => this._getElectronAccelerator(keybinding));
  }
  isChord() {
    return this._parts.length > 1;
  }
  getParts() {
    return this._parts.map((keybinding) => this._getPart(keybinding));
  }
  _getPart(keybinding) {
    return new keybindings.ResolvedKeybindingPart(keybinding.ctrlKey, keybinding.shiftKey, keybinding.altKey, keybinding.metaKey, this._getLabel(keybinding), this._getAriaLabel(keybinding));
  }
  getDispatchParts() {
    return this._parts.map((keybinding) => this._getDispatchPart(keybinding));
  }
  getSingleModifierDispatchParts() {
    return this._parts.map((keybinding) => this._getSingleModifierDispatchPart(keybinding));
  }
}
exports.BaseResolvedKeybinding = BaseResolvedKeybinding;
