@frontera-sdk/chat-ui 1.53.5 → 1.53.7

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.
@@ -1,7 +1,7 @@
1
1
  'use client';
2
- export { AgentPicker, useChatAgents } from './chunk-VTJ7WSOY.js';
2
+ export { AgentPicker, useChatAgents } from './chunk-NDU6ERVT.js';
3
3
  import './chunk-C3HW5S2Z.js';
4
- import './chunk-F433AP7Q.js';
4
+ import './chunk-RCWVJD7G.js';
5
5
  import './chunk-EZX3E3BB.js';
6
6
  import './chunk-LGVMMBL3.js';
7
7
  import './chunk-6JLWE7M3.js';
package/dist/chat.js CHANGED
@@ -1,27 +1,27 @@
1
1
  'use client';
2
2
  import { offset, flip, autoUpdate, computePosition } from './chunk-I7SXWUAN.js';
3
3
  import { isFullscreenHotkey, DeckNotesCard, deckOwnsArrowKeys } from './chunk-4FRTPVJT.js';
4
- import { ArtifactSkeleton, resolveStageWidth, zoomPercent, DECK_ZOOM_LEVELS, LazyThumb } from './chunk-E3COYKGP.js';
5
- import { NewSessionPrompt, keepCaretOnTap } from './chunk-NGIA5TNW.js';
6
- import { PendingCards } from './chunk-JR2FLI66.js';
4
+ import { ArtifactSkeleton, resolveStageWidth, zoomPercent, DECK_ZOOM_LEVELS, LazyThumb } from './chunk-DPCAFZ2S.js';
5
+ import { NewSessionPrompt, keepCaretOnTap } from './chunk-NOJWGKB4.js';
6
+ import { PendingCards } from './chunk-GRRSYZQZ.js';
7
7
  import { themeToStyle } from './chunk-6HYPVNVA.js';
8
- import { useChatAgents } from './chunk-VTJ7WSOY.js';
8
+ import { useChatAgents } from './chunk-NDU6ERVT.js';
9
9
  import { subjectOfChatToken, capabilitiesOfChatToken } from './chunk-CCVPZVFK.js';
10
10
  import { useChatCredential } from './chunk-6BCUAPW3.js';
11
11
  import './chunk-WDYCLC4F.js';
