import { UMB_BLOCK_GRID_PROPERTY_EDITOR_SCHEMA_ALIAS } from '../../../property-editors/constants.js';
import { UmbControllerBase } from '../../../../../../libs/class-api/index.js';
export class UmbBlockGridToGridBlockClipboardCopyPropertyValueTranslator extends UmbControllerBase {
    async translate(propertyValue) {
        if (!propertyValue) {
            throw new Error('Property value is missing.');
        }
        const valueClone = structuredClone(propertyValue);
        const layout = valueClone.layout?.[UMB_BLOCK_GRID_PROPERTY_EDITOR_SCHEMA_ALIAS] ?? undefined;
        const contentData = valueClone.contentData;
        const settingsData = valueClone.settingsData;
        if (!layout?.length) {
            throw new Error('No layouts found.');
        }
        layout?.forEach((layoutItem) => {
            // @ts-expect-error - We are removing the $type property from the layout item
            delete layoutItem.$type;
        });
        const gridBlockValue = {
            contentData,
            layout,
            settingsData,
        };
        return gridBlockValue;
    }
}
export { UmbBlockGridToGridBlockClipboardCopyPropertyValueTranslator as api };
