{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "hot-slab-morph",
  "title": "Hot Slab Morph",
  "description": "A hot-coloured slab morphs into a prompt card under the line \"or just describe it\".",
  "dependencies": [
    "remotion",
    "@remotion/google-fonts",
    "@remotion/transitions"
  ],
  "registryDependencies": ["@remocn/gsh"],
  "files": [
    {
      "path": "registry/remocn/hot-slab-morph/index.tsx",
      "content": "\"use client\";\n\nimport { loadFont as loadHanken } from \"@remotion/google-fonts/HankenGrotesk\";\nimport {\n  linearTiming,\n  type TransitionPresentation,\n  type TransitionPresentationComponentProps,\n  TransitionSeries,\n} from \"@remotion/transitions\";\nimport type React from \"react\";\nimport { useId } from \"react\";\nimport {\n  AbsoluteFill,\n  Easing,\n  interpolate,\n  spring,\n  useCurrentFrame,\n  useVideoConfig,\n} from \"remotion\";\nimport type { GradientParams } from \"@/lib/remocn/gsh/gradient-engine\";\nimport { GshGround } from \"@/lib/remocn/gsh/gsh-ground\";\nimport type { GshPresetId } from \"@/lib/remocn/gsh/presets\";\n\nconst hanken = loadHanken(\"normal\", {\n  weights: [\"300\", \"400\"],\n  subsets: [\"latin\"],\n});\n\nconst CLAMP = {\n  extrapolateLeft: \"clamp\",\n  extrapolateRight: \"clamp\",\n} as const;\n\ntype Rect = [number, number, number, number];\n\nexport type HotSlabMorphProps = {\n  from?: Rect;\n  to?: Rect;\n  fromRadius?: number;\n  toRadius?: number;\n  hot?: string;\n  core?: string;\n  deep?: string;\n  haze?: Rect | null;\n  hazeStrength?: number;\n  flood?: number;\n  floodBlend?: \"screen\" | \"normal\";\n  seed?: number;\n};\n\nexport const hotSlabMorphDefaults: Required<HotSlabMorphProps> = {\n  from: [0.32, 0.4, 0.36, 0.42],\n  to: [0.25, 0.44, 0.5, 0.2],\n  fromRadius: 0.024,\n  toRadius: 0.03,\n  hot: \"#2f62ff\",\n  core: \"#8fb0ff\",\n  deep: \"#1235d6\",\n  haze: [0.08, 0.2, 0.84, 0.18],\n  hazeStrength: 1,\n  flood: 0.85,\n  floodBlend: \"screen\",\n  seed: 4,\n};\n\nconst mix = (a: number, b: number, t: number) => a + (b - a) * t;\n\nfunction slabState(\n  p: number,\n  frames: number,\n  fps: number,\n  o: Required<HotSlabMorphProps>,\n) {\n  const heat = interpolate(p, [0, 0.28], [0, 1], {\n    ...CLAMP,\n    easing: Easing.bezier(0.32, 0.72, 0, 1),\n  });\n  const morphX = spring({\n    frame: (p - 0.26) * frames,\n    fps,\n    config: { damping: 200, stiffness: 180, mass: 0.8 },\n    durationInFrames: Math.max(2, Math.round(frames * 0.2)),\n  });\n  const morphY = spring({\n    frame: (p - 0.46) * frames,\n    fps,\n    config: { damping: 200, stiffness: 160, mass: 0.9 },\n    durationInFrames: Math.max(2, Math.round(frames * 0.28)),\n  });\n  const morph = (morphX + morphY) / 2;\n  const cool = interpolate(p, [0.7, 1], [0, 1], {\n    ...CLAMP,\n    easing: Easing.bezier(0.32, 0.72, 0, 1),\n  });\n  const swap = interpolate(p, [0.45, 0.49], [0, 1], {\n    ...CLAMP,\n    easing: Easing.bezier(0.65, 0, 0.35, 1),\n  });\n  const haze = interpolate(p, [0.22, 0.46, 0.8], [0, 1, 0], {\n    ...CLAMP,\n    easing: Easing.bezier(0.65, 0, 0.35, 1),\n  });\n  const flood = interpolate(p, [0, 0.42, 1], [0, 1, 0], {\n    ...CLAMP,\n    easing: Easing.bezier(0.65, 0, 0.35, 1),\n  });\n  const puff = Math.sin(Math.min(1, heat) * Math.PI) * 0.035 * (1 - morph);\n  const rect = [\n    mix(o.from[0], o.to[0], morphX),\n    mix(o.from[1], o.to[1], morphY),\n    mix(o.from[2], o.to[2], morphX),\n    mix(o.from[3], o.to[3], morphY),\n  ] as Rect;\n  const squash =\n    (Math.sin(morphX * Math.PI) - Math.sin(morphY * Math.PI)) * 0.03;\n  return {\n    heat,\n    morph,\n    cool,\n    swap,\n    haze,\n    flood,\n    rect,\n    puff,\n    squash,\n    radius: mix(o.fromRadius, o.toRadius, morph),\n  };\n}\n\nfunction HazeFilter({\n  id,\n  rect,\n  W,\n  H,\n  amount,\n  seed,\n}: {\n  id: string;\n  rect: Rect;\n  W: number;\n  H: number;\n  amount: number;\n  seed: number;\n}) {\n  return (\n    <svg width={0} height={0} style={{ position: \"absolute\" }} aria-hidden>\n      <defs>\n        <filter\n          id={id}\n          x={0}\n          y={0}\n          width={W}\n          height={H}\n          filterUnits=\"userSpaceOnUse\"\n          primitiveUnits=\"userSpaceOnUse\"\n          colorInterpolationFilters=\"sRGB\"\n        >\n          <feFlood floodColor=\"rgb(128,128,128)\" result=\"flat\" />\n          <feTurbulence\n            type=\"fractalNoise\"\n            baseFrequency={`${(6 / W).toFixed(5)} ${(40 / H).toFixed(5)}`}\n            numOctaves={2}\n            seed={seed}\n            x={rect[0] * W}\n            y={rect[1] * H}\n            width={rect[2] * W}\n            height={rect[3] * H}\n            result=\"noise\"\n          />\n          <feComposite in=\"noise\" in2=\"flat\" operator=\"over\" result=\"map\" />\n          <feDisplacementMap\n            in=\"SourceGraphic\"\n            in2=\"map\"\n            scale={amount * H * 0.045}\n            xChannelSelector=\"R\"\n            yChannelSelector=\"G\"\n          />\n        </filter>\n      </defs>\n    </svg>\n  );\n}\n\nconst HotSlabMorphPresentation: React.FC<\n  TransitionPresentationComponentProps<HotSlabMorphProps>\n> = ({\n  children,\n  presentationProgress,\n  presentationDirection,\n  presentationDurationInFrames,\n  passedProps,\n}) => {\n  const { width: W, height: H, fps } = useVideoConfig();\n  const o = { ...hotSlabMorphDefaults, ...passedProps };\n  const frames = Math.max(2, presentationDurationInFrames);\n  const s = slabState(presentationProgress, frames, fps, o);\n  const hazeId = `slab-haze-${useId().replace(/:/g, \"\")}`;\n  const hazeOn = o.haze !== null && s.haze * o.hazeStrength > 0.01;\n  const hazeAmt = s.haze * o.hazeStrength;\n  const frameSeed = o.seed + Math.floor(presentationProgress * frames * 0.5);\n  const haze =\n    hazeOn && o.haze ? (\n      <HazeFilter\n        id={hazeId}\n        rect={o.haze}\n        W={W}\n        H={H}\n        amount={hazeAmt}\n        seed={frameSeed}\n      />\n    ) : null;\n\n  if (presentationDirection === \"exiting\") {\n    return (\n      <AbsoluteFill>\n        {haze}\n        <AbsoluteFill\n          style={{\n            filter: hazeOn ? `url(#${hazeId})` : undefined,\n          }}\n        >\n          {children}\n        </AbsoluteFill>\n      </AbsoluteFill>\n    );\n  }\n\n  const m = Math.min(W, H);\n  const [rx, ry, rw, rh] = s.rect;\n  const sx = 1 + s.puff + s.squash;\n  const sy = 1 + s.puff - s.squash * 0.6;\n  const cx = (rx + rw / 2) * W;\n  const cy = (ry + rh / 2) * H;\n  const slabAlpha = s.heat * (1 - s.cool);\n  const rim = s.heat * (1 - interpolate(s.cool, [0.3, 1], [0, 1], CLAMP));\n\n  return (\n    <AbsoluteFill>\n      {haze}\n      <AbsoluteFill\n        style={{\n          opacity: s.swap,\n          filter: hazeOn ? `url(#${hazeId})` : undefined,\n        }}\n      >\n        {children}\n      </AbsoluteFill>\n      <AbsoluteFill\n        style={{\n          pointerEvents: \"none\",\n          opacity: s.flood * o.flood,\n          mixBlendMode: o.floodBlend,\n          background: `radial-gradient(${(W * 0.62).toFixed(0)}px ${(H * 0.62).toFixed(0)}px at ${cx.toFixed(1)}px ${cy.toFixed(1)}px, ${o.hot} 0%, ${o.deep}cc 38%, transparent 100%)`,\n        }}\n      />\n      <div\n        style={{\n          position: \"absolute\",\n          left: rx * W,\n          top: ry * H,\n          width: rw * W,\n          height: rh * H,\n          borderRadius: s.radius * m,\n          transform: `scale(${sx.toFixed(4)}, ${sy.toFixed(4)})`,\n          opacity: slabAlpha,\n          background: `radial-gradient(120% 140% at 50% 0%, ${o.core} 0%, ${o.hot} 46%, ${o.deep} 100%)`,\n          boxShadow: `0 0 ${(m * 0.08).toFixed(0)}px ${o.hot}, 0 0 ${(m * 0.22).toFixed(0)}px ${o.deep}aa, inset 0 1px 0 rgba(255,255,255,0.5), inset 0 0 ${(m * 0.04).toFixed(0)}px rgba(255,255,255,0.25)`,\n        }}\n      />\n      <div\n        style={{\n          position: \"absolute\",\n          left: rx * W,\n          top: ry * H,\n          width: rw * W,\n          height: rh * H,\n          borderRadius: s.radius * m,\n          transform: `scale(${sx.toFixed(4)}, ${sy.toFixed(4)})`,\n          opacity: rim * (1 - slabAlpha * 0.6),\n          boxShadow: `inset 0 0 0 1.5px ${o.core}, 0 0 ${(m * 0.05).toFixed(0)}px ${o.hot}`,\n        }}\n      />\n    </AbsoluteFill>\n  );\n};\n\nexport function hotSlabMorph(\n  props: HotSlabMorphProps = {},\n): TransitionPresentation<HotSlabMorphProps> {\n  return { component: HotSlabMorphPresentation, props };\n}\n\ntype Palette = {\n  ink: string;\n  muted: string;\n  faint: string;\n  accent: string;\n  panel: string;\n  row: string;\n  hairline: string;\n  highlight: string;\n  shadow: string;\n  iconBg: string;\n  hot: string;\n  core: string;\n  deep: string;\n  floodBlend: \"screen\" | \"normal\";\n  flood: number;\n  backdrop: string;\n  groundA: Partial<GradientParams>;\n  groundB: Partial<GradientParams>;\n};\n\nconst THEMES: Record<\"dark\" | \"light\", Palette> = {\n  dark: {\n    ink: \"#f3f6ff\",\n    muted: \"rgba(222,230,255,0.62)\",\n    faint: \"rgba(222,230,255,0.38)\",\n    accent: \"#3b5bfd\",\n    panel: \"rgba(9,11,18,0.86)\",\n    row: \"rgba(255,255,255,0.06)\",\n    hairline: \"rgba(255,255,255,0.09)\",\n    highlight: \"inset 0 1px 0 rgba(255,255,255,0.07)\",\n    shadow: \"0,3,18\",\n    iconBg: \"rgba(255,255,255,0.06)\",\n    hot: \"#2f62ff\",\n    core: \"#9cb8ff\",\n    deep: \"#1235d6\",\n    floodBlend: \"screen\",\n    flood: 0.85,\n    backdrop: \"#01030c\",\n    groundA: {\n      kind: \"mist\",\n      colors: [\"#a8c4ff\", \"#2f6bff\", \"#1440c8\", \"#04103a\"],\n      background: \"#020822\",\n      speed: 0.7,\n      loopSeconds: 16,\n      scale: 0.85,\n      warp: 0.45,\n      blur: 0.75,\n      grain: 0.12,\n      seed: 5,\n    },\n    groundB: {\n      kind: \"mist\",\n      colors: [\"#1f47d8\", \"#0c2580\", \"#050c2c\", \"#010207\"],\n      background: \"#010205\",\n      speed: 0.6,\n      loopSeconds: 16,\n      scale: 0.7,\n      warp: 0.35,\n      blur: 0.8,\n      grain: 0.12,\n      seed: 17,\n    },\n  },\n  light: {\n    ink: \"#111318\",\n    muted: \"rgba(17,19,24,0.58)\",\n    faint: \"rgba(17,19,24,0.36)\",\n    accent: \"#2f4ff0\",\n    panel: \"rgba(255,255,255,0.9)\",\n    row: \"rgba(30,40,80,0.05)\",\n    hairline: \"rgba(20,24,40,0.1)\",\n    highlight: \"inset 0 1px 0 rgba(255,255,255,0.9)\",\n    shadow: \"40,50,110\",\n    iconBg: \"rgba(30,40,80,0.05)\",\n    hot: \"#3a63ff\",\n    core: \"#b9cbff\",\n    deep: \"#1d3fe0\",\n    floodBlend: \"normal\",\n    flood: 0.35,\n    backdrop: \"#e9eaf0\",\n    groundA: {\n      kind: \"mist\",\n      colors: [\"#6d86ff\", \"#a8b8ff\", \"#dfe4fb\", \"#3a52d8\"],\n      background: \"#d5dcf6\",\n      speed: 0.7,\n      loopSeconds: 16,\n      scale: 0.85,\n      warp: 0.4,\n      blur: 0.7,\n      grain: 0.2,\n      seed: 5,\n    },\n    groundB: {\n      kind: \"mist\",\n      colors: [\"#9fb1ff\", \"#cdd6ff\", \"#ecedf3\", \"#6d84f0\"],\n      background: \"#f1f0ec\",\n      speed: 0.6,\n      loopSeconds: 16,\n      scale: 0.8,\n      warp: 0.35,\n      blur: 0.75,\n      grain: 0.24,\n      seed: 13,\n    },\n  },\n};\n\nconst A_LEN = 66;\nconst B_LEN = 84;\nconst T_LEN = 24;\nexport const HOT_SLAB_MORPH_DURATION = A_LEN + B_LEN - T_LEN;\n\nconst A_BEATS = { line: 0, panel: 4, rows: 8, hover: 30 } as const;\nconst B_BEATS = {\n  type: 24,\n  typeEnd: 60,\n  chips: 27,\n  send: 66,\n} as const;\n\nconst ENTER = Easing.bezier(0.32, 0.72, 0, 1);\nconst CARD = { mass: 0.8, damping: 18, stiffness: 160 };\nconst HEAVY = { mass: 1, damping: 26, stiffness: 120 };\nconst CHIP = { mass: 0.5, damping: 12, stiffness: 200 };\n\nfunction layout(W: number, H: number) {\n  const tall = H > W * 1.1;\n  if (tall) {\n    return {\n      tall,\n      lineY: 0.3,\n      panel: [0.08, 0.37, 0.84, 0.36] as Rect,\n      input: [0.06, 0.39, 0.88, 0.18] as Rect,\n      chipsY: 0.61,\n      haze: [0.04, 0.2, 0.92, 0.14] as Rect,\n    };\n  }\n  return {\n    tall,\n    lineY: 0.3,\n    panel: [0.3, 0.4, 0.4, 0.46] as Rect,\n    input: [0.22, 0.42, 0.56, 0.24] as Rect,\n    chipsY: 0.72,\n    haze: [0.1, 0.19, 0.8, 0.18] as Rect,\n  };\n}\n\nfunction Icon({ d, size, color }: { d: string; size: number; color: string }) {\n  return (\n    <svg viewBox=\"0 0 24 24\" width={size} height={size} aria-hidden>\n      <path\n        d={d}\n        fill=\"none\"\n        stroke={color}\n        strokeWidth=\"1.5\"\n        strokeLinecap=\"round\"\n        strokeLinejoin=\"round\"\n      />\n    </svg>\n  );\n}\n\nconst ICONS = {\n  film: \"M4 6.5h16v11H4zM8 6.5v11M16 6.5v11M4 10h4M4 14h4M16 10h4M16 14h4\",\n  spark: \"M12 4l1.8 4.6L18.5 10l-4.7 1.6L12 16l-1.8-4.4L5.5 10l4.7-1.4z\",\n  layers: \"M12 4l8 4-8 4-8-4zM4 12l8 4 8-4M4 16l8 4 8-4\",\n  phone:\n    \"M8 3.5h8a1.5 1.5 0 011.5 1.5v14a1.5 1.5 0 01-1.5 1.5H8A1.5 1.5 0 016.5 19V5A1.5 1.5 0 018 3.5zM11 17.5h2\",\n  search: \"M11 5a6 6 0 100 12 6 6 0 000-12zM20 20l-4.5-4.5\",\n  plus: \"M12 5v14M5 12h14\",\n  chevron: \"M7 10l5 5 5-5\",\n  mic: \"M12 4a2.5 2.5 0 012.5 2.5v5a2.5 2.5 0 01-5 0v-5A2.5 2.5 0 0112 4zM6.5 11a5.5 5.5 0 0011 0M12 16.5V20\",\n  send: \"M12 19V5M6 11l6-6 6 6\",\n  clip: \"M15.5 7.5l-6.4 6.4a2 2 0 002.8 2.8l7-7a4 4 0 00-5.6-5.6l-7 7a6 6 0 008.5 8.5l5.2-5.2\",\n};\n\nconst SUGGESTIONS = [\n  { icon: ICONS.spark, label: \"Launch teaser\" },\n  { icon: ICONS.layers, label: \"Changelog film\" },\n  { icon: ICONS.phone, label: \"Social cutdown\" },\n];\n\nconst TEMPLATES = [\n  { icon: ICONS.spark, name: \"Launch teaser\", meta: \"0:18\" },\n  { icon: ICONS.film, name: \"Product walkthrough\", meta: \"0:42\" },\n  { icon: ICONS.layers, name: \"Changelog film\", meta: \"0:30\" },\n  { icon: ICONS.phone, name: \"Social cutdowns\", meta: \"0:15\" },\n];\n\nfunction Heading({\n  text,\n  palette,\n  appear,\n}: {\n  text: string;\n  palette: Palette;\n  appear: number;\n}) {\n  const { width: W, height: H } = useVideoConfig();\n  const L = layout(W, H);\n  const fs = L.tall ? W * 0.085 : W * 0.046;\n  return (\n    <div\n      style={{\n        position: \"absolute\",\n        left: 0,\n        right: 0,\n        top: L.lineY * H,\n        transform: \"translateY(-50%)\",\n        display: \"flex\",\n        justifyContent: \"center\",\n        overflow: \"hidden\",\n        paddingBottom: fs * 0.2,\n      }}\n    >\n      <div\n        style={{\n          fontFamily: hanken.fontFamily,\n          fontWeight: 300,\n          fontSize: fs,\n          letterSpacing: \"-0.035em\",\n          lineHeight: 1.1,\n          color: palette.ink,\n          transform: `translateY(${((1 - appear) * 100).toFixed(2)}%)`,\n          filter:\n            appear < 0.99\n              ? `blur(${((1 - appear) * 6).toFixed(2)}px)`\n              : undefined,\n        }}\n      >\n        {text}\n      </div>\n    </div>\n  );\n}\n\nfunction SceneA({\n  line,\n  palette,\n  ground,\n  groundParams,\n}: {\n  line: string;\n  palette: Palette;\n  ground?: GshPresetId;\n  groundParams?: Partial<GradientParams>;\n}) {\n  const frame = useCurrentFrame();\n  const { width: W, height: H, fps } = useVideoConfig();\n  const L = layout(W, H);\n  const u = L.tall ? W / 600 : H / 720;\n  const [px, py, pw, ph] = L.panel;\n  const head = interpolate(frame, [A_BEATS.line, A_BEATS.line + 14], [0, 1], {\n    ...CLAMP,\n    easing: ENTER,\n  });\n  const panel = spring({ frame: frame - A_BEATS.panel, fps, config: HEAVY });\n  const hover = spring({ frame: frame - A_BEATS.hover, fps, config: CARD });\n  const push = interpolate(frame, [0, A_LEN], [1, 1.03], CLAMP);\n  const rowH = (ph * H - 64 * u) / TEMPLATES.length;\n  const hoverY = mix(0, 2, hover) * rowH;\n  const fs = 19 * u;\n\n  return (\n    <AbsoluteFill>\n      <GshGround\n        preset={ground}\n        params={ground ? groundParams : { ...palette.groundA, ...groundParams }}\n        timeOffset={3}\n        timeScale={0.7}\n      />\n      <AbsoluteFill style={{ transform: `scale(${push})` }}>\n        <Heading text={line} palette={palette} appear={head} />\n        <div\n          style={{\n            position: \"absolute\",\n            left: px * W,\n            top: py * H,\n            width: pw * W,\n            height: ph * H,\n            borderRadius: 0.024 * Math.min(W, H),\n            backgroundColor: palette.panel,\n            boxShadow: `inset 0 0 0 1px ${palette.hairline}, ${palette.highlight}, 0 2px 4px rgba(${palette.shadow},0.2), 0 18px 40px rgba(${palette.shadow},0.32), 0 44px 100px rgba(${palette.shadow},0.38)`,\n            fontFamily: hanken.fontFamily,\n            color: palette.ink,\n            padding: 10 * u,\n            display: \"flex\",\n            flexDirection: \"column\",\n            opacity: interpolate(panel, [0, 0.3], [0, 1], CLAMP),\n            transform: `translateY(${(1 - panel) * 30 * u}px) scale(${0.97 + 0.03 * panel})`,\n          }}\n        >\n          <div\n            style={{\n              height: 44 * u,\n              display: \"flex\",\n              alignItems: \"center\",\n              gap: 10 * u,\n              padding: `0 ${10 * u}px`,\n              fontSize: fs,\n              color: palette.muted,\n              borderBottom: `1px solid ${palette.hairline}`,\n              marginBottom: 6 * u,\n            }}\n          >\n            <Icon d={ICONS.search} size={18 * u} color={palette.faint} />\n            <span style={{ flex: 1 }}>Search templates</span>\n            <span\n              style={{\n                padding: `${3 * u}px ${9 * u}px`,\n                borderRadius: 99,\n                backgroundColor: palette.row,\n                fontSize: 15 * u,\n              }}\n            >\n              24\n            </span>\n          </div>\n          <div style={{ position: \"relative\", flex: 1 }}>\n            <div\n              style={{\n                position: \"absolute\",\n                left: 0,\n                right: 0,\n                top: hoverY,\n                height: rowH,\n                borderRadius: 10 * u,\n                backgroundColor: palette.row,\n                boxShadow: `inset 0 0 0 1px ${palette.hairline}`,\n                opacity: interpolate(\n                  frame,\n                  [A_BEATS.rows + 10, A_BEATS.rows + 18],\n                  [0, 1],\n                  CLAMP,\n                ),\n              }}\n            />\n            {TEMPLATES.map((t, i) => {\n              const r = spring({\n                frame: frame - A_BEATS.rows - i * 3,\n                fps,\n                config: CARD,\n              });\n              return (\n                <div\n                  key={t.name}\n                  style={{\n                    position: \"absolute\",\n                    left: 0,\n                    right: 0,\n                    top: i * rowH,\n                    height: rowH,\n                    display: \"flex\",\n                    alignItems: \"center\",\n                    gap: 12 * u,\n                    padding: `0 ${10 * u}px`,\n                    fontSize: fs,\n                    opacity: interpolate(r, [0, 0.4], [0, 1], CLAMP),\n                    transform: `translateY(${(1 - r) * 12 * u}px)`,\n                  }}\n                >\n                  <div\n                    style={{\n                      width: 32 * u,\n                      height: 32 * u,\n                      borderRadius: 8 * u,\n                      backgroundColor: palette.iconBg,\n                      boxShadow: `inset 0 0 0 1px ${palette.hairline}`,\n                      display: \"flex\",\n                      alignItems: \"center\",\n                      justifyContent: \"center\",\n                    }}\n                  >\n                    <Icon d={t.icon} size={18 * u} color={palette.ink} />\n                  </div>\n                  <span style={{ flex: 1 }}>{t.name}</span>\n                  <span style={{ color: palette.faint, fontSize: 15.5 * u }}>\n                    {t.meta}\n                  </span>\n                </div>\n              );\n            })}\n          </div>\n        </div>\n      </AbsoluteFill>\n    </AbsoluteFill>\n  );\n}\n\nfunction SceneB({\n  line,\n  prompt,\n  palette,\n  ground,\n  groundParams,\n}: {\n  line: string;\n  prompt: string;\n  palette: Palette;\n  ground?: GshPresetId;\n  groundParams?: Partial<GradientParams>;\n}) {\n  const frame = useCurrentFrame();\n  const { width: W, height: H, fps } = useVideoConfig();\n  const L = layout(W, H);\n  const u = L.tall ? W / 600 : H / 720;\n  const [ix, iy, iw, ih] = L.input;\n  const typed = Math.floor(\n    interpolate(\n      frame,\n      [B_BEATS.type, B_BEATS.typeEnd],\n      [0, prompt.length],\n      CLAMP,\n    ),\n  );\n  const done = typed >= prompt.length;\n  const caretOn = !done || Math.floor((frame - B_BEATS.typeEnd) / 8) % 2 === 0;\n  const send = spring({ frame: frame - B_BEATS.send, fps, config: CHIP });\n  const push = interpolate(frame, [0, B_LEN], [1.01, 1.04], CLAMP);\n  const fs = (L.tall ? 25 : 21) * u;\n  const small = (L.tall ? 23 : 16.5) * u;\n\n  return (\n    <AbsoluteFill>\n      <GshGround\n        preset={ground}\n        params={ground ? groundParams : { ...palette.groundB, ...groundParams }}\n        timeOffset={8}\n        timeScale={0.6}\n      />\n      <AbsoluteFill style={{ transform: `scale(${push})` }}>\n        <Heading text={line} palette={palette} appear={1} />\n        <div\n          style={{\n            position: \"absolute\",\n            left: ix * W,\n            top: iy * H,\n            width: iw * W,\n            height: ih * H,\n            borderRadius: 0.03 * Math.min(W, H),\n            backgroundColor: palette.panel,\n            boxShadow: `inset 0 0 0 1px ${palette.hairline}, ${palette.highlight}, 0 2px 4px rgba(${palette.shadow},0.2), 0 18px 40px rgba(${palette.shadow},0.32), 0 44px 100px rgba(${palette.shadow},0.38)`,\n            fontFamily: hanken.fontFamily,\n            color: palette.ink,\n            padding: `${18 * u}px ${18 * u}px ${14 * u}px`,\n            display: \"flex\",\n            flexDirection: \"column\",\n            justifyContent: \"space-between\",\n          }}\n        >\n          <div\n            style={{\n              fontSize: fs,\n              fontWeight: 300,\n              letterSpacing: \"-0.01em\",\n              lineHeight: 1.3,\n              color: typed > 0 ? palette.ink : palette.faint,\n            }}\n          >\n            {typed > 0 ? prompt.slice(0, typed) : \"Describe your launch film\"}\n            <span\n              style={{\n                display: \"inline-block\",\n                width: Math.max(2, 2 * u),\n                height: fs * 1.05,\n                marginLeft: 2 * u,\n                verticalAlign: \"-0.18em\",\n                backgroundColor: palette.accent,\n                opacity: caretOn ? 1 : 0,\n              }}\n            />\n          </div>\n          <div\n            style={{\n              display: \"flex\",\n              alignItems: \"center\",\n              gap: 8 * u,\n              fontSize: small,\n              color: palette.muted,\n            }}\n          >\n            <div\n              style={{\n                width: 34 * u,\n                height: 34 * u,\n                borderRadius: 99,\n                boxShadow: `inset 0 0 0 1px ${palette.hairline}`,\n                display: \"flex\",\n                alignItems: \"center\",\n                justifyContent: \"center\",\n              }}\n            >\n              <Icon d={ICONS.plus} size={17 * u} color={palette.muted} />\n            </div>\n            {[\"Film\", \"16:9\"].map((c) => (\n              <div\n                key={c}\n                style={{\n                  display: \"flex\",\n                  alignItems: \"center\",\n                  gap: 4 * u,\n                  padding: `${7 * u}px ${12 * u}px`,\n                  borderRadius: 99,\n                  backgroundColor: palette.row,\n                  boxShadow: `inset 0 0 0 1px ${palette.hairline}`,\n                }}\n              >\n                {c}\n                <Icon d={ICONS.chevron} size={14 * u} color={palette.faint} />\n              </div>\n            ))}\n            <div style={{ flex: 1 }} />\n            <Icon d={ICONS.mic} size={19 * u} color={palette.muted} />\n            <div\n              style={{\n                width: 36 * u,\n                height: 36 * u,\n                borderRadius: 99,\n                backgroundColor: done ? palette.accent : palette.row,\n                display: \"flex\",\n                alignItems: \"center\",\n                justifyContent: \"center\",\n                transform: `scale(${1 + 0.12 * send * (1 - send) * 4})`,\n                boxShadow: done ? `0 6px 18px ${palette.accent}66` : undefined,\n              }}\n            >\n              <Icon\n                d={ICONS.send}\n                size={18 * u}\n                color={done ? \"#fff\" : palette.faint}\n              />\n            </div>\n          </div>\n        </div>\n        <div\n          style={{\n            position: \"absolute\",\n            left: ix * W,\n            width: iw * W,\n            top: L.chipsY * H,\n            display: \"flex\",\n            flexWrap: \"wrap\",\n            justifyContent: \"center\",\n            gap: 10 * u,\n            fontFamily: hanken.fontFamily,\n            fontSize: small,\n            color: palette.muted,\n          }}\n        >\n          {SUGGESTIONS.map((c, i) => {\n            const k = spring({\n              frame: frame - B_BEATS.chips - i * 3,\n              fps,\n              config: CARD,\n            });\n            return (\n              <div\n                key={c.label}\n                style={{\n                  display: \"flex\",\n                  alignItems: \"center\",\n                  gap: 8 * u,\n                  padding: `${9 * u}px ${15 * u}px`,\n                  borderRadius: 99,\n                  backgroundColor: palette.panel,\n                  boxShadow: `inset 0 0 0 1px ${palette.hairline}, ${palette.highlight}, 0 8px 22px rgba(${palette.shadow},0.25)`,\n                  opacity: interpolate(k, [0, 0.4], [0, 1], CLAMP),\n                  transform: `translateY(${((1 - k) * 14 * u).toFixed(2)}px)`,\n                }}\n              >\n                <Icon d={c.icon} size={17 * u} color={palette.muted} />\n                {c.label}\n              </div>\n            );\n          })}\n        </div>\n      </AbsoluteFill>\n    </AbsoluteFill>\n  );\n}\n\nexport interface HotSlabMorphDemoProps {\n  theme?: \"dark\" | \"light\";\n  accent?: string;\n  lineA?: string;\n  lineB?: string;\n  prompt?: string;\n  ground?: GshPresetId;\n  groundParams?: Partial<GradientParams>;\n  groundB?: GshPresetId;\n  groundParamsB?: Partial<GradientParams>;\n  transition?: HotSlabMorphProps;\n}\n\nexport function HotSlabMorphDemo({\n  theme = \"dark\",\n  accent,\n  lineA = \"Start from a template\",\n  lineB = \"or just describe it\",\n  prompt = \"A 30-second launch film for our new editor\",\n  ground,\n  groundParams,\n  groundB,\n  groundParamsB,\n  transition,\n}: HotSlabMorphDemoProps) {\n  const { width: W, height: H } = useVideoConfig();\n  const base = THEMES[theme];\n  const palette = accent ? { ...base, accent } : base;\n  const L = layout(W, H);\n  return (\n    <AbsoluteFill style={{ backgroundColor: palette.backdrop }}>\n      <TransitionSeries>\n        <TransitionSeries.Sequence durationInFrames={A_LEN}>\n          <SceneA\n            line={lineA}\n            palette={palette}\n            ground={ground}\n            groundParams={groundParams}\n          />\n        </TransitionSeries.Sequence>\n        <TransitionSeries.Transition\n          presentation={hotSlabMorph({\n            from: L.panel,\n            to: L.input,\n            fromRadius: 0.024,\n            toRadius: 0.03,\n            hot: palette.hot,\n            core: palette.core,\n            deep: palette.deep,\n            haze: L.haze,\n            flood: palette.flood,\n            floodBlend: palette.floodBlend,\n            ...transition,\n          })}\n          timing={linearTiming({ durationInFrames: T_LEN })}\n        />\n        <TransitionSeries.Sequence durationInFrames={B_LEN}>\n          <SceneB\n            line={lineB}\n            prompt={prompt}\n            palette={palette}\n            ground={groundB}\n            groundParams={groundParamsB}\n          />\n        </TransitionSeries.Sequence>\n      </TransitionSeries>\n    </AbsoluteFill>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/remocn/hot-slab-morph.tsx"
    }
  ],
  "type": "registry:component"
}
