import { default as default_2 } from 'react';
import { DynamicToolUIPart } from 'ai';
import { JSX } from 'react/jsx-runtime';
import { ReactNode } from 'react';
import { ToolUIPart } from 'ai';

export declare const Badge: ({ children, className, variant, }: {
    children: ReactNode;
    className?: string;
    variant?: "secondary" | "destructive" | "success";
}) => JSX.Element;

declare type CardStatus = 'pending' | 'running' | 'success' | 'error';

/**
 * Close the sidebar (hide it)
 * This function explicitly closes the sidebar, providing more granular control than toggle
 */
export declare function closeSidenet(): void;

/**
 * Library default theme — the exact shape that gets stored in the DB's `sdk_ui.theme`.
 *
 * - Structural tokens (radius, fontFamily, etc.) are plain strings — apply to both modes.
 *   Per-component radii reference the Tailwind/shadcn scale so they stay proportional
 *   to the base `radius`.
 * - Palette tokens use `{ light, dark }` objects.
 */
export declare const DEFAULT_THEME: ThemeInput;

/**
 * Destroys the Sidenet instance and cleans up all resources
 * @returns Promise that resolves when cleanup is complete
 */
export declare function destroySidenet(): Promise<void>;

/**
 * Public API: Get agents for a copilot
 * Exported for SDK users to fetch agents programmatically
 * This is a convenience wrapper around fetchCopilotData that only returns subagents
 *
 * @param copilotId - The copilot identifier
 * @param apiKey - API key for authentication
 * @returns Promise resolving to list of subagents
 */
export declare function getAgents(copilotId: string, apiKey: string, orgId: string): Promise<Subagent_2[]>;

/**
 * Icons API
 *
 * Public API for getting available icon options
 */
/**
 * Get all available icon names that can be used in config
 *
 * Returns a sorted array of icon name strings that can be specified
 * in tool call and UI icon configurations.
 *
 * @example
 * ```typescript
 * import { getIconOptions, updateSidenetConfig } from '@sidebaria/sdk';
 *
 * // Get all available icon names
 * const icons = getIconOptions();
 * console.log(icons); // ["ArrowUpIcon", "AttachmentIcon", "BotIcon", ...]
 *
 * // Use an icon in config
 * updateSidenetConfig({
 *   'sidenet-tool-call-container': {
 *     tailwind: 'bg-white dark:bg-gray-800',
 *     css: '',
 *     icon: 'SparklesIcon'
 *   }
 * });
 * ```
 *
 * @returns Sorted array of icon name strings
 */
export declare function getIconOptions(): string[];

/**
 * Get all available icons with their categories
 *
 * Returns an array of objects containing icon names and their categories.
 * Useful for building categorized UI selectors.
 *
 * @example
 * ```typescript
 * import { getIconOptionsWithCategories } from '@sidebaria/sdk';
 *
 * const icons = getIconOptionsWithCategories();
 * console.log(icons);
 * // [
 * //   { name: "ArrowUpIcon", category: "Navigation" },
 * //   { name: "AttachmentIcon", category: "Action" },
 * //   { name: "BotIcon", category: "User Interface" },
 * //   ...
 * // ]
 * ```
 *
 * @returns Array of objects with name and category properties
 */
export declare function getIconOptionsWithCategories(): Array<{
    name: string;
    category: string;
}>;

/**
 * Read the current runtime config. `theme` is in the same token-first shape that the
 * DB provides (what you write = what you read).
 */
export declare function getRuntimeConfig(): SidebarRuntimeConfig;

/**
 * Get available runtime auth providers for the current copilot
 * Returns cached providers from initialization, or fetches if cache is empty
 */
export declare function getSidenetRuntimeAuthProviders(): Promise<RuntimeAuthProvider[]>;

/**
 * Get the current state of the sidebar
 * Returns whether the sidebar is currently open or closed
 *
 * @returns Object with isOpen (boolean) and isInitialized (boolean)
 */
export declare function getSidenetState(): {
    isOpen: boolean;
    isInitialized: boolean;
};

/**
 * Initialize the SideNetAI SDK
 * This function creates and mounts the sidebar component to the page
 * @param options - Configuration options for the sidebar
 * @param options.defaultOpen - Whether the sidebar should be open by default (default: false)
 * @param options.keyboardShortcut - Keyboard shortcut key (used with Cmd/Ctrl)
 */
