import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__ from "react/jsx-runtime";
import "react";
import * as __WEBPACK_EXTERNAL_MODULE_ahooks__ from "ahooks";
import * as __WEBPACK_EXTERNAL_MODULE__schema_component_core_index_mjs__ from "../schema-component/core/index.mjs";
const getKeyByName = (name)=>{
    if (!name) return 'tachybase_designable'.toUpperCase();
    return "tachybase_".concat(name, "_designable").toUpperCase();
};
const SchemaComponentProviderWithLocalStorageState = (props)=>{
    const [designable, setDesignable] = (0, __WEBPACK_EXTERNAL_MODULE_ahooks__.useLocalStorageState)(getKeyByName(props.appName), {
        defaultValue: !!props.designable || false
    });
    return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__schema_component_core_index_mjs__.SchemaComponentProvider, {
        ...props,
        designable: designable,
        onDesignableChange: (value)=>{
            setDesignable(value);
        }
    });
};
const AppSchemaComponentProvider = (props)=>{
    if ('boolean' == typeof props.designable) return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__schema_component_core_index_mjs__.SchemaComponentProvider, {
        ...props
    });
    return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(SchemaComponentProviderWithLocalStorageState, {
        ...props
    });
};
export { AppSchemaComponentProvider };
