<script lang="ts">
	import { setContext, untrack } from "svelte";
	import type { Snippet } from "svelte";
	import { AUTH_KEY, createAuth } from "$lib/auth.svelte";

	interface Props {
		initial?: { did: string; handle: string } | null;
		children: Snippet;
	}

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

	setContext(
		AUTH_KEY,
		createAuth(
			"https://bobbin.example.test",
			untrack(() => initial)
		)
	);
</script>

{@render children()}
