"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
require("bootstrap");
var core_1 = require("@angular/core");
var dialogRoot_service_1 = require("./dialogRoot.service");
var jquery_provider_1 = require("../../services/jquery/jquery.provider");
var DialogOutletComponent = (function () {
    function DialogOutletComponent(dialogRoot, jquery) {
        var _this = this;
        this.dialogRoot = dialogRoot;
        this.jquery = jquery;
        dialogRoot.openDialog.subscribe(function () {
            _this.jquery('.rlModal').modal('show');
        });
        dialogRoot.closeDialog.subscribe(function () {
            _this.jquery('.rlModal').modal('hide');
        });
        this.dialogSize$ = dialogRoot.openDialog.map(function (dialog) {
            return dialog.size ? "modal-" + dialog.size : '';
        });
    }
    DialogOutletComponent.prototype.dismiss = function () {
        this.dialogRoot.dismissing = true;
        this.dialogRoot.closeDialog.next(null);
    };
    DialogOutletComponent.prototype.ngAfterViewInit = function () {
        var _this = this;
        this.jquery('.rlModal').on('hide.bs.modal', function (event) {
            if (_this.dialogRoot.dismissing) {
                _this.dialogRoot.dismissing = false;
                return;
            }
            var canClose = _this.dialogRoot.onClosing();
            if (!canClose) {
                event.preventDefault();
            }
        });
    };
    return DialogOutletComponent;
}());
DialogOutletComponent = __decorate([
    core_1.Component({
        selector: 'rlDialogOutlet',
        template: require('./dialogOutlet.html'),
    }),
    __metadata("design:paramtypes", [dialogRoot_service_1.DialogRootService,
        jquery_provider_1.JQueryProvider])
], DialogOutletComponent);
exports.DialogO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