import { App } from 'vue';
import { ComponentOptionsMixin } from 'vue';
import { ComponentProvideOptions } from 'vue';
import { DefineComponent } from 'vue';
import { ExtractPropTypes } from 'vue';
import { PropType } from 'vue';
import { PublicProps } from 'vue';
import { Ref } from 'vue';

declare const __VLS_component: DefineComponent<ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
modelValue?: string;
mode?: EditorMode;
placeholder?: string;
readonly?: boolean;
height?: string | number;
toolbar?: ToolbarConfig | false;
importConfig?: ImportConfig;
exportConfig?: ExportConfig;
imageConfig?: ImageConfig;
videoConfig?: VideoConfig;
autosave?: boolean | AutosaveConfig;
/** Body typography settings shared with ContentRenderer. */
letterSpacing?: EditorTypographyConfig["letterSpacing"];
/** Custom CSS variables applied to the editor root. */
editorStyle?: Record<string, string>;
}>, {
modelValue: string;
mode: string;
placeholder: string;
readonly: boolean;
height: string;
}>>, {
getMarkdown: () => string;
getHTML: () => string;
setContent: (md: string) => void;
focus: () => void;
clear: () => void;
switchMode: (mode: EditorMode) => void;
}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
"update:modelValue": (value: string) => void;
"mode-change": (mode: EditorMode) => void;
"import-success": (result: ImportResult) => void;
"import-error": (error: ImportError) => void;
"export-success": (format: ExportFormat) => void;
}, string, PublicProps, Readonly<ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
modelValue?: string;
mode?: EditorMode;
placeholder?: string;
readonly?: boolean;
height?: string | number;
toolbar?: ToolbarConfig | false;
importConfig?: ImportConfig;
exportConfig?: ExportConfig;
imageConfig?: ImageConfig;
videoConfig?: VideoConfig;
autosave?: boolean | AutosaveConfig;
/** Body typography settings shared with ContentRenderer. */
letterSpacing?: EditorTypographyConfig["letterSpacing"];
/** Custom CSS variables applied to the editor root. */
editorStyle?: Record<string, string>;
}>, {
modelValue: string;
mode: string;
placeholder: string;
readonly: boolean;
height: string;
}>>> & Readonly<{
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
"onMode-change"?: ((mode: EditorMode) => any) | undefined;
"onImport-success"?: ((result: ImportResult) => any) | undefined;
"onImport-error"?: ((error: ImportError) => any) | undefined;
"onExport-success"?: ((format: ExportFormat) => any) | undefined;
}>, {
modelValue: string;
mode: EditorMode;
height: string | number;
placeholder: string;
readonly: boolean;
}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;

declare const __VLS_component_2: DefineComponent<ExtractPropTypes<__VLS_WithDefaults_3<__VLS_TypePropsToRuntimeProps_4<{
mode: EditorMode;
height?: string | number;
}>, {
height: string;
}>>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ExtractPropTypes<__VLS_WithDefaults_3<__VLS_TypePropsToRuntimeProps_4<{
mode: EditorMode;
height?: string | number;
}>, {
height: string;
}>>> & Readonly<{}>, {
height: string | number;
}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;

declare type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;

declare type __VLS_NonUndefinedable_2<T> = T extends undefined ? never : T;

declare type __VLS_NonUndefinedable_3<T> = T extends undefined ? never : T;

declare type __VLS_NonUndefinedable_4<T> = T extends undefined ? never : T;

declare type __VLS_NonUndefinedable_5<T> = T extends undefined ? never : T;

declare type __VLS_NonUndefinedable_6<T> = T extends undefined ? never : T;

declare type __VLS_Prettify<T> = {
    [K in keyof T]: T[K];
} & {};

declare type __VLS_Prettify_2<T> = {
    [K in keyof T]: T[K];
} & {};

declare type __VLS_Prettify_3<T> = {
    [K in keyof T]: T[K];
} & {};

declare function __VLS_template(): {
    "toolbar-extra"?(_: {}): any;
};

