import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__ from "react/jsx-runtime";
import "react";
import * as __WEBPACK_EXTERNAL_MODULE__tachybase_schema__ from "@tachybase/schema";
import * as __WEBPACK_EXTERNAL_MODULE__application_index_mjs__ from "../../../application/index.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__schema_initializer_utils_mjs__ from "../../../schema-initializer/utils.mjs";
const AssociationFilterDesignerDisplayField = ()=>{
    const itemConfig = (0, __WEBPACK_EXTERNAL_MODULE__application_index_mjs__.useSchemaInitializerItem)();
    const { schema } = itemConfig;
    const { exists, remove } = (0, __WEBPACK_EXTERNAL_MODULE__schema_initializer_utils_mjs__.useCurrentSchema)(schema.name, 'name', itemConfig.find, itemConfig.remove);
    const { insert } = (0, __WEBPACK_EXTERNAL_MODULE__application_index_mjs__.useSchemaInitializer)();
    return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__application_index_mjs__.SchemaInitializerSwitch, {
        checked: exists,
        title: itemConfig.title,
        onClick: ()=>{
            var _itemConfig_schemaInitialize;
            if (exists) return remove();
            const s = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.merge)(schema || {}, itemConfig.schema || {});
            null == itemConfig || null === (_itemConfig_schemaInitialize = itemConfig.schemaInitialize) || void 0 === _itemConfig_schemaInitialize || _itemConfig_schemaInitialize.call(itemConfig, s);
            insert(s);
        }
    });
};
export { AssociationFilterDesignerDisplayField };