export declare function initSidenet(options: {
    orgId: string;
    position?: 'left' | 'right';
    width?: string;
    userId?: string;
    copilotId?: string;
    apiKey?: string;
    defaultOpen?: boolean;
    keyboardShortcut?: string;
    customCSS?: string;
    customStyles?: Record<string, Record<string, string> | string>;
    layout?: 'sidebar' | 'modal';
    height?: string;
    offset?: {
        top?: string;
        bottom?: string;
        left?: string;
        right?: string;
    };
    contentElement?: string;
    onOpen?: (detail: SidenetEventDetail) => void;
    onClose?: (detail: SidenetEventDetail) => void;
    onResize?: (detail: SidenetEventDetail) => void;
    onReady?: (detail: SidenetEventDetail) => void;
    context?: string[];
    agentVersionId?: string;
    showAgentDropdown?: boolean;
    firstMessage?: string;
    runtimeAuth?: RuntimeAuthCredentials[];
    groupName?: string;
    lastThread?: boolean;
    threadId?: string;
    read_only?: boolean;
    use_routing?: boolean;
    debug?: boolean;
    theme?: 'light' | 'dark';
    showClose?: boolean;
    /**
     * Optional override for the backend-loaded `sdk_ui` (greeting, placeholder, suggestions,
     * theme tokens). Layers on top of the DB config — only the fields you pass are overridden.
     */
    sdkUi?: Partial<SidebarSDKConfig>;
}): Promise<void>;

/**
 * Open the sidebar (show it)
 * This function explicitly opens the sidebar, providing more granular control than toggle
 */
export declare function openSidenet(): void;

/**
 * Re-fetch sidebar config from the database and update the UI without re-initializing.
 * Uses the same credentials as init (or last updateSidenetConfig): userId, copilotId, apiKey.
 * Call this when your backend config has changed and you want the sidebar to pick up new
 * Tailwind classes, suggestion text, etc. After fetching, runtime config is updated and
 * the sidebar tree is re-rendered so useSidebarConfig() returns the new values.
 *
 * If the API request fails, fetchConfigFromDatabase returns {} and the sidebar keeps
 * the previous config; no error is thrown.
 */
export declare function refreshSidenetConfig(): Promise<void>;

/**
 * Refresh scrollbar positioning
 * Call this function if the host page's scrollbar properties change
 * Note: With Shadow DOM isolation, this function is no longer needed
 * but kept for backwards compatibility
 */
export declare function refreshSidenetScrollbar(): void;

/**
 * Apply database styles to the sidebar container
 * This function is called internally during initialization
 */
/**
 * Refresh database styles without reinitializing the sidebar
 * Call this function when your database styles have been updated
 */
export declare function refreshSidenetStyles(): void;

export declare interface RuntimeAuthCredentials {
    providerName: string;
    credentials: any;
}

export declare interface RuntimeAuthProvider {
    providerName: string;
    description?: string;
    authType: string;
    authFields: string[];
}

/**
 * Send a message programmatically to the chat
 * This function allows you to send messages to the sidebar chat without user interaction
 *
 * @param message - The message text to send
 * @param options - Optional configuration
 * @param options.agentVersionId - Optional agent version ID to use for this message
 * @param options.openSidebar - Whether to automatically open the sidebar (default: true)
 * @param options.prompt - Optional one-shot system prompt prepended to this message's
 *                          request (same semantics as `SidebarSuggestionItem.prompt`).
 *                          Applies to this single send only.
 *
 * @returns Promise<void>
 *
 * @example
 * ```typescript
 * // Send a simple message
 * await sendMessage('Hello, how can I help you?');
 *
 * // Send a message with a specific agent
 * await sendMessage('Analyze this code', { agentVersionId: 'expert-agent-123' });
 *
 * // Send a message without opening the sidebar
 * await sendMessage('Background task', { openSidebar: false });
 *
 * // Send a message with a one-shot system prompt
 * await sendMessage('Summarize my day', { prompt: 'Respond as a pirate.' });
 * ```
 */
export declare function sendMessage(message: string, options?: {
    agentVersionId?: string;
    openSidebar?: boolean;
    prompt?: string;
}): Promise<void>;

export declare const Sidebar: default_2.FC<SidebarProps>;

