define(["require", "exports", "../ScreenSizeDetection"], function (require, exports, ScreenSizeDetection_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var DownloadsController = /** @class */ (function () {
        function DownloadsController(DownloadsService, $timeout) {
            this.DownloadsService = DownloadsService;
            this.$timeout = $timeout;
            this.itemsPerPage = 7;
            this.queryMinLength = 3;
            this.initialGroups = 0;
            this.query = '';
            this.loading = false;
            this.items = [];
            this.controlsMaxSize = 9;
            this.subscribeObservables();
        }
        DownloadsController.prototype.subscribeObservables = function () {
            var _this = this;
            ScreenSizeDetection_1.default.get().subscribe(function (screensize) {
                console.log(screensize);
                var controlsMaxSize;
                if (screensize === 'xs' || screensize === 'sm') {
                    controlsMaxSize = 5;
                }
                else {
                    controlsMaxSize = 9;
                }
                _this.$timeout(function () {
                    _this.controlsMaxSize = controlsMaxSize;
                });
            });
        };
        DownloadsController.prototype.getData = function () {
            var _this = this;
            this.loading = true;
            this.DownloadsService.get().then(function (response) {
                _this.loading = false;
                _this.items = response.data;
            });
        };
        Object.defineProperty(DownloadsController.prototype, "downloads", {
            get: function () {
                if (this.query.length < this.queryMinLength) {
                    return this.items.slice(0, this.initialGroups);
                }
                else {
                    return this.items;
                }
            },
            enumerable: true,
            configurable: true
        });
        DownloadsController.prototype.$onInit = function () {
            this.getData();
        };
        return DownloadsController;
    }());
    exports.DownloadsController = DownloadsController;
});
//# sourceMappingURL=downloads.controller.js.map