{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "hero-dot-torus",
  "type": "registry:component",
  "title": "Hero Dot Torus",
  "description": "A huge solid-vermilion torus built from chunky cream and white square dots, rocking and looping across the block, with the headline on a solid ink panel; left brand with plain right links.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "hero",
    "hero",
    "torus",
    "mobius",
    "canvas",
    "dots"
  ],
  "docs": "https://hyperblur.dev/effects/hero-dot-torus",
  "files": [
    {
      "path": "registry/hyperblur/hero-dot-torus.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/hero-dot-torus.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface HeroDotTorusLink {\n  label: string;\n  href: string;\n}\n\nexport type HeroDotTorusShape = \"torus\" | \"mobius\";\n\nexport interface HeroDotTorusProps extends Omit<React.HTMLAttributes<HTMLElement>, \"title\"> {\n  title?: string;\n  subtitle?: string;\n  caption?: string;\n  command?: string;\n  primaryCta?: HeroDotTorusLink | null;\n  brand?: string;\n  nav?: HeroDotTorusLink[];\n  navCta?: HeroDotTorusLink | null;\n  learnMore?: HeroDotTorusLink | null;\n  accent?: string;\n  density?: number;\n  speed?: number;\n  shape?: HeroDotTorusShape;\n  headingAs?: \"h1\" | \"h2\";\n  onSearch?: () => void;\n}\n\nconst css = `\n@keyframes hb-hh5-up {\n  from { opacity: 0; transform: translate3d(0, 16px, 0); }\n  to { opacity: 1; transform: translate3d(0, 0, 0); }\n}\n.hb-hh5 {\n  --hb-hh5-accent: #ffe6c4;\n  --hb-hh5-ink: #1a0a05;\n  --hb-hh5-mono: var(--font-mono, ui-monospace), \"Geist Mono\", SFMono-Regular, Menlo, Consolas, monospace;\n  position: relative;\n  isolation: isolate;\n  box-sizing: border-box;\n  display: flex;\n  flex-direction: column;\n  width: 100%;\n  min-height: 640px;\n  overflow: hidden;\n  container-type: inline-size;\n  background: #ff4a1c;\n  color: #1a0a05;\n  font-family: inherit;\n  -webkit-font-smoothing: antialiased;\n}\n.hb-hh5 *, .hb-hh5 *::before, .hb-hh5 *::after { box-sizing: border-box; }\n.hb-hh5-canvas {\n  position: absolute;\n  inset: 0;\n  z-index: 0;\n  display: block;\n  width: 100%;\n  height: 100%;\n  pointer-events: none;\n}\n.hb-hh5-bar {\n  position: relative;\n  z-index: 3;\n  display: flex;\n  align-items: center;\n  justify-content: space-between;\n  gap: 16px;\n  padding: 26px clamp(20px, 4cqw, 56px) 0;\n}\n.hb-hh5-brand {\n  display: inline-flex;\n  align-items: center;\n  gap: 10px;\n  color: #1a0a05;\n  font-size: 21px;\n  font-weight: 800;\n  letter-spacing: -0.03em;\n  text-decoration: none;\n}\n.hb-hh5-right {\n  display: flex;\n  align-items: center;\n  gap: clamp(14px, 2.4cqw, 34px);\n}\n.hb-hh5-links {\n  display: flex;\n  align-items: center;\n  gap: clamp(14px, 2.4cqw, 34px);\n  margin: 0;\n  padding: 0;\n  list-style: none;\n}\n.hb-hh5-link, .hb-hh5-search {\n  appearance: none;\n  display: inline-flex;\n  align-items: center;\n  border: 0;\n  background: none;\n  padding: 4px 0;\n  color: #1a0a05;\n  font: inherit;\n  font-size: 15px;\n  font-weight: 650;\n  white-space: nowrap;\n  text-decoration: none;\n  cursor: pointer;\n  background-image: linear-gradient(currentColor, currentColor);\n  background-repeat: no-repeat;\n  background-position: 0 100%;\n  background-size: 0 2px;\n  transition: background-size 0.22s ease;\n}\n.hb-hh5-link:hover, .hb-hh5-search:hover { background-size: 100% 2px; }\n.hb-hh5-link:focus-visible, .hb-hh5-search:focus-visible, .hb-hh5-cta:focus-visible, .hb-hh5-copybtn:focus-visible, .hb-hh5-more:focus-visible, .hb-hh5-brand:focus-visible {\n  outline: 2px solid #1a0a05;\n  outline-offset: 3px;\n  border-radius: 8px;\n}\n.hb-hh5-panel a:focus-visible, .hb-hh5-panel button:focus-visible { outline-color: #ffe6c4; }\n.hb-hh5-foot {\n  position: relative;\n  z-index: 2;\n  display: flex;\n  flex-direction: column;\n  gap: clamp(18px, 2.4cqw, 30px);\n  margin-top: auto;\n  padding: 0 clamp(20px, 4cqw, 56px) clamp(26px, 3.4cqw, 48px);\n  pointer-events: none;\n}\n.hb-hh5-foot a, .hb-hh5-foot button, .hb-hh5-foot code { pointer-events: auto; }\n.hb-hh5-panel {\n  display: flex;\n  flex-direction: column;\n  gap: clamp(18px, 2.4cqw, 30px);\n  width: fit-content;\n  max-width: min(100%, 60cqw);\n  padding: clamp(20px, 2.4cqw, 34px);\n  border-radius: 8px;\n  background: #1a0a05;\n  color: #ffe6c4;\n  pointer-events: auto;\n}\n.hb-hh5-title {\n  max-width: 11ch;\n  margin: 0;\n  color: #ffe6c4;\n  font-size: clamp(50px, 7.6cqw, 140px);\n  font-weight: 800;\n  line-height: 0.88;\n  letter-spacing: -0.055em;\n  text-wrap: balance;\n  animation: hb-hh5-up 0.8s 0.1s cubic-bezier(0.2, 0.7, 0.2, 1) both;\n}\n.hb-hh5-lower {\n  display: flex;\n  flex-wrap: wrap;\n  align-items: flex-end;\n  justify-content: space-between;\n  gap: 22px 40px;\n  animation: hb-hh5-up 0.8s 0.25s cubic-bezier(0.2, 0.7, 0.2, 1) both;\n}\n.hb-hh5-sub {\n  max-width: 30ch;\n  margin: 0;\n  color: #ffe6c4;\n  font-size: clamp(16px, 1.4cqw, 20px);\n  font-weight: 550;\n  line-height: 1.4;\n}\n.hb-hh5-side {\n  display: flex;\n  flex-direction: column;\n  align-items: flex-start;\n  gap: 14px;\n}\n.hb-hh5-caption {\n  margin: 0;\n  color: #ffe6c4;\n  font-family: var(--hb-hh5-mono);\n  font-size: 12px;\n  font-weight: 600;\n  letter-spacing: 0.06em;\n  text-transform: uppercase;\n}\n.hb-hh5-row {\n  display: flex;\n  flex-wrap: wrap;\n  align-items: center;\n  gap: 12px;\n}\n.hb-hh5-cmd {\n  display: inline-flex;\n  align-items: center;\n  gap: 10px;\n  max-width: 100%;\n  padding: 6px 6px 6px 14px;\n  border: 2px solid #ffe6c4;\n  border-radius: 8px;\n  background: transparent;\n  color: #ffe6c4;\n  font-family: var(--hb-hh5-mono);\n  font-size: 13px;\n}\n.hb-hh5-prompt { opacity: 0.6; }\n.hb-hh5-code { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.hb-hh5-copybtn {\n  appearance: none;\n  display: grid;\n  place-items: center;\n  width: 32px;\n  height: 32px;\n  flex: none;\n  border: 0;\n  border-radius: 6px;\n  background: #ffe6c4;\n  color: #1a0a05;\n  cursor: pointer;\n  transition: transform 0.18s ease;\n}\n.hb-hh5-copybtn:hover { transform: translateY(-1px); }\n.hb-hh5-cta {\n  display: inline-flex;\n  align-items: center;\n  gap: 8px;\n  padding: 14px 22px;\n  border: 2px solid #ff4a1c;\n  border-radius: 8px;\n  background: #ff4a1c;\n  color: #1a0a05;\n  font-size: 15px;\n  font-weight: 700;\n  text-decoration: none;\n  transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease;\n}\n.hb-hh5-cta:hover { background: transparent; color: #ff4a1c; border-color: #ff4a1c; }\n.hb-hh5-more {\n  display: inline-flex;\n  align-items: center;\n  gap: 6px;\n  color: #ffe6c4;\n  font-size: 14px;\n  font-weight: 700;\n  text-decoration: underline;\n  text-underline-offset: 4px;\n  text-decoration-thickness: 2px;\n}\n.hb-hh5-sr {\n  position: absolute;\n  width: 1px;\n  height: 1px;\n  overflow: hidden;\n  clip: rect(0 0 0 0);\n  white-space: nowrap;\n}\n@container (max-width: 720px) {\n  .hb-hh5 { min-height: 720px; }\n  .hb-hh5-bar { padding-top: 20px; }\n  .hb-hh5-brand { font-size: 18px; }\n  .hb-hh5-link, .hb-hh5-search { font-size: 13px; }\n  .hb-hh5-right { gap: 14px; }\n  .hb-hh5-links { gap: 14px; }\n  .hb-hh5-title { max-width: 9ch; font-size: clamp(46px, 15.5cqw, 90px); }\n  .hb-hh5-lower { flex-direction: column; align-items: flex-start; }\n  .hb-hh5-panel { width: 100%; max-width: 100%; }\n  .hb-hh5-cmd { font-size: 12px; }\n}\n@media (prefers-reduced-motion: reduce) {\n  .hb-hh5-title, .hb-hh5-lower { animation: none; }\n  .hb-hh5-link, .hb-hh5-search, .hb-hh5-copybtn, .hb-hh5-cta { transition: none; }\n}\n`;\n\nconst defaultNav: HeroDotTorusLink[] = [\n  { label: \"Product\", href: \"#\" },\n  { label: \"Pricing\", href: \"#\" },\n  { label: \"Docs\", href: \"#\" },\n];\nconst defaultNavCta: HeroDotTorusLink = { label: \"Log in\", href: \"#\" };\nconst defaultPrimary: HeroDotTorusLink = { label: \"Start free\", href: \"#\" };\nconst defaultMore: HeroDotTorusLink = { label: \"How it works\", href: \"#\" };\n\nconst TAU = Math.PI * 2;\nconst LAYERS = 18;\nconst TONES = 3;\n\nfunction hash(n: number, salt: number) {\n  const s = Math.sin(n * 127.1 + salt * 311.7) * 43758.5453;\n  return s - Math.floor(s);\n}\n\nfunction smooth(x: number) {\n  if (x <= 0) return 0;\n  if (x >= 1) return 1;\n  return x * x * (3 - 2 * x);\n}\n\nfunction hexRgb(value: string): [number, number, number] | null {\n  const m = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(value.trim());\n  if (!m) return null;\n  let h = m[1];\n  if (h.length === 3) h = h.split(\"\").map((c) => c + c).join(\"\");\n  return [parseInt(h.slice(0, 2), 16), parseInt(h.slice(2, 4), 16), parseInt(h.slice(4, 6), 16)];\n}\n\nfunction toColor(value: string, ctx: CanvasRenderingContext2D) {\n  const hex = hexRgb(value);\n  if (hex) return value;\n  ctx.fillStyle = \"#ffe6c4\";\n  ctx.fillStyle = value;\n  return String(ctx.fillStyle);\n}\n\nfunction Mark() {\n  return (\n    <svg width=\"22\" height=\"22\" viewBox=\"0 0 22 22\" aria-hidden=\"true\">\n      <rect x=\"1\" y=\"1\" width=\"9\" height=\"9\" fill=\"#1a0a05\" />\n      <rect x=\"12\" y=\"1\" width=\"9\" height=\"9\" fill=\"#ffe6c4\" stroke=\"#1a0a05\" strokeWidth=\"2\" />\n      <rect x=\"1\" y=\"12\" width=\"9\" height=\"9\" fill=\"#ffe6c4\" stroke=\"#1a0a05\" strokeWidth=\"2\" />\n      <rect x=\"12\" y=\"12\" width=\"9\" height=\"9\" fill=\"#1a0a05\" />\n    </svg>\n  );\n}\n\ninterface Model {\n  px: Float32Array;\n  py: Float32Array;\n  pz: Float32Array;\n  nx: Float32Array;\n  ny: Float32Array;\n  nz: Float32Array;\n  seed: Float32Array;\n  count: number;\n}\n\nfunction buildModel(mobius: boolean, nuMax: number): Model {\n  const R = 1;\n  const r = 0.34;\n  const xs: number[] = [];\n  const ys: number[] = [];\n  const zs: number[] = [];\n  const ns: number[] = [];\n  const point = (u: number, v: number, out: number[]) => {\n    if (mobius) {\n      const w = 0.52 * v;\n      const k = R + w * Math.cos(u / 2);\n      out[0] = k * Math.cos(u);\n      out[1] = k * Math.sin(u);\n      out[2] = w * Math.sin(u / 2);\n    } else {\n      const k = R + r * Math.cos(v);\n      out[0] = k * Math.cos(u);\n      out[1] = k * Math.sin(u);\n      out[2] = r * Math.sin(v);\n    }\n  };\n  const a = [0, 0, 0];\n  const b = [0, 0, 0];\n  const c = [0, 0, 0];\n  const push = (u: number, v: number) => {\n    const e = 0.002;\n    point(u, v, a);\n    point(u + e, v, b);\n    point(u, v + e, c);\n    const ux = b[0] - a[0];\n    const uy = b[1] - a[1];\n    const uz = b[2] - a[2];\n    const vx = c[0] - a[0];\n    const vy = c[1] - a[1];\n    const vz = c[2] - a[2];\n    let nx = uy * vz - uz * vy;\n    let ny = uz * vx - ux * vz;\n    let nz = ux * vy - uy * vx;\n    const len = Math.hypot(nx, ny, nz) || 1;\n    nx /= len;\n    ny /= len;\n    nz /= len;\n    if (!mobius) {\n      const kk = R + r * Math.cos(v);\n      const ox = kk * Math.cos(u);\n      const oy = kk * Math.sin(u);\n      const outward = nx * (a[0] - R * Math.cos(u)) + ny * (a[1] - R * Math.sin(u)) + nz * a[2];\n      void ox;\n      void oy;\n      if (outward < 0) {\n        nx = -nx;\n        ny = -ny;\n        nz = -nz;\n      }\n    }\n    xs.push(a[0]);\n    ys.push(a[1]);\n    zs.push(a[2]);\n    ns.push(nx, ny, nz);\n  };\n  if (mobius) {\n    const rows = Math.max(8, Math.round(nuMax * 0.2));\n    for (let j = 0; j < rows; j++) {\n      const v = -1 + ((j + 0.5) / rows) * 2;\n      const n = nuMax;\n      for (let i = 0; i < n; i++) push(((i + (j % 2) * 0.5) / n) * TAU, v);\n    }\n  } else {\n    const rings = Math.max(10, Math.round(nuMax * 0.3));\n    for (let j = 0; j < rings; j++) {\n      const v = (j / rings) * TAU;\n      const n = Math.max(6, Math.round((nuMax * (R + r * Math.cos(v))) / (R + r)));\n      const off = hash(j, 5);\n      for (let i = 0; i < n; i++) push(((i + off) / n) * TAU, v);\n    }\n  }\n  const count = xs.length;\n  const m: Model = {\n    px: Float32Array.from(xs),\n    py: Float32Array.from(ys),\n    pz: Float32Array.from(zs),\n    nx: new Float32Array(count),\n    ny: new Float32Array(count),\n    nz: new Float32Array(count),\n    seed: new Float32Array(count),\n    count,\n  };\n  for (let k = 0; k < count; k++) {\n    m.nx[k] = ns[k * 3];\n    m.ny[k] = ns[k * 3 + 1];\n    m.nz[k] = ns[k * 3 + 2];\n    m.seed[k] = hash(k, 9);\n  }\n  return m;\n}\n\nexport function HeroDotTorus({\n  title = \"Every event, one loop.\",\n  subtitle = \"Stream, retry and replay through one continuous pipeline that never stalls.\",\n  caption = \"99.99% uptime · 3 regions\",\n  command = \"npx shadcn@latest add https://hyperblur.dev/r/hero-dot-torus.json\",\n  primaryCta = defaultPrimary,\n  brand = \"Loopwell\",\n  nav = defaultNav,\n  navCta = defaultNavCta,\n  learnMore = defaultMore,\n  accent = \"#ffe6c4\",\n  density = 1,\n  speed = 1,\n  shape = \"torus\",\n  headingAs = \"h1\",\n  onSearch,\n  className = \"\",\n  style,\n  ...rest\n}: HeroDotTorusProps) {\n  const rootRef = React.useRef<HTMLElement>(null);\n  const canvasRef = React.useRef<HTMLCanvasElement>(null);\n  const timerRef = React.useRef<ReturnType<typeof setTimeout> | null>(null);\n  const [copied, setCopied] = React.useState(false);\n\n  React.useEffect(() => {\n    const root = rootRef.current;\n    const canvas = canvasRef.current;\n    const ctx = canvas?.getContext(\"2d\");\n    if (!root || !canvas || !ctx) return;\n    const reduce = window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\n    const mult = Math.min(2, Math.max(0.3, Number.isFinite(density) ? density : 1));\n    const pace = Math.max(0, Number.isFinite(speed) ? speed : 1);\n    const mobius = shape === \"mobius\";\n    const tones = [toColor(\"#c92f0b\", ctx), toColor(accent, ctx), \"#ffffff\"];\n\n    let model = buildModel(mobius, 1);\n    let builtFor = 0;\n    let cap = 0;\n    let sx = new Float32Array(0);\n    let sy = new Float32Array(0);\n    let ss = new Float32Array(0);\n    let key = new Uint16Array(0);\n    let order = new Int32Array(0);\n    const counts = new Int32Array(LAYERS * TONES + 1);\n\n    let w = 0;\n    let h = 0;\n    let dpr = 1;\n    let narrow = false;\n    let raf = 0;\n    let visible = true;\n    let start = 0;\n    let tx = 0;\n    let ty = 0;\n    let cx = 0;\n    let cy = 0;\n\n    const layout = () => {\n      const rect = root.getBoundingClientRect();\n      w = Math.max(1, rect.width);\n      h = Math.max(1, rect.height);\n      dpr = Math.min(2, window.devicePixelRatio || 1);\n      canvas.width = Math.round(w * dpr);\n      canvas.height = Math.round(h * dpr);\n      narrow = w < 720;\n      const nuMax = Math.round((narrow ? 130 : 230) * mult);\n      if (nuMax !== builtFor) {\n        builtFor = nuMax;\n        model = buildModel(mobius, nuMax);\n        if (model.count > cap) {\n          cap = model.count;\n          sx = new Float32Array(cap);\n          sy = new Float32Array(cap);\n          ss = new Float32Array(cap);\n          key = new Uint16Array(cap);\n          order = new Int32Array(cap);\n        }\n      }\n    };\n\n    const draw = (now: number) => {\n      const t = reduce ? 5.4 : ((now - start) / 1000) * pace;\n      const grow = reduce ? 1 : Math.min(1, (now - start) / 1500);\n      ctx.setTransform(dpr, 0, 0, dpr, 0, 0);\n      ctx.clearRect(0, 0, w, h);\n      const unit = narrow ? (w * 0.5) / 1.4 : Math.min(w * 0.29, h * 0.4);\n      const ccx = narrow ? w * 0.5 : w * 0.73;\n      const ccy = narrow ? h * 0.3 : h * 0.66;\n      cx += (tx - cx) * 0.06;\n      cy += (ty - cy) * 0.06;\n      const ax = (narrow ? 0.45 : 0.55) + 0.28 * Math.sin(t * 0.31 + 1) + cy * 0.3;\n      const ay = 0.75 * Math.sin(t * 0.42) + cx * 0.4;\n      const az = -0.3 + 0.35 * Math.sin(t * 0.23);\n      const sap = Math.sin(t * 0.5);\n      const cap2 = Math.cos(t * 0.5);\n      const sax = Math.sin(ax);\n      const cax = Math.cos(ax);\n      const say = Math.sin(ay);\n      const cay = Math.cos(ay);\n      const saz = Math.sin(az);\n      const caz = Math.cos(az);\n      const D = 4.6;\n      const pitch = (unit * TAU * 1.34) / builtFor;\n      const base = Math.max(3, pitch * 0.5);\n      const lx = -0.42;\n      const ly = -0.62;\n      const lz = 0.66;\n      const m = model;\n      const n = m.count;\n      counts.fill(0);\n      for (let k = 0; k < n; k++) {\n        let x = m.px[k] * cap2 - m.py[k] * sap;\n        let y = m.px[k] * sap + m.py[k] * cap2;\n        let z = m.pz[k];\n        let nx = m.nx[k] * cap2 - m.ny[k] * sap;\n        let ny = m.nx[k] * sap + m.ny[k] * cap2;\n        let nz = m.nz[k];\n        let t1 = y * cax - z * sax;\n        z = y * sax + z * cax;\n        y = t1;\n        t1 = ny * cax - nz * sax;\n        nz = ny * sax + nz * cax;\n        ny = t1;\n        t1 = x * cay + z * say;\n        z = -x * say + z * cay;\n        x = t1;\n        t1 = nx * cay + nz * say;\n        nz = -nx * say + nz * cay;\n        nx = t1;\n        t1 = x * caz - y * saz;\n        y = x * saz + y * caz;\n        x = t1;\n        t1 = nx * caz - ny * saz;\n        ny = nx * saz + ny * caz;\n        nx = t1;\n        const s = D / (D - z);\n        sx[k] = ccx + x * unit * s;\n        sy[k] = ccy - y * unit * s;\n        const lit = nx * lx + ny * ly + nz * lz;\n        const facing = mobius ? Math.abs(nz) : nz;\n        let tone = 0;\n        if (facing > 0.02) tone = (mobius ? Math.abs(lit) : lit) > 0.62 ? 2 : 1;\n        const life = smooth(grow * 1.6 - m.seed[k] * 0.6);\n        const edge = mobius ? 1 : 0.35 + 0.65 * Math.min(1, Math.abs(nz) * 1.6);\n        ss[k] = base * s * (tone === 0 ? 0.7 : 1) * edge * life;\n        let layer = Math.floor(((z + 1.6) / 3.2) * LAYERS);\n        if (layer < 0) layer = 0;\n        if (layer >= LAYERS) layer = LAYERS - 1;\n        const kk = layer * TONES + tone;\n        key[k] = kk;\n        counts[kk + 1]++;\n      }\n      for (let b = 1; b < counts.length; b++) counts[b] += counts[b - 1];\n      for (let k = 0; k < n; k++) order[counts[key[k]]++] = k;\n      let cur = -1;\n      for (let i = 0; i < n; i++) {\n        const k = order[i];\n        const tone = key[k] % TONES;\n        if (tone !== cur) {\n          cur = tone;\n          ctx.fillStyle = tones[tone];\n        }\n        const sz = Math.round(ss[k]);\n        if (sz < 1) continue;\n        ctx.fillRect(Math.round(sx[k] - sz / 2), Math.round(sy[k] - sz / 2), sz, sz);\n      }\n    };\n\n    const frame = (now: number) => {\n      raf = 0;\n      draw(now);\n      if (visible && !document.hidden) raf = requestAnimationFrame(frame);\n    };\n    const schedule = () => {\n      if (reduce || raf) return;\n      raf = requestAnimationFrame(frame);\n    };\n    const stop = () => {\n      if (raf) cancelAnimationFrame(raf);\n      raf = 0;\n    };\n    const onMove = (e: PointerEvent) => {\n      const rect = root.getBoundingClientRect();\n      tx = ((e.clientX - rect.left) / rect.width - 0.5) * 2;\n      ty = ((e.clientY - rect.top) / rect.height - 0.5) * 2;\n    };\n    const onLeave = () => {\n      tx = 0;\n      ty = 0;\n    };\n    const onVisibility = () => {\n      if (document.hidden) stop();\n      else schedule();\n    };\n\n    layout();\n    start = performance.now();\n    draw(start);\n    const ro = new ResizeObserver(() => {\n      layout();\n      draw(performance.now());\n    });\n    ro.observe(root);\n    const io = new IntersectionObserver((entries) => {\n      visible = entries[0]?.isIntersecting ?? true;\n      if (visible) schedule();\n      else stop();\n    });\n    io.observe(root);\n    if (!reduce) {\n      root.addEventListener(\"pointermove\", onMove);\n      root.addEventListener(\"pointerleave\", onLeave);\n    }\n    document.addEventListener(\"visibilitychange\", onVisibility);\n    schedule();\n\n    return () => {\n      stop();\n      ro.disconnect();\n      io.disconnect();\n      root.removeEventListener(\"pointermove\", onMove);\n      root.removeEventListener(\"pointerleave\", onLeave);\n      document.removeEventListener(\"visibilitychange\", onVisibility);\n    };\n  }, [accent, density, speed, shape]);\n\n  React.useEffect(() => {\n    return () => {\n      if (timerRef.current) clearTimeout(timerRef.current);\n    };\n  }, []);\n\n  function copy() {\n    navigator.clipboard?.writeText(command).catch(() => undefined);\n    setCopied(true);\n    if (timerRef.current) clearTimeout(timerRef.current);\n    timerRef.current = setTimeout(() => setCopied(false), 1600);\n  }\n\n  const Heading = headingAs;\n  const vars = { \"--hb-hh5-accent\": accent, ...style } as React.CSSProperties;\n\n  return (\n    <section ref={rootRef} className={`hb-hh5 ${className}`} style={vars} {...rest}>\n      <style href=\"hb-hero-dot-torus\" precedence=\"default\">{css}</style>\n      <canvas ref={canvasRef} className=\"hb-hh5-canvas\" aria-hidden=\"true\" />\n      <header className=\"hb-hh5-bar\">\n        <a className=\"hb-hh5-brand\" href=\"#\">\n          <Mark />\n          <span>{brand}</span>\n        </a>\n        <div className=\"hb-hh5-right\">\n          {nav.length ? (\n            <nav aria-label=\"Primary\">\n              <ul className=\"hb-hh5-links\">\n                {nav.map((item) => (\n                  <li key={item.label}>\n                    <a className=\"hb-hh5-link\" href={item.href}>\n                      {item.label}\n                    </a>\n                  </li>\n                ))}\n              </ul>\n            </nav>\n          ) : null}\n          <button type=\"button\" className=\"hb-hh5-search\" aria-label=\"Search\" onClick={onSearch}>\n            <svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2.4\" strokeLinecap=\"square\" aria-hidden=\"true\">\n              <circle cx=\"11\" cy=\"11\" r=\"6.5\" />\n              <path d=\"M16 16l4.5 4.5\" />\n            </svg>\n          </button>\n          {navCta ? (\n            <a className=\"hb-hh5-link\" href={navCta.href}>\n              {navCta.label}\n            </a>\n          ) : null}\n        </div>\n      </header>\n      <div className=\"hb-hh5-foot\">\n        <div className=\"hb-hh5-panel\">\n        <Heading className=\"hb-hh5-title\">{title}</Heading>\n        <div className=\"hb-hh5-lower\">\n          {subtitle ? <p className=\"hb-hh5-sub\">{subtitle}</p> : null}\n          {caption || command || primaryCta || learnMore ? (\n            <div className=\"hb-hh5-side\">\n              {caption ? <p className=\"hb-hh5-caption\">{caption}</p> : null}\n              {command || primaryCta ? (\n                <div className=\"hb-hh5-row\">\n                  {primaryCta ? (\n                    <a className=\"hb-hh5-cta\" href={primaryCta.href}>\n                      {primaryCta.label}\n                      <svg width=\"15\" height=\"15\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2.6\" strokeLinecap=\"square\" aria-hidden=\"true\">\n                        <path d=\"M5 12h14M13 6l6 6-6 6\" />\n                      </svg>\n                    </a>\n                  ) : null}\n                  {command ? (\n                    <div className=\"hb-hh5-cmd\">\n                      <span className=\"hb-hh5-prompt\" aria-hidden=\"true\">$</span>\n                      <code className=\"hb-hh5-code\">{command}</code>\n                      <button type=\"button\" className=\"hb-hh5-copybtn\" onClick={copy} aria-label={copied ? \"Copied\" : \"Copy command\"}>\n                        {copied ? (\n                          <svg width=\"15\" height=\"15\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2.6\" strokeLinecap=\"square\" aria-hidden=\"true\">\n                            <path d=\"M5 12.5l4.5 4.5L19 7.5\" />\n                          </svg>\n                        ) : (\n                          <svg width=\"15\" height=\"15\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2.2\" strokeLinecap=\"square\" aria-hidden=\"true\">\n                            <rect x=\"8.5\" y=\"8.5\" width=\"11\" height=\"11\" />\n                            <path d=\"M15.5 8.5V4.5h-11v11h4\" />\n                          </svg>\n                        )}\n                        <span className=\"hb-hh5-sr\" aria-live=\"polite\">{copied ? \"Copied\" : \"\"}</span>\n                      </button>\n                    </div>\n                  ) : null}\n                </div>\n              ) : null}\n              {learnMore ? (\n                <a className=\"hb-hh5-more\" href={learnMore.href}>\n                  {learnMore.label}\n                </a>\n              ) : null}\n            </div>\n          ) : null}\n        </div>\n        </div>\n      </div>\n    </section>\n  );\n}\n"
    }
  ]
}