import * as i0 from '@angular/core';
import { Component, Inject, Optional, ViewChild, Directive, NgModule } from '@angular/core';
import * as i3 from '@angular/common';
import { CommonModule } from '@angular/common';
import * as i2 from 'ngx-bootstrap/dropdown';
import { BsDropdownModule } from 'ngx-bootstrap/dropdown';
import * as i5 from '@wm/components/base';
import { PROP_STRING, PROP_BOOLEAN, register, APPLY_STYLES_TYPE, styler, provideAsWidgetRef, StylableComponent, WmComponentsModule } from '@wm/components/base';
import * as i1 from '@wm/components/basic';
import { BasicModule } from '@wm/components/basic';
import * as i4 from '@wm/components/navigation/menu';
import { MenuAdapterComponent, MenuModule } from '@wm/components/navigation/menu';
import { removeAttr, setAttr } from '@wm/core';

const registerProps$3 = () => {
    register('wm-card', new Map([
        ['actions', PROP_STRING],
        ['animation', PROP_STRING],
        ['class', PROP_STRING],
        ['iconclass', PROP_STRING],
        ['iconurl', PROP_STRING],
        ['imageheight', { value: '200px', ...PROP_STRING }],
        ['itemaction', PROP_STRING],
        ['itemchildren', PROP_STRING],
        ['itemicon', PROP_STRING],
        ['itemlabel', PROP_STRING],
        ['itemlink', PROP_STRING],
        ['name', PROP_STRING],
        ['picturesource', PROP_STRING],
        ['picturetitle', { value: '', ...PROP_STRING }],
        ['show', { value: true, ...PROP_BOOLEAN }],
        ['subheading', PROP_STRING],
        ['title', PROP_STRING],
        ['userrole', PROP_STRING]
    ]));
};