12
- import { chatSidePanelSessionKey, Chart1Icon, useTemplatePreviewStore, useHasTemplatePreviewHost, useChatSidePanelStore, ChatHeader, ChatHeaderActions, useRightPane, getChatOverviewAgentStatus, useChatOverviewVisible, useConversationArtifacts, PENDING_CHART_TAB_PREFIX, CHART_TAB_PREFIX, AGENT_WORK_TAB_ID, AGENT_ROUTINES_TAB_ID, SOURCES_TAB_ID, TEMPLATE_TAB_ID, OutputsSection, ChainLink1Icon, ChatOverviewContent, COMPUTER_TAB_PREFIX, SourceRow, motion, MAX_CHAT_SIDE_PANEL_SESSIONS, DEFAULT_CHAT_SIDE_PANEL_SIZE, TableIcon } from './chunk-EKASJRLH.js';
13
- import { dynamic, useChatStreamStore, useComposerStore, Message, Thinking, setPendingFiles, usePersonConfirmations, unshownPendingConfirmations, ConversationConfirmationCard, useLivePreviewUrl, ArrowRotateClockwiseIcon, useComputerFiles, useUploadComputerFile, CanvasWidget, isPlainTextLanguage, useUploadFile, COMPOSER_ID_MAIN, useContextWindowInfo, useIsCompacting, useQueuedMessages, VolumeFullIcon, WarningSignIcon, useComputer, csvTextToWorkbookJson, CSV_PREVIEW_MAX_ROWS, CopyButton, COMPOSER_ID_COPILOT, ModelIcon, modeToBrandRow, useBackDismiss, PdfViewer, brandLabel, Spinner } from './chunk-YEVMFZRG.js';
14
- import { Textarea, artifactFormatIcon, BookIcon, useAgentRoster, ShieldCheckIcon, useArtifactStore, useCanvasStore, useChatOverviewStore, setSdkConversationPath, setSdkDarkMode, AgentsProvider, PluginProvider, WorkspaceProvider, TooltipProvider, getPersonConfirmation, isToolPart, getToolState, getToolName, getToolInput, sourceKind, extractDomain, CitationViewerContext, MarkdownRenderer, ConnectRunnerContext, usePathname, usePaneFocusStore, useAgentPanelStore, Tooltip, TooltipTrigger, TooltipContent, StudioDisplayIcon, WorldIcon, SlidesWideIcon, ArtifactActionsMenu, DotGrid1x3HorizontalTightIcon, ArrowsShowIcon, useKeyboardInset, ExclamationCircleIcon, getToolOutput, useArtifact, useUpdateArtifact, useArtifactFileObjectUrl, resolveArtifactIconFormat, useSourcesEnrichment, LoaderIcon, FileDownloadIcon, Label, Input, renderPluginBlock, useArtifactVersion, useChatCapabilities, useChatCapabilityEnabled, useChatOptInEnabled, useSessionPendingApprovals, tableToCsv, tableToXlsx, tableToMarkdown, DropdownMenu, DropdownMenuTrigger, StyledDropdownMenuContent, StyledDropdownMenuItem, useArtifactVersions, useClient, unwrapData, authFetch, getBearerHeadersForApi, EyeOpenIcon, EyeSlashIcon, useRestoreArtifactVersion, ZoomableImage, ChatImageLightbox, useDownloadArtifact, useArtifactFileBytes, useArtifactPreviewFileObjectUrl, useArtifactVersionPreviewFileObjectUrl, errorText, SpreadsheetIcon, FilePdfIcon, useOptionalWorkspaceContext, useAgentConnectionStatus, useArtifacts, useSession, useWorkspaceContext, useConversationDesktopStatus, isRequestHumanTool, appsKeys, unwrapDataDeep, useRouter, Images1Icon, ArrowUpIcon, VideoIcon, AudioIcon, useBrand, resolveBearerHeaders, subscribeSdkDarkMode, getSdkDarkMode, unwrap, useConnectRunner, useStartUserConnect, useUpsertGrant, useRevokeGrant, AlertDialog, AlertDialogContent, AlertDialogHeader, AlertDialogTitle, AlertDialogDescription, AlertDialogFooter, AlertDialogCancel, AlertDialogAction, LayoutGrid1Icon, useCatalog, useInstalls, useWorkspaceSlug, buildTenantUrlAbsolute } from './chunk-G67XADLL.js';
12
+ import { chatSidePanelSessionKey, Chart1Icon, useTemplatePreviewStore, useHasTemplatePreviewHost, useChatSidePanelStore, ChatHeader, ChatHeaderActions, useRightPane, getChatOverviewAgentStatus, useChatOverviewVisible, useConversationArtifacts, PENDING_CHART_TAB_PREFIX, CHART_TAB_PREFIX, AGENT_WORK_TAB_ID, AGENT_ROUTINES_TAB_ID, SOURCES_TAB_ID, TEMPLATE_TAB_ID, OutputsSection, ChainLink1Icon, ChatOverviewContent, COMPUTER_TAB_PREFIX, SourceRow, motion, MAX_CHAT_SIDE_PANEL_SESSIONS, DEFAULT_CHAT_SIDE_PANEL_SIZE, TableIcon } from './chunk-VB2YKQGZ.js';
13
+ import { dynamic, useChatStreamStore, useComposerStore, Message, Thinking, setPendingFiles, usePersonConfirmations, unshownPendingConfirmations, ConversationConfirmationCard, useLivePreviewUrl, ArrowRotateClockwiseIcon, useComputerFiles, useUploadComputerFile, CanvasWidget, isPlainTextLanguage, useUploadFile, COMPOSER_ID_MAIN, useContextWindowInfo, useIsCompacting, useQueuedMessages, VolumeFullIcon, WarningSignIcon, useComputer, csvTextToWorkbookJson, CSV_PREVIEW_MAX_ROWS, CopyButton, COMPOSER_ID_COPILOT, ModelIcon, modeToBrandRow, useBackDismiss, PdfViewer, brandLabel, Spinner } from './chunk-G4V3YKMK.js';
14
+ import { Textarea, resolveChatHost, artifactFormatIcon, BookIcon, useAgentRoster, ShieldCheckIcon, useArtifactStore, useCanvasStore, useChatOverviewStore, setSdkConversationPath, setSdkDarkMode, AgentsProvider, PluginProvider, WorkspaceProvider, TooltipProvider, ChatHostProvider, getPersonConfirmation, isToolPart, getToolState, getToolName, getToolInput, sourceKind, extractDomain, CitationViewerContext, MarkdownRenderer, ConnectRunnerContext, usePathname, useChatSurfaceProvider, usePaneFocusStore, useAgentPanelStore, Tooltip, TooltipTrigger, TooltipContent, StudioDisplayIcon, WorldIcon, SlidesWideIcon, ArtifactActionsMenu, DotGrid1x3HorizontalTightIcon, ArrowsShowIcon, useKeyboardInset, ExclamationCircleIcon, getToolOutput, useArtifact, useUpdateArtifact, useArtifactFileObjectUrl, resolveArtifactIconFormat, useSourcesEnrichment, LoaderIcon, FileDownloadIcon, Label, Input, renderPluginBlock, useArtifactVersion, useChatCapabilities, useChatCapabilityEnabled, useChatOptInEnabled, useChatHost, useSessionPendingApprovals, tableToCsv, tableToXlsx, tableToMarkdown, DropdownMenu, DropdownMenuTrigger, StyledDropdownMenuContent, StyledDropdownMenuItem, useArtifactVersions, useClient, unwrapData, authFetch, getBearerHeadersForApi, EyeOpenIcon, EyeSlashIcon, useRestoreArtifactVersion, ZoomableImage, ChatImageLightbox, useDownloadArtifact, useArtifactFileBytes, useArtifactPreviewFileObjectUrl, useArtifactVersionPreviewFileObjectUrl, errorText, SpreadsheetIcon, FilePdfIcon, useOptionalWorkspaceContext, useAgentConnectionStatus, useArtifacts, useSession, useWorkspaceContext, useConversationDesktopStatus, isRequestHumanTool, appsKeys, unwrapDataDeep, useRouter, Images1Icon, ArrowUpIcon, VideoIcon, AudioIcon, useBrand, resolveBearerHeaders, subscribeSdkDarkMode, getSdkDarkMode, unwrap, useConnectRunner, useStartUserConnect, useUpsertGrant, useRevokeGrant, AlertDialog, AlertDialogContent, AlertDialogHeader, AlertDialogTitle, AlertDialogDescription, AlertDialogFooter, AlertDialogCancel, AlertDialogAction, LayoutGrid1Icon, useCatalog, useInstalls, useWorkspaceSlug, buildTenantUrlAbsolute } from './chunk-KKOK22CN.js';
15
15
  import { ChevronLeftIcon } from './chunk-CWAOLMFS.js';
