<script lang="ts">
	import type { StrapiComponentUnion } from '$lib/types/strapi';
	import { cmsComponentMapping, mapComponentData } from '$lib/mapping/strapiMapping.svelte';

	/** @type {{ data: import('$lib/types/strapi/collection-types/page.js').Component}}  */
	let data: StrapiComponentUnion = $props();

	let component = cmsComponentMapping[data.__component];
	let componentData = mapComponentData(data)
</script>

{#if component}
	{#await component then { default: Component }}
		<Component {...componentData} />
	{/await}
{/if}
