/** 子面板类型标记，用于识别 memo / forwardRef 包裹后的组件 */ export var WORKSPACE_PANEL_TYPE = Symbol.for('@ant-design/agentic-ui/workspace-panel-type');
/** Segmented 首个「实时跟随」后的占位分隔项，禁止作为业务 tab key */ export var WORKSPACE_SEGMENTED_DIVIDER_KEY = '__divider__';
var MAX_PANEL_TYPE_WALK_DEPTH = 32;
export var isWorkspacePanelType = function isWorkspacePanelType(value) {
    return value === 'realtime' || value === 'browser' || value === 'task' || value === 'file' || value === 'fileTree' || value === 'custom';
};
/** 归一化标签 key，避免 `null` / 空白字符串参与比较 */ export var normalizeTabKey = function normalizeTabKey(key) {
    if (key === null || key === undefined) {
        return '';
    }
    return String(key).trim();
};
export var isWorkspaceSegmentedDividerKey = function isWorkspaceSegmentedDividerKey(key) {
    return normalizeTabKey(key) === WORKSPACE_SEGMENTED_DIVIDER_KEY;
};
export function markWorkspacePanel(component, panelType) {
    if (component === null || component === undefined) {
        return component;
    }
    if (!isWorkspacePanelType(panelType)) {
        return component;
    }
    component[WORKSPACE_PANEL_TYPE] = panelType;
    return component;
}
/**
 * 从 React 元素 type 链（含 memo / forwardRef 外层）解析内置子面板类型
 */ export function resolveWorkspacePanelType(type) {
    var visited = new Set();
    var current = type;
    var depth = 0;
    while(current && !visited.has(current) && depth < MAX_PANEL_TYPE_WALK_DEPTH){
        visited.add(current);
        depth += 1;
        var marked = current[WORKSPACE_PANEL_TYPE];
        if (isWorkspacePanelType(marked)) {
            return marked;
        }
        current = current.type;
    }
    return undefined;
}
export var isFileWorkspacePanel = function isFileWorkspacePanel(panelType) {
    return panelType === 'file' || panelType === 'fileTree';
};