16
16
  import { Popover, PopoverTrigger, PopoverContent, Sheet, SheetContent, SheetHeader, SheetTitle, SheetDescription } from './chunk-FZ3VSITY.js';
17
- import { MOBILE_BREAKPOINT, useIsMobile, I18nProvider, useTranslation } from './chunk-MGXLPADX.js';
18
- import './chunk-IOLSQ7XK.js';
19
- import { AppIcon, frontera_icon_default, PhotoIcon, Folder1Icon, FileTextIcon, describeToolRow, SquareArrowTopRightIcon, ClipboardIcon, getToolMeta, useStreamdownPlugins, AppIconFrame, MessageResponse } from './chunk-KI6SVNT2.js';
17
+ import { MOBILE_BREAKPOINT, useIsMobile, I18nProvider, useTranslation } from './chunk-G6A5DWFP.js';
18
+ import './chunk-DJ2Q5U3E.js';
19
+ import { AppIcon, frontera_icon_default, PhotoIcon, Folder1Icon, FileTextIcon, describeToolRow, SquareArrowTopRightIcon, ClipboardIcon, getToolMeta, useStreamdownPlugins, AppIconFrame, MessageResponse } from './chunk-RQPL7ZTX.js';
20
20
  import { Skeleton, Button, ScrollArea, ChevronDownMediumIcon, buttonVariants } from './chunk-UWKO24VT.js';
