import { jsx as _jsx } from "react/jsx-runtime";
import { createContext, useContext } from "react";
// ============================================================================
// Context
// ============================================================================
const SDKContext = createContext(undefined);
/**
 * Provider for GhostflowSDK access throughout the TUI.
 */
export const SDKProvider = ({ children, sdk }) => (_jsx(SDKContext.Provider, { value: sdk, children: children }));
// ============================================================================
// Hooks
// ============================================================================
/**
 * Hook to access the GhostflowSDK.
 * Must be used within an SDKProvider.
 *
 * @throws Error if used outside of SDKProvider
 */
export const useSDK = () => {
    const sdk = useContext(SDKContext);
    if (sdk === undefined) {
        throw new Error("useSDK must be used within SDKProvider");
    }
    return sdk;
};
//# sourceMappingURL=SDKContext.js.map