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';
let BlocksEcComponent = class BlocksEcComponent extends ComponentHelper {
    constructor(blocksService, consts) {
        super();
        this.blocksService = blocksService;
        this.consts = consts;
        this.strsection = null;
        this.show_loading = true;
        this.getHTMLContent = (block) => block.translations[this.consts.getLocale()].content;
        this.isNewsletter = (block) => block.code.includes('news');
        this.ecOnConstruct();
    }
    set section(paramsstrsection) {
        this.strsection = paramsstrsection;
        this.strsection && this.blocksService.getBlocks(this.strsection);
    }
    ngOnInit() {
        // this.blocksService.getBlocks(this.section);
        this.ecOnInit();
    }
};
BlocksEcComponent.ctorParameters = () => [
    { 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);
export { BlocksEcComponent };
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmxvY2tzLWVjLmNvbXBvbmVudC5qcyIsInNvdXJjZVJvb3QiOiJuZzovL25nLWVhc3ljb21tZXJjZS8iLCJzb3VyY2VzIjpbImxpYi9lYy1jb21wb25lbnQvYmxvY2tzLWVjL2Jsb2Nrcy1lYy5jb21wb25lbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7O0FBQUEsT0FBTyxFQUFFLFNBQVMsRUFBRSxLQUFLLEVBQVUsTUFBTSxlQUFlLENBQUM7QUFDekQsT0FBTyxFQUFFLGVBQWUsRUFBRSxNQUFNLGdDQUFnQyxDQUFDO0FBQ2pFLE9BQU8sRUFBRSxTQUFTLEVBQUUsTUFBTSxtQkFBbUIsQ0FBQztBQUU5QyxPQUFPLEVBQUUsYUFBYSxFQUFFLE1BQU0sc0NBQXNDLENBQUM7QUFRckU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