@cognite/aura 1.46766.0 → 1.46768.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.
@@ -2,10 +2,9 @@ import type { ControlsConfig } from "streamdown";
2
2
  /**
3
3
  * Default Streamdown `controls` for assistant markdown (`MessageResponse`).
4
4
  *
5
- * - **Mermaid:** Enables copy, download, and pan/zoom (AX-117, AX-118). Fullscreen is
6
- * disabled: it uses a portal to `document.body`, which breaks scoped / prefixed CSS in
7
- * micro-frontend hosts until upstream supports a configurable portal root.
8
- * - **Code / table:** Off so chat keeps a simpler surface; callers may override via the
9
- * `controls` prop on `MessageResponse`.
5
+ * - **Mermaid:** Copy, download, pan/zoom and fullscreen are on (AX-117, AX-118, KCIH-1232).
6
+ * Fullscreen renders into the Aura portal container so it stays inside the Aura style scope.
7
+ * - **Code / table:** Off so chat keeps a simpler surface.
8
+ * Callers may override via the `controls` prop on `MessageResponse`.
10
9
  */
11
10
  export declare const MESSAGE_RESPONSE_DEFAULT_STREAMDOWN_CONTROLS: Exclude<ControlsConfig, boolean>;
@@ -1,18 +1,17 @@
1
1
  /**
2
2
  * Default Streamdown `controls` for assistant markdown (`MessageResponse`).
3
3
  *
4
- * - **Mermaid:** Enables copy, download, and pan/zoom (AX-117, AX-118). Fullscreen is
5
- * disabled: it uses a portal to `document.body`, which breaks scoped / prefixed CSS in
6
- * micro-frontend hosts until upstream supports a configurable portal root.
7
- * - **Code / table:** Off so chat keeps a simpler surface; callers may override via the
8
- * `controls` prop on `MessageResponse`.
4
+ * - **Mermaid:** Copy, download, pan/zoom and fullscreen are on (AX-117, AX-118, KCIH-1232).
5
+ * Fullscreen renders into the Aura portal container so it stays inside the Aura style scope.
6
+ * - **Code / table:** Off so chat keeps a simpler surface.
7
+ * Callers may override via the `controls` prop on `MessageResponse`.
9
8
  */ export const MESSAGE_RESPONSE_DEFAULT_STREAMDOWN_CONTROLS = {
10
9
  code: false,
11
10
  table: false,
12
11
  mermaid: {
13
12
  copy: true,
14
13
  download: true,
15
- fullscreen: false,
14
+ fullscreen: true,
16
15
  panZoom: true
17
16
  }
18
17
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/components/ui/core/message/message-response-default-streamdown-controls.ts"],"sourcesContent":["import type { ControlsConfig } from 'streamdown';\n\n/**\n * Default Streamdown `controls` for assistant markdown (`MessageResponse`).\n *\n * - **Mermaid:** Enables copy, download, and pan/zoom (AX-117, AX-118). Fullscreen is\n * disabled: it uses a portal to `document.body`, which breaks scoped / prefixed CSS in\n * micro-frontend hosts until upstream supports a configurable portal root.\n * - **Code / table:** Off so chat keeps a simpler surface; callers may override via the\n * `controls` prop on `MessageResponse`.\n */\nexport const MESSAGE_RESPONSE_DEFAULT_STREAMDOWN_CONTROLS: Exclude<\n ControlsConfig,\n boolean\n> = {\n code: false,\n table: false,\n mermaid: {\n copy: true,\n download: true,\n fullscreen: false,\n panZoom: true,\n },\n};\n"],"names":["MESSAGE_RESPONSE_DEFAULT_STREAMDOWN_CONTROLS","code","table","mermaid","copy","download","fullscreen","panZoom"],"mappings":"AAEA;;;;;;;;CAQC,GACD,OAAO,MAAMA,+CAGT;IACFC,MAAM;IACNC,OAAO;IACPC,SAAS;QACPC,MAAM;QACNC,UAAU;QACVC,YAAY;QACZC,SAAS;IACX;AACF,EAAE"}
1
+ {"version":3,"sources":["../../../../../src/components/ui/core/message/message-response-default-streamdown-controls.ts"],"sourcesContent":["import type { ControlsConfig } from 'streamdown';\n\n/**\n * Default Streamdown `controls` for assistant markdown (`MessageResponse`).\n *\n * - **Mermaid:** Copy, download, pan/zoom and fullscreen are on (AX-117, AX-118, KCIH-1232).\n * Fullscreen renders into the Aura portal container so it stays inside the Aura style scope.\n * - **Code / table:** Off so chat keeps a simpler surface.\n * Callers may override via the `controls` prop on `MessageResponse`.\n */\nexport const MESSAGE_RESPONSE_DEFAULT_STREAMDOWN_CONTROLS: Exclude<\n ControlsConfig,\n boolean\n> = {\n code: false,\n table: false,\n mermaid: {\n copy: true,\n download: true,\n fullscreen: true,\n panZoom: true,\n },\n};\n"],"names":["MESSAGE_RESPONSE_DEFAULT_STREAMDOWN_CONTROLS","code","table","mermaid","copy","download","fullscreen","panZoom"],"mappings":"AAEA;;;;;;;CAOC,GACD,OAAO,MAAMA,+CAGT;IACFC,MAAM;IACNC,OAAO;IACPC,SAAS;QACPC,MAAM;QACNC,UAAU;QACVC,YAAY;QACZC,SAAS;IACX;AACF,EAAE"}
@@ -3,6 +3,7 @@ import { createContext, useCallback, useContext, useEffect, useMemo, useState }
3
3
  import { mermaid as mermaidPlugin } from "@streamdown/mermaid";
4
4
  import { IconChevronLeft, IconChevronRight, IconPaperclip, IconX } from "@tabler/icons-react";
5
5
  import { Streamdown } from "streamdown";
6
+ import { usePortalContainer } from "../../../../lib/portal-container-context.js";
6
7
  import { cn, getInitials } from "../../../../lib/utils.js";
7
8
  import { Avatar, AvatarFallback, AvatarIcon, AvatarImage } from "../avatar/avatar.js";
8
9
  import { Button } from "../button/button.js";
@@ -317,7 +318,9 @@ const messageResponseComponents = {
317
318
  children: children
318
319
  })
