import type { SourceFormat } from "./types/editor";
/** Returned by {@link derivePretextContent}. Exactly one of the two fields will be set. */
export interface DerivedPretextResult {
    /** The converted (or pass-through) PreTeXt XML string. */
    pretextSource?: string;
    /** Human-readable error when conversion fails. */
    pretextError?: string;
}
/**
 * Inspects `source` and returns the most likely {@link SourceFormat}.
 *
 * Rules (applied in order):
 * 1. Empty/whitespace-only → `"pretext"` (safe default).
 * 2. Starts with `<` → `"pretext"` (XML document).
 * 3. Contains any {@link LATEX_FORMAT_MARKERS} → `"latex"`.
 * 4. Otherwise → `"pretext"`.
 */
export declare function detectSourceFormat(source: string): SourceFormat;
/**
 * Converts a LaTeX document string to formatted PreTeXt XML.
 *
 * @param latexContent - The raw LaTeX source to convert.
 * @returns The formatted PreTeXt XML string, or `""` if `latexContent` is blank.
 * @throws If the underlying `latexToPretext` conversion throws.
 */
export declare function convertLatexToPretext(latexContent: string): string;
/**
 * Normalises an unknown thrown value into a displayable error message.
 *
 * @param error - The value caught in a `catch` block.
 * @returns A non-empty string suitable for showing to the user.
 */
export declare function getConversionErrorMessage(error: unknown): string;
/**
 * Derives PreTeXt content from `sourceContent` according to `sourceFormat`.
 *
 * - If `sourceFormat` is `"pretext"`, the content is returned as-is.
 * - If `sourceFormat` is `"latex"`, the content is converted via
 *   {@link convertLatexToPretext}.  Conversion errors are caught and returned
 *   as `pretextError` so callers never need a try/catch.
 *
 * @param sourceContent - The raw source string.
 * @param sourceFormat - The format of `sourceContent`.
 * @returns A {@link DerivedPretextResult} with either `pretextSource` or `pretextError`.
 */
export declare function derivePretextContent(sourceContent: string, sourceFormat: SourceFormat): DerivedPretextResult;
