import { defaultIcons } from './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 {
    cache = new Map();
    add = (...icons) => {
        icons.forEach(icon => {
            this.cache.set(icon.name, icon);
        });
    };
    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;
    };
    has = (name) => {
        return this.cache.has(name);
    };
    init = () => {
        this.add(...Object.values(defaultIcons));
    };
    reset = () => {
        this.cache.clear();
    };
}
const cache = new IconsCache();
cache.init();
export default cache;
//# sourceMappingURL=cache.js.map