import { Attribute, Component, Inject, Injector, Optional, TemplateRef, ViewChild } from '@angular/core';
import { toBoolean } from '@wm/core';
import { provideAsDialogRef, provideAsWidgetRef } from '@wm/components/base';
import { BaseDialog } from '@wm/components/dialogs';
import { registerProps } from './iframe-dialog.props';
import * as i0 from "@angular/core";
import * as i1 from "@wm/components/basic";
import * as i2 from "@angular/common";
import * as i3 from "@wm/components/dialogs";
import * as i4 from "@wm/components/input";
const _c0 = ["dialogTemplate"];
const _c1 = ["wmIframeDialog", ""];
function IframeDialogComponent_ng_template_0_div_0_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "div", 5);
} if (rf & 2) {
    const ctx_r0 = i0.ɵɵnextContext(2);
    i0.ɵɵproperty("closable", ctx_r0.closable)("iconclass", ctx_r0.iconclass)("iconurl", ctx_r0.iconurl)("iconwidth", ctx_r0.iconwidth)("iconheight", ctx_r0.iconheight)("iconmargin", ctx_r0.iconmargin)("heading", ctx_r0.title)("headinglevel", ctx_r0.headinglevel)("title", ctx_r0.title)("titleid", ctx_r0.titleId);
} }
function IframeDialogComponent_ng_template_0_div_3_Template(rf, ctx) { if (rf & 1) {
    const _r2 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "div", 6)(1, "button", 7);
    i0.ɵɵlistener("click", function IframeDialogComponent_ng_template_0_div_3_Template_button_click_1_listener($event) { i0.ɵɵrestoreView(_r2); const ctx_r0 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r0.onOk($event)); });
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const ctx_r0 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance();
    i0.ɵɵattribute("aria-label", ctx_r0.oktext);
} }
function IframeDialogComponent_ng_template_0_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵtemplate(0, IframeDialogComponent_ng_template_0_div_0_Template, 1, 10, "div", 1);
    i0.ɵɵelementStart(1, "div", 2);
    i0.ɵɵelement(2, "div", 3);
    i0.ɵɵelementEnd();
    i0.ɵɵtemplate(3, IframeDialogComponent_ng_template_0_div_3_Template, 2, 1, "div", 4);
} if (rf & 2) {
    const ctx_r0 = i0.ɵɵnextContext();
    i0.ɵɵproperty("ngIf", ctx_r0.showheader);
    i0.ɵɵadvance(3);
    i0.ɵɵproperty("ngIf", ctx_r0.showactions);
} }
const DIALOG_CLS = 'app-dialog modal-dialog app-iframe-dialog';
const WIDGET_INFO = { widgetType: 'wm-iframedialog' };
export class IframeDialogComponent extends BaseDialog {
    static { this.initializeProps = registerProps(); }
    constructor(inj, dialogClass, modal, closable, explicitContext) {
        if (modal === null || modal === undefined) {
            modal = false;
        }
        if (closable === null || closable === undefined) {
            closable = true;
        }
        // setting the backdrop to 'static' will not close the dialog on backdrop click
        const backdrop = toBoolean(modal) ? 'static' : true;
        super(inj, WIDGET_INFO, {
            class: `${DIALOG_CLS} ${dialogClass || ''}`,
            backdrop,
            keyboard: !toBoolean(modal)
        }, explicitContext);
    }
    getTemplateRef() {
        return this.dialogTemplate;
    }
    /**
     * Click event handler for the ok button
     * invokes on-ok event callback
     * @param {Event} $event
     */
    onOk($event) {
        this.invokeEventCallback('ok', { $event });
    }
    ngOnInit() {
        super.ngOnInit();
        this.register(this.viewParent);
    }
    static { this.ɵfac = function IframeDialogComponent_Factory(t) { return new (t || IframeDialogComponent)(i0.ɵɵdirectiveInject(i0.Injector), i0.ɵɵinjectAttribute('class'), i0.ɵɵinjectAttribute('modal'), i0.ɵɵinjectAttribute('closable'), i0.ɵɵdirectiveInject('EXPLICIT_CONTEXT', 8)); }; }
    static { this.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: IframeDialogComponent, selectors: [["div", "wmIframeDialog", ""]], viewQuery: function IframeDialogComponent_Query(rf, ctx) { if (rf & 1) {
            i0.ɵɵviewQuery(_c0, 7);
        } if (rf & 2) {
            let _t;
            i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.dialogTemplate = _t.first);
        } }, features: [i0.ɵɵProvidersFeature([
                provideAsWidgetRef(IframeDialogComponent),
                provideAsDialogRef(IframeDialogComponent)
            ]), i0.ɵɵInheritDefinitionFeature], attrs: _c1, decls: 2, vars: 0, consts: [["dialogTemplate", ""], ["wmDialogHeader", "", 3, "closable", "iconclass", "iconurl", "iconwidth", "iconheight", "iconmargin", "heading", "headinglevel", "title", "titleid", 4, "ngIf"], ["wmDialogBody", ""], ["wmIframe", "", "encodeurl.bind", "encodeurl", "iframesrc.bind", "url", "height.bind", "height", "width.bind", "width", "hint.bind", "hint"], ["wmDialogFooter", "", 4, "ngIf"], ["wmDialogHeader", "", 3, "closable", "iconclass", "iconurl", "iconwidth", "iconheight", "iconmargin", "heading", "headinglevel", "title", "titleid"], ["wmDialogFooter", ""], ["caption.bind", "oktext", "wmButton", "", 1, "btn-primary", "ok-action", 3, "click"]], template: function IframeDialogComponent_Template(rf, ctx) { if (rf & 1) {
            i0.ɵɵtemplate(0, IframeDialogComponent_ng_template_0_Template, 4, 2, "ng-template", null, 0, i0.ɵɵtemplateRefExtractor);
        } }, dependencies: [i1.IframeComponent, i2.NgIf, i3.DialogBodyDirective, i3.DialogFooterDirective, i3.DialogHeaderComponent, i4.ButtonComponent], encapsulation: 2 }); }
}
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(IframeDialogComponent, [{
        type: Component,
        args: [{ selector: 'div[wmIframeDialog]', providers: [
                    provideAsWidgetRef(IframeDialogComponent),
                    provideAsDialogRef(IframeDialogComponent)
                ], template: "<ng-template #dialogTemplate>\n    <div wmDialogHeader [closable]=\"closable\"\n         [iconclass]=\"iconclass\"\n         [iconurl]=\"iconurl\"\n         [iconwidth]=\"iconwidth\"\n         [iconheight]=\"iconheight\"\n         [iconmargin]=\"iconmargin\"\n         [heading]=\"title\"\n         [headinglevel]=\"headinglevel\"\n         *ngIf=\"showheader\"\n         [title]=\"title\"\n         [titleid]=\"titleId\"\n    ></div>\n    <div wmDialogBody>\n        <div wmIframe encodeurl.bind=\"encodeurl\" iframesrc.bind=\"url\" height.bind=\"height\" width.bind=\"width\" hint.bind=\"hint\"></div>\n    </div>\n    <div wmDialogFooter *ngIf=\"showactions\">\n        <button (click)=\"onOk($event)\" [attr.aria-label]=\"oktext\" caption.bind=\"oktext\" class=\"btn-primary ok-action\"\n                wmButton></button>\n    </div>\n</ng-template>\n" }]
    }], () => [{ type: i0.Injector }, { type: undefined, decorators: [{
                type: Attribute,
                args: ['class']
            }] }, { type: undefined, decorators: [{
                type: Attribute,
                args: ['modal']
            }] }, { type: undefined, decorators: [{
                type: Attribute,
                args: ['closable']
            }] }, { type: undefined, decorators: [{
                type: Inject,
                args: ['EXPLICIT_CONTEXT']
            }, {
                type: Optional
            }] }], { dialogTemplate: [{
            type: ViewChild,
            args: ['dialogTemplate', { static: true }]
        }] }); })();
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(IframeDialogComponent, { className: "IframeDialogComponent", filePath: "iframe-dialog.component.ts", lineNumber: 30 }); })();
//# sourceMappingURL=data:application/json;base64, 