const _c0$1 = ["cardContainerWrapper"];
const _c1$1 = ["wmCard", ""];
const _c2$1 = ["*", "*", "*"];
const _c3 = a0 => ({ "max-height": a0 });
function CardComponent_div_0_div_1_i_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "i", 12);
} if (rf & 2) {
    const ctx_r0 = i0.ɵɵnextContext(3);
    i0.ɵɵproperty("ngClass", ctx_r0.iconclass);
} }
function CardComponent_div_0_div_1_img_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "img", 13);
} if (rf & 2) {
    const ctx_r0 = i0.ɵɵnextContext(3);
    i0.ɵɵproperty("src", ctx_r0.iconurl, i0.ɵɵsanitizeUrl);
} }
function CardComponent_div_0_div_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 9);
    i0.ɵɵtemplate(1, CardComponent_div_0_div_1_i_1_Template, 1, 1, "i", 10)(2, CardComponent_div_0_div_1_img_2_Template, 1, 1, "img", 11);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r0 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance();
    i0.ɵɵproperty("ngIf", ctx_r0.iconclass && !ctx_r0.iconurl);
    i0.ɵɵadvance();
    i0.ɵɵproperty("ngIf", ctx_r0.iconurl);
} }
function CardComponent_div_0_div_5_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 14);
    i0.ɵɵelement(1, "div", 15);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r0 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance();
    i0.ɵɵproperty("autoClose", ctx_r0.autoclose !== "disabled");
} }
function CardComponent_div_0_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 3);
    i0.ɵɵtemplate(1, CardComponent_div_0_div_1_Template, 3, 2, "div", 4);
    i0.ɵɵelementStart(2, "div", 5);
    i0.ɵɵelement(3, "h4", 6)(4, "h5", 7);
    i0.ɵɵelementEnd();
    i0.ɵɵtemplate(5, CardComponent_div_0_div_5_Template, 2, 1, "div", 8);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r0 = i0.ɵɵnextContext();
    i0.ɵɵadvance();
    i0.ɵɵproperty("ngIf", ctx_r0.iconclass || ctx_r0.iconurl);
    i0.ɵɵadvance(2);
    i0.ɵɵproperty("textContent", ctx_r0.title);
    i0.ɵɵadvance();
    i0.ɵɵproperty("textContent", ctx_r0.subheading);
    i0.ɵɵadvance();
    i0.ɵɵproperty("ngIf", ctx_r0.actions);
} }
function CardComponent_div_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 16);
    i0.ɵɵelement(1, "img", 17);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r0 = i0.ɵɵnextContext();
    i0.ɵɵproperty("ngStyle", i0.ɵɵpureFunction1(1, _c3, ctx_r0.imageheight));
} }
const DEFAULT_CLS$3 = 'app-card card app-panel';
const WIDGET_CONFIG$3 = {
    widgetType: 'wm-card',
    hostClass: DEFAULT_CLS$3
};
class CardComponent extends MenuAdapterComponent {
    static { this.initializeProps = registerProps$3(); }
    constructor(inj, render2, explicitContext) {
        super(inj, WIDGET_CONFIG$3, explicitContext);
        this.render2 = render2;
        styler(this.nativeElement, this, APPLY_STYLES_TYPE.SHELL);
    }
    ngAfterViewInit() {
        super.ngAfterViewInit();
        styler(this.cardContainerElRef.nativeElement, this, APPLY_STYLES_TYPE.INNER_SHELL);
    }
    ngOnInit() {
        super.ngOnInit();
        removeAttr(this.nativeElement.parentElement, 'tabindex');
        setAttr(this.nativeElement, 'tabindex', 0);
        this.render2.listen(this.nativeElement, 'keydown.Enter', (e) => {
            e.preventDefault();
            this.nativeElement.click();
        });
    }
    onPropertyChange(key, nv, ov) {
        if (key === 'title' || key === 'subheading' || key === 'iconclass' || key === 'iconurl' || key === 'actions') {
            this.showHeader = !!(this.title || this.subheading || this.iconclass || this.iconurl || this.actions);
        }
        else {
            super.onPropertyChange(key, nv, ov);
        }
    }
    static { this.ɵfac = function CardComponent_Factory(t) { return new (t || CardComponent)(i0.ɵɵdirectiveInject(i0.Injector), i0.ɵɵdirectiveInject(i0.Renderer2), i0.ɵɵdirectiveInject('EXPLICIT_CONTEXT', 8)); }; }
    static { this.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: CardComponent, selectors: [["", "wmCard", ""]], viewQuery: function CardComponent_Query(rf, ctx) { if (rf & 1) {
            i0.ɵɵviewQuery(_c0$1, 7);
        } if (rf & 2) {
            let _t;
            i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.cardContainerElRef = _t.first);
        } }, features: [i0.ɵɵProvidersFeature([
                provideAsWidgetRef(CardComponent)
            ]), i0.ɵɵInheritDefinitionFeature], attrs: _c1$1, ngContentSelectors: _c2$1, decls: 9, vars: 2, consts: [["cardContainerWrapper", ""], ["class", "app-card-header panel-heading", 4, "ngIf"], ["class", "app-card-image", 3, "ngStyle", 4, "ngIf"], [1, "app-card-header", "panel-heading"], ["class", "app-card-avatar", 4, "ngIf"], [1, "app-card-header-text"], [1, "card-heading", 3, "textContent"], [1, "card-subheading", "text-muted", 3, "textContent"], ["class", "panel-actions", 4, "ngIf"], [1, "app-card-avatar"], ["class", "app-icon", 3, "ngClass", 4, "ngIf"], ["class", "img-circle", 3, "src", 4, "ngIf"], [1, "app-icon", 3, "ngClass"], [1, "img-circle", 3, "src"], [1, "panel-actions"], ["wmMenu", "", "dropdown", "", "type", "anchor", "iconclass", "wm-sl-l sl-more-menu-vertical", "menuposition", "down,left", "hint", "Actions", "caption", "", "dataset.bind", "actions", 1, "panel-action", 3, "autoClose"], [1, "app-card-image", 3, "ngStyle"], ["wmPicture", "", "picturesource.bind", "picturesource", "hint.bind", "picturetitle", 1, "card-image"]], template: function CardComponent_Template(rf, ctx) { if (rf & 1) {
            i0.ɵɵprojectionDef(_c2$1);
            i0.ɵɵtemplate(0, CardComponent_div_0_Template, 6, 4, "div", 1)(1, CardComponent_div_1_Template, 2, 3, "div", 2);
            i0.ɵɵelementStart(2, "div", null, 0);
            i0.ɵɵprojection(4, 0, ["ngProjectAs", "[wmCardContent]", 5, ["", "wmCardContent", ""]]);
            i0.ɵɵelementEnd();
            i0.ɵɵelementStart(5, "div");
            i0.ɵɵprojection(6, 1, ["ngProjectAs", "[wmCardActions]", 5, ["", "wmCardActions", ""]]);
            i0.ɵɵelementEnd();
            i0.ɵɵelementStart(7, "div");
            i0.ɵɵprojection(8, 2, ["ngProjectAs", "[wmCardFooter]", 5, ["", "wmCardFooter", ""]]);
            i0.ɵɵelementEnd();
        } if (rf & 2) {
            i0.ɵɵproperty("ngIf", ctx.showHeader);
            i0.ɵɵadvance();
            i0.ɵɵproperty("ngIf", ctx.picturesource);
        } }, dependencies: [i1.PictureDirective, i2.BsDropdownDirective, i3.NgClass, i3.NgIf, i3.NgStyle, i4.MenuComponent, i5.TextContentDirective], encapsulation: 2 }); }
}
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CardComponent, [{
        type: Component,
        args: [{ selector: '[wmCard]', providers: [
                    provideAsWidgetRef(CardComponent)
                ], template: "<div class=\"app-card-header panel-heading\" *ngIf=\"showHeader\">\n    <div class=\"app-card-avatar\" *ngIf=\"iconclass || iconurl\">\n        <i class=\"app-icon\" [ngClass]=\"iconclass\" *ngIf=\"iconclass && !iconurl\"></i>\n        <img class=\"img-circle\" [src]=\"iconurl\" *ngIf=\"iconurl\" />\n    </div>\n    <div class=\"app-card-header-text\">\n        <h4 class=\"card-heading\" [textContent]=\"title\"></h4>\n        <h5 class=\"card-subheading text-muted\" [textContent]=\"subheading\"></h5>\n    </div>\n    <div class=\"panel-actions\" *ngIf=\"actions\">\n        <!-- TODO(punith) need to bind autoclose-->\n        <div wmMenu dropdown\n             [autoClose]=\"autoclose !== 'disabled'\"\n             class=\"panel-action\"\n             type=\"anchor\"\n             iconclass=\"wm-sl-l sl-more-menu-vertical\"\n             menuposition=\"down,left\"\n             hint=\"Actions\"\n             caption=\"\"\n             dataset.bind=\"actions\">\n        </div>\n    </div>\n</div>\n<div class=\"app-card-image\" *ngIf=\"picturesource\"  [ngStyle]=\"{'max-height':imageheight}\">\n   <img wmPicture class=\"card-image\" picturesource.bind=\"picturesource\" hint.bind=\"picturetitle\" />\n</div>\n<div #cardContainerWrapper>\n    <ng-content ngProjectAs=\"[wmCardContent]\"></ng-content>\n</div>\n<div>\n    <ng-content ngProjectAs=\"[wmCardActions]\"></ng-content>\n</div>\n<div>\n    <ng-content ngProjectAs=\"[wmCardFooter]\"></ng-content>\n</div>\n" }]
    }], () => [{ type: i0.Injector }, { type: i0.Renderer2 }, { type: undefined, decorators: [{
                type: Inject,
                args: ['EXPLICIT_CONTEXT']
            }, {
                type: Optional
            }] }], { cardContainerElRef: [{
            type: ViewChild,
            args: ['cardContainerWrapper', { static: true }]
        }] }); })();
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(CardComponent, { className: "CardComponent", filePath: "card.component.ts", lineNumber: 33 }); })();

