---
// Starlight's search (@astrojs/starlight 0.42.6, components/Search.astro),
// with one change: the Pagefind UI (ui-core.js, 26 KiB) loads when the
// reader reaches for search, a pointer on the button, focus on it, a tap,
// Ctrl+K, and not on idle on every page. It was a third of the home page's
// weight. The markup and the styles are Starlight's own.
import { Icon } from '@astrojs/starlight/components';
import project from 'virtual:starlight/project-context';
const pagefindTranslations = {
placeholder: Astro.locals.t('search.label'),
...Object.fromEntries(
Object.entries(Astro.locals.t.all())
.filter(([key]) => key.startsWith('pagefind.'))
.map(([key, value]) => [key.replace('pagefind.', ''), value])
),
};
const dataAttributes: DOMStringMap = { 'data-translations': JSON.stringify(pagefindTranslations) };
if (project.trailingSlash === 'never') dataAttributes['data-strip-trailing-slash'] = '';
---
{
/**
* This is intentionally inlined to avoid briefly showing an invalid shortcut.
* Purposely using the deprecated `navigator.platform` property to detect Apple devices, as the
* user agent is spoofed by some browsers when opening the devtools.
*/
}