{"version":3,"sources":["../src/utils/slugify.ts","../src/core/HeadingIdContext.tsx","../src/overrides/heading-with-id.tsx","../src/core/OptixFlowContext.tsx","../src/utils/width-guard.ts","../src/overrides/image.tsx","../src/utils/sanitize.ts","../src/overrides/link.tsx","../src/overrides/code-block.tsx","../src/overrides/iframe.tsx","../src/overrides/table.tsx","../src/overrides/defaults.ts","../src/core/MarkdownCompiler.ts","../src/core/Markdown.tsx","../src/hooks/useMarkdown.ts","../src/hooks/useMarkdownOptions.ts","../src/overrides/heading.tsx"],"names":["React","jsx","compiler","Fragment","useState","useMemo"],"mappings":";;;;;;;;;;;;;;;;;;AAGO,SAAS,QAAQ,IAAA,EAAsB;AAC5C,EAAA,OAAO,IAAA,CACJ,QAAA,EAAS,CACT,WAAA,EAAY,CACZ,MAAK,CACL,OAAA,CAAQ,MAAA,EAAQ,GAAG,CAAA,CACnB,OAAA,CAAQ,aAAa,EAAE,CAAA,CACvB,OAAA,CAAQ,QAAA,EAAU,GAAG,CAAA,CACrB,OAAA,CAAQ,KAAA,EAAO,EAAE,CAAA,CACjB,OAAA,CAAQ,KAAA,EAAO,EAAE,CAAA;AACtB;AAKA,IAAM,OAAA,uBAAc,GAAA,EAAY;AAEzB,SAAS,iBAAA,CAAkB,IAAA,EAAc,aAAA,GAAgB,KAAA,EAAe;AAC7E,EAAA,IAAI,aAAA,EAAe;AACjB,IAAA,OAAA,CAAQ,KAAA,EAAM;AAAA,EAChB;AAEA,EAAA,MAAM,QAAA,GAAW,QAAQ,IAAI,CAAA;AAC7B,EAAA,IAAI,IAAA,GAAO,QAAA;AACX,EAAA,IAAI,OAAA,GAAU,CAAA;AAEd,EAAA,OAAO,OAAA,CAAQ,GAAA,CAAI,IAAI,CAAA,EAAG;AACxB,IAAA,IAAA,GAAO,CAAA,EAAG,QAAQ,CAAA,CAAA,EAAI,OAAO,CAAA,CAAA;AAC7B,IAAA,OAAA,EAAA;AAAA,EACF;AAEA,EAAA,OAAA,CAAQ,IAAI,IAAI,CA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A,EAAI,GAAG,KAAA,EAAO;AAGzB,IAAM,EAAA,GAAK,CAAC,KAAA,qBACjBA,eAAC,OAAA,EAAA,EAAQ,KAAA,EAAO,CAAA,EAAI,GAAG,KAAA,EAAO","file":"index.cjs","sourcesContent":["/**\n * Convert a string to a URL-safe slug for heading IDs\n */\nexport function slugify(text: string): string {\n  return text\n    .toString()\n    .toLowerCase()\n    .trim()\n    .replace(/\\s+/g, \"-\") // Replace spaces with -\n    .replace(/[^\\w\\-]+/g, \"\") // Remove all non-word chars\n    .replace(/\\-\\-+/g, \"-\") // Replace multiple - with single -\n    .replace(/^-+/, \"\") // Trim - from start of text\n    .replace(/-+$/, \"\"); // Trim - from end of text\n}\n\n/**\n * Generate a unique ID for a heading, with collision tracking\n */\nconst usedIds = new Set<string>();\n\nexport function generateHeadingId(text: string, resetTracking = false): string {\n  if (resetTracking) {\n    usedIds.clear();\n  }\n\n  const baseSlug = slugify(text);\n  let slug = baseSlug;\n  let counter = 1;\n\n  while (usedIds.has(slug)) {\n    slug = `${baseSlug}-${counter}`;\n    counter++;\n  }\n\n  usedIds.add(slug);\n  return slug;\n}\n\n/**\n * Reset heading ID tracking (useful for testing or new renders)\n */\nexport function resetHeadingIds(): void {\n  usedIds.clear();\n}\n","import React from \"react\";\n\n/**\n * Context for sharing custom heading ID mappings\n * Maps heading text to custom IDs extracted from {#id} syntax\n */\nexport const HeadingIdContext = React.createContext<Map<string, string>>(new Map());\n\n/**\n * Provider component for heading ID mappings\n */\nexport function HeadingIdProvider({\n  children,\n  headingIds,\n}: {\n  children: React.ReactNode;\n  headingIds: Map<string, string>;\n}) {\n  return (\n    <HeadingIdContext.Provider value={headingIds}>\n      {children}\n    </HeadingIdContext.Provider>\n  );\n}\n\n/**\n * Hook to access custom heading ID for a given text\n */\nexport function useHeadingId(text: string): string | null {\n  const headingIds = React.useContext(HeadingIdContext);\n  return headingIds.get(text) || null;\n}\n","import React from \"react\";\nimport { generateHeadingId } from \"../utils/slugify\";\nimport { useHeadingId } from \"../core/HeadingIdContext\";\n\nexport interface HeadingProps extends React.HTMLAttributes<HTMLHeadingElement> {\n  children?: React.ReactNode;\n  className?: string;\n  level: 1 | 2 | 3 | 4 | 5 | 6;\n}\n\n/**\n * Custom heading component that supports:\n * - Automatic ID generation from heading text\n * - Custom ID syntax: {#custom-id} (preprocessed by compiler)\n * - Custom className support\n */\nexport function HeadingWithId({ children, className, level, ...props }: HeadingProps) {\n  // Extract text content from children\n  const textContent = React.useMemo(() => {\n    if (typeof children === \"string\") {\n      return children;\n    }\n    if (React.isValidElement(children)) {\n      const childProps = children.props as any;\n      return String(childProps?.children || \"\");\n    }\n    if (Array.isArray(children)) {\n      return children\n        .map((child) => {\n          if (typeof child === \"string\") return child;\n          if (React.isValidElement(child)) {\n            const childProps = child.props as any;\n            return String(childProps?.children || \"\");\n          }\n          return \"\";\n        })\n        .join(\"\");\n    }\n    return String(children || \"\");\n  }, [children]);\n\n  // Check if there's a custom ID mapping from preprocessing\n  const customId = useHeadingId(textContent);\n\n  // Use custom ID if available, otherwise auto-generate from text\n  const headingId = customId || generateHeadingId(textContent);\n\n  // Create props with proper typing\n  const headingProps = {\n    id: headingId,\n    className,\n    ...props,\n  };\n\n  return React.createElement(`h${level}`, headingProps, children);\n}\n\n// Individual heading components\nexport function H1WithId(props: Omit<HeadingProps, \"level\">) {\n  return <HeadingWithId level={1} {...props} />;\n}\n\nexport function H2WithId(props: Omit<HeadingProps, \"level\">) {\n  return <HeadingWithId level={2} {...props} />;\n}\n\nexport function H3WithId(props: Omit<HeadingProps, \"level\">) {\n  return <HeadingWithId level={3} {...props} />;\n}\n\nexport function H4WithId(props: Omit<HeadingProps, \"level\">) {\n  return <HeadingWithId level={4} {...props} />;\n}\n\nexport function H5WithId(props: Omit<HeadingProps, \"level\">) {\n  return <HeadingWithId level={5} {...props} />;\n}\n\nexport function H6WithId(props: Omit<HeadingProps, \"level\">) {\n  return <HeadingWithId level={6} {...props} />;\n}\n","import React from \"react\";\nimport type { OptixFlowConfig } from \"../types\";\n\n/**\n * Context for sharing OptixFlow configuration with image components\n */\nexport const OptixFlowContext = React.createContext<OptixFlowConfig | undefined>(\n  undefined\n);\n\n/**\n * Provider component for OptixFlow configuration\n */\nexport function OptixFlowProvider({\n  children,\n  config,\n}: {\n  children: React.ReactNode;\n  config?: OptixFlowConfig;\n}) {\n  return (\n    <OptixFlowContext.Provider value={config}>\n      {children}\n    </OptixFlowContext.Provider>\n  );\n}\n\n/**\n * Hook to access OptixFlow configuration\n */\nexport function useOptixFlowConfig(): OptixFlowConfig | undefined {\n  return React.useContext(OptixFlowContext);\n}\n","import type { CSSProperties } from \"react\";\n\n/**\n * Width-containment styles for markdown-rendered content.\n *\n * ## Why these are inline styles and not classes\n *\n * Production customer sites are served a **safelist-compiled** Tailwind\n * stylesheet: a utility class that was not present in the extraction snapshot\n * ships with no rule at all. Inline styles are immune to that failure mode, so\n * every guard in this module is expressed as a plain style object.\n *\n * ## The failure this prevents\n *\n * A single wide descendant (a GFM table, a `<pre>` with a long line, a raw\n * `<iframe width=\"1200\">`, an unbroken URL) has a min-content width larger than\n * a phone viewport. When the markdown output is nested inside a CSS grid or flex\n * item whose `min-width` resolves to `auto`, that min-content width becomes the\n * track's base size, the *whole column* grows past the viewport, and every\n * sibling in the layout (headline, byline, floating navbar) is dragged wide with\n * it. The page then scrolls horizontally and looks broken - not just the table.\n *\n * The guards below are layered so no single element can do that:\n *\n * 1. `MARKDOWN_CONTENT_GUARD_STYLE` on the markdown wrapper - caps the content\n *    box at its parent's width, allows long tokens to break, and clips (never\n *    scrolls) anything that still escapes.\n * 2. `SCROLL_CONTAINER_GUARD_STYLE` on tables and code blocks - the wide child\n *    scrolls *inside* the article column instead of widening the page.\n * 3. `MEDIA_GUARD_STYLE` on images and iframes - intrinsic/attribute widths can\n *    never exceed the column.\n *\n * @packageDocumentation\n */\n\n/**\n * Applied to the markdown wrapper element (the `wrapper` option of\n * {@link Markdown}, a `<div>` by default).\n *\n * - `minWidth: 0` - lets the wrapper shrink when it is itself a flex/grid item.\n * - `maxWidth: \"100%\"` - never wider than the column it was given.\n * - `overflowWrap: \"break-word\"` - long URLs and unbroken words wrap instead of\n *   spilling out of the column.\n * - `overflowX: \"clip\"` - last-resort containment. `clip` is used rather than\n *   `hidden`/`auto` because it does **not** create a scroll container, so it\n *   cannot introduce a second horizontal scrollbar, cannot trap the page's\n *   scroll position, and leaves the vertical axis `visible` (so `position:\n *   sticky` and overflowing decorations elsewhere keep working). Browsers that\n *   do not support `clip` simply drop the declaration and fall back to the\n *   other guards.\n */\nexport const MARKDOWN_CONTENT_GUARD_STYLE: CSSProperties = {\n  minWidth: 0,\n  maxWidth: \"100%\",\n  overflowWrap: \"break-word\",\n  overflowX: \"clip\",\n};\n\n/**\n * Applied to the scroll wrapper around a table, and to `<pre>` blocks.\n *\n * The wide child is allowed to keep its natural width but scrolls *inside* this\n * box. `overscrollBehaviorX: \"contain\"` stops a horizontal swipe inside a table\n * from chaining out to the page/back-navigation gesture on touch devices.\n */\nexport const SCROLL_CONTAINER_GUARD_STYLE: CSSProperties = {\n  maxWidth: \"100%\",\n  minWidth: 0,\n  overflowX: \"auto\",\n  overflowY: \"hidden\",\n  overscrollBehaviorX: \"contain\",\n};\n\n/**\n * Applied to replaced elements rendered from markdown whose height must be left\n * alone - currently `<iframe>`, where the embed's declared height is meaningful.\n *\n * Markdown routinely carries raw embed HTML with a hard-coded `width=\"1200\"`,\n * which on a phone would widen the article column and the whole page.\n */\nexport const MEDIA_GUARD_STYLE: CSSProperties = {\n  maxWidth: \"100%\",\n};\n\n/**\n * Applied to `<img>`.\n *\n * An image's intrinsic width is unbounded, so it is capped to the column. `height:\n * auto` is required alongside the cap: without it, a `height` attribute (or a\n * `height` from raw HTML) is honoured literally while the width is clamped, and\n * the image renders distorted.\n *\n * Consumer sites that ship Tailwind Preflight already get `img { max-width: 100%;\n * height: auto }`. This guard makes the behaviour independent of the host\n * stylesheet.\n */\nexport const IMAGE_GUARD_STYLE: CSSProperties = {\n  maxWidth: \"100%\",\n  height: \"auto\",\n};\n\n/**\n * Applied to inline `<code>`.\n *\n * `anywhere` (rather than `break-word`) is deliberate: it also reduces the\n * element's min-content contribution, so a long inline token cannot inflate an\n * ancestor grid/flex track even before the overflow guards engage.\n */\nexport const INLINE_CODE_GUARD_STYLE: CSSProperties = {\n  overflowWrap: \"anywhere\",\n};\n\n/**\n * Merge a guard style with a caller-supplied `style` prop.\n *\n * Caller values win, so a consumer can always opt out of an individual\n * declaration (for example `style={{ overflowX: \"visible\" }}`) without having to\n * fork the component.\n */\nexport function mergeGuardStyle(\n  guard: CSSProperties,\n  style?: CSSProperties,\n): CSSProperties {\n  return style ? { ...guard, ...style } : guard;\n}\n","import React from \"react\";\nimport { useOptixFlowConfig } from \"../core/OptixFlowContext\";\nimport { IMAGE_GUARD_STYLE, mergeGuardStyle } from \"../utils/width-guard\";\n\nexport interface ImageProps extends React.ImgHTMLAttributes<HTMLImageElement> {\n  src: string;\n  alt?: string;\n  optixFlowConfig?: any; // Accept optixFlowConfig as direct prop (overrides context)\n}\n\n/**\n * Image component that optionally delegates to @page-speed/img if available\n * Falls back to standard img tag if @page-speed/img is not installed\n *\n * Supports OptixFlow configuration via:\n * 1. Direct prop: <Image optixFlowConfig={{...}} />\n * 2. Context: <Markdown optixFlowConfig={{...}}><img /></Markdown>\n */\nexport function Image({\n  src,\n  alt = \"\",\n  optixFlowConfig: propConfig,\n  style,\n  ...props\n}: ImageProps) {\n  // Get optixFlowConfig from context (can be overridden by prop)\n  const contextConfig = useOptixFlowConfig();\n  const optixFlowConfig = propConfig || contextConfig;\n\n  /**\n   * An image's intrinsic width is unbounded and raw HTML in markdown can carry a\n   * hard-coded `width` attribute; either can widen the article column on a phone\n   * and drag the whole layout past the viewport. Capped inline so the guard\n   * survives a safelist-compiled Tailwind build.\n   */\n  const guardedStyle = mergeGuardStyle(IMAGE_GUARD_STYLE, style);\n\n  // Try to import @page-speed/img dynamically\n  // If not available, fall back to standard img\n  const [PageSpeedImg, setPageSpeedImg] = React.useState<React.ComponentType<any> | null>(null);\n  const [useFallback, setUseFallback] = React.useState(false);\n\n  React.useEffect(() => {\n    // Only try to load once\n    if (PageSpeedImg || useFallback) return;\n\n    // The dynamic import can settle after this component unmounts (a short-lived\n    // markdown render, or a test tearing down its environment). Setting state\n    // then is a no-op at best and throws inside React's scheduler at worst, so\n    // the resolution is dropped once unmounted.\n    let active = true;\n\n    import(\"@page-speed/img\")\n      .then((mod) => {\n        if (active) setPageSpeedImg(() => mod.Img);\n      })\n      .catch(() => {\n        // @page-speed/img not available, use fallback\n        if (active) setUseFallback(true);\n      });\n\n    return () => {\n      active = false;\n    };\n  }, [PageSpeedImg, useFallback]);\n\n  // Use @page-speed/img if available\n  if (PageSpeedImg) {\n    return (\n      <PageSpeedImg\n        src={src}\n        alt={alt}\n        optixFlowConfig={optixFlowConfig}\n        style={guardedStyle}\n        {...props}\n      />\n    );\n  }\n\n  // Fallback to standard img with loading=\"lazy\"\n  return (\n    <img src={src} alt={alt} loading=\"lazy\" style={guardedStyle} {...props} />\n  );\n}\n","/**\n * Basic HTML sanitization for markdown content\n * Removes potentially dangerous attributes and protocols\n */\n\nconst DANGEROUS_PROTOCOLS = [\"javascript:\", \"data:\", \"vbscript:\"];\nconst DANGEROUS_ATTRIBUTES = [\n  \"onerror\",\n  \"onload\",\n  \"onclick\",\n  \"onmouseover\",\n  \"onfocus\",\n  \"onblur\",\n];\n\n/**\n * Check if a URL uses a dangerous protocol\n */\nexport function isDangerousUrl(url: string): boolean {\n  const lowercaseUrl = url.toLowerCase().trim();\n  return DANGEROUS_PROTOCOLS.some((protocol) =>\n    lowercaseUrl.startsWith(protocol)\n  );\n}\n\n/**\n * Sanitize a URL by removing dangerous protocols\n */\nexport function sanitizeUrl(url: string): string {\n  if (isDangerousUrl(url)) {\n    return \"#\";\n  }\n  return url;\n}\n\n/**\n * Check if an attribute name is dangerous\n */\nexport function isDangerousAttribute(attr: string): boolean {\n  return DANGEROUS_ATTRIBUTES.some((dangerous) =>\n    attr.toLowerCase().startsWith(dangerous)\n  );\n}\n\n/**\n * Sanitize HTML attributes by removing dangerous ones\n * This is a basic implementation - for production use, consider DOMPurify\n */\nexport function sanitizeAttributes(\n  attributes: Record<string, any>\n): Record<string, any> {\n  const sanitized: Record<string, any> = {};\n\n  for (const [key, value] of Object.entries(attributes)) {\n    // Skip dangerous attributes\n    if (isDangerousAttribute(key)) {\n      continue;\n    }\n\n    // Sanitize URL attributes\n    if (\n      (key === \"href\" || key === \"src\") &&\n      typeof value === \"string\" &&\n      isDangerousUrl(value)\n    ) {\n      sanitized[key] = \"#\";\n    } else {\n      sanitized[key] = value;\n    }\n  }\n\n  return sanitized;\n}\n\n/**\n * Get default sanitization configuration\n */\nexport function getDefaultSanitizationConfig() {\n  return {\n    disableParsingRawHTML: false,\n    forceBlock: false,\n    forceInline: false,\n  };\n}\n","import React from \"react\";\nimport { sanitizeUrl, isDangerousUrl } from \"../utils/sanitize\";\n\nexport interface LinkProps\n  extends React.AnchorHTMLAttributes<HTMLAnchorElement> {\n  href?: string;\n  children?: React.ReactNode;\n}\n\n// Try to load Pressable at module level (optional peer dependency)\nlet Pressable: any = null;\ntry {\n  const pressableModule = require(\"@page-speed/pressable\");\n  Pressable = pressableModule.Pressable;\n} catch {\n  // Pressable not available - will use fallback\n}\n\n/**\n * Safe link component with automatic external link handling and URL normalization.\n * Uses @page-speed/pressable when available for enhanced link functionality including:\n * - Phone number normalization (tel: links)\n * - Email normalization (mailto: links)\n * - Internal/external link detection\n * - Automatic target and rel attributes\n */\nexport function Link({ href, children, ...props }: LinkProps) {\n  // Sanitize the URL\n  const safeHref = href ? sanitizeUrl(href) : \"#\";\n\n  // Check if href is dangerous\n  if (isDangerousUrl(safeHref)) {\n    return <span {...props}>{children}</span>;\n  }\n\n  // Don't use Pressable for placeholder links (\"#\") - render basic link\n  const isPlaceholder = safeHref === \"#\";\n\n  // Use Pressable if available (provides phone/email normalization and enhanced navigation)\n  // but not for placeholder links which should remain as-is\n  if (Pressable && !isPlaceholder) {\n    return (\n      <Pressable href={safeHref} {...props}>\n        {children}\n      </Pressable>\n    );\n  }\n\n  // Fallback to basic link logic if Pressable not available\n  const isExternal = React.useMemo(() => {\n    if (!href) return false;\n\n    try {\n      // Check if it's an absolute URL\n      const url = new URL(href, window.location.href);\n      return url.origin !== window.location.origin;\n    } catch {\n      // Relative URLs are internal\n      return false;\n    }\n  }, [href]);\n\n  // Add security attributes for external links\n  const externalProps = isExternal\n    ? {\n        target: \"_blank\",\n        rel: \"noopener noreferrer\",\n      }\n    : {};\n\n  return (\n    <a href={safeHref} {...externalProps} {...props}>\n      {children}\n    </a>\n  );\n}\n","import React from \"react\";\nimport {\n  INLINE_CODE_GUARD_STYLE,\n  SCROLL_CONTAINER_GUARD_STYLE,\n  mergeGuardStyle,\n} from \"../utils/width-guard\";\n\nexport interface CodeBlockProps extends React.HTMLAttributes<HTMLElement> {\n  children?: React.ReactNode;\n  className?: string;\n}\n\n/**\n * Code block component with language detection.\n *\n * `<pre>` defaults to `white-space: pre`, so a single long line has an unbounded\n * min-content width and would otherwise stretch the article column past the\n * viewport on a phone. The block scrolls horizontally inside its own box instead.\n */\nexport function CodeBlock({\n  children,\n  className,\n  style,\n  ...props\n}: CodeBlockProps) {\n  // Extract language from className (e.g., \"language-javascript\")\n  const language = React.useMemo(() => {\n    if (!className) return null;\n    const match = className.match(/language-(\\w+)/);\n    return match ? match[1] : null;\n  }, [className]);\n\n  return (\n    <pre\n      className={className}\n      data-language={language}\n      style={mergeGuardStyle(SCROLL_CONTAINER_GUARD_STYLE, style)}\n      {...props}\n    >\n      <code>{children}</code>\n    </pre>\n  );\n}\n\n/**\n * Inline code component.\n *\n * Long inline tokens (CLI invocations, identifiers, URLs) are allowed to break\n * anywhere so they cannot push the surrounding text block wider than its column.\n */\nexport function InlineCode({ children, style, ...props }: CodeBlockProps) {\n  return (\n    <code style={mergeGuardStyle(INLINE_CODE_GUARD_STYLE, style)} {...props}>\n      {children}\n    </code>\n  );\n}\n","import React from \"react\";\nimport { MEDIA_GUARD_STYLE, mergeGuardStyle } from \"../utils/width-guard\";\n\nexport interface IframeProps extends React.IframeHTMLAttributes<HTMLIFrameElement> {\n  src: string;\n  title?: string;\n  className?: string;\n}\n\n/**\n * Iframe component with security attributes and responsive defaults\n * Commonly used for embeds (YouTube, Twitter, Spotify, etc.)\n *\n * Embed markup pasted into an article routinely carries a hard-coded\n * `width=\"1200\"`, which on a phone would widen the article column and the whole\n * page. The inline `max-width: 100%` guard caps it at the column width; authors\n * can still override it via `style`.\n */\nexport function Iframe({\n  src,\n  title = \"Embedded content\",\n  className,\n  style,\n  ...props\n}: IframeProps) {\n  return (\n    <iframe\n      src={src}\n      title={title}\n      className={className}\n      style={mergeGuardStyle(MEDIA_GUARD_STYLE, style)}\n      loading=\"lazy\"\n      allowFullScreen\n      {...props}\n    />\n  );\n}\n","import React from \"react\";\nimport {\n  SCROLL_CONTAINER_GUARD_STYLE,\n  mergeGuardStyle,\n} from \"../utils/width-guard\";\n\nexport interface TableProps\n  extends React.TableHTMLAttributes<HTMLTableElement> {\n  children?: React.ReactNode;\n  /**\n   * Styles for the horizontal scroll wrapper that surrounds the table.\n   * Merged over {@link SCROLL_CONTAINER_GUARD_STYLE}, so passing\n   * `{ overflowX: \"visible\" }` opts a single table out of scrolling.\n   */\n  wrapperStyle?: React.CSSProperties;\n  /**\n   * Additional className for the horizontal scroll wrapper.\n   */\n  wrapperClassName?: string;\n}\n\n/**\n * Responsive table wrapper component.\n *\n * A GFM table's min-content width regularly exceeds a phone viewport. The table\n * keeps its natural width and scrolls horizontally *inside* this wrapper, so it\n * can never widen the article column (and therefore can never widen the page).\n *\n * The wrapper styles are inline on purpose - production sites are served a\n * safelist-compiled Tailwind build where an unextracted utility class has no\n * rule at all.\n */\nexport function Table({\n  children,\n  className,\n  style,\n  wrapperStyle,\n  wrapperClassName,\n  ...props\n}: TableProps) {\n  const tableClassName = className\n    ? `markdown-table ${className}`\n    : \"markdown-table\";\n\n  return (\n    <div\n      className={\n        wrapperClassName ? `table-wrapper ${wrapperClassName}` : \"table-wrapper\"\n      }\n      style={mergeGuardStyle(SCROLL_CONTAINER_GUARD_STYLE, wrapperStyle)}\n    >\n      <table className={tableClassName} style={style} {...props}>\n        {children}\n      </table>\n    </div>\n  );\n}\n\n/**\n * Table head component\n */\nexport function TableHead({\n  children,\n  ...props\n}: React.HTMLAttributes<HTMLTableSectionElement>) {\n  return <thead {...props}>{children}</thead>;\n}\n\n/**\n * Table body component\n */\nexport function TableBody({\n  children,\n  ...props\n}: React.HTMLAttributes<HTMLTableSectionElement>) {\n  return <tbody {...props}>{children}</tbody>;\n}\n\n/**\n * Table row component\n */\nexport function TableRow({\n  children,\n  ...props\n}: React.HTMLAttributes<HTMLTableRowElement>) {\n  return <tr {...props}>{children}</tr>;\n}\n\n/**\n * Table header cell component\n */\nexport function TableHeaderCell({\n  children,\n  ...props\n}: React.ThHTMLAttributes<HTMLTableCellElement>) {\n  return <th {...props}>{children}</th>;\n}\n\n/**\n * Table data cell component\n */\nexport function TableDataCell({\n  children,\n  ...props\n}: React.TdHTMLAttributes<HTMLTableCellElement>) {\n  return <td {...props}>{children}</td>;\n}\n","import type { OverrideMap } from \"../types\";\nimport { H1WithId, H2WithId, H3WithId, H4WithId, H5WithId, H6WithId } from \"./heading-with-id\";\nimport { Image } from \"./image\";\nimport { Link } from \"./link\";\nimport { CodeBlock, InlineCode } from \"./code-block\";\nimport { Iframe } from \"./iframe\";\nimport {\n  Table,\n  TableHead,\n  TableBody,\n  TableRow,\n  TableHeaderCell,\n  TableDataCell,\n} from \"./table\";\n\n/**\n * Default override map for ecosystem-optimized components\n * Uses heading components with custom ID support ({#id} syntax)\n */\nexport function getDefaultOverrides(): OverrideMap {\n  return {\n    // Headings with auto-ID generation and {#id} syntax support\n    h1: H1WithId,\n    h2: H2WithId,\n    h3: H3WithId,\n    h4: H4WithId,\n    h5: H5WithId,\n    h6: H6WithId,\n\n    // Images with @page-speed/img integration\n    img: Image,\n\n    // Safe links with external link handling\n    a: Link,\n\n    // Iframes for embeds (YouTube, Twitter, Spotify, etc.)\n    iframe: Iframe,\n\n    // Code blocks with language detection\n    pre: CodeBlock,\n    code: InlineCode,\n\n    // Responsive tables\n    table: Table,\n    thead: TableHead,\n    tbody: TableBody,\n    tr: TableRow,\n    th: TableHeaderCell,\n    td: TableDataCell,\n  };\n}\n","import { compiler } from \"markdown-to-jsx\";\nimport React, { type ReactNode, type ElementType } from \"react\";\nimport type { MarkdownOptions, MarkdownStylesMap } from \"../types\";\nimport { getDefaultOverrides } from \"../overrides/defaults\";\nimport { HeadingIdProvider } from \"./HeadingIdContext\";\nimport { OptixFlowProvider } from \"./OptixFlowContext\";\nimport { HeadingWithId } from \"../overrides/heading-with-id\";\nimport { slugify as defaultSlugify } from \"../utils/slugify\";\nimport {\n  MARKDOWN_CONTENT_GUARD_STYLE,\n  mergeGuardStyle,\n} from \"../utils/width-guard\";\n\n/**\n * Preprocesses markdown to extract custom heading IDs using {#id} syntax\n * Returns processed markdown without {#id} and a map of IDs\n */\nfunction preprocessMarkdownHeadings(markdown: string): {\n  processedMarkdown: string;\n  headingIds: Map<string, string>;\n} {\n  const headingIds = new Map<string, string>();\n\n  // Match markdown headings with optional {#id} syntax\n  const processedMarkdown = markdown.replace(\n    /^(#{1,6})\\s+(.+?)(?:\\s*\\{#([a-zA-Z0-9_-]+)\\}\\s*)?$/gm,\n    (match, hashes, text, customId) => {\n      const cleanText = text.trim();\n      if (customId) {\n        // Store the custom ID mapping\n        headingIds.set(cleanText, customId);\n        // Return heading without the {#id} syntax\n        return `${hashes} ${cleanText}`;\n      }\n      return match;\n    }\n  );\n\n  return { processedMarkdown, headingIds };\n}\n\n/**\n * Creates heading components with custom ID support and optional className\n */\nfunction createHeadingWithClassName(level: 1 | 2 | 3 | 4 | 5 | 6, customClassName?: string) {\n  return function HeadingComponent(props: any) {\n    const { className: propsClassName, ...rest } = props;\n\n    // Merge custom className from markdownStyles with any className passed by markdown-to-jsx\n    const finalClassName = customClassName\n      ? propsClassName\n        ? `${propsClassName} ${customClassName}`\n        : customClassName\n      : propsClassName;\n\n    return React.createElement(HeadingWithId, {\n      level,\n      className: finalClassName,\n      ...rest,\n    });\n  };\n}\n\n/**\n * Creates override objects with className props from markdownStyles\n */\nfunction createStyleOverrides(\n  markdownStyles: MarkdownStylesMap,\n  baseOverrides: Record<string, ElementType>\n): Record<string, any> {\n  const styleOverrides: Record<string, any> = {};\n\n  for (const [element, className] of Object.entries(markdownStyles)) {\n    // Special handling for headings to preserve ID functionality\n    if (element.match(/^h[1-6]$/)) {\n      const level = parseInt(element[1]) as 1 | 2 | 3 | 4 | 5 | 6;\n      styleOverrides[element] = createHeadingWithClassName(level, className);\n    } else {\n      const BaseComponent = baseOverrides[element];\n\n      if (BaseComponent) {\n        // If we have a base component, wrap it with className\n        styleOverrides[element] = {\n          component: BaseComponent,\n          props: { className },\n        };\n      } else {\n        // Create a simple wrapper that adds className to the default element\n        styleOverrides[element] = {\n          component: (props: any) =>\n            React.createElement(element, { ...props, className }),\n        };\n      }\n    }\n  }\n\n  return styleOverrides;\n}\n\n/**\n * Merge {@link MARKDOWN_CONTENT_GUARD_STYLE} into a wrapper element's own style.\n *\n * Exported-adjacent helper kept local so the guard is applied in exactly one\n * place; the element's existing style declarations still win.\n */\nfunction applyWidthGuard(element: React.ReactElement): React.ReactElement {\n  const typed = element as React.ReactElement<{ style?: React.CSSProperties }>;\n  return React.cloneElement(typed, {\n    style: mergeGuardStyle(MARKDOWN_CONTENT_GUARD_STYLE, typed.props.style),\n  });\n}\n\n/**\n * Compile markdown to JSX with ecosystem defaults\n */\nexport function compileMarkdown(\n  markdown: string,\n  options: MarkdownOptions = {}\n): ReactNode {\n  const {\n    overrides: customOverrides = {},\n    markdownStyles = {},\n    optixFlowConfig,\n    useDefaults = true,\n    wrapper = \"div\",\n    // Consumed here, never forwarded into markdown-to-jsx compiler options.\n    widthGuard = true,\n    ...restOptions\n  } = options;\n\n  // Preprocess heading IDs from {#id} syntax\n  const { processedMarkdown, headingIds } = preprocessMarkdownHeadings(markdown);\n\n  // Create custom slugify function that uses our custom IDs\n  const customSlugify = (text: string): string => {\n    // Check if we have a custom ID for this heading text\n    const customId = headingIds.get(text);\n    if (customId) {\n      return customId;\n    }\n    // Otherwise use default slugify\n    return defaultSlugify(text);\n  };\n\n  // Get base overrides (defaults or empty)\n  const baseOverrides = useDefaults ? getDefaultOverrides() : {};\n\n  // Create style-based overrides from markdownStyles\n  const styleOverrides =\n    Object.keys(markdownStyles).length > 0\n      ? createStyleOverrides(markdownStyles, baseOverrides)\n      : {};\n\n  // Merge in priority order: base -> styles -> custom\n  // Custom overrides take highest priority\n  const finalOverrides = {\n    ...baseOverrides,\n    ...styleOverrides,\n    ...customOverrides,\n  };\n\n  // Compile markdown with custom slugify and merged options\n  const compiled = compiler(processedMarkdown, {\n    wrapper: wrapper as any, // wrapper can be string, ElementType or null\n    overrides: finalOverrides as any,\n    slugify: customSlugify,\n    ...restOptions,\n  });\n\n  // Apply width containment to the wrapper element.\n  //\n  // This lives in the compiler rather than only in <Markdown> because callers\n  // reach the compiler directly - customer-sites' block registry calls\n  // compileMarkdown() to hydrate markup-bearing props, and useMarkdown() wraps it.\n  // Putting the guard here means every entry point is protected, not just the\n  // component. Without it, one wide descendant (GFM table, long <pre> line,\n  // embed with a hard-coded width, unbroken URL) can inflate an ancestor\n  // grid/flex column and scroll the whole page sideways on a phone.\n  const guarded =\n    widthGuard && typeof wrapper === \"string\" && React.isValidElement(compiled)\n      ? applyWidthGuard(compiled)\n      : compiled;\n\n  // Wrap in context providers if needed\n  let result: ReactNode = guarded;\n\n  // Wrap with OptixFlow context if config provided\n  if (optixFlowConfig) {\n    result = React.createElement(\n      OptixFlowProvider,\n      { config: optixFlowConfig, children: result }\n    ) as ReactNode;\n  }\n\n  // Wrap with HeadingId context if custom IDs present\n  if (headingIds.size > 0) {\n    result = React.createElement(\n      HeadingIdProvider,\n      { headingIds, children: result }\n    ) as ReactNode;\n  }\n\n  return result;\n}\n\n/**\n * Pre-compile markdown for caching purposes\n * This is useful when you want to compile markdown once and reuse it\n */\nexport function precompileMarkdown(\n  markdown: string,\n  options: MarkdownOptions = {}\n): () => ReactNode {\n  return () => compileMarkdown(markdown, options);\n}\n","import React from \"react\";\nimport type { MarkdownProps } from \"../types\";\nimport { compileMarkdown } from \"./MarkdownCompiler\";\n\n/**\n * Primary Markdown component for rendering markdown content\n *\n * @example\n * ```tsx\n * <Markdown>\n *   # Hello World\n *   This is **bold** and this is *italic*.\n * </Markdown>\n * ```\n *\n * @example With custom overrides\n * ```tsx\n * <Markdown\n *   overrides={{\n *     h1: ({ children }) => <h1 className=\"custom-heading\">{children}</h1>\n *   }}\n * >\n *   # Custom Heading\n * </Markdown>\n * ```\n *\n * @example With custom styles\n * ```tsx\n * <Markdown\n *   markdownStyles={{\n *     h2: 'text-2xl md:text-4xl text-primary',\n *     img: 'shadow-lg rounded-2xl',\n *     iframe: 'aspect-video w-full rounded-2xl'\n *   }}\n * >\n *   ## Styled Heading\n *   ![Image](url)\n * </Markdown>\n * ```\n *\n * @example With heading IDs\n * ```tsx\n * <Markdown>\n *   ## Introduction {#intro}\n *   Content here...\n * </Markdown>\n * ```\n */\nexport function Markdown({\n  children,\n  className,\n  overrides,\n  markdownStyles,\n  optixFlowConfig,\n  useDefaults = true,\n  wrapper = \"div\",\n  widthGuard = true,\n  ...options\n}: MarkdownProps) {\n  // Memoize the compiled output to avoid re-compilation on every render\n  const compiled = React.useMemo(\n    () =>\n      compileMarkdown(children, {\n        overrides,\n        markdownStyles,\n        optixFlowConfig,\n        useDefaults,\n        wrapper,\n        widthGuard,\n        ...options,\n      }),\n    [\n      children,\n      overrides,\n      markdownStyles,\n      optixFlowConfig,\n      useDefaults,\n      wrapper,\n      widthGuard,\n      options,\n    ]\n  );\n\n  // Apply className if provided and wrapper is a string and result is a ReactElement.\n  //\n  // The mobile width guard is NOT applied here - it is applied inside\n  // compileMarkdown so that direct compiler callers (customer-sites' block\n  // registry, useMarkdown) get it too. See utils/width-guard.\n  if (className && typeof wrapper === \"string\" && React.isValidElement(compiled)) {\n    return React.cloneElement(compiled, {\n      className: compiled.props.className\n        ? `${compiled.props.className} ${className}`\n        : className,\n    } as any);\n  }\n\n  return <>{compiled}</>;\n}\n\n// Display name for debugging\nMarkdown.displayName = \"Markdown\";\n","import { useMemo, useState } from \"react\";\nimport type { MarkdownOptions, UseMarkdownResult } from \"../types\";\nimport { compileMarkdown } from \"../core/MarkdownCompiler\";\n\n/**\n * Hook for compiling markdown to JSX\n *\n * @param markdown - The markdown string to compile\n * @param options - Markdown compilation options\n * @returns Compiled JSX content with compilation state\n *\n * @example\n * ```tsx\n * function MyComponent() {\n *   const { content, isCompiling } = useMarkdown(\"# Hello World\");\n *   return <div>{content}</div>;\n * }\n * ```\n */\nexport function useMarkdown(\n  markdown: string,\n  options: MarkdownOptions = {}\n): UseMarkdownResult {\n  const [error, setError] = useState<Error | undefined>(undefined);\n\n  const content = useMemo(() => {\n    try {\n      setError(undefined);\n      const result = compileMarkdown(markdown, options);\n      return result;\n    } catch (err) {\n      const compilationError =\n        err instanceof Error ? err : new Error(String(err));\n      setError(compilationError);\n      return null;\n    }\n    // eslint-disable-next-line react-hooks/exhaustive-deps\n  }, [markdown, JSON.stringify(options)]);\n\n  return {\n    content,\n    isCompiling: false,\n    error,\n  };\n}\n","import { useMemo } from \"react\";\nimport type { MarkdownOptions, OverrideMap } from \"../types\";\nimport { getDefaultOverrides } from \"../overrides/defaults\";\n\n/**\n * Hook for merging custom markdown options with defaults\n *\n * @param options - Custom markdown options\n * @returns Merged options with defaults\n *\n * @example\n * ```tsx\n * function MyComponent() {\n *   const options = useMarkdownOptions({\n *     overrides: {\n *       h1: MyCustomH1,\n *     },\n *   });\n *\n *   return <Markdown {...options}># Hello</Markdown>;\n * }\n * ```\n */\nexport function useMarkdownOptions(\n  options: MarkdownOptions = {}\n): MarkdownOptions {\n  const {\n    overrides: customOverrides = {},\n    useDefaults = true,\n    ...restOptions\n  } = options;\n\n  // Memoize the merged overrides\n  const mergedOverrides = useMemo<OverrideMap>(() => {\n    if (!useDefaults) {\n      return customOverrides;\n    }\n\n    return {\n      ...getDefaultOverrides(),\n      ...customOverrides,\n    };\n  }, [customOverrides, useDefaults]);\n\n  // Return merged options\n  return useMemo(\n    () => ({\n      ...restOptions,\n      overrides: mergedOverrides,\n      useDefaults,\n    }),\n    [mergedOverrides, restOptions, useDefaults]\n  );\n}\n","import React from \"react\";\nimport { generateHeadingId } from \"../utils/slugify\";\n\nexport interface HeadingProps\n  extends React.HTMLAttributes<HTMLHeadingElement> {\n  level: 1 | 2 | 3 | 4 | 5 | 6;\n  children?: React.ReactNode;\n}\n\n/**\n * Heading component with automatic ID generation for anchor links\n */\nexport function Heading({ level, children, id, ...props }: HeadingProps) {\n  const Tag = `h${level}` as \"h1\" | \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\";\n\n  // Generate ID from text content if not provided\n  const generatedId = React.useMemo(() => {\n    if (id) return id;\n\n    // Extract text content from children\n    const textContent =\n      typeof children === \"string\"\n        ? children\n        : React.Children.toArray(children)\n            .filter((child) => typeof child === \"string\")\n            .join(\"\");\n\n    return textContent ? generateHeadingId(textContent) : undefined;\n  }, [children, id]);\n\n  return (\n    <Tag id={generatedId} {...props}>\n      {children}\n    </Tag>\n  );\n}\n\n// Create individual heading components\nexport const H1 = (props: React.HTMLAttributes<HTMLHeadingElement>) => (\n  <Heading level={1} {...props} />\n);\n\nexport const H2 = (props: React.HTMLAttributes<HTMLHeadingElement>) => (\n  <Heading level={2} {...props} />\n);\n\nexport const H3 = (props: React.HTMLAttributes<HTMLHeadingElement>) => (\n  <Heading level={3} {...props} />\n);\n\nexport const H4 = (props: React.HTMLAttributes<HTMLHeadingElement>) => (\n  <Heading level={4} {...props} />\n);\n\nexport const H5 = (props: React.HTMLAttributes<HTMLHeadingElement>) => (\n  <Heading level={5} {...props} />\n);\n\nexport const H6 = (props: React.HTMLAttributes<HTMLHeadingElement>) => (\n  <Heading level={6} {...props} />\n);\n"]}