/** * Embed-mode navigation resolver + shared click-handling primitives. * * Used by the lib chat panel's chip + card click handlers to force * new-tab + absolutize against the embedder-supplied content origin. * * Refactor from hub origin (D5): inferTargetPlatformFromHref + * getPlatformDomain dropped. Caller threads `targetPlatform` directly. * Relative URLs without a defaultContentOrigin emit a dev warning * and resolve against window.location.origin (likely wrong in embed * mode; embedder should set defaultContentOrigin). */ import type { ChatRuntime } from '../../../contexts/chat-runtime-context'; /** Arguments accepted by `window.open` for a new tab — keep `noopener` * + `noreferrer` to prevent the opened page from accessing * window.opener (reverse-tabnabbing class). */ export declare const NEW_TAB_FEATURES = "noopener,noreferrer"; /** Modifier-click predicate — matches the existing useNavLink branch * (cmd/ctrl/shift/alt OR non-primary mouse button). */ export declare function isModifierClick(e: { button?: number; metaKey?: boolean; ctrlKey?: boolean; shiftKey?: boolean; altKey?: boolean; }): boolean; /** Strip the origin from a same-origin absolute URL, returning a relative * path the host's router will treat as in-app navigation. Pass-through * for already-relative URLs and for cross-origin URLs. */ export declare function stripSameOriginToPath(href: string): string; export interface ExternalNavResolution { /** Absolutized href — relative paths are joined with * `runtime.navigation.defaultContentOrigin` (embed contract). */ href: string; /** Synchronous opener. MUST be invoked inline from a user gesture for * popup-blocker compatibility (Safari/Firefox). Honors * runtime.navigation.openExternal override, else falls back to * window.open(href, '_blank', 'noopener,noreferrer'). */ open: () => void; } /** * Pre-resolve an href against the embed-mode `defaultContentOrigin`. * * In `embed` mode every chat-rendered anchor MUST point at an absolute * URL on the hub origin (not the embedder origin). Without * pre-resolution, relative paths like `/knowledge-base/foo.md` render * as `` — the click handler intercepts * primary-button clicks correctly, but modifier-click (cmd/ctrl/middle/ * right) bypasses the handler and opens `/...` → 404. * Pre-resolution at render time makes every browser-native navigation * path (hover preview, status bar, copy-link, new-tab via modifier) * land on the hub correctly. * * In `host` mode (the hub itself) the href is returned unchanged — * relative paths resolve naturally against the hub's own origin. * * Absolute URLs and protocol-relative URLs are returned unchanged in * both modes. */ export declare function resolveHrefForRuntime(href: string, runtime: ChatRuntime): string; /** * Resolve external navigation in embed mode. * * Browser-only: called from React event handlers (onClick, imperative * click handlers) after mount. No SSR-reachable paths. */ export declare function resolveExternalNavigation(args: { href: string; targetPlatform: string | null | undefined; runtime: ChatRuntime; }): ExternalNavResolution; //# sourceMappingURL=chat-nav-resolution.d.ts.map