declare function __VLS_template_2(): {
    wysiwyg?(_: {}): any;
    markdown?(_: {}): any;
    preview?(_: {}): any;
};

declare type __VLS_TypePropsToRuntimeProps<T> = {
    [K in keyof T]-?: {} extends Pick<T, K> ? {
        type: PropType<__VLS_NonUndefinedable<T[K]>>;
    } : {
        type: PropType<T[K]>;
        required: true;
    };
};

declare type __VLS_TypePropsToRuntimeProps_2<T> = {
    [K in keyof T]-?: {} extends Pick<T, K> ? {
        type: PropType<__VLS_NonUndefinedable_2<T[K]>>;
    } : {
        type: PropType<T[K]>;
        required: true;
    };
};

declare type __VLS_TypePropsToRuntimeProps_3<T> = {
    [K in keyof T]-?: {} extends Pick<T, K> ? {
        type: PropType<__VLS_NonUndefinedable_3<T[K]>>;
    } : {
        type: PropType<T[K]>;
        required: true;
    };
};

declare type __VLS_TypePropsToRuntimeProps_4<T> = {
    [K in keyof T]-?: {} extends Pick<T, K> ? {
        type: PropType<__VLS_NonUndefinedable_4<T[K]>>;
    } : {
        type: PropType<T[K]>;
        required: true;
    };
};

declare type __VLS_TypePropsToRuntimeProps_5<T> = {
    [K in keyof T]-?: {} extends Pick<T, K> ? {
        type: PropType<__VLS_NonUndefinedable_5<T[K]>>;
    } : {
        type: PropType<T[K]>;
        required: true;
    };
};

declare type __VLS_TypePropsToRuntimeProps_6<T> = {
    [K in keyof T]-?: {} extends Pick<T, K> ? {
        type: PropType<__VLS_NonUndefinedable_6<T[K]>>;
    } : {
        type: PropType<T[K]>;
        required: true;
    };
};

declare type __VLS_WithDefaults<P, D> = {
    [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
        default: D[K];
    }> : P[K];
};

