<script lang="ts">
import { page } from '$app/stores';
  import AppLayout from '$lib/components/layout/AppLayout.svelte';
  import { browser } from '$app/environment';
  import { initAuth } from '$lib/stores/auth';
  import '$lib/stores/layout';
  import '../app.css';

const publicPages = ['/login', '/auth'];
  $: shouldUseAppLayout = !publicPages.some((path) => $page.url.pathname.startsWith(path));

	if (browser) {
		initAuth();
	}
</script>

{#if shouldUseAppLayout}
	<AppLayout>
		<slot />
	</AppLayout>
{:else}
	<slot />
{/if}
