import * as i0 from '@angular/core';
import { Component, Inject, Optional, HostBinding, SecurityContext, Directive, Attribute, NgModule } from '@angular/core';
import * as i1 from '@wm/core';
import { EventNotifier, App, setAttr, encodeUrl, addClass, getRouteNameFromLink, removeClass, removeAttr, setCSS, setProperty, isInsecureContentRequest, toggleClass, isMobileApp, switchClass, DataSource, validateDataSourceCtx, removeNode, createElement, appendNode, transformFileURI } from '@wm/core';
import * as i1$1 from '@wm/components/base';
import { PROP_STRING, PROP_ANY, PROP_BOOLEAN, PROP_NUMBER, register, DISPLAY_TYPE, StylableComponent, styler, provideAsWidgetRef, WmComponentsModule } from '@wm/components/base';
import * as i2 from '@angular/common';
import { CommonModule } from '@angular/common';
import { isObject, isEmpty, split, includes } from 'lodash-es';

const registerProps$8 = () => {
    register('wm-anchor', new Map([
        ['animation', PROP_STRING],
        ['badgevalue', PROP_STRING],
        ['caption', { value: 'Link', ...PROP_STRING }],
        ['class', PROP_STRING],
        ['conditionalclass', PROP_ANY],
        ['conditionalstyle', PROP_ANY],
        ['encodeurl', PROP_BOOLEAN],
        ['hint', PROP_STRING],
        ['arialabel', PROP_STRING],
        ['hyperlink', { value: '', ...PROP_STRING }],
        ['iconclass', PROP_STRING],
        ['iconheight', PROP_STRING],
        ['iconmargin', PROP_STRING],
        ['iconposition', PROP_STRING],
        ['iconurl', PROP_STRING],
        ['iconwidth', PROP_STRING],
        ['name', PROP_STRING],
        ['shortcutkey', PROP_STRING],
        ['show', { value: true, ...PROP_BOOLEAN }],
        ['tabindex', { value: 0, ...PROP_NUMBER }],
        ['target', { value: '_self', ...PROP_STRING }]
    ]));
};

