{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "caret-dolly",
  "title": "Caret Dolly",
  "description": "A prompt box types a request while the camera dollies along the caret.",
  "dependencies": ["remotion", "@remotion/google-fonts"],
  "registryDependencies": ["@remocn/gsh"],
  "files": [
    {
      "path": "registry/remocn/caret-dolly/index.tsx",
      "content": "\"use client\";\n\nimport { loadFont } from \"@remotion/google-fonts/InstrumentSans\";\nimport {\n  type ReactNode,\n  useEffect,\n  useId,\n  useMemo,\n  useRef,\n  useState,\n} from \"react\";\nimport {\n  AbsoluteFill,\n  continueRender,\n  delayRender,\n  Easing,\n  interpolate,\n  spring,\n  useCurrentFrame,\n  useVideoConfig,\n} from \"remotion\";\nimport type { GradientParams } from \"@/lib/remocn/gsh/gradient-engine\";\nimport { GshGround, gshParams } from \"@/lib/remocn/gsh/gsh-ground\";\nimport type { GshPresetId } from \"@/lib/remocn/gsh/presets\";\n\nconst face = loadFont(\"normal\", {\n  weights: [\"400\"],\n  subsets: [\"latin\"],\n});\n\nexport interface CaretDollyProps {\n  prompt?: string;\n  focus?: string;\n  chipLabel?: string;\n  modelLabel?: string;\n  accent?: string;\n  ink?: string;\n  background?: string;\n  theme?: \"dark\" | \"light\";\n  ground?: GshPresetId;\n  groundParams?: Partial<GradientParams>;\n}\n\nconst LIGHT_GROUND: Partial<GradientParams> = {\n  kind: \"mist\",\n  background: \"#efebe5\",\n  colors: [\"#ffffff\", \"#f8f4ee\", \"#f0dccb\", \"#e2cbb9\"],\n  blur: 0.7,\n  warp: 0.4,\n  seed: 3,\n  grain: 0.2,\n};\n\nconst THEMES = {\n  dark: {\n    ink: \"#f6f1ec\",\n    muted: \"rgba(246,241,236,0.56)\",\n    faint: \"rgba(246,241,236,0.12)\",\n    accent: \"#ff7d3f\",\n    ground: \"hearth\" as GshPresetId | undefined,\n    groundParams: undefined as Partial<GradientParams> | undefined,\n    groundOffset: 4,\n    scrim: \"5,3,3\",\n    scrimAlpha: 0.6,\n    card: \"#16120f\",\n    border: \"rgba(255,236,222,0.09)\",\n    shadow: \"0 40px 90px -24px rgba(0,0,0,0.7)\",\n    send: \"rgba(246,241,236,0.12)\",\n    sendArmed: \"#f6f1ec\",\n    sendGlyph: \"#16120f\",\n    cursorFill: \"#ffffff\",\n    cursorStroke: \"#15141d\",\n  },\n  light: {\n    ink: \"#1b1612\",\n    muted: \"rgba(27,22,18,0.54)\",\n    faint: \"rgba(27,22,18,0.1)\",\n    accent: \"#e0561c\",\n    ground: undefined as GshPresetId | undefined,\n    groundParams: LIGHT_GROUND as Partial<GradientParams> | undefined,\n    groundOffset: 2,\n    scrim: \"239,235,229\",\n    scrimAlpha: 0.35,\n    card: \"#ffffff\",\n    border: \"rgba(40,24,10,0.07)\",\n    shadow:\n      \"0 1px 3px rgba(40,24,10,0.06), 0 36px 80px -24px rgba(40,24,10,0.24)\",\n    send: \"rgba(27,22,18,0.07)\",\n    sendArmed: \"#1b1612\",\n    sendGlyph: \"#ffffff\",\n    cursorFill: \"#1b1612\",\n    cursorStroke: \"#ffffff\",\n  },\n};\n\nconst BEAT = {\n  typeA: 2,\n  punch: 24,\n  punchLen: 12,\n  focusLen: 22,\n  pull: 60,\n  pullLen: 24,\n  post: 72,\n  postLen: 30,\n  cursor: 82,\n  press: 108,\n};\n\nconst TRACK = -0.012;\nconst FONT_PX = 200;\nconst CAMERA = Easing.bezier(0.87, 0, 0.13, 1);\nconst LIGHT_IN = Easing.bezier(0.32, 0.72, 0, 1);\nconst CHAR = Easing.bezier(0.65, 0, 0.35, 1);\nconst CLAMP = {\n  extrapolateLeft: \"clamp\",\n  extrapolateRight: \"clamp\",\n} as const;\n\ntype Measure = (s: string) => number;\n\nfunction buildMeasure(_version: number): Measure {\n  const ctx = document.createElement(\"canvas\").getContext(\"2d\");\n  const cache: Record<string, number> = {};\n  return (s: string) => {\n    if (cache[s] === undefined) {\n      if (!ctx) return s.length * 0.52;\n      ctx.font = `400 ${FONT_PX}px \"${face.fontFamily}\"`;\n      cache[s] =\n        ctx.measureText(s).width / FONT_PX + TRACK * Array.from(s).length;\n    }\n    return cache[s];\n  };\n}\n\nfunction useMeasure() {\n  const [version, setVersion] = useState(0);\n  const [handle] = useState(() => delayRender(\"caret-dolly: measuring\"));\n  const released = useRef(false);\n  useEffect(() => {\n    let live = true;\n    const bump = () => {\n      if (live) setVersion((v) => v + 1);\n    };\n    document.fonts.addEventListener(\"loadingdone\", bump);\n    Promise.all([\n      face.waitUntilDone(),\n      document.fonts.load(`400 100px \"${face.fontFamily}\"`),\n    ])\n      .catch(() => undefined)\n      .then(() => {\n        bump();\n        if (!released.current) {\n          released.current = true;\n          continueRender(handle);\n        }\n      });\n    return () => {\n      live = false;\n      document.fonts.removeEventListener(\"loadingdone\", bump);\n    };\n  }, [handle]);\n  return useMemo(() => buildMeasure(version), [version]);\n}\n\nfunction Icon({\n  size,\n  color,\n  children,\n}: {\n  size: number;\n  color: string;\n  children: ReactNode;\n}) {\n  return (\n    <svg\n      viewBox=\"0 0 24 24\"\n      width={size}\n      height={size}\n      fill=\"none\"\n      stroke={color}\n      strokeWidth={1.6}\n      strokeLinecap=\"round\"\n      strokeLinejoin=\"round\"\n      style={{ display: \"block\", flexShrink: 0 }}\n      aria-hidden\n    >\n      {children}\n    </svg>\n  );\n}\n\ninterface Layout {\n  T: number;\n  LH: number;\n  cardX: number;\n  cardY: number;\n  cardW: number;\n  cardH: number;\n  pad: number;\n  u: number;\n  lines: { start: number; end: number }[];\n  charX: (i: number) => number;\n  lineOf: (i: number) => number;\n  lineY: (li: number) => number;\n  sendX: number;\n  sendY: number;\n  sendD: number;\n}\n\nexport function CaretDolly({\n  prompt = \"Make a launch video for our new app with a bold title, product shots and a calm ending\",\n  focus = \"launch video\",\n  chipLabel = \"Video\",\n  modelLabel = \"Remocn 1\",\n  accent,\n  ink,\n  background,\n  theme = \"dark\",\n  ground,\n  groundParams,\n}: CaretDollyProps) {\n  const frame = useCurrentFrame();\n  const { width: W, height: H, fps, durationInFrames } = useVideoConfig();\n  const c = THEMES[theme];\n  const inkC = ink ?? c.ink;\n  const hi = accent ?? c.accent;\n  const preset = ground ?? (groundParams ? undefined : c.ground);\n  const gParams = groundParams ?? (ground ? undefined : c.groundParams);\n  const bg = background ?? gshParams(preset, gParams).background;\n  const m = useMeasure();\n  const portrait = H > W * 1.1;\n  const filterId = `cd${useId().replace(/[^a-zA-Z0-9_-]/g, \"\")}`;\n\n  const found = prompt.indexOf(focus);\n  const fs = found >= 0 && focus.length > 0 ? found : 0;\n  const fe = found >= 0 && focus.length > 0 ? found + focus.length : 0;\n  const focusLen = fe - fs;\n  const postLen = prompt.length - fe;\n  const rateA = Math.max(0.6, fs / 18);\n  const rateF = Math.max(0.5, focusLen / BEAT.focusLen);\n  const rateP = Math.max(2, postLen / BEAT.postLen);\n  const punchEnd = BEAT.punch + BEAT.punchLen;\n  const pullEnd = BEAT.pull + BEAT.pullLen;\n  const postEnd = BEAT.post + postLen / rateP;\n\n  const typedA = (f: number) =>\n    Math.max(0, Math.min(fs, (f - BEAT.typeA) * rateA));\n  const typedF = (f: number) =>\n    Math.max(0, Math.min(focusLen, (f - punchEnd) * rateF));\n  const typedP = (f: number) =>\n    Math.max(0, Math.min(postLen, (f - BEAT.post) * rateP));\n\n  const layout = ((): Layout | null => {\n    if (!m) return null;\n    const cardW = portrait ? W * 0.86 : Math.min(W * 0.66, H * 1.25);\n    const T = portrait ? W * 0.05 : Math.max(H * 0.032, cardW * 0.031);\n    const u = T / 22;\n    const LH = T * 1.45;\n    const pad = 22 * u;\n    const room = cardW - pad * 2;\n    const words = prompt.split(\" \");\n    const lines: { start: number; end: number }[] = [];\n    let pos = 0;\n    let cur = \"\";\n    let curStart = 0;\n    for (const w of words) {\n      const next = cur.length > 0 ? `${cur} ${w}` : w;\n      if (cur.length > 0 && m(next) * T > room) {\n        lines.push({ start: curStart, end: curStart + cur.length });\n        curStart = pos;\n        cur = w;\n      } else {\n        cur = next;\n      }\n      pos += w.length + 1;\n    }\n    lines.push({ start: curStart, end: curStart + cur.length });\n    const barH = 36 * u;\n    const cardH = pad + lines.length * LH + 22 * u + barH + pad * 0.8;\n    const cardX = (W - cardW) / 2;\n    const cardY = H / 2 - cardH / 2;\n    const lineOf = (i: number) => {\n      for (let li = 0; li < lines.length; li++) {\n        if (i <= lines[li].end) return li;\n      }\n      return lines.length - 1;\n    };\n    const charX = (i: number) => {\n      const li = lineOf(i);\n      return cardX + pad + m(prompt.slice(lines[li].start, i)) * T;\n    };\n    const lineY = (li: number) => cardY + pad + li * LH + LH / 2;\n    const sendD = 34 * u;\n    return {\n      T,\n      LH,\n      cardX,\n      cardY,\n      cardW,\n      cardH,\n      pad,\n      u,\n      lines,\n      charX,\n      lineOf,\n      lineY,\n      sendX: cardX + cardW - pad * 0.8 - sendD / 2,\n      sendY: cardY + cardH - pad * 0.8 - barH / 2,\n      sendD,\n    };\n  })();\n\n  const cams = (() => {\n    if (!layout) return [];\n    const { T, charX, lineOf, lineY } = layout;\n    const C = { x: W / 2, y: H / 2 };\n    const A = portrait ? W * 0.11 : H * 0.1;\n    const giant = portrait ? W * 0.27 : Math.min(H * 0.36, W * 0.27);\n    const sA = A / T;\n    const sG = giant / T;\n    const xAt = (ci: number) => {\n      const lo = Math.floor(ci);\n      const hiI = Math.min(prompt.length, lo + 1);\n      const fr = ci - lo;\n      if (lineOf(lo) !== lineOf(hiI)) return charX(lo);\n      return charX(lo) + (charX(hiI) - charX(lo)) * CHAR(fr);\n    };\n    const goalA = (f: number) => {\n      const ci = typedA(f);\n      const li = lineOf(Math.floor(ci));\n      return {\n        x: (charX(layout.lines[li].start) + xAt(ci)) / 2,\n        y: lineY(li),\n      };\n    };\n    const goalG = (f: number) => {\n      const ci = fs + typedF(f);\n      const at = Math.floor(ci);\n      let ws = at;\n      while (ws > fs && prompt[ws - 1] !== \" \") ws--;\n      if (prompt[at] === \" \" && at > fs && ci - at < 0.5) {\n        ws = at;\n        while (ws > fs && prompt[ws - 1] !== \" \") ws--;\n      }\n      const li = lineOf(at);\n      return { x: (charX(ws) + xAt(ci)) / 2, y: lineY(li) };\n    };\n    const K = { x: charX(fs), y: lineY(lineOf(fs)) };\n    const Fp = { x: charX(fe), y: lineY(lineOf(Math.max(fs, fe - 1))) };\n    const out: { x: number; y: number; s: number }[] = [];\n    let fx = goalA(0).x;\n    let fy = goalA(0).y;\n    let scrStart = { x: 0, y: 0 };\n    let scrPull = { x: 0, y: 0 };\n    const total = Math.max(durationInFrames, pullEnd + 1);\n    for (let f = 0; f < total; f++) {\n      if (f < BEAT.punch) {\n        const g = goalA(f);\n        fx += (g.x - fx) * 0.32;\n        fy += (g.y - fy) * 0.32;\n        out.push({ x: fx, y: fy, s: sA });\n        scrStart = { x: C.x + (K.x - fx) * sA, y: C.y + (K.y - fy) * sA };\n      } else if (f < punchEnd) {\n        const p = CAMERA((f - BEAT.punch) / BEAT.punchLen);\n        const s = Math.exp(Math.log(sA) + (Math.log(sG) - Math.log(sA)) * p);\n        const sx = scrStart.x + (C.x - scrStart.x) * p;\n        const sy = scrStart.y + (C.y - scrStart.y) * p;\n        fx = K.x - (sx - C.x) / s;\n        fy = K.y - (sy - C.y) / s;\n        out.push({ x: fx, y: fy, s });\n      } else if (f < BEAT.pull) {\n        const g = goalG(f);\n        fx += (g.x - fx) * 0.3;\n        fy += (g.y - fy) * 0.3;\n        out.push({ x: fx, y: fy, s: sG });\n        scrPull = { x: C.x + (Fp.x - fx) * sG, y: C.y + (Fp.y - fy) * sG };\n      } else if (f < pullEnd) {\n        const p = CAMERA((f - BEAT.pull) / BEAT.pullLen);\n        const s = Math.exp(Math.log(sG) * (1 - p));\n        const sx = scrPull.x + (Fp.x - scrPull.x) * p;\n        const sy = scrPull.y + (Fp.y - scrPull.y) * p;\n        out.push({ x: Fp.x - (sx - C.x) / s, y: Fp.y - (sy - C.y) / s, s });\n      } else {\n        out.push({ x: C.x, y: C.y, s: 1 });\n      }\n    }\n    return out;\n  })();\n\n  let content: ReactNode = <div />;\n  if (layout && cams.length > 0) {\n    const L = layout;\n    const f = frame;\n    const cam = cams[Math.min(cams.length - 1, f)];\n    const prev = cams[Math.max(0, Math.min(cams.length - 1, f - 1))];\n    const push =\n      f >= pullEnd\n        ? interpolate(f, [pullEnd, durationInFrames], [1, 1.03], CLAMP)\n        : 1;\n    const s = cam.s * push;\n    const zoomV = Math.abs(Math.log(cam.s) - Math.log(prev.s));\n    const panV = Math.abs(cam.x - prev.x) * cam.s;\n    const zoomBlur = Math.min(7, zoomV * 26);\n    const bx = Math.min(12, zoomBlur + panV * 0.05);\n    const by = zoomBlur;\n\n    const preOp =\n      f < BEAT.punch\n        ? 1\n        : f < BEAT.pull\n          ? interpolate(f, [BEAT.punch, BEAT.punch + 5], [1, 0], CLAMP)\n          : interpolate(f, [BEAT.pull + 8, pullEnd], [0, 1], {\n              ...CLAMP,\n              easing: LIGHT_IN,\n            });\n    const shown =\n      f < punchEnd\n        ? Math.floor(typedA(f))\n        : fs + Math.floor(typedF(f)) + Math.floor(typedP(f));\n    const caretIdx = Math.min(prompt.length, shown);\n\n    const segs: ReactNode[] = [];\n    L.lines.forEach((ln, li) => {\n      const ranges: [number, number, number][] = [\n        [ln.start, Math.min(ln.end, fs), preOp],\n        [Math.max(ln.start, fs), Math.min(ln.end, fe), 1],\n        [Math.max(ln.start, fe), ln.end, 1],\n      ];\n      ranges.forEach(([a, b, op], ri) => {\n        const to = Math.min(b, shown);\n        if (to <= a || op <= 0.001) return;\n        segs.push(\n          <div\n            key={`s${li}-${ri}`}\n            style={{\n              position: \"absolute\",\n              left: L.charX(a),\n              top: L.lineY(li) - L.T / 2,\n              fontSize: L.T,\n              lineHeight: 1,\n              whiteSpace: \"pre\",\n              fontFamily: face.fontFamily,\n              fontWeight: 400,\n              letterSpacing: `${TRACK}em`,\n              color: inkC,\n              opacity: op,\n            }}\n          >\n            {prompt.slice(a, to)}\n          </div>,\n        );\n      });\n    });\n\n    const typing =\n      (f >= BEAT.typeA && f < BEAT.typeA + fs / rateA + 2) ||\n      (f >= punchEnd && f < punchEnd + focusLen / rateF + 2) ||\n      (f >= BEAT.post && f < postEnd + 2);\n    const blinkOn = typing || Math.floor(f / 14) % 2 === 0;\n    const caretFade =\n      f >= postEnd + 4\n        ? interpolate(f, [BEAT.press - 6, BEAT.press], [1, 0], CLAMP)\n        : 1;\n    const caretH = L.T * 1.18;\n    const caretW = Math.max(L.T * 0.05, 1.6 / s);\n    const caretLine = L.lineOf(Math.max(0, caretIdx === 0 ? 0 : caretIdx));\n    const caret = (\n      <div\n        style={{\n          position: \"absolute\",\n          left: L.charX(caretIdx) + L.T * 0.04,\n          top: L.lineY(caretLine) - caretH / 2,\n          width: caretW,\n          height: caretH,\n          borderRadius: caretW,\n          background: inkC,\n          opacity: (blinkOn ? 1 : 0) * caretFade,\n        }}\n      />\n    );\n\n    const surfaceIn = interpolate(f, [BEAT.pull + 6, pullEnd], [0, 1], {\n      ...CLAMP,\n      easing: LIGHT_IN,\n    });\n    const u = L.u;\n    const pop = (at: number) =>\n      spring({\n        frame: f - at,\n        fps,\n        config: { mass: 0.5, damping: 12, stiffness: 200 },\n      });\n    const toolIn = [0, 1, 2, 3, 4].map((i) => pop(pullEnd - 8 + i * 2));\n    const armed = interpolate(f, [postEnd, postEnd + 4], [0, 1], CLAMP);\n    const PRESS = { mass: 0.5, damping: 14, stiffness: 260 };\n    const dip =\n      spring({ frame: f - BEAT.press + 2, fps, config: PRESS }) -\n      spring({ frame: f - BEAT.press - 3, fps, config: PRESS });\n    const isPressed = f >= BEAT.press;\n    const sendScale = 1 - 0.06 * dip;\n    const sendBg = isPressed\n      ? hi\n      : `color-mix(in oklab, ${c.sendArmed} ${(armed * 100).toFixed(1)}%, ${c.send})`;\n    const glyph = isPressed\n      ? \"#ffffff\"\n      : `color-mix(in oklab, ${c.sendGlyph} ${(armed * 100).toFixed(1)}%, ${c.muted})`;\n    const stopIn = spring({\n      frame: f - BEAT.press - 3,\n      fps,\n      config: { mass: 0.5, damping: 12, stiffness: 200 },\n    });\n    const arrowOut = interpolate(f - BEAT.press, [1, 5], [1, 0], CLAMP);\n    const spin = interpolate(f - BEAT.press, [4, 12], [0, 1], {\n      ...CLAMP,\n      easing: LIGHT_IN,\n    });\n    const labelF = 15 * u;\n    const ctrlD = 32 * u;\n\n    const card = (\n      <div\n        style={{\n          position: \"absolute\",\n          left: L.cardX,\n          top: L.cardY,\n          width: L.cardW,\n          height: L.cardH,\n          borderRadius: 22 * u,\n          background: c.card,\n          boxShadow: `inset 0 0 0 1px ${c.border}, ${c.shadow}`,\n          opacity: surfaceIn,\n          transform: `scale(${(0.97 + 0.03 * surfaceIn).toFixed(4)})`,\n        }}\n      >\n        <div\n          style={{\n            position: \"absolute\",\n            left: L.pad * 0.8,\n            right: L.pad * 0.8,\n            bottom: L.pad * 0.8,\n            height: 36 * u,\n            display: \"flex\",\n            alignItems: \"center\",\n            gap: 8 * u,\n            fontFamily: face.fontFamily,\n            fontWeight: 400,\n            fontSize: labelF,\n            color: c.muted,\n          }}\n        >\n          <div\n            style={{\n              width: ctrlD,\n              height: ctrlD,\n              borderRadius: ctrlD,\n              boxShadow: `inset 0 0 0 1px ${c.faint}`,\n              display: \"flex\",\n              alignItems: \"center\",\n              justifyContent: \"center\",\n              transform: `scale(${toolIn[0].toFixed(4)})`,\n            }}\n          >\n            <Icon size={18 * u} color={c.muted}>\n              <path d=\"M12 5v14M5 12h14\" />\n            </Icon>\n          </div>\n          <div\n            style={{\n              height: ctrlD,\n              padding: `0 ${12 * u}px 0 ${10 * u}px`,\n              borderRadius: ctrlD,\n              boxShadow: `inset 0 0 0 1px ${c.faint}`,\n              display: \"flex\",\n              alignItems: \"center\",\n              gap: 6 * u,\n              whiteSpace: \"pre\",\n              transform: `scale(${toolIn[1].toFixed(4)})`,\n              transformOrigin: \"0% 50%\",\n            }}\n          >\n            <Icon size={16 * u} color={c.muted}>\n              <rect x=\"3.5\" y=\"5\" width=\"17\" height=\"14\" rx=\"2.5\" />\n              <path d=\"M3.5 9.5h17M8 5v4.5M12 5v4.5M16 5v4.5\" />\n            </Icon>\n            {chipLabel}\n          </div>\n          <div style={{ flex: 1 }} />\n          <div\n            style={{\n              display: \"flex\",\n              alignItems: \"center\",\n              gap: 4 * u,\n              whiteSpace: \"pre\",\n              opacity: Math.min(1, toolIn[2]),\n            }}\n          >\n            {modelLabel}\n            <Icon size={14 * u} color={c.muted}>\n              <path d=\"M7 10l5 5 5-5\" />\n            </Icon>\n          </div>\n          <div\n            style={{\n              position: \"relative\",\n              width: L.sendD,\n              height: L.sendD,\n              flexShrink: 0,\n              transform: `scale(${(toolIn[4] * sendScale).toFixed(4)})`,\n            }}\n          >\n            <div\n              style={{\n                position: \"absolute\",\n                inset: 0,\n                borderRadius: L.sendD,\n                background: sendBg,\n                display: \"flex\",\n                alignItems: \"center\",\n                justifyContent: \"center\",\n              }}\n            >\n              <div\n                style={{\n                  opacity: arrowOut,\n                  transform: `translateY(${(-6 * u * (1 - arrowOut)).toFixed(3)}px)`,\n                }}\n              >\n                <Icon size={18 * u} color={glyph}>\n                  <path d=\"M12 19V5M6 11l6-6 6 6\" />\n                </Icon>\n              </div>\n              {isPressed ? (\n                <div\n                  style={{\n                    position: \"absolute\",\n                    width: 11 * u,\n                    height: 11 * u,\n                    borderRadius: 2.5 * u,\n                    background: \"#ffffff\",\n                    transform: `scale(${stopIn.toFixed(4)})`,\n                  }}\n                />\n              ) : null}\n            </div>\n            {isPressed ? (\n              <svg\n                viewBox=\"0 0 40 40\"\n                width={L.sendD + 7 * u}\n                height={L.sendD + 7 * u}\n                style={{\n                  position: \"absolute\",\n                  left: -3.5 * u,\n                  top: -3.5 * u,\n                  opacity: spin,\n                  transform: `rotate(${((f - BEAT.press) * 9).toFixed(2)}deg)`,\n                }}\n                aria-hidden\n              >\n                <circle\n                  cx=\"20\"\n                  cy=\"20\"\n                  r=\"18.5\"\n                  fill=\"none\"\n                  stroke={hi}\n                  strokeWidth={1.4}\n                  strokeLinecap=\"round\"\n                  strokeDasharray=\"30 200\"\n                />\n              </svg>\n            ) : null}\n          </div>\n        </div>\n      </div>\n    );\n\n    const world = (\n      <div\n        style={{\n          position: \"absolute\",\n          left: 0,\n          top: 0,\n          width: W,\n          height: H,\n          transformOrigin: \"0 0\",\n          transform: `translate(${(W / 2).toFixed(2)}px, ${(H / 2).toFixed(2)}px) scale(${s.toFixed(5)}) translate(${(-cam.x).toFixed(3)}px, ${(-cam.y).toFixed(3)}px)`,\n        }}\n      >\n        {card}\n        {segs}\n        {caret}\n      </div>\n    );\n\n    const curSize = portrait ? W * 0.05 : H * 0.05;\n    const cursorP = spring({\n      frame: f - BEAT.cursor,\n      fps,\n      config: { mass: 0.8, damping: 20, stiffness: 140 },\n    });\n    const cursorPy = spring({\n      frame: f - BEAT.cursor - 3,\n      fps,\n      config: { mass: 0.8, damping: 20, stiffness: 140 },\n    });\n    const tx = W / 2 + (L.sendX + L.sendD * 0.12 - W / 2) * s;\n    const ty = H / 2 + (L.sendY + L.sendD * 0.18 - H / 2) * s;\n    const sx0 = W * (portrait ? 0.96 : 0.9);\n    const sy0 = H * 1.06;\n    const away = spring({\n      frame: f - BEAT.press - 8,\n      fps,\n      config: { mass: 0.8, damping: 20, stiffness: 140 },\n    });\n    const curX = sx0 + (tx - sx0) * cursorP + curSize * 1.1 * away;\n    const curY = sy0 + (ty - sy0) * cursorPy + curSize * 1.3 * away;\n    const click = dip;\n    const cursor =\n      f >= BEAT.cursor ? (\n        <svg\n          viewBox=\"0 0 24 24\"\n          width={curSize}\n          height={curSize}\n          style={{\n            position: \"absolute\",\n            left: curX - curSize * 0.17,\n            top: curY - curSize * 0.1,\n            transform: `scale(${(1 - 0.12 * click).toFixed(4)})`,\n            transformOrigin: \"17% 10%\",\n            filter: \"drop-shadow(0 2px 4px rgba(0,0,0,0.28))\",\n          }}\n          aria-hidden\n        >\n          <path\n            d=\"M4.5 2.5v16.2l4.4-4.1 2.9 6.6 2.7-1.2-2.9-6.5h6.1z\"\n            fill={c.cursorFill}\n            stroke={c.cursorStroke}\n            strokeWidth={1.3}\n            strokeLinejoin=\"round\"\n          />\n        </svg>\n      ) : null;\n\n    content = (\n      <>\n        <svg width=\"0\" height=\"0\" style={{ position: \"absolute\" }} aria-hidden>\n          <filter id={filterId} x=\"-10%\" y=\"-10%\" width=\"120%\" height=\"120%\">\n            <feGaussianBlur\n              stdDeviation={`${bx.toFixed(2)} ${by.toFixed(2)}`}\n            />\n          </filter>\n        </svg>\n        <AbsoluteFill\n          style={{ filter: bx > 0.2 ? `url(#${filterId})` : undefined }}\n        >\n          {world}\n        </AbsoluteFill>\n        {cursor}\n      </>\n    );\n  }\n\n  return (\n    <AbsoluteFill style={{ background: bg, overflow: \"hidden\" }}>\n      <GshGround\n        preset={preset}\n        params={gParams}\n        timeOffset={c.groundOffset}\n        timeScale={0.6}\n      />\n      <AbsoluteFill\n        style={{\n          background: `radial-gradient(${portrait ? \"90% 46%\" : \"64% 60%\"} at 50% 50%, rgba(${c.scrim},${c.scrimAlpha}) 0%, rgba(${c.scrim},0) 100%)`,\n        }}\n      />\n      {content}\n    </AbsoluteFill>\n  );\n}\n\nexport default CaretDolly;\n",
      "type": "registry:component",
      "target": "components/remocn/caret-dolly.tsx"
    }
  ],
  "type": "registry:component"
}