declare type __VLS_WithDefaults_2<P, D> = {
    [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify_2<P[K] & {
        default: D[K];
    }> : P[K];
};

declare type __VLS_WithDefaults_3<P, D> = {
    [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify_3<P[K] & {
        default: D[K];
    }> : P[K];
};

declare type __VLS_WithTemplateSlots<T, S> = T & {
    new (): {
        $slots: S;
    };
};

declare type __VLS_WithTemplateSlots_2<T, S> = T & {
    new (): {
        $slots: S;
    };
};

export declare interface AutosaveConfig {
    /** localStorage key for draft storage */
    key: string;
    /** Save interval in ms (default 30 000) */
    interval?: number;
    /** Max history snapshots to keep (default 10) */
    maxHistory?: number;
}

declare function close_2(): void;

export declare const ContentRenderer: DefineComponent<ExtractPropTypes<__VLS_WithDefaults_2<__VLS_TypePropsToRuntimeProps_2<{
modelValue?: string;
content?: string;
format?: RendererFormat;
emptyText?: string;
size?: "compact" | "normal";
/** Overrides the inherited editor typography setting when provided. */
letterSpacing?: string;
/** Optional editor CSS variables to apply when rendering outside the editor. */
editorStyle?: Record<string, string>;
}>, {
modelValue: string;
content: undefined;
format: string;
emptyText: string;
size: string;
letterSpacing: undefined;
editorStyle: undefined;
}>>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ExtractPropTypes<__VLS_WithDefaults_2<__VLS_TypePropsToRuntimeProps_2<{
modelValue?: string;
content?: string;
format?: RendererFormat;
emptyText?: string;
size?: "compact" | "normal";
/** Overrides the inherited editor typography setting when provided. */
letterSpacing?: string;
/** Optional editor CSS variables to apply when rendering outside the editor. */
editorStyle?: Record<string, string>;
}>, {
modelValue: string;
content: undefined;
format: string;
emptyText: string;
size: string;
letterSpacing: undefined;
editorStyle: undefined;
}>>> & Readonly<{}>, {
modelValue: string;
content: string;
size: "compact" | "normal";
format: RendererFormat;
emptyText: string;
letterSpacing: string;
editorStyle: Record<string, string>;
}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;

export declare const EditorContainer: __VLS_WithTemplateSlots_2<typeof __VLS_component_2, ReturnType<typeof __VLS_template_2>>;

export declare type EditorMode = 'wysiwyg' | 'markdown' | 'split';

export declare interface EditorState {
    /** Single source of truth — always Markdown */
    markdownContent: string;
    title: string;
    mode: EditorMode;
    isDirty: boolean;
    lastSavedAt: number | null;
    history: HistorySnapshot[];
}

/** Typography settings shared by the editor and content renderer. */
export declare interface EditorTypographyConfig {
    /** CSS letter-spacing value applied to body content, e.g. '0.05em' or '1px'. */
    letterSpacing?: string;
}

export declare interface ExportConfig {
    /** Required only for PDF export */
    apiBase?: string;
    /** Output filename without extension */
    filename?: string;
}

export declare type ExportFormat = 'markdown' | 'html' | 'pdf' | 'docx';

export declare const ExportMenu: DefineComponent<ExtractPropTypes<__VLS_TypePropsToRuntimeProps_6<{
loading?: boolean;
}>>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
export: (format: ExportFormat) => void;
}, string, PublicProps, Readonly<ExtractPropTypes<__VLS_TypePropsToRuntimeProps_6<{
loading?: boolean;
}>>> & Readonly<{
onExport?: ((format: ExportFormat) => any) | undefined;
}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;

export declare interface HistorySnapshot {
    id: string;
    timestamp: number;
    content: string;
    title: string;
}

export declare interface ImageConfig {
    /** Backend base URL, e.g. 'http://localhost:3001' */
    apiBase?: string;
    /** Upload endpoint path (default '/api/upload/image') */
    uploadPath?: string;
    /** Form field name for the image file (default 'file') */
    fieldName?: string;
    /** Max file size in bytes (default 10 MB) */
    maxFileSize?: number;
    /** Request timeout in ms (default 30 000) */
    timeout?: number;
}

export declare interface ImageUploadResult {
    url: string;
    filename?: string;
    originalName?: string;
    mimeType?: string;
    size?: number;
}

export declare interface ImportConfig {
    /** Backend base URL, e.g. 'http://localhost:3001' */
    apiBase: string;
    /** Max file size in bytes (default 20 MB) */
    maxFileSize?: number;
    /** Request timeout in ms (default 30 000) */
    timeout?: number;
}

export declare const ImportDialog: DefineComponent<ExtractPropTypes<__VLS_TypePropsToRuntimeProps_5<{
loading?: boolean;
disabled?: boolean;
maxFileSize?: number;
}>>, {
showError: (msg: string, sug?: string) => void;
showWarnings: (w: string[]) => void;
close: typeof close_2;
}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
"import-word": (file: File) => void;
"import-url": (url: string) => void;
}, string, PublicProps, Readonly<ExtractPropTypes<__VLS_TypePropsToRuntimeProps_5<{
loading?: boolean;
disabled?: boolean;
maxFileSize?: number;
}>>> & Readonly<{
"onImport-word"?: ((file: File) => any) | undefined;
"onImport-url"?: ((url: string) => any) | undefined;
}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;

export declare interface ImportError {
    code: string;
    message: string;
    suggestion?: string;
}

export declare interface ImportResult {
    html: string;
    title?: string;
    warnings: string[];
}

export declare const ModeSwitch: DefineComponent<ExtractPropTypes<__VLS_TypePropsToRuntimeProps_3<{
modelValue: EditorMode;
}>>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
"update:modelValue": (mode: EditorMode) => void;
}, string, PublicProps, Readonly<ExtractPropTypes<__VLS_TypePropsToRuntimeProps_3<{
modelValue: EditorMode;
}>>> & Readonly<{
"onUpdate:modelValue"?: ((mode: EditorMode) => any) | undefined;
}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;

