"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const React = require("react");
const mobx_react_1 = require("mobx-react");
const IndentComponent_1 = require("./boxes/IndentComponent");
const SelectComponent_1 = require("./boxes/SelectComponent");
const SvgComponent_1 = require("./boxes/SvgComponent");
const GridComponent_1 = require("./boxes/GridComponent");
const AliasComponent_1 = require("./boxes/AliasComponent");
const ListComponent_1 = require("./boxes/ListComponent");
const LabelComponent_1 = require("./boxes/LabelComponent");
const SelectableComponent_1 = require("./SelectableComponent");
const TextComponent_1 = require("./boxes/TextComponent");
const OptionalComponent_1 = require("./boxes/OptionalComponent");
exports.RenderBox = mobx_react_1.observer(({ box, editor }) => (React.createElement(SelectableComponent_1.SelectableComponent, { key: box.id, box: box, editor: editor }, renderComponent(box, editor))));
function renderComponent(box, editor) {
    switch (box.kind) {
        case "LabelBox":
            return React.createElement(LabelComponent_1.LabelComponent, { box: box, editor: editor });
        case "HorizontalListBox":
            return React.createElement(ListComponent_1.ListComponent, { box: box, editor: editor });
        case "VerticalPiElementListBox":
            return React.createElement(ListComponent_1.ListComponent, { box: box, editor: editor });
        case "VerticalListBox":
            return React.createElement(ListComponent_1.ListComponent, { box: box, editor: editor });
        case "TextBox":
            return React.createElement(TextComponent_1.TextComponent, { box: box, editor: editor });
        case "AliasBox":
            return React.createElement(AliasComponent_1.AliasComponent, { box: box, editor: editor });
        case "IndentBox":
            return React.createElement(IndentComponent_1.IndentComponent, { box: box, editor: editor });
        case "SelectBox":
            return React.createElement(SelectComponent_1.SelectComponent, { box: box, editor: editor });
        case "SvgBox":
            return React.createElement(SvgComponent_1.SvgComponent, { box: box, editor: editor });
        case "GridBox": {
            const callback = (box1, editor1) => React.createElement(exports.RenderBox, { box: box1, editor: editor1 });
            return React.createElement(GridComponent_1.GridComponent, { box: box, editor: editor, renderBoxCallback: callback });
        }
        case "OptionalBox":
            return React.createElement(OptionalComponent_1.OptionalComponent, { box: box, editor: editor });
        default:
            console.log("RenderComponent unknow box type: " + box);
    }
    return React.createElement("div", null,
        "Rendering unknown box of kind ",
        box.kind);
}
exports.renderComponent = renderComponent;
//# sourceMappingURL=Rendering.js.map