var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
import { Component, Input } from '@angular/core';
import { ComponentHelper } from '../../classes/component-helper';
import { Constants } from '../../core.consts';
import { BlocksService } from '../../services/blocks/blocks.service';
var BlocksEcComponent = /** @class */ (function (_super) {
    __extends(BlocksEcComponent, _super);
    function BlocksEcComponent(blocksService, consts) {
        var _this = _super.call(this) || this;
        _this.blocksService = blocksService;
        _this.consts = consts;
        _this.strsection = null;
        _this.show_loading = true;
        _this.getHTMLContent = function (block) { return block.translations[_this.consts.getLocale()].content; };
        _this.isNewsletter = function (block) { return block.code.includes('news'); };
        _this.ecOnConstruct();
        return _this;
    }
    Object.defineProperty(BlocksEcComponent.prototype, "section", {
        set: function (paramsstrsection) {
            this.strsection = paramsstrsection;
            this.strsection && this.blocksService.getBlocks(this.strsection);
        },
        enumerable: true,
        configurable: true
    });
    BlocksEcComponent.prototype.ngOnInit = function () {
        // this.blocksService.getBlocks(this.section);
        this.ecOnInit();
    };
    BlocksEcComponent.ctorParameters = function () { return [
        { type: BlocksService },
        { type: Constants }
    ]; };
    __decorate([
        Input()
    ], BlocksEcComponent.prototype, "section", null);
    __decorate([
        Input()
    ], BlocksEcComponent.prototype, "show_loading", void 0);
    BlocksEcComponent = __decorate([
        Component({
            selector: 'app-blocks-ec',
            template: "<div *ngIf=\"blocksService.blocks | async as blocks\">\n    <div *ngIf=\"blocks\">\n        <div *ngIf=\"blocks.length >= 1; else loading\">\n            <div *ngFor=\"let block of blocks\">\n                <div [ngSwitch]=\"block.contentType\">\n                    <div *ngSwitchCase=\"'banner'\">\n                        <app-block-banner-full-ec *ngIf=\"block.design == 'full'\" [banners]=\"block.banners\"\n                            [meta]=\"block\">\n                        </app-block-banner-full-ec>\n                        <app-block-banner-boxes-ec *ngIf=\"block.design == 'boxes'\" [banners]=\"block.banners\"\n                            [meta]=\"block\">\n                        </app-block-banner-boxes-ec>\n                    </div>\n                    <app-block-html-ec *ngSwitchCase=\"'html'\" [html_content]=\"getHTMLContent(block)\">\n                    </app-block-html-ec>\n                    <app-block-products-ec *ngSwitchCase=\"'products'\" [products]=\"block.products.items\" [meta]=\"block\">\n                    </app-block-products-ec>\n                    <div *ngSwitchCase=\"'contact_form'\">\n                        <app-contact-form-news-ec [block]=\"block.contactForm\"\n                            *ngIf=\"isNewsletter(block); else completeForm\">\n                        </app-contact-form-news-ec>\n                        <ng-template #completeForm>\n                            <app-block-form-contact-ec [block]=\"block.contactForm\"></app-block-form-contact-ec>\n                        </ng-template>\n                    </div>\n                </div>\n            </div>\n        </div>\n        <ng-template #loading>\n            <div *ngIf=\"show_loading\">\n                <div class=\"loading-container\">\n                    <app-loading-full-ec [hole_height]=\"true\"></app-loading-full-ec>\n                </div>\n            </div>\n        </ng-template>\n    </div>\n</div>",
            providers: [BlocksService],
            styles: [""]
        })
    ], BlocksEcComponent);
    return BlocksEcComponent;
}(ComponentHelper));
export { BlocksEcComponent };
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmxvY2tzLWVjLmNvbXBvbmVudC5qcyIsInNvdXJjZVJvb3QiO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