import { useTranslation } from "react-i18next";
import { useFormBlockContext } from "../../../block-provider/index.mjs";
import { useBaseVariable } from "./useBaseVariable.mjs";
const useFormVariable = (param)=>{
    let { collectionName, collectionField, schema, noDisabled, targetFieldSchema } = param;
    const { t } = useTranslation();
    const result = useBaseVariable({
        collectionField,
        uiSchema: schema,
        targetFieldSchema,
        maxDepth: 4,
        name: '$nForm',
        title: t('Current form'),
        collectionName: collectionName,
        noDisabled,
        returnFields: (fields, option)=>fields
    });
    return result;
};
const useCurrentFormVariable = function() {
    let { collectionField, schema, noDisabled, targetFieldSchema, form: _form } = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
    const { t } = useTranslation();
    const { form, collectionName } = useFormBlockContext();
    const currentFormSettings = useBaseVariable({
        collectionField,
        uiSchema: schema,
        targetFieldSchema,
        maxDepth: 4,
        name: '$nForm',
        title: t('Current form'),
        collectionName: collectionName,
        noDisabled,
        returnFields: (fields, option)=>fields
    });
    const formInstance = _form || form;
    return {
        currentFormSettings,
        currentFormCtx: null == formInstance ? void 0 : formInstance.values,
        shouldDisplayCurrentForm: formInstance && !formInstance.readPretty
    };
};
export { useCurrentFormVariable, useFormVariable };
