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 __assign = (this && this.__assign) || function () {
    __assign = Object.assign || function(t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
            s = arguments[i];
            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
                t[p] = s[p];
        }
        return t;
    };
    return __assign.apply(this, arguments);
};
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 BlockBannerBoxesEcComponent = /** @class */ (function (_super) {
    __extends(BlockBannerBoxesEcComponent, _super);
    function BlockBannerBoxesEcComponent(blocksService, consts) {
        var _this = _super.call(this) || this;
        _this.blocksService = blocksService;
        _this.consts = consts;
        _this.big_ones = [0, 3, 4, 7, 8, 11, 12, 15, 16];
        _this.getImage = function (banner) { return _this.blocksService.getBannerImage(banner); };
        _this.formUrl = function (banner) { return _this.blocksService.formUrl(banner); };
        _this.columnSize = function (i) {
            if (!_this.consts.mobile()) {
                if (_this.big_ones.includes(i))
                    return 'col-md-8';
                else if (!((i + 1) == _this.banners.length))
                    return 'col-md-4';
                else if (((i + 1) == _this.banners.length) && _this.esImpar(i))
                    return 'col-md-4';
            }
            return 'col-md-12';
        };
        _this.esImpar = function (number) { return (number % 2) == 1; };
        _this.boxesInlcudesCode = function (box) { return _this.meta.code.toUpperCase().includes(box.toUpperCase()); };
        _this.ecOnConstruct();
        return _this;
    }
    BlockBannerBoxesEcComponent.prototype.ngOnInit = function () {
        var _this = this;
        this.banners = this.banners.map(function (banner) { return __assign(__assign({}, banner), banner.translations[_this.consts.getLocale()]); });
        this.meta = __assign(__assign({}, this.meta), this.meta.translations[this.consts.getLocale()]);
        this.ecOnInit();
    };
    BlockBannerBoxesEcComponent.ctorParameters = function () { return [
        { type: BlocksService },
        { type: Constants }
    ]; };
    __decorate([
        Input()
    ], BlockBannerBoxesEcComponent.prototype, "banners", void 0);
    __decorate([
        Input()
    ], BlockBannerBoxesEcComponent.prototype, "meta", void 0);
    BlockBannerBoxesEcComponent = __decorate([
        Component({
            selector: 'app-block-banner-boxes-ec',
            template: "<!-- <div class=\"row\">\n     <div class=\"col-12 mt-4 px-md-5\">\n          <div class=\"row\">\n               <ng-container *ngFor=\"let banner of banners; let i = index\">\n                    <div [class]=\"(columnSize(i)) + ' col-12 p-2'\">\n                         <div class=\"image-caption\">\n                              <a *ngIf=\"!(banner.redirectionType == 'url')\" [routerLink]=\"formUrl(banner)\"\n                                   class=\"text-decoration-none\">\n                                   <img [src]=\"consts.mediaBannerUrl() + getImage(banner)\" class=\"w-100\">\n                                   <div class=\"caption\">\n                                        <button>{{ banner.title }}</button>\n                                   </div>\n                              </a>\n                              <a *ngIf=\"banner.redirectionType == 'url'\" class=\"text-decoration-none\"\n                                   href=\"{{ banner.url }}\">\n                                   <img [src]=\"consts.mediaBannerUrl() + getImage(banner)\" class=\"w-100\">\n                                   <div class=\"caption\">\n                                        <button>{{ banner.title }}</button>\n                                   </div>\n                              </a>\n                         </div>\n                    </div>\n               </ng-container>\n          </div>\n     </div>\n</div> -->",
            styles: [""]
        })
    ], BlockBannerBoxesEcComponent);
    return BlockBannerBoxesEcComponent;
}(ComponentHelper));
export { BlockBannerBoxesEcComponent };
//# sourceMappingURL=data:application/json;base64, 