'use client';
import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
import React, { createContext, use } from 'react';
const Context = /*#__PURE__*/ createContext({
    isCollapsed: undefined,
    isVisible: undefined,
    isWithinCollapsible: undefined,
    toggle: ()=>{}
});
export const CollapsibleProvider = ({ children, isCollapsed, isWithinCollapsible = true, toggle })=>{
    const { isCollapsed: parentIsCollapsed, isVisible } = useCollapsible();
    const contextValue = React.useMemo(()=>{
        return {
            isCollapsed,
            isVisible: isVisible && !parentIsCollapsed,
            isWithinCollapsible,
            toggle
        };
    }, [
        isCollapsed,
        isWithinCollapsible,
        toggle,
        parentIsCollapsed,
        isVisible
    ]);
    return /*#__PURE__*/ _jsxDEV(Context, {
        value: contextValue,
        children: children
    }, void 0, false, {
        fileName: "src/elements/Collapsible/provider.tsx",
        lineNumber: 35,
        columnNumber: 10
    }, this);
};
export const useCollapsible = ()=>use(Context);

//# sourceMappingURL=provider.js.map