<script lang="ts">
    import type { PageData } from './$types';
    import "../app.css";
    import { onMount } from 'svelte';
    interface Props {
        data: PageData;
        children?: import('svelte').Snippet;
    }

    let { data, children }: Props = $props();

    let loaded = $state(false);
    onMount(() => {
        const handleVisibilityChange = () => loaded = document.visibilityState === 'visible';
        document.addEventListener('visibilitychange', handleVisibilityChange);
        handleVisibilityChange();
    });
</script>

<svelte:head>
    <title>{data.title}</title>
    <meta name="description" content={data.quote} />
    <script defer src="https://a.satr14.my.id/script.js" data-website-id="6af23546-b65d-43d0-88cb-87fe863ea753"></script>
    <!-- <meta name="theme-color" content="#00e1ff" /> -->
</svelte:head>

{#if loaded}
    {@render children?.()}
{/if}