// SearchPanel - slide-in right panel of search-result cards. // Clicking a card highlights the matching org in the current view. function SearchPanel({ query, results, highlightOrgId, onPick, onOpen, onClose, facets }) { const q = (query || '').trim(); const typeLabel = (t) => (facets?.types?.labels?.[t]) || t; const Highlight = ({ text }) => { if (!q || !text) return text || ''; const lower = text.toLowerCase(); const needle = q.toLowerCase(); const i = lower.indexOf(needle); if (i < 0) return text; return ( <> {text.slice(0, i)} {text.slice(i, i + q.length)} {text.slice(i + q.length)} ); }; return ( ); } window.SearchPanel = SearchPanel;