const _c0$5 = ["wmAnchor", ""];
const _c1$1 = [[["", 8, "caret"]]];
const _c2$1 = [".caret"];
const _c3 = (a0, a1, a2) => ({ width: a0, height: a1, margin: a2 });
function AnchorComponent_img_0_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "img", 5);
    i0.ɵɵpipe(1, "image");
} if (rf & 2) {
    const ctx_r0 = i0.ɵɵnextContext();
    i0.ɵɵproperty("src", i0.ɵɵpipeBind1(1, 2, ctx_r0.iconurl), i0.ɵɵsanitizeUrl)("ngStyle", i0.ɵɵpureFunction3(4, _c3, ctx_r0.iconwidth, ctx_r0.iconheight, ctx_r0.iconmargin));
} }
function AnchorComponent_i_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "i", 6);
} if (rf & 2) {
    const ctx_r0 = i0.ɵɵnextContext();
    i0.ɵɵclassMapInterpolate1("app-icon ", ctx_r0.iconclass, "");
    i0.ɵɵproperty("ngStyle", i0.ɵɵpureFunction3(4, _c3, ctx_r0.iconwidth, ctx_r0.iconheight, ctx_r0.iconmargin));
} }
function AnchorComponent_span_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "span", 7);
    i0.ɵɵtext(1);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r0 = i0.ɵɵnextContext();
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate2("", ctx_r0.caption, " ", ctx_r0.appLocale.LABEL_ICON, "");
} }
function AnchorComponent_span_5_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "span", 8);
} if (rf & 2) {
    const ctx_r0 = i0.ɵɵnextContext();
    i0.ɵɵproperty("textContent", ctx_r0.badgevalue);
} }
const DEFAULT_CLS$8 = 'app-anchor';
const WIDGET_CONFIG$8 = {
    widgetType: 'wm-anchor',
    hostClass: DEFAULT_CLS$8,
    displayType: DISPLAY_TYPE.INLINE_BLOCK
};
const regex = /Actions.goToPage_(\w+)\.invoke\(\)/g;
const disableContextMenu = ($event) => {
    $event.preventDefault();
};
class AnchorComponent extends StylableComponent {
    static { this.initializeProps = registerProps$8(); }
    constructor(inj, app, explicitContext) {
        super(inj, WIDGET_CONFIG$8, explicitContext);
        this.app = app;
        this._eventNotifier = new EventNotifier();
        styler(this.nativeElement, this);
    }
    processEventAttr(eventName, expr, meta) {
        super.processEventAttr(eventName, expr, meta);
        if (!this.hasNavigationToCurrentPageExpr) {
            const app = this.inj.get(App);
            const fns = expr.split(';').map(Function.prototype.call, String.prototype.trim);
            if (fns.some(fn => {
                regex.lastIndex = 0;
                const matches = regex.exec(fn);
                const hasGoToPageExpr = matches && (matches.length > 0);
                if (hasGoToPageExpr && !this.hasGoToPageExpr) {
                    this.hasGoToPageExpr = true;
                    this.goToPageName = matches[1];
                }
                return hasGoToPageExpr && matches[1] === app.activePageName;
            })) {
                this.hasNavigationToCurrentPageExpr = true;
            }
        }
    }
    onActive(callback) {
        this._eventNotifier.subscribe('on-active', callback);
    }
    handleEvent(node, eventName, eventCallback, locals, meta) {
        super.handleEvent(node, eventName, e => {
            if (this.hasGoToPageExpr && locals.$event) {
                locals.$event.preventDefault();
            }
            eventCallback();
        }, locals, meta);
    }
    onPropertyChange(key, nv, ov) {
        if (key === 'hyperlink') {
            if (!nv) {
                setAttr(this.nativeElement, 'href', 'javascript:void(0)');
                this.nativeElement.addEventListener('contextmenu', disableContextMenu);
                return;
            }
            if (this.encodeurl) {
                nv = encodeUrl(nv);
            }
            // if hyperlink starts with 'www.' append '//' in the beginning
            if (nv.startsWith('www.')) {
                nv = `//${nv}`;
            }
            setAttr(this.nativeElement, 'href', nv);
            this.nativeElement.removeEventListener('contextmenu', disableContextMenu);
        }
        else {
            super.onPropertyChange(key, nv, ov);
        }
    }
    init() {
        if (this.hasNavigationToCurrentPageExpr) {
            addClass(this.nativeElement, 'active');
            setAttr(this.nativeElement, 'aria-current', 'page');
        }
        if (this.hyperlink && getRouteNameFromLink(this.hyperlink) === `/${this.app.activePageName}`
            || this.hasNavigationToCurrentPageExpr) {
            this._eventNotifier.notify("on-active", {});
        }
    }
    ngAfterViewInit() {
        super.ngAfterViewInit();
        this.init();
        if (this.hasGoToPageExpr) {
            // In SPA, it highlights active page link when we navigate within the same layout
            this.cancelSubscription = this.app.subscribe("highlightActiveLink", (data) => {
                if (this.hasNavigationToCurrentPageExpr && this.goToPageName !== this.app.activePageName) {
                    this.hasNavigationToCurrentPageExpr = false;
                    removeClass(this.nativeElement, 'active');
                    removeAttr(this.nativeElement, 'aria-current');
                }
                if (this.goToPageName === data.pageName) {
                    this.hasNavigationToCurrentPageExpr = true;
                    addClass(this.nativeElement, 'active');
                    setAttr(this.nativeElement, 'aria-current', 'page');
                }
            });
        }
    }
    ngOnAttach() {
        this.init();
        super.ngOnAttach();
    }
    ngOnDestroy() {
        this._eventNotifier.destroy();
        if (this.cancelSubscription) {
            this.cancelSubscription();
        }
        super.ngOnDestroy();
    }
    static { this.ɵfac = function AnchorComponent_Factory(t) { return new (t || AnchorComponent)(i0.ɵɵdirectiveInject(i0.Injector), i0.ɵɵdirectiveInject(i1.App), i0.ɵɵdirectiveInject('EXPLICIT_CONTEXT', 8)); }; }
    static { this.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: AnchorComponent, selectors: [["a", "wmAnchor", ""]], hostVars: 3, hostBindings: function AnchorComponent_HostBindings(rf, ctx) { if (rf & 2) {
            i0.ɵɵhostProperty("target", ctx.target);
            i0.ɵɵattribute("accesskey", ctx.shortcutkey)("icon-position", ctx.iconposition);
        } }, exportAs: ["wmAnchor"], features: [i0.ɵɵProvidersFeature([
                provideAsWidgetRef(AnchorComponent)
            ]), i0.ɵɵInheritDefinitionFeature], attrs: _c0$5, ngContentSelectors: _c2$1, decls: 6, vars: 5, consts: [["data-identifier", "img", "alt", "Image", "class", "anchor-image-icon", 3, "src", "ngStyle", 4, "ngIf"], ["aria-hidden", "true", 3, "class", "ngStyle", 4, "ngIf"], ["class", "sr-only", 4, "ngIf"], [1, "anchor-caption", 3, "innerHTML"], ["class", "badge pull-right", 3, "textContent", 4, "ngIf"], ["data-identifier", "img", "alt", "Image", 1, "anchor-image-icon", 3, "src", "ngStyle"], ["aria-hidden", "true", 3, "ngStyle"], [1, "sr-only"], [1, "badge", "pull-right", 3, "textContent"]], template: function AnchorComponent_Template(rf, ctx) { if (rf & 1) {
            i0.ɵɵprojectionDef(_c1$1);
            i0.ɵɵtemplate(0, AnchorComponent_img_0_Template, 2, 8, "img", 0)(1, AnchorComponent_i_1_Template, 1, 8, "i", 1)(2, AnchorComponent_span_2_Template, 2, 2, "span", 2);
            i0.ɵɵelement(3, "span", 3);
            i0.ɵɵprojection(4);
            i0.ɵɵtemplate(5, AnchorComponent_span_5_Template, 1, 1, "span", 4);
        } if (rf & 2) {
            i0.ɵɵproperty("ngIf", ctx.iconurl);
            i0.ɵɵadvance();
            i0.ɵɵproperty("ngIf", ctx.iconclass);
            i0.ɵɵadvance();
            i0.ɵɵproperty("ngIf", ctx.iconclass);
            i0.ɵɵadvance();
            i0.ɵɵproperty("innerHTML", ctx.caption, i0.ɵɵsanitizeHtml);
            i0.ɵɵadvance(2);
            i0.ɵɵproperty("ngIf", ctx.badgevalue);
        } }, dependencies: [i2.NgIf, i2.NgStyle, i1$1.TextContentDirective, i1$1.ImagePipe], encapsulation: 2 }); }
}
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AnchorComponent, [{
        type: Component,
        args: [{ selector: 'a[wmAnchor]', providers: [
                    provideAsWidgetRef(AnchorComponent)
                ], exportAs: 'wmAnchor', template: "<img data-identifier=\"img\" alt=\"Image\" class=\"anchor-image-icon\" [src]=\"iconurl | image\" *ngIf=\"iconurl\" [ngStyle]=\"{width:iconwidth, height:iconheight, margin:iconmargin}\"/>\n<i class=\"app-icon {{iconclass}}\" aria-hidden=\"true\" [ngStyle]=\"{width:iconwidth, height:iconheight, margin:iconmargin}\" *ngIf=\"iconclass\"></i>\n<span class=\"sr-only\" *ngIf=\"iconclass\">{{caption}} {{appLocale.LABEL_ICON}}</span>\n<span class=\"anchor-caption\" [innerHTML]=\"caption\"></span>\n<ng-content select=\".caret\"></ng-content>\n<span *ngIf=\"badgevalue\" class=\"badge pull-right\" [textContent]=\"badgevalue\"></span>\n" }]
    }], () => [{ type: i0.Injector }, { type: i1.App }, { type: undefined, decorators: [{
                type: Inject,
                args: ['EXPLICIT_CONTEXT']
            }, {
                type: Optional
            }] }], { target: [{
            type: HostBinding,
            args: ['target']
        }], shortcutkey: [{
            type: HostBinding,
            args: ['attr.accesskey']
        }], iconposition: [{
            type: HostBinding,
            args: ['attr.icon-position']
        }] }); })();
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(AnchorComponent, { className: "AnchorComponent", filePath: "anchor/anchor.component.ts", lineNumber: 37 }); })();

const registerProps$7 = () => {
    register('wm-audio', new Map([
        ['audiopreload', { value: 'none', ...PROP_STRING }],
        ['audiosupportmessage', { value: 'Your browser does not support the audio tag.', ...PROP_STRING }],
        ['autoplay', PROP_BOOLEAN],
        ['class', PROP_STRING],
        ['controls', PROP_BOOLEAN],
        ['hint', PROP_STRING],
        ['arialabel', PROP_STRING],
        ['loop', PROP_BOOLEAN],
        ['mp3format', PROP_STRING],
        ['muted', PROP_BOOLEAN],
        ['name', PROP_STRING],
        ['show', { value: true, ...PROP_BOOLEAN }],
        ['tabindex', { value: 0, ...PROP_NUMBER }]
    ]));
};

