import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__ from "react/jsx-runtime";
import "react";
import * as __WEBPACK_EXTERNAL_MODULE_react_i18next__ from "react-i18next";
import * as __WEBPACK_EXTERNAL_MODULE__application_schema_initializer_components_SchemaInitializerChildren_mjs__ from "../../../../application/schema-initializer/components/SchemaInitializerChildren.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__application_schema_initializer_SchemaInitializer_mjs__ from "../../../../application/schema-initializer/SchemaInitializer.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__schema_component_index_mjs__ from "../../../../schema-component/index.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__schema_initializer_utils_mjs__ from "../../../../schema-initializer/utils.mjs";
const ParentCollectionFields = ()=>{
    const inheritFields = (0, __WEBPACK_EXTERNAL_MODULE__schema_initializer_utils_mjs__.useInheritsFormItemInitializerFields)();
    const { t } = (0, __WEBPACK_EXTERNAL_MODULE_react_i18next__.useTranslation)();
    const compile = (0, __WEBPACK_EXTERNAL_MODULE__schema_component_index_mjs__.useCompile)();
    if (!(null == inheritFields ? void 0 : inheritFields.length)) return null;
    const res = [];
    inheritFields.forEach((inherit)=>{
        Object.values(inherit)[0].length && res.push({
            type: 'itemGroup',
            divider: true,
            title: t("Parent collection fields") + '(' + compile("".concat(Object.keys(inherit)[0])) + ')',
            children: Object.values(inherit)[0]
        });
    });
    return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__application_schema_initializer_components_SchemaInitializerChildren_mjs__.SchemaInitializerChildren, {
        children: res
    });
};
const AssociatedFields = ()=>{
    const associationFields = (0, __WEBPACK_EXTERNAL_MODULE__schema_initializer_utils_mjs__.useAssociatedFormItemInitializerFields)({
        readPretty: true,
        block: 'Form'
    });
    const { t } = (0, __WEBPACK_EXTERNAL_MODULE_react_i18next__.useTranslation)();
    if (0 === associationFields.length) return null;
    const schema = [
        {
            type: 'itemGroup',
            title: t('Display association fields'),
            children: associationFields
        }
    ];
    return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__application_schema_initializer_components_SchemaInitializerChildren_mjs__.SchemaInitializerChildren, {
        children: schema
    });
};
const readPrettyFormItemInitializers = new __WEBPACK_EXTERNAL_MODULE__application_schema_initializer_SchemaInitializer_mjs__.SchemaInitializer({
    name: 'details:configureFields',
    wrap: __WEBPACK_EXTERNAL_MODULE__schema_initializer_utils_mjs__.gridRowColWrap,
    icon: 'SettingOutlined',
    title: '{{t("Configure fields")}}',
    items: [
        {
            type: 'itemGroup',
            name: 'displayFields',
            title: '{{t("Display fields")}}',
            useChildren: __WEBPACK_EXTERNAL_MODULE__schema_initializer_utils_mjs__.useFormItemInitializerFields
        },
        {
            name: 'parentCollectionFields',
            Component: ParentCollectionFields
        },
        {
            name: 'associationFields',
            Component: AssociatedFields
        },
        {
            name: 'divider',
            type: 'divider'
        },
        {
            name: 'addText',
            title: '{{t("Add text")}}',
            Component: 'BlockItemInitializer',
            schema: {
                type: 'void',
                'x-editable': false,
                'x-decorator': 'FormItem',
                'x-toolbar': 'BlockSchemaToolbar',
                'x-settings': 'blockSettings:markdown',
                'x-component': 'Markdown.Void',
                'x-component-props': {
                    content: '{{t("This is a demo text, **supports Markdown syntax**.")}}'
                }
            }
        }
    ]
});
export { readPrettyFormItemInitializers };