21
21
  import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription, CrossMediumIcon, DialogFooter } from './chunk-2P4IEVOQ.js';
22
22
  import './chunk-CDTES65T.js';
23
23
  import { DropdownMenu as DropdownMenu$1, DropdownMenuTrigger as DropdownMenuTrigger$1, DropdownMenuContent, DropdownMenuItem, ChevronRightIcon, DropdownMenuSeparator, DropdownMenuLabel } from './chunk-C3HW5S2Z.js';
24
- import { AgentAvatar } from './chunk-F433AP7Q.js';
24
+ import { AgentAvatar } from './chunk-RCWVJD7G.js';
25
25
  import { ArrowDownIcon, FileTextIcon as FileTextIcon$1, Checkmark1Icon as Checkmark1Icon$1 } from './chunk-EZX3E3BB.js';
26
26
  import { cn, PortalContainerContext, Checkmark1Icon } from './chunk-LGVMMBL3.js';
27
27
  import { ChatClientContext } from './chunk-6JLWE7M3.js';
@@ -656,57 +656,6 @@ function ChatOverviewPanel({
656
656
  function useOverviewFloat(_ref, active) {
657
657
  return active;
658
658
  }
659
- var noSurfaceCapture = {
660
- captureEligibleSurface: () => null,
661
- legacyPageHint: () => null,
662
- legacyPageAttachment: () => null,
663
- prepareCapturedSurface: async (context) => context,
664
- noteCapturedSurface: () => {
665
- },
666
- releaseCapturedSurface: () => {
667
- },
668
- confirmCapturedRunTerminal: () => {
669
- },
670
- settleCapturedRun: () => {
671
- },
672
- waitForReadySurface: async () => true
673
- };
674
- var NO_REMEMBERED_MODEL = { modelMode: null, reasoningEffort: null };
675
- function useNoSurfaceProvider() {
676
- }
677
- function useNoRememberedModel() {
678
- return NO_REMEMBERED_MODEL;
679
- }
680
- function useNotBeside() {
681
- return false;
682
- }
683
- function useNoPrepareToLeave() {
684
- return void 0;
685
- }
686
- function resolveChatHost(host) {
687
- return {
688
- surfaceCapture: host.surfaceCapture ?? noSurfaceCapture,
689
- useSurfaceProvider: host.useSurfaceProvider ?? useNoSurfaceProvider,
690
- useRememberedComposerModel: host.useRememberedComposerModel ?? useNoRememberedModel,
691
- rememberComposerModel: host.rememberComposerModel ?? null,
692
- useAssistantBeside: host.useAssistantBeside ?? useNotBeside,
693
- AssistantEmptyState: host.AssistantEmptyState ?? null,
694
- ApprovalsView: host.ApprovalsView ?? null,
695
- usePrepareToLeave: host.usePrepareToLeave ?? useNoPrepareToLeave,
696
- platformLinks: host.platformLinks ?? true
697
- };
698
- }
699
- var EMPTY_HOST = resolveChatHost({});
700
- var ChatHostContext = createContext(EMPTY_HOST);
701
- function ChatHostProvider({ host, children }) {
702
- return /* @__PURE__ */ jsx(ChatHostContext.Provider, { value: host, children });
703
- }
704
- function useChatHost() {
705
- return useContext(ChatHostContext);
706
- }
707
- function useChatSurfaceProvider(options) {
708
- return useChatHost().useSurfaceProvider(options);
709
- }
710
659
  function reducedMotionRequested() {
711
660
  return window.matchMedia("(prefers-reduced-motion: reduce)").matches;
712
661
  }
@@ -42448,7 +42397,7 @@ function SheetEditor({ content, onSave, readOnly = false }) {
42448
42397
  );
42449
42398
  }
42450
42399
  var PdfDocumentViewInner = dynamic(
42451
- () => import('./pdf-document-view-inner-6RK4MYTM.js'),
42400
+ () => import('./pdf-document-view-inner-SH2HOPGD.js'),
42452
42401
  {
42453
42402
  ssr: false,
42454
42403
  loading: () => /* @__PURE__ */ jsx(ArtifactSkeleton, { format: "pdf" })
@@ -42458,7 +42407,8 @@ function PdfDocumentView({
42458
42407
  fileUrl,
42459
42408
  title,
42460
42409
  label,
42461
- versionSlot
42410
+ versionSlot,
42411
+ page
42462
42412
  }) {
42463
42413
  const [failedFileUrl, setFailedFileUrl] = useState(null);
42464
42414
  const failed = failedFileUrl === fileUrl;
@@ -42488,7 +42438,8 @@ function PdfDocumentView({
42488
42438
  title,
42489
42439
  label,
42490
42440
  onError: () => setFailedFileUrl(fileUrl),
42491
- versionSlot
42441
+ versionSlot,
42442
+ page
42492
42443
  }
42493
42444
  );
42494
42445
  }
@@ -43265,11 +43216,11 @@ function HtmlDeckView({ content, inChat = false, versionSlot }) {
43265
43216
  !present && inChat && /* @__PURE__ */ jsx(DeckEditPanel, { currentIndex: sel, currentHtml: slides[sel]?.html ?? "" })
43266
43217
  ] });
43267
43218
  }
