import { jsx } from "react/jsx-runtime";
import "react";
import { useLocalStorageState } from "ahooks";
import { SchemaComponentProvider } 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] = useLocalStorageState(getKeyByName(props.appName), {
        defaultValue: !!props.designable
    });
    return /*#__PURE__*/ jsx(SchemaComponentProvider, {
        ...props,
        designable: designable,
        onDesignableChange: (value)=>{
            setDesignable(value);
        }
    });
};
const AppSchemaComponentProvider = (props)=>{
    if ('boolean' == typeof props.designable) return /*#__PURE__*/ jsx(SchemaComponentProvider, {
        ...props
    });
    return /*#__PURE__*/ jsx(SchemaComponentProviderWithLocalStorageState, {
        ...props
    });
};
export { AppSchemaComponentProvider };
