import { jsx as _jsx } from "react/jsx-runtime";
// (C) 2025 GoodData Corporation
import { createContext, useContext, useState } from "react";
const ExportTabularPdfDialogContext = createContext(undefined);
/**
 * @internal
 */
export function ExportTabularPdfDialogContextProvider({ children }) {
    const [isOpen, setIsOpen] = useState(false);
    const [config, setConfig] = useState({});
    const openDialog = (newConfig) => {
        setConfig(newConfig);
        setIsOpen(true);
    };
    const closeDialog = () => {
        setIsOpen(false);
        // Keep config intact - it might be useful for reopening with same settings
    };
    const value = {
        isOpen,
        config,
        openDialog,
        closeDialog,
    };
    return (_jsx(ExportTabularPdfDialogContext.Provider, { value: value, children: children }));
}
/**
 * @internal
 */
export const useExportTabularPdfDialogContext = () => {
    const context = useContext(ExportTabularPdfDialogContext);
    if (!context) {
        throw new Error("useExportTabularPdfDialogContext must be used within ExportTabularPdfDialogContextProvider");
    }
    return context;
};
//# sourceMappingURL=ExportTabularPdfDialogContext.js.map