import { OverlayPanel } from 'primeng-lts/overlaypanel';
import { Component, Input, Output, EventEmitter, ViewEncapsulation, ViewChild, ElementRef } from '@angular/core';
import * as i0 from "@angular/core";
import * as i1 from "primeng-lts/inputtext";
import * as i2 from "@angular/common";
import * as i3 from "primeng-lts/accordion";
import * as i4 from "primeng-lts/tooltip";
import * as i5 from "../al-search-bar/al-search-bar.component";
import * as i6 from "primeng-lts/overlaypanel";
import * as i7 from "../pipes/al-sort-pipe";
import * as i8 from "../pipes/filter-list-by-search-pipe";
import * as i9 from "../pipes/al-prefix-multiplier.pipe";
var _c0 = ["popoverModal"];
var _c1 = ["searchFilterKey"];
function AlFilterComponent_div_4_Template(rf, ctx) { if (rf & 1) {
    var _r5 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "div", 7);
    i0.ɵɵlistener("click", function AlFilterComponent_div_4_Template_div_click_0_listener() { i0.ɵɵrestoreView(_r5); var ctx_r4 = i0.ɵɵnextContext(); return ctx_r4.clearAllFilters(); });
    i0.ɵɵelementStart(1, "span");
    i0.ɵɵtext(2, "CLEAR ALL FILTERS");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(3, "i", 8);
    i0.ɵɵtext(4, "close");
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
} if (rf & 2) {
    var ctx_r1 = i0.ɵɵnextContext();
    i0.ɵɵproperty("ngClass", ctx_r1.clearFilter ? "show" : "hide");
} }
function AlFilterComponent_p_accordion_5_ng_container_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementContainer(0);
} }
function AlFilterComponent_p_accordion_5_ng_template_3_ng_container_0_ng_container_3_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementContainer(0);
} }
var _c2 = function (a0) { return { $implicit: a0 }; };
function AlFilterComponent_p_accordion_5_ng_template_3_ng_container_0_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementContainerStart(0);
    i0.ɵɵelementStart(1, "p", 15);
    i0.ɵɵtext(2);
    i0.ɵɵelementEnd();
    i0.ɵɵtemplate(3, AlFilterComponent_p_accordion_5_ng_template_3_ng_container_0_ng_container_3_Template, 1, 0, "ng-container", 11);
    i0.ɵɵelementContainerEnd();
} if (rf & 2) {
    var f_r14 = ctx.$implicit;
    i0.ɵɵnextContext(2);
    var _r10 = i0.ɵɵreference(6);
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(f_r14.caption);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngTemplateOutlet", _r10)("ngTemplateOutletContext", i0.ɵɵpureFunction1(3, _c2, f_r14));
} }
function AlFilterComponent_p_accordion_5_ng_template_3_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵtemplate(0, AlFilterComponent_p_accordion_5_ng_template_3_ng_container_0_Template, 4, 5, "ng-container", 14);
} if (rf & 2) {
    var list_r12 = ctx.$implicit;
    var ctx_r9 = i0.ɵɵnextContext(2);
    i0.ɵɵproperty("ngForOf", list_r12.children)("ngForTrackBy", ctx_r9.filterTrackByFn);
} }
function AlFilterComponent_p_accordion_5_ng_template_5_ng_container_0_ng_container_5_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementContainer(0);
} }
function AlFilterComponent_p_accordion_5_ng_template_5_ng_container_0_ng_template_6_span_0_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "span", 27);
    i0.ɵɵelementStart(1, "b");
    i0.ɵɵtext(2);
    i0.ɵɵpipe(3, "alPrefixMultiplier");
    i0.ɵɵelementEnd();
    i0.ɵɵtext(4);
    i0.ɵɵpipe(5, "alPrefixMultiplier");
    i0.ɵɵelementEnd();
} if (rf & 2) {
    var vDescr_r22 = i0.ɵɵnextContext(2).$implicit;
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(3, 2, vDescr_r22.count));
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate1("/", i0.ɵɵpipeBind1(5, 4, vDescr_r22.total), "");
} }
function AlFilterComponent_p_accordion_5_ng_template_5_ng_container_0_ng_template_6_span_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "span", 28);
    i0.ɵɵelementStart(1, "b");
    i0.ɵɵtext(2);
    i0.ɵɵpipe(3, "alPrefixMultiplier");
    i0.ɵɵelementEnd();
    i0.ɵɵtext(4);
    i0.ɵɵpipe(5, "alPrefixMultiplier");
    i0.ɵɵelementEnd();
} if (rf & 2) {
    var vDescr_r22 = i0.ɵɵnextContext(2).$implicit;
    var ctx_r29 = i0.ɵɵnextContext(3);
    i0.ɵɵpropertyInterpolate2("pTooltip", "", vDescr_r22.count, " ", ctx_r29.filterConfig.toolTipText, "");
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(3, 4, vDescr_r22.count));
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate1("/", i0.ɵɵpipeBind1(5, 6, vDescr_r22.total), "");
} }
function AlFilterComponent_p_accordion_5_ng_template_5_ng_container_0_ng_template_6_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵtemplate(0, AlFilterComponent_p_accordion_5_ng_template_5_ng_container_0_ng_template_6_span_0_Template, 6, 6, "span", 25);
    i0.ɵɵtemplate(1, AlFilterComponent_p_accordion_5_ng_template_5_ng_container_0_ng_template_6_span_1_Template, 6, 8, "span", 26);
} if (rf & 2) {
    var ctx_r25 = i0.ɵɵnextContext(4);
    i0.ɵɵproperty("ngIf", ctx_r25.filterConfig.showFiltersCount && !ctx_r25.filterConfig.showToolTip);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", ctx_r25.filterConfig.showFiltersCount && ctx_r25.filterConfig.showToolTip);
} }
function AlFilterComponent_p_accordion_5_ng_template_5_ng_container_0_ng_template_8_span_0_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "span", 27);
    i0.ɵɵtext(1);
    i0.ɵɵpipe(2, "alPrefixMultiplier");
    i0.ɵɵelementEnd();
} if (rf & 2) {
    var vDescr_r22 = i0.ɵɵnextContext(2).$implicit;
    i0.ɵɵadvance(1);
    i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(2, 1, vDescr_r22.count));
} }
function AlFilterComponent_p_accordion_5_ng_template_5_ng_container_0_ng_template_8_span_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "span", 28);
    i0.ɵɵtext(1);
    i0.ɵɵpipe(2, "alPrefixMultiplier");
    i0.ɵɵelementEnd();
} if (rf & 2) {
    var vDescr_r22 = i0.ɵɵnextContext(2).$implicit;
    var ctx_r33 = i0.ɵɵnextContext(3);
    i0.ɵɵpropertyInterpolate2("pTooltip", "", vDescr_r22.count, " ", ctx_r33.filterConfig.toolTipText, "");
    i0.ɵɵadvance(1);
    i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(2, 3, vDescr_r22.count));
} }
function AlFilterComponent_p_accordion_5_ng_template_5_ng_container_0_ng_template_8_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵtemplate(0, AlFilterComponent_p_accordion_5_ng_template_5_ng_container_0_ng_template_8_span_0_Template, 3, 3, "span", 25);
    i0.ɵɵtemplate(1, AlFilterComponent_p_accordion_5_ng_template_5_ng_container_0_ng_template_8_span_1_Template, 3, 5, "span", 26);
} if (rf & 2) {
    var ctx_r27 = i0.ɵɵnextContext(4);
    i0.ɵɵproperty("ngIf", ctx_r27.filterConfig.showFiltersCount && !ctx_r27.filterConfig.showToolTip);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", ctx_r27.filterConfig.showFiltersCount && ctx_r27.filterConfig.showToolTip);
} }
var _c3 = function (a0) { return { "highlight-filter": a0 }; };
var _c4 = function (a0, a1) { return { "ui-icon-check-box": a0, "ui-icon-check-box-outline-blank": a1 }; };
function AlFilterComponent_p_accordion_5_ng_template_5_ng_container_0_Template(rf, ctx) { if (rf & 1) {
    var _r37 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementContainerStart(0);
    i0.ɵɵelementStart(1, "div", 19);
    i0.ɵɵlistener("click", function AlFilterComponent_p_accordion_5_ng_template_5_ng_container_0_Template_div_click_1_listener($event) { i0.ɵɵrestoreView(_r37); var vDescr_r22 = ctx.$implicit; var ctx_r36 = i0.ɵɵnextContext(3); return ctx_r36.selectedFilter(vDescr_r22, $event); });
    i0.ɵɵelement(2, "i", 20);
    i0.ɵɵelementStart(3, "div", 21);
    i0.ɵɵtext(4);
    i0.ɵɵtemplate(5, AlFilterComponent_p_accordion_5_ng_template_5_ng_container_0_ng_container_5_Template, 1, 0, "ng-container", 22);
    i0.ɵɵtemplate(6, AlFilterComponent_p_accordion_5_ng_template_5_ng_container_0_ng_template_6_Template, 2, 2, "ng-template", null, 23, i0.ɵɵtemplateRefExtractor);
    i0.ɵɵtemplate(8, AlFilterComponent_p_accordion_5_ng_template_5_ng_container_0_ng_template_8_Template, 2, 2, "ng-template", null, 24, i0.ɵɵtemplateRefExtractor);
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
    i0.ɵɵelementContainerEnd();
} if (rf & 2) {
    var vDescr_r22 = ctx.$implicit;
    var _r24 = i0.ɵɵreference(7);
    var _r26 = i0.ɵɵreference(9);
    var ctx_r17 = i0.ɵɵnextContext(3);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(7, _c3, (ctx_r17.filterConfig == null ? null : ctx_r17.filterConfig.highlight) && vDescr_r22.activeFilter));
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction2(9, _c4, ctx_r17.filterConfig.activeIcon && vDescr_r22.activeFilter, ctx_r17.filterConfig.activeIcon && !vDescr_r22.activeFilter));
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngClass", vDescr_r22.cssClasses);
    i0.ɵɵadvance(1);
    i0.ɵɵtextInterpolate1(" ", vDescr_r22.caption, " ");
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", vDescr_r22.total)("ngIfThen", _r24)("ngIfElse", _r26);
} }
function AlFilterComponent_p_accordion_5_ng_template_5_div_4_Template(rf, ctx) { if (rf & 1) {
    var _r40 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "div", 29);
    i0.ɵɵlistener("click", function AlFilterComponent_p_accordion_5_ng_template_5_div_4_Template_div_click_0_listener() { i0.ɵɵrestoreView(_r40); var list_r16 = i0.ɵɵnextContext().$implicit; var ctx_r38 = i0.ɵɵnextContext(2); return ctx_r38.showMoreFilterValues(list_r16); });
    i0.ɵɵelementStart(1, "em");
    i0.ɵɵtext(2, "Show More...");
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
} }
function AlFilterComponent_p_accordion_5_ng_template_5_div_5_Template(rf, ctx) { if (rf & 1) {
    var _r42 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "div", 29);
    i0.ɵɵlistener("click", function AlFilterComponent_p_accordion_5_ng_template_5_div_5_Template_div_click_0_listener($event) { i0.ɵɵrestoreView(_r42); var list_r16 = i0.ɵɵnextContext().$implicit; var ctx_r41 = i0.ɵɵnextContext(2); return ctx_r41.popoverModal.show($event, list_r16); });
    i0.ɵɵelementStart(1, "em");
    i0.ɵɵtext(2, "Show More...");
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
} }
function AlFilterComponent_p_accordion_5_ng_template_5_p_accordion_6_ng_container_5_span_5_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "span");
    i0.ɵɵtext(1);
    i0.ɵɵpipe(2, "alPrefixMultiplier");
    i0.ɵɵelementEnd();
} if (rf & 2) {
    var vDescr_r46 = i0.ɵɵnextContext().$implicit;
    i0.ɵɵadvance(1);
    i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(2, 1, vDescr_r46.count));
} }
function AlFilterComponent_p_accordion_5_ng_template_5_p_accordion_6_ng_container_5_span_6_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "span", 28);
    i0.ɵɵtext(1);
    i0.ɵɵpipe(2, "alPrefixMultiplier");
    i0.ɵɵelementEnd();
} if (rf & 2) {
    var vDescr_r46 = i0.ɵɵnextContext().$implicit;
    var ctx_r48 = i0.ɵɵnextContext(4);
    i0.ɵɵpropertyInterpolate2("pTooltip", "", vDescr_r46.count, " ", ctx_r48.filterConfig.toolTipText, "");
    i0.ɵɵadvance(1);
    i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(2, 3, vDescr_r46.count));
} }
function AlFilterComponent_p_accordion_5_ng_template_5_p_accordion_6_ng_container_5_Template(rf, ctx) { if (rf & 1) {
    var _r52 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementContainerStart(0);
    i0.ɵɵelementStart(1, "div", 36);
    i0.ɵɵlistener("click", function AlFilterComponent_p_accordion_5_ng_template_5_p_accordion_6_ng_container_5_Template_div_click_1_listener($event) { i0.ɵɵrestoreView(_r52); var vDescr_r46 = ctx.$implicit; var ctx_r51 = i0.ɵɵnextContext(4); return ctx_r51.selectedFilter(vDescr_r46, $event); });
    i0.ɵɵelement(2, "i", 20);
    i0.ɵɵelementStart(3, "div", 21);
    i0.ɵɵtext(4);
    i0.ɵɵtemplate(5, AlFilterComponent_p_accordion_5_ng_template_5_p_accordion_6_ng_container_5_span_5_Template, 3, 3, "span", 37);
    i0.ɵɵtemplate(6, AlFilterComponent_p_accordion_5_ng_template_5_p_accordion_6_ng_container_5_span_6_Template, 3, 5, "span", 38);
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
    i0.ɵɵelementContainerEnd();
} if (rf & 2) {
    var vDescr_r46 = ctx.$implicit;
    var ctx_r45 = i0.ɵɵnextContext(4);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(6, _c3, (ctx_r45.filterConfig == null ? null : ctx_r45.filterConfig.highlight) && vDescr_r46.activeFilter));
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction2(8, _c4, ctx_r45.filterConfig.activeIcon && vDescr_r46.activeFilter, ctx_r45.filterConfig.activeIcon && !vDescr_r46.activeFilter));
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngClass", vDescr_r46.cssClasses);
    i0.ɵɵadvance(1);
    i0.ɵɵtextInterpolate1(" ", vDescr_r46.caption, " ");
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", ctx_r45.filterConfig.showFiltersCount && !ctx_r45.filterConfig.showToolTip);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", ctx_r45.filterConfig.showFiltersCount && ctx_r45.filterConfig.showToolTip);
} }
function AlFilterComponent_p_accordion_5_ng_template_5_p_accordion_6_Template(rf, ctx) { if (rf & 1) {
    var _r54 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "p-accordion", 30, 31);
    i0.ɵɵelementStart(2, "p-accordionTab", 32);
    i0.ɵɵelementStart(3, "al-search-bar", 33);
    i0.ɵɵlistener("onSearchChanged", function AlFilterComponent_p_accordion_5_ng_template_5_p_accordion_6_Template_al_search_bar_onSearchChanged_3_listener($event) { i0.ɵɵrestoreView(_r54); var ctx_r53 = i0.ɵɵnextContext(3); return ctx_r53.applyShowMoreSearchFilter($event); });
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(4, "div", 34);
    i0.ɵɵtemplate(5, AlFilterComponent_p_accordion_5_ng_template_5_p_accordion_6_ng_container_5_Template, 7, 11, "ng-container", 35);
    i0.ɵɵpipe(6, "sort");
    i0.ɵɵpipe(7, "filterListBySearchPipe");
    i0.ɵɵpipe(8, "slice");
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
} if (rf & 2) {
    var _r44 = i0.ɵɵreference(1);
    var list_r16 = i0.ɵɵnextContext().$implicit;
    var ctx_r20 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance(2);
    i0.ɵɵproperty("header", (_r44 == null ? null : _r44.tabs) && (_r44 == null ? null : _r44.tabs.length) > 0 && (_r44 == null ? null : _r44.tabs[0].selected) ? "Show Less..." : "Show More...");
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("placeholder", "Search filters")("autofocus", true);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngClass", list_r16.activeFilter ? "al-h-bold" : "");
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngForOf", i0.ɵɵpipeBind3(6, 5, i0.ɵɵpipeBind2(7, 9, i0.ɵɵpipeBind2(8, 12, list_r16.values, list_r16.shown), ctx_r20.searchShowMorekey), "sort", "asc"));
} }
function AlFilterComponent_p_accordion_5_ng_template_5_p_overlayPanel_7_ng_container_6_span_5_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "span");
    i0.ɵɵtext(1);
    i0.ɵɵpipe(2, "alPrefixMultiplier");
    i0.ɵɵelementEnd();
} if (rf & 2) {
    var vDescr_r58 = i0.ɵɵnextContext().$implicit;
    i0.ɵɵadvance(1);
    i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(2, 1, vDescr_r58.count));
} }
function AlFilterComponent_p_accordion_5_ng_template_5_p_overlayPanel_7_ng_container_6_span_6_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "span", 28);
    i0.ɵɵtext(1);
    i0.ɵɵpipe(2, "alPrefixMultiplier");
    i0.ɵɵelementEnd();
} if (rf & 2) {
    var vDescr_r58 = i0.ɵɵnextContext().$implicit;
    var ctx_r60 = i0.ɵɵnextContext(4);
    i0.ɵɵpropertyInterpolate2("pTooltip", "", vDescr_r58.count, " ", ctx_r60.filterConfig.toolTipText, "");
    i0.ɵɵadvance(1);
    i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(2, 3, vDescr_r58.count));
} }
function AlFilterComponent_p_accordion_5_ng_template_5_p_overlayPanel_7_ng_container_6_Template(rf, ctx) { if (rf & 1) {
    var _r64 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementContainerStart(0);
    i0.ɵɵelementStart(1, "div", 36);
    i0.ɵɵlistener("click", function AlFilterComponent_p_accordion_5_ng_template_5_p_overlayPanel_7_ng_container_6_Template_div_click_1_listener($event) { i0.ɵɵrestoreView(_r64); var vDescr_r58 = ctx.$implicit; var ctx_r63 = i0.ɵɵnextContext(4); return ctx_r63.selectedFilter(vDescr_r58, $event); });
    i0.ɵɵelement(2, "i", 20);
    i0.ɵɵelementStart(3, "div", 21);
    i0.ɵɵtext(4);
    i0.ɵɵtemplate(5, AlFilterComponent_p_accordion_5_ng_template_5_p_overlayPanel_7_ng_container_6_span_5_Template, 3, 3, "span", 37);
    i0.ɵɵtemplate(6, AlFilterComponent_p_accordion_5_ng_template_5_p_overlayPanel_7_ng_container_6_span_6_Template, 3, 5, "span", 38);
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
    i0.ɵɵelementContainerEnd();
} if (rf & 2) {
    var vDescr_r58 = ctx.$implicit;
    var ctx_r57 = i0.ɵɵnextContext(4);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(6, _c3, (ctx_r57.filterConfig == null ? null : ctx_r57.filterConfig.highlight) && vDescr_r58.activeFilter));
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction2(8, _c4, ctx_r57.filterConfig.activeIcon && vDescr_r58.activeFilter, ctx_r57.filterConfig.activeIcon && !vDescr_r58.activeFilter));
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngClass", vDescr_r58.cssClasses);
    i0.ɵɵadvance(1);
    i0.ɵɵtextInterpolate1(" ", vDescr_r58.caption, " ");
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", ctx_r57.filterConfig.showFiltersCount && !ctx_r57.filterConfig.showToolTip);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", ctx_r57.filterConfig.showFiltersCount && ctx_r57.filterConfig.showToolTip);
} }
function AlFilterComponent_p_accordion_5_ng_template_5_p_overlayPanel_7_Template(rf, ctx) { if (rf & 1) {
    var _r66 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "p-overlayPanel", 39, 40);
    i0.ɵɵelementStart(2, "div", 41);
    i0.ɵɵtext(3);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(4, "al-search-bar", 42);
    i0.ɵɵlistener("onSearchChanged", function AlFilterComponent_p_accordion_5_ng_template_5_p_overlayPanel_7_Template_al_search_bar_onSearchChanged_4_listener($event) { i0.ɵɵrestoreView(_r66); var ctx_r65 = i0.ɵɵnextContext(3); return ctx_r65.applyShowMoreSearchFilter($event); });
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(5, "div", 43);
    i0.ɵɵtemplate(6, AlFilterComponent_p_accordion_5_ng_template_5_p_overlayPanel_7_ng_container_6_Template, 7, 11, "ng-container", 14);
    i0.ɵɵpipe(7, "slice");
    i0.ɵɵpipe(8, "filterListBySearchPipe");
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
} if (rf & 2) {
    var list_r16 = i0.ɵɵnextContext().$implicit;
    var ctx_r21 = i0.ɵɵnextContext(2);
    i0.ɵɵproperty("showCloseIcon", true);
    i0.ɵɵadvance(3);
    i0.ɵɵtextInterpolate1(" ", list_r16.caption, "");
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("placeholder", "search filters")("autofocus", true);
    i0.ɵɵadvance(2);
    i0.ɵɵproperty("ngForOf", i0.ɵɵpipeBind2(7, 6, i0.ɵɵpipeBind2(8, 9, list_r16.values, ctx_r21.searchShowMorekey), list_r16.shown))("ngForTrackBy", ctx_r21.filterItemTrackByFn);
} }
function AlFilterComponent_p_accordion_5_ng_template_5_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵtemplate(0, AlFilterComponent_p_accordion_5_ng_template_5_ng_container_0_Template, 10, 12, "ng-container", 14);
    i0.ɵɵpipe(1, "sort");
    i0.ɵɵpipe(2, "slice");
    i0.ɵɵpipe(3, "filterListBySearchPipe");
    i0.ɵɵtemplate(4, AlFilterComponent_p_accordion_5_ng_template_5_div_4_Template, 3, 0, "div", 16);
    i0.ɵɵtemplate(5, AlFilterComponent_p_accordion_5_ng_template_5_div_5_Template, 3, 0, "div", 16);
    i0.ɵɵtemplate(6, AlFilterComponent_p_accordion_5_ng_template_5_p_accordion_6_Template, 9, 15, "p-accordion", 17);
    i0.ɵɵtemplate(7, AlFilterComponent_p_accordion_5_ng_template_5_p_overlayPanel_7_Template, 9, 12, "p-overlayPanel", 18);
} if (rf & 2) {
    var list_r16 = ctx.$implicit;
    var filter_r6 = i0.ɵɵnextContext().$implicit;
    var ctx_r11 = i0.ɵɵnextContext();
    var _r0 = i0.ɵɵreference(2);
    i0.ɵɵproperty("ngForOf", i0.ɵɵpipeBind3(1, 6, i0.ɵɵpipeBind3(2, 10, i0.ɵɵpipeBind2(3, 14, list_r16.values, _r0.value), 0, list_r16.shown), filter_r6.orderBy ? filter_r6.orderBy : filter_r6.count ? "count" : "", filter_r6.orderDirection ? filter_r6.orderDirection : "desc"))("ngForTrackBy", ctx_r11.filterItemTrackByFn);
    i0.ɵɵadvance(4);
    i0.ɵɵproperty("ngIf", ctx_r11.filterConfig.showMoreType === "plain" && list_r16.shown < list_r16.values.length);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", ctx_r11.filterConfig.showMoreType === "popover" && list_r16.shown < list_r16.values.length);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", ctx_r11.filterConfig.showMoreType === "accordion" && list_r16.shown < list_r16.values.length);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", ctx_r11.filterConfig.showMoreType === "popover" && list_r16.shown < list_r16.values.length);
} }
function AlFilterComponent_p_accordion_5_Template(rf, ctx) { if (rf & 1) {
    var _r70 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "p-accordion", 9);
    i0.ɵɵlistener("onOpen", function AlFilterComponent_p_accordion_5_Template_p_accordion_onOpen_0_listener() { i0.ɵɵrestoreView(_r70); var filter_r6 = ctx.$implicit; var ctx_r69 = i0.ɵɵnextContext(); return ctx_r69.onFilterOpened(filter_r6); });
    i0.ɵɵelementStart(1, "p-accordionTab", 10);
    i0.ɵɵtemplate(2, AlFilterComponent_p_accordion_5_ng_container_2_Template, 1, 0, "ng-container", 11);
    i0.ɵɵtemplate(3, AlFilterComponent_p_accordion_5_ng_template_3_Template, 1, 2, "ng-template", null, 12, i0.ɵɵtemplateRefExtractor);
    i0.ɵɵtemplate(5, AlFilterComponent_p_accordion_5_ng_template_5_Template, 8, 17, "ng-template", null, 13, i0.ɵɵtemplateRefExtractor);
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
} if (rf & 2) {
    var filter_r6 = ctx.$implicit;
    var _r8 = i0.ɵɵreference(4);
    var _r10 = i0.ɵɵreference(6);
    i0.ɵɵproperty("multiple", true);
    i0.ɵɵadvance(1);
    i0.ɵɵpropertyInterpolate("header", filter_r6.caption);
    i0.ɵɵproperty("selected", true);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngTemplateOutlet", filter_r6.children && filter_r6.children.length > 0 ? _r8 : _r10)("ngTemplateOutletContext", i0.ɵɵpureFunction1(5, _c2, filter_r6));
} }
function AlFilterComponent_div_6_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 44);
    i0.ɵɵelementStart(1, "div", 45);
    i0.ɵɵtext(2);
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
} if (rf & 2) {
    var ctx_r3 = i0.ɵɵnextContext();
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate1(" ", ctx_r3.filterConfig == null ? null : ctx_r3.filterConfig.helpText, " ");
} }
var AlFilterComponent = /** @class */ (function () {
    function AlFilterComponent() {
        this.filters = [];
        this.alFilterConfig = {};
        this.onClick = new EventEmitter();
        this.onClearAllFilters = new EventEmitter();
        this.filterConfig = {
            showFiltersCount: true,
            hideEmptyFilterValues: false,
            hideNotSelectedValues: false,
            filterValueLimit: 10,
            filterValueIncrement: 10,
            expanded: true,
            showMoreType: "plain",
            showClearFilter: true,
            showSearch: true,
            showToolTip: false,
            toolTipText: '',
            helpText: '',
            showHelpText: false,
            highlight: false,
            activeIcon: false,
            showMoreZeros: false,
            showMoreNoActive: false,
            capitalizeCaptions: false,
        };
        this.searchShowMorekey = "";
        this.clearFilter = false;
        this.positionLeft = '260px';
        this.marginStyle = { 'margin-left': this.positionLeft };
        this.lastFilterSelection = null;
    }
    AlFilterComponent.prototype.ngOnChanges = function (changes) {
        if (changes.hasOwnProperty('alFilterConfig')) {
            Object.assign(this.filterConfig, this.alFilterConfig);
        }
        this.setUpFilterData();
    };
    AlFilterComponent.prototype.selectedFilter = function (vDescriptor, event) {
        this.lastFilterSelection = event.target;
        if (this.filterConfig.showMoreType === 'popover' && this.popoverModal) {
            this.popoverModal.hide();
        }
        this.onClick.emit(vDescriptor);
    };
    AlFilterComponent.prototype.showMoreFilterValues = function (filterProperty) {
        if (this.filterConfig) {
            filterProperty.shown = Math.min(filterProperty.shown + this.filterConfig.filterValueIncrement, filterProperty.values.length);
        }
    };
    AlFilterComponent.prototype.onFilterOpened = function (filterProperty) {
        //  Reset the number of shown entries back to a reasonable default
        if (this.filterConfig) {
            filterProperty.shown = Math.min(filterProperty.values.length, this.filterConfig.filterValueLimit);
            // compensating for the show more so you dont show more and then get 1
            if (filterProperty.values.length - 1 === this.filterConfig.filterValueLimit) {
                filterProperty.shown = filterProperty.values.length;
            }
        }
    };
    AlFilterComponent.prototype.filterTrackByFn = function (index, item) {
        return item.property;
    };
    AlFilterComponent.prototype.filterItemTrackByFn = function (index, item) {
        return item.valueKey;
    };
    AlFilterComponent.prototype.applyShowMoreSearchFilter = function (searchInput) {
        this.searchShowMorekey = searchInput;
    };
    AlFilterComponent.prototype.toFilterValue = function (vDescr) {
        var value = vDescr;
        value.cssClasses = value.cssClasses || [];
        return value;
    };
    AlFilterComponent.prototype.clearAllFilters = function () {
        if (this.searchFilterKey) {
            this.searchFilterKey.nativeElement.value = '';
        }
        this.clearFilter = false;
        this.onClearAllFilters.emit();
    };
    AlFilterComponent.prototype.classifyFilterValue = function (value, activeFilter) {
        var _a;
        value.cssClasses = [];
        if ((_a = this.filterConfig) === null || _a === void 0 ? void 0 : _a.capitalizeCaptions) {
            value.cssClasses.push("capitalize");
        }
        // if (value.metadata && 'borderLeft' in value.metadata) {
        //     value.cssClasses.push(value.metadata.borderLeft as string);
        // }
        if (value.activeFilter) {
            value.cssClasses.push("al-bold"); //  If it's active, make it bold!
        }
    };
    AlFilterComponent.prototype.setUpFilterData = function () {
        var _this = this;
        this.clearFilter = false;
        var auxFn = function (filters) {
            var _loop_1 = function (i) {
                var filter = filters[i];
                if (filter.children) {
                    auxFn(filter.children);
                }
                filter.shown = filter.activeFilter || (filter.values.length < _this.filterConfig.filterValueLimit + 2) ?
                    filter.values.length : _this.filterConfig.filterValueLimit; // don't bother hiding fewer than 3 overflow items and Reset the number of shown for active filters;
                filter.values = filter.values.map(function (value) { return _this.toFilterValue(value); });
                var hasIncidentStatusFilters = filter.values.every(function (value) { var _a; return ((_a = value.metadata) === null || _a === void 0 ? void 0 : _a.key) === "customer_status"; });
                if (_this.filterConfig.showMoreZeros) {
                    var totalZeros = filter.values.filter(function (v) { return v.count === 0; }).length;
                    filter.values = filter.values.sort(function (a, b) {
                        var _a, _b;
                        return a.activeFilter ? -1 : ((_a = b.count) !== null && _a !== void 0 ? _a : 0) - ((_b = a.count) !== null && _b !== void 0 ? _b : 0);
                    });
                    if (_this.filterConfig.showMoreNoActive && filter.values.some(function (v) { return v.activeFilter; })) {
                        var totalToHidden = filter.values.filter(function (v) { return (v.count === 0 && !v.activeFilter) || !v.activeFilter; }).length;
                        if (!hasIncidentStatusFilters) {
                            filter.shown = filter.values.length - totalToHidden;
                        }
                    }
                    else {
                        if (!hasIncidentStatusFilters) {
                            filter.shown = filter.values.length - totalZeros;
                        }
                    }
                }
                filter.values.forEach(function (filterValue) {
                    _this.classifyFilterValue(filterValue, filter.activeFilter);
                });
                if (filter.activeFilter) {
                    _this.clearFilter = true;
                }
            };
            for (var i = 0; i < filters.length; i++) {
                _loop_1(i);
            }
        };
        auxFn(this.filters);
    };
    /** @nocollapse */ AlFilterComponent.ɵfac = function AlFilterComponent_Factory(t) { return new (t || AlFilterComponent)(); };
    /** @nocollapse */ AlFilterComponent.ɵcmp = i0.ɵɵdefineComponent({ type: AlFilterComponent, selectors: [["al-filter"]], viewQuery: function AlFilterComponent_Query(rf, ctx) { if (rf & 1) {
            i0.ɵɵviewQuery(_c0, true);
            i0.ɵɵviewQuery(_c1, true);
        } if (rf & 2) {
            var _t;
            i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.popoverModal = _t.first);
            i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.searchFilterKey = _t.first);
        } }, inputs: { filters: "filters", alFilterConfig: "alFilterConfig" }, outputs: { onClick: "onClick", onClearAllFilters: "onClearAllFilters" }, features: [i0.ɵɵNgOnChangesFeature], decls: 7, vars: 5, consts: [[1, "al-filter-search", 3, "hidden"], ["type", "text", "pInputText", "", "placeholder", "search filters", 1, "ui-inputtext", "p-corner-all", "ui-state-default", "ui-widget"], ["searchFilterKey", ""], [1, "pi", "pi-search", "mx"], ["class", "al-filter-clear", 3, "ngClass", "click", 4, "ngIf"], ["class", "al-filter", 3, "multiple", "onOpen", 4, "ngFor", "ngForOf", "ngForTrackBy"], ["class", "show-help-text", 4, "ngIf"], [1, "al-filter-clear", 3, "ngClass", "click"], [1, "material-icons"], [1, "al-filter", 3, "multiple", "onOpen"], [3, "selected", "header"], [4, "ngTemplateOutlet", "ngTemplateOutletContext"], ["nested", ""], ["normal", ""], [4, "ngFor", "ngForOf", "ngForTrackBy"], [1, "subtitle"], ["class", "symbolic", 3, "click", 4, "ngIf"], ["class", "accordion show-more", 4, "ngIf"], ["class", "popover", 3, "showCloseIcon", 4, "ngIf"], [1, "u-grid", "u-grid-nogutter", "u-items-center", "u-break-all", "filter-option", 3, "ngClass", "click"], [1, "check-icon", 3, "ngClass"], [1, "u-col", "u-flex", "u-justify-between", 3, "ngClass"], [4, "ngIf", "ngIfThen", "ngIfElse"], ["total", ""], ["count", ""], ["class", "u-flex-none u-pl-2", 4, "ngIf"], ["class", "u-flex-none u-pl-2", "tooltipStyleClass", "tool-tip", "class", "u-flex-none u-pl-2", 3, "pTooltip", 4, "ngIf"], [1, "u-flex-none", "u-pl-2"], ["tooltipStyleClass", "tool-tip", 1, "u-flex-none", "u-pl-2", 3, "pTooltip"], [1, "symbolic", 3, "click"], [1, "accordion", "show-more"], ["accordionTemplate", ""], [3, "header"], ["width", "100%", 1, "search-bar", 3, "placeholder", "autofocus", "onSearchChanged"], [1, "scrollable", 3, "ngClass"], [4, "ngFor", "ngForOf"], [1, "u-grid", "u-grid-nogutter", "u-items-center", "filter-option-popover", 3, "ngClass", "click"], [4, "ngIf"], ["class", "u-flex-none u-pl-2", "tooltipStyleClass", "tool-tip", 3, "pTooltip", 4, "ngIf"], [1, "popover", 3, "showCloseIcon"], ["popoverModal", ""], [1, "custom-modal-title"], ["width", "280px", 1, "search-bar", 3, "placeholder", "autofocus", "onSearchChanged"], [1, "scrollable"], [1, "show-help-text"], [1, "description"]], template: function AlFilterComponent_Template(rf, ctx) { if (rf & 1) {
            i0.ɵɵelementStart(0, "div", 0);
            i0.ɵɵelement(1, "input", 1, 2);
            i0.ɵɵelement(3, "i", 3);
            i0.ɵɵelementEnd();
            i0.ɵɵtemplate(4, AlFilterComponent_div_4_Template, 5, 1, "div", 4);
            i0.ɵɵtemplate(5, AlFilterComponent_p_accordion_5_Template, 7, 7, "p-accordion", 5);
            i0.ɵɵtemplate(6, AlFilterComponent_div_6_Template, 3, 1, "div", 6);
        } if (rf & 2) {
            i0.ɵɵproperty("hidden", !ctx.filterConfig.showSearch || ctx.filters.length <= 0);
            i0.ɵɵadvance(4);
            i0.ɵɵproperty("ngIf", ctx.filterConfig.showClearFilter);
            i0.ɵɵadvance(1);
            i0.ɵɵproperty("ngForOf", ctx.filters)("ngForTrackBy", ctx.filterTrackByFn);
            i0.ɵɵadvance(1);
            i0.ɵɵproperty("ngIf", ctx.filterConfig == null ? null : ctx.filterConfig.showHelpText);
        } }, directives: [i1.InputText, i2.NgIf, i2.NgForOf, i2.NgClass, i3.Accordion, i3.AccordionTab, i2.NgTemplateOutlet, i4.Tooltip, i5.AlSearchBarComponent, i6.OverlayPanel], pipes: [i7.AlSortPipe, i2.SlicePipe, i8.FilterListBySearchPipe, i9.AlPrefixMultiplierPipe], styles: ["al-filter .ui-accordion{border-bottom:1px solid var(--ald-g-color-gray-200)}al-filter .ui-accordion .ui-accordion-header{border-bottom:none;margin:var(--ald-g-space-3) var(--ald-g-space-4) var(--ald-g-space-2) var(--ald-g-space-4);padding:0}al-filter .ui-accordion-header-link{justify-content:space-between}al-filter .ui-accordion-toggle-icon{order:2}al-filter .ui-accordion-toggle-icon:before{content:\"\"}al-filter .symbolic{margin-left:var(--ald-g-space-4);margin-top:var(--ald-g-space-2);cursor:pointer}al-filter .ui-accordion .ui-accordion-content{padding:0 0 var(--ald-g-space-3) 0;border-bottom:0}al-filter .al-filter .ui-accordion .ui-accordion-header{background-color:inherit}al-filter .al-filter .ui-accordion .ui-accordion-header a{font-size:var(--ald-g-text-md);color:var(--ald-g-color-gray-500)}al-filter .al-filter .ui-accordion .ui-accordion-header a span.pi{color:var(--ald-g-color-gray-500)}al-filter .al-filter .ui-accordion-header,al-filter .al-filter .ui-accordion-header:hover a{color:var(--ald-g-color-gray-600)}al-filter .al-filter.filter-accordian{margin:var(--ald-g-space-6) 0 var(--ald-g-space-3) 0}al-filter .al-filter .ui-accordion .ui-accordion-header:not(.ui-state-active):not(.ui-state-disabled):hover a{color:var(--ald-g-color-gray-900)}al-filter .al-filter .ui-accordion .ui-accordion-header:not(.ui-state-active):not(.ui-state-disabled):hover{background-color:transparent}al-filter .al-filter .ui-accordion .ui-accordion-header.ui-state-active{background-color:inherit}al-filter .al-filter .ui-accordion .ui-accordion-header.ui-state-active a{font-size:var(--ald-g-text-md)}al-filter .al-filter .ui-accordion .ui-accordion-header.ui-state-active a span.pi{color:var(--ald-g-color-gray-500)}al-filter .al-filter .accordion.show-more .ui-accordion-content{padding:var(--ald-g-space-3);margin:0;border-bottom:none;font-size:var(--ald-g-text-xs)}al-filter .al-filter .accordion.show-more .ui-accordion{border-bottom:none}al-filter .al-filter .accordion.show-more .ui-accordion-header-text{font-size:var(--ald-g-text-md)}al-filter .al-filter .accordion .ui-accordion .ui-accordion-header{border-bottom:none;margin-top:0;padding:var(--ald-g-space-3) 0 var(--ald-g-space-6) 0}al-filter .al-filter .accordion .scrollable{overflow-y:scroll;margin-top:var(--ald-g-space-075)}al-filter .filter-option{margin:0 var(--ald-g-space-4);font-size:var(--ald-g-text-sm);display:flex;align-items:center;justify-content:space-between;cursor:pointer}al-filter .filter-option.capitalize{text-transform:capitalize}al-filter .search-bar{margin-bottom:var(--ald-g-space-075)}al-filter .search-bar .ui-inputtext{padding-left:0}al-filter .highlight-filter i{color:var(--ald-g-color-smoke-blue-500)}al-filter .check-icon{font-size:24px;text-align:left;cursor:pointer;margin-right:3px}al-filter .check-icon.ui-icon-check-box-outline-blank{color:#535353}al-filter .al-h-bold li:not(.al-bold){display:none}al-filter .al-bold{font-weight:700;display:flex}al-filter .show{display:block}al-filter .hide{display:none}al-filter .al-filter-clear{margin-top:var(--ald-g-space-6);border-bottom:1px solid var(--ald-g-color-gray-200);padding:0 var(--ald-g-space-3) var(--ald-g-space-3) var(--ald-g-space-3);cursor:pointer}al-filter .al-filter-clear span{font-size:var(--ald-g-text-sm);color:var(--ald-g-color-gray-900)}al-filter .al-filter-clear i{font-size:1.3em;float:right;margin:var(--ald-g-space-075) var(--ald-g-space-2);color:var(--ald-g-color-gray-500);font-weight:800}al-filter .al-filter-search{position:relative;padding:var(--ald-g-space-6) var(--ald-g-space-3) var(--ald-g-space-3) var(--ald-g-space-3);display:flex;align-items:center}al-filter .al-filter-search>.ui-inputtext{width:100%;padding:var(--ald-g-space-2) 0 var(--ald-g-space-2) var(--ald-g-space-5)}al-filter .al-filter-search>input:focus{padding-bottom:var(--ald-g-space-2)}al-filter i.pi.pi-search.mx{position:absolute;left:12px;font-size:18px;margin:0;color:var(--ald-g-color-gray-500);pointer-events:none}al-filter .custom-modal-title{margin:var(--ald-g-space-3);line-height:14px;font-size:var(--ald-g-text-xxl)}al-filter .popover .scrollable{max-height:340px;overflow-y:scroll;width:300px;margin-top:var(--ald-g-space-075)}al-filter .active{display:block}al-filter .deactive:not(.al-bold){display:none}al-filter .show-help-text{padding-top:24px;padding-bottom:var(--ald-g-space-6);border-bottom:1px solid var(--ald-g-color-gray-200)}al-filter .show-help-text .description{padding-right:var(--ald-g-space-4);padding-left:var(--ald-g-space-4)}al-filter .subtitle{font-size:.8em;margin:var(--ald-g-space-2) var(--ald-g-space-4) var(--ald-g-space-1);color:var(--ald-g-color-gray-400)}@media only screen and (max-width:1024px){al-filter,al-filter .al-filter .ui-accordion .ui-accordion-header a,al-filter .al-filter .ui-accordion .ui-accordion-header.ui-state-active a,al-filter .al-filter .ui-toggleable-content .ui-accordion-content,al-filter .al-filter-clear span{font-size:var(--ald-g-text-xs)}al-filter .check-icon{font-size:var(--ald-g-text-xxl)}}"], encapsulation: 2 });
    return AlFilterComponent;
}());
export { AlFilterComponent };
/*@__PURE__*/ (function () { i0.ɵsetClassMetadata(AlFilterComponent, [{
        type: Component,
        args: [{
                selector: 'al-filter',
                templateUrl: './al-filter.component.html',
                styleUrls: ['./al-filter.component.scss'],
                encapsulation: ViewEncapsulation.None
            }]
    }], null, { filters: [{
            type: Input
        }], alFilterConfig: [{
            type: Input
        }], onClick: [{
            type: Output
        }], onClearAllFilters: [{
            type: Output
        }], popoverModal: [{
            type: ViewChild,
            args: ['popoverModal']
        }], searchFilterKey: [{
            type: ViewChild,
            args: ['searchFilterKey', { static: false }]
        }] }); })();
//# sourceMappingURL=data:application/json;base64, 