const _c0$4 = ["wmAudio", ""];
const DEFAULT_CLS$7 = 'app-audio';
const WIDGET_CONFIG$7 = {
    widgetType: 'wm-audio',
    hostClass: DEFAULT_CLS$7,
    displayType: DISPLAY_TYPE.INLINE_BLOCK
};
class AudioComponent extends StylableComponent {
    static { this.initializeProps = registerProps$7(); }
    constructor(inj, explicitContext) {
        super(inj, WIDGET_CONFIG$7, explicitContext);
        styler(this.nativeElement, this);
    }
    static { this.ɵfac = function AudioComponent_Factory(t) { return new (t || AudioComponent)(i0.ɵɵdirectiveInject(i0.Injector), i0.ɵɵdirectiveInject('EXPLICIT_CONTEXT', 8)); }; }
    static { this.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: AudioComponent, selectors: [["", "wmAudio", ""]], features: [i0.ɵɵProvidersFeature([
                provideAsWidgetRef(AudioComponent)
            ]), i0.ɵɵInheritDefinitionFeature], attrs: _c0$4, decls: 5, vars: 16, consts: [["name", "wmAudio", "role", "application", 3, "autoplay", "controls", "loop", "muted", "preload", "src"], ["type", "audio/mp3", 3, "src"]], template: function AudioComponent_Template(rf, ctx) { if (rf & 1) {
            i0.ɵɵelementStart(0, "audio", 0);
            i0.ɵɵpipe(1, "trustAs");
            i0.ɵɵelement(2, "source", 1);
            i0.ɵɵpipe(3, "trustAs");
            i0.ɵɵtext(4);
            i0.ɵɵelementEnd();
        } if (rf & 2) {
            i0.ɵɵproperty("autoplay", ctx.autoplay)("controls", ctx.controls)("loop", ctx.loop)("muted", ctx.muted)("preload", ctx.audiopreload)("src", i0.ɵɵpipeBind2(1, 10, ctx.mp3format, "resource"), i0.ɵɵsanitizeUrl);
            i0.ɵɵattribute("aria-label", ctx.arialabel || "Audio")("hint", ctx.hint);
            i0.ɵɵadvance(2);
            i0.ɵɵproperty("src", i0.ɵɵpipeBind2(3, 13, ctx.mp3format, "resource"), i0.ɵɵsanitizeUrl);
            i0.ɵɵadvance(2);
            i0.ɵɵtextInterpolate1(" ", ctx.audiosupportmessage, "\n");
        } }, dependencies: [i1$1.TrustAsPipe], encapsulation: 2 }); }
}
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AudioComponent, [{
        type: Component,
        args: [{ selector: '[wmAudio]', providers: [
                    provideAsWidgetRef(AudioComponent)
                ], template: "<audio [attr.aria-label]=\"arialabel || 'Audio'\" [attr.hint]=\"hint\" [autoplay]=\"autoplay\"\n       [controls]=\"controls\" [loop]=\"loop\" [muted]=\"muted\" [preload]=\"audiopreload\" [src]=\"mp3format | trustAs: 'resource'\"\n       name=\"wmAudio\" role=\"application\">\n    <source type=\"audio/mp3\" [src]=\"mp3format | trustAs: 'resource'\">\n    {{audiosupportmessage}}\n</audio>\n" }]
    }], () => [{ type: i0.Injector }, { type: undefined, decorators: [{
                type: Inject,
                args: ['EXPLICIT_CONTEXT']
            }, {
                type: Optional
            }] }], null); })();
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(AudioComponent, { className: "AudioComponent", filePath: "audio/audio.component.ts", lineNumber: 20 }); })();

const registerProps$6 = () => {
    register('wm-html', new Map([
        ['class', PROP_STRING],
        ['content', PROP_STRING],
        ['hint', PROP_STRING],
        ['arialabel', PROP_STRING],
        ['name', PROP_STRING],
        ['show', { value: true, ...PROP_BOOLEAN }]
    ]));
};

const DEFAULT_CLS$6 = 'app-html-container';
const WIDGET_CONFIG$6 = {
    widgetType: 'wm-html',
    hostClass: DEFAULT_CLS$6
};
class HtmlDirective extends StylableComponent {
    static { this.initializeProps = registerProps$6(); }
    constructor(inj, height, boundContent, sanitizePipe, explicitContext) {
        super(inj, WIDGET_CONFIG$6, explicitContext);
        this.boundContent = boundContent;
        this.sanitizePipe = sanitizePipe;
        // if the height is provided set the overflow to auto
        if (height) {
            setCSS(this.nativeElement, 'overflow', 'auto');
        }
        styler(this.nativeElement, this);
    }
    ngOnInit() {
        super.ngOnInit();
        if (this.boundContent) {
            this.nativeElement.innerHTML = '';
        }
        if (!this.content && this.nativeElement.innerHTML) {
            this.content = this.nativeElement.innerHTML;
        }
    }
    onPropertyChange(key, nv, ov) {
        if (key === 'content') {
            // Check for trustPipe safe values
            let bindContent = this.nativeElement.getAttribute('content.bind');
            let safeValue = bindContent ? nv && bindContent.includes('trustAs:') : false;
            if (typeof nv === 'object' && safeValue) {
                setProperty(this.nativeElement, 'innerHTML', nv[Object.keys(nv)[0]]);
            }
            else {
                setProperty(this.nativeElement, 'innerHTML', this.sanitizePipe.transform(nv, SecurityContext.HTML));
            }
        }
        else {
            super.onPropertyChange(key, nv, ov);
        }
    }
    static { this.ɵfac = function HtmlDirective_Factory(t) { return new (t || HtmlDirective)(i0.ɵɵdirectiveInject(i0.Injector), i0.ɵɵinjectAttribute('height'), i0.ɵɵinjectAttribute('content.bind'), i0.ɵɵdirectiveInject(i1$1.SanitizePipe), i0.ɵɵdirectiveInject('EXPLICIT_CONTEXT', 8)); }; }
    static { this.ɵdir = /*@__PURE__*/ i0.ɵɵdefineDirective({ type: HtmlDirective, selectors: [["", "wmHtml", ""]], exportAs: ["wmHtml"], features: [i0.ɵɵProvidersFeature([
                provideAsWidgetRef(HtmlDirective)
            ]), i0.ɵɵInheritDefinitionFeature] }); }
}
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(HtmlDirective, [{
        type: Directive,
        args: [{
                selector: '[wmHtml]',
                providers: [
                    provideAsWidgetRef(HtmlDirective)
                ],
                exportAs: 'wmHtml'
            }]
    }], () => [{ type: i0.Injector }, { type: undefined, decorators: [{
                type: Attribute,
                args: ['height']
            }] }, { type: undefined, decorators: [{
                type: Attribute,
                args: ['content.bind']
            }] }, { type: i1$1.SanitizePipe }, { type: undefined, decorators: [{
                type: Inject,
                args: ['EXPLICIT_CONTEXT']
            }, {
                type: Optional
            }] }], null); })();

const registerProps$5 = () => {
    register('wm-icon', new Map([
        ['animation', PROP_STRING],
        ['caption', PROP_STRING],
        ['class', PROP_STRING],
        ['conditionalclass', PROP_ANY],
        ['conditionalstyle', PROP_ANY],
        ['hint', PROP_STRING],
        ['arialabel', PROP_STRING],
        ['iconclass', { value: 'wm-sl-l sl-user', ...PROP_STRING }],
        ['iconposition', { value: 'left', ...PROP_STRING }],
        ['iconsize', PROP_STRING],
        ['iconurl', PROP_STRING],
        ['name', PROP_STRING],
        ['show', { value: true, ...PROP_BOOLEAN }]
    ]));
};

