{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "cta-terminal-install",
  "type": "registry:component",
  "title": "CTA Terminal Install",
  "description": "An install call to action built around a terminal: package manager tabs, a command that types itself when the section comes into view, an install progress bar and output lines, plus copy and replay buttons.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "cta",
    "cta",
    "terminal",
    "install",
    "developer",
    "typewriter",
    "section"
  ],
  "docs": "https://hyperblur.dev/effects/cta-terminal-install",
  "files": [
    {
      "path": "registry/hyperblur/cta-terminal-install.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/cta-terminal-install.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface CtaTerminalInstallManager {\n  id: string;\n  label: string;\n  command: string;\n}\n\nexport interface CtaTerminalInstallLine {\n  text: string;\n  tone?: \"ok\" | \"dim\" | \"info\" | \"accent\";\n}\n\nexport interface CtaTerminalInstallProps extends Omit<React.HTMLAttributes<HTMLElement>, \"title\"> {\n  eyebrow?: string;\n  title?: string;\n  subtitle?: string;\n  managers?: CtaTerminalInstallManager[];\n  output?: CtaTerminalInstallLine[];\n  primary?: { label: string; href: string };\n  secondary?: { label: string; href: string };\n  autoPlay?: boolean;\n  typingSpeed?: number;\n  onCommandCopy?: (command: string) => void;\n  accent?: string;\n}\n\nconst css = `\n.hb-wc8 {\n  --hb-wc8-accent: #4ade80;\n  container-type: inline-size;\n  position: relative;\n  box-sizing: border-box;\n  width: 100%;\n  overflow: hidden;\n  isolation: isolate;\n  background: #0a0a0a;\n  color: #ededed;\n  font-family: inherit;\n  -webkit-font-smoothing: antialiased;\n}\n.hb-wc8 *, .hb-wc8 *::before, .hb-wc8 *::after { box-sizing: border-box; }\n.hb-wc8::before { content: \"\"; position: absolute; inset: 0; z-index: -1; background-image: linear-gradient(rgba(255, 255, 255, .04) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .04) 1px, transparent 1px); background-size: 44px 44px; mask-image: radial-gradient(70% 60% at 50% 40%, #000, transparent); }\n.hb-wc8::after { content: \"\"; position: absolute; left: 50%; top: 58%; z-index: -1; width: 70%; height: 50%; transform: translate(-50%, -50%); background: radial-gradient(closest-side, color-mix(in srgb, var(--hb-wc8-accent) 16%, transparent), transparent); }\n.hb-wc8-inner { display: grid; justify-items: center; gap: 0; max-width: 900px; margin: 0 auto; padding: 80px 18px; text-align: center; }\n.hb-wc8-eyebrow { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 18px; padding: 5px 12px 5px 6px; border: 1px solid rgba(255, 255, 255, .1); border-radius: 999px; background: rgba(255, 255, 255, .03); color: #a1a1a1; font-family: var(--font-mono), monospace; font-size: 12px; }\n.hb-wc8-eyebrow b { padding: 2px 7px; border-radius: 999px; background: var(--hb-wc8-accent); color: #04140a; font-weight: 700; }\n.hb-wc8-title { margin: 0; max-width: 16ch; font-family: var(--font-grotesk), var(--font-sans), sans-serif; font-size: clamp(34px, 6cqi, 60px); font-weight: 600; line-height: 1.02; letter-spacing: -.04em; text-wrap: balance; }\n.hb-wc8-sub { margin: 18px 0 0; max-width: 520px; color: #8f8f8f; font-size: 16px; line-height: 1.6; }\n.hb-wc8-term { width: 100%; max-width: 720px; margin-top: 40px; border: 1px solid rgba(255, 255, 255, .1); border-radius: 14px; background: linear-gradient(180deg, #121212, #0c0c0c); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 40px 80px -40px rgba(0, 0, 0, .9), 0 0 0 6px rgba(255, 255, 255, .02); text-align: left; overflow: hidden; }\n.hb-wc8-bar { display: flex; align-items: center; gap: 12px; height: 44px; padding: 0 8px 0 14px; border-bottom: 1px solid rgba(255, 255, 255, .07); }\n.hb-wc8-dots { display: flex; gap: 6px; }\n.hb-wc8-dots i { width: 10px; height: 10px; border-radius: 50%; background: #2a2a2a; font-style: normal; }\n.hb-wc8-tabs { position: relative; display: flex; gap: 2px; margin-left: auto; padding: 3px; border-radius: 9px; background: rgba(255, 255, 255, .04); }\n.hb-wc8-tab { position: relative; z-index: 1; height: 28px; padding: 0 11px; border: 0; border-radius: 7px; background: none; color: #7a7a7a; font-family: var(--font-mono), monospace; font-size: 12px; cursor: pointer; transition: color .2s ease, background .2s ease; }\n.hb-wc8-tab[aria-selected=\"true\"] { background: #1f1f1f; color: #ededed; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06); }\n.hb-wc8-tab:hover { color: #d4d4d4; }\n.hb-wc8-tab:focus-visible, .hb-wc8-icon:focus-visible { outline: 2px solid var(--hb-wc8-accent); outline-offset: 1px; }\n.hb-wc8-body { position: relative; min-height: 260px; padding: 18px 18px 20px; font-family: var(--font-mono), monospace; font-size: 13px; line-height: 1.75; }\n.hb-wc8-cmd { display: flex; align-items: flex-start; gap: 10px; padding: 10px 10px 10px 12px; margin-bottom: 10px; border: 1px solid rgba(255, 255, 255, .07); border-radius: 10px; background: rgba(255, 255, 255, .025); }\n.hb-wc8-ps { color: var(--hb-wc8-accent); user-select: none; }\n.hb-wc8-text { flex: 1; min-width: 0; color: #ededed; overflow-wrap: anywhere; }\n.hb-wc8-caret { display: inline-block; width: .55em; height: 1.1em; margin-left: 1px; vertical-align: -.18em; background: var(--hb-wc8-accent); animation: hb-wc8-blink 1s steps(1) infinite; }\n.hb-wc8-tools { display: flex; gap: 4px; margin: -4px -4px -4px 0; }\n.hb-wc8-icon { display: inline-grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 1px solid rgba(255, 255, 255, .08); border-radius: 8px; background: #161616; color: #a1a1a1; cursor: pointer; transition: color .2s ease, border-color .2s ease, transform .15s ease; }\n.hb-wc8-icon:hover { color: #fff; border-color: rgba(255, 255, 255, .2); }\n.hb-wc8-icon:active { transform: scale(.92); }\n.hb-wc8-icon[data-done=\"true\"] { color: var(--hb-wc8-accent); border-color: color-mix(in srgb, var(--hb-wc8-accent) 50%, transparent); }\n.hb-wc8-icon svg { width: 14px; height: 14px; }\n.hb-wc8-out { margin: 0; padding: 0 2px; list-style: none; }\n.hb-wc8-out li { white-space: pre-wrap; animation: hb-wc8-in .25s ease-out both; }\n.hb-wc8-out li[data-tone=\"ok\"] { color: #d4d4d4; }\n.hb-wc8-out li[data-tone=\"ok\"]::before { content: \"\\\\2713  \"; color: var(--hb-wc8-accent); }\n.hb-wc8-out li[data-tone=\"dim\"] { color: #666; }\n.hb-wc8-out li[data-tone=\"info\"] { color: #7dd3fc; }\n.hb-wc8-out li[data-tone=\"accent\"] { color: var(--hb-wc8-accent); font-weight: 600; }\n.hb-wc8-prog { display: flex; align-items: center; gap: 10px; color: #8f8f8f; }\n.hb-wc8-prog span:first-child { flex: 1; max-width: 220px; height: 6px; border-radius: 3px; background: #1f1f1f; overflow: hidden; }\n.hb-wc8-prog i { display: block; height: 100%; width: var(--hb-wc8-p); border-radius: inherit; background: linear-gradient(90deg, color-mix(in srgb, var(--hb-wc8-accent) 50%, #0a0a0a), var(--hb-wc8-accent)); transition: width .25s ease; font-style: normal; }\n.hb-wc8-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 32px; }\n.hb-wc8-btn { display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 18px; border-radius: 10px; font-size: 14.5px; font-weight: 600; text-decoration: none; transition: transform .2s ease, background .2s ease, border-color .2s ease; }\n.hb-wc8-btn:focus-visible { outline: 2px solid var(--hb-wc8-accent); outline-offset: 3px; }\n.hb-wc8-btn[data-kind=\"primary\"] { background: #ededed; color: #0a0a0a; box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .12); }\n.hb-wc8-btn[data-kind=\"primary\"]:hover { background: #fff; transform: translateY(-1px); }\n.hb-wc8-btn[data-kind=\"secondary\"] { border: 1px solid rgba(255, 255, 255, .12); color: #ededed; }\n.hb-wc8-btn[data-kind=\"secondary\"]:hover { border-color: rgba(255, 255, 255, .28); }\n.hb-wc8-btn svg { width: 15px; height: 15px; }\n.hb-wc8-sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }\n@keyframes hb-wc8-blink { 50% { opacity: 0; } }\n@keyframes hb-wc8-in { from { opacity: 0; transform: translateY(4px); } }\n@container (min-width: 720px) {\n  .hb-wc8-inner { padding: 112px 32px; }\n  .hb-wc8-body { padding: 22px 24px 26px; font-size: 13.5px; }\n}\n@container (max-width: 480px) {\n  .hb-wc8-dots { display: none; }\n  .hb-wc8-tabs { margin-left: 0; }\n  .hb-wc8-tab { padding: 0 8px; }\n}\n@media (prefers-reduced-motion: reduce) {\n  .hb-wc8 *, .hb-wc8 *::before, .hb-wc8 *::after { animation: none !important; transition: none !important; }\n}\n`;\n\nconst defaultManagers: CtaTerminalInstallManager[] = [\n  { id: \"npm\", label: \"npm\", command: \"npx shadcn@latest add https://hyperblur.dev/r/cta-terminal-install.json\" },\n  { id: \"pnpm\", label: \"pnpm\", command: \"pnpm dlx shadcn@latest add https://hyperblur.dev/r/cta-terminal-install.json\" },\n  { id: \"yarn\", label: \"yarn\", command: \"yarn dlx shadcn@latest add https://hyperblur.dev/r/cta-terminal-install.json\" },\n  { id: \"bun\", label: \"bun\", command: \"bunx --bun shadcn@latest add https://hyperblur.dev/r/cta-terminal-install.json\" },\n];\n\nconst defaultOutput: CtaTerminalInstallLine[] = [\n  { text: \"Checking registry\", tone: \"dim\" },\n  { text: \"Updating files\", tone: \"dim\" },\n  { text: \"Created src/components/hyperblur/cta-terminal-install.tsx\", tone: \"ok\" },\n  { text: \"Import it and use it. No extra dependencies.\", tone: \"accent\" },\n  { text: \"  Docs:  https://hyperblur.dev/effects/cta-terminal-install\", tone: \"info\" },\n];\n\nexport function CtaTerminalInstall({\n  eyebrow = \"MIT\",\n  title = \"Up and running before your coffee cools.\",\n  subtitle = \"One command adds the component to your project as plain source you own. No runtime and no lock-in.\",\n  managers = defaultManagers,\n  output = defaultOutput,\n  primary = { label: \"Read the quickstart\", href: \"#\" },\n  secondary = { label: \"Browse templates\", href: \"#\" },\n  autoPlay = true,\n  typingSpeed = 38,\n  onCommandCopy,\n  accent = \"#4ade80\",\n  className = \"\",\n  style,\n  ...rest\n}: CtaTerminalInstallProps) {\n  const [tab, setTab] = React.useState(0);\n  const [run, setRun] = React.useState(0);\n  const [typed, setTyped] = React.useState(Infinity);\n  const [shown, setShown] = React.useState(Infinity);\n  const [copied, setCopied] = React.useState(false);\n  const root = React.useRef<HTMLElement>(null);\n  const tabs = React.useRef<(HTMLButtonElement | null)[]>([]);\n  const command = managers[tab]?.command ?? \"\";\n\n  React.useEffect(() => {\n    if (!autoPlay) return;\n    const el = root.current;\n    if (!el || typeof IntersectionObserver === \"undefined\") return;\n    const io = new IntersectionObserver(\n      (entries) => {\n        if (entries.some((e) => e.isIntersecting)) {\n          io.disconnect();\n          setRun((r) => r + 1);\n        }\n      },\n      { threshold: 0.35 },\n    );\n    io.observe(el);\n    return () => io.disconnect();\n  }, [autoPlay]);\n\n  React.useEffect(() => {\n    if (run === 0) return;\n    const timers: ReturnType<typeof setTimeout>[] = [];\n    const reduced = window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\n    if (reduced) {\n      timers.push(\n        setTimeout(() => {\n          setTyped(Infinity);\n          setShown(Infinity);\n        }, 0),\n      );\n      return () => timers.forEach(clearTimeout);\n    }\n    const step = Math.max(8, typingSpeed);\n    timers.push(\n      setTimeout(() => {\n        setTyped(0);\n        setShown(0);\n      }, 0),\n    );\n    for (let i = 1; i <= command.length; i++) {\n      timers.push(setTimeout(() => setTyped(i), 120 + i * step + ((i * 7919) % 5) * 6));\n    }\n    const base = 120 + command.length * step + 380;\n    for (let j = 1; j <= output.length + 1; j++) {\n      timers.push(setTimeout(() => setShown(j), base + j * 260));\n    }\n    return () => timers.forEach(clearTimeout);\n  }, [run, command, output.length, typingSpeed]);\n\n  const choose = (i: number) => {\n    setTab(i);\n    setRun((r) => r + 1);\n  };\n\n  const tabKey = (e: React.KeyboardEvent, i: number) => {\n    let n = i;\n    if (e.key === \"ArrowRight\") n = (i + 1) % managers.length;\n    else if (e.key === \"ArrowLeft\") n = (i - 1 + managers.length) % managers.length;\n    else if (e.key === \"Home\") n = 0;\n    else if (e.key === \"End\") n = managers.length - 1;\n    else return;\n    e.preventDefault();\n    choose(n);\n    tabs.current[n]?.focus();\n  };\n\n  const copy = () => {\n    navigator.clipboard?.writeText(command).catch(() => undefined);\n    onCommandCopy?.(command);\n    setCopied(true);\n    setTimeout(() => setCopied(false), 1600);\n  };\n\n  const typing = typed < command.length;\n  const progress = Math.min(1, shown / (output.length + 1));\n  const installing = !typing && shown <= output.length;\n  const vars = { \"--hb-wc8-accent\": accent, ...style } as React.CSSProperties;\n\n  return (\n    <section ref={root} className={`hb-wc8 ${className}`} style={vars} {...rest}>\n      <style href=\"hb-cta-terminal-install\" precedence=\"default\">{css}</style>\n      <div className=\"hb-wc8-inner\">\n        {eyebrow ? (\n          <p className=\"hb-wc8-eyebrow\">\n            <b>{eyebrow}</b>\n            copy-paste, one command\n          </p>\n        ) : null}\n        <h2 className=\"hb-wc8-title\">{title}</h2>\n        {subtitle ? <p className=\"hb-wc8-sub\">{subtitle}</p> : null}\n        <div className=\"hb-wc8-term\">\n          <div className=\"hb-wc8-bar\">\n            <span className=\"hb-wc8-dots\" aria-hidden=\"true\">\n              <i />\n              <i />\n              <i />\n            </span>\n            <div className=\"hb-wc8-tabs\" role=\"tablist\" aria-label=\"Package manager\">\n              {managers.map((m, i) => (\n                <button\n                  key={m.id}\n                  ref={(el) => {\n                    tabs.current[i] = el;\n                  }}\n                  type=\"button\"\n                  role=\"tab\"\n                  className=\"hb-wc8-tab\"\n                  aria-selected={tab === i}\n                  tabIndex={tab === i ? 0 : -1}\n                  onClick={() => choose(i)}\n                  onKeyDown={(e) => tabKey(e, i)}\n                >\n                  {m.label}\n                </button>\n              ))}\n            </div>\n          </div>\n          <div className=\"hb-wc8-body\" role=\"tabpanel\">\n            <div className=\"hb-wc8-cmd\">\n              <span className=\"hb-wc8-ps\" aria-hidden=\"true\">$</span>\n              <span className=\"hb-wc8-text\">\n                <span aria-hidden=\"true\">{command.slice(0, typed)}</span>\n                <span className=\"hb-wc8-sr\">{command}</span>\n                {typing || shown > output.length ? <span className=\"hb-wc8-caret\" aria-hidden=\"true\" /> : null}\n              </span>\n              <span className=\"hb-wc8-tools\">\n                <button type=\"button\" className=\"hb-wc8-icon\" data-done={copied ? \"true\" : \"false\"} onClick={copy} aria-label={copied ? \"Copied\" : \"Copy command\"}>\n                  {copied ? (\n                    <svg viewBox=\"0 0 14 14\" aria-hidden=\"true\">\n                      <path d=\"M2.5 7.5l3 3 6-6.5\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.7\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n                    </svg>\n                  ) : (\n                    <svg viewBox=\"0 0 14 14\" aria-hidden=\"true\">\n                      <path d=\"M4.5 4.5V2.5h7v7h-2M2.5 4.5h7v7h-7z\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.3\" strokeLinejoin=\"round\" />\n                    </svg>\n                  )}\n                </button>\n                <button type=\"button\" className=\"hb-wc8-icon\" onClick={() => setRun((r) => r + 1)} aria-label=\"Replay\">\n                  <svg viewBox=\"0 0 14 14\" aria-hidden=\"true\">\n                    <path d=\"M2.5 7a4.5 4.5 0 104.5-4.5c-1.5 0-2.8.7-3.6 1.8M3 1.5v3h3\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.3\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n                  </svg>\n                </button>\n              </span>\n            </div>\n            <ul className=\"hb-wc8-out\" aria-live=\"polite\">\n              {!typing && shown > 0 && shown <= output.length ? (\n                <li className=\"hb-wc8-prog\" data-tone=\"dim\">\n                  <span>\n                    <i style={{ \"--hb-wc8-p\": `${(progress * 100).toFixed(0)}%` } as React.CSSProperties} />\n                  </span>\n                  <span>{installing ? `${(progress * 100).toFixed(0)}%` : \"\"}</span>\n                </li>\n              ) : null}\n              {output.slice(0, typing ? 0 : Math.min(shown, output.length)).map((l, i) => (\n                <li key={`${run}-${i}`} data-tone={l.tone ?? \"dim\"}>\n                  {l.text}\n                </li>\n              ))}\n            </ul>\n          </div>\n        </div>\n        <div className=\"hb-wc8-actions\">\n          {primary ? (\n            <a className=\"hb-wc8-btn\" data-kind=\"primary\" href={primary.href}>\n              {primary.label}\n              <svg viewBox=\"0 0 16 16\" aria-hidden=\"true\">\n                <path d=\"M3 8h9.5M8.5 4l4 4-4 4\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.8\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n              </svg>\n            </a>\n          ) : null}\n          {secondary ? (\n            <a className=\"hb-wc8-btn\" data-kind=\"secondary\" href={secondary.href}>\n              {secondary.label}\n            </a>\n          ) : null}\n        </div>\n      </div>\n    </section>\n  );\n}\n"
    }
  ]
}