<template>
    <span>
		<HoverCard trigger-key="Ctrl" nuxt-client class="max-w-[600px] max-h-[600px] w-full overflow-auto z-[45]" :class="{'overflow-hidden !p-0': overview?.type === 'canvas'}" :disabled="!overview">
			<template #content>
				<Markdown v-if="overview?.type === 'markdown'" class="!px-6" :path="pathname" :filter="hash.substring(1)" popover />
				<template v-else-if="overview?.type === 'canvas'"><div class="w-[600px] h-[600px] relative"><Canvas :path="pathname" /></div></template>
			</template>
			<span>
                <span class="text-accent-blue inline-flex items-center cursor-pointer hover:text-opacity-85"><slot v-bind="$attrs"></slot></span>
			</span>
		</HoverCard>
	</span>
</template>

<script setup lang="ts">
import { parseURL } from 'ufo';

const { href } = defineProps<{
	href: string
	class?: string
}>();

const { hash, pathname } = parseURL(href);

const { content } = useContent();
const overview = computed(() => content.value.find(e => e.path === pathname));
</script>