/**
 * This file is part of the NocoBase (R) project.
 * Copyright (c) 2020-2024 NocoBase Co., Ltd.
 * Authors: NocoBase Team.
 *
 * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
 * For more information, please refer to: https://www.nocobase.com/agreement.
 */
import { FlowModel } from '@nocobase/flow-engine';
import React, { FC } from 'react';
import { type NavigateFunction } from 'react-router-dom';
import type { AdminLayoutMenuItemModel } from './AdminLayoutMenuModels';
import { type NocoBaseDesktopRoute } from './route-types';
export type AdminLayoutMenuRenderType = 'item' | 'group';
export type AdminLayoutMenuRenderOptions = {
    isMobile?: boolean;
    collapsed?: boolean;
    menuRenderType?: string;
};
export type AdminLayoutMenuNode = {
    key?: string;
    name: React.ReactNode;
    icon?: React.ReactNode;
    path: string;
    redirect?: string;
    hideInMenu?: boolean;
    disabled?: boolean;
    _route: any;
    _parentRoute?: NocoBaseDesktopRoute;
    _depth?: number;
    _model?: AdminLayoutMenuItemModel;
    _launcherModel?: FlowModel;
    routes?: AdminLayoutMenuNode[];
};
export type AdminLayoutMenuRouteOptions = {
    designable: boolean;
    isMobile: boolean;
    t: (title: any) => any;
    depth?: number;
};
export type AdminLayoutMenuMovePositionOption = {
    label: any;
    value: 'beforeBegin' | 'afterEnd' | 'beforeEnd';
    disabled?: boolean;
};
export type AdminLayoutMenuInsertPosition = 'beforeBegin' | 'afterEnd' | 'beforeEnd';
export type AdminLayoutMenuCreationType = 'group' | 'page' | 'flowPage' | 'link';
export type AdminLayoutMenuCreationSource = 'header' | 'sider' | 'insert';
export type AdminLayoutMenuCreationMeta = {
    menuType: AdminLayoutMenuCreationType;
    source: AdminLayoutMenuCreationSource;
    insertPosition?: AdminLayoutMenuInsertPosition;
    targetRoute?: NocoBaseDesktopRoute;
    parentRoute?: NocoBaseDesktopRoute;
};
export type AdminLayoutMenuCreationParams = {
    menuType?: AdminLayoutMenuCreationType;
    title?: string;
    icon?: string;
    href?: string;
    params?: any[];
    openInNewWindow?: boolean;
};
export type AdminLayoutMenuItemStructure = {
    subModels: {
        menuItems?: AdminLayoutMenuItemModel[];
    };
};
type AdminLayoutMenuItemsParent = FlowModel & {
    subModels: {
        menuItems?: AdminLayoutMenuItemModel[];
    };
};
/**
 * 为不会直接参与站内路由跳转的菜单节点生成稳定且唯一的占位路径。
 * 这些节点仍会被 ProLayout/rc-menu 当成菜单 key 使用，因此不能复用 '/'。
 * @param type 占位路径类型
 * @param identity 节点身份
 * @returns 唯一占位路径
 */
export declare const getAdminLayoutMenuVirtualPath: (type: 'link' | 'designer', identity: string | number) => string;
/**
 * 仅在模板表达式内部兼容历史菜单变量写法，避免误改普通文本。
 * @param template 原始模板字符串
 * @returns 归一化后的模板字符串
 */
export declare const normalizeAdminLayoutMenuLegacyVariables: (template: string) => string;
/**
 * 使用 FlowContext 解析 admin-layout link 菜单的 URL 和查询参数。
 * @param options 解析所需参数
 * @returns 最终可跳转的 URL
 */
export declare const resolveAdminLayoutMenuLink: (options: {
    context: FlowModel['context'];
    href: string;
    params?: Array<{
        name: string;
        value: any;
    }>;
}) => Promise<string>;
export declare const openAdminLayoutMenuLink: (options: {
    context: FlowModel['context'];
    href: string;
    params?: any[];
    openInNewWindow?: boolean;
    isMobile?: boolean;
    closeMobileMenu: () => void;
    navigate: NavigateFunction;
    basenameOfCurrentRouter: string;
}) => Promise<void>;
export declare const MobileMenuControlContext: React.Context<{
    closeMobileMenu: () => void;
}>;
export declare const HeaderContext: React.Context<{
    inHeader: boolean;
}>;
/**
 * 根据当前选中的目标菜单，生成可用的 Move to 位置选项。
 */
export declare const getAdminLayoutMenuMovePositionOptions: (target: string | undefined, currentRouteId: string | number | undefined, t: (title: any) => any) => AdminLayoutMenuMovePositionOption[];
export declare function reconcileAdminLayoutMenuItems(parent: AdminLayoutMenuItemsParent, routes: NocoBaseDesktopRoute[], parentRoute?: NocoBaseDesktopRoute): void;
type AdminLayoutMenuDragMoveOptions = {
    sourceId: string | number;
    targetId?: string | number;
    targetScope?: {
        parentId: string | number;
    };
    sortField: 'sort';
    method?: 'insertAfter' | 'prepend';
};
export declare function resolveAdminLayoutMenuDragMoveOptions(activeModel?: FlowModel, overModel?: FlowModel): AdminLayoutMenuDragMoveOptions | undefined;
export declare function resolveAdminLayoutMenuDragMoveOptionsFromEvent(flowEngine: {
    getModel: (uid: string) => FlowModel | undefined;
}, event: {
    active?: {
        id?: string | number;
    };
    over?: {
        id?: string | number;
    } | null;
}): AdminLayoutMenuDragMoveOptions | undefined;
export declare const AdminLayoutMenuItemRenderer: FC<{
    item: AdminLayoutMenuNode;
    dom: React.ReactNode;
    options?: AdminLayoutMenuRenderOptions;
    renderType: AdminLayoutMenuRenderType;
}>;
export declare const shouldRenderIconInTitle: ({ depth, isMobile }: {
    depth: number;
    isMobile: boolean;
}) => boolean;
export declare const AdminLayoutMenuModelRenderer: FC<{
    model: FlowModel;
    item: AdminLayoutMenuNode;
    dom: React.ReactNode;
    renderType: AdminLayoutMenuRenderType;
    options?: AdminLayoutMenuRenderOptions;
}>;
export declare function getAdminLayoutMenuInitializerButton(testId: string, launcherModel: FlowModel, parentRoute?: NocoBaseDesktopRoute): AdminLayoutMenuNode;
export declare const buildMenuTitleWithIcon: (route: NocoBaseDesktopRoute, t: (title: any) => any, showIconInTitle: boolean) => {
    name: any;
    icon: React.JSX.Element;
};
export {};
