text: import { Component, Input, Output, EventEmitter } from '@angular/core';
  import { NgbDate } from './ngb-date';
  import { toInteger } from '../util/util';
  import { NgbDatepickerI18n } from './datepicker-i18n';
  import { NgbCalendar } from './ngb-calendar';
  export var NgbDatepickerNavigationSelect = (function () {
      function NgbDatepickerNavigationSelect(i18n, calendar) {
          this.i18n = i18n;
          this.calendar = calendar;
          this.years = [];
          this.select = new EventEmitter();
          this.months = calendar.getMonths();
      }
      NgbDatepickerNavigationSelect.prototype.ngOnChanges = function (changes) {
          if (changes['maxDate'] || changes['minDate'] || changes['date']) {
              this._generateYears();
              this._generateMonths();
          }
      };
      NgbDatepickerNavigationSelect.prototype.changeMonth = function (month) { this.select.emit(new NgbDate(this.date.year, toInteger(month), 1)); };
      NgbDatepickerNavigationSelect.prototype.changeYear = function (year) { this.select.emit(new NgbDate(toInteger(year), this.date.month, 1)); };
      NgbDatepickerNavigationSelect.prototype._generateMonths = function () {
          var _this = this;
          this.months = this.calendar.getMonths();
          if (this.date && this.date.year === this.minDate.year) {
              var index = this.months.findIndex(function (month) { return month === _this.minDate.month; });
              this.months = this.months.slice(index);
          }
          if (this.date && this.date.year === this.maxDate.year) {
              var index = this.months.findIndex(function (month) { return month === _this.maxDate.month; });
              this.months = this.months.slice(0, index + 1);
          }
      };
      NgbDatepickerNavigationSelect.prototype._generateYears = function () {
          var _this = this;
          this.years = Array.from({ length: this.maxDate.year - this.minDate.year + 1 }, function (e, i) { return _this.minDate.year + i; });
      };
      NgbDatepickerNavigationSelect.decorators = [
          { type: Component, args: [{
                      selector: 'ngb-datepicker-navigation-select',
                      styles: ["\n    select {\n      /* to align with btn-sm */\n      padding: 0.25rem 0.5rem;\n      font-size: 0.875rem;      \n      line-height: 1.25;\n      /* to cancel the custom height set by custom-select */\n      height: inherit;\n      width: 50%;\n    }\n  "],
                      template: "\n    <select [disabled]=\"disabled\" class=\"custom-select d-inline-block\" [value]=\"date?.month\" (change)=\"changeMonth($event.target.value)\">\n      <option *ngFor=\"let m of months\" [value]=\"m\">{{ i18n.getMonthShortName(m) }}</option>\n    </select>" +
                          "<select [disabled]=\"disabled\" class=\"custom-select d-inline-block\" [value]=\"date?.year\" (change)=\"changeYear($event.target.value)\">\n      <option *ngFor=\"let y of years\" [value]=\"y\">{{ y }}</option>\n    </select> \n  " // template needs to be formatted in a certain way so we don't add empty text nodes
                  },] },
      ];
      /** @nocollapse */
      NgbDatepickerNavigationSelect.ctorParameters = function () { return [
          { type: NgbDatepickerI18n, },
          { type: NgbCalendar, },
      ]; };
      NgbDatepickerNavigationSelect.propDecorators = {
          'date': [{ type: Input },],
          'disabled': [{ type: Input },],
          'maxDate': [{ type: Input },],
          'minDate': [{ type: Input },],
          'select': [{ type: Output },],
      };
      return NgbDatepickerNavigationSelect;
  }());
  //# sourceMappingURL=datepicker-navigation-select.js.map