import { Component, Injector, Input, ViewEncapsulation } from '@angular/core';
import { AxoUtils } from '../../../../axo-utils/axo-utils';
import { Video } from '../../../../forms/page/widgets/video';
import { MatDialog } from '@angular/material/dialog';
import { FormObjectWidgetMatDialogComponent } from '../../../form-object-list/formObjectWidgetValue/formobject-widget-mat-dialog/formobject-widget-mat-dialog.component';
import * as i0 from "@angular/core";
import * as i1 from "@angular/common";
import * as i2 from "@angular/material/icon";
function VideoWidgetViewComponent_ng_container_1_span_4_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "span");
    i0.ɵɵtext(1);
    i0.ɵɵelementStart(2, "span", 9);
    i0.ɵɵtext(3, ":");
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r3 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance(1);
    i0.ɵɵtextInterpolate(ctx_r3.widget.prompt);
} }
function VideoWidgetViewComponent_ng_container_1_Template(rf, ctx) { if (rf & 1) {
    const _r5 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementContainerStart(0);
    i0.ɵɵelementStart(1, "div", 3);
    i0.ɵɵelementStart(2, "div", 4);
    i0.ɵɵelement(3, "mat-icon", 5);
    i0.ɵɵtemplate(4, VideoWidgetViewComponent_ng_container_1_span_4_Template, 4, 1, "span", 6);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(5, "span", 7);
    i0.ɵɵelementStart(6, "mat-icon", 8);
    i0.ɵɵlistener("click", function VideoWidgetViewComponent_ng_container_1_Template_mat_icon_click_6_listener() { i0.ɵɵrestoreView(_r5); const ctx_r4 = i0.ɵɵnextContext(); return ctx_r4.showVideoPopUp(); });
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
    i0.ɵɵelementContainerEnd();
} if (rf & 2) {
    const ctx_r0 = i0.ɵɵnextContext();
    i0.ɵɵadvance(4);
    i0.ɵɵproperty("ngIf", ctx_r0.section.showPrompt);
    i0.ɵɵadvance(2);
    i0.ɵɵproperty("svgIcon", "axo_video_list");
} }
function VideoWidgetViewComponent_ng_template_2_span_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "span");
    i0.ɵɵtext(1);
    i0.ɵɵelementStart(2, "span", 9);
    i0.ɵɵtext(3, ":");
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r6 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance(1);
    i0.ɵɵtextInterpolate(ctx_r6.widget.prompt);
} }
function VideoWidgetViewComponent_ng_template_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 10);
    i0.ɵɵelement(1, "mat-icon", 11);
    i0.ɵɵtemplate(2, VideoWidgetViewComponent_ng_template_2_span_2_Template, 4, 1, "span", 6);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(3, "span", 7);
    i0.ɵɵtext(4, "-");
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r2 = i0.ɵɵnextContext();
    i0.ɵɵadvance(2);
    i0.ɵɵproperty("ngIf", ctx_r2.section.showPrompt);
} }
export class VideoWidgetViewComponent {
    constructor(_injector) {
        this._injector = _injector;
    }
    ngOnInit() {
        if (this.widget.value.length) {
            this.widgetValue = AxoUtils.removeSlashFromImageUrl(this.widget.value);
        }
    }
    showVideoPopUp() {
        if (this.widgetValue !== null) {
            this.dialog = this._injector.get(MatDialog);
            this.dialog.open(FormObjectWidgetMatDialogComponent, {
                height: '80vh',
                width: '80vw',
                maxWidth: '100vw',
                panelClass: 'video-pop-up-box',
                data: {
                    widget: this.widget,
                    baseUrl: this.baseUrl,
                    widgetValue: '/images/media/app_data/' + this.widgetValue
                }
            });
        }
    }
}
VideoWidgetViewComponent.ɵfac = function VideoWidgetViewComponent_Factory(t) { return new (t || VideoWidgetViewComponent)(i0.ɵɵdirectiveInject(i0.Injector)); };
VideoWidgetViewComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: VideoWidgetViewComponent, selectors: [["lib-video-widget-view"]], inputs: { widget: "widget", baseUrl: "baseUrl" }, decls: 4, vars: 2, consts: [[1, "data-detail-info", "video-detail"], [4, "ngIf", "ngIfElse"], ["isWidgetValueEmpty", ""], [1, "video-container", "text-center", "flex", "gap-4"], [1, "data-detail-title", "flex", "text-sm"], ["svgIcon", "axo_video"], [4, "ngIf"], [1, "flex", "justify-start"], [1, "w-7", "h-7", "cursor-pointer", 3, "svgIcon", "click"], [1, "colon"], [1, "data-detail-title", "flex"], ["svgIcon", "axo_video", 1, "add-text"]], template: function VideoWidgetViewComponent_Template(rf, ctx) { if (rf & 1) {
        i0.ɵɵelementStart(0, "div", 0);
        i0.ɵɵtemplate(1, VideoWidgetViewComponent_ng_container_1_Template, 7, 2, "ng-container", 1);
        i0.ɵɵtemplate(2, VideoWidgetViewComponent_ng_template_2_Template, 5, 1, "ng-template", null, 2, i0.ɵɵtemplateRefExtractor);
        i0.ɵɵelementEnd();
    } if (rf & 2) {
        const _r1 = i0.ɵɵreference(3);
        i0.ɵɵadvance(1);
        i0.ɵɵproperty("ngIf", ctx.widgetValue)("ngIfElse", _r1);
    } }, directives: [i1.NgIf, i2.MatIcon], styles: ["lib-video-widget-view video{max-height:100px;border-radius:5px}\n"], encapsulation: 2 });
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(VideoWidgetViewComponent, [{
        type: Component,
        args: [{ selector: 'lib-video-widget-view', encapsulation: ViewEncapsulation.None, template: "<div class=\"data-detail-info video-detail\">\n  <ng-container *ngIf=\"widgetValue else isWidgetValueEmpty\">\n    <div class=\"video-container text-center flex gap-4\">\n      <!-- <video autoplay=\"false\" loop=\"\" preload=\"none\" controls=\"\" width=\"640\" height=\"480\">\n              <source type=\"video/mp4\" [src]=\"baseUrl + '/images/media/app_data/'+ widgetValue\">\n            </video> -->\n      <div class=\"data-detail-title flex text-sm\">\n        <mat-icon svgIcon=\"axo_video\"></mat-icon>\n        <span *ngIf=\"section.showPrompt\">{{widget.prompt}}<span class=\"colon\">:</span></span>\n      </div>\n      <span class=\"flex justify-start\">\n        <mat-icon [svgIcon]=\"'axo_video_list'\" class=\"w-7 h-7 cursor-pointer\" (click)=\"showVideoPopUp()\"></mat-icon>\n      </span>\n\n    </div>\n  </ng-container>\n  <ng-template #isWidgetValueEmpty>\n    <div class=\"data-detail-title flex\">\n      <mat-icon class=\"add-text\" svgIcon=\"axo_video\"></mat-icon>\n      <span *ngIf=\"section.showPrompt\">{{widget.prompt}}<span class=\"colon\">:</span></span>\n    </div>\n    <span class=\"flex justify-start\">-</span>\n\n  </ng-template>\n</div>", styles: ["lib-video-widget-view video{max-height:100px;border-radius:5px}\n"] }]
    }], function () { return [{ type: i0.Injector }]; }, { widget: [{
            type: Input
        }], baseUrl: [{
            type: Input
        }] }); })();
//# sourceMappingURL=data:application/json;base64, 