declare interface SidebarProps {
    config: {
        position?: 'left' | 'right';
        width?: string;
        layout?: 'sidebar' | 'modal';
        userId?: string;
        copilotId?: string;
        apiKey?: string;
        defaultOpen?: boolean;
        context?: string[];
        firstMessage?: string;
        runtimeAuth?: RuntimeAuthCredentials[];
        subagents?: Subagent[];
        selectedAgentVersionId?: string;
        showAgentDropdown?: boolean;
        orgId?: string;
        groupName?: string;
        lastThread?: boolean;
        threadId?: string;
        readOnly?: boolean;
        useRouting?: boolean;
        showClose?: boolean;
    };
    onWidthChange?: (newWidth: string) => void;
    onAgentChange?: (agentVersionId: string | undefined) => void;
    onSendMessageReady?: (sendMessageFn: (message: string) => void, resetThreadFn: () => void) => void;
    onClose?: () => void;
}

/**
 * Public runtime shape returned by `getRuntimeConfig()`. Same shape as SidebarSDKConfig
 * but fields are non-optional (always populated from defaults after init).
 */
export declare interface SidebarRuntimeConfig {
    text: SidebarTextConfig;
    theme: ThemeInput;
}

/**
 * SDK configuration interface — what the DB provides and what the public API consumes.
 */
export declare interface SidebarSDKConfig {
    text?: SidebarTextConfig;
    theme?: ThemeInput;
}

/**
 * Single suggestion item shown on a suggestion card (title + subtitle).
 *
 * Optionally binds the click → next-send to a specific agent. The slug is
 * version-tolerant: matching compares the part before the first underscore on both
 * sides, and the highest-versioned matching subagent wins at send time. Both
 * `"le-closer"` and `"le-closer_v1_1"` resolve to the same agent.
 */
export declare interface SidebarSuggestionItem {
    title: string;
    subtitle: string;
    /**
     * Optional agent slug to bind this suggestion to. Accepts either the version-stripped
     * form (`"le-closer"`) or a full versioned slug (`"le-closer_v1_1"`). If no subagent
     * matches at click time, the binding is silently dropped (auto-route).
     */
    agentSlug?: string;
    /**
     * Optional system prompt to send alongside the user message when this suggestion is
     * clicked. The SDK adds it to the request body as `systemPrompt` for that single send;
     * the backend can use it to bias the assistant's response (e.g. instructions, persona).
     * Gated by `editTolerance` the same way as `agentSlug`.
     */
    prompt?: string;
    /**
     * Max fraction of characters (Levenshtein distance / original length) the user can edit
     * before the suggestion's bindings (`agentSlug`, `prompt`) are dropped. Default 0.25.
     * An absolute floor of 6 chars also applies so short suggestions aren't punished.
     */
    editTolerance?: number;
}

/**
 * Copy and suggestions for the chat empty state.
 */
export declare interface SidebarTextConfig {
    greeting: {
        title: string;
        subtitle: string;
    };
    placeholder: string;
    suggestions: SidebarSuggestionItem[];
}

export declare const SIDENET_EVENTS: {
    readonly OPEN: "sidenet:open";
    readonly CLOSE: "sidenet:close";
    readonly RESIZE: "sidenet:resize";
    readonly READY: "sidenet:ready";
};

export declare interface SidenetCallbacks {
    onOpen?: (detail: SidenetEventDetail) => void;
    onClose?: (detail: SidenetEventDetail) => void;
    onResize?: (detail: SidenetEventDetail) => void;
    onReady?: (detail: SidenetEventDetail) => void;
}

export declare interface SidenetEventDetail {
    width: string;
    position: 'left' | 'right';
    layout: 'sidebar' | 'modal';
}

export declare type SidenetOptions = {
    orgId: string;
    position?: 'left' | 'right';
    width?: string;
    height?: string;
    layout?: 'sidebar' | 'modal';
    offset?: {
        top?: string;
        bottom?: string;
        left?: string;
        right?: string;
    };
    contentElement?: string;
    userId?: string;
    copilotId?: string;
    apiKey?: string;
    defaultOpen?: boolean;
    keyboardShortcut?: string;
    agentVersionId?: string;
    showAgentDropdown?: boolean;
    groupName?: string;
    lastThread?: boolean;
    threadId?: string;
    read_only?: boolean;
    use_routing?: boolean;
    debug?: boolean;
    showClose?: boolean;
    onOpen?: (detail: SidenetEventDetail) => void;
    onClose?: (detail: SidenetEventDetail) => void;
    onResize?: (detail: SidenetEventDetail) => void;
    onReady?: (detail: SidenetEventDetail) => void;
};

export declare interface Subagent {
    id: string;
    slug: string;
    name: string;
    description: string;
    versionNumber: number;
    isRouting: boolean;
}