export declare type RendererFormat = 'markdown' | 'html';

export declare const RichEditor: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;

export declare const RichEditorPlugin: {
    install(app: App): void;
};

export declare interface ToolbarConfig {
    bold?: boolean;
    italic?: boolean;
    underline?: boolean;
    strike?: boolean;
    heading?: boolean;
    list?: boolean;
    taskList?: boolean;
    blockquote?: boolean;
    code?: boolean;
    codeBlock?: boolean;
    table?: boolean;
    image?: boolean;
    video?: boolean;
    link?: boolean;
    align?: boolean;
    indent?: boolean;
    hr?: boolean;
    undo?: boolean;
    redo?: boolean;
    import?: boolean;
    export?: boolean;
}

export declare function useEditorStore(): {
    state: {
        readonly markdownContent: string;
        readonly title: string;
        readonly mode: EditorMode;
        readonly isDirty: boolean;
        readonly lastSavedAt: number | null;
        readonly history: readonly {
            readonly id: string;
            readonly timestamp: number;
            readonly content: string;
            readonly title: string;
        }[];
    };
    setContent: (md: string) => void;
    getContent: () => string;
    setMode: (mode: EditorMode) => void;
    setTitle: (title: string) => void;
    pushSnapshot: (maxHistory?: number) => void;
    restoreSnapshot: (id: string) => void;
    markSaved: () => void;
    reset: () => void;
};

export declare function useImportExport(importConfig: () => ImportConfig | undefined, exportConfig: () => ExportConfig | undefined, getMarkdown: () => string, getHtml: () => string, getTitle: () => string, setContent: (md: string, title?: string) => void): {
    importing: Ref<boolean, boolean>;
    exporting: Ref<boolean, boolean>;
    importError: Ref<    {
    code: string;
    message: string;
    suggestion?: string | undefined;
    } | null, ImportError | {
    code: string;
    message: string;
    suggestion?: string | undefined;
    } | null>;
    importWord: (file: File) => Promise<ImportResult>;
    importUrl: (url: string) => Promise<ImportResult>;
    exportMarkdown: () => void;
    exportHtml: () => void;
    exportPdf: () => Promise<void>;
    exportWord: () => Promise<void>;
};

export declare interface VideoConfig {
    /** Backend base URL, e.g. 'http://localhost:3001' */
    apiBase?: string;
    /** Upload endpoint path (default '/api/upload/video') */
    uploadPath?: string;
    /** Form field name for the video file (default 'file') */
    fieldName?: string;
    /** Max file size in bytes (default 100 MB) */
    maxFileSize?: number;
    /** Request timeout in ms (default 120 000) */
    timeout?: number;
    /** Accepted MIME types (defaults to common browser video formats) */
    acceptedMimeTypes?: string[];
}

export declare interface VideoUploadResult {
    url: string;
    filename?: string;
    originalName?: string;
    mimeType?: string;
    size?: number;
}

export { }


declare module '@tiptap/core' {
    interface Commands<ReturnType> {
        textIndent: {
            setTextIndent: (indent: string) => ReturnType;
            unsetTextIndent: () => ReturnType;
            toggleTextIndent: (indent?: string) => ReturnType;
        };
    }
}


declare module '@tiptap/core' {
    interface Commands<ReturnType> {
        paragraphLineHeight: {
            setParagraphLineHeight: (lineHeight: string) => ReturnType;
            unsetParagraphLineHeight: () => ReturnType;
        };
    }
}


declare module '@tiptap/core' {
    interface Commands<ReturnType> {
        fontSize: {
            setFontSize: (fontSize: string) => ReturnType;
            unsetFontSize: () => ReturnType;
        };
    }
}


declare module '@tiptap/core' {
    interface Commands<ReturnType> {
        video: {
            setVideo: (options: {
                src: string;
                poster?: string;
                title?: string;
            }) => ReturnType;
        };
    }
}

