import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__ from "react/jsx-runtime";
import * as __WEBPACK_EXTERNAL_MODULE__application_schema_initializer_index_mjs__ from "../../../application/schema-initializer/index.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__utils_index_mjs__ from "../utils/index.mjs";
const ParentCollectionFields = (props)=>{
    const context = (0, __WEBPACK_EXTERNAL_MODULE__utils_index_mjs__.useCollectionFieldContext)();
    const { collection, t, collectionManager } = context;
    const parentCollectionNames = collection.getParentCollectionsName();
    if (!parentCollectionNames.length) return null;
    const children = parentCollectionNames.map((parentCollectionName)=>{
        const parentCollectionFields = collection.getParentCollectionFields(parentCollectionName);
        if (0 === parentCollectionFields.length) return null;
        const parentCollection = collectionManager.getCollection(parentCollectionName);
        return {
            parentCollection,
            parentCollectionFields
        };
    }).filter(Boolean).map((options)=>{
        const { parentCollection, parentCollectionFields } = options;
        const newContext = {
            ...context,
            collection: parentCollection
        };
        return {
            type: 'itemGroup',
            divider: true,
            title: t("Parent collection fields") + '(' + context.compile(parentCollection.title) + ')',
            children: (0, __WEBPACK_EXTERNAL_MODULE__utils_index_mjs__.getInitializerItemsByFields)(props, parentCollectionFields, newContext)
        };
    });
    return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__application_schema_initializer_index_mjs__.SchemaInitializerChildren, {
        children: children
    });
};
export { ParentCollectionFields };
