/* eslint-disable fp/no-delete -- immer */
import { createContext } from "./react-immersive-history";
export var Panel;
(function (Panel) {
    Panel[Panel["Layout"] = 0] = "Layout";
    Panel[Panel["Navigation"] = 1] = "Navigation";
    Panel[Panel["Setting"] = 2] = "Setting";
})(Panel || (Panel = {}));
const initialEditorState = {
    activePanel: Panel.Navigation,
    rightPanel: { type: "page" },
    activeWindow: "preview",
    qoreDataConfig: {
        endpoint: "",
        adminSecret: "admin-secret",
    },
    screen: "large",
    editMode: null,
    showEmptyState: {},
    hasProduction: false,
    navbarPanel: {
        type: "sidetop",
        contentId: -1,
    },
};
const EditorContext = createContext(initialEditorState, (modify) => ({
    setActivePanel(panel) {
        modify((draft) => {
            draft.activePanel = panel;
        });
    },
    setRevisionID(revisionID) {
        modify((draft) => {
            draft.revisionID = revisionID;
            draft.ready = false;
        });
    },
    setActiveComponent(id) {
        modify((draft) => {
            draft.activeComponent = id;
        });
    },
    setActiveCategory(id) {
        modify((draft) => {
            draft.activeCategory = id;
        });
    },
    setRightPanel(name) {
        modify((draft) => {
            draft.rightPanel = name;
        });
    },
    setWindow(name) {
        modify((draft) => {
            draft.activeWindow = name;
        });
    },
    setReady(ready) {
        modify((draft) => {
            draft.ready = ready;
        });
    },
    setEditMode(mode) {
        modify((draft) => {
            draft.editMode = mode;
        });
    },
    setQoreDataConfig(config) {
        modify((draft) => {
            draft.qoreDataConfig = config;
        });
    },
    setScreen(screen) {
        modify((draft) => {
            draft.screen = screen;
        });
    },
    setShowEmptyState(id, show) {
        modify((draft) => {
            draft.showEmptyState[id] = show;
        });
    },
    setHasProduction(toggle) {
        modify((draft) => {
            draft.hasProduction = toggle;
        });
    },
    setNavbarPanel(content) {
        modify((draft) => {
            draft.navbarPanel = content;
        });
    },
}));
export default EditorContext;
//# sourceMappingURL=EditorContext.js.map