"use client";
import { jsx } from "react/jsx-runtime";
import { createContext, useContext, useMemo, useRef, useState } from "react";
const MarkdownModeContext = /*#__PURE__*/ createContext(null);
function MarkdownModeProvider({ children }) {
    const [isMarkdown, setIsMarkdown] = useState(false);
    const markdownModeRef = useRef(false);
    const value = useMemo(()=>({
            isMarkdown,
            setIsMarkdown,
            markdownModeRef
        }), [
        isMarkdown
    ]);
    return /*#__PURE__*/ jsx(MarkdownModeContext.Provider, {
        value: value,
        children: children
    });
}
function useMarkdownMode() {
    const ctx = useContext(MarkdownModeContext);
    if (null == ctx) throw new Error('useMarkdownMode must be used within a MarkdownModeProvider');
    return ctx;
}
export { MarkdownModeProvider, useMarkdownMode };