const registerProps$2 = () => {
    register('wm-card-actions', new Map([
        ['class', PROP_STRING],
        ['name', PROP_STRING],
        ['show', { value: true, ...PROP_BOOLEAN }],
    ]));
};

const DEFAULT_CLS$2 = 'app-card-actions';
const WIDGET_CONFIG$2 = {
    widgetType: 'wm-card-actions',
    hostClass: DEFAULT_CLS$2
};
class CardActionsDirective extends StylableComponent {
    static { this.initializeProps = registerProps$2(); }
    constructor(inj, explicitContext) {
        super(inj, WIDGET_CONFIG$2, explicitContext);
        styler(this.nativeElement, this, APPLY_STYLES_TYPE.CONTAINER);
    }
    static { this.ɵfac = function CardActionsDirective_Factory(t) { return new (t || CardActionsDirective)(i0.ɵɵdirectiveInject(i0.Injector), i0.ɵɵdirectiveInject('EXPLICIT_CONTEXT', 8)); }; }
    static { this.ɵdir = /*@__PURE__*/ i0.ɵɵdefineDirective({ type: CardActionsDirective, selectors: [["", "wmCardActions", ""]], features: [i0.ɵɵInheritDefinitionFeature] }); }
}
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CardActionsDirective, [{
        type: Directive,
        args: [{
                selector: '[wmCardActions]'
            }]
    }], () => [{ type: i0.Injector }, { type: undefined, decorators: [{
                type: Inject,
                args: ['EXPLICIT_CONTEXT']
            }, {
                type: Optional
            }] }], null); })();

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

