"use strict";
var __webpack_require__ = {};
(()=>{
    __webpack_require__.d = function(exports1, definition) {
        for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
            enumerable: true,
            get: definition[key]
        });
    };
})();
(()=>{
    __webpack_require__.o = function(obj, prop) {
        return Object.prototype.hasOwnProperty.call(obj, prop);
    };
})();
(()=>{
    __webpack_require__.r = function(exports1) {
        if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
            value: 'Module'
        });
        Object.defineProperty(exports1, '__esModule', {
            value: true
        });
    };
})();
var __webpack_exports__ = {};
__webpack_require__.r(__webpack_exports__);
__webpack_require__.d(__webpack_exports__, {
    default: ()=>demo3_rslib_entry_
});
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
require("react");
const client_namespaceObject = require("@tachybase/client");
const external_antd_namespaceObject = require("antd");
const mySettings = new client_namespaceObject.SchemaSettings({
    name: 'mySettings',
    items: [
        {
            name: 'remove',
            type: 'remove',
            componentProps: {
                removeParentsIfNoChildren: true
            }
        }
    ]
});
const myInitializer = new client_namespaceObject.SchemaInitializer({
    name: 'myInitializer',
    title: 'Button Text',
    wrap: client_namespaceObject.Grid.wrap,
    items: [
        {
            name: 'demo1',
            title: 'Demo1',
            Component: ()=>{
                const itemConfig = (0, client_namespaceObject.useSchemaInitializerItem)();
                const { insert } = (0, client_namespaceObject.useSchemaInitializer)();
                const handleClick = ()=>{
                    insert({
                        type: 'void',
                        'x-settings': 'mySettings',
                        'x-decorator': 'CardItem',
                        'x-component': 'Hello'
                    });
                };
                return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(client_namespaceObject.SchemaInitializerItem, {
                    title: itemConfig.title,
                    onClick: handleClick
                });
            }
        }
    ]
});
const Hello = ()=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("h1", {
        children: "Hello, world!"
    });
const Btn = ()=>{
    const { designable, setDesignable } = (0, client_namespaceObject.useSchemaComponentContext)();
    return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_antd_namespaceObject.Button, {
        style: {
            marginBottom: 24
        },
        onClick: ()=>{
            setDesignable(!designable);
        },
        children: [
            "designable: ",
            designable ? 'true' : 'false'
        ]
    });
};
const HelloPage = ()=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
        children: [
            /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(Btn, {}),
            /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(client_namespaceObject.SchemaComponent, {
                schema: {
                    name: 'hello',
                    type: 'void',
                    'x-component': 'Grid',
                    'x-initializer': 'myInitializer'
                }
            })
        ]
    });
class PluginHello extends client_namespaceObject.Plugin {
    async load() {
        this.app.addComponents({
            Grid: client_namespaceObject.Grid,
            CardItem: client_namespaceObject.CardItem,
            Hello
        });
        this.app.schemaSettingsManager.add(mySettings);
        this.app.schemaInitializerManager.add(myInitializer);
        this.router.add('hello', {
            path: '/',
            Component: HelloPage
        });
    }
}
const app = new client_namespaceObject.Application({
    router: {
        type: 'memory'
    },
    designable: true,
    plugins: [
        PluginHello
    ]
});
const demo3_rslib_entry_ = app.getRootComponent();
var __webpack_export_target__ = exports;
for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
    value: true
});