const _c0$3 = ["wmIcon", ""];
function IconComponent_span_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "span", 2);
    i0.ɵɵtext(1);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r0 = i0.ɵɵnextContext();
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate(ctx_r0.arialabel || ctx_r0.caption || ctx_r0.appLocale.LABEL_ICON);
} }
function IconComponent_label_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "label", 3);
} if (rf & 2) {
    const ctx_r0 = i0.ɵɵnextContext();
    i0.ɵɵproperty("textContent", ctx_r0.caption);
} }
const DEFAULT_CLS$5 = 'app-icon-wrapper';
const WIDGET_CONFIG$5 = {
    widgetType: 'wm-icon',
    hostClass: DEFAULT_CLS$5
};
class IconComponent extends StylableComponent {
    static { this.initializeProps = registerProps$5(); }
    constructor(inj, explicitContext) {
        super(inj, WIDGET_CONFIG$5, explicitContext);
        styler(this.nativeElement, this);
    }
    static { this.ɵfac = function IconComponent_Factory(t) { return new (t || IconComponent)(i0.ɵɵdirectiveInject(i0.Injector), i0.ɵɵdirectiveInject('EXPLICIT_CONTEXT', 8)); }; }
    static { this.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: IconComponent, selectors: [["", "wmIcon", ""]], hostVars: 3, hostBindings: function IconComponent_HostBindings(rf, ctx) { if (rf & 2) {
            i0.ɵɵattribute("icon-position", ctx.iconposition);
            i0.ɵɵstyleProp("font-size", ctx.iconsize);
        } }, features: [i0.ɵɵProvidersFeature([
                provideAsWidgetRef(IconComponent)
            ]), i0.ɵɵInheritDefinitionFeature], attrs: _c0$3, decls: 3, vars: 5, consts: [["class", "sr-only", 4, "ngIf"], ["aria-hidden", "true", "class", "app-label", 3, "textContent", 4, "ngIf"], [1, "sr-only"], ["aria-hidden", "true", 1, "app-label", 3, "textContent"]], template: function IconComponent_Template(rf, ctx) { if (rf & 1) {
            i0.ɵɵelement(0, "i");
            i0.ɵɵtemplate(1, IconComponent_span_1_Template, 2, 1, "span", 0)(2, IconComponent_label_2_Template, 1, 1, "label", 1);
        } if (rf & 2) {
            i0.ɵɵclassMapInterpolate1("app-icon ", ctx.iconclass, "");
            i0.ɵɵadvance();
            i0.ɵɵproperty("ngIf", ctx.iconclass);
            i0.ɵɵadvance();
            i0.ɵɵproperty("ngIf", ctx.caption);
        } }, dependencies: [i2.NgIf, i1$1.TextContentDirective], encapsulation: 2 }); }
}
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(IconComponent, [{
        type: Component,
        args: [{ selector: '[wmIcon]', providers: [
                    provideAsWidgetRef(IconComponent)
                ], template: "<i class=\"app-icon {{iconclass}}\"></i>\n<span *ngIf=\"iconclass\" class=\"sr-only\">{{ arialabel || caption || appLocale.LABEL_ICON }}</span>\n<label *ngIf=\"caption\" [textContent]=\"caption\" aria-hidden=\"true\" class=\"app-label\"></label>\n" }]
    }], () => [{ type: i0.Injector }, { type: undefined, decorators: [{
                type: Inject,
                args: ['EXPLICIT_CONTEXT']
            }, {
                type: Optional
            }] }], { iconposition: [{
            type: HostBinding,
            args: ['attr.icon-position']
        }], iconsize: [{
            type: HostBinding,
            args: ['style.fontSize']
        }] }); })();
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(IconComponent, { className: "IconComponent", filePath: "icon/icon.component.ts", lineNumber: 19 }); })();

const registerProps$4 = () => {
    register('wm-iframe', new Map([
        ['class', PROP_STRING],
        ['encodeurl', PROP_BOOLEAN],
        ['height', { value: '150px', ...PROP_STRING }],
        ['iframesrc', PROP_STRING],
        ['name', PROP_STRING],
        ['show', { value: true, ...PROP_BOOLEAN }],
        ['width', { value: '300px', ...PROP_STRING }],
        ['hint', PROP_STRING],
        ['arialabel', PROP_STRING]
    ]));
};

const _c0$2 = ["wmIframe", ""];
function IframeComponent_div_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 2);
    i0.ɵɵelement(1, "p", 3);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r0 = i0.ɵɵnextContext();
    i0.ɵɵadvance();
    i0.ɵɵproperty("title", ctx_r0.hintMsg)("textContent", ctx_r0.errMsg);
} }
const DEFAULT_CLS$4 = 'embed-responsive app-iframe';
const WIDGET_CONFIG$4 = {
    widgetType: 'wm-iframe',
    hostClass: DEFAULT_CLS$4
};
class IframeComponent extends StylableComponent {
    static { this.initializeProps = registerProps$4(); }
    constructor(inj, trustAsPipe, explicitContext) {
        super(inj, WIDGET_CONFIG$4, explicitContext);
        this.trustAsPipe = trustAsPipe;
        /**
         * this property member is set to true when the content request url doesn't match windows protocol
         */
        this.showContentLoadError = false;
        styler(this.nativeElement, this);
    }
    computeIframeSrc() {
        this.showContentLoadError = false;
        this._iframesrc = undefined;
        if (this.iframesrc) {
            let url = this.iframesrc;
            if (this.encodeurl) {
                url = encodeUrl(this.iframesrc);
            }
            const trustedUrl = this.trustAsPipe.transform(url, SecurityContext.RESOURCE_URL);
            if (isInsecureContentRequest(url)) {
                this.showContentLoadError = true;
                this.errorMsg = `${this.appLocale.MESSAGE_ERROR_CONTENT_DISPLAY} ${this.iframesrc}`;
                this.hintMsg = this.errorMsg;
            }
            this._iframesrc = trustedUrl;
        }
    }
    onPropertyChange(key, nv, ov) {
        if (key === 'iframesrc' || key === 'encodeurl') {
            this.computeIframeSrc();
        }
        else {
            super.onPropertyChange(key, nv, ov);
        }
    }
    static { this.ɵfac = function IframeComponent_Factory(t) { return new (t || IframeComponent)(i0.ɵɵdirectiveInject(i0.Injector), i0.ɵɵdirectiveInject(i1$1.TrustAsPipe), i0.ɵɵdirectiveInject('EXPLICIT_CONTEXT', 8)); }; }
    static { this.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: IframeComponent, selectors: [["", "wmIframe", ""]], features: [i0.ɵɵProvidersFeature([
                provideAsWidgetRef(IframeComponent)
            ]), i0.ɵɵInheritDefinitionFeature], attrs: _c0$2, decls: 2, vars: 4, consts: [["role", "document", "scrolling", "auto", "marginheight", "0", "marginwidth", "0", "frameborder", "0", "seamless", "seamless", 1, "embed-responsive-item", "iframe-content", 3, "name"], ["class", "wm-content-info readonly-wrapper", 4, "ngIf"], [1, "wm-content-info", "readonly-wrapper"], [1, "wm-message", 3, "title", "textContent"]], template: function IframeComponent_Template(rf, ctx) { if (rf & 1) {
            i0.ɵɵelement(0, "iframe", 0);
            i0.ɵɵtemplate(1, IframeComponent_div_1_Template, 2, 2, "div", 1);
        } if (rf & 2) {
            i0.ɵɵproperty("name", ctx.name);
            i0.ɵɵattribute("src", ctx._iframesrc, i0.ɵɵsanitizeResourceUrl)("aria-label", ctx.arialabel || "iframe");
            i0.ɵɵadvance();
            i0.ɵɵproperty("ngIf", ctx.showContentLoadError);
        } }, dependencies: [i2.NgIf, i1$1.TextContentDirective], encapsulation: 2 }); }
}
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(IframeComponent, [{
        type: Component,
        args: [{ selector: '[wmIframe]', providers: [
                    provideAsWidgetRef(IframeComponent)
                ], template: "<iframe  class=\"embed-responsive-item iframe-content\" role=\"document\"\n        scrolling=\"auto\"\n        marginheight=\"0\"\n        marginwidth=\"0\"\n        frameborder=\"0\"\n        [name]=\"name\"\n        [attr.src]=\"_iframesrc\"\n         [attr.aria-label]=\"arialabel || 'iframe'\"\n        seamless=\"seamless\">\n</iframe>\n<div class=\"wm-content-info readonly-wrapper\" *ngIf=\"showContentLoadError\">\n    <p class=\"wm-message\" [title]=\"hintMsg\" [textContent]=\"errMsg\"></p>\n</div>\n" }]
    }], () => [{ type: i0.Injector }, { type: i1$1.TrustAsPipe }, { type: undefined, decorators: [{
                type: Inject,
                args: ['EXPLICIT_CONTEXT']
            }, {
                type: Optional
            }] }], null); })();
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(IframeComponent, { className: "IframeComponent", filePath: "iframe/iframe.component.ts", lineNumber: 22 }); })();