319
320
  };
320
- const MessageResponseMarkdown = ({ className, components, plugins, controls, ...props })=>/*#__PURE__*/ _jsx(Streamdown, {
321
+ const MessageResponseMarkdown = ({ className, components, plugins, controls, portal, ...props })=>{
322
+ const portalContainer = usePortalContainer();
323
+ return /*#__PURE__*/ _jsx(Streamdown, {
321
324
  className: cn('size-full', // Blockquote paragraph overrides
322
325
  '[&_blockquote_p]:text-sm', '[&_blockquote_p]:tracking-tight', // Inline code
323
326
  '[&_code]:relative', '[&_code]:rounded', '[&_code]:bg-muted-background', '[&_code]:px-[0.3rem]', '[&_code]:py-[0.2rem]', '[&_code]:font-mono', '[&_code]:text-sm', '[&_code]:font-semibold', // Code blocks (Streamdown container)
@@ -343,8 +346,10 @@ const MessageResponseMarkdown = ({ className, components, plugins, controls, ...
343
346
  ...plugins,
344
347
  mermaid: mermaidPlugin
345
348
  },
349
+ portal: portal ?? portalContainer,
346
350
  ...props
347
351
  });
352
+ };
348
353
  const MessageResponse = ({ id, role, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, 'aria-describedby': ariaDescribedBy, 'data-testid': dataTestId, ...props })=>/*#__PURE__*/ _jsx("div", {
349
354
  "data-slot": "message-response",
350
355
  id: id,
@@ -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 { 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 '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 ...props\n}: ComponentProps<typeof Streamdown>): JSX.Element => (\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 {...props}\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 <MessageResponseMarkdown {...props} />\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","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","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,QAA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IAAI,CAAC,EAAE/E,QAAQ,EAAgC,iBAC7C,KAAC+E;YAAGrF,WAAU;sBAA6CM;;IAE7DgF,IAAI,CAAC,EAAEhF,QAAQ,EAAgC,iBAC7C,KAACgF;YAAGtF,WAAU;sBAAwCM;;IAExDiF,IAAI,CAAC,EAAEjF,QAAQ,EAAgC,iBAC7C,KAACiF;YAAGvF,WAAU;sBAA8BM;;AAEhD;AAEA,MAAMkF,0BAA0B,CAAC,EAC/BxF,SAAS,EACTyF,UAAU,EACVC,OAAO,EACPC,QAAQ,EACR,GAAGzF,OAC+B,iBAClC,KAACjB;QACCe,WAAWd,GACT,aACA,iCAAiC;QACjC,4BACA,mCACA,cAAc;QACd,qBACA,oBACA,gCACA,wBACA,wBACA,sBACA,oBACA,0BACA,qCAAqC;QACrC,8CACA,gDACA,yDACA,oDACA,gDACA,wDACA,oBAAoB;QACpB,qDACA,6DACA,gEACA,uEACA,qDACA,qDACA,wDACA,sEACA,gCAAgC;QAChC,iDACA,6DACA,sDACA,4DACA,iEACA,iDACA,qDACA,qEACA,0BAA0B;QAC1B,yDACA,+DACA,iEACA,sDACA,4DACA,0DACA,8DACA,qBAAqB;QACrB,uEACA,4DACA,8EACA,uEACA,mFACA,2EACA,gEACA,kFACA,2EACA,uFACA,qDAAqD;QACrD,uCACA,uCACA,kDACA,6CACA,yCACA,qDACA,sCACA,yDACA,0CACA,8CACA,oDACA,sDACA,4CACA,4CACA,iDACA,+CACA,mDACA,yBAAyB;QACzB,+DACA,iEACA,iDACA,qDACA,uDACA,2EACA,qDACA,uDAAuD;QACvD,qDACA,sFAAsF;QACtF,0FAA0F;QAC1F,yGACA,sGACA,wGACA,qGACA,qGACA,oHACA,+EAA+E;QAC/E,uEACA,0DAA0D;QAC1D,2BACA,yBACA,qCAAqC;QACrC,0BACA,yBACAc;QAEFyF,YAAY;YAAE,GAAG3B,yBAAyB;YAAE,GAAG2B,UAAU;QAAC;QAC1DE,UAAUA,YAAY7F;QACtB4F,SAAS;YAAE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MAAC/G;oBACCiE,cAAW;oBACXzD,WAAU;oBACV2D,SAAS,CAACsD;wBACRA,EAAEC,eAAe;wBACjBX;oBACF;oBACAjF,MAAK;oBACLZ,SAAQ;;sCAER,KAAC1B;sCACD,KAACuC;4BAAKvB,WAAU;sCAAU;;;;;;;AAOxC;AAIA,SAASmH,mBAAmB,EAC1B7G,QAAQ,EACRN,SAAS,EACT,GAAGE,OACqB;IACxB,IAAI,CAACI,UAAU;QACb,OAAO;IACT;IAEA,qBACE,KAACH;QACCC,aAAU;QACVJ,WAAWd,GACT,kDACAc;QAED,GAAGE,KAAK;kBAERI;;AAGP;AAIA,MAAM8G,iBAAiB,CAAC,EACtBpH,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,EACdqF,iBAAiB,EACjBc,kBAAkB,EAClB5G,aAAa,EACbQ,iBAAiB,EACjBe,aAAa,EACbgB,oBAAoB,EACpBc,iBAAiB,EACjBC,iBAAiB,EACjBL,qBAAqB,EACrBF,qBAAqB,EACrBjD,cAAc,EACduF,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 { usePortalContainer } 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 '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\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 <MessageResponseMarkdown {...props} />\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","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","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,SAASC,kBAAkB,QAAQ,8CAA2C;AAC9E,SAASC,EAAE,EAAEC,WAAW,QAAQ,2BAAwB;AACxD,SACEC,MAAM,EACNC,cAAc,EACdC,UAAU,EACVC,WAAW,QACN,sBAAmB;AAC1B,SAASC,MAAM,QAAQ,sBAAmB;AAC1C,SAASC,WAAW,EAAEC,eAAe,QAAQ,kCAA+B;AAC5E,SAASC,OAAO,EAAEC,cAAc,EAAEC,cAAc,QAAQ,wBAAqB;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,E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ACA,qCAAqC;QACrC,8CACA,gDACA,yDACA,oDACA,gDACA,wDACA,oBAAoB;QACpB,qDACA,6DACA,gEACA,uEACA,qDACA,qDACA,wDACA,sEACA,gCAAgC;QAChC,iDACA,6DACA,sDACA,4DACA,iEACA,iDACA,qDACA,qEACA,0BAA0B;QAC1B,yDACA,+DACA,iEACA,sDACA,4DACA,0DACA,8DACA,qBAAqB;QACrB,uEACA,4DACA,8EACA,uEACA,mFACA,2EACA,gEACA,kFACA,2EACA,uFACA,qDAAqD;QACrD,uCACA,uCACA,kDACA,6CACA,yCACA,qDACA,sCACA,yDACA,0CACA,8CACA,oDACA,sDACA,4CACA,4CACA,iDACA,+CACA,mDACA,yBAAyB;QACzB,+DACA,iEACA,iDACA,qDACA,uDACA,2EACA,qDACA,uDAAuD;QACvD,qDACA,sFAAsF;QACtF,0FAA0F;QAC1F,yGACA,sGACA,wGACA,qGACA,qGACA,oHACA,+EAA+E;QAC/E,uEACA,0DAA0D;QAC1D,2BACA,yBACA,qCAAqC;QACrC,0BACA,yBACAc;QAEFyF,YAAY;YAAE,GAAG3B,yBAAyB;YAAE,GAAG2B,UAAU;QAAC;QAC1DE,UAAUA,YAAY7F;QACtB4F,SAAS;YAAE,GAAGA,OAAO;YAAEhH,SAASC;QAAc;QAC9CiH,QAAQA,UAAUC;QACjB,GAAG3F,KAAK;;AAGf;AAEA,MAAM4F,kBAAkB,CAAC,EACvBC,EAAE,EACFb,IAAI,EACJ,cAAcc,SAAS,EACvB,mBAAmBC,cAAc,EACjC,oBAAoBC,eAAe,EACnC,eAAeC,UAAU,EACzB,GAAGjG,OACkB,iBACrB,KAACC;QACCC,aAAU;QACV2F,IAAIA;QACJb,MAAMA;QACNzB,cAAYuC;QACZI,mBAAiBH;QACjBI,oBAAkBH;QAClBI,eAAaH;kBAEb,cAAA,KAACX;YAAyB,GAAGtF,KAAK;;;AAUtC,SAASqG,kBAAkB,EACzBC,IAAI,EACJxG,SAAS,EACTyG,QAAQ,EACR,GAAGv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