"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const consts_1 = require("./consts");
/**
 * Holds the collection of selected predefined icons. Can be extended with more icons by the consumer.
 * When using icons, they will be checked in library before loading them from CDN.
 */
class IconsCache {
    constructor() {
        this.cache = new Map();
        this.add = (...icons) => {
            icons.forEach(icon => {
                this.cache.set(icon.name, icon);
            });
        };
        this.get = (name) => {
            const icon = this.cache.get(name);
            if (!icon) {
                /* eslint-disable-next-line no-console */
                console.error(`Icon ${name} does not exist in the library.`);
            }
            return icon;
        };
        this.has = (name) => {
            return this.cache.has(name);
        };
        this.init = () => {
            this.add(...Object.values(consts_1.defaultIcons));
        };
        this.reset = () => {
            this.cache.clear();
        };
    }
}
const cache = new IconsCache();
cache.init();
exports.default = cache;
//# sourceMappingURL=cache.js.map