/**
 * Subagent interface for the unified copilot endpoint
 * Note: Uses 'slug' instead of 'orgName'
 */
declare interface Subagent_2 {
    id: string;
    slug: string;
    name: string;
    description: string;
    versionNumber: number;
    isRouting: boolean;
}

/**
 * Token-first theme input shape — what the DB provides as `sdk_ui.theme`, what the
 * SDK runtime stores, and what `getRuntimeConfig()` returns.
 *
 * Example:
 * ```json
 * {
 *   "radius": "1rem",
 *   "background": { "light": "#ffffff", "dark": "#09090b" },
 *   "accentColor": { "light": "#0ea5e9" }
 * }
 * ```
 */
export declare type ThemeInput = {
    [K in keyof ThemeTokens]?: ThemeTokenInput;
};

/**
 * Per-token value: either a plain string (applies to both modes) or a `{light, dark}`
 * object for per-mode values. If only one side of the object is set, that value
 * applies to both modes (fallback behavior).
 */
export declare type ThemeTokenInput = string | {
    light?: string;
    dark?: string;
};

/**
 * Sidebar Configuration - Centralized Design Tokens
 *
 * Single shape end-to-end: the DB, the SDK public API, and the internal runtime all
 * use the same token-first `ThemeInput` format. The CSS emitter branches per-token
 * on string vs `{light, dark}` — no resolve/transform step.
 */
/**
 * Flat token names — shared between `ThemeInput` keys and per-mode values.
 * Each key is optional at the `ThemeInput` level; the CSS emitter ignores undefined entries.
 */
export declare interface ThemeTokens {
    /** Base border radius (e.g., "0.625rem"). Drives rounded-sm/md/lg/xl utilities via calc. */
    radius?: string;
    /** Composer (input area) border radius. Defaults to radius × 2.2. */
    composerRadius?: string;
    /** User + assistant message bubble border radius. Defaults to radius × 1.8. */
    messageRadius?: string;
    /** Suggestion card border radius. Defaults to radius × 1.0. */
    suggestionRadius?: string;
    /** Send/cancel button radius. Default: pill shape (9999px). */
    sendButtonRadius?: string;
    /** Header icon button radius (new thread, history, etc.). Defaults to radius × 0.8. */
    headerButtonRadius?: string;
    /** Dropdown/select trigger radius (model selector, agent selector). Defaults to radius × 0.8. */
    selectRadius?: string;
    /** Outer modal radius (only applies when `layout: 'modal'`). Defaults to radius × 0.8. */
    modalRadius?: string;
    /** Max width of the thread/conversation area (e.g., "44rem") */
    threadMaxWidth?: string;
    /** Accent color used for interactive elements (e.g., "#0ea5e9") */
    accentColor?: string;
    /** Main background color */
    background?: string;
    /** Main text/foreground color */
    foreground?: string;
    /** Muted background for secondary surfaces */
    muted?: string;
    /** Muted text color for secondary text */
    mutedForeground?: string;
    /** Border color */
    border?: string;
    /** Background color for user message bubbles */
    userMessageBackground?: string;
    /** Text color inside user message bubbles */
    userMessageForeground?: string;
    /** Border color for user message bubbles (use "transparent" for no border) */
    userMessageBorder?: string;
    /** Background color for the composer/input area */
    composerBackground?: string;
    /** Background color for suggestion cards */
    suggestionBackground?: string;
    /** Border color for suggestion cards */
    suggestionBorder?: string;
    /** Font family for all text (e.g., "Inter, sans-serif") */
    fontFamily?: string;
    /** Background color for assistant message bubbles */
    assistantMessageBackground?: string;
    /** Text color inside assistant message bubbles */
    assistantMessageForeground?: string;
    /** Border color for assistant message bubbles (use "transparent" for no border) */
    assistantMessageBorder?: string;
}

/**
 * Toggle sidebar visibility
 */
export declare function toggleSidenet(): void;

export declare const Tool: ({ className, defaultOpen, status, children, ...props }: ToolProps) => JSX.Element;

export declare function ToolCall({ toolCall, className, defaultOpen, customIcon: customIconProp, customIconSize: customIconSizeProp, customIconLight: customIconLightProp, customIconDark: customIconDarkProp, }: ToolCallProps): JSX.Element;

