import Renderables from '../Renderables';
/**
 * Implementation of the 'container' type markup element.
 * The container markup element is always the top element
 * of each process step.
 *
 * A div HTML element is created and the class lto-container
 * is added to allow CSS manipulations. Additionally, if the
 * rendered markup elements contains the class lto-suggestions
 * a suggestion element is crated.
 *
 * @see {@link Suggestion}
 * @see {@link IRenderable}
 */
var Container = /** @class */ (function () {
    function Container(message) {
        this.spec = message;
    }
    /**
     * @inheritDoc
     */
    Container.prototype.render = function (renderer, isNested) {
        var div = document.createElement("div");
        div.classList.add("lto-container");
        var elements = (this.spec.elements || []).map(function (e) { return renderer.render(e); });
        elements.forEach(function (e) { return e.forEach(function (x) { return div.appendChild(x); }); });
        var suggestions = div.querySelectorAll(".lto-suggestion");
        suggestions.forEach(function (suggestion) {
            div.removeChild(suggestion);
            renderer.appendSuggest(suggestion);
        });
        return div;
    };
    return Container;
}());
export { Container };
Renderables.register("container", Container);
//# sourceMappingURL=index.js.map