const registerProps$3 = () => {
    register('wm-label', new Map([
        ['animation', PROP_STRING],
        ['caption', { value: 'Label', ...PROP_STRING }],
        ['class', PROP_STRING],
        ['conditionalclass', PROP_ANY],
        ['conditionalstyle', PROP_ANY],
        ['type', PROP_STRING],
        ['notag', PROP_BOOLEAN],
        ['hint', PROP_STRING],
        ['name', PROP_STRING],
        ['required', PROP_BOOLEAN],
        ['show', { value: true, ...PROP_BOOLEAN }]
    ]));
};

const DEFAULT_CLS$3 = 'app-label';
const WIDGET_CONFIG$3 = {
    widgetType: 'wm-label',
    hostClass: DEFAULT_CLS$3,
    displayType: DISPLAY_TYPE.INLINE_BLOCK
};
class LabelDirective extends StylableComponent {
    static { this.initializeProps = registerProps$3(); }
    constructor(inj, sanitizePipe, explicitContext) {
        super(inj, WIDGET_CONFIG$3, explicitContext);
        this.sanitizePipe = sanitizePipe;
        styler(this.nativeElement, this);
    }
    onPropertyChange(key, nv, ov) {
        if (key === 'caption') {
            // Check for trustPipe safe values
            let bindContent = this.nativeElement.getAttribute('caption.bind');
            let safeValue = bindContent ? nv && bindContent.includes('trustAs:') : false;
            if (isObject(nv) && !safeValue) {
                setProperty(this.nativeElement, 'textContent', JSON.stringify(nv));
            }
            else if (isObject(nv) && safeValue) {
                setProperty(this.nativeElement, 'innerHTML', nv[Object.keys(nv)[0]]);
            }
            else {
                setProperty(this.nativeElement, 'innerHTML', this.sanitizePipe.transform(nv, SecurityContext.HTML));
            }
        }
        else if (key === 'required') {
            toggleClass(this.nativeElement, 'required', nv);
        }
        else {
            super.onPropertyChange(key, nv, ov);
        }
    }
    static { this.ɵfac = function LabelDirective_Factory(t) { return new (t || LabelDirective)(i0.ɵɵdirectiveInject(i0.Injector), i0.ɵɵdirectiveInject(i1$1.SanitizePipe), i0.ɵɵdirectiveInject('EXPLICIT_CONTEXT', 8)); }; }
    static { this.ɵdir = /*@__PURE__*/ i0.ɵɵdefineDirective({ type: LabelDirective, selectors: [["", "wmLabel", ""]], exportAs: ["wmLabel"], features: [i0.ɵɵProvidersFeature([
                provideAsWidgetRef(LabelDirective)
            ]), i0.ɵɵInheritDefinitionFeature] }); }
}
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(LabelDirective, [{
        type: Directive,
        args: [{
                selector: '[wmLabel]',
                providers: [
                    provideAsWidgetRef(LabelDirective)
                ],
                exportAs: 'wmLabel'
            }]
    }], () => [{ type: i0.Injector }, { type: i1$1.SanitizePipe }, { type: undefined, decorators: [{
                type: Inject,
                args: ['EXPLICIT_CONTEXT']
            }, {
                type: Optional
            }] }], null); })();

const registerProps$2 = () => {
    const props = new Map([
        ['animation', PROP_STRING],
        ['class', PROP_STRING],
        ['conditionalclass', PROP_ANY],
        ['conditionalstyle', PROP_ANY],
        ['encodeurl', PROP_STRING],
        ['hint', PROP_STRING],
        ['arialabel', PROP_STRING],
        ['name', PROP_STRING],
        ['pictureaspect', { value: 'None', ...PROP_STRING }],
        ['alttext', { value: 'Image alt text not provided', ...PROP_STRING }],
        ['pictureplaceholder', PROP_STRING],
        ['picturesource', PROP_STRING],
        ['resizemode', { value: 'fill', ...PROP_STRING }],
        ['shape', PROP_STRING],
        ['show', { value: true, ...PROP_BOOLEAN }],
        ['tabindex', { value: 0, ...PROP_NUMBER }]
    ]);
    if (isMobileApp()) {
        props.set('offline', { value: true, ...PROP_BOOLEAN });
    }
    register('wm-picture', props);
};

