@cognite/aura 1.49709.0 → 1.49741.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -382,75 +382,49 @@ function MessageAttachment({ data, className, onRemove, ...props }) {
382
382
  const mediaType = data.mediaType?.startsWith('image/') && data.url ? 'image' : 'file';
383
383
  const isImage = mediaType === 'image';
384
384
  const attachmentLabel = filename || (isImage ? 'Image' : 'Attachment');
385
- return /*#__PURE__*/ _jsx("div", {
385
+ return /*#__PURE__*/ _jsxs("div", {
386
386
  "data-slot": "message-attachment",
387
387
  className: cn('group relative size-24 overflow-hidden rounded-lg', className),
388
388
  ...props,
389
- children: isImage ? /*#__PURE__*/ _jsxs(_Fragment, {
390
- children: [
391
- /*#__PURE__*/ _jsx("img", {
392
- alt: filename || 'attachment',
393
- className: "size-full object-cover",
394
- height: 100,
395
- src: data.url,
396
- width: 100
397
- }),
398
- onRemove && /*#__PURE__*/ _jsxs(Button, {
399
- "aria-label": "Remove attachment",
400
- className: "absolute top-2 right-2 size-6 rounded-full bg-card-background/80 p-0 opacity-0 backdrop-blur-sm transition-opacity hover:bg-card-background group-hover:opacity-100 [&>svg]:size-3",
401
- onClick: (e)=>{
402
- e.stopPropagation();
403
- onRemove();
404
- },
405
- type: "button",
406
- variant: "ghost",
407
- children: [
408
- /*#__PURE__*/ _jsx(IconX, {}),
409
- /*#__PURE__*/ _jsx("span", {
410
- className: "sr-only",
411
- children: "Remove"
412
- })
413
- ]
414
- })
415
- ]
416
- }) : /*#__PURE__*/ _jsxs(_Fragment, {
417
- children: [
418
- /*#__PURE__*/ _jsxs(Tooltip, {
419
- children: [
420
- /*#__PURE__*/ _jsx(TooltipTrigger, {
421
- render: /*#__PURE__*/ _jsx("div", {
422
- className: "flex size-full shrink-0 items-center justify-center rounded-lg bg-muted-background text-muted-foreground",
423
- children: /*#__PURE__*/ _jsx(IconPaperclip, {
424
- className: "size-4"
425
- })
426
- })
427
- }),
428
- /*#__PURE__*/ _jsx(TooltipContent, {
429
- children: /*#__PURE__*/ _jsx("p", {
430
- children: attachmentLabel
389
+ children: [
390
+ isImage ? /*#__PURE__*/ _jsx("img", {
391
+ alt: filename || 'attachment',
392
+ className: "size-full object-cover",
393
+ height: 100,
394
+ src: data.url,
395
+ width: 100
396
+ }) : /*#__PURE__*/ _jsxs(Tooltip, {
397
+ children: [
398
+ /*#__PURE__*/ _jsx(TooltipTrigger, {
399
+ render: /*#__PURE__*/ _jsx("div", {
400
+ className: "flex size-full shrink-0 items-center justify-center rounded-lg bg-muted-background text-muted-foreground",
401
+ children: /*#__PURE__*/ _jsx(IconPaperclip, {
402
+ className: "size-4"
431
403
  })
432
404
  })
433
- ]
434
- }),
435
- onRemove && /*#__PURE__*/ _jsxs(Button, {
436
- "aria-label": "Remove attachment",
437
- className: "size-6 shrink-0 rounded-full p-0 opacity-0 transition-opacity hover:bg-base-background-hover group-hover:opacity-100 [&>svg]:size-3",
438
- onClick: (e)=>{
439
- e.stopPropagation();
440
- onRemove();
441
- },
442
- type: "button",
443
- variant: "ghost",
444
- children: [
445
- /*#__PURE__*/ _jsx(IconX, {}),
446
- /*#__PURE__*/ _jsx("span", {
447
- className: "sr-only",
448
- children: "Remove"
405
+ }),
406
+ /*#__PURE__*/ _jsx(TooltipContent, {
407
+ children: /*#__PURE__*/ _jsx("p", {
408
+ children: attachmentLabel
449
409
  })
450
- ]
410
+ })
411
+ ]
412
+ }),
413
+ onRemove && /*#__PURE__*/ _jsx(Button, {
414
+ "aria-label": "Remove attachment",
415
+ className: "absolute top-1 right-1 size-6 rounded-full bg-card-background/80 opacity-0 backdrop-blur-sm transition-opacity hover:bg-card-background group-hover:opacity-100 group-focus-within:opacity-100 [@media(hover:none)]:opacity-100",
416
+ onClick: (e)=>{
417
+ e.stopPropagation();
418
+ onRemove();
419
+ },
420
+ size: "icon",
421
+ type: "button",
422
+ variant: "ghost",
423
+ children: /*#__PURE__*/ _jsx(IconX, {
424
+ className: "size-3"
451
425
  })
452
- ]
453
- })
426
+ })
427
+ ]
454
428
  });
455
429
  }
456
430
  function MessageAttachments({ children, className, ...props }) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/components/ui/core/message/message.tsx"],"sourcesContent":["import type {\n ComponentProps,\n HTMLAttributes,\n ReactElement,\n ReactNode,\n} from 'react';\nimport {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useState,\n} from 'react';\n\nimport { mermaid as mermaidPlugin } from '@streamdown/mermaid';\nimport {\n IconChevronLeft,\n IconChevronRight,\n IconPaperclip,\n IconX,\n} from '@tabler/icons-react';\nimport type { JSX } from 'react/jsx-runtime';\nimport type { Components, ExtraProps } from 'streamdown';\nimport { Streamdown } from 'streamdown';\n\nimport type { FileUIPart, UIMessage } from '../../../../lib/ai/types';\nimport {\n PortalContainerContext,\n usePortalContainer,\n} from '../../../../lib/portal-container-context';\nimport { cn, getInitials } from '../../../../lib/utils';\nimport {\n Avatar,\n AvatarFallback,\n AvatarIcon,\n AvatarImage,\n} from '../avatar/avatar';\nimport { Button } from '../button/button';\nimport { ButtonGroup, ButtonGroupText } from '../button-group/button-group';\nimport { Tooltip, TooltipContent, TooltipTrigger } from '../tooltip/tooltip';\n\nimport { MESSAGE_RESPONSE_DEFAULT_STREAMDOWN_CONTROLS } from './message-response-default-streamdown-controls';\n\ntype MessageProps = HTMLAttributes<HTMLDivElement> & {\n isResponse?: boolean;\n};\n\nconst Message = ({\n className,\n isResponse = false,\n ...props\n}: MessageProps): ReactNode => (\n <div\n data-slot=\"message\"\n className={cn(\n 'group flex w-full items-start justify-start gap-3 mb-0 py-3',\n isResponse ? 'is-assistant items-start' : 'is-user flex-row-reverse',\n className\n )}\n {...props}\n />\n);\n\ntype MessageContentProps = HTMLAttributes<HTMLDivElement>;\n\nconst MessageContent = ({\n children,\n className,\n ...props\n}: MessageContentProps): ReactNode => (\n <div\n data-slot=\"message-content\"\n className={cn(\n 'is-user:dark flex flex-col gap-4 rounded-md text-base leading-tight tracking-tightest',\n 'max-w-4/5',\n // The table grid's rows are absolutely positioned, so they don't widen the content; give tables the full width rather than wrapping cells to fit the headers.\n 'has-data-[slot=message-table]:w-full',\n 'group-[.is-user]:overflow-hidden group-[.is-user]:bg-medium-background group-[.is-user]:p-2 group-[.is-user]:text-base-foreground',\n 'group-[.is-assistant]:text-base-foreground group-[.is-assistant]:pt-1',\n className\n )}\n {...props}\n >\n {children}\n </div>\n);\n\ntype MessageAvatarProps = ComponentProps<typeof Avatar> & {\n avatarUrl?: string;\n name?: string;\n};\n\nconst MessageAvatar = ({\n avatarUrl,\n name,\n className,\n children,\n variant,\n sizes,\n ...props\n}: MessageAvatarProps): ReactNode => {\n const fallbackText = name ? getInitials(name) : 'ME';\n\n return (\n <Avatar\n data-slot=\"message-avatar\"\n className={cn('size-7 group-[.is-user]:mt-1', className)}\n variant={variant}\n sizes={sizes}\n {...props}\n >\n {children || (\n <>\n {avatarUrl && (\n <AvatarImage\n alt={name || ''}\n className=\"mt-0 mb-0\"\n src={avatarUrl}\n />\n )}\n <AvatarFallback>{fallbackText}</AvatarFallback>\n </>\n )}\n </Avatar>\n );\n};\n\ntype MessageAvatarIconProps = ComponentProps<typeof AvatarIcon>;\n\nconst MessageAvatarIcon = (props: MessageAvatarIconProps): ReactNode => (\n <AvatarIcon data-slot=\"message-avatar-icon\" {...props} />\n);\n\ntype MessageActionsProps = ComponentProps<'div'>;\n\nconst MessageActions = ({\n className,\n children,\n ...props\n}: MessageActionsProps): ReactNode => (\n <div\n data-slot=\"message-actions\"\n className={cn('flex items-center gap-2 pt-2', className)}\n {...props}\n >\n {children}\n </div>\n);\n\ntype MessageActionProps = ComponentProps<typeof Button> & {\n tooltip?: string;\n label?: string;\n};\n\nconst MessageAction = ({\n tooltip,\n children,\n label,\n className,\n variant = 'ghost',\n size = 'sm',\n ...props\n}: MessageActionProps): ReactNode => {\n const button = (\n <Button\n data-slot=\"message-action\"\n className={cn(\n 'relative icon-sm text-muted-foreground hover:text-base-foreground',\n className\n )}\n size={size}\n type=\"button\"\n variant={variant}\n {...props}\n >\n {children}\n <span className=\"sr-only\">{label || tooltip}</span>\n </Button>\n );\n\n if (tooltip) {\n return (\n <Tooltip>\n <TooltipTrigger render={button} />\n <TooltipContent>\n <p>{tooltip}</p>\n </TooltipContent>\n </Tooltip>\n );\n }\n\n return button;\n};\n\ntype MessageBranchContextType = {\n currentBranch: number;\n totalBranches: number;\n goToPrevious: () => void;\n goToNext: () => void;\n branches: ReactElement[];\n setBranches: (branches: ReactElement[]) => void;\n};\n\nconst MessageBranchContext = createContext<MessageBranchContextType | null>(\n null\n);\n\nconst useMessageBranch = () => {\n const context = useContext(MessageBranchContext);\n\n if (!context) {\n throw new Error(\n 'MessageBranch components must be used within MessageBranch'\n );\n }\n\n return context;\n};\n\ntype MessageBranchProps = HTMLAttributes<HTMLDivElement> & {\n defaultBranch?: number;\n onBranchChange?: (branchIndex: number) => void;\n};\n\nconst MessageBranch = ({\n defaultBranch = 0,\n onBranchChange,\n className,\n ...props\n}: MessageBranchProps): ReactNode => {\n const [currentBranch, setCurrentBranch] = useState(defaultBranch);\n const [branches, setBranches] = useState<ReactElement[]>([]);\n\n const goToPrevious = useCallback(() => {\n setCurrentBranch((prev) => {\n const newBranch = prev > 0 ? prev - 1 : branches.length - 1;\n onBranchChange?.(newBranch);\n return newBranch;\n });\n }, [branches.length, onBranchChange]);\n\n const goToNext = useCallback(() => {\n setCurrentBranch((prev) => {\n const newBranch = prev < branches.length - 1 ? prev + 1 : 0;\n onBranchChange?.(newBranch);\n return newBranch;\n });\n }, [branches.length, onBranchChange]);\n\n const contextValue = useMemo<MessageBranchContextType>(\n () => ({\n currentBranch,\n totalBranches: branches.length,\n goToPrevious,\n goToNext,\n branches,\n setBranches,\n }),\n [currentBranch, branches, goToPrevious, goToNext, setBranches]\n );\n\n return (\n <MessageBranchContext.Provider value={contextValue}>\n <div\n data-slot=\"message-branch\"\n className={cn('grid w-full gap-2 [&>div]:pb-0', className)}\n {...props}\n />\n </MessageBranchContext.Provider>\n );\n};\n\ntype MessageBranchContentProps = HTMLAttributes<HTMLDivElement>;\n\nconst MessageBranchContent = ({\n children,\n ...props\n}: MessageBranchContentProps): ReactNode[] => {\n const { currentBranch, setBranches, branches } = useMessageBranch();\n const childrenArray = useMemo(\n () => (Array.isArray(children) ? children : [children]),\n [children]\n );\n\n useEffect(() => {\n if (branches.length !== childrenArray.length) {\n setBranches(childrenArray);\n }\n }, [childrenArray, branches, setBranches]);\n\n return childrenArray.map((branch, index) => (\n <div\n data-slot=\"message-branch-content\"\n className={cn(\n 'grid gap-2 overflow-hidden [&>div]:pb-0',\n index === currentBranch ? 'block' : 'hidden'\n )}\n key={branch.key}\n {...props}\n >\n {branch}\n </div>\n ));\n};\n\ntype MessageBranchSelectorProps = HTMLAttributes<HTMLDivElement> & {\n from: UIMessage['role'];\n};\n\nconst MessageBranchSelector = ({\n ...props\n}: MessageBranchSelectorProps): ReactNode => {\n const { totalBranches } = useMessageBranch();\n\n if (totalBranches <= 1) {\n return null;\n }\n\n return (\n <ButtonGroup\n data-slot=\"message-branch-selector\"\n className=\"[&>*:not(:first-child)]:rounded-l-md [&>*:not(:last-child)]:rounded-r-md\"\n orientation=\"horizontal\"\n {...props}\n />\n );\n};\n\ntype MessageBranchPreviousProps = ComponentProps<typeof Button>;\n\nconst MessageBranchPrevious = ({\n children,\n ...props\n}: MessageBranchPreviousProps): ReactNode => {\n const { goToPrevious, totalBranches } = useMessageBranch();\n\n return (\n <Button\n data-slot=\"message-branch-previous\"\n aria-label=\"Previous branch\"\n disabled={totalBranches <= 1}\n onClick={goToPrevious}\n size=\"icon-sm\"\n type=\"button\"\n variant=\"ghost\"\n {...props}\n >\n {children ?? <IconChevronLeft size={14} />}\n </Button>\n );\n};\n\ntype MessageBranchNextProps = ComponentProps<typeof Button>;\n\nconst MessageBranchNext = ({\n children,\n ...props\n}: MessageBranchNextProps): ReactNode => {\n const { goToNext, totalBranches } = useMessageBranch();\n\n return (\n <Button\n data-slot=\"message-branch-next\"\n aria-label=\"Next branch\"\n disabled={totalBranches <= 1}\n onClick={goToNext}\n size=\"icon-sm\"\n type=\"button\"\n variant=\"ghost\"\n {...props}\n >\n {children ?? <IconChevronRight size={14} />}\n </Button>\n );\n};\n\ntype MessageBranchPageProps = HTMLAttributes<HTMLSpanElement>;\n\nconst MessageBranchPage = ({\n className,\n ...props\n}: MessageBranchPageProps): ReactNode => {\n const { currentBranch, totalBranches } = useMessageBranch();\n\n return (\n <ButtonGroupText\n data-slot=\"message-branch-page\"\n className={cn(\n 'border-none bg-transparent text-muted-foreground shadow-none px-2',\n className\n )}\n {...props}\n >\n {currentBranch + 1}/{totalBranches}\n </ButtonGroupText>\n );\n};\n\n/** Streamdown discards unrecognised props, so these go on a wrapper instead. */\ntype MessageResponseHostProps = Pick<\n HTMLAttributes<HTMLDivElement>,\n 'id' | 'role' | 'aria-label' | 'aria-labelledby' | 'aria-describedby'\n> & {\n 'data-testid'?: string;\n};\n\ntype MessageResponseProps = ComponentProps<typeof Streamdown> &\n MessageResponseHostProps;\n\ntype MarkdownComponentProps<T extends keyof JSX.IntrinsicElements> =\n JSX.IntrinsicElements[T] & ExtraProps;\n\nconst messageResponseComponents: Components = {\n h1: ({ children }: MarkdownComponentProps<'h1'>) => (\n <h1 className=\"mt-0 mb-2 scroll-m-20 text-xl font-medium tracking-tightest\">\n {children}\n </h1>\n ),\n h2: ({ children }: MarkdownComponentProps<'h2'>) => (\n <h2 className=\"mt-4 mb-1 scroll-m-20 text-lg font-medium tracking-tightest\">\n {children}\n </h2>\n ),\n h3: ({ children }: MarkdownComponentProps<'h3'>) => (\n <h3 className=\"mt-4 mb-1 scroll-m-20 text-base font-medium tracking-tighter\">\n {children}\n </h3>\n ),\n h4: ({ children }: MarkdownComponentProps<'h4'>) => (\n <h4 className=\"mt-2 mb-0 scroll-m-20 text-sm font-medium tracking-normal\">\n {children}\n </h4>\n ),\n h5: ({ children }: MarkdownComponentProps<'h5'>) => (\n <h5 className=\"mt-0 mb-0 scroll-m-20 text-xs font-medium tracking-tighter\">\n {children}\n </h5>\n ),\n h6: ({ children }: MarkdownComponentProps<'h6'>) => (\n <h6 className=\"mt-0 mb-0 scroll-m-20 text-2xs font-medium tracking-tighter\">\n {children}\n </h6>\n ),\n p: ({ children }: MarkdownComponentProps<'p'>) => (\n <p className=\"mt-2 mb-3 text-base font-normal leading-5 tracking-tightest\">\n {children}\n </p>\n ),\n strong: ({ children }: MarkdownComponentProps<'strong'>) => (\n <strong className=\"font-medium\">{children}</strong>\n ),\n em: ({ children }: MarkdownComponentProps<'em'>) => (\n <em className=\"italic\">{children}</em>\n ),\n b: ({ children }: MarkdownComponentProps<'b'>) => (\n <b className=\"font-medium\">{children}</b>\n ),\n i: ({ children }: MarkdownComponentProps<'i'>) => (\n <i className=\"italic\">{children}</i>\n ),\n ul: ({ children }: MarkdownComponentProps<'ul'>) => (\n <ul className=\"ml-8.25 mb-3 pt-2 pl-0 pb-0 list-disc text-base font-normal tracking-tightest\">\n {children}\n </ul>\n ),\n ol: ({ children }: MarkdownComponentProps<'ol'>) => (\n <ol className=\"ml-8.25 mb-3 pt-2 pl-0 pb-0 list-decimal text-base font-normal tracking-tightest\">\n {children}\n </ol>\n ),\n li: ({ children }: MarkdownComponentProps<'li'>) => (\n <li className=\"py-0\">{children}</li>\n ),\n blockquote: ({ children }: MarkdownComponentProps<'blockquote'>) => (\n <blockquote className=\"my-3 pr-2 pl-2 border-l border-l-default text-sm text-muted-foreground font-normal tracking-tight not-italic\">\n {children}\n </blockquote>\n ),\n hr: () => <hr className=\"my-4 border-default\" />,\n a: ({ children, href, ...props }: MarkdownComponentProps<'a'>) => (\n <a\n className=\"text-link-foreground no-underline hover:underline underline-offset-4\"\n href={href}\n {...props}\n >\n {children}\n </a>\n ),\n table: ({ children }: MarkdownComponentProps<'table'>) => (\n <div\n className=\"my-6 overflow-x-auto\"\n tabIndex={0}\n role=\"group\"\n aria-label=\"Atlas AI Chat Table\"\n >\n <table className=\"w-full\">{children}</table>\n </div>\n ),\n thead: ({ children }: MarkdownComponentProps<'thead'>) => (\n <thead>{children}</thead>\n ),\n tbody: ({ children }: MarkdownComponentProps<'tbody'>) => (\n <tbody>{children}</tbody>\n ),\n tr: ({ children }: MarkdownComponentProps<'tr'>) => (\n <tr className=\"m-0 border-t p-0 even:bg-muted-background\">{children}</tr>\n ),\n th: ({ children }: MarkdownComponentProps<'th'>) => (\n <th className=\"border px-4 py-2 text-left font-bold\">{children}</th>\n ),\n td: ({ children }: MarkdownComponentProps<'td'>) => (\n <td className=\"border px-4 py-2 text-left\">{children}</td>\n ),\n};\n\nconst MessageResponseMarkdown = ({\n className,\n components,\n plugins,\n controls,\n portal,\n ...props\n}: ComponentProps<typeof Streamdown>): JSX.Element => {\n const portalContainer = usePortalContainer();\n\n return (\n <Streamdown\n className={cn(\n 'size-full',\n // Blockquote paragraph overrides\n '[&_blockquote_p]:text-sm',\n '[&_blockquote_p]:tracking-tight',\n // Inline code\n '[&_code]:relative',\n '[&_code]:rounded',\n '[&_code]:bg-muted-background',\n '[&_code]:px-[0.3rem]',\n '[&_code]:py-[0.2rem]',\n '[&_code]:font-mono',\n '[&_code]:text-sm',\n '[&_code]:font-semibold',\n // Code blocks (Streamdown container)\n '[&_div[data-streamdown=\"code-block\"]]:my-4',\n '[&_div[data-streamdown=\"code-block\"]]:w-full',\n '[&_div[data-streamdown=\"code-block\"]]:overflow-hidden',\n '[&_div[data-streamdown=\"code-block\"]]:rounded-xl',\n '[&_div[data-streamdown=\"code-block\"]]:border',\n '[&_div[data-streamdown=\"code-block\"]]:border-default',\n // Code block header\n '[&_div[data-streamdown=\"code-block-header\"]]:flex',\n '[&_div[data-streamdown=\"code-block-header\"]]:items-center',\n '[&_div[data-streamdown=\"code-block-header\"]]:justify-between',\n '[&_div[data-streamdown=\"code-block-header\"]]:bg-muted-background/80',\n '[&_div[data-streamdown=\"code-block-header\"]]:px-4',\n '[&_div[data-streamdown=\"code-block-header\"]]:py-3',\n '[&_div[data-streamdown=\"code-block-header\"]]:text-xs',\n '[&_div[data-streamdown=\"code-block-header\"]]:text-muted-foreground',\n // Pre element inside code block\n '[&_div[data-streamdown=\"code-block\"]_pre]:m-0',\n '[&_div[data-streamdown=\"code-block\"]_pre]:overflow-x-auto',\n '[&_div[data-streamdown=\"code-block\"]_pre]:border-t',\n '[&_div[data-streamdown=\"code-block\"]_pre]:border-default',\n '[&_div[data-streamdown=\"code-block\"]_pre]:bg-card-background!',\n '[&_div[data-streamdown=\"code-block\"]_pre]:p-4',\n '[&_div[data-streamdown=\"code-block\"]_pre]:text-sm',\n '[&_div[data-streamdown=\"code-block\"]_pre]:text-medium-foreground!',\n // Code element inside pre\n '[&_div[data-streamdown=\"code-block\"]_pre_code]:static',\n '[&_div[data-streamdown=\"code-block\"]_pre_code]:rounded-none',\n '[&_div[data-streamdown=\"code-block\"]_pre_code]:bg-transparent',\n '[&_div[data-streamdown=\"code-block\"]_pre_code]:p-0',\n '[&_div[data-streamdown=\"code-block\"]_pre_code]:font-mono',\n '[&_div[data-streamdown=\"code-block\"]_pre_code]:text-sm',\n '[&_div[data-streamdown=\"code-block\"]_pre_code]:font-normal',\n // Code block buttons\n '[&_button[data-streamdown=\"code-block-copy-button\"]]:cursor-pointer',\n '[&_button[data-streamdown=\"code-block-copy-button\"]]:p-1',\n '[&_button[data-streamdown=\"code-block-copy-button\"]]:text-muted-foreground',\n '[&_button[data-streamdown=\"code-block-copy-button\"]]:transition-all',\n '[&_button[data-streamdown=\"code-block-copy-button\"]]:hover:text-base-foreground',\n '[&_button[data-streamdown=\"code-block-download-button\"]]:cursor-pointer',\n '[&_button[data-streamdown=\"code-block-download-button\"]]:p-1',\n '[&_button[data-streamdown=\"code-block-download-button\"]]:text-muted-foreground',\n '[&_button[data-streamdown=\"code-block-download-button\"]]:transition-all',\n '[&_button[data-streamdown=\"code-block-download-button\"]]:hover:text-base-foreground',\n // Regular pre blocks (not in Streamdown code blocks)\n '[&_pre:not([data-streamdown])]:my-3',\n '[&_pre:not([data-streamdown])]:mx-0',\n '[&_pre:not([data-streamdown])]:overflow-x-auto',\n '[&_pre:not([data-streamdown])]:rounded-md',\n '[&_pre:not([data-streamdown])]:border',\n '[&_pre:not([data-streamdown])]:bg-card-background',\n '[&_pre:not([data-streamdown])]:p-4',\n '[&_pre:not([data-streamdown])]:text-medium-foreground',\n '[&_pre:not([data-streamdown])]:text-sm',\n '[&_pre:not([data-streamdown])_code]:static',\n '[&_pre:not([data-streamdown])_code]:rounded-none',\n '[&_pre:not([data-streamdown])_code]:bg-transparent',\n '[&_pre:not([data-streamdown])_code]:px-0',\n '[&_pre:not([data-streamdown])_code]:py-0',\n '[&_pre:not([data-streamdown])_code]:font-mono',\n '[&_pre:not([data-streamdown])_code]:text-sm',\n '[&_pre:not([data-streamdown])_code]:font-normal',\n // Mermaid diagram blocks\n '[&_div[data-streamdown=\"mermaid-block\"]]:bg-card-background',\n '[&_div[data-streamdown=\"mermaid-block\"]]:text-base-foreground',\n '[&_div[data-streamdown=\"mermaid-block\"]]:flex',\n '[&_div[data-streamdown=\"mermaid-block\"]]:flex-col',\n '[&_div[data-streamdown=\"mermaid-block\"]]:rounded-lg',\n '[&_div[data-streamdown=\"mermaid-block\"]]:hover:bg-base-background-hover',\n '[&_div[data-streamdown=\"mermaid-block\"]]:border-0',\n // Positioning context for the action strip (see below)\n '[&_div[data-streamdown=\"mermaid-block\"]]:relative',\n // Nested scroll + sticky + pointer-events breaks hit-testing on Mermaid Copy/Download\n // (same class of issue as github.com/vercel/streamdown/issues/494). Force absolute strip.\n '[&_div[data-streamdown=\"mermaid-block\"]>div:has([data-streamdown=\"mermaid-block-actions\"])]:!absolute',\n '[&_div[data-streamdown=\"mermaid-block\"]>div:has([data-streamdown=\"mermaid-block-actions\"])]:!top-2',\n '[&_div[data-streamdown=\"mermaid-block\"]>div:has([data-streamdown=\"mermaid-block-actions\"])]:!right-2',\n '[&_div[data-streamdown=\"mermaid-block\"]>div:has([data-streamdown=\"mermaid-block-actions\"])]:!z-10',\n '[&_div[data-streamdown=\"mermaid-block\"]>div:has([data-streamdown=\"mermaid-block-actions\"])]:!mt-0',\n '[&_div[data-streamdown=\"mermaid-block\"]>div:has([data-streamdown=\"mermaid-block-actions\"])]:!pointer-events-auto',\n // Ensure mermaid container is tall enough for the toolbar (pan/zoom + actions)\n '[&_div[data-streamdown=\"mermaid-block\"]_.relative.w-full]:!min-h-28',\n // KaTeX sizing (overflow rules live in styles.source.css)\n '[&_.katex-display]:my-3',\n '[&_.katex]:text-[1em]',\n // First and last child margin resets\n '[&>*:first-child]:mt-0',\n '[&>*:last-child]:mb-0',\n className\n )}\n components={{ ...messageResponseComponents, ...components }}\n controls={controls ?? MESSAGE_RESPONSE_DEFAULT_STREAMDOWN_CONTROLS}\n plugins={{ ...plugins, mermaid: mermaidPlugin }}\n portal={portal ?? portalContainer}\n {...props}\n />\n );\n};\n\n/**\n * Shares an explicit `portal` prop with components rendered inside the Markdown,\n * such as the expanded table view, so they portal into the same container as Streamdown.\n */\nconst MessageResponsePortalProvider = ({\n portal,\n children,\n}: Pick<MessageResponseProps, 'portal'> & {\n children: ReactNode;\n}): JSX.Element => {\n const portalContainer = usePortalContainer();\n const explicitPortalElement =\n typeof portal === 'function' ? (portal() ?? undefined) : portal;\n\n return (\n <PortalContainerContext.Provider\n value={explicitPortalElement ?? portalContainer}\n >\n {children}\n </PortalContainerContext.Provider>\n );\n};\n\nconst MessageResponse = ({\n id,\n role,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n 'data-testid': dataTestId,\n ...props\n}: MessageResponseProps): JSX.Element => (\n <div\n data-slot=\"message-response\"\n id={id}\n role={role}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n aria-describedby={ariaDescribedBy}\n data-testid={dataTestId}\n >\n <MessageResponsePortalProvider portal={props.portal}>\n <MessageResponseMarkdown {...props} />\n </MessageResponsePortalProvider>\n </div>\n);\n\ntype MessageAttachmentProps = HTMLAttributes<HTMLDivElement> & {\n data: FileUIPart;\n className?: string;\n onRemove?: () => void;\n};\n\nfunction MessageAttachment({\n data,\n className,\n onRemove,\n ...props\n}: MessageAttachmentProps): ReactNode {\n const filename = data.filename || '';\n const mediaType =\n data.mediaType?.startsWith('image/') && data.url ? 'image' : 'file';\n const isImage = mediaType === 'image';\n const attachmentLabel = filename || (isImage ? 'Image' : 'Attachment');\n\n return (\n <div\n data-slot=\"message-attachment\"\n className={cn(\n 'group relative size-24 overflow-hidden rounded-lg',\n className\n )}\n {...props}\n >\n {isImage ? (\n <>\n <img\n alt={filename || 'attachment'}\n className=\"size-full object-cover\"\n height={100}\n src={data.url}\n width={100}\n />\n {onRemove && (\n <Button\n aria-label=\"Remove attachment\"\n className=\"absolute top-2 right-2 size-6 rounded-full bg-card-background/80 p-0 opacity-0 backdrop-blur-sm transition-opacity hover:bg-card-background group-hover:opacity-100 [&>svg]:size-3\"\n onClick={(e) => {\n e.stopPropagation();\n onRemove();\n }}\n type=\"button\"\n variant=\"ghost\"\n >\n <IconX />\n <span className=\"sr-only\">Remove</span>\n </Button>\n )}\n </>\n ) : (\n <>\n <Tooltip>\n <TooltipTrigger\n render={\n <div className=\"flex size-full shrink-0 items-center justify-center rounded-lg bg-muted-background text-muted-foreground\">\n <IconPaperclip className=\"size-4\" />\n </div>\n }\n />\n <TooltipContent>\n <p>{attachmentLabel}</p>\n </TooltipContent>\n </Tooltip>\n {onRemove && (\n <Button\n aria-label=\"Remove attachment\"\n className=\"size-6 shrink-0 rounded-full p-0 opacity-0 transition-opacity hover:bg-base-background-hover group-hover:opacity-100 [&>svg]:size-3\"\n onClick={(e) => {\n e.stopPropagation();\n onRemove();\n }}\n type=\"button\"\n variant=\"ghost\"\n >\n <IconX />\n <span className=\"sr-only\">Remove</span>\n </Button>\n )}\n </>\n )}\n </div>\n );\n}\n\ntype MessageAttachmentsProps = ComponentProps<'div'>;\n\nfunction MessageAttachments({\n children,\n className,\n ...props\n}: MessageAttachmentsProps): ReactNode {\n if (!children) {\n return null;\n }\n\n return (\n <div\n data-slot=\"message-attachments\"\n className={cn(\n 'ml-auto flex w-fit flex-wrap items-start gap-2',\n className\n )}\n {...props}\n >\n {children}\n </div>\n );\n}\n\ntype MessageToolbarProps = ComponentProps<'div'>;\n\nconst MessageToolbar = ({\n className,\n children,\n ...props\n}: MessageToolbarProps): ReactNode => (\n <div\n data-slot=\"message-toolbar\"\n className={cn(\n 'mt-4 flex w-full items-center justify-between gap-4',\n className\n )}\n {...props}\n >\n {children}\n </div>\n);\n\nexport {\n Message,\n MessageAction,\n MessageActions,\n MessageAttachment,\n MessageAttachments,\n MessageAvatar,\n MessageAvatarIcon,\n MessageBranch,\n MessageBranchContent,\n MessageBranchNext,\n MessageBranchPage,\n MessageBranchPrevious,\n MessageBranchSelector,\n MessageContent,\n MessageResponse,\n MessageToolbar,\n};\n"],"names":["createContext","useCallback","useContext","useEffect","useMemo","useState","mermaid","mermaidPlugin","IconChevronLeft","IconChevronRight","IconPaperclip","IconX","Streamdown","PortalContainerContext","usePortalContainer","cn","getInitials","Avatar","AvatarFallback","AvatarIcon","AvatarImage","Button","ButtonGroup","ButtonGroupText","Tooltip","TooltipContent","TooltipTrigger","MESSAGE_RESPONSE_DEFAULT_STREAMDOWN_CONTROLS","Message","className","isResponse","props","div","data-slot","MessageContent","children","MessageAvatar","avatarUrl","name","variant","sizes","fallbackText","alt","src","MessageAvatarIcon","MessageActions","MessageAction","tooltip","label","size","button","type","span","render","p","MessageBranchContext","useMessageBranch","context","Error","MessageBranch","defaultBranch","onBranchChange","currentBranch","setCurrentBranch","branches","setBranches","goToPrevious","prev","newBranch","length","goToNext","contextValue","totalBranches","Provider","value","MessageBranchContent","childrenArray","Array","isArray","map","branch","index","key","MessageBranchSelector","orientation","MessageBranchPrevious","aria-label","disabled","onClick","MessageBranchNext","MessageBranchPage","messageResponseComponents","h1","h2","h3","h4","h5","h6","strong","em","b","i","ul","ol","li","blockquote","hr","a","href","table","tabIndex","role","thead","tbody","tr","th","td","MessageResponseMarkdown","components","plugins","controls","portal","portalContainer","MessageResponsePortalProvider","explicitPortalElement","undefined","MessageResponse","id","ariaLabel","ariaLabelledBy","ariaDescribedBy","dataTestId","aria-labelledby","aria-describedby","data-testid","MessageAttachment","data","onRemove","filename","mediaType","startsWith","url","isImage","attachmentLabel","img","height","width","e","stopPropagation","MessageAttachments","MessageToolbar"],"mappings":";AAMA,SACEA,aAAa,EACbC,WAAW,EACXC,UAAU,EACVC,SAAS,EACTC,OAAO,EACPC,QAAQ,QACH,QAAQ;AAEf,SAASC,WAAWC,aAAa,QAAQ,sBAAsB;AAC/D,SACEC,eAAe,EACfC,gBAAgB,EAChBC,aAAa,EACbC,KAAK,QACA,sBAAsB;AAG7B,SAASC,UAAU,QAAQ,aAAa;AAGxC,SACEC,sBAAsB,EACtBC,kBAAkB,QACb,2CAA2C;AAClD,SAASC,EAAE,EAAEC,WAAW,QAAQ,wBAAwB;AACxD,SACEC,MAAM,EACNC,cAAc,EACdC,UAAU,EACVC,WAAW,QACN,mBAAmB;AAC1B,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASC,WAAW,EAAEC,eAAe,QAAQ,+BAA+B;AAC5E,SAASC,OAAO,EAAEC,cAAc,EAAEC,cAAc,QAAQ,qBAAqB;AAE7E,SAASC,4CAA4C,QAAQ,oDAAiD;AAM9G,MAAMC,UAAU,CAAC,EACfC,SAAS,EACTC,aAAa,KAAK,EAClB,GAAGC,OACU,iBACb,KAACC;QACCC,aAAU;QACVJ,WAAWd,GACT,+DACAe,aAAa,6BAA6B,4BAC1CD;QAED,GAAGE,KAAK;;AAMb,MAAMG,iBAAiB,CAAC,EACtBC,QAAQ,EACRN,SAAS,EACT,GAAGE,OACiB,iBACpB,KAACC;QACCC,aAAU;QACVJ,WAAWd,GACT,yFACA,aACA,8JAA8J;QAC9J,wCACA,qIACA,yEACAc;QAED,GAAGE,KAAK;kBAERI;;AASL,MAAMC,g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QACb,OAAO;IACT;IAEA,qBACE,KAACH;QACCC,aAAU;QACVJ,WAAWd,GACT,kDACAc;QAED,GAAGE,KAAK;kBAERI;;AAGP;AAIA,MAAMmH,iBAAiB,CAAC,EACtBzH,SAAS,EACTM,QAAQ,EACR,GAAGJ,OACiB,iBACpB,KAACC;QACCC,aAAU;QACVJ,WAAWd,GACT,uDACAc;QAED,GAAGE,KAAK;kBAERI;;AAIL,SACEP,OAAO,EACPkB,aAAa,EACbD,cAAc,EACd0F,iBAAiB,EACjBc,kBAAkB,EAClBjH,aAAa,EACbQ,iBAAiB,EACjBe,aAAa,EACbgB,oBAAoB,EACpBc,iBAAiB,EACjBC,iBAAiB,EACjBL,qBAAqB,EACrBF,qBAAqB,EACrBjD,cAAc,EACd4F,eAAe,EACfwB,cAAc,GACd"}
1
+ {"version":3,"sources":["../../../../../src/components/ui/core/message/message.tsx"],"sourcesContent":["import type {\n ComponentProps,\n HTMLAttributes,\n ReactElement,\n ReactNode,\n} from 'react';\nimport {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useState,\n} from 'react';\n\nimport { mermaid as mermaidPlugin } from '@streamdown/mermaid';\nimport {\n IconChevronLeft,\n IconChevronRight,\n IconPaperclip,\n IconX,\n} from '@tabler/icons-react';\nimport type { JSX } from 'react/jsx-runtime';\nimport type { Components, ExtraProps } from 'streamdown';\nimport { Streamdown } from 'streamdown';\n\nimport type { FileUIPart, UIMessage } from '../../../../lib/ai/types';\nimport {\n PortalContainerContext,\n usePortalContainer,\n} from '../../../../lib/portal-container-context';\nimport { cn, getInitials } from '../../../../lib/utils';\nimport {\n Avatar,\n AvatarFallback,\n AvatarIcon,\n AvatarImage,\n} from '../avatar/avatar';\nimport { Button } from '../button/button';\nimport { ButtonGroup, ButtonGroupText } from '../button-group/button-group';\nimport { Tooltip, TooltipContent, TooltipTrigger } from '../tooltip/tooltip';\n\nimport { MESSAGE_RESPONSE_DEFAULT_STREAMDOWN_CONTROLS } from './message-response-default-streamdown-controls';\n\ntype MessageProps = HTMLAttributes<HTMLDivElement> & {\n isResponse?: boolean;\n};\n\nconst Message = ({\n className,\n isResponse = false,\n ...props\n}: MessageProps): ReactNode => (\n <div\n data-slot=\"message\"\n className={cn(\n 'group flex w-full items-start justify-start gap-3 mb-0 py-3',\n isResponse ? 'is-assistant items-start' : 'is-user flex-row-reverse',\n className\n )}\n {...props}\n />\n);\n\ntype MessageContentProps = HTMLAttributes<HTMLDivElement>;\n\nconst MessageContent = ({\n children,\n className,\n ...props\n}: MessageContentProps): ReactNode => (\n <div\n data-slot=\"message-content\"\n className={cn(\n 'is-user:dark flex flex-col gap-4 rounded-md text-base leading-tight tracking-tightest',\n 'max-w-4/5',\n // The table grid's rows are absolutely positioned, so they don't widen the content; give tables the full width rather than wrapping cells to fit the headers.\n 'has-data-[slot=message-table]:w-full',\n 'group-[.is-user]:overflow-hidden group-[.is-user]:bg-medium-background group-[.is-user]:p-2 group-[.is-user]:text-base-foreground',\n 'group-[.is-assistant]:text-base-foreground group-[.is-assistant]:pt-1',\n className\n )}\n {...props}\n >\n {children}\n </div>\n);\n\ntype MessageAvatarProps = ComponentProps<typeof Avatar> & {\n avatarUrl?: string;\n name?: string;\n};\n\nconst MessageAvatar = ({\n avatarUrl,\n name,\n className,\n children,\n variant,\n sizes,\n ...props\n}: MessageAvatarProps): ReactNode => {\n const fallbackText = name ? getInitials(name) : 'ME';\n\n return (\n <Avatar\n data-slot=\"message-avatar\"\n className={cn('size-7 group-[.is-user]:mt-1', className)}\n variant={variant}\n sizes={sizes}\n {...props}\n >\n {children || (\n <>\n {avatarUrl && (\n <AvatarImage\n alt={name || ''}\n className=\"mt-0 mb-0\"\n src={avatarUrl}\n />\n )}\n <AvatarFallback>{fallbackText}</AvatarFallback>\n </>\n )}\n </Avatar>\n );\n};\n\ntype MessageAvatarIconProps = ComponentProps<typeof AvatarIcon>;\n\nconst MessageAvatarIcon = (props: MessageAvatarIconProps): ReactNode => (\n <AvatarIcon data-slot=\"message-avatar-icon\" {...props} />\n);\n\ntype MessageActionsProps = ComponentProps<'div'>;\n\nconst MessageActions = ({\n className,\n children,\n ...props\n}: MessageActionsProps): ReactNode => (\n <div\n data-slot=\"message-actions\"\n className={cn('flex items-center gap-2 pt-2', className)}\n {...props}\n >\n {children}\n </div>\n);\n\ntype MessageActionProps = ComponentProps<typeof Button> & {\n tooltip?: string;\n label?: string;\n};\n\nconst MessageAction = ({\n tooltip,\n children,\n label,\n className,\n variant = 'ghost',\n size = 'sm',\n ...props\n}: MessageActionProps): ReactNode => {\n const button = (\n <Button\n data-slot=\"message-action\"\n className={cn(\n 'relative icon-sm text-muted-foreground hover:text-base-foreground',\n className\n )}\n size={size}\n type=\"button\"\n variant={variant}\n {...props}\n >\n {children}\n <span className=\"sr-only\">{label || tooltip}</span>\n </Button>\n );\n\n if (tooltip) {\n return (\n <Tooltip>\n <TooltipTrigger render={button} />\n <TooltipContent>\n <p>{tooltip}</p>\n </TooltipContent>\n </Tooltip>\n );\n }\n\n return button;\n};\n\ntype MessageBranchContextType = {\n currentBranch: number;\n totalBranches: number;\n goToPrevious: () => void;\n goToNext: () => void;\n branches: ReactElement[];\n setBranches: (branches: ReactElement[]) => void;\n};\n\nconst MessageBranchContext = createContext<MessageBranchContextType | null>(\n null\n);\n\nconst useMessageBranch = () => {\n const context = useContext(MessageBranchContext);\n\n if (!context) {\n throw new Error(\n 'MessageBranch components must be used within MessageBranch'\n );\n }\n\n return context;\n};\n\ntype MessageBranchProps = HTMLAttributes<HTMLDivElement> & {\n defaultBranch?: number;\n onBranchChange?: (branchIndex: number) => void;\n};\n\nconst MessageBranch = ({\n defaultBranch = 0,\n onBranchChange,\n className,\n ...props\n}: MessageBranchProps): ReactNode => {\n const [currentBranch, setCurrentBranch] = useState(defaultBranch);\n const [branches, setBranches] = useState<ReactElement[]>([]);\n\n const goToPrevious = useCallback(() => {\n setCurrentBranch((prev) => {\n const newBranch = prev > 0 ? prev - 1 : branches.length - 1;\n onBranchChange?.(newBranch);\n return newBranch;\n });\n }, [branches.length, onBranchChange]);\n\n const goToNext = useCallback(() => {\n setCurrentBranch((prev) => {\n const newBranch = prev < branches.length - 1 ? prev + 1 : 0;\n onBranchChange?.(newBranch);\n return newBranch;\n });\n }, [branches.length, onBranchChange]);\n\n const contextValue = useMemo<MessageBranchContextType>(\n () => ({\n currentBranch,\n totalBranches: branches.length,\n goToPrevious,\n goToNext,\n branches,\n setBranches,\n }),\n [currentBranch, branches, goToPrevious, goToNext, setBranches]\n );\n\n return (\n <MessageBranchContext.Provider value={contextValue}>\n <div\n data-slot=\"message-branch\"\n className={cn('grid w-full gap-2 [&>div]:pb-0', className)}\n {...props}\n />\n </MessageBranchContext.Provider>\n );\n};\n\ntype MessageBranchContentProps = HTMLAttributes<HTMLDivElement>;\n\nconst MessageBranchContent = ({\n children,\n ...props\n}: MessageBranchContentProps): ReactNode[] => {\n const { currentBranch, setBranches, branches } = useMessageBranch();\n const childrenArray = useMemo(\n () => (Array.isArray(children) ? children : [children]),\n [children]\n );\n\n useEffect(() => {\n if (branches.length !== childrenArray.length) {\n setBranches(childrenArray);\n }\n }, [childrenArray, branches, setBranches]);\n\n return childrenArray.map((branch, index) => (\n <div\n data-slot=\"message-branch-content\"\n className={cn(\n 'grid gap-2 overflow-hidden [&>div]:pb-0',\n index === currentBranch ? 'block' : 'hidden'\n )}\n key={branch.key}\n {...props}\n >\n {branch}\n </div>\n ));\n};\n\ntype MessageBranchSelectorProps = HTMLAttributes<HTMLDivElement> & {\n from: UIMessage['role'];\n};\n\nconst MessageBranchSelector = ({\n ...props\n}: MessageBranchSelectorProps): ReactNode => {\n const { totalBranches } = useMessageBranch();\n\n if (totalBranches <= 1) {\n return null;\n }\n\n return (\n <ButtonGroup\n data-slot=\"message-branch-selector\"\n className=\"[&>*:not(:first-child)]:rounded-l-md [&>*:not(:last-child)]:rounded-r-md\"\n orientation=\"horizontal\"\n {...props}\n />\n );\n};\n\ntype MessageBranchPreviousProps = ComponentProps<typeof Button>;\n\nconst MessageBranchPrevious = ({\n children,\n ...props\n}: MessageBranchPreviousProps): ReactNode => {\n const { goToPrevious, totalBranches } = useMessageBranch();\n\n return (\n <Button\n data-slot=\"message-branch-previous\"\n aria-label=\"Previous branch\"\n disabled={totalBranches <= 1}\n onClick={goToPrevious}\n size=\"icon-sm\"\n type=\"button\"\n variant=\"ghost\"\n {...props}\n >\n {children ?? <IconChevronLeft size={14} />}\n </Button>\n );\n};\n\ntype MessageBranchNextProps = ComponentProps<typeof Button>;\n\nconst MessageBranchNext = ({\n children,\n ...props\n}: MessageBranchNextProps): ReactNode => {\n const { goToNext, totalBranches } = useMessageBranch();\n\n return (\n <Button\n data-slot=\"message-branch-next\"\n aria-label=\"Next branch\"\n disabled={totalBranches <= 1}\n onClick={goToNext}\n size=\"icon-sm\"\n type=\"button\"\n variant=\"ghost\"\n {...props}\n >\n {children ?? <IconChevronRight size={14} />}\n </Button>\n );\n};\n\ntype MessageBranchPageProps = HTMLAttributes<HTMLSpanElement>;\n\nconst MessageBranchPage = ({\n className,\n ...props\n}: MessageBranchPageProps): ReactNode => {\n const { currentBranch, totalBranches } = useMessageBranch();\n\n return (\n <ButtonGroupText\n data-slot=\"message-branch-page\"\n className={cn(\n 'border-none bg-transparent text-muted-foreground shadow-none px-2',\n className\n )}\n {...props}\n >\n {currentBranch + 1}/{totalBranches}\n </ButtonGroupText>\n );\n};\n\n/** Streamdown discards unrecognised props, so these go on a wrapper instead. */\ntype MessageResponseHostProps = Pick<\n HTMLAttributes<HTMLDivElement>,\n 'id' | 'role' | 'aria-label' | 'aria-labelledby' | 'aria-describedby'\n> & {\n 'data-testid'?: string;\n};\n\ntype MessageResponseProps = ComponentProps<typeof Streamdown> &\n MessageResponseHostProps;\n\ntype MarkdownComponentProps<T extends keyof JSX.IntrinsicElements> =\n JSX.IntrinsicElements[T] & ExtraProps;\n\nconst messageResponseComponents: Components = {\n h1: ({ children }: MarkdownComponentProps<'h1'>) => (\n <h1 className=\"mt-0 mb-2 scroll-m-20 text-xl font-medium tracking-tightest\">\n {children}\n </h1>\n ),\n h2: ({ children }: MarkdownComponentProps<'h2'>) => (\n <h2 className=\"mt-4 mb-1 scroll-m-20 text-lg font-medium tracking-tightest\">\n {children}\n </h2>\n ),\n h3: ({ children }: MarkdownComponentProps<'h3'>) => (\n <h3 className=\"mt-4 mb-1 scroll-m-20 text-base font-medium tracking-tighter\">\n {children}\n </h3>\n ),\n h4: ({ children }: MarkdownComponentProps<'h4'>) => (\n <h4 className=\"mt-2 mb-0 scroll-m-20 text-sm font-medium tracking-normal\">\n {children}\n </h4>\n ),\n h5: ({ children }: MarkdownComponentProps<'h5'>) => (\n <h5 className=\"mt-0 mb-0 scroll-m-20 text-xs font-medium tracking-tighter\">\n {children}\n </h5>\n ),\n h6: ({ children }: MarkdownComponentProps<'h6'>) => (\n <h6 className=\"mt-0 mb-0 scroll-m-20 text-2xs font-medium tracking-tighter\">\n {children}\n </h6>\n ),\n p: ({ children }: MarkdownComponentProps<'p'>) => (\n <p className=\"mt-2 mb-3 text-base font-normal leading-5 tracking-tightest\">\n {children}\n </p>\n ),\n strong: ({ children }: MarkdownComponentProps<'strong'>) => (\n <strong className=\"font-medium\">{children}</strong>\n ),\n em: ({ children }: MarkdownComponentProps<'em'>) => (\n <em className=\"italic\">{children}</em>\n ),\n b: ({ children }: MarkdownComponentProps<'b'>) => (\n <b className=\"font-medium\">{children}</b>\n ),\n i: ({ children }: MarkdownComponentProps<'i'>) => (\n <i className=\"italic\">{children}</i>\n ),\n ul: ({ children }: MarkdownComponentProps<'ul'>) => (\n <ul className=\"ml-8.25 mb-3 pt-2 pl-0 pb-0 list-disc text-base font-normal tracking-tightest\">\n {children}\n </ul>\n ),\n ol: ({ children }: MarkdownComponentProps<'ol'>) => (\n <ol className=\"ml-8.25 mb-3 pt-2 pl-0 pb-0 list-decimal text-base font-normal tracking-tightest\">\n {children}\n </ol>\n ),\n li: ({ children }: MarkdownComponentProps<'li'>) => (\n <li className=\"py-0\">{children}</li>\n ),\n blockquote: ({ children }: MarkdownComponentProps<'blockquote'>) => (\n <blockquote className=\"my-3 pr-2 pl-2 border-l border-l-default text-sm text-muted-foreground font-normal tracking-tight not-italic\">\n {children}\n </blockquote>\n ),\n hr: () => <hr className=\"my-4 border-default\" />,\n a: ({ children, href, ...props }: MarkdownComponentProps<'a'>) => (\n <a\n className=\"text-link-foreground no-underline hover:underline underline-offset-4\"\n href={href}\n {...props}\n >\n {children}\n </a>\n ),\n table: ({ children }: MarkdownComponentProps<'table'>) => (\n <div\n className=\"my-6 overflow-x-auto\"\n tabIndex={0}\n role=\"group\"\n aria-label=\"Atlas AI Chat Table\"\n >\n <table className=\"w-full\">{children}</table>\n </div>\n ),\n thead: ({ children }: MarkdownComponentProps<'thead'>) => (\n <thead>{children}</thead>\n ),\n tbody: ({ children }: MarkdownComponentProps<'tbody'>) => (\n <tbody>{children}</tbody>\n ),\n tr: ({ children }: MarkdownComponentProps<'tr'>) => (\n <tr className=\"m-0 border-t p-0 even:bg-muted-background\">{children}</tr>\n ),\n th: ({ children }: MarkdownComponentProps<'th'>) => (\n <th className=\"border px-4 py-2 text-left font-bold\">{children}</th>\n ),\n td: ({ children }: MarkdownComponentProps<'td'>) => (\n <td className=\"border px-4 py-2 text-left\">{children}</td>\n ),\n};\n\nconst MessageResponseMarkdown = ({\n className,\n components,\n plugins,\n controls,\n portal,\n ...props\n}: ComponentProps<typeof Streamdown>): JSX.Element => {\n const portalContainer = usePortalContainer();\n\n return (\n <Streamdown\n className={cn(\n 'size-full',\n // Blockquote paragraph overrides\n '[&_blockquote_p]:text-sm',\n '[&_blockquote_p]:tracking-tight',\n // Inline code\n '[&_code]:relative',\n '[&_code]:rounded',\n '[&_code]:bg-muted-background',\n '[&_code]:px-[0.3rem]',\n '[&_code]:py-[0.2rem]',\n '[&_code]:font-mono',\n '[&_code]:text-sm',\n '[&_code]:font-semibold',\n // Code blocks (Streamdown container)\n '[&_div[data-streamdown=\"code-block\"]]:my-4',\n '[&_div[data-streamdown=\"code-block\"]]:w-full',\n '[&_div[data-streamdown=\"code-block\"]]:overflow-hidden',\n '[&_div[data-streamdown=\"code-block\"]]:rounded-xl',\n '[&_div[data-streamdown=\"code-block\"]]:border',\n '[&_div[data-streamdown=\"code-block\"]]:border-default',\n // Code block header\n '[&_div[data-streamdown=\"code-block-header\"]]:flex',\n '[&_div[data-streamdown=\"code-block-header\"]]:items-center',\n '[&_div[data-streamdown=\"code-block-header\"]]:justify-between',\n '[&_div[data-streamdown=\"code-block-header\"]]:bg-muted-background/80',\n '[&_div[data-streamdown=\"code-block-header\"]]:px-4',\n '[&_div[data-streamdown=\"code-block-header\"]]:py-3',\n '[&_div[data-streamdown=\"code-block-header\"]]:text-xs',\n '[&_div[data-streamdown=\"code-block-header\"]]:text-muted-foreground',\n // Pre element inside code block\n '[&_div[data-streamdown=\"code-block\"]_pre]:m-0',\n '[&_div[data-streamdown=\"code-block\"]_pre]:overflow-x-auto',\n '[&_div[data-streamdown=\"code-block\"]_pre]:border-t',\n '[&_div[data-streamdown=\"code-block\"]_pre]:border-default',\n '[&_div[data-streamdown=\"code-block\"]_pre]:bg-card-background!',\n '[&_div[data-streamdown=\"code-block\"]_pre]:p-4',\n '[&_div[data-streamdown=\"code-block\"]_pre]:text-sm',\n '[&_div[data-streamdown=\"code-block\"]_pre]:text-medium-foreground!',\n // Code element inside pre\n '[&_div[data-streamdown=\"code-block\"]_pre_code]:static',\n '[&_div[data-streamdown=\"code-block\"]_pre_code]:rounded-none',\n '[&_div[data-streamdown=\"code-block\"]_pre_code]:bg-transparent',\n '[&_div[data-streamdown=\"code-block\"]_pre_code]:p-0',\n '[&_div[data-streamdown=\"code-block\"]_pre_code]:font-mono',\n '[&_div[data-streamdown=\"code-block\"]_pre_code]:text-sm',\n '[&_div[data-streamdown=\"code-block\"]_pre_code]:font-normal',\n // Code block buttons\n '[&_button[data-streamdown=\"code-block-copy-button\"]]:cursor-pointer',\n '[&_button[data-streamdown=\"code-block-copy-button\"]]:p-1',\n '[&_button[data-streamdown=\"code-block-copy-button\"]]:text-muted-foreground',\n '[&_button[data-streamdown=\"code-block-copy-button\"]]:transition-all',\n '[&_button[data-streamdown=\"code-block-copy-button\"]]:hover:text-base-foreground',\n '[&_button[data-streamdown=\"code-block-download-button\"]]:cursor-pointer',\n '[&_button[data-streamdown=\"code-block-download-button\"]]:p-1',\n '[&_button[data-streamdown=\"code-block-download-button\"]]:text-muted-foreground',\n '[&_button[data-streamdown=\"code-block-download-button\"]]:transition-all',\n '[&_button[data-streamdown=\"code-block-download-button\"]]:hover:text-base-foreground',\n // Regular pre blocks (not in Streamdown code blocks)\n '[&_pre:not([data-streamdown])]:my-3',\n '[&_pre:not([data-streamdown])]:mx-0',\n '[&_pre:not([data-streamdown])]:overflow-x-auto',\n '[&_pre:not([data-streamdown])]:rounded-md',\n '[&_pre:not([data-streamdown])]:border',\n '[&_pre:not([data-streamdown])]:bg-card-background',\n '[&_pre:not([data-streamdown])]:p-4',\n '[&_pre:not([data-streamdown])]:text-medium-foreground',\n '[&_pre:not([data-streamdown])]:text-sm',\n '[&_pre:not([data-streamdown])_code]:static',\n '[&_pre:not([data-streamdown])_code]:rounded-none',\n '[&_pre:not([data-streamdown])_code]:bg-transparent',\n '[&_pre:not([data-streamdown])_code]:px-0',\n '[&_pre:not([data-streamdown])_code]:py-0',\n '[&_pre:not([data-streamdown])_code]:font-mono',\n '[&_pre:not([data-streamdown])_code]:text-sm',\n '[&_pre:not([data-streamdown])_code]:font-normal',\n // Mermaid diagram blocks\n '[&_div[data-streamdown=\"mermaid-block\"]]:bg-card-background',\n '[&_div[data-streamdown=\"mermaid-block\"]]:text-base-foreground',\n '[&_div[data-streamdown=\"mermaid-block\"]]:flex',\n '[&_div[data-streamdown=\"mermaid-block\"]]:flex-col',\n '[&_div[data-streamdown=\"mermaid-block\"]]:rounded-lg',\n '[&_div[data-streamdown=\"mermaid-block\"]]:hover:bg-base-background-hover',\n '[&_div[data-streamdown=\"mermaid-block\"]]:border-0',\n // Positioning context for the action strip (see below)\n '[&_div[data-streamdown=\"mermaid-block\"]]:relative',\n // Nested scroll + sticky + pointer-events breaks hit-testing on Mermaid Copy/Download\n // (same class of issue as github.com/vercel/streamdown/issues/494). Force absolute strip.\n '[&_div[data-streamdown=\"mermaid-block\"]>div:has([data-streamdown=\"mermaid-block-actions\"])]:!absolute',\n '[&_div[data-streamdown=\"mermaid-block\"]>div:has([data-streamdown=\"mermaid-block-actions\"])]:!top-2',\n '[&_div[data-streamdown=\"mermaid-block\"]>div:has([data-streamdown=\"mermaid-block-actions\"])]:!right-2',\n '[&_div[data-streamdown=\"mermaid-block\"]>div:has([data-streamdown=\"mermaid-block-actions\"])]:!z-10',\n '[&_div[data-streamdown=\"mermaid-block\"]>div:has([data-streamdown=\"mermaid-block-actions\"])]:!mt-0',\n '[&_div[data-streamdown=\"mermaid-block\"]>div:has([data-streamdown=\"mermaid-block-actions\"])]:!pointer-events-auto',\n // Ensure mermaid container is tall enough for the toolbar (pan/zoom + actions)\n '[&_div[data-streamdown=\"mermaid-block\"]_.relative.w-full]:!min-h-28',\n // KaTeX sizing (overflow rules live in styles.source.css)\n '[&_.katex-display]:my-3',\n '[&_.katex]:text-[1em]',\n // First and last child margin resets\n '[&>*:first-child]:mt-0',\n '[&>*:last-child]:mb-0',\n className\n )}\n components={{ ...messageResponseComponents, ...components }}\n controls={controls ?? MESSAGE_RESPONSE_DEFAULT_STREAMDOWN_CONTROLS}\n plugins={{ ...plugins, mermaid: mermaidPlugin }}\n portal={portal ?? portalContainer}\n {...props}\n />\n );\n};\n\n/**\n * Shares an explicit `portal` prop with components rendered inside the Markdown,\n * such as the expanded table view, so they portal into the same container as Streamdown.\n */\nconst MessageResponsePortalProvider = ({\n portal,\n children,\n}: Pick<MessageResponseProps, 'portal'> & {\n children: ReactNode;\n}): JSX.Element => {\n const portalContainer = usePortalContainer();\n const explicitPortalElement =\n typeof portal === 'function' ? (portal() ?? undefined) : portal;\n\n return (\n <PortalContainerContext.Provider\n value={explicitPortalElement ?? portalContainer}\n >\n {children}\n </PortalContainerContext.Provider>\n );\n};\n\nconst MessageResponse = ({\n id,\n role,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n 'data-testid': dataTestId,\n ...props\n}: MessageResponseProps): JSX.Element => (\n <div\n data-slot=\"message-response\"\n id={id}\n role={role}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n aria-describedby={ariaDescribedBy}\n data-testid={dataTestId}\n >\n <MessageResponsePortalProvider portal={props.portal}>\n <MessageResponseMarkdown {...props} />\n </MessageResponsePortalProvider>\n </div>\n);\n\ntype MessageAttachmentProps = HTMLAttributes<HTMLDivElement> & {\n data: FileUIPart;\n className?: string;\n onRemove?: () => void;\n};\n\nfunction MessageAttachment({\n data,\n className,\n onRemove,\n ...props\n}: MessageAttachmentProps): ReactNode {\n const filename = data.filename || '';\n const mediaType =\n data.mediaType?.startsWith('image/') && data.url ? 'image' : 'file';\n const isImage = mediaType === 'image';\n const attachmentLabel = filename || (isImage ? 'Image' : 'Attachment');\n\n return (\n <div\n data-slot=\"message-attachment\"\n className={cn(\n 'group relative size-24 overflow-hidden rounded-lg',\n className\n )}\n {...props}\n >\n {isImage ? (\n <img\n alt={filename || 'attachment'}\n className=\"size-full object-cover\"\n height={100}\n src={data.url}\n width={100}\n />\n ) : (\n <Tooltip>\n <TooltipTrigger\n render={\n <div className=\"flex size-full shrink-0 items-center justify-center rounded-lg bg-muted-background text-muted-foreground\">\n <IconPaperclip className=\"size-4\" />\n </div>\n }\n />\n <TooltipContent>\n <p>{attachmentLabel}</p>\n </TooltipContent>\n </Tooltip>\n )}\n {onRemove && (\n <Button\n aria-label=\"Remove attachment\"\n className=\"absolute top-1 right-1 size-6 rounded-full bg-card-background/80 opacity-0 backdrop-blur-sm transition-opacity hover:bg-card-background group-hover:opacity-100 group-focus-within:opacity-100 [@media(hover:none)]:opacity-100\"\n onClick={(e) => {\n e.stopPropagation();\n onRemove();\n }}\n size=\"icon\"\n type=\"button\"\n variant=\"ghost\"\n >\n <IconX className=\"size-3\" />\n </Button>\n )}\n </div>\n );\n}\n\ntype MessageAttachmentsProps = ComponentProps<'div'>;\n\nfunction MessageAttachments({\n children,\n className,\n ...props\n}: MessageAttachmentsProps): ReactNode {\n if (!children) {\n return null;\n }\n\n return (\n <div\n data-slot=\"message-attachments\"\n className={cn(\n 'ml-auto flex w-fit flex-wrap items-start gap-2',\n className\n )}\n {...props}\n >\n {children}\n </div>\n );\n}\n\ntype MessageToolbarProps = ComponentProps<'div'>;\n\nconst MessageToolbar = ({\n className,\n children,\n ...props\n}: MessageToolbarProps): ReactNode => (\n <div\n data-slot=\"message-toolbar\"\n className={cn(\n 'mt-4 flex w-full items-center justify-between gap-4',\n className\n )}\n {...props}\n >\n {children}\n </div>\n);\n\nexport {\n Message,\n MessageAction,\n MessageActions,\n MessageAttachment,\n MessageAttachments,\n MessageAvatar,\n MessageAvatarIcon,\n MessageBranch,\n MessageBranchContent,\n MessageBranchNext,\n MessageBranchPage,\n MessageBranchPrevious,\n MessageBranchSelector,\n MessageContent,\n MessageResponse,\n MessageToolbar,\n};\n"],"names":["createContext","useCallback","useContext","useEffect","useMemo","useState","mermaid","mermaidPlugin","IconChevronLeft","IconChevronRight","IconPaperclip","IconX","Streamdown","PortalContainerContext","usePortalContainer","cn","getInitials","Avatar","AvatarFallback","AvatarIcon","AvatarImage","Button","ButtonGroup","ButtonGroupText","Tooltip","TooltipContent","TooltipTrigger","MESSAGE_RESPONSE_DEFAULT_STREAMDOWN_CONTROLS","Message","className","isResponse","props","div","data-slot","MessageContent","children","MessageAvatar","avatarUrl","name","variant","sizes","fallbackText","alt","src","MessageAvatarIcon","MessageActions","MessageAction","tooltip","label","size","button","type","span","render","p","MessageBranchContext","useMessageBranch","context","Error","MessageBranch","defaultBranch","onBranchChange","currentBranch","setCurrentBranch","branches","setBranches","goToPrevious","prev","newBranch","length","goToNext","contextValue","totalBranches","Provider","value","MessageBranchContent","childrenArray","Array","isArray","map","branch","index","key","MessageBranchSelector","orientation","MessageBranchPrevious","aria-label","disabled","onClick","MessageBranchNext","MessageBranchPage","messageResponseComponents","h1","h2","h3","h4","h5","h6","strong","em","b","i","ul","ol","li","blockquote","hr","a","href","table","tabIndex","role","thead","tbody","tr","th","td","MessageResponseMarkdown","components","plugins","controls","portal","portalContainer","MessageResponsePortalProvider","explicitPortalElement","undefined","MessageResponse","id","ariaLabel","ariaLabelledBy","ariaDescribedBy","dataTestId","aria-labelledby","aria-describedby","data-testid","MessageAttachment","data","onRemove","filename","mediaType","startsWith","url","isImage","attachmentLabel","img","height","width","e","stopPropagation","MessageAttachments","MessageToolbar"],"mappings":";AAMA,SACEA,aAAa,EACbC,WAAW,EACXC,UAAU,EACVC,SAAS,EACTC,OAAO,EACPC,QAAQ,QACH,QAAQ;AAEf,SAASC,WAAWC,aAAa,QAAQ,sBAAsB;AAC/D,SACEC,eAAe,EACfC,gBAAgB,EAChBC,aAAa,EACbC,KAAK,QACA,sBAAsB;AAG7B,SAASC,UAAU,QAAQ,aAAa;AAGxC,SACEC,sBAAsB,EACtBC,kBAAkB,QACb,2CAA2C;AAClD,SAASC,EAAE,EAAEC,WAAW,QAAQ,wBAAwB;AACxD,SACEC,MAAM,EACNC,cAAc,EACdC,UAAU,EACVC,WAAW,QACN,mBAAmB;AAC1B,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASC,WAAW,EAAEC,eAAe,QAAQ,+BAA+B;AAC5E,SAASC,OAAO,EAAEC,cAAc,EAAEC,cAAc,QAAQ,qBAAqB;AAE7E,SAASC,4CAA4C,QAAQ,oDAAiD;AAM9G,MAAMC,UAAU,CAAC,EACfC,SAAS,EACTC,aAAa,KAAK,EAClB,GAAGC,OACU,iBACb,KAACC;QACCC,aAAU;QACVJ,WAAWd,GACT,+DACAe,aAAa,6BAA6B,4BAC1CD;QAED,GAAGE,KAAK;;AAMb,MAAMG,iBAAiB,CAAC,EACtB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