import { IconCheckbox, IconClipboardList, IconFile, IconFileText, IconFolder, IconMail, IconMessageChatbot, IconPresentation, IconStack2, IconUser, } from "@tabler/icons-react"; import { useComposerRuntimeAdapters } from "./runtime-adapters.js"; import type { MentionItemMedia as MentionItemMediaValue } from "./types.js"; const iconProps = { size: 14, className: "shrink-0 text-muted-foreground" }; export interface MentionItemMediaProps { icon?: string; media?: MentionItemMediaValue | null; size?: "sm" | "md"; fallbackIcon?: "clipboard" | "file" | "stack"; } function LegacyMentionIcon({ icon, fallbackIcon = "file", }: Pick) { if (!icon && fallbackIcon === "clipboard") { return ( ); } switch (icon) { case "folder": return ; case "document": return ; case "form": return ; case "email": return ; case "user": return ; case "deck": return ; case "agent": return ; case "file": return ; default: return fallbackIcon === "stack" ? ( ) : ( ); } } export function MentionItemMedia({ icon, media, size = "md", fallbackIcon = "file", }: MentionItemMediaProps) { const { resolvePath = (path) => path } = useComposerRuntimeAdapters(); if (media?.type === "none") return null; const backgroundColor = typeof media?.backgroundColor === "string" ? media.backgroundColor : undefined; const text = media?.type === "text" && typeof media.text === "string" ? media.text.trim() : ""; if (text) { return ( ); } const src = media?.type === "image" && typeof media.src === "string" ? media.src.trim() : ""; if (src) { const coversFrame = media?.type === "image" && media.fit === "cover"; const resolvedSrc = src.startsWith("/") && !src.startsWith("//") ? resolvePath(src) : src; return ( ); } return ; }