const DEFAULT_CLS$2 = 'app-picture';
const WIDGET_CONFIG$2 = {
    widgetType: 'wm-picture',
    hostClass: DEFAULT_CLS$2,
    displayType: DISPLAY_TYPE.INLINE_BLOCK
};
class PictureDirective extends StylableComponent {
    static { this.initializeProps = registerProps$2(); }
    constructor(inj, imagePipe, explicitContext) {
        super(inj, WIDGET_CONFIG$2, explicitContext);
        this.imagePipe = imagePipe;
        styler(this.nativeElement, this);
    }
    setImgSource() {
        this.imgSource = this.imagePipe.transform(this.picturesource, this.encodeurl, this.pictureplaceholder);
    }
    onPropertyChange(key, nv, ov) {
        if (key === 'pictureaspect') {
            let width = '';
            let height = '';
            switch (nv) {
                case 'None':
                    width = this.width;
                    height = this.height;
                    break;
                case 'H':
                    width = '100%';
                    break;
                case 'V':
                    height = '100%';
                    break;
                case 'Both':
                    width = '100%';
                    height = '100%';
                    break;
            }
            setCSS(this.nativeElement, 'width', width, true);
            setCSS(this.nativeElement, 'height', height, true);
        }
        else if (key === 'encodeurl' || key === 'pictureplaceholder') {
            this.setImgSource();
        }
        else if (key === 'shape') {
            switchClass(this.nativeElement, `img-${nv}`, `img-${ov}`);
        }
        else if (key === 'hint') {
            setAttr(this.nativeElement, 'alt', nv);
        }
        else if (key === 'resizemode') {
            setCSS(this.nativeElement, 'object-fit', nv);
        }
        super.onPropertyChange(key, nv, ov);
    }
    onStyleChange(key, nv, ov) {
        if (key === 'picturesource') {
            this.setImgSource();
        }
        else {
            super.onStyleChange(key, nv, ov);
        }
    }
    ngOnInit() {
        this.setImgSource();
        super.ngOnInit();
    }
    static { this.ɵfac = function PictureDirective_Factory(t) { return new (t || PictureDirective)(i0.ɵɵdirectiveInject(i0.Injector), i0.ɵɵdirectiveInject(i1$1.ImagePipe), i0.ɵɵdirectiveInject('EXPLICIT_CONTEXT', 8)); }; }
    static { this.ɵdir = /*@__PURE__*/ i0.ɵɵdefineDirective({ type: PictureDirective, selectors: [["img", "wmPicture", ""]], hostVars: 1, hostBindings: function PictureDirective_HostBindings(rf, ctx) { if (rf & 2) {
            i0.ɵɵhostProperty("src", ctx.imgSource, i0.ɵɵsanitizeUrl);
        } }, exportAs: ["wmPicture"], features: [i0.ɵɵProvidersFeature([
                provideAsWidgetRef(PictureDirective)
            ]), i0.ɵɵInheritDefinitionFeature] }); }
}
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(PictureDirective, [{
        type: Directive,
        args: [{
                selector: 'img[wmPicture]',
                providers: [
                    provideAsWidgetRef(PictureDirective)
                ],
                exportAs: 'wmPicture'
            }]
    }], () => [{ type: i0.Injector }, { type: i1$1.ImagePipe }, { type: undefined, decorators: [{
                type: Inject,
                args: ['EXPLICIT_CONTEXT']
            }, {
                type: Optional
            }] }], { imgSource: [{
            type: HostBinding,
            args: ['src']
        }] }); })();

const registerProps$1 = () => {
    register('wm-spinner', new Map([
        ['animation', { value: 'spin', PROP_STRING }],
        ['caption', { value: 'Loading...', ...PROP_STRING }],
        ['class', PROP_STRING],
        ['iconclass', { value: 'fa fa-circle-o-notch fa-spin', ...PROP_STRING }],
        ['iconsize', PROP_STRING],
        ['image', PROP_STRING],
        ['imageheight', PROP_STRING],
        ['imagewidth', { value: '20px', ...PROP_STRING }],
        ['name', PROP_STRING],
        ['show', { value: true, ...PROP_BOOLEAN }],
        ['type', { value: 'icon', ...PROP_STRING }],
        ['servicevariabletotrack', PROP_STRING],
        ['hint', PROP_STRING],
        ['arialabel', PROP_STRING]
    ]));
};

