import React, { useContext, useState } from "react";
export const C3SidebarStateContext = React.createContext(null);
export const C3SidebarStateProvider = ({ children, ...value }) => {
    const [isNotificationSidebarOpen, setIsNotificationSidebarOpen] = useState(value.isNotificationSidebarOpen || false);
    const [notificationScrollBarWidth, setNotificationScrollBarWidth] = useState(0);
    const [isOrgSidebarOpen, setIsOrgSidebarOpen] = useState(value.isOrgSidebarOpen || false);
    const [orgScrollBarWidth, setOrgScrollBarWidth] = useState(0);
    const [isInfoSidebarOpen, setIsInfoSidebarOpen] = useState(value.isInfoSidebarOpen || false);
    const [infoScrollBarWidth, setInfoScrollBarWidth] = useState(0);
    const [isUserSidebarOpen, setIsUserSidebarOpen] = useState(value.isUserSidebarOpen || false);
    const [userScrollBarWidth, setUserScrollBarWidth] = useState(0);
    return (React.createElement(C3SidebarStateContext.Provider, { value: {
            notifications: {
                isOpen: isNotificationSidebarOpen,
                setIsOpen: setIsNotificationSidebarOpen,
                scrollBarWidth: notificationScrollBarWidth,
                setScrollBarWidth: setNotificationScrollBarWidth,
            },
            org: {
                isOpen: isOrgSidebarOpen,
                setIsOpen: setIsOrgSidebarOpen,
                scrollBarWidth: orgScrollBarWidth,
                setScrollBarWidth: setOrgScrollBarWidth,
            },
            info: {
                isOpen: isInfoSidebarOpen,
                setIsOpen: setIsInfoSidebarOpen,
                scrollBarWidth: infoScrollBarWidth,
                setScrollBarWidth: setInfoScrollBarWidth,
            },
            user: {
                isOpen: isUserSidebarOpen,
                setIsOpen: setIsUserSidebarOpen,
                scrollBarWidth: userScrollBarWidth,
                setScrollBarWidth: setUserScrollBarWidth,
            },
        } }, children));
};
export const useSidebarState = () => {
    const value = useContext(C3SidebarStateContext);
    if (!value)
        throw new Error("No C3SidebarStateContextProvider found.");
    return value;
};
export const useNotificationSidebarState = () => useSidebarState().notifications;
export const useOrgSidebarState = () => useSidebarState().org;
export const useInfoSidebarState = () => useSidebarState().info;
export const useUserSidebarState = () => useSidebarState().user;
