/** * AI Intel pin icons — teardrop SVG data URIs per category. * * These are registered with MapLibre via `map.addImage()` during init and * referenced from the ai-intel-pin-layer via the `icon-image` layout prop. */ import { PIN_CATEGORY_COLORS, type PinCategory } from '@/types/aiIntel'; /** Classic teardrop pin shape with a white dot in the head. */ function buildPinSvg(color: string): string { const svg = ` `; return `data:image/svg+xml;charset=utf-8,${encodeURIComponent(svg)}`; } /** Map image-id used in the layer's icon-image expression. */ export const pinIconId = (category: PinCategory): string => `ai-pin-${category}`; /** Generate every category's pin icon as a [id, dataURI] pair. */ export function getAllPinIcons(): Array<[string, string]> { return (Object.keys(PIN_CATEGORY_COLORS) as PinCategory[]).map((cat) => [ pinIconId(cat), buildPinSvg(PIN_CATEGORY_COLORS[cat]), ]); }