const _c0 = ["cardContentContainer"];
const _c1 = ["wmCardContent", ""];
const _c2 = ["*"];
const DEFAULT_CLS$1 = 'app-card-content card-body card-block';
const WIDGET_CONFIG$1 = {
    widgetType: 'wm-card-content',
    hostClass: DEFAULT_CLS$1
};
class CardContentComponent extends StylableComponent {
    static { this.initializeProps = registerProps$1(); }
    constructor(inj, explicitContext) {
        super(inj, WIDGET_CONFIG$1, explicitContext);
    }
    ngAfterViewInit() {
        super.ngAfterViewInit();
        styler(this.cardContentContainerElRef.nativeElement, this, APPLY_STYLES_TYPE.CONTAINER);
    }
    static { this.ɵfac = function CardContentComponent_Factory(t) { return new (t || CardContentComponent)(i0.ɵɵdirectiveInject(i0.Injector), i0.ɵɵdirectiveInject('EXPLICIT_CONTEXT', 8)); }; }
    static { this.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: CardContentComponent, selectors: [["div", "wmCardContent", ""]], viewQuery: function CardContentComponent_Query(rf, ctx) { if (rf & 1) {
            i0.ɵɵviewQuery(_c0, 5);
        } if (rf & 2) {
            let _t;
            i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.cardContentContainerElRef = _t.first);
        } }, features: [i0.ɵɵProvidersFeature([
                provideAsWidgetRef(CardContentComponent)
            ]), i0.ɵɵInheritDefinitionFeature], attrs: _c1, ngContentSelectors: _c2, decls: 3, vars: 0, consts: [["cardContentContainer", ""], ["partial-container-target", ""]], template: function CardContentComponent_Template(rf, ctx) { if (rf & 1) {
            i0.ɵɵprojectionDef();
            i0.ɵɵelementStart(0, "div", 1, 0);
            i0.ɵɵprojection(2);
            i0.ɵɵelementEnd();
        } }, encapsulation: 2 }); }
}
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CardContentComponent, [{
        type: Component,
        args: [{ selector: 'div[wmCardContent]', providers: [
                    provideAsWidgetRef(CardContentComponent)
                ], template: "<div partial-container-target #cardContentContainer>\n    <ng-content></ng-content>\n</div>" }]
    }], () => [{ type: i0.Injector }, { type: undefined, decorators: [{
                type: Inject,
                args: ['EXPLICIT_CONTEXT']
            }, {
                type: Optional
            }] }], { cardContentContainerElRef: [{
            type: ViewChild,
            args: ['cardContentContainer']
        }] }); })();
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(CardContentComponent, { className: "CardContentComponent", filePath: "card-content/card-content.component.ts", lineNumber: 19 }); })();

const registerProps = () => {
    register('wm-card-footer', new Map([
        ['class', PROP_STRING],
        ['name', PROP_STRING],
        ['show', { value: true, ...PROP_BOOLEAN }],
    ]));
};

const DEFAULT_CLS = 'app-card-footer text-muted card-footer';
const WIDGET_CONFIG = {
    widgetType: 'wm-card-footer',
    hostClass: DEFAULT_CLS
};
class CardFooterDirective extends StylableComponent {
    static { this.initializeProps = registerProps(); }
    constructor(inj, explicitContext) {
        super(inj, WIDGET_CONFIG, explicitContext);
        styler(this.nativeElement, this, APPLY_STYLES_TYPE.CONTAINER);
    }
    static { this.ɵfac = function CardFooterDirective_Factory(t) { return new (t || CardFooterDirective)(i0.ɵɵdirectiveInject(i0.Injector), i0.ɵɵdirectiveInject('EXPLICIT_CONTEXT', 8)); }; }
    static { this.ɵdir = /*@__PURE__*/ i0.ɵɵdefineDirective({ type: CardFooterDirective, selectors: [["", "wmCardFooter", ""]], features: [i0.ɵɵInheritDefinitionFeature] }); }
}
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CardFooterDirective, [{
        type: Directive,
        args: [{
                selector: '[wmCardFooter]'
            }]
    }], () => [{ type: i0.Injector }, { type: undefined, decorators: [{
                type: Inject,
                args: ['EXPLICIT_CONTEXT']
            }, {
                type: Optional
            }] }], null); })();

const components = [
    CardComponent,
    CardActionsDirective,
    CardContentComponent,
    CardFooterDirective
];
class CardModule {
    static { this.ɵfac = function CardModule_Factory(t) { return new (t || CardModule)(); }; }
    static { this.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: CardModule }); }
    static { this.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ imports: [BasicModule,
            BsDropdownModule,
            CommonModule,
            MenuModule,
            WmComponentsModule] }); }
}
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CardModule, [{
        type: NgModule,
        args: [{
                imports: [
                    BasicModule,
                    BsDropdownModule,
                    CommonModule,
                    MenuModule,
                    WmComponentsModule
                ],
                declarations: [...components],
                exports: [...components]
            }]
    }], null, null); })();
(function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(CardModule, { declarations: [CardComponent,
        CardActionsDirective,
        CardContentComponent,
        CardFooterDirective], imports: [BasicModule,
        BsDropdownModule,
        CommonModule,
        MenuModule,
        WmComponentsModule], exports: [CardComponent,
        CardActionsDirective,
        CardContentComponent,
        CardFooterDirective] }); })();

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

export { CardActionsDirective, CardComponent, CardContentComponent, CardFooterDirective, CardModule };
//# sourceMappingURL=index.mjs.map
