{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "map-pin-board",
  "type": "registry:component",
  "title": "Map Pin Board",
  "description": "A flat stylized map with pulsing pins. Hovering or focusing a pin raises a floating card with its details; arrow keys move between pins.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "maps",
    "map",
    "pins",
    "markers",
    "tooltip",
    "places",
    "svg"
  ],
  "docs": "https://hyperblur.dev/effects/map-pin-board",
  "files": [
    {
      "path": "registry/hyperblur/map-pin-board.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/map-pin-board.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface MapPin {\n  id: string;\n  x: number;\n  y: number;\n  title: string;\n  subtitle?: string;\n  rating?: number;\n  meta?: string;\n  color?: string;\n}\n\nexport interface MapPinBoardProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"children\"> {\n  pins?: MapPin[];\n  accent?: string;\n  selectedId?: string | null;\n  defaultSelectedId?: string | null;\n  onPinSelect?: (pin: MapPin) => void;\n  label?: string;\n  seed?: number;\n}\n\nexport const defaultMapPins: MapPin[] = [\n  { id: \"lumen\", x: 22, y: 34, title: \"Lumen Roasters\", subtitle: \"Coffee · Open until 6 PM\", rating: 4.8, meta: \"3 min walk\" },\n  { id: \"pier\", x: 68, y: 28, title: \"Pier 9 Market\", subtitle: \"Food hall · Open now\", rating: 4.6, meta: \"7 min walk\" },\n  { id: \"halden\", x: 33, y: 76, title: \"Halden Books\", subtitle: \"Bookshop · Closes 8 PM\", rating: 4.9, meta: \"5 min walk\" },\n  { id: \"northgate\", x: 88, y: 82, title: \"Northgate Climbing\", subtitle: \"Gym · Open 24 hours\", rating: 4.7, meta: \"11 min walk\" },\n  { id: \"juniper\", x: 12, y: 66, title: \"Juniper Studio\", subtitle: \"Yoga · Next class 18:30\", rating: 4.9, meta: \"9 min walk\" },\n];\n\nfunction mix32(n: number) {\n  let x = n | 0;\n  x = Math.imul(x ^ (x >>> 16), 0x7feb352d);\n  x = Math.imul(x ^ (x >>> 15), 0x846ca68b);\n  x ^= x >>> 16;\n  return (x >>> 0) / 4294967296;\n}\n\nfunction rnd(seed: number, a: number, b = 0) {\n  return mix32(seed * 374761393 + a * 668265263 + b * 2246822519 + 1013904223);\n}\n\ntype Rect = { x: number; y: number; w: number; h: number; tone: number };\n\nfunction buildMap(seed: number) {\n  const xs = [0];\n  while (xs[xs.length - 1] < 400) xs.push(Math.min(400, xs[xs.length - 1] + 34 + Math.round(rnd(seed, xs.length, 1) * 20)));\n  const ys = [0];\n  while (ys[ys.length - 1] < 250) ys.push(Math.min(250, ys[ys.length - 1] + 28 + Math.round(rnd(seed, ys.length, 2) * 16)));\n  const blocks: Rect[] = [];\n  const parks: Rect[] = [];\n  const trees: [number, number][] = [];\n  const pc = 1 + Math.floor(rnd(seed, 3) * 2);\n  const pr = 1 + Math.floor(rnd(seed, 4) * 2);\n  for (let j = 0; j < ys.length - 1; j++) {\n    for (let i = 0; i < xs.length - 1; i++) {\n      const x = xs[i] + 3;\n      const y = ys[j] + 3;\n      const w = xs[i + 1] - xs[i] - 6;\n      const h = ys[j + 1] - ys[j] - 6;\n      if (w < 6 || h < 6) continue;\n      if (i >= pc && i < pc + 2 && j === pr) {\n        parks.push({ x, y, w, h, tone: 0 });\n        for (let q = 0; q < 7; q++) trees.push([x + 4 + rnd(seed, i * 50 + j, q) * (w - 8), y + 4 + rnd(seed, i * 50 + j, q + 20) * (h - 8)]);\n        continue;\n      }\n      const r = rnd(seed, i * 31 + j, 5);\n      const tone = rnd(seed, i * 31 + j, 6);\n      if (r < 0.4 && w > 30) {\n        const m = Math.round(w * (0.4 + rnd(seed, i, j) * 0.2));\n        blocks.push({ x, y, w: m - 2, h, tone }, { x: x + m + 2, y, w: w - m - 2, h, tone: rnd(seed, i * 31 + j, 7) });\n      } else if (r < 0.7 && h > 26) {\n        const m = Math.round(h * 0.5);\n        blocks.push({ x, y, w, h: m - 2, tone }, { x, y: y + m + 2, w, h: h - m - 2, tone: rnd(seed, i * 31 + j, 8) });\n      } else {\n        blocks.push({ x, y, w, h, tone });\n      }\n    }\n  }\n  const a = 150 + rnd(seed, 9) * 40;\n  const b = 110 + rnd(seed, 10) * 40;\n  const river = `M-20 ${(a + 30).toFixed(1)} C 90 ${(a + 50).toFixed(1)}, 150 ${(b - 20).toFixed(1)}, 230 ${b.toFixed(1)} S 360 ${(b + 70).toFixed(1)}, 420 ${(b + 40).toFixed(1)}`;\n  return { blocks, parks, trees, river, xs, ys };\n}\n\nconst css = `\n.hb-ub3 {\n  --hb-ub3-a: #2f7bff;\n  position: relative;\n  box-sizing: border-box;\n  width: 100%;\n  aspect-ratio: 16 / 10;\n  min-height: 170px;\n  overflow: hidden;\n  isolation: isolate;\n  border-radius: 14px;\n  border: 1px solid rgba(255, 255, 255, 0.09);\n  background: #0b0d12;\n  color: #ededed;\n  font-family: inherit;\n}\n.hb-ub3 *, .hb-ub3 *::before, .hb-ub3 *::after { box-sizing: border-box; }\n.hb-ub3-svg { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }\n.hb-ub3-shade {\n  position: absolute;\n  inset: 0;\n  pointer-events: none;\n  background: radial-gradient(120% 90% at 50% 45%, transparent 55%, rgba(5, 6, 9, 0.55));\n}\n.hb-ub3-chip {\n  position: absolute;\n  left: 10px;\n  top: 10px;\n  display: inline-flex;\n  align-items: center;\n  gap: 6px;\n  height: 22px;\n  padding: 0 9px;\n  border-radius: 999px;\n  background: rgba(9, 10, 13, 0.7);\n  border: 1px solid rgba(255, 255, 255, 0.08);\n  font: 600 8.5px/1 ui-monospace, SFMono-Regular, Menlo, monospace;\n  letter-spacing: 0.14em;\n  text-transform: uppercase;\n  color: #a1a1a1;\n  pointer-events: none;\n  z-index: 3;\n}\n.hb-ub3-chip::before { content: \"\"; width: 6px; height: 6px; border-radius: 50%; background: var(--hb-ub3-a); box-shadow: 0 0 8px var(--hb-ub3-a); }\n.hb-ub3-pin {\n  --hb-ub3-c: var(--hb-ub3-a);\n  position: absolute;\n  z-index: 1;\n  display: grid;\n  place-items: end center;\n  width: 30px;\n  height: 34px;\n  margin: 0;\n  padding: 0 0 2px;\n  border: 0;\n  background: none;\n  color: inherit;\n  cursor: pointer;\n  transform: translate(-50%, -100%);\n  -webkit-tap-highlight-color: transparent;\n}\n.hb-ub3-pin svg {\n  position: relative;\n  z-index: 1;\n  width: 18px;\n  height: 23px;\n  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.5));\n  transform-origin: 50% 100%;\n  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.2s ease;\n}\n.hb-ub3-pin:hover svg, .hb-ub3-pin:focus-visible svg, .hb-ub3-pin[data-on=\"true\"] svg {\n  transform: translateY(-3px) scale(1.18);\n  filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.55)) drop-shadow(0 0 10px color-mix(in srgb, var(--hb-ub3-c) 60%, transparent));\n}\n.hb-ub3-pin[data-on=\"true\"] { z-index: 2; }\n.hb-ub3-pin:focus-visible { outline: none; }\n.hb-ub3-pin:focus-visible::after {\n  content: \"\";\n  position: absolute;\n  inset: -2px;\n  border-radius: 10px;\n  box-shadow: 0 0 0 2px var(--hb-ub3-c);\n}\n.hb-ub3-ring {\n  position: absolute;\n  left: 50%;\n  bottom: -2px;\n  width: 22px;\n  height: 8px;\n  margin-left: -11px;\n  border-radius: 50%;\n  border: 1.5px solid var(--hb-ub3-c);\n  opacity: 0;\n  animation: hb-ub3-pulse 2.4s cubic-bezier(0.2, 0.7, 0.3, 1) infinite;\n  animation-delay: var(--hb-ub3-d, 0s);\n}\n.hb-ub3-base {\n  position: absolute;\n  left: 50%;\n  bottom: 0;\n  width: 8px;\n  height: 3px;\n  margin-left: -4px;\n  border-radius: 50%;\n  background: rgba(0, 0, 0, 0.6);\n}\n.hb-ub3-card {\n  position: absolute;\n  z-index: 4;\n  width: 176px;\n  padding: 9px 11px 10px;\n  border-radius: 12px;\n  background: rgba(17, 17, 17, 0.94);\n  border: 1px solid rgba(255, 255, 255, 0.1);\n  box-shadow: 0 14px 30px -10px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(0, 0, 0, 0.3);\n  -webkit-backdrop-filter: blur(12px);\n  backdrop-filter: blur(12px);\n  pointer-events: none;\n  animation: hb-ub3-in 0.26s cubic-bezier(0.2, 0.8, 0.2, 1) both;\n}\n.hb-ub3-card[data-v=\"above\"] { transform: translate(var(--hb-ub3-tx), calc(-100% - 32px)); }\n.hb-ub3-card[data-v=\"below\"] { transform: translate(var(--hb-ub3-tx), 10px); }\n.hb-ub3-card[data-h=\"start\"] { --hb-ub3-tx: -18px; }\n.hb-ub3-card[data-h=\"center\"] { --hb-ub3-tx: -50%; }\n.hb-ub3-card[data-h=\"end\"] { --hb-ub3-tx: calc(-100% + 18px); }\n.hb-ub3-ct { display: block; font-size: 12.5px; font-weight: 600; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }\n.hb-ub3-cs { display: block; margin-top: 2px; font-size: 10.5px; color: #a1a1a1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }\n.hb-ub3-cm { display: flex; align-items: center; gap: 8px; margin-top: 7px; font-size: 10.5px; color: #8f8f8f; white-space: nowrap; }\n.hb-ub3-cr { display: inline-flex; align-items: center; gap: 3px; color: #ededed; font-weight: 600; font-variant-numeric: tabular-nums; }\n.hb-ub3-cr svg { width: 10px; height: 10px; color: #ffc24d; }\n.hb-ub3-cb { width: 3px; height: 3px; border-radius: 50%; background: #5a5a5a; }\n@keyframes hb-ub3-pulse {\n  0% { opacity: 0.9; transform: scale(0.35); }\n  80% { opacity: 0; transform: scale(1.7); }\n  100% { opacity: 0; transform: scale(1.7); }\n}\n@keyframes hb-ub3-in {\n  from { opacity: 0; translate: 0 5px; }\n  to { opacity: 1; translate: 0 0; }\n}\n@media (prefers-reduced-motion: reduce) {\n  .hb-ub3-ring { animation: none; opacity: 0.5; transform: scale(1.1); }\n  .hb-ub3-card { animation: none; }\n  .hb-ub3-pin svg { transition: none; }\n}\n`;\n\nexport function MapPinBoard({\n  pins = defaultMapPins,\n  accent = \"#2f7bff\",\n  selectedId,\n  defaultSelectedId = null,\n  onPinSelect,\n  label = \"Places nearby\",\n  seed = 4,\n  className = \"\",\n  style,\n  ...rest\n}: MapPinBoardProps) {\n  const map = React.useMemo(() => buildMap(seed), [seed]);\n  const [innerSel, setInnerSel] = React.useState<string | null>(defaultSelectedId);\n  const [hover, setHover] = React.useState<string | null>(null);\n  const [focus, setFocus] = React.useState<string | null>(null);\n  const refs = React.useRef(new Map<string, HTMLButtonElement>());\n  const uid = React.useId();\n  const sel = selectedId === undefined ? innerSel : selectedId;\n  const activeId = hover ?? focus ?? sel;\n  const active = pins.find((p) => p.id === activeId) ?? null;\n  const order = React.useMemo(() => pins.slice().sort((a, b) => a.x - b.x || a.y - b.y).map((p) => p.id), [pins]);\n\n  const choose = (pin: MapPin) => {\n    if (selectedId === undefined) setInnerSel(pin.id);\n    onPinSelect?.(pin);\n  };\n\n  const onKey = (e: React.KeyboardEvent<HTMLButtonElement>, pin: MapPin) => {\n    if (e.key === \"Escape\") {\n      e.preventDefault();\n      setHover(null);\n      setFocus(null);\n      if (selectedId === undefined) setInnerSel(null);\n      return;\n    }\n    const keys: Record<string, number> = { ArrowRight: 1, ArrowDown: 1, ArrowLeft: -1, ArrowUp: -1 };\n    let next = -2;\n    const at = order.indexOf(pin.id);\n    if (e.key in keys) next = (at + keys[e.key] + order.length) % order.length;\n    else if (e.key === \"Home\") next = 0;\n    else if (e.key === \"End\") next = order.length - 1;\n    if (next < 0) return;\n    e.preventDefault();\n    refs.current.get(order[next])?.focus();\n  };\n\n  const vPos = active && active.y < 52 ? \"below\" : \"above\";\n  const hPos = active ? (active.x < 26 ? \"start\" : active.x > 74 ? \"end\" : \"center\") : \"center\";\n  const cardId = `${uid}-card`;\n\n  return (\n    <div\n      className={`hb-ub3 ${className}`.trim()}\n      style={{ \"--hb-ub3-a\": accent, ...style } as React.CSSProperties}\n      role=\"group\"\n      aria-label={label}\n      {...rest}\n    >\n      <style href=\"hb-map-pin-board\" precedence=\"default\">\n        {css}\n      </style>\n      <svg className=\"hb-ub3-svg\" viewBox=\"0 0 400 250\" preserveAspectRatio=\"xMidYMid slice\" aria-hidden=\"true\">\n        <rect width=\"400\" height=\"250\" fill=\"#0b0d12\" />\n        {map.blocks.map((b, i) => (\n          <rect\n            key={i}\n            x={b.x}\n            y={b.y}\n            width={b.w}\n            height={b.h}\n            rx=\"2\"\n            fill={b.tone > 0.82 ? \"#1b2029\" : b.tone > 0.4 ? \"#161a22\" : \"#14171e\"}\n          />\n        ))}\n        {map.parks.map((p, i) => (\n          <rect key={i} x={p.x} y={p.y} width={p.w} height={p.h} rx=\"4\" fill=\"#12271f\" />\n        ))}\n        {map.trees.map(([x, y], i) => (\n          <circle key={i} cx={x.toFixed(1)} cy={y.toFixed(1)} r=\"2.4\" fill=\"#1d4434\" />\n        ))}\n        <path d=\"M-10 40 L 410 176\" stroke=\"#0b0d12\" strokeWidth=\"9\" />\n        <path d=\"M-10 40 L 410 176\" stroke=\"#242a35\" strokeWidth=\"0.8\" strokeDasharray=\"4 5\" />\n        <path d={map.river} fill=\"none\" stroke=\"#0d2038\" strokeWidth=\"22\" strokeLinecap=\"round\" />\n        <path d={map.river} fill=\"none\" stroke=\"#123056\" strokeWidth=\"16\" strokeLinecap=\"round\" />\n        <path d={map.river} fill=\"none\" stroke=\"#1d4a80\" strokeWidth=\"0.8\" strokeOpacity=\"0.6\" strokeDasharray=\"10 14\" />\n        <g fill=\"#4a5162\" fontSize=\"6.5\" letterSpacing=\"1.4\" fontFamily=\"ui-monospace, SFMono-Regular, Menlo, monospace\">\n          <text x={map.xs[2] + 6} y={map.ys[1] - 0.5}>HARBOR AVE</text>\n          <text x={map.xs[5] + 6} y={map.ys[4] - 0.5}>KESTREL ST</text>\n          <text x=\"300\" y=\"196\" fill=\"#2d5d93\">ALDER RIVER</text>\n        </g>\n      </svg>\n      <div className=\"hb-ub3-shade\" />\n      <span className=\"hb-ub3-chip\">{label}</span>\n      {pins.map((pin, i) => {\n        const on = activeId === pin.id;\n        return (\n          <button\n            key={pin.id}\n            ref={(el) => {\n              if (el) refs.current.set(pin.id, el);\n              else refs.current.delete(pin.id);\n            }}\n            type=\"button\"\n            className=\"hb-ub3-pin\"\n            data-on={on ? \"true\" : \"false\"}\n            aria-label={pin.subtitle ? `${pin.title}, ${pin.subtitle}` : pin.title}\n            aria-pressed={sel === pin.id}\n            aria-describedby={on ? cardId : undefined}\n            style={\n              {\n                left: `${pin.x}%`,\n                top: `${pin.y}%`,\n                \"--hb-ub3-c\": pin.color ?? accent,\n                \"--hb-ub3-d\": `${((i * 0.47) % 2.4).toFixed(2)}s`,\n              } as React.CSSProperties\n            }\n            onPointerEnter={() => setHover(pin.id)}\n            onPointerLeave={() => setHover((h) => (h === pin.id ? null : h))}\n            onFocus={() => setFocus(pin.id)}\n            onBlur={() => setFocus((f) => (f === pin.id ? null : f))}\n            onClick={() => choose(pin)}\n            onKeyDown={(e) => onKey(e, pin)}\n          >\n            <span className=\"hb-ub3-ring\" />\n            <span className=\"hb-ub3-base\" />\n            <svg viewBox=\"0 0 24 30\" aria-hidden=\"true\">\n              <path d=\"M12 0C5.4 0 0 5.2 0 11.6 0 20 12 30 12 30s12-10 12-18.4C24 5.2 18.6 0 12 0Z\" fill=\"var(--hb-ub3-c)\" />\n              <path d=\"M12 1.2C6 1.2 1.2 5.9 1.2 11.6\" fill=\"none\" stroke=\"#fff\" strokeOpacity=\"0.35\" strokeWidth=\"1.2\" />\n              <circle cx=\"12\" cy=\"11.5\" r=\"4.2\" fill=\"#fff\" />\n            </svg>\n          </button>\n        );\n      })}\n      {active ? (\n        <div\n          key={active.id}\n          id={cardId}\n          role=\"tooltip\"\n          className=\"hb-ub3-card\"\n          data-v={vPos}\n          data-h={hPos}\n          style={{ left: `${active.x}%`, top: `${active.y}%` }}\n        >\n          <span className=\"hb-ub3-ct\">{active.title}</span>\n          {active.subtitle ? <span className=\"hb-ub3-cs\">{active.subtitle}</span> : null}\n          {active.rating !== undefined || active.meta ? (\n            <span className=\"hb-ub3-cm\">\n              {active.rating !== undefined ? (\n                <span className=\"hb-ub3-cr\">\n                  <svg viewBox=\"0 0 12 12\" fill=\"currentColor\" aria-hidden=\"true\">\n                    <path d=\"M6 .8l1.6 3.3 3.6.5-2.6 2.5.6 3.6L6 9l-3.2 1.7.6-3.6L.8 4.6l3.6-.5Z\" />\n                  </svg>\n                  {active.rating.toFixed(1)}\n                </span>\n              ) : null}\n              {active.rating !== undefined && active.meta ? <span className=\"hb-ub3-cb\" /> : null}\n              {active.meta ? <span>{active.meta}</span> : null}\n            </span>\n          ) : null}\n        </div>\n      ) : null}\n    </div>\n  );\n}\n"
    }
  ]
}