import { Component, Input } from '@angular/core';
import { CommonModule } from '@angular/common';
import { BackgroundDirective } from '../../directive/background-directive';
import { AnimationDirective } from '../../directive/animation-directive';
import { BorderDirective } from '../../directive/border-directive';
import { ContentFitDirective } from '../../directive/content-fit-directive';
import { ImageDirectiveDirective } from '../../directive/image-directive.directive';
import { CornerDirective } from '../../directive/corner-directive';
import { ColumnDirectiveDirective } from '../../directive/column-directive.directive';
import { OverlayDirective } from '../../directive/overlay-directive';
import { ContentTitleDirective } from '../../directive/content-title-spacing.directive';
import { MatIcon } from '@angular/material/icon';
import BaseSection from '../BaseSection';
import { HoverElementsComponent } from "../../components/hover-elements/hover-elements.component";
import { HoverDirective } from '../../directive/hover-element-directive';
import { SvgDividerComponent } from '../../elements/svg-divider/svg-divider.component';
import { SpacingHorizontalDirective } from '../../directive/spacing-horizontal.directive';
import { RouterLink } from "@angular/router";
import * as i0 from "@angular/core";
import * as i1 from "../../services/events.service";
import * as i2 from "@angular/common";
export class BlogListComponent extends BaseSection {
    constructor(_eventService) {
        super();
        this._eventService = _eventService;
        this.responseData = [];
    }
    ngOnInit() {
        for (let blog of this.responseData) {
            console.log(blog);
            blog['img'] = blog.blocks.find((x) => x.type === 'image')?.data?.file?.url;
            if (blog?.keyWords?.content?.length > 0)
                blog['tags'] = blog?.keyWords?.content?.split(',') || [];
            console.log(blog['tags']);
        }
        this.style = this.data?.styles;
        this.blogContent = this.data?.content;
    }
    get headingSpace() {
        return this.style?.layout?.headingSpacing;
    }
    get stylesLayout() {
        return { ...this.style?.layout };
    }
    getBlogById(blogId) {
        this._eventService.blogByIdEvent.emit(blogId);
    }
    editSection() {
        if (window.innerWidth <= 475)
            return;
        this._eventService.toggleEditorEvent.emit(false);
        setTimeout(() => {
            this._eventService.editSection.emit({ data: this.data });
        }, 100);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: BlogListComponent, deps: [{ token: i1.EventsService }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: BlogListComponent, isStandalone: true, selector: "simpo-blog-list", inputs: { responseData: "responseData", index: "index", edit: "edit", customClass: "customClass", data: "data", nextComponentColor: "nextComponentColor" }, usesInheritance: true, ngImport: i0, template: "<section [id]=\"data?.id\" [simpoBackground]=\"style?.background\" class=\"total-container\" simpoHover\r\n  (hovering)=\"showEditTabs($event)\" *ngIf=\"(responseData?.length || 0) > 0;else elseBlock\" [attr.style]=\"customClass\">\r\n  <div [id]=\"data?.id\" [simpoOverlay]=\"style?.background\" [simpoBorder]=\"style?.border\"\r\n    [simpoAnimation]=\"style?.animation\" [simpoLayout]=\"style?.layout\">\r\n    <div class=\"container-fluid\" [spacingHorizontal]=\"stylesLayout\">\r\n      <div class=\"row gap-20\">\r\n        <div [simpoColumnDirective]=\"data?.styles?.size\" [id]=\"data?.id\" *ngFor=\"let content of responseData\"\r\n          class=\"d-flex\">\r\n          <a [routerLink]=\"['/blog', content.newPostTitle]\" (click)=\"getBlogById(content.articleSlug)\">\r\n            <div class=\"cards h-100\" [simpoCorner]=\"style?.corners\" [id]=\"data?.id\">\r\n              <img loading=\"lazy\" [src]=\"content.img\" [simpoImageDirective]=\"style?.image\" [id]=\"data?.id\"\r\n                [simpoCorner]=\"style?.corners\" alt=\"\" *ngIf=\"content.img\" loading=\"lazy\">\r\n              <img loading=\"lazy\" [simpoImageDirective]=\"style?.image\" [id]=\"data?.id\" [simpoCorner]=\"style?.corners\"\r\n                src=\"https://dev-beeos.s3.amazonaws.com/library-media/541329c1719236963199pexels-pixabay-262508.jpg\"\r\n                alt=\"\" *ngIf=\"!content.img\" loading=\"lazy\">\r\n              <div class=\"p-30\">\r\n                <!-- <div class=\"d-flex flex-wrap align-items-center gap-2\">\r\n                  <ng-container *ngFor=\"let tag of content?.tags | slice:0:4\">\r\n                    <p class=\"mb-0 p-2 border\">{{ tag }}</p>\r\n                  </ng-container>\r\n                </div> -->\r\n                <div class=\"heading-medium title mt-2 fs-20\" *ngIf=\"blogContent?.display?.showHeading\">\r\n                  {{content.postTitle.length > 100 ? content.postTitle.substring(0,100)+'...\"' : content.postTitle}}\r\n                  <!-- {{content.postTitle}} -->\r\n                </div>\r\n                <ng-container>\r\n                  <div class=\"body-large mt-4 pb-15\" *ngIf=\"blogContent?.display?.showContent\">\r\n                    {{ content.postSummary.length > 250 ? content.postSummary.substring(0, 250) + '...' :\r\n                    content.postSummary }}\r\n                  </div>\r\n                </ng-container>\r\n\r\n                <div class=\"d-flex justify-content-end p-2 align-items-center\" *ngIf=\"content?.author?.content && content?.author?.content.length > 0\">\r\n                  <p>- {{content?.author?.content | titlecase}}</p>\r\n                </div>\r\n\r\n                <!-- <div class=\"authors\" [ngClass]=\"'justify-content-' + (style?.layout?.align || '')\">\r\n                <div>\r\n                  <mat-icon>person</mat-icon> &nbsp;&nbsp;<span class=\"body-large\">{{content?.author?.content | titlecase}}</span>\r\n                </div>\r\n                <div class=\"calendar_today\">\r\n                  <mat-icon>calendar_today</mat-icon> &nbsp;&nbsp; <span class=\"body-large\">{{content.createdTimeStamp |\r\n                    date:'EEEE, MMM, d, y'}}</span>\r\n                </div>\r\n              </div>\r\n              <div class=\"button heading-large\" (click)=\"getBlogById(content.newPostTitle)\" [ngClass]=\"'justify-content-' + (style?.layout?.align || '')\">\r\n                Read More <mat-icon>arrow_right_alt</mat-icon>\r\n              </div> -->\r\n              </div>\r\n            </div>\r\n          </a>\r\n        </div>\r\n      </div>\r\n    </div>\r\n  </div>\r\n  <ng-container *ngIf=\"style?.devider?.display\">\r\n    <simpo-svg-divider [dividerType]=\"style?.devider?.deviderType\"\r\n      [color]=\"nextComponentColor?.color\"></simpo-svg-divider>\r\n  </ng-container>\r\n  <div [ngClass]=\"{'hover_effect': edit}\" *ngIf=\"showEditors\">\r\n    <simpo-hover-elements [data]=\"data\" [index]=\"index\" [editOptions]=\"edit\"></simpo-hover-elements>\r\n  </div>\r\n</section>\r\n<ng-template #elseBlock>\r\n  <div class=\"no-blog-text heading-medium\">Sorry there are no blog posts.</div>\r\n</ng-template>", styles: [".cards{box-shadow:0 1px 3px #1018281a,0 1px 2px #1018280f}.cards img{width:100%;border-bottom-left-radius:0!important;border-bottom-right-radius:0!important}.p-30{padding:10px 15px 0}.border{border:1px solid;border-radius:8px}.authors{display:flex;gap:35px;margin-top:40px}.authors div{display:flex}.authors .calendar_today{align-items:center}.authors .calendar_today mat-icon{font-size:20px}.button{font-size:15px;display:flex;align-items:center;gap:10px;cursor:pointer;font-family:interReg;font-weight:500;justify-content:end}.mt-20{margin-top:20px}.total-container{position:relative;height:auto}.hover_effect{position:absolute;width:100%;top:0;left:0;height:100%}.no-blog-text{font-size:24px;line-height:36px;height:40vh;display:flex;align-items:center;justify-content:center}.justify-content-right{justify-content:right}.h-100{height:100%}.gap-20{gap:20px 0px!important}.fs-20{font-size:20px!important}.pb-15{padding-bottom:15px}.ar-none{aspect-ratio:0!important}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i2.TitleCasePipe, name: "titlecase" }, { kind: "directive", type: AnimationDirective, selector: "[simpoAnimation]", inputs: ["simpoAnimation"] }, { kind: "directive", type: BorderDirective, selector: "[simpoBorder]", inputs: ["simpoBorder"] }, { kind: "directive", type: ContentFitDirective, selector: "[simpoLayout]", inputs: ["simpoLayout"] }, { kind: "directive", type: BackgroundDirective, selector: "[simpoBackground]", inputs: ["simpoBackground", "scrollValue"] }, { kind: "directive", type: ImageDirectiveDirective, selector: "[simpoImageDirective]", inputs: ["simpoImageDirective"] }, { kind: "directive", type: CornerDirective, selector: "[simpoCorner]", inputs: ["simpoCorner"] }, { kind: "directive", type: ColumnDirectiveDirective, selector: "[simpoColumnDirective]", inputs: ["simpoColumnDirective"] }, { kind: "directive", type: OverlayDirective, selector: "[simpoOverlay]", inputs: ["simpoOverlay"] }, { kind: "directive", type: HoverDirective, selector: "[simpoHover]", outputs: ["hovering"] }, { kind: "component", type: HoverElementsComponent, selector: "simpo-hover-elements", inputs: ["data", "index", "editOptions", "isMerged", "isEcommerce"], outputs: ["edit"] }, { kind: "component", type: SvgDividerComponent, selector: "simpo-svg-divider", inputs: ["dividerType", "color"] }, { kind: "directive", type: SpacingHorizontalDirective, selector: "[spacingHorizontal]", inputs: ["spacingHorizontal", "isHeader"] }, { kind: "directive", type: RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: BlogListComponent, decorators: [{
            type: Component,
            args: [{ selector: 'simpo-blog-list', standalone: true, imports: [CommonModule,
                        AnimationDirective,
                        BorderDirective,
                        ContentFitDirective,
                        BackgroundDirective,
                        ImageDirectiveDirective,
                        CornerDirective,
                        ColumnDirectiveDirective,
                        OverlayDirective,
                        ContentTitleDirective,
                        HoverDirective,
                        HoverElementsComponent,
                        MatIcon, SvgDividerComponent,
                        SpacingHorizontalDirective, RouterLink], template: "<section [id]=\"data?.id\" [simpoBackground]=\"style?.background\" class=\"total-container\" simpoHover\r\n  (hovering)=\"showEditTabs($event)\" *ngIf=\"(responseData?.length || 0) > 0;else elseBlock\" [attr.style]=\"customClass\">\r\n  <div [id]=\"data?.id\" [simpoOverlay]=\"style?.background\" [simpoBorder]=\"style?.border\"\r\n    [simpoAnimation]=\"style?.animation\" [simpoLayout]=\"style?.layout\">\r\n    <div class=\"container-fluid\" [spacingHorizontal]=\"stylesLayout\">\r\n      <div class=\"row gap-20\">\r\n        <div [simpoColumnDirective]=\"data?.styles?.size\" [id]=\"data?.id\" *ngFor=\"let content of responseData\"\r\n          class=\"d-flex\">\r\n          <a [routerLink]=\"['/blog', content.newPostTitle]\" (click)=\"getBlogById(content.articleSlug)\">\r\n            <div class=\"cards h-100\" [simpoCorner]=\"style?.corners\" [id]=\"data?.id\">\r\n              <img loading=\"lazy\" [src]=\"content.img\" [simpoImageDirective]=\"style?.image\" [id]=\"data?.id\"\r\n                [simpoCorner]=\"style?.corners\" alt=\"\" *ngIf=\"content.img\" loading=\"lazy\">\r\n              <img loading=\"lazy\" [simpoImageDirective]=\"style?.image\" [id]=\"data?.id\" [simpoCorner]=\"style?.corners\"\r\n                src=\"https://dev-beeos.s3.amazonaws.com/library-media/541329c1719236963199pexels-pixabay-262508.jpg\"\r\n                alt=\"\" *ngIf=\"!content.img\" loading=\"lazy\">\r\n              <div class=\"p-30\">\r\n                <!-- <div class=\"d-flex flex-wrap align-items-center gap-2\">\r\n                  <ng-container *ngFor=\"let tag of content?.tags | slice:0:4\">\r\n                    <p class=\"mb-0 p-2 border\">{{ tag }}</p>\r\n                  </ng-container>\r\n                </div> -->\r\n                <div class=\"heading-medium title mt-2 fs-20\" *ngIf=\"blogContent?.display?.showHeading\">\r\n                  {{content.postTitle.length > 100 ? content.postTitle.substring(0,100)+'...\"' : content.postTitle}}\r\n                  <!-- {{content.postTitle}} -->\r\n                </div>\r\n                <ng-container>\r\n                  <div class=\"body-large mt-4 pb-15\" *ngIf=\"blogContent?.display?.showContent\">\r\n                    {{ content.postSummary.length > 250 ? content.postSummary.substring(0, 250) + '...' :\r\n                    content.postSummary }}\r\n                  </div>\r\n                </ng-container>\r\n\r\n                <div class=\"d-flex justify-content-end p-2 align-items-center\" *ngIf=\"content?.author?.content && content?.author?.content.length > 0\">\r\n                  <p>- {{content?.author?.content | titlecase}}</p>\r\n                </div>\r\n\r\n                <!-- <div class=\"authors\" [ngClass]=\"'justify-content-' + (style?.layout?.align || '')\">\r\n                <div>\r\n                  <mat-icon>person</mat-icon> &nbsp;&nbsp;<span class=\"body-large\">{{content?.author?.content | titlecase}}</span>\r\n                </div>\r\n                <div class=\"calendar_today\">\r\n                  <mat-icon>calendar_today</mat-icon> &nbsp;&nbsp; <span class=\"body-large\">{{content.createdTimeStamp |\r\n                    date:'EEEE, MMM, d, y'}}</span>\r\n                </div>\r\n              </div>\r\n              <div class=\"button heading-large\" (click)=\"getBlogById(content.newPostTitle)\" [ngClass]=\"'justify-content-' + (style?.layout?.align || '')\">\r\n                Read More <mat-icon>arrow_right_alt</mat-icon>\r\n              </div> -->\r\n              </div>\r\n            </div>\r\n          </a>\r\n        </div>\r\n      </div>\r\n    </div>\r\n  </div>\r\n  <ng-container *ngIf=\"style?.devider?.display\">\r\n    <simpo-svg-divider [dividerType]=\"style?.devider?.deviderType\"\r\n      [color]=\"nextComponentColor?.color\"></simpo-svg-divider>\r\n  </ng-container>\r\n  <div [ngClass]=\"{'hover_effect': edit}\" *ngIf=\"showEditors\">\r\n    <simpo-hover-elements [data]=\"data\" [index]=\"index\" [editOptions]=\"edit\"></simpo-hover-elements>\r\n  </div>\r\n</section>\r\n<ng-template #elseBlock>\r\n  <div class=\"no-blog-text heading-medium\">Sorry there are no blog posts.</div>\r\n</ng-template>", styles: [".cards{box-shadow:0 1px 3px #1018281a,0 1px 2px #1018280f}.cards img{width:100%;border-bottom-left-radius:0!important;border-bottom-right-radius:0!important}.p-30{padding:10px 15px 0}.border{border:1px solid;border-radius:8px}.authors{display:flex;gap:35px;margin-top:40px}.authors div{display:flex}.authors .calendar_today{align-items:center}.authors .calendar_today mat-icon{font-size:20px}.button{font-size:15px;display:flex;align-items:center;gap:10px;cursor:pointer;font-family:interReg;font-weight:500;justify-content:end}.mt-20{margin-top:20px}.total-container{position:relative;height:auto}.hover_effect{position:absolute;width:100%;top:0;left:0;height:100%}.no-blog-text{font-size:24px;line-height:36px;height:40vh;display:flex;align-items:center;justify-content:center}.justify-content-right{justify-content:right}.h-100{height:100%}.gap-20{gap:20px 0px!important}.fs-20{font-size:20px!important}.pb-15{padding-bottom:15px}.ar-none{aspect-ratio:0!important}\n"] }]
        }], ctorParameters: () => [{ type: i1.EventsService }], propDecorators: { responseData: [{
                type: Input
            }], index: [{
                type: Input
            }], edit: [{
                type: Input
            }], customClass: [{
                type: Input
            }], data: [{
                type: Input
            }], nextComponentColor: [{
                type: Input
            }] } });
//# sourceMappingURL=data:application/json;base64, 