import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
import * as __WEBPACK_EXTERNAL_MODULE__tachybase_schema__ from "@tachybase/schema";
import * as __WEBPACK_EXTERNAL_MODULE__collection_manager_index_mjs__ from "../../collection-manager/index.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__useCompile_mjs__ from "./useCompile.mjs";
const useFieldTitle = ()=>{
    var _collectionField_uiSchema;
    const field = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.useField)();
    const fieldSchema = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.useFieldSchema)();
    const { getField } = (0, __WEBPACK_EXTERNAL_MODULE__collection_manager_index_mjs__.useCollection_deprecated)();
    const { getCollectionJoinField } = (0, __WEBPACK_EXTERNAL_MODULE__collection_manager_index_mjs__.useCollectionManager_deprecated)();
    const collectionField = getField(fieldSchema['name']) || getCollectionJoinField(fieldSchema['x-collection-field']);
    const compile = (0, __WEBPACK_EXTERNAL_MODULE__useCompile_mjs__.useCompile)();
    (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
        if (!(null == field ? void 0 : field.title)) {
            var _collectionField_uiSchema;
            field.title = compile(null == collectionField ? void 0 : null === (_collectionField_uiSchema = collectionField.uiSchema) || void 0 === _collectionField_uiSchema ? void 0 : _collectionField_uiSchema.title);
        }
    }, [
        null == collectionField ? void 0 : null === (_collectionField_uiSchema = collectionField.uiSchema) || void 0 === _collectionField_uiSchema ? void 0 : _collectionField_uiSchema.title
    ]);
};
export { useFieldTitle };