43268
- var Inner = dynamic(() => import('./pdf-deck-view-inner-IWBUG4WN.js'), {
43219
+ var Inner = dynamic(() => import('./pdf-deck-view-inner-UEMN324J.js'), {
43269
43220
  ssr: false,
43270
43221
  loading: () => /* @__PURE__ */ jsx(ArtifactSkeleton, { format: "htmldeck" })
43271
43222
  });
43272
- function PdfDeckView({ fileUrl, title, label, notes }) {
43223
+ function PdfDeckView({ fileUrl, title, label, notes, page }) {
43273
43224
  const [failedFileUrl, setFailedFileUrl] = useState(null);
43274
43225
  if (failedFileUrl === fileUrl) {
43275
43226
  return /* @__PURE__ */ jsx("div", { className: "h-full min-h-0 overflow-y-auto scrollbar bg-muted/30", children: /* @__PURE__ */ jsx(
@@ -43286,6 +43237,7 @@ function PdfDeckView({ fileUrl, title, label, notes }) {
43286
43237
  fileUrl,
43287
43238
  label,
43288
43239
  notes,
43240
+ page,
43289
43241
  onError: () => setFailedFileUrl(fileUrl)
43290
43242
  },
43291
43243
  fileUrl
@@ -1,5 +1,5 @@
1
1
  'use client';
2
- import { describeToolRow, Code2Icon, getToolMeta, Shimmer, Collapse } from './chunk-KI6SVNT2.js';
2
+ import { describeToolRow, Code2Icon, getToolMeta, Shimmer, Collapse } from './chunk-RQPL7ZTX.js';
3
3
  import { ChevronDownMediumIcon } from './chunk-UWKO24VT.js';
4
4
  import { cn } from './chunk-LGVMMBL3.js';
5
5
  import { memo, useState, useMemo } from 'react';
@@ -1,5 +1,5 @@
1
1
  'use client';
2
- import { useTranslation } from './chunk-MGXLPADX.js';
2
+ import { useTranslation } from './chunk-G6A5DWFP.js';
3
3
  import { Skeleton } from './chunk-UWKO24VT.js';
4
4
  import { useRef, useState, useEffect } from 'react';
5
5
  import { jsx, jsxs } from 'react/jsx-runtime';
@@ -1,12 +1,12 @@
1
1
  'use client';
2
- import { usePlugins, useChatCapabilityEnabled, resolvePluginLanguage, renderPluginBlock, AlertDialog, AlertDialogContent, AlertDialogHeader, AlertDialogTitle, AlertDialogDescription, AlertDialogFooter, AlertDialogCancel, AlertDialogAction, TooltipProvider, Tooltip, TooltipTrigger, TooltipContent, ActionMenu, useArtifactStore, ArtifactActionsMenu, DotGrid1x3HorizontalTightIcon, useArtifact, resolveArtifactIconFormat, artifactFormatIcon, useArtifactFileObjectUrl, artifactFormatSubtitle, ChatImageLightbox, ArrowsShowIcon, FileDownloadIcon, useClient, processMessageParts, getMessageDisplayTimestampValue, getMessageCreatedAtMs, isApprovalRequested, extractCitationsFromSteps, useSourcesEnrichment, extractImagesFromSteps, dedupeImageResults, getDocumentStreamArtifacts, getToolOutput, useCanvasStore, ImageResultsGallery, MessageDecisionCards, useChatCapabilities, useOptionalWorkspaceContext, useCitationViewer, useChatOverviewStore, dedup, extractDomain, sourceKind, SourceFavicon, Input, exportDocumentPdf, FilePdfIcon, StudioDisplayIcon, WorldIcon, MessageStepsGroup, getToolState, getToolInput, getToolErrorText, useChatOptInEnabled, ArrowRightIcon, formatFileSize, FileThumbnail, attachmentFileOf, MobileScreenSheet, useAgentHistorySource, treatyErrorMessage, useRouter, useBasePath, useAgentPanelStore, AgentRoutineForm, getFileCategory, unwrap, unwrapData, unwrapDataDeep, formatDecisionTime, DecisionCard, LoaderIcon, formatRelativeTime, CircleCheckIcon, agentRoutineKeys, useOptionalAgentsContext, avatarMotionForStream, AGENT_AVATAR_SIZE } from './chunk-G67XADLL.js';
2
+ import { usePlugins, useChatCapabilityEnabled, resolvePluginLanguage, renderPluginBlock, AlertDialog, AlertDialogContent, AlertDialogHeader, AlertDialogTitle, AlertDialogDescription, AlertDialogFooter, AlertDialogCancel, AlertDialogAction, TooltipProvider, Tooltip, TooltipTrigger, TooltipContent, ActionMenu, useArtifactStore, ArtifactActionsMenu, DotGrid1x3HorizontalTightIcon, useArtifact, resolveArtifactIconFormat, artifactFormatIcon, useArtifactFileObjectUrl, artifactFormatSubtitle, ChatImageLightbox, ArrowsShowIcon, FileDownloadIcon, useClient, processMessageParts, getMessageDisplayTimestampValue, getMessageCreatedAtMs, isApprovalRequested, extractCitationsFromSteps, useSourcesEnrichment, extractImagesFromSteps, dedupeImageResults, getDocumentStreamArtifacts, getToolOutput, useCanvasStore, ImageResultsGallery, MessageDecisionCards, useChatCapabilities, useOptionalWorkspaceContext, useCitationViewer, useCitedDocument, useChatOverviewStore, dedup, extractDomain, sourceKind, SourceFavicon, Input, exportDocumentPdf, FilePdfIcon, StudioDisplayIcon, WorldIcon, MessageStepsGroup, getToolState, getToolInput, getToolErrorText, useChatOptInEnabled, ArrowRightIcon, formatFileSize, FileThumbnail, attachmentFileOf, MobileScreenSheet, useAgentHistorySource, treatyErrorMessage, useRouter, useBasePath, useAgentPanelStore, AgentRoutineForm, getFileCategory, unwrap, unwrapData, unwrapDataDeep, formatDecisionTime, DecisionCard, LoaderIcon, formatRelativeTime, CircleCheckIcon, agentRoutineKeys, useOptionalAgentsContext, avatarMotionForStream, AGENT_AVATAR_SIZE } from './chunk-KKOK22CN.js';
3
3
  import { Sheet, SheetTrigger, SheetContent, SheetHeader, SheetTitle, SheetDescription, Popover, PopoverTrigger, PopoverContent } from './chunk-FZ3VSITY.js';
4
- import { useIsMobile, useTranslation } from './chunk-MGXLPADX.js';
5
- import { MessageToolbar, MessageResponse, SquareArrowTopRightIcon, FileTextIcon, Shimmer, ClipboardIcon, Message, MessageContent, PencilIcon, deferDuringLayoutMotion, HoverCard, HoverCardTrigger, HoverCardContent, Collapse, Icon, CircleXIcon, ClockIcon } from './chunk-KI6SVNT2.js';
4
+ import { useIsMobile, useTranslation } from './chunk-G6A5DWFP.js';
5
+ import { MessageToolbar, MessageResponse, SquareArrowTopRightIcon, FileTextIcon, Shimmer, ClipboardIcon, Message, MessageContent, PencilIcon, deferDuringLayoutMotion, HoverCard, HoverCardTrigger, HoverCardContent, Collapse, Icon, CircleXIcon, ClockIcon } from './chunk-RQPL7ZTX.js';
6
6
  import { ChevronDownMediumIcon, Button, ScrollArea, Skeleton } from './chunk-UWKO24VT.js';
7
7
  import { CrossMediumIcon } from './chunk-2P4IEVOQ.js';
8
8
  import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuSub, DropdownMenuSubTrigger, DropdownMenuSubContent } from './chunk-C3HW5S2Z.js';
9
- import { HISTORY_CITATION_PREFIX, canonicalCitationUrl, encodeKnowledgeCitationLinks, historyCitationReference, AgentAvatar } from './chunk-F433AP7Q.js';
9
+ import { HISTORY_CITATION_PREFIX, canonicalCitationUrl, encodeKnowledgeCitationLinks, historyCitationReference, AgentAvatar } from './chunk-RCWVJD7G.js';
10
10
  import { cn, Checkmark1Icon } from './chunk-LGVMMBL3.js';
11
11
  import { useChatClientOptional } from './chunk-6JLWE7M3.js';
12
12
  import { createContext, memo, useMemo, isValidElement, cloneElement, useState, useCallback, useRef, useEffect, useId, useLayoutEffect, lazy, Suspense, useContext } from 'react';
@@ -1637,7 +1637,42 @@ function CitationChip({
1637
1637
  }) {
1638
1638
  const isMobile = useIsMobile();
1639
1639
  const [open, setOpen] = useState(false);
1640
+ const [previewing, setPreviewing] = useState(false);
1640
1641
  const viewer = useCitationViewer();
1642
+ const document2 = useCitedDocument(href, title);
1643
+ const preview = (hint) => /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-2", children: [
1644
+ /* @__PURE__ */ jsx(FileTextIcon, { className: "size-4 shrink-0 mt-0.5 text-muted-foreground" }),
1645
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0 space-y-1", children: [
1646
+ /* @__PURE__ */ jsx("p", { className: "text-sm font-medium leading-snug line-clamp-2", children: title }),
1647
+ snippet && /* @__PURE__ */ jsx("p", { className: "text-xs leading-relaxed text-muted-foreground line-clamp-3", children: snippet }),
1648
+ hint && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground/70", children: hint })
1649
+ ] })
1650
+ ] });
1651
+ if (document2) {
1652
+ const chip = /* @__PURE__ */ jsx(
1653
+ "button",
1654
+ {
1655
+ type: "button",
1656
+ onClick: () => {
1657
+ setPreviewing(false);
1658
+ document2.open();
1659
+ },
1660
+ className: CHIP_CLASS,
1661
+ "aria-label": `Source: ${title}`,
1662
+ children: label
1663
+ }
1664
+ );
1665
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
1666
+ isMobile ? chip : (
1667
+ // Closed while the document is open: the card would sit over the viewer.
1668
+ /* @__PURE__ */ jsxs(HoverCard, { open: previewing && !document2.opened, onOpenChange: setPreviewing, openDelay: 200, closeDelay: 100, children: [
1669
+ /* @__PURE__ */ jsx(HoverCardTrigger, { asChild: true, children: chip }),
1670
+ /* @__PURE__ */ jsx(HoverCardContent, { side: "top", className: "w-72 p-3", children: preview("Click to open the document") })
1671
+ ] })
1672
+ ),
1673
+ document2.viewer
1674
+ ] });
1675
+ }
1641
1676
  const useDialog = viewer !== null && (!href || href.startsWith("/cite/"));
