"use strict";
var static_1 = require("@angular/upgrade/static");
var angular = require("angular");
var typescript_angular_utilities_1 = require("typescript-angular-utilities");
var absoluteTime_1 = require("./components/inputs/absoluteTime/absoluteTime");
var busy_1 = require("./components/busy/busy");
var index_1 = require("./components/buttons/index");
var index_2 = require("./components/inputs/index");
var commaList_1 = require("./components/commaList/commaList");
var dialogOutlet_1 = require("./components/dialog/dialogOutlet");
var form_1 = require("./components/form/form");
var stringWithWatermark_1 = require("./components/stringWithWatermark/stringWithWatermark");
var input_1 = require("./components/inputs/input");
var validationInput_1 = require("./components/inputs/validationInput");
var baseButton_1 = require("./components/buttons/baseButton");
var buttonAsync_1 = require("./components/buttons/buttonAsync/buttonAsync");
var columnSearchFilter_service_1 = require("./components/cardContainer/filters/columnSearchFilter/columnSearchFilter.service");
var index_3 = require("./components/cardContainer/paging/index");
var sorter_service_1 = require("./components/cardContainer/sorts/sorter/sorter.service");
var isEmpty_pipe_1 = require("./pipes/isEmpty/isEmpty.pipe");
var truncate_pipe_1 = require("./pipes/truncate/truncate.pipe");
var date_pipe_1 = require("./pipes/date/date.pipe");
var localizeStringDates_pipe_1 = require("./pipes/localizeStringDates/localizeStringDates.pipe");
var autosaveAction_service_1 = require("./services/autosaveAction/autosaveAction.service");
var documentWrapper_service_1 = require("./services/documentWrapper/documentWrapper.service");
var windowWrapper_service_1 = require("./services/windowWrapper/windowWrapper.service");
var index_4 = require("./services/breakpoints/index");
exports.visibleBreakpointServiceName = index_4.visibleBreakpointServiceName;
var componentsDefaultTheme_1 = require("./components/componentsDefaultTheme");
exports.moduleName = 'rl.components.downgrade';
exports.autosaveActionServiceName = 'autosaveAction';
exports.cardContainerBuilderServiceName = 'rlCardContainerBuilder';
exports.dataPagerFactoryName = 'rlDataPagerFactory';
exports.documentServiceName = 'documentWrapper';
exports.columnSearchFilterName = 'columnSearchFilter';
exports.sorterServiceName = 'rlSorterService';
exports.windowServiceName = 'windowWrapper';
function PipeDowngrader(pipe) {
    // factory that returns a filter
    return function () { return function (value) {
        var args = [];
        for (var _i = 1; _i < arguments.length; _i++) {
            args[_i - 1] = arguments[_i];
        }
        return pipe.transform.apply(pipe, [value].concat(args));
    }; };
}
exports.PipeDowngrader = PipeDowngrader;
exports.downgradedComponents = [
    absoluteTime_1.AbsoluteTimeComponent,
    busy_1.BusyComponent,
    index_1.ButtonComponent,
    index_1.ButtonAsyncComponent,
    index_1.ButtonLinkComponent,
    index_1.ButtonLongClickComponent,
    index_1.ButtonRouteComponent,
    index_1.ButtonSubmitComponent,
    index_1.ButtonToggleComponent,
    index_2.CheckboxComponent,
    commaList_1.CommaListComponent,
    dialogOutlet_1.DialogOutletComponent,
    form_1.FormComponent,
    index_2.TextboxComponent,
    stringWithWatermark_1.StringWithWatermarkComponent,
];
angular.module(exports.moduleName, [])
    .value(componentsDefaultTheme_1.defaultThemeValueName, static_1.downgradeInjectable('defaultThemeNg1'))
    .filter('isEmpty', PipeDowngrader(new isEmpty_pipe_1.IsEmptyPipe(typescript_angular_utilities_1.services.object.objectUtility)))
    .filter('truncate', PipeDowngrader(new truncate_pipe_1.TruncatePipe(typescript_angular_utilities_1.services.object.objectUtility)))
    .filter('rlDate', PipeDowngrader(new date_pipe_1.DatePipe(typescript_angular_utilities_1.services.object.objectUtility)))
    .filter('rlLocalizeStringDates', PipeDowngrader(new localizeStringDates_pipe_1.LocalizeStringDatesPipe(typescript_angular_utilities_1.services.timezone.timezoneService)))
    .factory(exports.autosaveActionServiceName, static_1.downgradeInjectable(autosaveAction_service_1.AutosaveActionService))
    .factory(exports.cardContainerBuilderServiceName, static_1.downgradeInjectable(exports.cardContainerBuilderServiceName))
    .factory(exports.dataPagerFactoryName, static_1.downgradeInjectable(index_3.DataPagerOld))
    .factory(exports.columnSearchFilterName, static_1.downgradeInjectable(columnSearchFilter_service_1.ColumnSearchFilter))
    .factory(exports.sorterServiceName, static_1.downgradeInjectable(sorter_service_1.Sorter))
    .factory(exports.documentServiceName, static_1.downgradeInjectable(documentWrapper_service_1.DocumentService))
    .factory(index_4.visibleBreakpointServiceName, static_1.downgradeInjectable(index_4.VisibleBreakpointService))
    .factory(exports.windowServiceName, static_1.downgradeInjectable(windowWrapper_service_1.WindowService))
    .directive('rlAbsoluteTime', static_1.downgradeComponent({
    component: absoluteTime_1.AbsoluteTimeComponent,
    inputs: validationInput_1.validationInputs,
    outputs: input_1.baseOutputs,
}))
    .directive('rlBusyNg', static_1.downgradeComponent({
    component: busy_1.BusyComponent,
    inputs: ['loading', 'size'],
}))
    .directive('rlButtonNg', static_1.downgradeComponent({
    component: index_1.ButtonComponent,
    inputs: baseButton_1.baseInputs,
    outputs: ['trigger'],
}))
    .directive('rlButtonAsyncNg', static_1.downgradeComponent({
    component: index_1.ButtonAsyncComponent,
    inputs: buttonAsync_1.asyncInputs,
}))
    .directive('rlButtonLinkNg', static_1.downgradeComponent({
    component: index_1.ButtonLinkComponent,
    inputs: baseButton_1.baseInputs.concat(['link', 'newTab']),
}))
    .directive('rlButtonLongClickNg', static_1.downgradeComponent({
    component: index_1.ButtonLongClickComponent,
    inputs: buttonAsync_1.asyncInputs.concat(['warning']),
}))
    .directive('rlButtonRouteNg', static_1.downgradeComponent({
    component: index_1.ButtonRouteComponent,
    inputs: baseButton_1.baseInputs.concat(['link', 'activeClass', 'newTab']),
}))
    .directive('rlButtonSubmitNg', static_1.downgradeComponent({
    component: index_1.ButtonSubmitComponent,
    inputs: baseButton_1.baseInputs,
}))
    .directive('rlButtonToggleNg', static_1.downgradeComponent({
    component: index_1.ButtonToggleComponent,
    inputs: baseButton_1.baseInputs.concat(['value']),
    outputs: ['change', 'valueChange'],
}))
    .directive('rlCheckboxNg', static_1.downgradeComponent({
    component: index_2.CheckboxComponent,
    inputs: input_1.baseInputs.concat(['active']),
    outputs: input_1.baseOutputs,
}))
    .directive('rlCommaListNg', static_1.downgradeComponent({
    component: commaList_1.CommaListComponent,
    inputs: ['list', 'transform', 'max'],
}))
    .directive('rlDialogOutlet', static_1.downgradeComponent({
    component: dialogOutlet_1.DialogOutletComponent,
}))
    .directive('rlFormNg', static_1.downgradeComponent({
    component: form_1.FormComponent,
    inputs: ['save'],
}))
    .directive('rlTextboxNg', static_1.downgradeComponent({
    component: index_2.TextboxComponent,
    inputs: validationInput_1.validationInputs.concat(['maxlength']),
    outputs: input_1.baseOutputs,
}))
    .directive('rlStringWithWatermarkNg', static_1.downgradeComponent({
    component: stringWithWatermark_1.StringWithWatermarkComponent,
    inputs: ['string', 'watermark'],
}));
//# sourceMappingURL=data:application/json;base64, 