{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "story",
  "title": "Story",
  "description": "A 1080 × 1920 story put together from parts (header, eyebrow, title, grid of tiles, list of rows, highlight, image, call to action), laid out inside the safe area, with themes, patterns and a background photo. Drawn by Satori: render it with story-frame or renderStoryPng().",
  "registryDependencies": [
    "@corsair-ui/story-export"
  ],
  "files": [
    {
      "path": "registry/default/ui/story.tsx",
      "content": "// Satori draws stories from inline styles; there are no Tailwind classes here to check.\n// tailwind-compat-ignore-file\nimport { Children, cloneElement, isValidElement, type CSSProperties, type ReactNode } from \"react\";\n\nimport { STORY_SAFE_AREA, STORY_SIZE } from \"@/registry/default/lib/story-export\";\n\n/**\n * The colours a story is drawn with. Parts read them as CSS variables\n * (`var(--story-accent)`), so your own elements inside a story can too.\n */\ninterface StoryTheme {\n  background: string;\n  /** Drawn over `background`: a gradient, for example. */\n  backgroundImage?: string;\n  foreground: string;\n  muted: string;\n  /** Solid tiles and chips, the call to action, eyebrows and glows. */\n  accent: string;\n  /** Text on the accent. */\n  accentForeground: string;\n  /** Soft tiles and chips. */\n  surface: string;\n  /** Outlines and dividers. */\n  border: string;\n}\n\nconst STORY_THEMES = {\n  midnight: {\n    background: \"#09090b\",\n    foreground: \"#fafafa\",\n    muted: \"rgba(250, 250, 250, 0.6)\",\n    accent: \"#c6f432\",\n    accentForeground: \"#09090b\",\n    surface: \"rgba(250, 250, 250, 0.08)\",\n    border: \"rgba(250, 250, 250, 0.16)\",\n  },\n  paper: {\n    background: \"#f3efe6\",\n    foreground: \"#141414\",\n    muted: \"rgba(20, 20, 20, 0.58)\",\n    accent: \"#ff5a1f\",\n    accentForeground: \"#ffffff\",\n    surface: \"rgba(20, 20, 20, 0.06)\",\n    border: \"rgba(20, 20, 20, 0.14)\",\n  },\n  ocean: {\n    background: \"#041029\",\n    backgroundImage: \"linear-gradient(165deg, #0c2a6b 0%, #041029 70%)\",\n    foreground: \"#eef5ff\",\n    muted: \"rgba(238, 245, 255, 0.64)\",\n    accent: \"#5ee7ff\",\n    accentForeground: \"#041029\",\n    surface: \"rgba(238, 245, 255, 0.1)\",\n    border: \"rgba(238, 245, 255, 0.2)\",\n  },\n  sunset: {\n    background: \"#ff3d77\",\n    backgroundImage: \"linear-gradient(165deg, #ff8a3d 0%, #ff3d77 50%, #7b2cff 100%)\",\n    foreground: \"#ffffff\",\n    muted: \"rgba(255, 255, 255, 0.8)\",\n    accent: \"#ffffff\",\n    accentForeground: \"#2b0b3f\",\n    surface: \"rgba(255, 255, 255, 0.18)\",\n    border: \"rgba(255, 255, 255, 0.4)\",\n  },\n  mono: {\n    background: \"#ffffff\",\n    foreground: \"#0a0a0a\",\n    muted: \"rgba(10, 10, 10, 0.55)\",\n    accent: \"#0a0a0a\",\n    accentForeground: \"#ffffff\",\n    surface: \"rgba(10, 10, 10, 0.06)\",\n    border: \"rgba(10, 10, 10, 0.16)\",\n  },\n} satisfies Record<string, StoryTheme>;\n\ntype StoryThemeName = keyof typeof STORY_THEMES;\n\ntype StoryDecoration = \"none\" | \"glow\" | \"dots\" | \"grid\";\n\n/** Side padding of the content: the safe area's, plus a little air. */\nconst SIDE = STORY_SAFE_AREA.side + 8;\n/** Width of the content between the side paddings. */\nconst STORY_CONTENT_WIDTH = STORY_SIZE.width - SIDE * 2;\n\nconst v = {\n  background: \"var(--story-background)\",\n  foreground: \"var(--story-foreground)\",\n  muted: \"var(--story-muted)\",\n  accent: \"var(--story-accent)\",\n  accentForeground: \"var(--story-accent-foreground)\",\n  surface: \"var(--story-surface)\",\n  border: \"var(--story-border)\",\n  radius: \"var(--story-radius)\",\n} as const;\n\nconst nowrap: CSSProperties = {\n  whiteSpace: \"nowrap\",\n  overflow: \"hidden\",\n  textOverflow: \"ellipsis\",\n};\n\n/** A hex colour at an opacity; other colours come back as they are. */\nfunction alpha(color: string, amount: number) {\n  const hex = /^#([\\da-f]{3}|[\\da-f]{6})$/i.exec(color.trim())?.[1];\n  if (!hex) return color;\n  const full = hex.length === 3 ? [...hex].map((digit) => digit + digit).join(\"\") : hex;\n  const [r, g, b] = [0, 2, 4].map((index) => parseInt(full.slice(index, index + 2), 16));\n  return `rgba(${r}, ${g}, ${b}, ${amount})`;\n}\n\nfunction decorationStyle(decoration: StoryDecoration, theme: StoryTheme): CSSProperties | null {\n  switch (decoration) {\n    case \"glow\":\n      return {\n        backgroundImage: `radial-gradient(circle at 92% 6%, ${alpha(theme.accent, 0.42)} 0%, rgba(0, 0, 0, 0) 48%), radial-gradient(circle at 0% 100%, ${alpha(theme.accent, 0.18)} 0%, rgba(0, 0, 0, 0) 42%)`,\n      };\n    case \"dots\":\n      return {\n        backgroundImage: `radial-gradient(circle, ${theme.border} 3px, rgba(0, 0, 0, 0) 3.5px)`,\n        backgroundSize: \"54px 54px\",\n      };\n    case \"grid\":\n      return {\n        backgroundImage: `linear-gradient(${theme.border} 2px, rgba(0, 0, 0, 0) 2px), linear-gradient(90deg, ${theme.border} 2px, rgba(0, 0, 0, 0) 2px)`,\n        backgroundSize: \"108px 108px\",\n      };\n    default:\n      return null;\n  }\n}\n\ninterface StoryProps {\n  /** A preset, or your own colours. Defaults to `midnight`. */\n  theme?: StoryThemeName | StoryTheme;\n  /** Overrides some colours of the theme: `{ accent: \"#e11d48\" }`. */\n  colors?: Partial<StoryTheme>;\n  /** A photo behind everything (a URL that allows CORS, or a data URL), darkened by `imageDim`. */\n  image?: string;\n  /** From 0 to 1: how much of the background colour covers the photo. */\n  imageDim?: number;\n  /** A pattern or light behind the content, in the theme's colours. */\n  decoration?: StoryDecoration;\n  /** A family from the fonts given to the renderer. Defaults to the first one. */\n  fontFamily?: string;\n  /** Corner radius of tiles, images and cards, in px. */\n  radius?: number;\n  /** How the parts spread over the safe area when there is room left. */\n  justify?: \"start\" | \"center\" | \"end\" | \"between\";\n  /** Space between the parts, in px. */\n  gap?: number;\n  style?: CSSProperties;\n  children?: ReactNode;\n}\n\nconst JUSTIFY = {\n  start: \"flex-start\",\n  center: \"center\",\n  end: \"flex-end\",\n  between: \"space-between\",\n} as const;\n\n/**\n * A 1080 × 1920 story, for Instagram, WhatsApp or TikTok, put together from\n * parts: `StoryHeader`, `StoryEyebrow`, `StoryTitle`, `StoryText`,\n * `StoryBody` with a `StoryGrid` of `StoryTile`s or a `StoryList` of\n * `StoryRow`s, `StoryHighlight`, and a `StoryFooter` with a `StoryCta`.\n * Content is laid out inside the stories' safe area, clear of the bars the\n * apps draw. Themes, colours, a photo, a pattern, the font and the radius\n * are all props; every part also takes `style`, and your own elements can\n * use the theme's CSS variables (`var(--story-accent)`).\n *\n * It is an image template: render it with `StoryFrame` or `renderStoryPng`\n * in the browser, or with `ImageResponse` from `next/og` on a server. Like\n * everything Satori draws, it takes inline styles and flexbox, not classes.\n *\n * @example\n * <Story theme=\"midnight\" decoration=\"glow\">\n *   <StoryHeader><StoryBrand name=\"North Court\" /></StoryHeader>\n *   <StoryTitle>Free today</StoryTitle>\n *   <StoryBody>\n *     <StoryGrid max={9}>\n *       <StoryTile label=\"18h\" />\n *       <StoryTile label=\"19h\" variant=\"muted\" strike />\n *     </StoryGrid>\n *   </StoryBody>\n *   <StoryFooter><StoryCta>Book through the link</StoryCta></StoryFooter>\n * </Story>\n */\nfunction Story({\n  theme = \"midnight\",\n  colors,\n  image,\n  imageDim = 0.55,\n  decoration = \"none\",\n  fontFamily,\n  radius = 36,\n  justify = \"start\",\n  gap = 48,\n  style,\n  children,\n}: StoryProps) {\n  const palette: StoryTheme = {\n    ...(typeof theme === \"string\" ? STORY_THEMES[theme] : theme),\n    ...colors,\n  };\n  const { width, height } = STORY_SIZE;\n  const layer: CSSProperties = {\n    display: \"flex\",\n    position: \"absolute\",\n    top: 0,\n    left: 0,\n    width,\n    height,\n  };\n  const pattern = decorationStyle(decoration, palette);\n\n  return (\n    <div\n      style={\n        {\n          \"--story-background\": palette.background,\n          \"--story-foreground\": palette.foreground,\n          \"--story-muted\": palette.muted,\n          \"--story-accent\": palette.accent,\n          \"--story-accent-foreground\": palette.accentForeground,\n          \"--story-surface\": palette.surface,\n          \"--story-border\": palette.border,\n          \"--story-radius\": `${radius}px`,\n          display: \"flex\",\n          position: \"relative\",\n          width,\n          height,\n          overflow: \"hidden\",\n          backgroundColor: palette.background,\n          ...(palette.backgroundImage ? { backgroundImage: palette.backgroundImage } : {}),\n          color: palette.foreground,\n          // Left out when unset: the Satori in next/og fails on undefined style values.\n          ...(fontFamily ? { fontFamily } : {}),\n          ...style,\n        } as CSSProperties\n      }\n    >\n      {image ? (\n        <>\n          <img\n            src={image}\n            alt=\"\"\n            width={width}\n            height={height}\n            style={{ ...layer, objectFit: \"cover\" }}\n          />\n          <div style={{ ...layer, backgroundColor: palette.background, opacity: imageDim }} />\n          {/* Fades the photo into the background towards the bottom, where the text sits. */}\n          <div\n            style={{\n              ...layer,\n              backgroundImage: `linear-gradient(180deg, rgba(0, 0, 0, 0) 30%, ${palette.background} 92%)`,\n            }}\n          />\n        </>\n      ) : null}\n      {pattern ? <div style={{ ...layer, ...pattern }} /> : null}\n      <div\n        style={{\n          display: \"flex\",\n          flexDirection: \"column\",\n          // Positioned, so it paints above the photo and the pattern, which are.\n          position: \"relative\",\n          flexShrink: 0,\n          width,\n          height,\n          boxSizing: \"border-box\",\n          padding: `${STORY_SAFE_AREA.top}px ${SIDE}px ${STORY_SAFE_AREA.bottom}px`,\n          justifyContent: JUSTIFY[justify],\n          gap,\n        }}\n      >\n        {children}\n      </div>\n    </div>\n  );\n}\n\ninterface StoryPartProps {\n  style?: CSSProperties;\n  children?: ReactNode;\n}\n\n/** A row at the top: a `StoryBrand` at the start and, say, a date `StoryChip` at the end. */\nfunction StoryHeader({ style, children }: StoryPartProps) {\n  return (\n    <div\n      style={{\n        display: \"flex\",\n        flexShrink: 0,\n        alignItems: \"center\",\n        justifyContent: \"space-between\",\n        gap: 24,\n        minHeight: 96,\n        ...style,\n      }}\n    >\n      {children}\n    </div>\n  );\n}\n\ninterface StoryBrandProps {\n  name: string;\n  /** A URL that allows CORS, or a data URL. */\n  logo?: string;\n  style?: CSSProperties;\n}\n\n/** The logo and name of whoever posts the story. */\nfunction StoryBrand({ name, logo, style }: StoryBrandProps) {\n  return (\n    <div style={{ display: \"flex\", alignItems: \"center\", gap: 22, minWidth: 0, ...style }}>\n      {logo ? (\n        <img\n          src={logo}\n          alt=\"\"\n          width={88}\n          height={88}\n          style={{ width: 88, height: 88, borderRadius: 24, objectFit: \"cover\", flexShrink: 0 }}\n        />\n      ) : null}\n      <div style={{ display: \"flex\", fontSize: 42, fontWeight: 700, maxWidth: 640, ...nowrap }}>\n        {name}\n      </div>\n    </div>\n  );\n}\n\n/** A short label above the title, in the accent: \"Free slots\", \"New\", \"This Friday\". */\nfunction StoryEyebrow({ style, children }: StoryPartProps) {\n  return (\n    <div\n      style={{\n        display: \"flex\",\n        flexShrink: 0,\n        alignItems: \"center\",\n        gap: 18,\n        color: v.accent,\n        fontSize: 34,\n        fontWeight: 700,\n        letterSpacing: 5,\n        textTransform: \"uppercase\",\n        ...style,\n      }}\n    >\n      <div\n        style={{\n          display: \"flex\",\n          width: 18,\n          height: 18,\n          borderRadius: 9,\n          backgroundColor: v.accent,\n          flexShrink: 0,\n        }}\n      />\n      <div style={{ display: \"flex\", maxWidth: STORY_CONTENT_WIDTH - 40, ...nowrap }}>\n        {children}\n      </div>\n    </div>\n  );\n}\n\nfunction textLength(node: ReactNode): number {\n  if (typeof node === \"string\" || typeof node === \"number\") return String(node).length;\n  if (Array.isArray(node)) return node.reduce((sum: number, child) => sum + textLength(child), 0);\n  if (isValidElement<{ children?: ReactNode }>(node)) return textLength(node.props.children);\n  return 0;\n}\n\ninterface StoryTitleProps extends StoryPartProps {\n  /** Font size in px. By default it gets smaller as the title gets longer, to stay within `lines`. */\n  size?: number;\n  /** Lines before it is cut with an ellipsis. */\n  lines?: number;\n}\n\n/** The headline, large and tight. */\nfunction StoryTitle({ size, lines = 3, style, children }: StoryTitleProps) {\n  const length = textLength(children);\n  const fontSize =\n    size ?? (length <= 12 ? 150 : length <= 20 ? 124 : length <= 32 ? 104 : length <= 48 ? 88 : 76);\n  return (\n    <div\n      style={{\n        display: \"flex\",\n        flexShrink: 0,\n        fontSize,\n        fontWeight: 700,\n        lineHeight: 0.98,\n        letterSpacing: -Math.round(fontSize * 0.03),\n        lineClamp: lines,\n        ...style,\n      }}\n    >\n      {children}\n    </div>\n  );\n}\n\ninterface StoryTextProps extends StoryPartProps {\n  size?: number;\n  lines?: number;\n}\n\n/** A line or two in the muted colour: the day, the place, the details. */\nfunction StoryText({ size = 46, lines = 3, style, children }: StoryTextProps) {\n  return (\n    <div\n      style={{\n        display: \"flex\",\n        flexShrink: 0,\n        fontSize: size,\n        lineHeight: 1.3,\n        color: v.muted,\n        lineClamp: lines,\n        ...style,\n      }}\n    >\n      {children}\n    </div>\n  );\n}\n\ninterface StoryBodyProps extends StoryPartProps {\n  justify?: \"start\" | \"center\" | \"end\";\n  gap?: number;\n}\n\n/**\n * Takes the height the other parts leave, so the footer stays at the\n * bottom of the safe area. What does not fit is clipped: give grids and\n * lists a `max`.\n */\nfunction StoryBody({ justify = \"start\", gap = 28, style, children }: StoryBodyProps) {\n  return (\n    <div\n      style={{\n        display: \"flex\",\n        flexDirection: \"column\",\n        flexGrow: 1,\n        minHeight: 0,\n        overflow: \"hidden\",\n        justifyContent: JUSTIFY[justify],\n        gap,\n        ...style,\n      }}\n    >\n      {children}\n    </div>\n  );\n}\n\ntype StoryVariant = \"solid\" | \"soft\" | \"outline\" | \"muted\";\n\nfunction look(variant: StoryVariant | \"dashed\") {\n  switch (variant) {\n    case \"soft\":\n      return { backgroundColor: v.surface, borderColor: \"rgba(0, 0, 0, 0)\", color: v.foreground };\n    case \"outline\":\n      return { backgroundColor: \"rgba(0, 0, 0, 0)\", borderColor: v.accent, color: v.foreground };\n    case \"muted\":\n      return { backgroundColor: v.surface, borderColor: \"rgba(0, 0, 0, 0)\", color: v.muted };\n    case \"dashed\":\n      return { backgroundColor: \"rgba(0, 0, 0, 0)\", borderColor: v.border, color: v.foreground };\n    default:\n      return { backgroundColor: v.accent, borderColor: v.accent, color: v.accentForeground };\n  }\n}\n\n/** Keeps the first `max` items; the last place goes to a \"+N\" for the rest. */\nfunction limit(children: ReactNode, max: number | undefined) {\n  const items = Children.toArray(children);\n  if (!max || items.length <= max) return { items, hidden: 0 };\n  const shown = items.slice(0, Math.max(0, max - 1));\n  return { items: shown, hidden: items.length - shown.length };\n}\n\ninterface StoryTileProps {\n  label: ReactNode;\n  /** A smaller line under the label: a price, \"2 left\". */\n  note?: ReactNode;\n  /** `solid` in the accent, `soft` on the surface, `outline`, or `muted` for what is gone. */\n  variant?: StoryVariant;\n  /** Strikes the label through, for what is taken or sold out. */\n  strike?: boolean;\n  /** What screen readers hear instead of the text, e.g. \"19h, taken\". Used by `storyAlt`. */\n  alt?: string;\n  style?: CSSProperties;\n}\n\nfunction labelSize(length: number) {\n  if (length <= 4) return 64;\n  if (length <= 6) return 56;\n  if (length <= 9) return 46;\n  return 38;\n}\n\n/** One cell of a `StoryGrid`: a time, a size, a seat. */\nfunction StoryTile({ label, note, variant = \"solid\", strike, style }: StoryTileProps) {\n  return (\n    <StoryTileBox variant={variant} style={style}>\n      <div\n        style={{\n          display: \"flex\",\n          fontSize: labelSize(textLength(label)),\n          fontWeight: 700,\n          lineHeight: 1,\n          textDecoration: strike ? \"line-through\" : \"none\",\n          maxWidth: \"100%\",\n          ...nowrap,\n        }}\n      >\n        {label}\n      </div>\n      {note ? (\n        <div\n          style={{\n            display: \"flex\",\n            marginTop: 12,\n            fontSize: 30,\n            lineHeight: 1,\n            opacity: 0.75,\n            maxWidth: \"100%\",\n            ...nowrap,\n          }}\n        >\n          {note}\n        </div>\n      ) : null}\n    </StoryTileBox>\n  );\n}\n\nfunction StoryTileBox({\n  variant,\n  style,\n  children,\n}: {\n  variant: StoryVariant | \"dashed\";\n  style?: CSSProperties;\n  children: ReactNode;\n}) {\n  const colors = look(variant);\n  return (\n    <div\n      style={{\n        display: \"flex\",\n        flexDirection: \"column\",\n        alignItems: \"center\",\n        justifyContent: \"center\",\n        flexGrow: 1,\n        minHeight: 140,\n        padding: \"28px 20px\",\n        boxSizing: \"border-box\",\n        borderRadius: v.radius,\n        borderWidth: 4,\n        borderStyle: variant === \"dashed\" ? \"dashed\" : \"solid\",\n        ...colors,\n        ...style,\n      }}\n    >\n      {children}\n    </div>\n  );\n}\n\ninterface StoryGridProps extends StoryPartProps {\n  columns?: number;\n  gap?: number;\n  /** The most cells shown; the last one becomes `more` for the rest. */\n  max?: number;\n  /** Label of the cell that stands for what did not fit. */\n  more?: (hidden: number) => string;\n  /** Width the grid fills, in px. The content width by default. */\n  width?: number;\n}\n\n/** Tiles in rows of `columns`, ending in \"+N\" when there are more than `max`. */\nfunction StoryGrid({\n  columns = 3,\n  gap = 24,\n  max,\n  more = (hidden) => `+${hidden}`,\n  width = STORY_CONTENT_WIDTH,\n  style,\n  children,\n}: StoryGridProps) {\n  const { items, hidden } = limit(children, max);\n  const cell = Math.floor((width - gap * (columns - 1)) / columns);\n  const moreLabel = hidden > 0 ? more(hidden) : \"\";\n  return (\n    <div style={{ display: \"flex\", flexWrap: \"wrap\", gap, width, flexShrink: 0, ...style }}>\n      {items.map((item, index) => (\n        <div key={index} style={{ display: \"flex\", width: cell }}>\n          {item}\n        </div>\n      ))}\n      {hidden > 0 ? (\n        <div style={{ display: \"flex\", width: cell }}>\n          <StoryTileBox variant=\"dashed\">\n            <div\n              style={{\n                display: \"flex\",\n                fontSize: labelSize(moreLabel.length) - 8,\n                fontWeight: 700,\n                maxWidth: \"100%\",\n                ...nowrap,\n              }}\n            >\n              {moreLabel}\n            </div>\n          </StoryTileBox>\n        </div>\n      ) : null}\n    </div>\n  );\n}\n\ninterface StoryChipProps {\n  children: ReactNode;\n  variant?: StoryVariant;\n  strike?: boolean;\n  alt?: string;\n  style?: CSSProperties;\n}\n\n/** A pill: a time in a row, a date in the header, a price, \"New\". */\nfunction StoryChip({ variant = \"soft\", strike, style, children }: StoryChipProps) {\n  return (\n    <div\n      style={{\n        display: \"flex\",\n        flexShrink: 0,\n        alignItems: \"center\",\n        height: 76,\n        padding: \"0 30px\",\n        boxSizing: \"border-box\",\n        borderRadius: 999,\n        borderWidth: 3,\n        borderStyle: \"solid\",\n        fontSize: 36,\n        fontWeight: 700,\n        textDecoration: strike ? \"line-through\" : \"none\",\n        ...look(variant),\n        ...nowrap,\n        ...style,\n      }}\n    >\n      {children}\n    </div>\n  );\n}\n\ninterface StoryListProps extends StoryPartProps {\n  /** Lines between rows. */\n  divider?: boolean;\n}\n\n/** Rows one under the other: a day per row, a menu, a line-up. */\nfunction StoryList({ divider = true, style, children }: StoryListProps) {\n  const rows = Children.toArray(children);\n  return (\n    <div style={{ display: \"flex\", flexDirection: \"column\", flexShrink: 0, ...style }}>\n      {rows.map((row, index) =>\n        isValidElement<StoryRowProps>(row)\n          ? cloneElement(row, { divider: divider && index < rows.length - 1 })\n          : row\n      )}\n    </div>\n  );\n}\n\ninterface StoryRowProps {\n  /** At the start, in bold: \"Mon\", \"Haircut\". */\n  label: ReactNode;\n  /** Under the label, muted: \"30 min\". */\n  detail?: ReactNode;\n  /** At the end: a price, a time. */\n  value?: ReactNode;\n  /** Chips between the label and the value. */\n  children?: ReactNode;\n  /** The most chips shown; the last place says how many more. */\n  max?: number;\n  more?: (hidden: number) => string;\n  /** Width of the label column, in px, to line rows up. */\n  labelWidth?: number;\n  /** Set by StoryList. */\n  divider?: boolean;\n  style?: CSSProperties;\n}\n\n/** One row of a `StoryList`. */\nfunction StoryRow({\n  label,\n  detail,\n  value,\n  children,\n  max,\n  more = (hidden) => `+${hidden}`,\n  labelWidth,\n  divider,\n  style,\n}: StoryRowProps) {\n  const { items, hidden } = limit(children, max);\n  return (\n    <div\n      style={{\n        display: \"flex\",\n        alignItems: \"center\",\n        gap: 24,\n        padding: \"22px 0\",\n        borderBottom: divider ? `2px solid ${v.border}` : \"2px solid rgba(0, 0, 0, 0)\",\n        ...style,\n      }}\n    >\n      <div\n        style={{\n          display: \"flex\",\n          flexDirection: \"column\",\n          flexShrink: 0,\n          ...(labelWidth ? { width: labelWidth } : { maxWidth: 520 }),\n        }}\n      >\n        <div style={{ display: \"flex\", fontSize: 46, fontWeight: 700, lineHeight: 1.1, ...nowrap }}>\n          {label}\n        </div>\n        {detail ? (\n          <div\n            style={{\n              display: \"flex\",\n              marginTop: 6,\n              fontSize: 32,\n              color: v.muted,\n              ...nowrap,\n            }}\n          >\n            {detail}\n          </div>\n        ) : null}\n      </div>\n      <div\n        style={{\n          display: \"flex\",\n          flexGrow: 1,\n          minWidth: 0,\n          gap: 14,\n          overflow: \"hidden\",\n          justifyContent: value ? \"flex-start\" : \"flex-end\",\n        }}\n      >\n        {items}\n        {hidden > 0 ? (\n          <StoryChip variant=\"outline\" style={{ borderStyle: \"dashed\", borderColor: v.border }}>\n            {more(hidden)}\n          </StoryChip>\n        ) : null}\n      </div>\n      {value ? (\n        <div style={{ display: \"flex\", flexShrink: 0, fontSize: 46, fontWeight: 700 }}>{value}</div>\n      ) : null}\n    </div>\n  );\n}\n\ninterface StoryHighlightProps extends StoryPartProps {\n  /** Above, muted: \"Tonight at\". */\n  label?: ReactNode;\n  /** Below, muted: \"Only one left\". */\n  caption?: ReactNode;\n  /** `accent` draws the big text in the accent colour. */\n  tone?: \"default\" | \"accent\";\n  /** Font size in px; by default it fits the length. */\n  size?: number;\n}\n\n/** One thing in very large type: a time, a date, a price, a score. */\nfunction StoryHighlight({\n  label,\n  caption,\n  tone = \"default\",\n  size,\n  style,\n  children,\n}: StoryHighlightProps) {\n  const length = textLength(children);\n  const fontSize = size ?? (length <= 3 ? 320 : length <= 5 ? 260 : length <= 8 ? 190 : 140);\n  return (\n    <div style={{ display: \"flex\", flexDirection: \"column\", flexShrink: 0, ...style }}>\n      {label ? (\n        <div style={{ display: \"flex\", fontSize: 44, color: v.muted, marginBottom: 8 }}>\n          {label}\n        </div>\n      ) : null}\n      <div\n        style={{\n          display: \"flex\",\n          fontSize,\n          fontWeight: 700,\n          lineHeight: 0.9,\n          letterSpacing: -Math.round(fontSize * 0.045),\n          color: tone === \"accent\" ? v.accent : v.foreground,\n          maxWidth: STORY_CONTENT_WIDTH,\n          ...nowrap,\n        }}\n      >\n        {children}\n      </div>\n      {caption ? (\n        <div\n          style={{\n            display: \"flex\",\n            marginTop: 28,\n            fontSize: 48,\n            lineHeight: 1.25,\n            color: v.muted,\n            lineClamp: 2,\n          }}\n        >\n          {caption}\n        </div>\n      ) : null}\n    </div>\n  );\n}\n\ninterface StoryImageProps {\n  /** A URL that allows CORS, or a data URL. */\n  src: string;\n  height?: number;\n  width?: number;\n  style?: CSSProperties;\n}\n\n/** A photo inside the content, with the theme's corners. */\nfunction StoryImage({ src, height = 560, width = STORY_CONTENT_WIDTH, style }: StoryImageProps) {\n  return (\n    <img\n      src={src}\n      alt=\"\"\n      width={width}\n      height={height}\n      style={{ width, height, flexShrink: 0, objectFit: \"cover\", borderRadius: v.radius, ...style }}\n    />\n  );\n}\n\n/** The bottom of the story: a `StoryCta` and a `StoryLinkHint`. */\nfunction StoryFooter({ style, children }: StoryPartProps) {\n  return (\n    <div\n      style={{\n        display: \"flex\",\n        flexDirection: \"column\",\n        alignItems: \"flex-start\",\n        flexShrink: 0,\n        gap: 24,\n        marginTop: \"auto\",\n        ...style,\n      }}\n    >\n      {children}\n    </div>\n  );\n}\n\ninterface StoryCtaProps extends StoryPartProps {\n  variant?: \"solid\" | \"outline\";\n  /** An arrow after the text. */\n  arrow?: boolean;\n}\n\n/** The call to action: \"Book through the link\". */\nfunction StoryCta({ variant = \"solid\", arrow = true, style, children }: StoryCtaProps) {\n  const solid = variant === \"solid\";\n  const color = solid ? v.accentForeground : v.foreground;\n  return (\n    <div\n      style={{\n        display: \"flex\",\n        alignItems: \"center\",\n        gap: 20,\n        height: 112,\n        padding: \"0 52px\",\n        boxSizing: \"border-box\",\n        borderRadius: 999,\n        borderWidth: 4,\n        borderStyle: \"solid\",\n        borderColor: solid ? v.accent : v.foreground,\n        backgroundColor: solid ? v.accent : \"rgba(0, 0, 0, 0)\",\n        color,\n        fontSize: 46,\n        fontWeight: 700,\n        maxWidth: STORY_CONTENT_WIDTH,\n        ...style,\n      }}\n    >\n      <div style={{ display: \"flex\", ...nowrap }}>{children}</div>\n      {arrow ? <Arrow color={solid ? \"currentColor\" : \"currentColor\"} /> : null}\n    </div>\n  );\n}\n\nfunction Arrow({ color }: { color: string }) {\n  return (\n    <svg width=\"44\" height=\"44\" viewBox=\"0 0 24 24\" fill=\"none\" style={{ flexShrink: 0 }}>\n      <path\n        d=\"M5 12h14m0 0-6-6m6 6-6 6\"\n        stroke={color}\n        strokeWidth=\"2.6\"\n        strokeLinecap=\"round\"\n        strokeLinejoin=\"round\"\n      />\n    </svg>\n  );\n}\n\n/** A small line pointing at where the link sticker goes: \"Tap the link\". */\nfunction StoryLinkHint({ style, children }: StoryPartProps) {\n  return (\n    <div\n      style={{\n        display: \"flex\",\n        alignItems: \"center\",\n        gap: 14,\n        fontSize: 36,\n        color: v.muted,\n        ...style,\n      }}\n    >\n      <svg width=\"40\" height=\"40\" viewBox=\"0 0 24 24\" fill=\"none\" style={{ flexShrink: 0 }}>\n        <path\n          d=\"M10 14a4 4 0 0 0 5.66 0l3-3a4 4 0 0 0-5.66-5.66l-1 1M14 10a4 4 0 0 0-5.66 0l-3 3a4 4 0 0 0 5.66 5.66l1-1\"\n          stroke=\"currentColor\"\n          strokeWidth=\"2.2\"\n          strokeLinecap=\"round\"\n          strokeLinejoin=\"round\"\n        />\n      </svg>\n      <div style={{ display: \"flex\", ...nowrap }}>{children}</div>\n    </div>\n  );\n}\n\n/** A line across the content, in the border colour. */\nfunction StoryDivider({ style }: { style?: CSSProperties }) {\n  return (\n    <div\n      style={{ display: \"flex\", flexShrink: 0, height: 2, backgroundColor: v.border, ...style }}\n    />\n  );\n}\n\ntype AnyProps = Record<string, unknown> & { children?: ReactNode; alt?: unknown };\n\n/**\n * The text of a story, in reading order, for the image's `alt`. Parts with\n * an `alt` prop (tiles, chips) are read by it instead of their text, so a\n * struck-through \"19h\" can say \"19h, taken\".\n *\n * @example\n * <StoryFrame story={story} alt={storyAlt(story)} … />\n */\nfunction storyAlt(story: ReactNode): string {\n  const runs: string[] = [];\n  const walk = (node: ReactNode) => {\n    if (node === null || node === undefined || typeof node === \"boolean\") return;\n    if (typeof node === \"string\" || typeof node === \"number\") {\n      const text = String(node).trim();\n      if (text) runs.push(text);\n      return;\n    }\n    if (Array.isArray(node)) {\n      node.forEach(walk);\n      return;\n    }\n    if (!isValidElement<AnyProps>(node)) return;\n    const { props, type } = node;\n    if (typeof props.alt === \"string\" && type !== \"img\") {\n      if (props.alt.trim()) runs.push(props.alt.trim());\n      return;\n    }\n    // Parts are plain functions without hooks, so they can be expanded here as Satori does.\n    if (typeof type === \"function\") {\n      walk((type as (props: AnyProps) => ReactNode)(props));\n      return;\n    }\n    walk(props.children);\n  };\n  walk(story);\n  return runs.map((run) => (/[.!?…:]$/.test(run) ? run : `${run}.`)).join(\" \");\n}\n\nexport {\n  Story,\n  STORY_CONTENT_WIDTH,\n  STORY_THEMES,\n  storyAlt,\n  StoryBody,\n  StoryBrand,\n  StoryChip,\n  StoryCta,\n  StoryDivider,\n  StoryEyebrow,\n  StoryFooter,\n  StoryGrid,\n  StoryHeader,\n  StoryHighlight,\n  StoryImage,\n  StoryLinkHint,\n  StoryList,\n  StoryRow,\n  StoryText,\n  StoryTile,\n  StoryTitle,\n  type StoryDecoration,\n  type StoryProps,\n  type StoryTheme,\n  type StoryThemeName,\n  type StoryVariant,\n};\n",
      "type": "registry:ui"
    }
  ],
  "type": "registry:ui"
}