import { Component, HostListener, Input, ViewChild } from '@angular/core';
import { CommonModule } from '@angular/common';
import { SimpoElementsModule } from './../../elements/index';
import { AnimationDirective } from '../../directive/animation-directive';
import { BackgroundDirective } from '../../directive/background-directive';
import { ContentFitDirective } from '../../directive/content-fit-directive';
import { BorderDirective } from '../../directive/border-directive';
import { ButtonDirectiveDirective } from '../../directive/button-directive.directive';
import { ColumnDirectiveDirective } from '../../directive/column-directive.directive';
import { CornerDirective } from '../../directive/corner-directive';
import { HoverDirective } from '../../directive/hover-element-directive';
import { OverlayDirective } from '../../directive/overlay-directive';
import { SimpoComponentModule } from './../../components/index';
import BaseSection from '../BaseSection';
import { ContentTitleDirective } from '../../directive/content-title-spacing.directive';
import { SanitizeHtmlPipe } from '../../services/sanitizeHtml';
import { MatIcon } from '@angular/material/icon';
import { ColorDirective } from './../../directive/color.directive';
import { TextEditorComponent } from '../../elements/text-editor/text-editor.component';
import * as i0 from "@angular/core";
import * as i1 from "./../../services/events.service";
import * as i2 from "../../elements/svg-divider/svg-divider.component";
import * as i3 from "@angular/common";
import * as i4 from "../../components/hover-elements/hover-elements.component";
import * as i5 from "../../components/delete-hover-element/delete-hover-element.component";
export class TestimonialVideoComponent extends BaseSection {
    constructor(_eventService) {
        super();
        this._eventService = _eventService;
        this.screenWidth = 475;
    }
    ngOnInit() {
        this.content = this.data?.content;
        this.style = this.data?.styles;
        this.deleteSelected = this.delete;
    }
    getScreenSize(event) {
        if (typeof window !== 'undefined') {
            this.screenWidth = window.innerWidth;
        }
    }
    getPrevImage(index) {
        const prevIndex = (index - 1 + (this.content?.listItem?.data.length || 0)) % (this.content?.listItem.data.length || 0);
        return this.content?.listItem.data[prevIndex].videoLink;
    }
    getNextImage(index) {
        const nextIndex = (index + 1) % (this.content?.listItem.data.length || 0);
        return this.content?.listItem.data[nextIndex].videoLink;
    }
    get headingSpace() {
        return this.style?.layout.headingSpacing;
    }
    onVideoStart(event) {
        event.play();
    }
    onVideoEnd(video) {
        if (video.currentTime >= video.duration - 0.1) {
            document.getElementById('nextBtn')?.click();
        }
    }
    redirectTo(content) {
        if (!content?.button?.redirectionUrl)
            return;
        this._eventService.buttonRedirection.emit({ data: content.button });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: TestimonialVideoComponent, deps: [{ token: i1.EventsService }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: TestimonialVideoComponent, isStandalone: true, selector: "simpo-testimonial-video", inputs: { data: "data", index: "index", edit: "edit", delete: "delete", nextComponentColor: "nextComponentColor" }, host: { listeners: { "window:resize": "getScreenSize($event)" } }, viewQueries: [{ propertyName: "videoPlayer", first: true, predicate: ["videoPlayer"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<section [simpoBackground]=\"style?.background\" [id]=\"data?.id\" class=\"total-container\"  simpoHover\r\n  (hovering)=\"showEditTabs($event)\">\r\n  <div [id]=\"data?.id\" [simpoOverlay]=\"style?.background\" [simpoBorder]=\"style?.border\" [simpoAnimation]=\"style?.animation\" >\r\n    <div class = \"content-side\" [simpoContentTitleSpace]=\"headingSpace\" [id]=\"data?.id\" class=\"container-fluid\" [simpoLayout]=\"style?.layout\">\r\n      <div *ngFor=\"let text of content?.inputText; let i = index\">\r\n        <!-- <p class = \"content-side\"[innerHtml]=\"text.value | sanitizeHtml\"\r\n          [ngClass]=\"text.label === 'Heading' ? 'heading-large lh-2 mb-3' : 'body-large'\"></p> -->\r\n          <simpo-text-editor [(value)]=\"text.value\" [editable]=\"edit || false\" [sectionId]=\"data?.id\" [inputTextIndex]=\"i\" [isRTE]=\"text.isRTE\"></simpo-text-editor>\r\n      </div>\r\n    </div>\r\n\r\n    <div id=\"carouselExampleCaptions\" class=\"carousel slide\">\r\n      <ol class=\"carousel-indicators\">\r\n        <li *ngFor=\"let img of content?.listItem?.data; let i = index\" [class.active]=\"i === 0\"\r\n          data-bs-target=\"#carouselExampleCaptions\" [attr.data-bs-slide-to]=\"i\"></li>\r\n      </ol>\r\n      <div class=\"carousel-inner\">\r\n        <div class=\"carousel-item\" *ngFor=\"let img of content?.listItem?.data; let i = index\" [class.active]=\"i === 0\">\r\n          <div class=\"row\">\r\n            <div class=\"col d-flex activeCarousel\">\r\n              <div class=\"d-flex align-center h-60 left-video\">\r\n                <video loading=\"lazy\" muted playsinline [simpoCorner]=\"style?.corners\" [id]=\"data?.id\">\r\n                  <source [src]=\"getPrevImage(i)?.url\" type=\"video/mp4\">\r\n                  <source [src]=\"getPrevImage(i)?.url\" type=\"video/ogg\">\r\n                </video>\r\n              </div>\r\n              <div class=\"middle-video\">\r\n                <div class=\"position-relative\">\r\n                  <video  autoplay muted playsinline [simpoCorner]=\"style?.corners\" [id]=\"data?.id\" class=\"h-60\" loop (timeupdate)=\"onVideoEnd(videoPlayer)\" #videoPlayer>\r\n                    <source [src]=\"img.videoLink.url\" type=\"video/mp4\">\r\n                    <source [src]=\"img.videoLink.url\" type=\"video/ogg\">\r\n                  </video>\r\n                  <button [style.background]=\"style?.background?.accentColor\" [simpoColor]=\"style?.background?.accentColor\" [id]=\"data?.id\" (click)=\"redirectTo(img)\"  class=\"button\"><mat-icon> call_made</mat-icon></button>\r\n                </div>\r\n                <div class=\"quote content-side\">\r\n                  <!-- <p class=\"heading-medium\"[innerHtml]=\"img.inputText[0].value | sanitizeHtml\"></p> -->\r\n                  <simpo-text-editor [(value)]=\"img.inputText[0].value\" [editable]=\"edit || false\" [sectionId]=\"data?.id\" [inputTextIndex]=\"0\" [itemIndex]=\"i\" [isRTE]=\"img.inputText[0]?.isRTE\"></simpo-text-editor>\r\n\r\n                </div>\r\n              </div>\r\n              <div class=\"d-flex align-center h-60 right-video\">\r\n                <video  muted playsinline [simpoCorner]=\"style?.corners\" [id]=\"data?.id\">\r\n                  <source [src]=\"getNextImage(i)?.url\" type=\"video/mp4\">\r\n                  <source [src]=\"getNextImage(i)?.url\" type=\"video/ogg\">\r\n                </video>\r\n              </div>\r\n            </div>\r\n\r\n            <!-- <div *ngFor=\"let quote of img?.inputText\">\r\n              <p [innerHtml]=\"quote.value | sanitizeHtml\" class=\"heading-medium\"></p>\r\n            </div> -->\r\n          </div>\r\n        </div>\r\n      </div>\r\n      <a class=\"carousel-control-prev\" data-bs-target=\"#carouselExampleCaptions\" role=\"button\" data-bs-slide=\"prev\">\r\n        <span class=\"carousel-control-prev-icon previous-icon\" aria-hidden=\"true\"></span>\r\n        <span class=\"sr-only\">Previous</span>\r\n      </a>\r\n      <a class=\"carousel-control-next\" id=\"nextBtn\" data-bs-target=\"#carouselExampleCaptions\" role=\"button\" data-bs-slide=\"next\">\r\n        <span class=\"carousel-control-next-icon previous-icon\" aria-hidden=\"true\"></span>\r\n        <span class=\"sr-only\">Next</span>\r\n      </a>\r\n    </div>\r\n  </div>\r\n  \r\n  <ng-container *ngIf=\"style?.devider?.display\">\r\n    <simpo-svg-divider [dividerType]=\"style?.devider?.deviderType\" [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\"\r\n      [isMerged]=\"false\"></simpo-hover-elements>\r\n  </div>\r\n  <div *ngIf=\"showDelete\" [ngClass]=\"{'hover_effect': delete}\">\r\n    <simpo-delete-hover-element [data]=\"data\" [index]=\"index\"></simpo-delete-hover-element>\r\n  </div>\r\n</section>\r\n", styles: [".mb-1{margin-bottom:1.5rem!important}.previous-icon{width:65px;height:65px}.image-height-40vh{height:40vh}.full-width-image{width:100vw;height:70vh}.not-full-width{width:60%}.image-height-content{height:70vh}.image-height-screen{height:calc(90vh + -0px);min-height:0px!important}.image-screen{height:calc(110vh + -0px);min-height:0px!important}.img-screen-notext{height:calc(90vh + -0px);min-height:0px!important}.btn-primary{border:none}.hover_effect{position:unset;width:100%;top:0;left:0;height:100%}.button-display{display:flex;gap:10px}.gap-15{gap:15px}.blur{filter:blur(5px)}@media only screen and (max-width: 475px){.previous-icon{width:44%}.image-height-40vh{padding:0}}.mlr-0{margin-left:0;margin-right:0}li{list-style:none}.activeCarousel{gap:15px}.align-center{align-items:center}.left-video video{width:153%;height:90%;object-fit:cover;transform:translate(-35%);opacity:.5}.right-video video{width:135%;height:90%;object-fit:cover;opacity:.5}.middle-video{width:80%;margin-bottom:5%}.middle-video video{height:60vh}.container-fluid{display:block!important}.total-container{position:relative;height:auto}.h-60{height:60vh}.quote{margin-top:45px;text-align:center;display:flex;justify-content:center}.quote p{width:80%;font-size:18px;line-height:normal}.button{position:absolute;right:5%;bottom:10%;display:flex;align-items:center;height:60px;width:60px!important;justify-content:center;border-radius:100%;border:none}.position-relative{position:relative}@media screen and (max-width : 475px){.middle-video{margin-bottom:9%}}@media screen and (max-width : 924px){.middle-video{width:100%}}@media screen and (max-width : 764px){.middle-video video{height:auto;width:98vw}.middle-video div{display:flex;justify-content:center}.activeCarousel{gap:0px}.left-video,.right-video{display:none!important}.quote p{width:95%}}\n"], dependencies: [{ kind: "ngmodule", type: SimpoElementsModule }, { kind: "component", type: i2.SvgDividerComponent, selector: "simpo-svg-divider", inputs: ["dividerType", "color"] }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: SimpoComponentModule }, { kind: "component", type: i4.HoverElementsComponent, selector: "simpo-hover-elements", inputs: ["data", "index", "editOptions", "isMerged", "isEcommerce"], outputs: ["edit"] }, { kind: "component", type: i5.DeleteHoverElementComponent, selector: "simpo-delete-hover-element", inputs: ["index", "data"], outputs: ["edit"] }, { kind: "component", type: TextEditorComponent, selector: "simpo-text-editor", inputs: ["value", "editable", "isRTE", "sectionId", "label", "type", "inputTextIndex", "itemIndex"], outputs: ["valueChange"] }, { kind: "directive", type: 
                //directive
                AnimationDirective, selector: "[simpoAnimation]", inputs: ["simpoAnimation"] }, { kind: "directive", type: BackgroundDirective, selector: "[simpoBackground]", inputs: ["simpoBackground", "scrollValue"] }, { kind: "directive", type: BorderDirective, selector: "[simpoBorder]", inputs: ["simpoBorder"] }, { kind: "directive", type: ContentFitDirective, selector: "[simpoLayout]", inputs: ["simpoLayout"] }, { kind: "directive", type: CornerDirective, selector: "[simpoCorner]", inputs: ["simpoCorner"] }, { kind: "directive", type: HoverDirective, selector: "[simpoHover]", outputs: ["hovering"] }, { kind: "directive", type: OverlayDirective, selector: "[simpoOverlay]", inputs: ["simpoOverlay"] }, { kind: "directive", type: ContentTitleDirective, selector: "[simpoContentTitleSpace]", inputs: ["simpoContentTitleSpace"] }, { kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: ColorDirective, selector: "[simpoColor]", inputs: ["simpoColor"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: TestimonialVideoComponent, decorators: [{
            type: Component,
            args: [{ selector: 'simpo-testimonial-video', standalone: true, imports: [
                        SimpoElementsModule,
                        CommonModule,
                        ColumnDirectiveDirective,
                        SimpoComponentModule,
                        TextEditorComponent,
                        //directive
                        AnimationDirective,
                        BackgroundDirective,
                        BorderDirective,
                        ButtonDirectiveDirective,
                        ContentFitDirective,
                        CornerDirective,
                        HoverDirective,
                        OverlayDirective,
                        ContentTitleDirective,
                        SanitizeHtmlPipe,
                        MatIcon,
                        ColorDirective
                    ], template: "<section [simpoBackground]=\"style?.background\" [id]=\"data?.id\" class=\"total-container\"  simpoHover\r\n  (hovering)=\"showEditTabs($event)\">\r\n  <div [id]=\"data?.id\" [simpoOverlay]=\"style?.background\" [simpoBorder]=\"style?.border\" [simpoAnimation]=\"style?.animation\" >\r\n    <div class = \"content-side\" [simpoContentTitleSpace]=\"headingSpace\" [id]=\"data?.id\" class=\"container-fluid\" [simpoLayout]=\"style?.layout\">\r\n      <div *ngFor=\"let text of content?.inputText; let i = index\">\r\n        <!-- <p class = \"content-side\"[innerHtml]=\"text.value | sanitizeHtml\"\r\n          [ngClass]=\"text.label === 'Heading' ? 'heading-large lh-2 mb-3' : 'body-large'\"></p> -->\r\n          <simpo-text-editor [(value)]=\"text.value\" [editable]=\"edit || false\" [sectionId]=\"data?.id\" [inputTextIndex]=\"i\" [isRTE]=\"text.isRTE\"></simpo-text-editor>\r\n      </div>\r\n    </div>\r\n\r\n    <div id=\"carouselExampleCaptions\" class=\"carousel slide\">\r\n      <ol class=\"carousel-indicators\">\r\n        <li *ngFor=\"let img of content?.listItem?.data; let i = index\" [class.active]=\"i === 0\"\r\n          data-bs-target=\"#carouselExampleCaptions\" [attr.data-bs-slide-to]=\"i\"></li>\r\n      </ol>\r\n      <div class=\"carousel-inner\">\r\n        <div class=\"carousel-item\" *ngFor=\"let img of content?.listItem?.data; let i = index\" [class.active]=\"i === 0\">\r\n          <div class=\"row\">\r\n            <div class=\"col d-flex activeCarousel\">\r\n              <div class=\"d-flex align-center h-60 left-video\">\r\n                <video loading=\"lazy\" muted playsinline [simpoCorner]=\"style?.corners\" [id]=\"data?.id\">\r\n                  <source [src]=\"getPrevImage(i)?.url\" type=\"video/mp4\">\r\n                  <source [src]=\"getPrevImage(i)?.url\" type=\"video/ogg\">\r\n                </video>\r\n              </div>\r\n              <div class=\"middle-video\">\r\n                <div class=\"position-relative\">\r\n                  <video  autoplay muted playsinline [simpoCorner]=\"style?.corners\" [id]=\"data?.id\" class=\"h-60\" loop (timeupdate)=\"onVideoEnd(videoPlayer)\" #videoPlayer>\r\n                    <source [src]=\"img.videoLink.url\" type=\"video/mp4\">\r\n                    <source [src]=\"img.videoLink.url\" type=\"video/ogg\">\r\n                  </video>\r\n                  <button [style.background]=\"style?.background?.accentColor\" [simpoColor]=\"style?.background?.accentColor\" [id]=\"data?.id\" (click)=\"redirectTo(img)\"  class=\"button\"><mat-icon> call_made</mat-icon></button>\r\n                </div>\r\n                <div class=\"quote content-side\">\r\n                  <!-- <p class=\"heading-medium\"[innerHtml]=\"img.inputText[0].value | sanitizeHtml\"></p> -->\r\n                  <simpo-text-editor [(value)]=\"img.inputText[0].value\" [editable]=\"edit || false\" [sectionId]=\"data?.id\" [inputTextIndex]=\"0\" [itemIndex]=\"i\" [isRTE]=\"img.inputText[0]?.isRTE\"></simpo-text-editor>\r\n\r\n                </div>\r\n              </div>\r\n              <div class=\"d-flex align-center h-60 right-video\">\r\n                <video  muted playsinline [simpoCorner]=\"style?.corners\" [id]=\"data?.id\">\r\n                  <source [src]=\"getNextImage(i)?.url\" type=\"video/mp4\">\r\n                  <source [src]=\"getNextImage(i)?.url\" type=\"video/ogg\">\r\n                </video>\r\n              </div>\r\n            </div>\r\n\r\n            <!-- <div *ngFor=\"let quote of img?.inputText\">\r\n              <p [innerHtml]=\"quote.value | sanitizeHtml\" class=\"heading-medium\"></p>\r\n            </div> -->\r\n          </div>\r\n        </div>\r\n      </div>\r\n      <a class=\"carousel-control-prev\" data-bs-target=\"#carouselExampleCaptions\" role=\"button\" data-bs-slide=\"prev\">\r\n        <span class=\"carousel-control-prev-icon previous-icon\" aria-hidden=\"true\"></span>\r\n        <span class=\"sr-only\">Previous</span>\r\n      </a>\r\n      <a class=\"carousel-control-next\" id=\"nextBtn\" data-bs-target=\"#carouselExampleCaptions\" role=\"button\" data-bs-slide=\"next\">\r\n        <span class=\"carousel-control-next-icon previous-icon\" aria-hidden=\"true\"></span>\r\n        <span class=\"sr-only\">Next</span>\r\n      </a>\r\n    </div>\r\n  </div>\r\n  \r\n  <ng-container *ngIf=\"style?.devider?.display\">\r\n    <simpo-svg-divider [dividerType]=\"style?.devider?.deviderType\" [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\"\r\n      [isMerged]=\"false\"></simpo-hover-elements>\r\n  </div>\r\n  <div *ngIf=\"showDelete\" [ngClass]=\"{'hover_effect': delete}\">\r\n    <simpo-delete-hover-element [data]=\"data\" [index]=\"index\"></simpo-delete-hover-element>\r\n  </div>\r\n</section>\r\n", styles: [".mb-1{margin-bottom:1.5rem!important}.previous-icon{width:65px;height:65px}.image-height-40vh{height:40vh}.full-width-image{width:100vw;height:70vh}.not-full-width{width:60%}.image-height-content{height:70vh}.image-height-screen{height:calc(90vh + -0px);min-height:0px!important}.image-screen{height:calc(110vh + -0px);min-height:0px!important}.img-screen-notext{height:calc(90vh + -0px);min-height:0px!important}.btn-primary{border:none}.hover_effect{position:unset;width:100%;top:0;left:0;height:100%}.button-display{display:flex;gap:10px}.gap-15{gap:15px}.blur{filter:blur(5px)}@media only screen and (max-width: 475px){.previous-icon{width:44%}.image-height-40vh{padding:0}}.mlr-0{margin-left:0;margin-right:0}li{list-style:none}.activeCarousel{gap:15px}.align-center{align-items:center}.left-video video{width:153%;height:90%;object-fit:cover;transform:translate(-35%);opacity:.5}.right-video video{width:135%;height:90%;object-fit:cover;opacity:.5}.middle-video{width:80%;margin-bottom:5%}.middle-video video{height:60vh}.container-fluid{display:block!important}.total-container{position:relative;height:auto}.h-60{height:60vh}.quote{margin-top:45px;text-align:center;display:flex;justify-content:center}.quote p{width:80%;font-size:18px;line-height:normal}.button{position:absolute;right:5%;bottom:10%;display:flex;align-items:center;height:60px;width:60px!important;justify-content:center;border-radius:100%;border:none}.position-relative{position:relative}@media screen and (max-width : 475px){.middle-video{margin-bottom:9%}}@media screen and (max-width : 924px){.middle-video{width:100%}}@media screen and (max-width : 764px){.middle-video video{height:auto;width:98vw}.middle-video div{display:flex;justify-content:center}.activeCarousel{gap:0px}.left-video,.right-video{display:none!important}.quote p{width:95%}}\n"] }]
        }], ctorParameters: () => [{ type: i1.EventsService }], propDecorators: { videoPlayer: [{
                type: ViewChild,
                args: ['videoPlayer', { static: false }]
            }], data: [{
                type: Input
            }], index: [{
                type: Input
            }], edit: [{
                type: Input
            }], delete: [{
                type: Input
            }], nextComponentColor: [{
                type: Input
            }], getScreenSize: [{
                type: HostListener,
                args: ['window:resize', ['$event']]
            }] } });
//# sourceMappingURL=data:application/json;base64, 