'use client';
import React, { createContext, useContext, useEffect, useState } from 'react';
import { useComponentMap } from '../ComponentMapProvider/index.js';
const ActionsContext = /*#__PURE__*/ createContext({
    actions: [],
    setViewActions: ()=>{}
});
export const useActions = ()=>useContext(ActionsContext);
export const ActionsProvider = ({ children })=>{
    const [viewActions, setViewActions] = useState([]);
    const [adminActions, setAdminActions] = useState([]);
    const { componentMap: { actions } } = useComponentMap();
    useEffect(()=>{
        setAdminActions(actions || []);
    }, [
        actions
    ]);
    const combinedActions = [
        ...viewActions || [],
        ...adminActions || []
    ];
    return /*#__PURE__*/ React.createElement(ActionsContext.Provider, {
        value: {
            actions: combinedActions,
            setViewActions
        }
    }, children);
};

//# sourceMappingURL=index.js.map