"use strict";
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __decorate = (this && this.__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 __values = (this && this.__values) || function(o) {
    var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
    if (m) return m.call(o);
    if (o && typeof o.length === "number") return {
        next: function () {
            if (o && i >= o.length) o = void 0;
            return { value: o && o[i++], done: !o };
        }
    };
    throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.KeybindingRegistry = void 0;
var inversify_1 = require("inversify");
var command_1 = require("@theia/core/lib/common/command");
var keybinding_1 = require("@theia/core/lib/common/keybinding");
var keybinding_2 = require("@theia/core/lib/browser/keybinding");
var KeybindingRegistry = /** @class */ (function (_super) {
    __extends(KeybindingRegistry, _super);
    function KeybindingRegistry() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    KeybindingRegistry.prototype.unregisterKeybinding = function (arg) {
        var e_1, _a;
        var keymap = this.keymaps[keybinding_2.KeybindingScope.DEFAULT];
        var filter = command_1.Command.is(arg)
            ? function (_a) {
                var command = _a.command;
                return command === arg.id;
            }
            : function (_a) {
                var keybinding = _a.keybinding;
                return keybinding_1.Keybinding.is(arg)
                    ? keybinding === arg.keybinding
                    : keybinding === arg;
            };
        try {
            for (var _b = __values(keymap.filter(filter)), _c = _b.next(); !_c.done; _c = _b.next()) {
                var binding = _c.value;
                var idx = keymap.indexOf(binding);
                if (idx !== -1) {
                    keymap.splice(idx, 1);
                }
            }
        }
        catch (e_1_1) { e_1 = { error: e_1_1 }; }
        finally {
            try {
                if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
            }
            finally { if (e_1) throw e_1.error; }
        }
    };
    KeybindingRegistry = __decorate([
        inversify_1.injectable()
    ], KeybindingRegistry);
    return KeybindingRegistry;
}(keybinding_2.KeybindingRegistry));
exports.KeybindingRegistry = KeybindingRegistry;
//# sourceMappingURL=keybindings.js.map