import * as __WEBPACK_EXTERNAL_MODULE__tachybase_schema__ from "@tachybase/schema";
import * as __WEBPACK_EXTERNAL_MODULE_lodash__ from "lodash";
import * as __WEBPACK_EXTERNAL_MODULE__schema_component_index_mjs__ from "../../schema-component/index.mjs";
function getNewSchema(options) {
    const { fieldSchema, schemaKey, parentSchemaKey, value, valueKeys } = options;
    if (schemaKey) __WEBPACK_EXTERNAL_MODULE_lodash__["default"].set(fieldSchema, schemaKey, value);
    else if (parentSchemaKey) {
        if (void 0 === value) return fieldSchema;
        if ('object' == typeof value) Object.keys(value).forEach((key)=>{
            if (valueKeys && !valueKeys.includes(key)) return;
            __WEBPACK_EXTERNAL_MODULE_lodash__["default"].set(fieldSchema, "".concat(parentSchemaKey, ".").concat(key), value[key]);
        });
        else console.error('value must be object');
    }
    return fieldSchema;
}
const useHookDefault = (defaultValues)=>defaultValues;
const useSchemaByType = function() {
    let type = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 'common';
    const schema = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.useFieldSchema)();
    const { fieldSchema: tableColumnSchema } = (0, __WEBPACK_EXTERNAL_MODULE__schema_component_index_mjs__.useColumnSchema)() || {};
    return 'field' === type ? tableColumnSchema || schema : schema;
};
export { getNewSchema, useHookDefault, useSchemaByType };
