import { site } from './store.js';
import { esc } from './util.js';
const NAV = [
{ key: '', href: '#/', label: '总览' },
{ key: 'threads', href: '#/threads', label: '沿革' },
{ key: 'glossary', href: '#/glossary', label: '词典' },
];
function activeKey(path) {
const seg = path.split('/').filter(Boolean)[0] || '';
if (seg === 'dynasty') return '';
if (seg === 'thread') return 'threads';
return seg;
}
export function header(path) {
const s = site();
const key = activeKey(path);
const nav = NAV.map((item) => {
const cls = item.key === key ? ' class="active"' : '';
return `${item.label}`;
}).join('');
return `
`;
}
export function footer() {
return `
`;
}
export function shell(inner, path) {
return header(path) + `${inner}` + footer();
}