{"version":3,"file":"mention-chip.cjs","sources":["../../../src/chat-ui/mentions/mention-chip.tsx"],"sourcesContent":["/**\n * Mention chip rendering for message display.\n *\n * Parses [@name](mention://type?...) markdown links and renders them\n * as styled inline chips matching the Olympus mention style.\n * Used in both user messages (inline text) and assistant messages (markdown links).\n */\n\nimport { useContext, type FC, type ReactElement, type ReactNode } from \"react\";\nimport {\n  formatScreenPoint,\n  isScreenPointHref,\n  parseScreenPointHref,\n} from \"@athenaintel/agent-runtime\";\nimport { CrosshairIcon, Globe2Icon } from \"lucide-react\";\nimport { cn } from \"../../lib/utils\";\nimport { createOlympusAssetUrl } from \"../lib/asset-urls\";\nimport { MentionAuthCtx } from \"./suggestions/data/api-client\";\nimport { assetTypeToThumb } from \"./suggestions/data/sources/asset-type-icons\";\n\nconst SPACES_MENTION_PATH = /\\/dashboard\\/spaces\\/?\\?/;\n\nfunction isSpacesMentionUrl(url: string): boolean {\n  return SPACES_MENTION_PATH.test(url);\n}\n\nfunction getSpacesAssetType(url: URL): string | null {\n  const assetType =\n    url.searchParams.get(\"assetType\") ||\n    url.searchParams.get(\"asset_type\") ||\n    url.searchParams.get(\"type\");\n  return assetType === \"sheet\" ? \"spreadsheet\" : assetType;\n}\n\n// ── Mention link component for markdown renderer ──\n\n/**\n * Custom <a> renderer for MarkdownTextPrimitive.\n * Intercepts mention:// links and renders them as chips.\n * Falls through to a normal link for non-mention URLs.\n */\nexport const MentionLink: FC<{\n  href?: string;\n  children?: ReactNode;\n  interactive?: boolean;\n}> = ({ href, children, interactive = true }) => {\n  if (\n    href &&\n    (href.startsWith(\"mention://\") || isSpacesMentionUrl(href))\n  ) {\n    const name = typeof children === \"string\"\n      ? children.replace(/^@/, \"\")\n      : Array.isArray(children)\n        ? String(children[0] ?? \"\").replace(/^@/, \"\")\n        : \"\";\n\n    const parsed = parseMentionUrl(href);\n\n    return (\n      <MentionChip\n        name={name || parsed.name}\n        type={parsed.type}\n        assetIds={parsed.assetIds}\n        thumbnailUrl={parsed.thumbnailUrl}\n        sourceHref={isSpacesMentionUrl(href) ? href : undefined}\n        interactive={interactive}\n      />\n    );\n  }\n\n  if (href?.startsWith(\"chrome-extension://\")) {\n    return <span>{children}</span>;\n  }\n\n  if (isScreenPointHref(href)) {\n    return <ScreenPointChip href={href}>{children}</ScreenPointChip>;\n  }\n\n  // Normal link — render as-is\n  return (\n    <a href={href} target=\"_blank\" rel=\"noopener noreferrer\">\n      {children}\n    </a>\n  );\n};\n\n// ── Inline screen-point chip ──\n\n/**\n * Renders an `athena-point://` link as a non-navigating coordinate chip.\n * Surfaces without screenshot context (extension side panel, SDK consumers)\n * get the label plus the coordinates; malformed points fall back to text.\n */\nexport const ScreenPointChip: FC<{\n  href: string;\n  children?: ReactNode;\n}> = ({ href, children }) => {\n  const parsed = parseScreenPointHref(href);\n  if (!parsed.ok) {\n    return <span>{children}</span>;\n  }\n  const description = formatScreenPoint(parsed.point);\n  return (\n    <span\n      className=\"not-prose inline-flex max-w-[260px] items-center gap-1 whitespace-nowrap rounded-md border border-slate-300 bg-white px-1.5 py-px align-middle text-[0.85em] font-medium leading-[1.4] text-slate-600\"\n      title={description}\n      aria-label={description}\n      data-screen-point=\"valid\"\n    >\n      <CrosshairIcon className=\"size-3.5 shrink-0\" aria-hidden=\"true\" />\n      <span className=\"max-w-[180px] overflow-hidden text-ellipsis\">\n        {children}\n      </span>\n      <span className=\"font-normal text-slate-400\">\n        {parsed.point.x}, {parsed.point.y}\n      </span>\n    </span>\n  );\n};\n\n// ── Inline mention chip ──\n\nexport const MentionChip: FC<{\n  name: string;\n  type?: string;\n  assetIds?: string[];\n  thumbnailUrl?: string;\n  sourceHref?: string;\n  interactive?: boolean;\n}> = ({ name, type, assetIds, thumbnailUrl, sourceHref, interactive = true }) => {\n  const auth = useContext(MentionAuthCtx);\n  const assetRootHref =\n    type === \"asset\" && assetIds?.length\n      ? createOlympusAssetUrl({\n          appUrl: auth?.appUrl,\n          backendUrl: auth?.backendUrl,\n          assetIds,\n        })\n      : null;\n  const href = (() => {\n    if (!assetRootHref || !sourceHref) return assetRootHref;\n    try {\n      const source = new URL(sourceHref, \"https://app.athenaintel.com\");\n      const destination = new URL(assetRootHref);\n      for (const [key, value] of source.searchParams) {\n        destination.searchParams.set(key, value);\n      }\n      destination.searchParams.set(\"asset_ids\", assetIds?.join(\",\") ?? \"\");\n      return destination.toString();\n    } catch {\n      return assetRootHref;\n    }\n  })();\n  // `not-prose` matters: assistant messages render inside Tailwind\n  // Typography's `prose`, whose zero-specificity `img` margins (~1.7em\n  // top/bottom) would otherwise inflate the chip's icon into a tall card\n  // that breaks the sentence flow around it.\n  const className = cn(\n    \"not-prose inline-flex max-w-[220px] items-center gap-1 whitespace-nowrap rounded-md border border-slate-300 bg-white px-1.5 py-px align-middle text-[0.85em] font-medium leading-[1.4] text-slate-600 no-underline\",\n    href &&\n      \"cursor-pointer transition-colors hover:border-slate-400 hover:bg-slate-50 hover:text-slate-800 hover:no-underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-1\",\n  );\n  const contents = (\n    <>\n      {thumbnailUrl && (\n        <img\n          src={thumbnailUrl}\n          alt=\"\"\n          className=\"size-3.5 shrink-0\"\n          draggable={false}\n        />\n      )}\n      {!thumbnailUrl && type === \"webpage\" && (\n        <Globe2Icon className=\"size-3.5 shrink-0\" aria-hidden=\"true\" />\n      )}\n      <span className=\"max-w-[180px] overflow-hidden text-ellipsis\">\n        {name}\n      </span>\n    </>\n  );\n\n  if (href && interactive) {\n    return (\n      <a\n        href={href}\n        target=\"_blank\"\n        rel=\"noopener noreferrer\"\n        className={className}\n        aria-label={`Open ${name} in Spaces`}\n        title={`Open ${name} in Spaces`}\n      >\n        {contents}\n      </a>\n    );\n  }\n\n  return <span className={className}>{contents}</span>;\n};\n\n// ── Parse mention:// URLs ──\n\nexport function parseMentionUrl(url: string): {\n  type: string;\n  name: string;\n  id: string;\n  assetIds?: string[];\n  thumbnailUrl?: string;\n} {\n  try {\n    if (isSpacesMentionUrl(url)) {\n      const parsed = new URL(url, \"https://app.athenaintel.com\");\n      const assetIds = (parsed.searchParams.get(\"asset_ids\") ?? \"\")\n        .split(\",\")\n        .map((id) => id.trim())\n        .filter(Boolean);\n      const id = assetIds[0] ?? \"\";\n      const assetType = getSpacesAssetType(parsed);\n      return {\n        type: \"asset\",\n        name: assetIds.length > 1 ? `${assetIds.length} assets` : \"Asset\",\n        id,\n        assetIds,\n        thumbnailUrl: assetTypeToThumb(assetType),\n      };\n    }\n    // mention://tool?name=...&description=...\n    // mention://asset?id=...&assetType=project&thumb=../icons/files/ic-project.svg\n    const u = new URL(url);\n    const type = u.hostname || u.pathname.replace(/^\\/\\//, \"\").split(\"?\")[0];\n    const isWebpage = type === \"webpage\";\n    const id = isWebpage\n      ? u.searchParams.get(\"tab_id\") || \"\"\n      : u.searchParams.get(\"id\") || u.searchParams.get(\"name\") || \"\";\n    const name = isWebpage\n      ? u.searchParams.get(\"title\") || \"This webpage\"\n      : u.searchParams.get(\"name\") || id;\n\n    // Get thumbnail: prefer explicit thumb param, then derive from assetType\n    let thumbnailUrl = u.searchParams.get(\"thumb\") || undefined;\n    if (!thumbnailUrl) {\n      const assetType = u.searchParams.get(\"assetType\");\n      if (assetType) {\n        thumbnailUrl = assetTypeToThumb(assetType);\n      } else if (type === \"asset\" || type === \"folder\") {\n        thumbnailUrl = assetTypeToThumb(type === \"folder\" ? \"folder\" : null);\n      }\n    }\n\n    return {\n      type,\n      name,\n      id,\n      assetIds: type === \"asset\" && id ? [id] : undefined,\n      thumbnailUrl,\n    };\n  } catch {\n    return { type: \"unknown\", name: \"\", id: \"\" };\n  }\n}\n\nfunction htmlAttribute(attributes: string, name: string): string | null {\n  const escapedName = name.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n  const match = new RegExp(\n    `(?:^|\\\\s)${escapedName}\\\\s*=\\\\s*(?:\"([^\"]*)\"|'([^']*)'|([^\\\\s>]+))`,\n    \"i\",\n  ).exec(attributes);\n  return match?.[1] ?? match?.[2] ?? match?.[3] ?? null;\n}\n\nfunction decodeHtmlAttribute(value: string): string {\n  return value\n    .replace(/&amp;/gi, \"&\")\n    .replace(/&quot;/gi, '\"')\n    .replace(/&#39;|&apos;/gi, \"'\")\n    .replace(/&lt;/gi, \"<\")\n    .replace(/&gt;/gi, \">\");\n}\n\n/** Turn complete model-emitted URL citation anchors into safe Markdown links. */\nexport function normalizeAthenaMentionHtml(text: string): string {\n  return text.replace(\n    /<a\\b([^>]*)>([\\s\\S]*?)<\\/a>/gi,\n    (original, attributes: string, rawLabel: string) => {\n      const className = htmlAttribute(attributes, \"class\") ?? \"\";\n      const type = htmlAttribute(attributes, \"data-type\") ?? \"\";\n      if (!className.split(/\\s+/).includes(\"mention\") || type !== \"url\") {\n        return original;\n      }\n\n      const rawUrl =\n        htmlAttribute(attributes, \"data-url\") ??\n        htmlAttribute(attributes, \"href\");\n      if (!rawUrl) return original;\n      const url = decodeHtmlAttribute(rawUrl);\n      let normalizedUrl: string;\n      try {\n        const parsed = new URL(url);\n        if (parsed.protocol !== \"http:\" && parsed.protocol !== \"https:\") {\n          return original;\n        }\n        normalizedUrl = parsed.toString();\n      } catch {\n        return original;\n      }\n\n      const label = decodeHtmlAttribute(rawLabel.replace(/<[^>]*>/g, \"\"))\n        .trim()\n        .replace(/([\\\\[\\]])/g, \"\\\\$1\");\n      return label ? `[${label}](<${normalizedUrl}>)` : original;\n    },\n  );\n}\n// ── Parse mention markdown in plain text ──\n\nconst MENTION_RE =\n  /\\[@([^\\]]*)\\]\\(((?:mention:\\/\\/|(?:https?:\\/\\/[^)\\s]+)?\\/dashboard\\/spaces\\/?\\?)[^)]+)\\)/g;\n\n/**\n * Parse text containing [@name](mention://...) patterns into\n * an array of string segments and MentionChip elements.\n */\nexport function parseMentionsInText(text: string): (string | ReactElement)[] {\n  const parts: (string | ReactElement)[] = [];\n  let lastIndex = 0;\n  let match: RegExpExecArray | null;\n\n  MENTION_RE.lastIndex = 0;\n\n  while ((match = MENTION_RE.exec(text)) !== null) {\n    if (match.index > lastIndex) {\n      parts.push(text.slice(lastIndex, match.index));\n    }\n\n    const name = match[1];\n    const url = match[2];\n    const parsed = parseMentionUrl(url);\n\n    parts.push(\n      <MentionChip\n        key={`mention-${match.index}`}\n        name={name || parsed.name}\n        type={parsed.type}\n        assetIds={parsed.assetIds}\n        thumbnailUrl={parsed.thumbnailUrl}\n        sourceHref={isSpacesMentionUrl(url) ? url : undefined}\n      />\n    );\n\n    lastIndex = match.index + match[0].length;\n  }\n\n  if (lastIndex < text.length) {\n    parts.push(text.slice(lastIndex));\n  }\n\n  return parts.length > 0 ? parts : [text];\n}\n"],"names":["jsx","isScreenPointHref","parseScreenPointHref","formatScreenPoint","jsxs","CrosshairIcon","useContext","MentionAuthCtx","createOlympusAssetUrl","cn","Fragment","Globe2Icon","id","assetTypeToThumb"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAoBA,MAAM,sBAAsB;AAE5B,SAAS,mBAAmB,KAAsB;AAChD,SAAO,oBAAoB,KAAK,GAAG;AACrC;AAEA,SAAS,mBAAmB,KAAyB;AACnD,QAAM,YACJ,IAAI,aAAa,IAAI,WAAW,KAChC,IAAI,aAAa,IAAI,YAAY,KACjC,IAAI,aAAa,IAAI,MAAM;AAC7B,SAAO,cAAc,UAAU,gBAAgB;AACjD;AASO,MAAM,cAIR,CAAC,EAAE,MAAM,UAAU,cAAc,WAAW;AAC/C,MACE,SACC,KAAK,WAAW,YAAY,KAAK,mBAAmB,IAAI,IACzD;AACA,UAAM,OAAO,OAAO,aAAa,WAC7B,SAAS,QAAQ,MAAM,EAAE,IACzB,MAAM,QAAQ,QAAQ,IACpB,OAAO,SAAS,CAAC,KAAK,EAAE,EAAE,QAAQ,MAAM,EAAE,IAC1C;AAEN,UAAM,SAAS,gBAAgB,IAAI;AAEnC,WACEA,2BAAAA;AAAAA,MAAC;AAAA,MAAA;AAAA,QACC,MAAM,QAAQ,OAAO;AAAA,QACrB,MAAM,O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