{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"area-chart","type":"registry:block","title":"Area chart","description":"Revenue over time with a self-drawing line, morphing ranges, and a pointer crosshair.","dependencies":["motion","lucide-react"],"registryDependencies":["utils"],"files":[{"path":"registry/prequel/area-chart/area-chart.tsx","type":"registry:component","content":"\"use client\";\n\nimport { useEffect, useId, useMemo, useRef, useState } from \"react\";\nimport {\n  AnimatePresence,\n  MotionConfig,\n  animate,\n  motion,\n  useInView,\n  useReducedMotion,\n} from \"motion/react\";\nimport { ArrowDownRight, ArrowUpRight } from \"lucide-react\";\nimport { cn } from \"@/lib/utils\";\n\nconst EASE: [number, number, number, number] = [0.22, 1, 0.36, 1];\n\nexport type AreaChartPoint = {\n  date: string;\n  value: number;\n};\n\nexport type AreaChartRange = {\n  key: string;\n  label: string;\n  /** Headline number shown in the header (counts up on change). */\n  total: number;\n  /** Percent change vs the previous period. */\n  delta: number;\n  /** Human-readable period label, e.g. \"Oct 10 – Nov 9 · vs previous 30 days\". */\n  rangeText: string;\n  points: AreaChartPoint[];\n};\n\nexport type AreaChartProps = {\n  className?: string;\n  title?: string;\n  ranges?: AreaChartRange[];\n  defaultRange?: string;\n  valuePrefix?: string;\n  formatValue?: (value: number) => string;\n};\n\n/* ------------------------------------------------------------------ */\n/* deterministic demo data (no Math.random / Date.now at module load)  */\n/* ------------------------------------------------------------------ */\n\nconst MONTHS = [\n  \"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\",\n  \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\",\n] as const;\n\nfunction lcg(seed: number) {\n  let s = seed >>> 0;\n  return () => {\n    s = (s * 1664525 + 1013904223) >>> 0;\n    return s / 4294967296;\n  };\n}\n\n/* UTC on purpose: labels must read the same on the server and in the\n   visitor's timezone, or hydration would disagree. */\nfunction dayLabel(offset: number) {\n  const d = new Date(Date.UTC(2026, 9, 10 + offset));\n  return `${MONTHS[d.getUTCMonth()]} ${d.getUTCDate()}`;\n}\n\nfunction monthLabel(index: number) {\n  const d = new Date(Date.UTC(2025, 11 + index, 1));\n  return `${MONTHS[d.getUTCMonth()]} ${d.getUTCFullYear()}`;\n}\n\nfunction buildPoints(\n  count: number,\n  start: number,\n  end: number,\n  noise: number,\n  seed: number,\n  labelFor: (i: number) => string\n): AreaChartPoint[] {\n  const rand = lcg(seed);\n  return Array.from({ length: count }, (_, i) => {\n    const t = i / (count - 1);\n    const value =\n      start + (end - start) * Math.pow(t, 1.15) + (rand() - 0.5) * noise * start;\n    return { date: labelFor(i), value: Math.round(value) };\n  });\n}\n\nconst DEFAULT_RANGES: AreaChartRange[] = [\n  {\n    key: \"7d\",\n    label: \"7D\",\n    total: 51240,\n    delta: 8.1,\n    rangeText: \"Nov 3 – Nov 9 · vs previous 7 days\",\n    points: buildPoints(7, 6200, 8100, 0.08, 1, (i) => dayLabel(24 + i)),\n  },\n  {\n    key: \"30d\",\n    label: \"30D\",\n    total: 213480,\n    delta: 14.9,\n    rangeText: \"Oct 10 – Nov 9 · vs previous 30 days\",\n    points: buildPoints(30, 5400, 8800, 0.1, 2, dayLabel),\n  },\n  {\n    key: \"12m\",\n    label: \"12M\",\n    total: 764200,\n    delta: 64.3,\n    rangeText: \"Dec 2025 – Nov 2026 · vs previous 12 months\",\n    points: buildPoints(12, 41000, 85000, 0.03, 3, monthLabel),\n  },\n];\n\n/* ------------------------------------------------------------------ */\n/* small helpers                                                       */\n/* ------------------------------------------------------------------ */\n\nfunction clamp(v: number, min: number, max: number) {\n  return Math.min(max, Math.max(min, v));\n}\n\nfunction niceMax(value: number) {\n  const padded = value * 1.08;\n  const magnitude = Math.pow(10, Math.floor(Math.log10(padded)));\n  const normalized = padded / magnitude;\n  const steps = [1, 1.2, 1.6, 2, 2.4, 3, 4, 5, 6, 8, 10];\n  const factor = steps.find((k) => k >= normalized) ?? 10;\n  return factor * magnitude;\n}\n\nfunction smoothPath(points: Array<[number, number]>) {\n  return points\n    .map(([x, y], i) => {\n      if (i === 0) return `M${x},${y}`;\n      const [x0, y0] = points[i - 1];\n      const cx = (x0 + x) / 2;\n      return `C${cx},${y0} ${cx},${y} ${x},${y}`;\n    })\n    .join(\" \");\n}\n\nfunction resample(values: number[], count: number) {\n  if (count <= 1) return [values[0]];\n  return Array.from({ length: count }, (_, i) => {\n    const t = (i * (values.length - 1)) / (count - 1);\n    const k = Math.floor(t);\n    const f = t - k;\n    const next = values[k + 1] ?? values[k];\n    return values[k] + (next - values[k]) * f;\n  });\n}\n\nfunction formatDelta(n: number) {\n  return `${n >= 0 ? \"+\" : \"−\"}${Math.abs(n).toFixed(1)}%`;\n}\n\nfunction trimZero(n: number) {\n  const s = n.toFixed(1);\n  return s.endsWith(\".0\") ? s.slice(0, -2) : s;\n}\n\nfunction formatCompact(value: number, prefix: string) {\n  const abs = Math.abs(value);\n  if (abs >= 1_000_000) return `${prefix}${trimZero(abs / 1_000_000)}M`;\n  if (abs >= 1000) return `${prefix}${trimZero(abs / 1000)}k`;\n  return `${prefix}${abs}`;\n}\n\ntype Geometry = {\n  W: number;\n  H: number;\n  L: number;\n  R: number;\n  T: number;\n  B: number;\n  n: number;\n  points: Array<{ x: number; y: number }>;\n  line: string;\n  area: string;\n  yTicks: Array<{ value: number; y: number }>;\n  xTicks: Array<{ index: number; x: number; label: string }>;\n};\n\nfunction buildGeometry(\n  width: number,\n  height: number,\n  values: number[],\n  max: number,\n  dates: string[]\n): Geometry {\n  const W = width;\n  const H = height;\n  const L = 52;\n  const R = 8;\n  const T = 12;\n  const B = 30;\n  const n = values.length;\n  const x = (i: number) => L + ((W - L - R) * i) / (n - 1);\n  const y = (v: number) => T + (H - T - B) * (1 - v / max);\n\n  const points = values.map((v, i) => ({ x: x(i), y: y(v) }));\n  const line = smoothPath(points.map((p) => [p.x, p.y] as [number, number]));\n  const area = `${line} L${x(n - 1)},${H - B} L${L},${H - B} Z`;\n\n  const yTicks = [0, 1, 2, 3, 4].map((k) => ({\n    value: (max * k) / 4,\n    y: T + (H - T - B) * (1 - k / 4),\n  }));\n\n  const step = Math.max(\n    1,\n    Math.ceil(n / Math.max(2, Math.floor((W - L) / 64)))\n  );\n  const xTicks: Array<{ index: number; x: number; label: string }> = [];\n  for (let i = 0; i < n; i += step) {\n    xTicks.push({ index: i, x: x(i), label: dates[i] });\n  }\n\n  return { W, H, L, R, T, B, n, points, line, area, yTicks, xTicks };\n}\n\n/* ------------------------------------------------------------------ */\n/* count-up                                                           */\n/* ------------------------------------------------------------------ */\n\nfunction useAnimatedNumber(\n  target: number,\n  opts: { inView: boolean; reduce: boolean }\n) {\n  const [value, setValue] = useState(target);\n  const valueRef = useRef(target);\n  const animRef = useRef<ReturnType<typeof animate> | null>(null);\n  const firstRef = useRef(true);\n\n  useEffect(() => {\n    if (!opts.inView) return;\n    if (opts.reduce) {\n      valueRef.current = target;\n      setValue(target);\n      return;\n    }\n    const from = firstRef.current ? 0 : valueRef.current;\n    firstRef.current = false;\n    animRef.current?.stop();\n    setValue(from);\n    animRef.current = animate(from, target, {\n      duration: 0.9,\n      ease: EASE,\n      onUpdate: (v) => {\n        valueRef.current = v;\n        setValue(v);\n      },\n      onComplete: () => {\n        valueRef.current = target;\n        setValue(target);\n      },\n    });\n    return () => {\n      animRef.current?.stop();\n    };\n  }, [target, opts.inView, opts.reduce]);\n\n  return value;\n}\n\n/* ------------------------------------------------------------------ */\n/* component                                                          */\n/* ------------------------------------------------------------------ */\n\nexport function AreaChart({\n  className,\n  title = \"Revenue\",\n  ranges = DEFAULT_RANGES,\n  defaultRange = \"30d\",\n  valuePrefix = \"$\",\n  formatValue,\n}: AreaChartProps) {\n  const uid = useId().replace(/:/g, \"\");\n  const cardRef = useRef<HTMLDivElement>(null);\n  const chartRef = useRef<HTMLDivElement>(null);\n  const lineRef = useRef<SVGPathElement>(null);\n\n  const inView = useInView(cardRef, { once: true, margin: \"-10% 0px\" });\n  /* Used only inside effects and event handlers (never in render output), so it\n     can't cause a server/client hydration mismatch. */\n  const reduce = Boolean(useReducedMotion());\n  const show = inView;\n\n  const [rangeKey, setRangeKey] = useState(defaultRange);\n  const [size, setSize] = useState<{ width: number; height: number } | null>(\n    null\n  );\n  const [morphValues, setMorphValues] = useState<number[] | null>(null);\n  const [hover, setHover] = useState<number | null>(null);\n  const morphAnim = useRef<ReturnType<typeof animate> | null>(null);\n  const drewRef = useRef(false);\n\n  const activeRange = ranges.find((r) => r.key === rangeKey) ?? ranges[0];\n  const gradientId = `area-chart-fill-${uid}`;\n  const pillId = `area-chart-pill-${uid}`;\n\n  const format =\n    formatValue ??\n    ((n: number) => valuePrefix + Math.round(n).toLocaleString(\"en-US\"));\n\n  const total = useAnimatedNumber(activeRange.total, { inView, reduce });\n  const delta = useAnimatedNumber(activeRange.delta, { inView, reduce });\n\n  /* measure the chart container so the SVG matches its pixel size */\n  useEffect(() => {\n    const el = chartRef.current;\n    if (!el) return;\n    const update = () => {\n      const rect = el.getBoundingClientRect();\n      setSize((prev) =>\n        prev && prev.width === rect.width && prev.height === rect.height\n          ? prev\n          : { width: rect.width, height: rect.height }\n      );\n    };\n    update();\n    const observer = new ResizeObserver(update);\n    observer.observe(el);\n    return () => observer.disconnect();\n  }, []);\n\n  const targetMax = useMemo(\n    () => niceMax(Math.max(...activeRange.points.map((p) => p.value))),\n    [activeRange]\n  );\n\n  const geometry = useMemo<Geometry | null>(() => {\n    if (!size) return null;\n    const values = morphValues ?? activeRange.points.map((p) => p.value);\n    return buildGeometry(\n      size.width,\n      size.height,\n      values,\n      targetMax,\n      activeRange.points.map((p) => p.date)\n    );\n  }, [size, morphValues, activeRange, targetMax]);\n\n  const switchRange = (key: string) => {\n    if (key === rangeKey) return;\n    const prevRange = activeRange;\n    const prevMax = niceMax(Math.max(...prevRange.points.map((p) => p.value)));\n    const next = ranges.find((r) => r.key === key);\n    if (!next) return;\n\n    const nextValues = next.points.map((p) => p.value);\n    const nextMax = niceMax(Math.max(...nextValues));\n    const scale = nextMax / prevMax;\n    const fromValues = resample(\n      prevRange.points.map((p) => p.value),\n      nextValues.length\n    );\n\n    setRangeKey(key);\n    setHover(null);\n\n    if (reduce) {\n      setMorphValues(null);\n      return;\n    }\n\n    morphAnim.current?.stop();\n    morphAnim.current = animate(0, 1, {\n      duration: 0.7,\n      ease: EASE,\n      onUpdate: (t) => {\n        setMorphValues(\n          nextValues.map(\n            (v, i) => fromValues[i] * scale + (v - fromValues[i] * scale) * t\n          )\n        );\n      },\n      onComplete: () => setMorphValues(null),\n    });\n  };\n\n  /* the line draws itself once on entrance */\n  useEffect(() => {\n    if (!show || reduce || !geometry || drewRef.current) return;\n    const el = lineRef.current;\n    if (!el) return;\n    drewRef.current = true;\n\n    const length = el.getTotalLength();\n    el.style.strokeDasharray = String(length);\n    el.style.strokeDashoffset = String(length);\n\n    const controls = animate(length, 0, {\n      duration: 1.1,\n      ease: EASE,\n      onUpdate: (v) => {\n        el.style.strokeDashoffset = String(v);\n      },\n      onComplete: () => {\n        el.style.strokeDasharray = \"none\";\n        el.style.strokeDashoffset = \"0\";\n      },\n    });\n\n    return () => {\n      controls.stop();\n      el.style.strokeDasharray = \"none\";\n      el.style.strokeDashoffset = \"0\";\n    };\n  }, [show, reduce, geometry]);\n\n  const activePoint =\n    geometry && hover != null ? geometry.points[hover] : undefined;\n  const tooltipDate = activeRange.points[hover ?? 0]?.date;\n  const tooltipValue = activeRange.points[hover ?? 0]?.value ?? 0;\n\n  const tipLeft =\n    activePoint && geometry\n      ? Math.max(\n          4,\n          Math.min(\n            geometry.W - 158,\n            activePoint.x > geometry.W * 0.5\n              ? activePoint.x - 158\n              : activePoint.x + 14\n          )\n        )\n      : 0;\n  const tipTop = activePoint ? Math.max(4, activePoint.y - 64) : 0;\n\n  const ariaLabel = `Daily revenue area chart. ${ranges\n    .map(\n      (r) =>\n        `${r.label}: ${r.rangeText}, total ${format(r.total)}, ${formatDelta(\n          r.delta\n        )}`\n    )\n    .join(\". \")}.`;\n\n  return (\n    <MotionConfig reducedMotion=\"user\">\n      <motion.div\n        ref={cardRef}\n        initial={{ opacity: 0, y: 20 }}\n        animate={show ? { opacity: 1, y: 0 } : { opacity: 0, y: 20 }}\n        transition={{ duration: 0.6, ease: EASE }}\n        className={cn(\n          \"rounded-xl border border-border bg-card text-card-foreground shadow-sm\",\n          className\n        )}\n      >\n        <div className=\"p-5 sm:p-6\">\n          <div className=\"flex flex-wrap items-start justify-between gap-3\">\n            <div>\n              <h2 className=\"text-[15px] font-semibold tracking-tight\">\n                {title}\n              </h2>\n              <p className=\"mt-0.5 text-[13px] text-muted-foreground\">\n                {activeRange.rangeText}\n              </p>\n            </div>\n\n            <div\n              role=\"tablist\"\n              aria-label=\"Range\"\n              className=\"inline-flex items-center rounded-lg bg-muted p-1\"\n            >\n              {ranges.map((r) => {\n                const active = r.key === rangeKey;\n                return (\n                  <button\n                    key={r.key}\n                    type=\"button\"\n                    role=\"tab\"\n                    aria-selected={active}\n                    onClick={() => switchRange(r.key)}\n                    className={cn(\n                      \"relative rounded-md px-3 py-1 text-[13px] font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n                      active\n                        ? \"text-foreground\"\n                        : \"text-muted-foreground hover:text-foreground\"\n                    )}\n                  >\n                    {active && (\n                      <motion.span\n                        layoutId={pillId}\n                        transition={{ type: \"tween\", duration: 0.35, ease: EASE }}\n                        className=\"absolute inset-0 rounded-md bg-card shadow-sm ring-1 ring-border\"\n                      />\n                    )}\n                    <span className=\"relative z-10\">{r.label}</span>\n                  </button>\n                );\n              })}\n            </div>\n          </div>\n\n          <div className=\"mt-5\">\n            <div className=\"text-[13px] font-medium text-muted-foreground\">\n              Total\n            </div>\n            <div className=\"mt-0.5 flex flex-wrap items-center gap-x-3 gap-y-1\">\n              <span className=\"text-3xl font-semibold tracking-tight tabular-nums\">\n                {format(total)}\n              </span>\n              <span\n                className={cn(\n                  \"inline-flex items-center gap-0.5 text-[13px] font-medium tabular-nums\",\n                  delta >= 0 ? \"text-success\" : \"text-destructive\"\n                )}\n              >\n                {delta >= 0 ? (\n                  <ArrowUpRight className=\"h-3.5 w-3.5\" />\n                ) : (\n                  <ArrowDownRight className=\"h-3.5 w-3.5\" />\n                )}\n                {formatDelta(delta)}\n              </span>\n            </div>\n          </div>\n\n          <div className=\"mt-4 text-[13px] font-medium text-muted-foreground\">\n            Daily revenue\n          </div>\n\n          <div ref={chartRef} className=\"relative mt-1 h-72 w-full sm:h-80\">\n            {geometry && (\n              <svg\n                viewBox={`0 0 ${geometry.W} ${geometry.H}`}\n                role=\"img\"\n                aria-label={ariaLabel}\n                tabIndex={0}\n                onKeyDown={(e) => {\n                  if (!geometry) return;\n                  if (e.key === \"ArrowLeft\" || e.key === \"ArrowRight\") {\n                    e.preventDefault();\n                    const dir = e.key === \"ArrowRight\" ? 1 : -1;\n                    setHover((h) =>\n                      h == null\n                        ? dir === 1\n                          ? 0\n                          : geometry.n - 1\n                        : clamp(h + dir, 0, geometry.n - 1)\n                    );\n                  } else if (e.key === \"Home\") {\n                    e.preventDefault();\n                    setHover(0);\n                  } else if (e.key === \"End\") {\n                    e.preventDefault();\n                    setHover(geometry.n - 1);\n                  }\n                }}\n                onFocus={() => {\n                  if (geometry) {\n                    setHover((h) => h ?? Math.floor(geometry.n / 2));\n                  }\n                }}\n                onBlur={() => setHover(null)}\n                className=\"block h-full w-full focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n              >\n                <defs>\n                  <linearGradient\n                    id={gradientId}\n                    x1=\"0\"\n                    y1=\"0\"\n                    x2=\"0\"\n                    y2=\"1\"\n                  >\n                    <stop\n                      offset=\"0%\"\n                      stopColor=\"var(--chart-1)\"\n                      stopOpacity={0.18}\n                    />\n                    <stop\n                      offset=\"100%\"\n                      stopColor=\"var(--chart-1)\"\n                      stopOpacity={0}\n                    />\n                  </linearGradient>\n                </defs>\n\n                {geometry.yTicks.map((tick, i) => (\n                  <line\n                    key={`gl-${i}`}\n                    x1={geometry.L}\n                    x2={geometry.W - geometry.R}\n                    y1={tick.y}\n                    y2={tick.y}\n                    stroke=\"var(--border)\"\n                    strokeDasharray=\"3 3\"\n                  />\n                ))}\n\n                <motion.g\n                  key={`${rangeKey}-y`}\n                  initial={{ opacity: 0 }}\n                  animate={{ opacity: 1 }}\n                  transition={{ duration: 0.4, delay: 0.1 }}\n                >\n                  {geometry.yTicks.map((tick, i) => (\n                    <text\n                      key={`y-${i}`}\n                      x={geometry.L - 10}\n                      y={tick.y + 4}\n                      textAnchor=\"end\"\n                      className=\"fill-muted-foreground text-[11px]\"\n                    >\n                      {formatCompact(tick.value, valuePrefix)}\n                    </text>\n                  ))}\n                </motion.g>\n\n                <motion.g\n                  key={`${rangeKey}-x`}\n                  initial={{ opacity: 0 }}\n                  animate={{ opacity: 1 }}\n                  transition={{ duration: 0.4, delay: 0.1 }}\n                >\n                  {geometry.xTicks.map((tick) => (\n                    <text\n                      key={`x-${tick.index}`}\n                      x={tick.x}\n                      y={geometry.H - 8}\n                      textAnchor=\"middle\"\n                      className=\"fill-muted-foreground text-[11px]\"\n                    >\n                      {tick.label}\n                    </text>\n                  ))}\n                </motion.g>\n\n                <motion.path\n                  d={geometry.area}\n                  fill={`url(#${gradientId})`}\n                  initial={{ opacity: 0 }}\n                  animate={{ opacity: show ? 1 : 0 }}\n                  transition={{ delay: 0.55, duration: 0.7, ease: EASE }}\n                />\n\n                <path\n                  ref={lineRef}\n                  d={geometry.line}\n                  fill=\"none\"\n                  stroke=\"var(--chart-1)\"\n                  strokeWidth={2}\n                  strokeLinecap=\"round\"\n                  strokeLinejoin=\"round\"\n                />\n\n                <motion.g\n                  initial={{ opacity: 0 }}\n                  animate={{ opacity: show ? 1 : 0 }}\n                  transition={{ delay: 1.05, duration: 0.4, ease: EASE }}\n                >\n                  <circle\n                    cx={geometry.points[geometry.n - 1].x}\n                    cy={geometry.points[geometry.n - 1].y}\n                    r={5}\n                    fill=\"var(--card)\"\n                    stroke=\"var(--chart-1)\"\n                    strokeWidth={2}\n                  />\n                  <circle\n                    cx={geometry.points[geometry.n - 1].x}\n                    cy={geometry.points[geometry.n - 1].y}\n                    r={1.75}\n                    fill=\"var(--chart-1)\"\n                  />\n                  <circle\n                    cx={geometry.points[geometry.n - 1].x - 1.1}\n                    cy={geometry.points[geometry.n - 1].y - 1.1}\n                    r={0.8}\n                    fill=\"var(--card)\"\n                  />\n                </motion.g>\n\n                <motion.g\n                  initial={false}\n                  animate={{ opacity: activePoint ? 1 : 0 }}\n                  transition={{ duration: 0.15 }}\n                >\n                  {activePoint && (\n                    <>\n                      <line\n                        x1={activePoint.x}\n                        x2={activePoint.x}\n                        y1={geometry.T}\n                        y2={geometry.H - geometry.B}\n                        stroke=\"var(--muted-foreground)\"\n                        strokeWidth={1}\n                        strokeDasharray=\"3 3\"\n                      />\n                      <circle\n                        cx={activePoint.x}\n                        cy={activePoint.y}\n                        r={9}\n                        fill=\"none\"\n                        stroke=\"var(--chart-1)\"\n                        strokeWidth={1}\n                        opacity={0.25}\n                      />\n                      <circle\n                        cx={activePoint.x}\n                        cy={activePoint.y}\n                        r={4.5}\n                        fill=\"var(--card)\"\n                        stroke=\"var(--chart-1)\"\n                        strokeWidth={2}\n                      />\n                      <circle\n                        cx={activePoint.x}\n                        cy={activePoint.y}\n                        r={1.5}\n                        fill=\"var(--chart-1)\"\n                      />\n                    </>\n                  )}\n                </motion.g>\n\n                <rect\n                  x={geometry.L}\n                  y={0}\n                  width={geometry.W - geometry.L - geometry.R}\n                  height={geometry.H}\n                  fill=\"transparent\"\n                  style={{ cursor: \"crosshair\" }}\n                  onPointerMove={(e) => {\n                    const el = chartRef.current;\n                    if (!el || !geometry) return;\n                    const px = e.clientX - el.getBoundingClientRect().left;\n                    const step =\n                      (geometry.W - geometry.L - geometry.R) /\n                      (geometry.n - 1);\n                    const index = Math.round((px - geometry.L) / step);\n                    setHover(clamp(index, 0, geometry.n - 1));\n                  }}\n                  onPointerLeave={() => setHover(null)}\n                />\n              </svg>\n            )}\n\n            <AnimatePresence>\n              {activePoint && hover != null && (\n                <motion.div\n                  key=\"tooltip\"\n                  initial={{ opacity: 0, scale: 0.96, y: 4 }}\n                  animate={{ opacity: 1, scale: 1, y: 0 }}\n                  exit={{ opacity: 0, scale: 0.96, y: 4 }}\n                  transition={{ duration: 0.16, ease: \"easeOut\" }}\n                  className=\"pointer-events-none absolute z-10 min-w-[132px] rounded-lg border border-border bg-card px-3 py-2 shadow-lg\"\n                  style={{ left: tipLeft, top: tipTop }}\n                >\n                  <div className=\"text-[12px] text-muted-foreground\">\n                    {tooltipDate}\n                  </div>\n                  <div className=\"mt-0.5 flex items-center gap-2\">\n                    <span\n                      className=\"h-2 w-2 rounded-full\"\n                      style={{ background: \"var(--chart-1)\" }}\n                    />\n                    <span className=\"text-[13px] font-medium tabular-nums\">\n                      {format(tooltipValue)}\n                    </span>\n                  </div>\n                </motion.div>\n              )}\n            </AnimatePresence>\n          </div>\n        </div>\n      </motion.div>\n    </MotionConfig>\n  );\n}\n\nexport default AreaChart;\n"}]}