{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "capture-reveal",
  "title": "Capture Reveal",
  "description": "Screenshot capture animation: a toast counts \"Capturing selection…\" up to 100% over a browser window, the window drops away and shrinks, the toast pops to \"Copied to clipboard.\" and a two-line headline rises out from behind the window while the cursor glides up. Every curve was measured off a recording frame by frame: the window's drop and shrink share one cubic-bezier, the toast pops on another, the headline rises without scaling or blurring, and type moves by fractions of a pixel.",
  "dependencies": [
    "remotion",
    "@remotion/google-fonts"
  ],
  "registryDependencies": [
    "https://snapcn.dev/r/snap-cn-ui.json"
  ],
  "files": [
    {
      "path": "registry/snap-cn/capture-reveal/index.tsx",
      "content": "// Capture Reveal · snapcn — https://snapcn.dev/docs/screens/capture-reveal\n\"use client\";\n\nimport { loadFont as loadDmSans } from \"@remotion/google-fonts/DMSans\";\nimport {\n  type CSSProperties,\n  type ReactNode,\n  type RefObject,\n  useEffect,\n  useId,\n  useLayoutEffect,\n  useRef,\n  useState,\n} from \"react\";\nimport {\n  AbsoluteFill,\n  continueRender,\n  delayRender,\n  Easing,\n  getRemotionEnvironment,\n  staticFile,\n  useCurrentFrame,\n  useVideoConfig,\n} from \"remotion\";\nimport {\n  mixOklch,\n  resolveFont,\n  type SnapCnTheme,\n  useSnapCnTheme,\n} from \"@/lib/snap-cn-ui\";\n\n/**\n * A screenshot being taken: \"Capturing selection… 79%\" counts up in a toast\n * over a browser window, the window drops away and shrinks, the toast pops to\n * \"Copied to clipboard.\" and a two-line headline rises out from behind the\n * window while the cursor glides up to the toast.\n *\n * ## Everything here was measured off a recording, frame by frame\n *\n * The numbers below are not taste. They were recovered from a 1.21 second,\n * 714 × 394, 24fps screen capture (29 frames) by fitting renders of each\n * element to it in BT.709 Y′CbCr, through the capture's own blur (σ 0.62px):\n *\n *   - the window is ONE transform about a fixed origin: a 107.9px drop and a\n *     15.8% shrink on the same curve, `cubic-bezier(0.549, 0.228, 0.136,\n *     0.938)` over 19.16 frames (0.06px RMS), and then a slow exponential\n *     shrink (τ 1.2s) that starts the frame the drop lands (0.03% RMS).\n *   - the cursor glides on its own in-out curve over 19.5 frames and then\n *     keeps drifting up — a hand that has not quite stopped (0.07px RMS).\n *   - the \"Copied\" toast pops from 0.905 to 1 on `cubic-bezier(0.301, 1.056,\n *     0.803, 1)` over 22.8 frames. The \"Capturing\" toast is the same curve run\n *     the other way: it presses in to 0.881 while the counter runs, which is\n *     why the swap reads as a release.\n *   - the headline does not scale and does not blur. It rises 22.6px on\n *     `cubic-bezier(0.114, 1, 0.665, 1)` over 24 frames and fades in on a\n *     faster curve of its own, from behind the window.\n *   - the counter is linear: +3% a frame, 1% → 100%.\n *\n * The recording starts mid-count, so the 1.33s before its first frame — the\n * toast arriving and pressing in — is built from the same curves, not\n * measured. Everything after is the recording.\n *\n * ## The type is DM Sans, at the optical sizes the recording used\n *\n * Fingerprinted against thirty faces: DM Sans at opsz 40 is the closest free\n * match for the headline, and DM Sans at opsz 9 for the toast. The opsz axis is\n * pinned per element rather than left to `font-optical-sizing`, so a render at\n * any resolution draws the letterforms the recording has — a 1080p render\n * would otherwise give the toast its display cut.\n */\n\nconst { fontFamily: DM_SANS } = loadDmSans(\"normal\", {\n  weights: [\"400\"],\n  subsets: [\"latin\"],\n});\n\n/** DM Sans with its `opsz` axis, which the Google CSS API does not serve. */\nconst FACE = \"Capture Reveal DM Sans\";\nconst FACE_URL =\n  \"https://cdn.jsdelivr.net/npm/@fontsource-variable/dm-sans@5.3.0/files/dm-sans-latin-opsz-normal.woff2\";\nlet faceLoad: Promise<unknown> | null = null;\nfunction loadFace(): Promise<unknown> {\n  if (faceLoad) return faceLoad;\n  if (typeof FontFace === \"undefined\") {\n    faceLoad = Promise.resolve();\n    return faceLoad;\n  }\n  const face = new FontFace(FACE, `url(${FACE_URL}) format(\"woff2\")`, {\n    weight: \"100 1000\",\n  });\n  document.fonts.add(face);\n  // A face that fails to load leaves Google's DM Sans to paint — close, not exact.\n  faceLoad = face.load().catch(() => undefined);\n  return faceLoad;\n}\n\n/* ─────────────────────────────────────────────────────────────────────────\n   The scene, in the reference's own 714 × 394 pixels and 24fps frames\n   ───────────────────────────────────────────────────────────────────────── */\n\nexport const REF_W = 714;\nexport const REF_H = 394;\n/** The recording's frame rate. Every time below is in its frames, \"beats\". */\nexport const BEATS = 24;\n/** Where the recording's first frame sits on this scene's clock, in beats. */\nexport const REF_AT = 32;\n/** The scene's length in beats: the recording's 29, a held tail, and the lead-in. */\nexport const SCENE_BEATS = 104;\n\n/** The page: a 45px grid, fainter across than down — measured per line. */\nexport const GRID = {\n  x0: 12.85,\n  dx: 45.379,\n  y0: 16.44,\n  dy: 45.245,\n  /** Ink of one line, as a mix toward `foreground` at 1px. */\n  across: 0.0275,\n  down: 0.0149,\n};\n\n/** The window at rest: its box, top corners, and the shadow it casts. */\nexport const WIN = { x: 152.34, y: 106.57, w: 400.76, r: 9 };\nexport const WIN_SHADOW = { dy: 5.9, blur: 10.07, spread: -1.21, alpha: 0.207 };\n/** The point the window scales about — its centre, on the measured 508.5 box. */\nexport const WIN_ORIGIN = [352.85, 361.33] as const;\n/** The drop: how far, and the shrink that rides the same curve. */\nexport const DROP = 107.905;\nexport const SHRINK = 0.1581;\nexport const DROP_AT = 0.154;\nexport const DROP_FOR = 19.16;\nexport const DROP_EASE = Easing.bezier(0.5492, 0.2279, 0.1361, 0.9381);\n/** The slow shrink after the drop lands. */\nexport const SETTLE = 0.0267;\nexport const SETTLE_AT = 18.62;\nexport const SETTLE_TAU = 28.94;\n\n/** The cursor's tip, where it glides, and the drift after. */\nexport const CURSOR_FROM = [573.334, 189.634] as const;\nexport const CURSOR_BY = [-83.28, -111.49] as const;\nexport const CURSOR_AT = -0.03;\nexport const CURSOR_FOR = 19.5;\nexport const CURSOR_EASE = Easing.bezier(0.54, 0.1, 0.41, 0.97);\nexport const DRIFT = [-0.16, -0.43] as const;\nexport const DRIFT_AT = 19;\n/** The arrowhead, from its tip: right point, notch, heel. Fitted outline. */\nexport const ARROW: readonly (readonly [number, number])[] = [\n  [0, 0],\n  [14.779, 15.455],\n  [5.855, 15.72],\n  [0.051, 21.146],\n];\nexport const ARROW_OUTLINE = 1.194;\nexport const ARROW_SHADOW = {\n  dx: -1.571,\n  dy: 1.45,\n  sigma: 0.716,\n  alpha: 0.247,\n};\n\n/** The headline: centre, the middle of its block, and the type. */\nexport const HEAD = {\n  x: 353.64,\n  mid: 188.619,\n  pitch: 45.304,\n  size: 45.93,\n  weight: 367,\n  track: 0.952,\n  opsz: 40,\n  /** Its ink, as a mix from `foreground` toward `mutedForeground`: #2b2b2b. */\n  ink: 0.29,\n};\nexport const RISE = 22.585;\nexport const RISE_AT = 7.342;\nexport const RISE_FOR = 23.972;\nexport const RISE_EASE = Easing.bezier(0.114, 1, 0.665, 1);\nexport const FADE_AT = 8;\nexport const FADE_FOR = 8.322;\nexport const FADE_EASE = Easing.bezier(0, 0.235, 0.166, 1);\n\n/** Both toasts share a surface and a type style. */\nexport const TOAST = {\n  h: 49.357,\n  r: 8.879,\n  shadow: { dy: 0.012, blur: 14.549, spread: -2.397, alpha: 0.2512 },\n  size: 12.46,\n  weight: 347,\n  track: -0.192,\n  opsz: 9,\n};\n/** \"Copied\": centre, and its row laid out from the box's left edge. */\nexport const COPIED = {\n  at: [357.7, 62.904] as const,\n  check: { x: 21.371, dy: 0.005, r: 7.143, stroke: 1.124 },\n  /** The tick, from the circle's centre. */\n  tick: [\n    [-3.232, 0.238],\n    [-0.916, 2.835],\n    [3.193, -2.28],\n  ] as const,\n  text: { x: 38.469, base: 3.445 },\n  right: 18.464,\n};\n/**\n * \"Capturing\": centre and scale at rest, and its row from the box's left edge.\n * The counter gets the width of \"100%\" whatever it reads, so the box does not\n * twitch as the digits change — with the same 10px either side of it.\n */\nexport const CAPTURING = {\n  at: [353.221, 63.002] as const,\n  scale: 0.8855,\n  icon: { x: 20.957, dy: -1.09 },\n  text: { x: 39.039, base: 3.665 },\n  gap: 10.067,\n  right: 10.067,\n  percent: { base: 4.731 },\n};\n/**\n * The toast's mark: snapcn's, in its own 432 × 349.84 ink box, set 14px wide and\n * centred where the reference's app mark sat (its box ran x −5.5…8.9, y −5.9…8.7).\n * The recording carried another product's logo; a component ships ours.\n */\nexport const MARK = {\n  path: \"M43.9 1.41C27.2 5.51 13.4 16.31 5.9 31.11C-0.1 43.11 0 39.51 0 155.01C0 255.41 0.1 260.92 1.9 266.22C6.7 280.92 16.7 288.81 35 292.42C45 294.42 47.7 295.72 53.6 301.12C58.9 306.02 61 312.02 61 322.31C61.1 334.42 65.2 341.92 74.3 346.72L79.5 349.42L177.5 349.72C265.8 350.02 276.1 349.81 281.7 348.42C289.2 346.31 295 341.72 298.8 334.52L301.5 329.42L301.8 297.92C302 280.62 302 263.72 301.8 260.52L301.5 254.52L298.4 259.52C294.8 265.42 288.3 271.02 281.4 274.12L276.5 276.42L195.5 276.72C136.4 276.92 113 276.72 109 275.92C96.2 273.12 83.2 263.81 76.5 252.52C70 241.52 69.9 239.71 70.2 169.91L70.5 107.41L72.9 101.61C77.3 90.51 87.6 80.61 99.9 75.72L105.5 73.41L188.5 73.11C269.4 72.91 271.6 72.91 278 74.91C286 77.41 292.9 82.31 297.8 89.11L301.5 94.31L301.8 60.91C302.1 24.21 301.5 19.11 296.2 11.51C293.2 7.11 286.4 2.41 281 0.91C278.8 0.31 235.3-0.09 163.5 0.01C71.2 0.11 48.4 0.31 43.9 1.41ZM365 83.61C332.3 103.22 305.2 119.72 304.8 120.31C304.4 120.91 304.1 145.71 304.3 175.31L304.5 229.31L319 238.41C327 243.41 339.8 251.41 347.5 256.12C355.2 260.81 375.8 273.52 393.2 284.31C410.6 295.12 425.8 303.92 426.9 303.92C428 303.92 429.6 303.22 430.4 302.31C431.8 300.92 432 288.22 432 176.91C432 98.81 431.6 52.11 431 50.51C430.3 48.51 429.4 47.91 427.3 47.91C425.5 48.01 404.1 60.21 365 83.61Z\",\n  width: 432,\n  height: 349.84,\n  /** Rendered width, and the centre it sits on, in reference pixels. */\n  size: 14,\n  cx: 1.7,\n  cy: 1.4,\n};\n/**\n * The toast's greys, as mixes of the theme's own: on the default light theme\n * they land on the recording's #474747 / #4f4f4f / #d0d0d0 / #c9c9c9.\n */\nexport const INK = {\n  copied: 0.615,\n  capturing: 0.705,\n  percent: 0.6975,\n  mark: 0.6525,\n};\n/** The swap, and the pop both toasts ride. */\nexport const SWAP_AT = 7.5;\nexport const POP_FROM = 0.9053;\nexport const POP_FOR = 22.84;\nexport const POP_EASE = Easing.bezier(0.3012, 1.056, 0.8028, 1.0);\n/** The lead-in nobody recorded: the toast arrives, then presses in. */\nexport const TOAST_IN = -26;\nexport const PRESS_AT = -24;\n/** The counter: 1% at `TOAST_IN`, three a frame. */\nexport const COUNT_RATE = 3;\n\nconst unit = (v: number) => Math.min(1, Math.max(0, v));\nconst ease = (f: (t: number) => number, at: number, dur: number, n: number) =>\n  f(unit((n - at) / dur));\n\n/** The window's drop and scale at beat `n`. */\nexport function windowAt(n: number): { drop: number; scale: number } {\n  const p = ease(DROP_EASE, DROP_AT, DROP_FOR, n);\n  const settle =\n    n > SETTLE_AT ? SETTLE * (1 - Math.exp(-(n - SETTLE_AT) / SETTLE_TAU)) : 0;\n  return { drop: DROP * p, scale: 1 - SHRINK * p - settle };\n}\n\n/** The cursor tip at beat `n`. */\nexport function cursorAt(n: number): [number, number] {\n  const p = ease(CURSOR_EASE, CURSOR_AT, CURSOR_FOR, n);\n  const d = Math.max(0, n - DRIFT_AT);\n  return [\n    CURSOR_FROM[0] + CURSOR_BY[0] * p + DRIFT[0] * d,\n    CURSOR_FROM[1] + CURSOR_BY[1] * p + DRIFT[1] * d,\n  ];\n}\n\n/** The headline's rise (px still to climb) and opacity at beat `n`. */\n/**\n * The outro — not in the recording, built from its curves: once everything has\n * settled, the window slides out of the bottom of the frame on the drop's own\n * curve, the toast and cursor fade out on the headline's fade run backwards,\n * and the headline pushes forward to the middle of the frame.\n */\nexport const OUTRO_AT = 40;\n/** How far the window falls on its way out, past the frame's bottom edge. */\nexport const OUTRO_DROP = 240;\n/** The headline's push: scale, and the frame-middle it settles on. */\nexport const OUTRO_SCALE = 1.3;\nexport const OUTRO_MID = REF_H / 2;\n\n/** Outro progress at beat `n`: the drop (window, headline) and the fade. */\nexport function outroAt(n: number): { p: number; fade: number } {\n  return {\n    p: ease(DROP_EASE, OUTRO_AT, DROP_FOR, n),\n    fade: n < OUTRO_AT ? 1 : 1 - ease(FADE_EASE, OUTRO_AT, FADE_FOR, n),\n  };\n}\n\nexport function headlineAt(n: number): { rise: number; opacity: number } {\n  return {\n    rise: RISE * (1 - ease(RISE_EASE, RISE_AT, RISE_FOR, n)),\n    opacity: n < FADE_AT ? 0 : ease(FADE_EASE, FADE_AT, FADE_FOR, n),\n  };\n}\n\n/** The counter's reading at beat `n`. */\nexport function percentAt(n: number): number {\n  // The epsilon is for the clock, not the count: 32/24·24 is 31.999…\n  return Math.min(100, Math.floor(1 + COUNT_RATE * (n - TOAST_IN) + 1e-6));\n}\n\n/** Which toast is up, and its scale and opacity at beat `n`. */\nexport function toastAt(n: number): {\n  copied: boolean;\n  scale: number;\n  opacity: number;\n} {\n  if (n >= SWAP_AT) {\n    const p = ease(POP_EASE, SWAP_AT, POP_FOR, n);\n    return { copied: true, scale: POP_FROM + (1 - POP_FROM) * p, opacity: 1 };\n  }\n  const p = ease(POP_EASE, PRESS_AT, POP_FOR, n);\n  return {\n    copied: false,\n    scale: 1 - (1 - CAPTURING.scale) * p,\n    opacity: n < TOAST_IN ? 0 : ease(FADE_EASE, TOAST_IN, FADE_FOR, n),\n  };\n}\n\n/**\n * A line of type that can sit — and move — a fraction of a pixel.\n *\n * Chrome rounds a glyph run's baseline to a whole device pixel, in HTML and\n * SVG alike. The headline's rise ends in a long, slow crawl — a tenth of a\n * pixel a frame — that would otherwise hold still and then jump. So the line\n * is painted twice, one device pixel apart, both on whole pixels, cross-faded\n * by the fraction in between; `plus-lighter` adds the two copies' coverage,\n * so the blend is exactly linear. (Same trick as check-cycle.)\n */\nfunction Line({\n  x,\n  y,\n  dev,\n  style,\n  children,\n}: {\n  x: number;\n  y: number;\n  /** A baseline at y, in this group's units, lands on device row a·y + b. */\n  dev: { a: number; b: number };\n  style: CSSProperties;\n  children: ReactNode;\n}) {\n  // The Player scales the scene with CSS, so its pixel grid is not the one\n  // `dev` describes — there a single copy is the honest choice.\n  if (getRemotionEnvironment().isPlayer)\n    return (\n      <text x={x} y={y} style={style}>\n        {children}\n      </text>\n    );\n  const d = dev.a * y + dev.b;\n  const lo = Math.floor(d);\n  const f = d - lo;\n  const at = (row: number) => (row + 1e-3 - dev.b) / dev.a;\n  return (\n    <g style={{ isolation: \"isolate\" }}>\n      {[\n        [lo, 1 - f],\n        [lo + 1, f],\n      ].map(([row, w]) =>\n        (w ?? 0) < 1e-3 ? null : (\n          <text\n            key={row}\n            x={x}\n            y={at(row ?? 0)}\n            style={{ ...style, opacity: w, mixBlendMode: \"plus-lighter\" }}\n          >\n            {children}\n          </text>\n        ),\n      )}\n    </g>\n  );\n}\n\n/**\n * A root-relative asset is a `public/` file. Only the site's own Player serves\n * it at that path; Remotion Studio and a render know its URL through\n * `staticFile()` alone — so every environment but the Player rewrites it.\n */\nfunction resolveSrc(src: string): string {\n  const isLocal = src.startsWith(\"/\") && !src.startsWith(\"//\");\n  if (!isLocal || getRemotionEnvironment().isPlayer) return src;\n  const base = staticFile(\"_\").slice(0, -2);\n  if (base && src.startsWith(`${base}/`)) return src;\n  try {\n    return staticFile(src.replace(/^\\/+/, \"\"));\n  } catch {\n    return src;\n  }\n}\n\n/** The screenshot's natural aspect, held behind the render until it is known. */\nfunction useAspect(src: string): number | null {\n  const [aspect, setAspect] = useState<number | null>(null);\n  const [handle] = useState(() => delayRender(`capture-reveal: ${src}`));\n  useEffect(() => {\n    if (!src) {\n      continueRender(handle);\n      return;\n    }\n    const img = new Image();\n    img.onload = () => {\n      setAspect(img.naturalHeight / Math.max(1, img.naturalWidth));\n      continueRender(handle);\n    };\n    img.onerror = () => continueRender(handle);\n    img.src = src;\n  }, [src, handle]);\n  return aspect;\n}\n\n/** Advance widths of the toast copy, measured in the real face once it loads. */\nfunction useWidths(\n  texts: string[],\n  font: string,\n): [number[] | null, RefObject<SVGGElement | null>] {\n  const probe = useRef<SVGGElement>(null);\n  const [widths, setWidths] = useState<number[] | null>(null);\n  const [handle] = useState(() => delayRender(\"capture-reveal: measure\"));\n  const key = texts.join(\"\\u0000\");\n  // biome-ignore lint/correctness/useExhaustiveDependencies: `key` is `texts`\n  useLayoutEffect(() => {\n    let live = true;\n    loadFace()\n      .then(() => document.fonts.ready)\n      .then(() => {\n        if (!live) return;\n        const nodes = probe.current?.querySelectorAll(\"text\") ?? [];\n        setWidths(Array.from(nodes, (t) => t.getComputedTextLength()));\n        continueRender(handle);\n      });\n    return () => {\n      live = false;\n    };\n  }, [key, font, handle]);\n  return [widths, probe];\n}\n\nexport interface CaptureRevealProps {\n  /** The headline; `|` breaks it into lines. */\n  headline?: string;\n  /** The toast while the counter runs. */\n  capturing?: string;\n  /** The toast once it lands. */\n  copied?: string;\n  /** The screenshot in the window: an image, laid in at full width, top first. */\n  src?: string;\n  theme?: Partial<SnapCnTheme>;\n  mode?: \"light\" | \"dark\";\n  fontFamily?: string;\n}\n\nexport function CaptureReveal({\n  headline = \"no more | keyframes\",\n  capturing = \"Capturing selection...\",\n  copied = \"Copied to clipboard.\",\n  src = \"https://media.snapcn.dev/stills/capture-reveal-window.webp\",\n  theme,\n  mode = \"light\",\n  fontFamily = \"Default\",\n}: CaptureRevealProps) {\n  const frame = useCurrentFrame();\n  const { fps, width, height } = useVideoConfig();\n  const t = useSnapCnTheme(theme, mode);\n  const face = resolveFont(fontFamily) ?? `\"${FACE}\", ${DM_SANS}`;\n  const id = useId().replace(/:/g, \"\");\n  const image = src ? resolveSrc(src) : \"\";\n  const aspect = useAspect(image);\n  const [widths, probe] = useWidths([capturing, copied, \"100%\"], face);\n\n  const n = (frame / fps) * BEATS - REF_AT;\n  const u = Math.min(width / REF_W, height / REF_H);\n  const left = (width - REF_W * u) / 2;\n  const top = (height - REF_H * u) / 2;\n  // A Remotion render's `scale` is the page's devicePixelRatio.\n  const dpr = typeof window === \"undefined\" ? 1 : window.devicePixelRatio || 1;\n\n  /* — the page — */\n  const lineX = mixOklch(t.background, t.foreground, GRID.down);\n  const lineY = mixOklch(t.background, t.foreground, GRID.across);\n  const view = { x: -left / u, y: -top / u, w: width / u, h: height / u };\n  const cols: number[] = [];\n  for (\n    let x = GRID.x0 + Math.floor((view.x - GRID.x0) / GRID.dx) * GRID.dx;\n    x < view.x + view.w;\n    x += GRID.dx\n  )\n    cols.push(x);\n  const rows: number[] = [];\n  for (\n    let y = GRID.y0 + Math.floor((view.y - GRID.y0) / GRID.dy) * GRID.dy;\n    y < view.y + view.h;\n    y += GRID.dy\n  )\n    rows.push(y);\n\n  /* — the window — */\n  const win = windowAt(n);\n  const [ox, oy] = WIN_ORIGIN;\n  const winH = WIN.w * (aspect ?? 1.25);\n  const out = outroAt(n);\n  const winT = `translate(${ox} ${oy + win.drop + OUTRO_DROP * out.p}) scale(${win.scale}) translate(${-ox} ${-oy})`;\n\n  /* — the headline — */\n  const lines = headline\n    .split(\"|\")\n    .map((l) => l.trim())\n    .filter(Boolean);\n  const head = headlineAt(n);\n  const headType: CSSProperties = {\n    fontFamily: face,\n    fontSize: HEAD.size,\n    fontWeight: HEAD.weight,\n    fontVariationSettings: `\"opsz\" ${HEAD.opsz}`,\n    letterSpacing: HEAD.track,\n    fill: mixOklch(t.foreground, t.mutedForeground, HEAD.ink),\n    textAnchor: \"middle\",\n    // Unhinted outlines, so the sub-pixel `Line` blend moves the shape it drew.\n    textRendering: \"geometricPrecision\",\n  };\n\n  /* — the toast — */\n  const toast = toastAt(n);\n  const [wCapturing, wCopied, wFull] = widths ?? [0, 0, 0];\n  const capText = CAPTURING.text.x + (wCapturing ?? 0) + CAPTURING.gap;\n  const boxW = toast.copied\n    ? COPIED.text.x + (wCopied ?? 0) + COPIED.right\n    : capText + (wFull ?? 0) + CAPTURING.right;\n  const [cx, cy] = toast.copied ? COPIED.at : CAPTURING.at;\n  const boxL = cx - boxW / 2;\n  const s = toast.scale;\n  const toastType: CSSProperties = {\n    fontFamily: face,\n    fontSize: TOAST.size,\n    fontWeight: TOAST.weight,\n    fontVariationSettings: `\"opsz\" ${TOAST.opsz}`,\n    letterSpacing: TOAST.track,\n    textRendering: \"geometricPrecision\",\n  };\n  // Toast group: y_stage = cy + s·(y − cy) → device row = a·y + b.\n  const toastDev = { a: dpr * u * s, b: dpr * (top + u * cy * (1 - s)) };\n  // The push scales the block about its middle and carries that middle to the\n  // frame's: y_stage = m + k·(y − mid), so the rows map as a·y + b.\n  const k = 1 + (OUTRO_SCALE - 1) * out.p;\n  const m = HEAD.mid + (OUTRO_MID - HEAD.mid) * out.p;\n  const headT = `translate(${HEAD.x} ${m}) scale(${k}) translate(${-HEAD.x} ${-HEAD.mid})`;\n  const headDev = { a: dpr * u * k, b: dpr * (top + u * (m - k * HEAD.mid)) };\n  const ts = TOAST.shadow;\n\n  /* — the cursor — */\n  const [tx, ty] = cursorAt(n);\n\n  const muted = t.mutedForeground;\n  const inkCopied = mixOklch(t.foreground, muted, INK.copied);\n  const inkCapturing = mixOklch(t.foreground, muted, INK.capturing);\n  const inkPercent = mixOklch(muted, t.card, INK.percent);\n  const inkMark = mixOklch(muted, t.card, INK.mark);\n  const check = { x: boxL + COPIED.check.x, y: cy + COPIED.check.dy };\n\n  return (\n    <AbsoluteFill style={{ backgroundColor: t.background }}>\n      <svg\n        width={width}\n        height={height}\n        viewBox={`${view.x} ${view.y} ${view.w} ${view.h}`}\n        style={{ position: \"absolute\", inset: 0 }}\n      >\n        <defs>\n          <filter id={`${id}-win`} x=\"-50%\" y=\"-50%\" width=\"200%\" height=\"200%\">\n            <feGaussianBlur stdDeviation={WIN_SHADOW.blur / 2} />\n          </filter>\n          <filter\n            id={`${id}-toast`}\n            x=\"-50%\"\n            y=\"-100%\"\n            width=\"200%\"\n            height=\"300%\"\n          >\n            <feGaussianBlur stdDeviation={ts.blur / 2} />\n          </filter>\n          <filter\n            id={`${id}-arrow`}\n            x=\"-50%\"\n            y=\"-50%\"\n            width=\"200%\"\n            height=\"200%\"\n          >\n            <feDropShadow\n              dx={ARROW_SHADOW.dx}\n              dy={ARROW_SHADOW.dy}\n              stdDeviation={ARROW_SHADOW.sigma}\n              floodColor=\"#000\"\n              floodOpacity={ARROW_SHADOW.alpha}\n            />\n          </filter>\n          <clipPath id={`${id}-clip`}>\n            <rect x={WIN.x} y={WIN.y} width={WIN.w} height={winH} rx={WIN.r} />\n          </clipPath>\n        </defs>\n\n        {/* The page's grid: hairlines, one reference pixel wide. */}\n        <g>\n          {cols.map((x) => (\n            <rect\n              key={`c${x}`}\n              x={x - 0.5}\n              y={view.y}\n              width={1}\n              height={view.h}\n              fill={lineX}\n            />\n          ))}\n          {rows.map((y) => (\n            <rect\n              key={`r${y}`}\n              x={view.x}\n              y={y - 0.5}\n              width={view.w}\n              height={1}\n              fill={lineY}\n            />\n          ))}\n        </g>\n\n        {/* The headline sits behind the window and rises out from under it. */}\n        {head.opacity > 0 && (\n          <g opacity={head.opacity} transform={headT}>\n            {lines.map((line, i) => (\n              <Line\n                key={`${i}-${line}`}\n                x={HEAD.x}\n                y={\n                  HEAD.mid +\n                  (i - (lines.length - 1) / 2) * HEAD.pitch +\n                  head.rise\n                }\n                dev={headDev}\n                style={headType}\n              >\n                {line}\n              </Line>\n            ))}\n          </g>\n        )}\n\n        {/* The window. */}\n        <g transform={winT}>\n          <rect\n            x={WIN.x - WIN_SHADOW.spread}\n            y={WIN.y + WIN_SHADOW.dy - WIN_SHADOW.spread}\n            width={WIN.w + 2 * WIN_SHADOW.spread}\n            height={winH + 2 * WIN_SHADOW.spread}\n            rx={Math.max(0, WIN.r + WIN_SHADOW.spread)}\n            fill=\"#000\"\n            opacity={WIN_SHADOW.alpha}\n            filter={`url(#${id}-win)`}\n          />\n          <g clipPath={`url(#${id}-clip)`}>\n            <rect\n              x={WIN.x}\n              y={WIN.y}\n              width={WIN.w}\n              height={winH}\n              fill={t.card}\n            />\n            {image && (\n              <image\n                href={image}\n                x={WIN.x}\n                y={WIN.y}\n                width={WIN.w}\n                height={winH}\n                preserveAspectRatio=\"xMidYMin slice\"\n              />\n            )}\n          </g>\n        </g>\n\n        {/* The toast. */}\n        {toast.opacity * out.fade > 0 && (\n          <g\n            opacity={toast.opacity * out.fade}\n            transform={`translate(${cx} ${cy}) scale(${s}) translate(${-cx} ${-cy})`}\n          >\n            <rect\n              x={cx - boxW / 2 - ts.spread}\n              y={cy - TOAST.h / 2 + ts.dy - ts.spread}\n              width={boxW + 2 * ts.spread}\n              height={TOAST.h + 2 * ts.spread}\n              rx={Math.max(0, TOAST.r + ts.spread)}\n              fill=\"#000\"\n              opacity={ts.alpha}\n              filter={`url(#${id}-toast)`}\n            />\n            <rect\n              x={cx - boxW / 2}\n              y={cy - TOAST.h / 2}\n              width={boxW}\n              height={TOAST.h}\n              rx={TOAST.r}\n              fill={t.card}\n            />\n            {toast.copied ? (\n              <>\n                <circle\n                  cx={check.x}\n                  cy={check.y}\n                  r={COPIED.check.r}\n                  fill={t.primary}\n                />\n                <polyline\n                  points={COPIED.tick\n                    .map(([a, b]) => `${check.x + a},${check.y + b}`)\n                    .join(\" \")}\n                  fill=\"none\"\n                  stroke={t.primaryForeground}\n                  strokeWidth={COPIED.check.stroke}\n                  strokeLinecap=\"round\"\n                  strokeLinejoin=\"round\"\n                />\n                <Line\n                  x={boxL + COPIED.text.x}\n                  y={cy + COPIED.text.base}\n                  dev={toastDev}\n                  style={{ ...toastType, fill: inkCopied }}\n                >\n                  {copied}\n                </Line>\n              </>\n            ) : (\n              <>\n                <Mark\n                  x={boxL + CAPTURING.icon.x}\n                  y={cy + CAPTURING.icon.dy}\n                  ink={inkMark}\n                />\n                <Line\n                  x={boxL + CAPTURING.text.x}\n                  y={cy + CAPTURING.text.base}\n                  dev={toastDev}\n                  style={{ ...toastType, fill: inkCapturing }}\n                >\n                  {capturing}\n                </Line>\n                <Line\n                  x={boxL + capText}\n                  y={cy + CAPTURING.percent.base}\n                  dev={toastDev}\n                  style={{ ...toastType, fill: inkPercent }}\n                >\n                  {`${percentAt(n)}%`}\n                </Line>\n              </>\n            )}\n          </g>\n        )}\n\n        {/* The cursor is the system's, not the app's: black on a white\n            outline in either mode, the way a real pointer is. */}\n        <polygon\n          opacity={out.fade}\n          points={ARROW.map(([a, b]) => `${tx + a},${ty + b}`).join(\" \")}\n          fill=\"#000000\"\n          stroke=\"#ffffff\"\n          strokeWidth={2 * ARROW_OUTLINE}\n          strokeLinejoin=\"round\"\n          paintOrder=\"stroke\"\n          filter={`url(#${id}-arrow)`}\n        />\n\n        {/* Width probes for the toast copy, in the real face, never painted. */}\n        <g ref={probe} visibility=\"hidden\" aria-hidden>\n          <Probe style={toastType} texts={[capturing, copied, \"100%\"]} />\n        </g>\n      </svg>\n    </AbsoluteFill>\n  );\n}\n\nfunction Probe({ style, texts }: { style: CSSProperties; texts: string[] }) {\n  return (\n    <>\n      {texts.map((s, i) => (\n        <text key={`${i}-${s}`} x={0} y={-1000} style={style}>\n          {s}\n        </text>\n      ))}\n    </>\n  );\n}\n\n/** The selection mark: a back sheet, and a front sheet with a hole in it. */\nfunction Mark({ x, y, ink }: { x: number; y: number; ink: string }) {\n  const k = MARK.size / MARK.width;\n  const left = x + MARK.cx - MARK.size / 2;\n  const top = y + MARK.cy - (MARK.height * k) / 2;\n  return (\n    <path\n      d={MARK.path}\n      fill={ink}\n      transform={`translate(${left} ${top}) scale(${k})`}\n    />\n  );\n}\n",
      "type": "registry:component",
      "target": "components/snap-cn/capture-reveal.tsx"
    }
  ],
  "docs": "Docs and props: https://snapcn.dev/docs/screens/capture-reveal?ref=cli — src is the screenshot in the window (laid in at full width, top first); headline breaks lines on |; capturing and copied are the two toast messages. Pass mode=\"dark\" if you are rendering onto a dark frame — these default to shadcn's light palette. — 82 Pro components too — charts, launch scenes, device shots: https://snapcn.dev/docs/pricing?ref=cli-docs",
  "type": "registry:component"
}
