import type { DocumentChapter, DocumentSection, DocumentSectionType } from "../types/sections";
import type { ProjectAsset } from "../types/editor";
import type { ChapterParseResult } from "./toc/useBookChapters";
import "./TableOfContents.css";
export interface TableOfContentsProps {
    sections: DocumentSection[];
    currentSectionId: string | null;
    isCollapsed: boolean;
    onToggleCollapse: () => void;
    onSelectSection: (id: string) => void;
    onAddSection: (afterId: string | null) => void;
    onAddIntroduction: () => void;
    onAddConclusion: () => void;
    onRemoveSection: (id: string) => void;
    /**
     * Called when the user commits changes from the inline edit form.
     * `changes` may include a new title, type, xml:id, and/or label.
     */
    onUpdateSection: (id: string, changes: {
        title?: string;
        type?: DocumentSectionType;
        xmlId?: string | null;
        label?: string | null;
    }) => void;
    onReorderSections: (sections: DocumentSection[]) => void;
    /**
     * Called when the user drags one section onto another to merge them.
     * `sourceId` is appended to the end of `targetId`.
     */
    onMergeSections?: (sourceId: string, targetId: string) => void;
    /**
     * Called when the user wants to convert the (currently unsectioned) document
     * into a single section and switch to sectioned mode.
     */
    onAddFirstSection?: () => void;
    /**
     * Called when the user requests a manual TOC refresh (sectioned mode).
     * Re-parses the merged document to pick up any sub-sections the user
     * added inside the current section.
     */
    onRefresh?: () => void;
    /** Current editing mode */
    editMode: "document" | "sectioned";
    /** Called when the user clicks the "Edit full document" link */
    onToggleEditMode: () => void;
    /** When true (document mode), hide all edit controls */
    readonly?: boolean;
    /**
     * Whether this is an `"article"` (default) or `"book"` project.
     * When `"book"`, chapter items are rendered above the section list.
     */
    projectType?: "article" | "book";
    /**
     * Book chapter summaries provided by the host.
     * Only meaningful when `projectType === "book"`.
     */
    chapters?: DocumentChapter[];
    /**
     * The id of the currently loaded/active chapter.
     * Only meaningful when `projectType === "book"`.
     */
    currentChapterId?: string | null;
    /**
     * Called when the user clicks a chapter to request loading it.
     * The host is responsible for fetching the chapter source and updating
     * the `source` prop accordingly.
     */
    onChapterSelect?: (chapterId: string) => void;
    /**
     * Called when the user drags chapters into a new order.
     * Receives the full reordered `DocumentChapter[]`; the host is responsible
     * for persisting the new order (e.g., via a Rails PATCH request).
     * When omitted, chapter drag handles are hidden and reordering is disabled.
     */
    onChaptersReorder?: (chapters: DocumentChapter[]) => void;
    /**
     * The set of chapter ids whose section list should be displayed expanded.
     * Owned by the parent `useBookChapters` hook.  Only meaningful when
     * `projectType === "book"`.
     */
    expandedChapterIds?: Set<string>;
    /**
     * Toggle a chapter's expanded state.  Wired to the chevron button.
     * Only meaningful when `projectType === "book"`.
     */
    onToggleChapterExpanded?: (chapterId: string) => void;
    /**
     * Looks up parsed `{sections, wrapper}` for a given chapter id.  Returns
     * `null` for chapters whose `content` is not yet loaded or fails to
     * parse.  Provided by `useBookChapters`.
     */
    getChapterParse?: (chapterId: string) => ChapterParseResult | null;
    /**
     * Called when a chapter is expanded for the first time and its content
     * has not yet been fetched.  The host should fetch the chapter source
     * and update the `chapters` prop with `content` populated.
     */
    onChapterRequestLoad?: (chapterId: string) => void;
    /**
     * Called when the user clicks the "+ Add chapter" row at the bottom of
     * the chapter list.  When omitted, the row is hidden.
     */
    onChapterAdd?: (afterChapterId: string | null) => void;
    /**
     * Called when the user removes a chapter from the TOC.  When omitted,
     * the chapter remove (×) button is hidden.
     */
    onChapterRemove?: (chapterId: string) => void;
    /**
     * Persist a chapter's updated content (e.g. after a cross-chapter
     * section drag).  When omitted, cross-chapter section drops are
     * disabled and rejected silently.
     */
    onChapterContentChange?: (chapterId: string, content: string) => void;
    /**
     * Handle a section click that targets a chapter other than the active
     * one.  The host should switch active chapter and land on the section
     * with the given title.  Only meaningful in book mode.
     */
    onSelectSectionInChapter?: (chapterId: string, sectionTitle: string) => void;
    /**
     * Commit edited chapter properties (title, xml:id, label) from the inline
     * chapter edit form.  When omitted, the chapter edit (✎) button is hidden.
     */
    onUpdateChapter?: (chapterId: string, changes: {
        title?: string;
        xmlId?: string | null;
        label?: string | null;
    }) => void;
    /**
     * When set, the current source XML cannot be parsed and the TOC will
     * display the message as a red warning banner.  Section-list operations
     * (re-parsing, mode switching) remain blocked until the XML is fixed.
     */
    parseError?: string | null;
    /**
     * When true, the section list body (ArticleToc / BookToc) is hidden and
     * replaced with a brief informational note.  Used for source formats that
     * don't support sectioned editing (e.g. Markdown).
     */
    hideSectionList?: boolean;
    /**
     * Project assets shown in the bottom Assets panel.
     * When omitted, the panel is hidden.
     */
    assets?: ProjectAsset[];
    /**
     * Called when the user clicks "Insert" on an asset in the Assets panel.
     */
    onAssetInsert?: (asset: ProjectAsset) => void;
    /**
     * Called when the user clicks the "+" button in the Assets panel header
     * to open the asset picker dialog.
     */
    onOpenAssetPicker?: () => void;
}
/**
 * The table-of-contents sidebar.  This component is a thin dispatcher that
 * owns only the collapsed-state UI; the body is delegated to either
 * {@link ArticleToc} or {@link BookToc} based on `projectType`.
 */
declare const TableOfContents: (props: TableOfContentsProps) => import("react/jsx-runtime").JSX.Element;
export default TableOfContents;
