import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__ from "react/jsx-runtime";
import "react";
import * as __WEBPACK_EXTERNAL_MODULE__tachybase_client__ from "@tachybase/client";
import * as __WEBPACK_EXTERNAL_MODULE__testUtils_index_mjs__ from "../../../../testUtils/index.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__collections_mjs__ from "./collections.mjs";
const { apiClient, mockRequest } = (0, __WEBPACK_EXTERNAL_MODULE__testUtils_index_mjs__.mockAPIClient)();
mockRequest.onGet('/users:get').reply(200, {
    data: {
        id: 1,
        nickname: '张三',
        password: '123456'
    }
});
mockRequest.onGet('/auth:check').reply(()=>[
        200,
        {
            data: {}
        }
    ]);
const schema = {
    type: 'object',
    properties: {
        block: {
            type: 'void',
            'x-decorator': 'FormBlockProvider',
            'x-decorator-props': {
                collection: 'users',
                resource: 'users',
                action: 'get'
            },
            properties: {
                form: {
                    type: 'void',
                    'x-component': 'FormV2',
                    'x-read-pretty': true,
                    'x-use-component-props': 'useFormBlockProps',
                    properties: {
                        grid: {
                            type: 'void',
                            'x-component': 'Grid',
                            properties: {
                                row1: {
                                    type: 'void',
                                    'x-component': 'Grid.Row',
                                    properties: {
                                        col11: {
                                            type: 'void',
                                            'x-component': 'Grid.Col',
                                            properties: {
                                                nickname: {
                                                    type: 'string',
                                                    'x-decorator': 'FormItem',
                                                    'x-designer': 'FormItem.Designer',
                                                    'x-component': 'CollectionField'
                                                }
                                            }
                                        },
                                        col12: {
                                            type: 'void',
                                            'x-component': 'Grid.Col',
                                            properties: {
                                                password: {
                                                    type: 'string',
                                                    'x-decorator': 'FormItem',
                                                    'x-designer': 'FormItem.Designer',
                                                    'x-component': 'CollectionField'
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
};
const Demo = ()=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__tachybase_client__.CurrentUserProvider, {
        children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__tachybase_client__.BlockSchemaComponentProvider, {
            children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__tachybase_client__.SchemaComponent, {
                schema: schema
            })
        })
    });
class MyPlugin extends __WEBPACK_EXTERNAL_MODULE__tachybase_client__.Plugin {
    async load() {
        this.app.dataSourceManager.addDataSource(__WEBPACK_EXTERNAL_MODULE__tachybase_client__.LocalDataSource, {
            key: __WEBPACK_EXTERNAL_MODULE__tachybase_client__.DEFAULT_DATA_SOURCE_KEY,
            displayName: __WEBPACK_EXTERNAL_MODULE__tachybase_client__.DEFAULT_DATA_SOURCE_TITLE,
            collections: __WEBPACK_EXTERNAL_MODULE__collections_mjs__["default"]
        });
    }
}
const app = new __WEBPACK_EXTERNAL_MODULE__tachybase_client__.Application({
    apiClient,
    plugins: [
        __WEBPACK_EXTERNAL_MODULE__tachybase_client__.CollectionPlugin,
        MyPlugin
    ],
    components: {
        FormBlockProvider: __WEBPACK_EXTERNAL_MODULE__tachybase_client__.FormBlockProvider,
        FormItem: __WEBPACK_EXTERNAL_MODULE__tachybase_client__.FormItem,
        CollectionField: __WEBPACK_EXTERNAL_MODULE__tachybase_client__.CollectionField,
        Input: __WEBPACK_EXTERNAL_MODULE__tachybase_client__.Input,
        Action: __WEBPACK_EXTERNAL_MODULE__tachybase_client__.Action,
        FormV2: __WEBPACK_EXTERNAL_MODULE__tachybase_client__.FormV2,
        Password: __WEBPACK_EXTERNAL_MODULE__tachybase_client__.Password,
        Grid: __WEBPACK_EXTERNAL_MODULE__tachybase_client__.Grid
    },
    providers: [
        Demo
    ]
});
const demo3_rslib_entry_ = app.getRootComponent();
export { demo3_rslib_entry_ as default };