const _c0$1 = ["wmSpinner", ""];
const _c1 = (a0, a1, a2, a3) => ({ width: a0, height: a1, backgroundImage: a2, backgroundSize: a3 });
const _c2 = (a0, a1) => [a0, a1];
function SpinnerComponent_span_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "span", 5);
} if (rf & 2) {
    const ctx_r0 = i0.ɵɵnextContext();
    i0.ɵɵproperty("ngClass", ctx_r0.animation)("ngStyle", i0.ɵɵpureFunction4(2, _c1, ctx_r0.imagewidth, ctx_r0.imageheight, "url(" + ctx_r0.picture + ")", ctx_r0.imagewidth));
} }
function SpinnerComponent_i_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "i", 6);
} if (rf & 2) {
    const ctx_r0 = i0.ɵɵnextContext();
    i0.ɵɵstyleProp("fon-size", ctx_r0.iconsize);
    i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction2(3, _c2, ctx_r0.iconclass, ctx_r0.animation));
} }
function SpinnerComponent_span_3_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "span", 7);
} if (rf & 2) {
    const ctx_r0 = i0.ɵɵnextContext();
    i0.ɵɵproperty("innerHTML", ctx_r0.caption, i0.ɵɵsanitizeHtml);
} }
function SpinnerComponent_div_4_p_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "p", 10);
} if (rf & 2) {
    const value_r2 = ctx.$implicit;
    i0.ɵɵproperty("textContent", value_r2);
} }
function SpinnerComponent_div_4_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 8);
    i0.ɵɵtemplate(1, SpinnerComponent_div_4_p_1_Template, 1, 1, "p", 9);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r0 = i0.ɵɵnextContext();
    i0.ɵɵadvance();
    i0.ɵɵproperty("ngForOf", ctx_r0.spinnerMessages);
} }
const DEFAULT_CLS$1 = 'app-spinner';
const WIDGET_CONFIG$1 = { widgetType: 'wm-spinner', hostClass: DEFAULT_CLS$1 };
class SpinnerComponent extends StylableComponent {
    static { this.initializeProps = registerProps$1(); }
    get spinnerMessages() {
        return this._spinnerMessages;
    }
    set spinnerMessages(newVal) {
        this.showCaption = isEmpty(newVal);
        this._spinnerMessages = newVal;
    }
    listenOnDataSource() {
        const variables = split(this.servicevariabletotrack, ',');
        this.getAppInstance().subscribe('toggle-variable-state', data => {
            const name = data.variable.execute(DataSource.Operation.GET_NAME);
            if (includes(variables, name) && validateDataSourceCtx(data.variable, this.getViewParent())) {
                this.widget.show = data.active;
            }
        });
    }
    constructor(inj, imagePipe, explicitContext) {
        super(inj, WIDGET_CONFIG$1, explicitContext);
        this.imagePipe = imagePipe;
        this.iconclass = '';
        this.animation = '';
        this.showCaption = true;
        styler(this.nativeElement, this);
    }
    onPropertyChange(key, nv, ov) {
        if (key === 'image') {
            this.picture = this.imagePipe.transform(nv);
        }
        else if (key === 'animation') {
            if (nv === 'spin') {
                this.animation = 'fa-spin';
            }
            else {
                this.animation = nv || '';
            }
        }
        else {
            super.onPropertyChange(key, nv, ov);
        }
    }
    ngOnInit() {
        super.ngOnInit();
        // if variables are to be listened to, hide the widget and set the listener
        if (this.servicevariabletotrack) {
            this.widget.show = false;
            this.listenOnDataSource();
        }
    }
    static { this.ɵfac = function SpinnerComponent_Factory(t) { return new (t || SpinnerComponent)(i0.ɵɵdirectiveInject(i0.Injector), i0.ɵɵdirectiveInject(i1$1.ImagePipe), i0.ɵɵdirectiveInject('EXPLICIT_CONTEXT', 8)); }; }
    static { this.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: SpinnerComponent, selectors: [["", "wmSpinner", ""]], exportAs: ["wmSpinner"], features: [i0.ɵɵProvidersFeature([
                provideAsWidgetRef(SpinnerComponent)
            ]), i0.ɵɵInheritDefinitionFeature], attrs: _c0$1, decls: 5, vars: 4, consts: [[1, "spinner-message"], ["class", "spinner-image animated infinite", "aria-hidden", "true", 3, "ngClass", "ngStyle", 4, "ngIf"], ["class", "spinner-image animated infinite", "aria-hidden", "true", 3, "ngClass", "fonSize", 4, "ngIf"], ["class", "spinner-text", 3, "innerHTML", 4, "ngIf"], ["class", "spinner-messages", 4, "ngIf"], ["aria-hidden", "true", 1, "spinner-image", "animated", "infinite", 3, "ngClass", "ngStyle"], ["aria-hidden", "true", 1, "spinner-image", "animated", "infinite", 3, "ngClass"], [1, "spinner-text", 3, "innerHTML"], [1, "spinner-messages"], [3, "textContent", 4, "ngFor", "ngForOf"], [3, "textContent"]], template: function SpinnerComponent_Template(rf, ctx) { if (rf & 1) {
            i0.ɵɵelementStart(0, "div", 0);
            i0.ɵɵtemplate(1, SpinnerComponent_span_1_Template, 1, 7, "span", 1)(2, SpinnerComponent_i_2_Template, 1, 6, "i", 2)(3, SpinnerComponent_span_3_Template, 1, 1, "span", 3)(4, SpinnerComponent_div_4_Template, 2, 1, "div", 4);
            i0.ɵɵelementEnd();
        } if (rf & 2) {
            i0.ɵɵadvance();
            i0.ɵɵproperty("ngIf", ctx.type === "image");
            i0.ɵɵadvance();
            i0.ɵɵproperty("ngIf", ctx.type === "icon");
            i0.ɵɵadvance();
            i0.ɵɵproperty("ngIf", ctx.showCaption);
            i0.ɵɵadvance();
            i0.ɵɵproperty("ngIf", !ctx.showCaption && ctx.spinnerMessages);
        } }, dependencies: [i2.NgClass, i2.NgForOf, i2.NgIf, i2.NgStyle, i1$1.TextContentDirective], encapsulation: 2 }); }
}
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(SpinnerComponent, [{
        type: Component,
        args: [{ selector: '[wmSpinner]', providers: [
                    provideAsWidgetRef(SpinnerComponent)
                ], exportAs: 'wmSpinner', template: "<div class=\"spinner-message\">\n    <span class=\"spinner-image animated infinite\" [ngClass]=\"animation\" aria-hidden=\"true\"\n        [ngStyle]=\"{width: imagewidth, height: imageheight, backgroundImage: 'url(' + picture + ')', backgroundSize: imagewidth}\"\n        *ngIf=\"type === 'image'\"></span>\n    <i class=\"spinner-image animated infinite\" aria-hidden=\"true\" [ngClass]=\"[iconclass, animation]\" [style.fonSize]=\"iconsize\" *ngIf=\"type === 'icon'\"></i>\n    <span class=\"spinner-text\" [innerHTML]=\"caption\" *ngIf=\"showCaption\"></span>\n    <div class=\"spinner-messages\" *ngIf=\"!showCaption && spinnerMessages\">\n        <p *ngFor=\"let value of spinnerMessages\" [textContent]=\"value\"></p>\n    </div>\n</div>\n" }]
    }], () => [{ type: i0.Injector }, { type: i1$1.ImagePipe }, { type: undefined, decorators: [{
                type: Inject,
                args: ['EXPLICIT_CONTEXT']
            }, {
                type: Optional
            }] }], null); })();
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(SpinnerComponent, { className: "SpinnerComponent", filePath: "spinner/spinner.component.ts", lineNumber: 20 }); })();

const registerProps = () => {
    register('wm-video', new Map([
        ['autoplay', PROP_BOOLEAN],
        ['class', PROP_STRING],
        ['controls', PROP_BOOLEAN],
        ['hint', PROP_STRING],
        ['arialabel', PROP_STRING],
        ['loop', PROP_BOOLEAN],
        ['mp4format', PROP_STRING],
        ['muted', PROP_BOOLEAN],
        ['name', PROP_STRING],
        ['oggformat', PROP_STRING],
        ['show', { value: true, ...PROP_BOOLEAN }],
        ['subtitlelang', { value: 'en', ...PROP_STRING }],
        ['subtitlesource', PROP_STRING],
        ['tabindex', { value: 0, ...PROP_NUMBER }],
        ['videoposter', { value: 'resources/images/imagelists/default-image.png', ...PROP_STRING }],
        ['videopreload', { value: 'none', ...PROP_STRING }],
        ['videosupportmessage', { value: 'Your browser does not support the video tag.', ...PROP_STRING }],
        ['webmformat', PROP_STRING]
    ]));
};

