<!-- This file is generated by @sveltejs/kit — do not edit it! -->
<svelte:options runes={true} />
<script>
	import { setContext, onMount, tick } from 'svelte';
	import { browser } from '$app/env';

	// stores
	let { stores, page, constructors, components = [], form, errors = [], error, data_0 = null, data_1 = null } = $props();
	let data = $derived({'0': data_0, '1': data_1})

	if (browser) {
		$effect.pre(() => stores.page.set(page));
	} else {
		// svelte-ignore state_referenced_locally
		setContext('__svelte__', stores);
		// svelte-ignore state_referenced_locally
		stores.page.set(page);
	}

	$effect(() => {
		stores;page;constructors;components;form;errors;error;data_0;data_1;
		stores.page.notify();
	});

	let mounted = $state(false);
	let navigated = $state(false);
	let title = $state(null);

	onMount(() => {
		const unsubscribe = stores.page.subscribe(() => {
			if (mounted) {
				navigated = true;
				tick().then(() => {
					title = document.title || 'untitled page';
				});
			}
		});

		mounted = true;
		return unsubscribe;
	});

	const Pyramid_1 = $derived(constructors[1]);
</script>

{#snippet pyramid(depth)}
	{@const Pyramid = constructors[depth]}
	{#snippet failed(error)}
		{@const ErrorPage = errors[depth]}
		<ErrorPage {error} />
	{/snippet}
	<svelte:boundary failed={errors[depth] ? failed : undefined}>
		{#if constructors[depth + 1]}
			{@const d = data[depth]}
			<!-- svelte-ignore binding_property_non_reactive -->
			<Pyramid bind:this={components[depth]} data={d} {form} params={page.params}>
				{@render pyramid(depth + 1)}
			</Pyramid>
		{:else}
			{@const d = data[depth]}
			<!-- svelte-ignore binding_property_non_reactive -->
			<Pyramid bind:this={components[depth]} data={d} {form} params={page.params} {error} />
		{/if}
	</svelte:boundary>
{/snippet}

{@render pyramid(0)}

{#if mounted}
	<div id="svelte-announcer" aria-live="assertive" aria-atomic="true" style="position: absolute; left: 0; top: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; width: 1px; height: 1px">
		{#if navigated}
			{title}
		{/if}
	</div>
{/if}