/*
 * Copyright (c) 2023-2025 Datalayer, Inc.
 * Distributed under the terms of the Modified BSD License.
 */
import { createStore } from 'zustand/vanilla';
import { useStore } from 'zustand';
import { coreStore } from './substates/CoreState.js';
import { cellStore } from './substates/CellState.js';
import { documentStore } from './substates/DocumentState.js';
import { gradeStore } from './substates/GradeState.js';
import { iamStore } from './substates/IAMState.js';
import { runtimesStore } from './substates/RuntimesState.js';
import { layoutStore } from './substates/LayoutState.js';
import { nbformatStore } from './substates/NbformatState.js';
import { organizationStore } from './substates/OrganizationState.js';
import { spaceStore } from './substates/SpaceState.js';
import { surveysStore } from './substates/SurveysState.js';
import { teamStore } from './substates/TeamState.js';
import { isDevDeployment } from '../utils/index.js';
export const runStore = createStore((set, get) => ({
    version: '',
    setVersion: version => {
        if (version && !get().version) {
            set(state => ({ version }));
        }
    },
    isDev: isDevDeployment(),
    core: coreStore.getState,
    cell: cellStore.getState,
    document: documentStore.getState,
    grade: gradeStore.getState,
    iam: iamStore.getState,
    runtimes: runtimesStore.getState,
    layout: layoutStore.getState,
    nbformat: nbformatStore.getState,
    organization: organizationStore.getState,
    space: spaceStore.getState,
    success: surveysStore.getState,
    team: teamStore.getState,
}));
export function useRunStore(selector) {
    return useStore(runStore, selector);
}
export default useRunStore;
