import { OolongApp } from "../../OolongApp";
import { RichTextHelper } from "../../../renderText/richText/RichTextHelper";
import { NodeDetailInfo } from "../types/NodeDetailInfo";
/**
 * AI Node API
 * 提供给 AI 调用的节点操作接口
 */
export declare class AINodeAPI {
    app: OolongApp;
    textHelper: RichTextHelper;
    private duplicateWorker;
    private basePropsWorker;
    private deleteWorker;
    constructor(app: OolongApp);
    /**
     * 获取上下文
     */
    private getCtx;
    /**
     * 计算富文本
     * 如果文本已经是 <root> 开头的 XML 富文本格式，则直接返回
     * 否则转换为富文本格式
     */
    private computeRichText;
    /**
     * 添加节点
     * @param params 节点参数
     * @returns {code: 200, id: string} | {code: number, msg: string}
     */
    addNode(params: {
        x: number;
        y: number;
        width: number;
        height: number;
        angle?: number;
        zIndex?: number;
        color?: string;
        alpha?: number;
        borderColor?: string;
        dashType?: number;
        text?: string;
        fontSize?: number;
        fontColor?: string;
        shapeCode?: number;
        bold?: boolean;
        italic?: boolean;
        underline?: boolean;
        strikethrough?: boolean;
        verticalAlign?: number;
        horizonAlign?: number;
    }): {
        code: number;
        id?: string;
        msg?: string;
    };
    /**
     * 删除节点
     * @param params 删除参数
     * @returns {code: 200} | {code: number, msg: string}
     */
    deleteNode(params: {
        ids: string[];
    }): {
        code: number;
        msg?: string;
    };
    /**
     * 更新节点
     * @param params 更新参数
     * @returns {code: 200} | {code: number, msg: string}
     */
    updateNode(params: {
        id: string;
        x?: number;
        y?: number;
        width?: number;
        height?: number;
        angle?: number;
        zIndex?: number;
        color?: string;
        alpha?: number;
        borderColor?: string;
        borderWidth?: number;
        borderAlpha?: number;
        dashType?: number;
        text?: string;
        fontSize?: number;
        fontColor?: string;
        shapeCode?: number;
    }): {
        code: number;
        msg?: string;
    };
    /**
     * 批量移动节点
     * @param params 移动参数，包含节点id数组和移动偏移量
     * @returns 移动结果
     */
    moveNodes(params: {
        ids: string[];
        dx: number;
        dy: number;
    }): {
        code: number;
        msg?: string;
    };
    /**
     * 批量调整节点尺寸
     * @param params 调整参数，包含节点id数组和目标宽高
     * @returns 调整结果
     */
    resizeNodes(params: {
        ids: string[];
        width: number;
        height: number;
    }): {
        code: number;
        msg?: string;
    };
    /**
     * 批量更新节点
     * @param params 批量更新参数
     * @returns {code: 200, successCount: number} | {code: 206, successCount: number, errorCount: number, errors: any[]} | {code: number, msg: string}
     */
    batchUpdateNode(params: {
        nodes: Array<{
            id: string;
            x?: number;
            y?: number;
            width?: number;
            height?: number;
            angle?: number;
            zIndex?: number;
            color?: string;
            alpha?: number;
            borderColor?: string;
            borderWidth?: number;
            borderAlpha?: number;
            dashType?: number;
            text?: string;
            fontSize?: number;
            fontColor?: string;
            shapeCode?: number;
            bold?: boolean;
            italic?: boolean;
            underline?: boolean;
            strikethrough?: boolean;
            verticalAlign?: number;
            horizonAlign?: number;
        }>;
    }): {
        code: number;
        successCount?: number;
        errorCount?: number;
        errors?: any[];
        msg?: string;
    };
    /**
     * 批量更新连线属性
     * @param params 批量更新连线参数
     * @returns 更新结果
     */
    batchUpdateLine(params: {
        lines: Array<{
            id: string;
            points?: {
                x: number;
                y: number;
            }[];
            borderColor?: string;
            borderWidth?: number;
            dashType?: number;
            text?: string;
            fontSize?: number;
            fontColor?: string;
            shapeCode?: number;
            lArrow?: number;
            rArrow?: number;
        }>;
    }): {
        code: number;
        successCount?: number;
        errorCount?: number;
        errors?: any[];
        msg?: string;
    };
    /**
     * 查询节点
     * @param params 查询参数（矩形区域）
     * @returns {code: 200, nodes: any[]} | {code: number, msg: string}
     */
    selectNode(params: {
        x: number;
        y: number;
        width: number;
        height: number;
    }): {
        code: number;
        nodes?: any[];
        count?: number;
        msg?: string;
    };
    /**
     * 查询节点详细信息
     * @param params 查询参数（节点 ID 数组）
     * @returns {code: 200, nodes: any[]} | {code: number, msg: string}
     */
    selectNodeDetail(params: {
        ids: string[];
    }): {
        code: number;
        nodes?: NodeDetailInfo[];
        count?: number;
        msg?: string;
    };
    /**
     * 计算文字节点尺寸
     * 计算包含文字的节点的最小尺寸（确保文字不被遮挡）
     * @param params 计算参数（节点 ID 数组）
     * @returns {code: 200, nodes: any[]} | {code: number, msg: string}
     */
    computeTextNodeSize(params: {
        ids: string[];
    }): {
        code: number;
        nodes?: {
            id: string;
            width: number;
            height: number;
        }[];
        count?: number;
        msg?: string;
    };
    /**
     * 添加连线
     * @param params 连线参数
     * @returns {code: 200, id: string} | {code: number, msg: string}
     */
    addLine(params: {
        points: {
            x: number;
            y: number;
        }[];
        zIndex?: number;
        shapeCode?: number;
        borderColor?: string;
        borderWidth?: number;
        dashType?: number;
        lArrow?: number;
        rArrow?: number;
        text?: string;
        fontSize?: number;
        fontColor?: string;
        textPosition?: number;
    }): {
        code: number;
        id?: string;
        msg?: string;
    };
    /**
     * 添加 SVG 节点
     * @param params SVG 节点参数
     * @returns {code: 200, id: string} | {code: number, msg: string}
     */
    addSvg(params: {
        x: number;
        y: number;
        width: number;
        height: number;
        angle?: number;
        svgCode: string;
        borderColor?: string;
        borderWidth?: number;
        dashType?: number;
        sectionId?: string;
    }): {
        code: number;
        id?: string;
        msg?: string;
    };
    /**
     * 批量添加节点
     * @param params 批量节点参数
     * @returns {code: 200, ids: string[]} | {code: number, msg: string}
     */
    batchAddNodes(params: {
        nodes: Array<{
            x: number;
            y: number;
            width: number;
            height: number;
            angle?: number;
            zIndex?: number;
            color?: string;
            alpha?: number;
            borderColor?: string;
            dashType?: number;
            text?: string;
            fontSize?: number;
            fontColor?: string;
            shapeCode?: number;
            bold?: boolean;
            italic?: boolean;
            underline?: boolean;
            strikethrough?: boolean;
            verticalAlign?: number;
            horizonAlign?: number;
        }>;
        sectionId?: string;
    }): {
        code: number;
        ids?: string[];
        count?: number;
        msg?: string;
    };
    /**
     * 批量添加连线
     * @param params 批量连线参数
     * @returns {code: 200, ids: string[]} | {code: number, msg: string}
     */
    batchAddLines(params: {
        lines: Array<{
            points?: {
                x: number;
                y: number;
            }[];
            startInfo?: {
                id: string;
                endType?: 0 | 1 | 2 | 3;
                anchorRatio?: {
                    x: number;
                    y: number;
                };
            };
            endInfo?: {
                id: string;
                endType?: 0 | 1 | 2 | 3;
                anchorRatio?: {
                    x: number;
                    y: number;
                };
            };
            startPoint?: {
                x: number;
                y: number;
            };
            endPoint?: {
                x: number;
                y: number;
            };
            zIndex?: number;
            shapeCode?: number;
            borderColor?: string;
            borderWidth?: number;
            dashType?: number;
            lArrow?: number;
            rArrow?: number;
            text?: string;
            fontSize?: number;
            fontColor?: string;
            textPosition?: number;
        }>;
        defaultStyle?: {
            zIndex?: number;
            shapeCode?: number;
            borderColor?: string;
            borderWidth?: number;
            dashType?: number;
            lArrow?: number;
            rArrow?: number;
            fontSize?: number;
            fontColor?: string;
        };
        sectionId?: string;
    }): {
        code: number;
        successCount?: number;
        failedCount?: number;
        results?: Array<{
            index: number;
            success: boolean;
            id?: string;
            error?: string;
        }>;
        msg?: string;
    };
    /**
     * 批量添加 Section 容器
     * @param params 批量容器参数
     * @returns {code: 200, ids: string[], count: number} | {code: number, msg: string}
     */
    batchAddSections(params: {
        sections: Array<{
            x: number;
            y: number;
            width: number;
            height: number;
            color?: string;
            borderColor?: string;
            dashType?: number;
            borderWidth?: number;
        }>;
    }): {
        code: number;
        ids?: string[];
        count?: number;
        msg?: string;
    };
    /**
     * 批量修改节点的父级容器
     * 将一组节点（普通节点、连线、section容器）移动到指定的 section 容器内或根节点
     * 会自动处理坐标系转换，保持节点在画布上的视觉位置不变
     */
    batchReparentNodes(params: {
        ids: string[];
        sectionId?: string;
    }): {
        code: number;
        msg?: string;
    };
    /**
     * 创建连接线（连接两个节点或指定端点）
     * @param params 连接线参数
     * @returns {code: 200, id: string} | {code: number, msg: string}
     */
    connectLine(params: {
        startInfo?: {
            id: string;
            endType?: 0 | 1 | 2 | 3;
            anchorRatio?: {
                x: number;
                y: number;
            };
        };
        endInfo?: {
            id: string;
            endType?: 0 | 1 | 2 | 3;
            anchorRatio?: {
                x: number;
                y: number;
            };
        };
        startPoint?: {
            x: number;
            y: number;
        };
        endPoint?: {
            x: number;
            y: number;
        };
        zIndex?: number;
        shapeCode?: number;
        borderColor?: string;
        borderWidth?: number;
        dashType?: number;
        lArrow?: number;
        rArrow?: number;
        text?: string;
        fontSize?: number;
        fontColor?: string;
        textPosition?: number;
    }): {
        code: number;
        id?: string;
        msg?: string;
    };
    /**
     * 批量创建连接线
     * @param params 批量连接线参数
     * @returns {code: 200, successCount: number, failedCount: number, results: Array} | {code: number, msg: string}
     */
    batchConnectLine(params: {
        connections: Array<{
            startInfo?: {
                id: string;
                endType?: 0 | 1 | 2 | 3;
                anchorRatio?: {
                    x: number;
                    y: number;
                };
            };
            endInfo?: {
                id: string;
                endType?: 0 | 1 | 2 | 3;
                anchorRatio?: {
                    x: number;
                    y: number;
                };
            };
            startPoint?: {
                x: number;
                y: number;
            };
            endPoint?: {
                x: number;
                y: number;
            };
            zIndex?: number;
            shapeCode?: number;
            borderColor?: string;
            borderWidth?: number;
            dashType?: number;
            lArrow?: number;
            rArrow?: number;
            text?: string;
            fontSize?: number;
            fontColor?: string;
            textPosition?: number;
        }>;
        defaultStyle?: {
            zIndex?: number;
            shapeCode?: number;
            borderColor?: string;
            borderWidth?: number;
            dashType?: number;
            lArrow?: number;
            rArrow?: number;
            fontSize?: number;
            fontColor?: string;
        };
    }): {
        code: number;
        successCount?: number;
        failedCount?: number;
        results?: Array<{
            index: number;
            success: boolean;
            id?: string;
            error?: string;
        }>;
        msg?: string;
    };
    /**
     * 编组 - 将多个节点合并为一个 Group 节点
     * @param params 编组参数
     * @returns {code: 200} | {code: number, msg: string}
     */
    toGroup(params: {
        ids: string[];
    }): {
        code: number;
        msg?: string;
    };
    /**
     * 解散编组 - 将 Group 节点解散，其子节点恢复为独立节点
     * @param params 解散编组参数
     * @returns {code: 200} | {code: number, msg: string}
     */
    unGroup(params: {
        id: string;
    }): {
        code: number;
        msg?: string;
    };
    /**
     * 调整节点层级
     * @param params 层级调整参数
     * @returns {code: 200} | {code: number, msg: string}
     */
    changeLayer(params: {
        ids: string[];
        action: string;
    }): {
        code: number;
        msg?: string;
    };
    /**
     * 计算点坐标在节点范围内的归一化比例值 (anchorRatio)
     * 将一个绝对坐标点转换为相对于指定节点边界矩形的 0-1 比例值
     * @param params 参数：point 点坐标，nodeId 节点ID
     * @returns {code: 200, data: {x, y}} | {code: number, msg: string}
     */
    computeAnchorRatio(params: {
        point: {
            x: number;
            y: number;
        };
        nodeId: string;
    }): {
        code: number;
        data?: {
            x: number;
            y: number;
        };
        msg?: string;
    };
    /**
     * 计算线段路径上 t=0.5 处的中点坐标
     * 参考 GraphicUtils.computePointByT 逻辑，沿路径等距取中点
     */
    private computeLineMidpoint;
    /**
     * 复制节点
     * @param params.ids 要复制的节点 id 数组，为空时复制当前选中的节点
     * @param params.deltaX 复制偏移量 X，默认 20
     * @param params.deltaY 复制偏移量 Y，默认 20
     * @returns {code: 200, newIds: string[]} | {code: number, msg: string}
     */
    duplicateNodes(params: {
        ids?: string[];
        deltaX?: number;
        deltaY?: number;
    }): {
        code: number;
        msg?: string;
        newIds?: string[];
    };
    /**
     * 添加数学公式节点
     * @param params 数学公式参数
     * @returns {code: 200, id: string} | {code: number, msg: string}
     */
    addMathFormula(params: {
        latex: string;
        x?: number;
        y?: number;
        fontSize?: number;
        sectionId?: string;
    }): Promise<{
        code: number;
        id?: string;
        msg?: string;
    }>;
    /**
     * 添加饼图
     * 创建一个 ChartSection 容器，并通过 PieParseEngine 解析 PieInfo 生成饼图子节点
     * @param params 饼图参数
     * @returns {code: 200, sectionId: string, childIds: string[]} | {code: number, msg: string}
     */
    addPieChart(params: {
        title: string;
        showTitle?: boolean;
        members: Array<{
            name: string;
            value: number;
        }>;
        x?: number;
        y?: number;
        sectionId?: string;
    }): {
        code: number;
        sectionId?: string;
        childIds?: string[];
        msg?: string;
    };
    /**
     * 添加折线图
     * 创建一个 ChartSection 容器，并通过 LineParseEngine 解析 LineInfo 生成折线图子节点
     * @param params 折线图参数
     * @returns {code: 200, sectionId: string, childIds: string[]} | {code: number, msg: string}
     */
    addLineChart(params: {
        title: string;
        showTitle?: boolean;
        showDot?: boolean;
        showXGrid?: boolean;
        showYGrid?: boolean;
        times: {
            title?: string;
            value: Array<{
                value: number;
                label: string;
            }>;
        };
        members: Array<{
            title: string;
            value: number[];
        }>;
        x?: number;
        y?: number;
        sectionId?: string;
    }): {
        code: number;
        sectionId?: string;
        childIds?: string[];
        msg?: string;
    };
    /**
     * 添加柱状图
     * 创建一个 ChartSection 容器，并通过 BarParseEngine 解析 BarInfo 生成柱状图子节点
     * @param params 柱状图参数
     * @returns {code: 200, sectionId: string, childIds: string[]} | {code: number, msg: string}
     */
    addBarChart(params: {
        title: string;
        showTitle?: boolean;
        times: {
            title?: string;
            value: Array<{
                value: number;
                label: string;
            }>;
        };
        members: Array<{
            title: string;
            value: number[];
        }>;
        x?: number;
        y?: number;
        sectionId?: string;
    }): {
        code: number;
        sectionId?: string;
        childIds?: string[];
        msg?: string;
    };
    /**
     * 添加散点图
     * 创建一个 ChartSection 容器，并通过 ScatterParseEngine 解析 ScatterInfo 生成散点图子节点
     * @param params 散点图参数
     * @returns {code: 200, sectionId: string, childIds: string[]} | {code: number, msg: string}
     */
    addScatterChart(params: {
        title: string;
        showTitle?: boolean;
        showLine?: boolean;
        showXGrid?: boolean;
        showYGrid?: boolean;
        members: Array<{
            title: string;
            points: Array<{
                x: number;
                y: number;
            }>;
        }>;
        x?: number;
        y?: number;
        sectionId?: string;
    }): {
        code: number;
        sectionId?: string;
        childIds?: string[];
        msg?: string;
    };
    /**
     * 添加 Mermaid 流程图
     * 创建一个 MermaidSection 容器，并通过 MermaidParseEngine 解析 mermaid 语法生成流程图子节点
     * @param params mermaid 流程图参数
     * @returns {code: 200, sectionId: string, childIds: string[]} | {code: number, msg: string}
     */
    addMermaidFlowchart(params: {
        code: string;
        x?: number;
        y?: number;
        sectionId?: string;
    }): Promise<{
        code: number;
        sectionId?: string;
        childIds?: string[];
        msg?: string;
    }>;
    /**
     * 添加图片节点
     * 根据已上传的图片 URL 和尺寸，在画布上创建一个图片节点
     * @param params 图片参数
     * @returns {code: 200, nodeId: string, url: string, width: number, height: number} | {code: number, msg: string}
     */
    addImage(params: {
        url: string;
        width: number;
        height: number;
        x?: number;
        y?: number;
        sectionId?: string;
    }): {
        code: number;
        nodeId?: string;
        url?: string;
        width?: number;
        height?: number;
        msg?: string;
    };
}
//# sourceMappingURL=AINodeAPI.d.ts.map