export declare interface ToolCallInterface {
    toolName: string;
    args: Record<string, unknown>;
    argsRawText?: string;
    result?: Record<string, unknown>;
    timestamp: string;
    isNested?: boolean;
    parentToolCallId?: string;
    nestedRunId?: string;
    state?: ToolUIPart["state"];
    errorText?: string;
    toolCallId?: string;
}

/**
 * @deprecated This component is deprecated. Use ToolCall from './tool' instead.
 * The new component provides full ai-elements state support and better customization.
 *
 * Migration:
 * ```
 * // Old
 * import { ToolCall } from './components/base/tool-call';
 *
 * // New
 * import { ToolCall } from './components/base/tool';
 * ```
 */
export declare const ToolCallInterface: default_2.NamedExoticComponent<{
    toolCall: ToolCallInterface;
}>;

export declare interface ToolCallProps {
    toolCall: ToolCallInterface;
    className?: string;
    defaultOpen?: boolean;
    customIcon?: string;
    customIconSize?: number;
    customIconLight?: string;
    customIconDark?: string;
}

export declare const ToolContent: ({ className, children, ...props }: ToolContentProps) => JSX.Element;

export declare interface ToolContentProps extends React.HTMLAttributes<HTMLDivElement> {
}

export declare const ToolHeader: ({ className, title, type, state, toolName, ...props }: ToolHeaderProps) => JSX.Element;

export declare type ToolHeaderProps = {
    title?: string;
    className?: string;
} & ({
    type: ToolUIPart["type"];
    state: ToolUIPart["state"];
    toolName?: never;
} | {
    type: DynamicToolUIPart["type"];
    state: DynamicToolUIPart["state"];
    toolName: string;
});

export declare const ToolInput: ({ className, input, ...props }: ToolInputProps) => JSX.Element;

export declare type ToolInputProps = React.HTMLAttributes<HTMLDivElement> & {
    input: ToolPart["input"];
};

export declare const ToolOutput: ({ className, output, errorText, ...props }: ToolOutputProps) => JSX.Element | null;

export declare type ToolOutputProps = React.HTMLAttributes<HTMLDivElement> & {
    output: ToolPart["output"];
    errorText: ToolPart["errorText"];
};

export declare type ToolPart = ToolUIPart | DynamicToolUIPart;

export declare interface ToolProps extends React.HTMLAttributes<HTMLDivElement> {
    defaultOpen?: boolean;
    status?: CardStatus;
}

/**
 * Programmatically trigger the keyboard shortcut action (toggle sidebar)
 * This implements the interface contract from types.ts
 */
export declare function triggerKeyboardShortcut(): void;

/**
 * Update sidebar configuration without reinitializing
 * This function allows dynamic updates to width and position
 * while preserving the current state and avoiding reinitialization
 */
export declare function updateSidenetConfig(options: {
    width?: string;
    height?: string;
    position?: 'left' | 'right';
    layout?: 'sidebar' | 'modal';
    offset?: {
        top?: string;
        bottom?: string;
        left?: string;
        right?: string;
    };
    userId?: string;
    copilotId?: string;
    apiKey?: string;
    defaultOpen?: boolean;
    keyboardShortcut?: string | null;
    agentVersionId?: string;
    showAgentDropdown?: boolean;
    firstMessage?: string;
    runtimeAuth?: RuntimeAuthCredentials[];
    groupName?: string;
    lastThread?: boolean;
    threadId?: string | null;
    read_only?: boolean;
    use_routing?: boolean;
    debug?: boolean;
    theme?: 'light' | 'dark';
    showClose?: boolean;
}): void;

/**
 * Update runtime authentication credentials dynamically
 * This allows changing runtime auth after initialization without re-initializing the sidebar
 */
export declare function updateSidenetRuntimeAuth(runtimeAuth: RuntimeAuthCredentials[]): void;

/**
 * Update theme and text configuration at runtime.
 *
 * @param styleConfig - Partial config with theme tokens and/or text config
 *
 * @example
 * ```typescript
 * updateSidenetStyledConfig({
 *   theme: {
 *     light: { accentColor: '#3b82f6', userMessageBackground: '#eff6ff' },
 *     dark: { accentColor: '#60a5fa', userMessageBackground: '#1e3a5f' }
 *   }
 * });
 * ```
 */
export declare function updateSidenetStyledConfig(styleConfig: Partial<SidebarSDKConfig>): void;

/**
 * Hook to access the sidebar configuration from any component.
 */
export declare function useSidebarConfig(): SidebarRuntimeConfig;

export { }
