import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__ from "react/jsx-runtime";
import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
import * as __WEBPACK_EXTERNAL_MODULE__data_source_DataSourceProvider_mjs__ from "../data-source/DataSourceProvider.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__CollectionManagerProvider_mjs__ from "./CollectionManagerProvider.mjs";
const ExtendCollectionsContext = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react__.createContext)(null);
ExtendCollectionsContext.displayName = 'ExtendCollectionsContext';
const ExtendCollectionsProvider = (param)=>{
    let { children, collections } = param;
    const parentCollections = useExtendCollections();
    const extendCollections = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>parentCollections ? [
            ...parentCollections,
            ...collections
        ] : collections, [
        parentCollections,
        collections
    ]);
    const dataSource = (0, __WEBPACK_EXTERNAL_MODULE__data_source_DataSourceProvider_mjs__.useDataSourceKey)();
    return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(ExtendCollectionsContext.Provider, {
        value: extendCollections,
        children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__CollectionManagerProvider_mjs__.CollectionManagerProvider, {
            dataSource: dataSource,
            children: children
        })
    });
};
function useExtendCollections() {
    const context = (0, __WEBPACK_EXTERNAL_MODULE_react__.useContext)(ExtendCollectionsContext);
    return context;
}
export { ExtendCollectionsContext, ExtendCollectionsProvider, useExtendCollections };
