import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output, } from '@angular/core';
import { PICKER_TIME_RANGES } from './helpers';
import * as i0 from "@angular/core";
function MetricTimePickComponent_ng_template_0_ng_container_0_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementContainerStart(0);
    i0.ɵɵelement(1, "aui-icon", 5);
    i0.ɵɵelementContainerEnd();
} }
function MetricTimePickComponent_ng_template_0_ng_template_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵtext(0);
    i0.ɵɵpipe(1, "translate");
} if (rf & 2) {
    i0.ɵɵtextInterpolate1(" ", i0.ɵɵpipeBind1(1, 1, "time_range"), ": ");
} }
function MetricTimePickComponent_ng_template_0_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵtemplate(0, MetricTimePickComponent_ng_template_0_ng_container_0_Template, 2, 0, "ng-container", 3);
    i0.ɵɵtemplate(1, MetricTimePickComponent_ng_template_0_ng_template_1_Template, 2, 3, "ng-template", null, 4, i0.ɵɵtemplateRefExtractor);
} if (rf & 2) {
    const _r4 = i0.ɵɵreference(2);
    const ctx_r1 = i0.ɵɵnextContext();
    i0.ɵɵproperty("ngIf", ctx_r1.icon)("ngIfElse", _r4);
} }
function MetricTimePickComponent_aui_option_3_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "aui-option", 6);
    i0.ɵɵpipe(1, "translate");
    i0.ɵɵtext(2);
    i0.ɵɵpipe(3, "translate");
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const item_r6 = ctx.$implicit;
    i0.ɵɵproperty("label", i0.ɵɵpipeBind1(1, 3, item_r6.name))("value", item_r6);
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate1(" ", i0.ɵɵpipeBind1(3, 5, item_r6.name), " ");
} }
export class MetricTimePickComponent {
    constructor() {
        this.icon = true;
        this.time = PICKER_TIME_RANGES[1];
        this.timeRange = PICKER_TIME_RANGES;
        this.timeSelected = new EventEmitter();
    }
    changeTime() {
        this.timeSelected.emit(this.time);
    }
}
MetricTimePickComponent.ɵfac = function MetricTimePickComponent_Factory(t) { return new (t || MetricTimePickComponent)(); };
MetricTimePickComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: MetricTimePickComponent, selectors: [["acl-metric-time-pick"]], inputs: { icon: "icon", time: "time", timeRange: "timeRange" }, outputs: { timeSelected: "timeSelected" }, decls: 4, vars: 3, consts: [["iconWrapper", ""], [3, "aclPrefixLabel", "ngModel", "ngModelChange"], [3, "label", "value", 4, "ngFor", "ngForOf"], [4, "ngIf", "ngIfElse"], ["elseTemplate", ""], ["icon", "basic:time"], [3, "label", "value"]], template: function MetricTimePickComponent_Template(rf, ctx) { if (rf & 1) {
        i0.ɵɵtemplate(0, MetricTimePickComponent_ng_template_0_Template, 3, 2, "ng-template", null, 0, i0.ɵɵtemplateRefExtractor);
        i0.ɵɵelementStart(2, "aui-select", 1);
        i0.ɵɵlistener("ngModelChange", function MetricTimePickComponent_Template_aui_select_ngModelChange_2_listener($event) { return ctx.time = $event; })("ngModelChange", function MetricTimePickComponent_Template_aui_select_ngModelChange_2_listener() { return ctx.changeTime(); });
        i0.ɵɵtemplate(3, MetricTimePickComponent_aui_option_3_Template, 4, 7, "aui-option", 2);
        i0.ɵɵelementEnd();
    } if (rf & 2) {
        const _r0 = i0.ɵɵreference(1);
        i0.ɵɵadvance(2);
        i0.ɵɵproperty("aclPrefixLabel", _r0)("ngModel", ctx.time);
        i0.ɵɵadvance(1);
        i0.ɵɵproperty("ngForOf", ctx.timeRange);
    } }, styles: ["[_nghost-%COMP%] > aui-select[_ngcontent-%COMP%]{font-weight:400}"], changeDetection: 0 });
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MetricTimePickComponent, [{
        type: Component,
        args: [{ selector: 'acl-metric-time-pick', template: `
    <ng-template #iconWrapper>
      <ng-container *ngIf="icon; else elseTemplate">
        <aui-icon icon="basic:time"></aui-icon>
      </ng-container>
      <ng-template #elseTemplate> {{ 'time_range' | translate }}: </ng-template>
    </ng-template>
    <aui-select
      [aclPrefixLabel]="iconWrapper"
      [(ngModel)]="time"
      (ngModelChange)="changeTime()"
    >
      <aui-option
        *ngFor="let item of timeRange"
        [label]="item.name | translate"
        [value]="item"
      >
        {{ item.name | translate }}
      </aui-option>
    </aui-select>
  `, changeDetection: ChangeDetectionStrategy.OnPush, styles: [":host>aui-select{font-weight:400}\n"] }]
    }], null, { icon: [{
            type: Input
        }], time: [{
            type: Input
        }], timeRange: [{
            type: Input
        }], timeSelected: [{
            type: Output
        }] }); })();
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWV0cmljLXRpbWUtcGljay5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL2xpYnMvY29tbW9uL3NyYy9tZXRyaWMtY2hhcnQvbWV0cmljLXRpbWUtcGljay50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQ0wsdUJBQXVCLEVBQ3ZCLFNBQVMsRUFDVCxZQUFZLEVBQ1osS0FBSyxFQUNMLE1BQU0sR0FDUCxNQUFNLGVBQWUsQ0FBQztBQUV2QixPQUFPLEVBQUUsa0JBQWtCLEVBQUUsTUFBTSxXQUFXLENBQUM7OztJQU96Qyw2QkFBOEM7SUFDNUMsOEJBQXVDO0lBQ3pDLDBCQUFlOzs7SUFDYSxZQUFnQzs7O0lBQWhDLG9FQUFnQzs7O0lBSDVELHdHQUVlO0lBQ2YsdUlBQTBFOzs7O0lBSDNELGtDQUFZLGlCQUFBOzs7SUFVM0IscUNBSUM7O0lBQ0MsWUFDRjs7SUFBQSxpQkFBYTs7O0lBSlgsMERBQStCLGtCQUFBO0lBRy9CLGVBQ0Y7SUFERSxtRUFDRjs7QUFNTixNQUFNLE9BQU8sdUJBQXVCO0lBMUJwQztRQTJCVyxTQUFJLEdBQUcsSUFBSSxDQUFDO1FBRVosU0F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