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";
const BlockInitializer = (props)=>{
    const { item, schema, ...others } = props;
    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__.SchemaInitializerItem, {
        ...others,
        onClick: ()=>{
            var _item_schemaInitialize, _props_onClick;
            const s = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.merge)(schema || {}, item.schema || {});
            null == item || null === (_item_schemaInitialize = item.schemaInitialize) || void 0 === _item_schemaInitialize || _item_schemaInitialize.call(item, s);
            insert(s);
            null === (_props_onClick = props.onClick) || void 0 === _props_onClick || _props_onClick.call(props, s);
        }
    });
};
const BlockItemInitializer = ()=>{
    const itemConfig = (0, __WEBPACK_EXTERNAL_MODULE__application_index_mjs__.useSchemaInitializerItem)();
    const { schema, ...others } = itemConfig;
    return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(BlockInitializer, {
        ...others,
        item: itemConfig
    });
};
export { BlockInitializer, BlockItemInitializer };
