import { BlockType } from "../../models/index.js";
import { formatBlockName } from "../utils/index.js";
import DefaultPreview from "./previews/default-preview.js";
import HeaderBlock from "./previews/header-block.js";
const getBlockTemplate = (blockType) => import(`./templates/${blockType}.json`).then((data) => data.default);
const getBlockPreview = (blockType) => {
    try {
        if (blockType === BlockType.HeaderBlock) {
            return HeaderBlock;
        }
        return DefaultPreview;
    }
    catch (err) {
        /*eslint-disable no-console */
        console.warn(`Preview image for ${blockType} not found`);
        return DefaultPreview;
    }
};
async function getEditorBlocksData() {
    const EdiorBlockData = {};
    for (const blockType of Object.values(BlockType)) {
        const template = await getBlockTemplate(blockType);
        const preview = getBlockPreview(blockType);
        template.meta = template.meta || {};
        template.meta.title = template.meta.title || formatBlockName(blockType);
        EdiorBlockData[blockType] = {
            ...template,
            preview,
        };
    }
    return EdiorBlockData;
}
export { getEditorBlocksData };
//# sourceMappingURL=index.js.map
