// (C) 2025-2026 GoodData Corporation
/**
 * Identifier used for dashboards without explicit tabs support and the first tab created automatically.
 *
 * @internal
 */
export const DEFAULT_TAB_ID = "defaultTabId";
export const getActiveTab = (state) => {
    if (!state.tabs || !state.activeTabLocalIdentifier) {
        return;
    }
    return state.tabs.find((tab) => tab.localIdentifier === state.activeTabLocalIdentifier);
};
/**
 * Gets a tab by its local identifier, or the active tab if no identifier is provided.
 *
 * @param state - The tabs state
 * @param tabLocalIdentifier - Optional tab local identifier. If not provided, returns the active tab.
 * @returns The tab state or undefined if not found
 *
 * @internal
 */
export const getTabOrActive = (state, tabLocalIdentifier) => {
    if (!state.tabs) {
        return;
    }
    if (tabLocalIdentifier) {
        return state.tabs.find((tab) => tab.localIdentifier === tabLocalIdentifier);
    }
    return getActiveTab(state);
};
export const tabsInitialState = {
    tabs: undefined,
    activeTabLocalIdentifier: undefined,
    attributesWithReferences: undefined,
};
//# sourceMappingURL=tabsState.js.map