---
import Base from '../layouts/Base.astro';
import Branch from '../components/Branch.astro';
import { SITE_TITLE, SITE_DESCRIPTION } from '../consts';
import { buildBonsai } from '../wikibonsai/semtree';

const bonsai = await buildBonsai();
const root = bonsai ? bonsai.root : '';
const treeNodes = bonsai ? bonsai.nodes : [];
---

<Base title={`Map — ${SITE_TITLE}`} description={SITE_DESCRIPTION}>
  <div class="max-w-3xl mx-auto">
    <h1 class="text-3xl font-bold mb-6" style="color: var(--text-primary)">Tag Map</h1>
    <div class="prose-wiki">
      <Branch nodes={treeNodes.filter(tn => tn.text === root)} />
    </div>
  </div>
</Base>
