"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Extensions = void 0;
const printTree_1 = require("tree-dump/lib/printTree");
class Extensions {
    constructor() {
        this.ext = {};
    }
    register(extension) {
        this.ext[extension.id] = extension;
    }
    get(id) {
        return this.ext[id];
    }
    size() {
        return Object.keys(this.ext).length;
    }
    clone() {
        const clone = new Extensions();
        for (const ext of Object.values(this.ext))
            clone.register(ext);
        return clone;
    }
    toString(tab = '') {
        const keys = Object.keys(this.ext)
            .map((k) => +k)
            .sort();
        return ('extensions' +
            (0, printTree_1.printTree)(tab, keys.map((k) => (tab) => `${k}: ${this.ext[k].name}`)));
    }
}
exports.Extensions = Extensions;
//# sourceMappingURL=Extensions.js.map