import { createContext, useContext, useMemo } from "react";
const NodeRegistryContext = createContext(null);
const useNodeTypeRegistry = ()=>{
    const context = useContext(NodeRegistryContext);
    if (!context) throw new Error('useNodeTypeRegistry must be used within a NodeRegistryProvider');
    return context.registry;
};
const useOptionalNodeTypeRegistry = ()=>{
    const context = useContext(NodeRegistryContext);
    return context?.registry ?? null;
};
const useNodeManifests = ()=>{
    const registry = useNodeTypeRegistry();
    return useMemo(()=>registry.getAllManifests(), [
        registry
    ]);
};
const useNodeManifest = (nodeType)=>{
    const registry = useNodeTypeRegistry();
    return useMemo(()=>registry.getManifest(nodeType), [
        registry,
        nodeType
    ]);
};
export { NodeRegistryContext, useNodeManifest, useNodeManifests, useNodeTypeRegistry, useOptionalNodeTypeRegistry };