1642
1677
  if (useDialog) {
1643
1678
  const openDialog = () => viewer.open({ url: href ?? "", title, snippet, content });
@@ -1664,14 +1699,7 @@ function CitationChip({
1664
1699
  children: label
1665
1700
  }
1666
1701
  ) }),
1667
- /* @__PURE__ */ jsx(HoverCardContent, { side: "top", className: "w-72 p-3", children: /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-2", children: [
1668
- /* @__PURE__ */ jsx(FileTextIcon, { className: "size-4 shrink-0 mt-0.5 text-muted-foreground" }),
1669
- /* @__PURE__ */ jsxs("div", { className: "min-w-0 space-y-1", children: [
1670
- /* @__PURE__ */ jsx("p", { className: "text-sm font-medium leading-snug line-clamp-2", children: title }),
1671
- snippet && /* @__PURE__ */ jsx("p", { className: "text-xs leading-relaxed text-muted-foreground line-clamp-3", children: snippet }),
1672
- /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground/70", children: "Click to read the passage" })
1673
- ] })
1674
- ] }) })
1702
+ /* @__PURE__ */ jsx(HoverCardContent, { side: "top", className: "w-72 p-3", children: preview("Click to read the passage") })
1675
1703
  ] });
1676
1704
  }
1677
1705
  if (isMobile) {
@@ -1723,13 +1751,7 @@ function CitationChip({
1723
1751
  children: label
1724
1752
  }
1725
1753
  ) }),
1726
- /* @__PURE__ */ jsx(HoverCardContent, { side: "top", className: "w-72 p-3", children: /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-2", children: [
1727
- /* @__PURE__ */ jsx(FileTextIcon, { className: "size-4 shrink-0 mt-0.5 text-muted-foreground" }),
1728
- /* @__PURE__ */ jsxs("div", { className: "min-w-0 space-y-1", children: [
1729
- /* @__PURE__ */ jsx("p", { className: "text-sm font-medium leading-snug line-clamp-2", children: title }),
1730
- snippet && /* @__PURE__ */ jsx("p", { className: "text-xs leading-relaxed text-muted-foreground line-clamp-3", children: snippet })
1731
- ] })
1732
- ] }) })
1754
+ /* @__PURE__ */ jsx(HoverCardContent, { side: "top", className: "w-72 p-3", children: preview() })
1733
1755
  ] });
1734
1756
  }
1735
1757