const _c0 = ["wmVideo", ""];
function VideoComponent_source_3_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "source", 4);
    i0.ɵɵpipe(1, "trustAs");
} if (rf & 2) {
    const ctx_r0 = i0.ɵɵnextContext();
    i0.ɵɵproperty("src", i0.ɵɵpipeBind2(1, 1, ctx_r0.mp4format, "resource"), i0.ɵɵsanitizeUrl);
} }
function VideoComponent_source_4_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "source", 5);
    i0.ɵɵpipe(1, "trustAs");
} if (rf & 2) {
    const ctx_r0 = i0.ɵɵnextContext();
    i0.ɵɵproperty("src", i0.ɵɵpipeBind2(1, 1, ctx_r0.webmformat, "resource"), i0.ɵɵsanitizeUrl);
} }
function VideoComponent_source_5_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "source", 6);
    i0.ɵɵpipe(1, "trustAs");
} if (rf & 2) {
    const ctx_r0 = i0.ɵɵnextContext();
    i0.ɵɵproperty("src", i0.ɵɵpipeBind2(1, 1, ctx_r0.oggformat, "resource"), i0.ɵɵsanitizeUrl);
} }
const DEFAULT_CLS = 'app-video';
const WIDGET_CONFIG = {
    widgetType: 'wm-video',
    hostClass: DEFAULT_CLS,
    displayType: DISPLAY_TYPE.INLINE_BLOCK
};
class VideoComponent extends StylableComponent {
    static { this.initializeProps = registerProps(); }
    constructor(inj, trustAsPipe, explicitContext) {
        super(inj, WIDGET_CONFIG, explicitContext);
        this.trustAsPipe = trustAsPipe;
        /**
         * subtitle language property eg: en
         */
        this.subtitlelang = 'en';
        styler(this.nativeElement, this);
    }
    // DO NOT use ngIf binding for the track. As of v6.0.Beta7 there is an error creating a void track node
    onPropertyChange(key, nv, ov) {
        if (key === 'subtitlesource') {
            let track = this.nativeElement.querySelector('track');
            if (track) {
                removeNode(track, true);
            }
            track = createElement('track', {
                kind: 'subtitles',
                label: this.subtitlelang,
                srclang: this.subtitlelang,
                src: this.trustAsPipe.transform(nv, SecurityContext.RESOURCE_URL),
                default: ''
            }, true);
            appendNode(track, this.nativeElement.querySelector('video'));
        }
        else if (key === 'mp4format') {
            this.mp4format = transformFileURI(nv);
        }
        else if (key === 'webmformat') {
            this.webmformat = transformFileURI(nv);
        }
        else if (key === 'oggformat') {
            this.oggformat = transformFileURI(nv);
        }
        super.onPropertyChange(key, nv, ov);
    }
    static { this.ɵfac = function VideoComponent_Factory(t) { return new (t || VideoComponent)(i0.ɵɵdirectiveInject(i0.Injector), i0.ɵɵdirectiveInject(i1$1.TrustAsPipe), i0.ɵɵdirectiveInject('EXPLICIT_CONTEXT', 8)); }; }
    static { this.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: VideoComponent, selectors: [["", "wmVideo", ""]], features: [i0.ɵɵProvidersFeature([
                provideAsWidgetRef(VideoComponent)
            ]), i0.ɵɵInheritDefinitionFeature], attrs: _c0, decls: 7, vars: 17, consts: [[3, "preload", "src", "muted", "poster", "controls", "loop", "autoplay"], ["type", "video/mp4", 3, "src", 4, "ngIf"], ["type", "video/webm", 3, "src", 4, "ngIf"], ["type", "video/ogg", 3, "src", 4, "ngIf"], ["type", "video/mp4", 3, "src"], ["type", "video/webm", 3, "src"], ["type", "video/ogg", 3, "src"]], template: function VideoComponent_Template(rf, ctx) { if (rf & 1) {
            i0.ɵɵelementStart(0, "video", 0);
            i0.ɵɵpipe(1, "trustAs");
            i0.ɵɵpipe(2, "image");
            i0.ɵɵtemplate(3, VideoComponent_source_3_Template, 2, 4, "source", 1)(4, VideoComponent_source_4_Template, 2, 4, "source", 2)(5, VideoComponent_source_5_Template, 2, 4, "source", 3);
            i0.ɵɵtext(6);
            i0.ɵɵelementEnd();
        } if (rf & 2) {
            i0.ɵɵproperty("preload", ctx.videopreload)("src", i0.ɵɵpipeBind2(1, 12, ctx.mp4format, "resource"), i0.ɵɵsanitizeUrl)("muted", ctx.muted)("poster", i0.ɵɵpipeBind1(2, 15, ctx.videoposter), i0.ɵɵsanitizeUrl)("controls", ctx.controls)("loop", ctx.loop)("autoplay", ctx.autoplay);
            i0.ɵɵattribute("aria-label", ctx.arialabel || "video");
            i0.ɵɵadvance(3);
            i0.ɵɵproperty("ngIf", ctx.mp4format);
            i0.ɵɵadvance();
            i0.ɵɵproperty("ngIf", ctx.webmformat);
            i0.ɵɵadvance();
            i0.ɵɵproperty("ngIf", ctx.oggformat);
            i0.ɵɵadvance();
            i0.ɵɵtextInterpolate1(" ", ctx.videosupportmessage, "\n");
        } }, dependencies: [i2.NgIf, i1$1.TrustAsPipe, i1$1.ImagePipe], encapsulation: 2 }); }
}
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(VideoComponent, [{
        type: Component,
        args: [{ selector: '[wmVideo]', providers: [
                    provideAsWidgetRef(VideoComponent)
                ], template: "<video [attr.aria-label]=\"arialabel || 'video'\" [preload]=\"videopreload\"\n       [src]=\"mp4format | trustAs: 'resource'\"\n       [muted]=\"muted\"\n       [poster]=\"videoposter | image\"\n       [controls]=\"controls\"\n       [loop]=\"loop\"\n       [autoplay]=\"autoplay\">\n    <source type=\"video/mp4\" [src]=\"mp4format | trustAs: 'resource'\" *ngIf=\"mp4format\">\n    <source type=\"video/webm\" [src]=\"webmformat | trustAs: 'resource'\" *ngIf=\"webmformat\">\n    <source type=\"video/ogg\" [src]=\"oggformat | trustAs: 'resource'\" *ngIf=\"oggformat\">\n    {{videosupportmessage}}\n</video>\n" }]
    }], () => [{ type: i0.Injector }, { type: i1$1.TrustAsPipe }, { type: undefined, decorators: [{
                type: Inject,
                args: ['EXPLICIT_CONTEXT']
            }, {
                type: Optional
            }] }], null); })();
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(VideoComponent, { className: "VideoComponent", filePath: "video/video.component.ts", lineNumber: 22 }); })();

const components = [
    AnchorComponent,
    AudioComponent,
    HtmlDirective,
    IconComponent,
    IframeComponent,
    LabelDirective,
    PictureDirective,
    SpinnerComponent,
    VideoComponent
];
class BasicModule {
    static { this.ɵfac = function BasicModule_Factory(t) { return new (t || BasicModule)(); }; }
    static { this.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: BasicModule }); }
    static { this.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ imports: [CommonModule,
            WmComponentsModule] }); }
}
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(BasicModule, [{
        type: NgModule,
        args: [{
                imports: [
                    CommonModule,
                    WmComponentsModule
                ],
                declarations: [...components],
                exports: [...components]
            }]
    }], null, null); })();
(function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(BasicModule, { declarations: [AnchorComponent,
        AudioComponent,
        HtmlDirective,
        IconComponent,
        IframeComponent,
        LabelDirective,
        PictureDirective,
        SpinnerComponent,
        VideoComponent], imports: [CommonModule,
        WmComponentsModule], exports: [AnchorComponent,
        AudioComponent,
        HtmlDirective,
        IconComponent,
        IframeComponent,
        LabelDirective,
        PictureDirective,
        SpinnerComponent,
        VideoComponent] }); })();

/**
 * Generated bundle index. Do not edit.
 */

export { AnchorComponent, AudioComponent, BasicModule, HtmlDirective, IconComponent, IframeComponent, LabelDirective, PictureDirective, SpinnerComponent, VideoComponent, disableContextMenu };
//# sourceMappingURL=index.mjs.map
