import Renderables from '../Renderables';
/**
 * Implementation of the 'slotMachine' markup element.
 * A HTML div element where multiple 'reel' elements can be displayed.
 * The class lto-slotmachine is added to allow CSS manipulations.
 *
 * @see {@link IRenderable}
 * @see {@link IStackeable}
 */
var SlotMachine = /** @class */ (function () {
    function SlotMachine(spec) {
        this.spec = spec;
    }
    /**
     * @inheritDoc
     */
    SlotMachine.prototype.render = function (renderer, isNested) {
        var _this = this;
        var position = this.spec.position || 'left';
        var slotMachine = document.createElement("div");
        slotMachine.classList.add('lto-slotmachine', "lto-" + position);
        if (this.spec.id !== undefined) {
            slotMachine.id = this.spec.id;
        }
        if (this.spec.class !== undefined) {
            this.spec.class.split(" ").forEach(function (e) { return slotMachine.classList.add(e); });
        }
        var elements = (this.spec.elements || []).map(function (e) { return renderer.render(e, _this); });
        elements.forEach(function (e) { return e.forEach(function (x) { return slotMachine.appendChild(x); }); });
        if (isNested) {
            slotMachine.classList.add('lto-nested');
        }
        return slotMachine;
    };
    return SlotMachine;
}());
export { SlotMachine };
Renderables.register("slotmachine", SlotMachine);
//# sourceMappingURL=index.js.map