{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "stats-versus",
  "type": "registry:component",
  "title": "Stats Versus",
  "description": "A light before and after comparison drawn as mirrored bars that grow out from a center axis, the old way on one side and the new on the other. A team size switch re-flows every bar, and each row carries a multiplier chip.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "stats",
    "stats",
    "comparison",
    "butterfly chart",
    "before after",
    "light",
    "section"
  ],
  "docs": "https://hyperblur.dev/effects/stats-versus",
  "files": [
    {
      "path": "registry/hyperblur/stats-versus.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/stats-versus.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface VersusRow {\n  label: string;\n  unit?: string;\n  prefix?: string;\n  lowerIsBetter?: boolean;\n  values: [number, number][];\n}\n\nexport interface StatsVersusProps extends Omit<React.HTMLAttributes<HTMLElement>, \"title\"> {\n  eyebrow?: string;\n  title?: string;\n  subtitle?: string;\n  them?: string;\n  us?: string;\n  scenarios?: string[];\n  rows?: VersusRow[];\n  defaultScenario?: number;\n  footnote?: string;\n  accent?: string;\n  onScenarioChange?: (index: number) => void;\n}\n\nconst css = `\n.hb-wb9 {\n  --hb-wb9-accent: #7c3aed;\n  box-sizing: border-box;\n  position: relative;\n  width: 100%;\n  container-type: inline-size;\n  background: #ffffff;\n  color: #0f0f10;\n  font-family: inherit;\n  -webkit-font-smoothing: antialiased;\n}\n.hb-wb9 *, .hb-wb9 *::before, .hb-wb9 *::after { box-sizing: border-box; }\n.hb-wb9-wrap { max-width: 1040px; margin: 0 auto; padding: 80px 24px 88px; }\n.hb-wb9-head { text-align: center; max-width: 640px; margin: 0 auto 32px; }\n.hb-wb9-eyebrow { margin: 0 0 14px; color: var(--hb-wb9-accent); font-size: 13px; font-weight: 600; }\n.hb-wb9-title { margin: 0; font-size: clamp(28px, 4cqw, 44px); font-weight: 600; line-height: 1.05; letter-spacing: -.04em; text-wrap: balance; }\n.hb-wb9-sub { margin: 14px 0 0; color: #6b6b70; font-size: 15.5px; line-height: 1.6; }\n.hb-wb9-bar-top { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 16px; margin-bottom: 18px; }\n.hb-wb9-side { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; }\n.hb-wb9-side:first-child { justify-self: end; color: #6b6b70; }\n.hb-wb9-side:last-child { justify-self: start; }\n.hb-wb9-side i { width: 10px; height: 10px; border-radius: 3px; background: #d4d4d8; }\n.hb-wb9-side:last-child i { background: var(--hb-wb9-accent); }\n.hb-wb9-seg { position: relative; display: inline-flex; padding: 3px; border-radius: 999px; background: #f2f2f4; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .04); }\n.hb-wb9-seg button { position: relative; z-index: 1; padding: 7px 14px; border: 0; border-radius: 999px; background: transparent; color: #6b6b70; font: inherit; font-size: 12.5px; font-weight: 500; white-space: nowrap; cursor: pointer; transition: color .25s ease; }\n.hb-wb9-seg button[aria-pressed=\"true\"] { color: #0f0f10; }\n.hb-wb9-seg button:focus-visible { outline: 2px solid var(--hb-wb9-accent); outline-offset: 2px; }\n.hb-wb9-pill { position: absolute; top: 3px; bottom: 3px; left: 3px; width: calc((100% - 6px) / var(--hb-wb9-n)); border-radius: 999px; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 4px 10px -4px rgba(0, 0, 0, .12); transform: translateX(calc(var(--hb-wb9-s) * 100%)); transition: transform .45s cubic-bezier(.2, .8, .2, 1); }\n.hb-wb9-rows { position: relative; margin: 0; padding: 0; list-style: none; }\n.hb-wb9-rows::before { content: \"\"; position: absolute; left: 50%; top: -6px; bottom: -6px; width: 1px; background: linear-gradient(180deg, transparent, #e4e4e7 10%, #e4e4e7 90%, transparent); }\n.hb-wb9-row { display: grid; grid-template-columns: minmax(0, 1fr) 168px minmax(0, 1fr); align-items: center; gap: 0; padding: 10px 0; }\n.hb-wb9-row + .hb-wb9-row { border-top: 1px dashed #ececef; }\n.hb-wb9-half { position: relative; display: flex; align-items: center; gap: 10px; height: 34px; min-width: 0; }\n.hb-wb9-half[data-side=\"them\"] { flex-direction: row-reverse; }\n.hb-wb9-track { position: relative; flex: 1; height: 100%; }\n.hb-wb9-fill {\n  position: absolute;\n  top: 4px;\n  bottom: 4px;\n  width: var(--hb-wb9-w);\n  border-radius: 8px;\n  transform: scaleX(0);\n  transition: width .9s cubic-bezier(.2, .8, .2, 1), transform 1.1s cubic-bezier(.2, .8, .2, 1);\n  transition-delay: 0s, var(--hb-wb9-d);\n}\n.hb-wb9[data-on=\"true\"] .hb-wb9-fill { transform: scaleX(1); }\n.hb-wb9-half[data-side=\"them\"] .hb-wb9-fill { right: 0; transform-origin: right; background: repeating-linear-gradient(-45deg, #e4e4e7 0 6px, #dcdce0 6px 12px); }\n.hb-wb9-half[data-side=\"us\"] .hb-wb9-fill { left: 0; transform-origin: left; background: linear-gradient(90deg, color-mix(in srgb, var(--hb-wb9-accent) 70%, #fff), var(--hb-wb9-accent)); box-shadow: 0 8px 18px -10px var(--hb-wb9-accent), inset 0 1px 0 rgba(255, 255, 255, .35); }\n.hb-wb9-val { position: absolute; top: 50%; white-space: nowrap; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; transform: translateY(-50%); transition: left .9s cubic-bezier(.2, .8, .2, 1), right .9s cubic-bezier(.2, .8, .2, 1), opacity .5s ease; opacity: 0; transition-delay: 0s, 0s, calc(var(--hb-wb9-d) + .6s); }\n.hb-wb9[data-on=\"true\"] .hb-wb9-val { opacity: 1; }\n.hb-wb9-half[data-side=\"them\"] .hb-wb9-val { right: calc(var(--hb-wb9-w) + 10px); color: #8a8a90; }\n.hb-wb9-half[data-side=\"us\"] .hb-wb9-val { left: calc(var(--hb-wb9-w) + 10px); color: #0f0f10; }\n.hb-wb9-mid { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 0 12px; text-align: center; }\n.hb-wb9-mid b { font-size: 13.5px; font-weight: 600; letter-spacing: -.01em; line-height: 1.2; }\n.hb-wb9-chip { display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px; border-radius: 999px; background: color-mix(in srgb, var(--hb-wb9-accent) 10%, #fff); color: var(--hb-wb9-accent); font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums; }\n.hb-wb9-foot { margin: 24px 0 0; color: #8a8a90; font-size: 12.5px; text-align: center; }\n@container (max-width: 720px) {\n  .hb-wb9-bar-top { grid-template-columns: 1fr 1fr; }\n  .hb-wb9-bar-top .hb-wb9-seg { grid-column: span 2; grid-row: 1; justify-self: center; }\n  .hb-wb9-side:first-child { justify-self: start; }\n  .hb-wb9-side:last-child { justify-self: end; }\n  .hb-wb9-rows::before { display: none; }\n  .hb-wb9-row { grid-template-columns: minmax(0, 1fr); gap: 6px; padding: 14px 0; }\n  .hb-wb9-mid { order: -1; flex-direction: row; justify-content: space-between; padding: 0; text-align: left; }\n  .hb-wb9-half { height: 24px; }\n  .hb-wb9-half[data-side=\"them\"] { flex-direction: row; }\n  .hb-wb9-half[data-side=\"them\"] .hb-wb9-fill { right: auto; left: 0; transform-origin: left; }\n  .hb-wb9-half[data-side=\"them\"] .hb-wb9-val { right: auto; left: calc(var(--hb-wb9-w) + 10px); }\n  .hb-wb9-fill { top: 3px; bottom: 3px; width: calc(var(--hb-wb9-w) * .8); }\n  .hb-wb9-half .hb-wb9-val { font-size: 12px; }\n  .hb-wb9-half[data-side] .hb-wb9-val { left: calc(var(--hb-wb9-w) * .8 + 8px); }\n}\n@container (max-width: 420px) {\n  .hb-wb9-wrap { padding: 56px 16px 64px; }\n}\n@media (prefers-reduced-motion: reduce) {\n  .hb-wb9-fill { transition: none; transform: scaleX(1); }\n  .hb-wb9-val { transition: none; opacity: 1; }\n  .hb-wb9-pill, .hb-wb9-seg button { transition: none; }\n}\n`;\n\nconst defaultRows: VersusRow[] = [\n  { label: \"Time to deploy\", unit: \" min\", lowerIsBetter: true, values: [[38, 4], [64, 6]] },\n  { label: \"Deploys per week\", values: [[3, 41], [9, 186]] },\n  { label: \"Monthly cloud bill\", prefix: \"$\", lowerIsBetter: true, values: [[6400, 2900], [118000, 61500]] },\n  { label: \"Incidents per quarter\", lowerIsBetter: true, values: [[11, 2], [37, 6]] },\n  { label: \"Days to first commit\", lowerIsBetter: true, values: [[9, 1], [21, 2]] },\n];\n\nfunction fmt(v: number, prefix = \"\", unit = \"\") {\n  const s = v >= 10000 ? `${(v / 1000).toFixed(v >= 100000 ? 0 : 1)}k` : v.toLocaleString(\"en-US\");\n  return `${prefix}${s}${unit}`;\n}\n\nexport function StatsVersus({\n  eyebrow = \"Measured after migration\",\n  title = \"Same team, same product, a different week\",\n  subtitle = \"What changes when engineering moves from a hand-built pipeline to Tessera. Pick a team size to see the median result.\",\n  them = \"Hand-built pipeline\",\n  us = \"With Tessera\",\n  scenarios = [\"Team of 12\", \"Team of 240\"],\n  rows = defaultRows,\n  defaultScenario = 0,\n  footnote = \"Median of 312 customer migrations between January and September 2026.\",\n  accent = \"#7c3aed\",\n  onScenarioChange,\n  className = \"\",\n  style,\n  ...rest\n}: StatsVersusProps) {\n  const uid = React.useId();\n  const ref = React.useRef<HTMLElement>(null);\n  const [on, setOn] = React.useState(false);\n  const [sc, setSc] = React.useState(Math.max(0, Math.min(defaultScenario, scenarios.length - 1)));\n\n  React.useEffect(() => {\n    const el = ref.current;\n    if (!el) return;\n    if (typeof IntersectionObserver === \"undefined\") {\n      const raf = requestAnimationFrame(() => setOn(true));\n      return () => cancelAnimationFrame(raf);\n    }\n    const io = new IntersectionObserver(\n      (entries) => {\n        if (entries.some((e) => e.isIntersecting)) {\n          setOn(true);\n          io.disconnect();\n        }\n      },\n      { threshold: 0.25 },\n    );\n    io.observe(el);\n    return () => io.disconnect();\n  }, []);\n\n  const choose = (i: number) => {\n    setSc(i);\n    onScenarioChange?.(i);\n  };\n\n  const vars = { \"--hb-wb9-accent\": accent, \"--hb-wb9-n\": scenarios.length, \"--hb-wb9-s\": sc, ...style } as React.CSSProperties;\n\n  return (\n    <section ref={ref} className={`hb-wb9 ${className}`} style={vars} data-on={on} aria-labelledby={`${uid}-t`} {...rest}>\n      <style href=\"hb-stats-versus\" precedence=\"default\">{css}</style>\n      <div className=\"hb-wb9-wrap\">\n        <div className=\"hb-wb9-head\">\n          <p className=\"hb-wb9-eyebrow\">{eyebrow}</p>\n          <h2 id={`${uid}-t`} className=\"hb-wb9-title\">{title}</h2>\n          {subtitle && <p className=\"hb-wb9-sub\">{subtitle}</p>}\n        </div>\n        <div className=\"hb-wb9-bar-top\">\n          <span className=\"hb-wb9-side\"><i aria-hidden=\"true\" />{them}</span>\n          {scenarios.length > 1 ? (\n            <div className=\"hb-wb9-seg\" role=\"group\" aria-label=\"Team size\">\n              <span className=\"hb-wb9-pill\" aria-hidden=\"true\" />\n              {scenarios.map((s, i) => (\n                <button key={s} type=\"button\" aria-pressed={i === sc} onClick={() => choose(i)}>{s}</button>\n              ))}\n            </div>\n          ) : <span />}\n          <span className=\"hb-wb9-side\"><i aria-hidden=\"true\" />{us}</span>\n        </div>\n        <ul className=\"hb-wb9-rows\">\n          {rows.map((r, i) => {\n            const pair = r.values[Math.min(sc, r.values.length - 1)] ?? [0, 0];\n            const [a, b] = pair;\n            const max = Math.max(a, b, 1e-9);\n            const wa = (a / max) * 82;\n            const wb = (b / max) * 82;\n            let chip = \"\";\n            if (r.lowerIsBetter) {\n              chip = b > 0 && a / b >= 2 ? `${(a / b).toFixed(1)}x less` : `-${Math.round((1 - b / Math.max(a, 1e-9)) * 100)}%`;\n            } else {\n              chip = a > 0 ? `${(b / a).toFixed(1)}x more` : \"new\";\n            }\n            const d = `${(i * 0.09).toFixed(2)}s`;\n            return (\n              <li key={`${r.label}-${i}`} className=\"hb-wb9-row\" aria-label={`${r.label}: ${them} ${fmt(a, r.prefix, r.unit)}, ${us} ${fmt(b, r.prefix, r.unit)}`}>\n                <div className=\"hb-wb9-half\" data-side=\"them\" aria-hidden=\"true\">\n                  <div className=\"hb-wb9-track\" style={{ \"--hb-wb9-w\": `${wa.toFixed(2)}%`, \"--hb-wb9-d\": d } as React.CSSProperties}>\n                    <span className=\"hb-wb9-fill\" />\n                    <span className=\"hb-wb9-val\">{fmt(a, r.prefix, r.unit)}</span>\n                  </div>\n                </div>\n                <div className=\"hb-wb9-mid\">\n                  <b>{r.label}</b>\n                  <span className=\"hb-wb9-chip\" aria-hidden=\"true\">{chip}</span>\n                </div>\n                <div className=\"hb-wb9-half\" data-side=\"us\" aria-hidden=\"true\">\n                  <div className=\"hb-wb9-track\" style={{ \"--hb-wb9-w\": `${wb.toFixed(2)}%`, \"--hb-wb9-d\": d } as React.CSSProperties}>\n                    <span className=\"hb-wb9-fill\" />\n                    <span className=\"hb-wb9-val\">{fmt(b, r.prefix, r.unit)}</span>\n                  </div>\n                </div>\n              </li>\n            );\n          })}\n        </ul>\n        {footnote && <p className=\"hb-wb9-foot\">{footnote}</p>}\n      </div>\n    </section>\n  );\n}\n"
    }
  ]
}