// tslint:disable:max-line-length
import { Component, ChangeDetectionStrategy, HostBinding, ViewEncapsulation, Input, Output, Directive, ContentChild, forwardRef, QueryList, EventEmitter, HostListener } from '@angular/core';
import { BaseDirective } from '../../../../base.directive';
import { UxAppShellService } from '@eui/core';
import * as i0 from "@angular/core";
import * as i1 from "@eui/core";
import * as i2 from "@angular/common";
import * as i3 from "../../../../components/eui-button/eui-button.component";
function EuiPageColumnComponent_div_0_div_1_div_1_ng_content_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵprojection(0, 1, ["*ngIf", "customHeaderCollapsedContent"]);
} }
function EuiPageColumnComponent_div_0_div_1_div_1_ng_container_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementContainerStart(0);
    i0.ɵɵtext(1);
    i0.ɵɵelementContainerEnd();
} if (rf & 2) {
    const ctx_r9 = i0.ɵɵnextContext(4);
    i0.ɵɵadvance(1);
    i0.ɵɵtextInterpolate1(" ", ctx_r9.label, " ");
} }
function EuiPageColumnComponent_div_0_div_1_div_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 11);
    i0.ɵɵtemplate(1, EuiPageColumnComponent_div_0_div_1_div_1_ng_content_1_Template, 1, 0, "ng-content", 12);
    i0.ɵɵtemplate(2, EuiPageColumnComponent_div_0_div_1_div_1_ng_container_2_Template, 2, 1, "ng-container", 12);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r7 = i0.ɵɵnextContext(3);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", ctx_r7.customHeaderCollapsedContent);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", !ctx_r7.isCollapsedWithIcons);
} }
function EuiPageColumnComponent_div_0_div_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 9);
    i0.ɵɵtemplate(1, EuiPageColumnComponent_div_0_div_1_div_1_Template, 3, 2, "div", 10);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r3 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", ctx_r3.label);
} }
function EuiPageColumnComponent_div_0_div_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 9);
    i0.ɵɵprojection(1, 2);
    i0.ɵɵelementEnd();
} }
function EuiPageColumnComponent_div_0_div_4_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 13);
    i0.ɵɵprojection(1, 3);
    i0.ɵɵelementEnd();
} }
function EuiPageColumnComponent_div_0_button_5_Template(rf, ctx) { if (rf & 1) {
    const _r11 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "button", 14);
    i0.ɵɵlistener("click", function EuiPageColumnComponent_div_0_button_5_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r11); const ctx_r10 = i0.ɵɵnextContext(2); return ctx_r10.onToggle(); });
    i0.ɵɵpipe(1, "async");
    i0.ɵɵpipe(2, "async");
    i0.ɵɵpipe(3, "async");
    i0.ɵɵpipe(4, "async");
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r6 = i0.ɵɵnextContext(2);
    i0.ɵɵclassProp("eui-icon-angle-right", ctx_r6.isCollapsed && !i0.ɵɵpipeBind1(1, 9, ctx_r6.asService.state$).breakpoints.isMobile)("eui-icon-angle-left", !ctx_r6.isCollapsed && !i0.ɵɵpipeBind1(2, 11, ctx_r6.asService.state$).breakpoints.isMobile)("eui-icon-angle-down", ctx_r6.isCollapsed && i0.ɵɵpipeBind1(3, 13, ctx_r6.asService.state$).breakpoints.isMobile)("eui-icon-angle-up", !ctx_r6.isCollapsed && i0.ɵɵpipeBind1(4, 15, ctx_r6.asService.state$).breakpoints.isMobile);
    i0.ɵɵattribute("aria-label", ctx_r6.isCollapsed ? "Expand" : "Collapse");
} }
function EuiPageColumnComponent_div_0_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 4);
    i0.ɵɵtemplate(1, EuiPageColumnComponent_div_0_div_1_Template, 2, 1, "div", 5);
    i0.ɵɵtemplate(2, EuiPageColumnComponent_div_0_div_2_Template, 2, 0, "div", 5);
    i0.ɵɵelementStart(3, "div", 6);
    i0.ɵɵtemplate(4, EuiPageColumnComponent_div_0_div_4_Template, 2, 0, "div", 7);
    i0.ɵɵtemplate(5, EuiPageColumnComponent_div_0_button_5_Template, 5, 17, "button", 8);
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r0 = i0.ɵɵnextContext();
    i0.ɵɵclassProp("eui-page-column__header--with-icons", ctx_r0.isCollapsedWithIcons);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", !ctx_r0.customHeaderLeftContent);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", ctx_r0.customHeaderLeftContent);
    i0.ɵɵadvance(2);
    i0.ɵɵproperty("ngIf", ctx_r0.customHeaderRightContent);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", ctx_r0.isCollapsible);
} }
function EuiPageColumnComponent_div_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 15);
    i0.ɵɵprojection(1, 4);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext();
    i0.ɵɵclassProp("eui-page-column__header-left-content-body--shrinked", ctx_r1.isHeaderBodyShrinked);
} }
function EuiPageColumnComponent_div_4_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 16);
    i0.ɵɵprojection(1, 5);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r2 = i0.ɵɵnextContext();
    i0.ɵɵclassProp("eui-page-column__footer--highlighted", ctx_r2.isHighlighted);
} }
const _c0 = [[["eui-page-column-body"]], [["eui-page-column-header-collapsed-content"]], [["eui-page-column-header-left-content"]], [["eui-page-column-header-right-content"]], [["eui-page-column-header-body"]], [["eui-page-column-footer"]]];
const _c1 = ["eui-page-column-body", "eui-page-column-header-collapsed-content", "eui-page-column-header-left-content", "eui-page-column-header-right-content", "eui-page-column-header-body", "eui-page-column-footer"];
export class EuiPageColumnComponent extends BaseDirective {
    constructor(asService) {
        super();
        this.asService = asService;
        this.isCollapsible = false;
        this.isCollapsed = false;
        this.isHighlighted = false;
        this.interactiveScrollbars = true;
        this.isCollapsedWithIcons = false; // contains ux-layout-sidebar-items
        this.hasSidebarMenu = false; // contains eui-sidebar-menu
        this.hasHeaderBodyShrinkable = false; // allow to track scroll event Up & Down
        this.collapsed = new EventEmitter();
        this.headerCollapsed = new EventEmitter();
        this.isActive = false;
        this.isHeaderBodyShrinked = false;
        this.currentOffset = 0;
        this.previousOffset = 0;
        this.treshHold = 50;
    }
    get cssClasses() {
        return [
            super.getCssClasses('eui-page-column'),
            this.size && !this.isCollapsed ? `eui-page-column--size-${this.size}` : ``,
            this.isCollapsed ? 'eui-page-column--collapsed' : '',
            this.isCollapsedWithIcons ? 'eui-page-column__header--with-icons' : '',
            this.isHighlighted ? 'eui-page-column--highlighted' : '',
            this.isActive ? 'eui-page-column--active' : '',
            this.interactiveScrollbars ? 'eui-page-column--interactive-scrollbars' : '',
            this.hasSidebarMenu ? 'eui-page-column--has-sidebar-menu' : '',
            this.isHeaderBodyShrinked ? 'eui-page-column__header--shrinked' : '',
        ].join(' ').trim();
    }
    onBodyScoll(event) {
        if (this.hasHeaderBodyShrinkable && event.target) {
            this.currentOffset = event.target.scrollTop;
            // Scroll DOWN
            if (this.currentOffset > this.previousOffset && this.currentOffset > this.treshHold) {
                // console.log('Scroll DOWN:', this.currentOffset);
                this.isHeaderBodyShrinked = true;
                this.headerCollapsed.emit(true);
            }
            // Scroll UP
            if (this.currentOffset <= this.previousOffset) {
                // console.log('Scroll UP:', this.currentOffset);
                if (this.currentOffset <= this.treshHold) {
                    this.isHeaderBodyShrinked = false;
                    this.headerCollapsed.emit(false);
                }
            }
            this.previousOffset = this.currentOffset;
        }
    }
    ngOnInit() {
        this.euiSizeS = false; // Bypass size default
    }
    onToggle() {
        this.isCollapsed = !this.isCollapsed;
        this.collapsed.emit(this.isCollapsed);
    }
    onMouseEnter() {
        if (this.interactiveScrollbars) {
            this.isActive = true;
        }
    }
    onMouseLeave() {
        if (this.interactiveScrollbars) {
            this.isActive = false;
        }
    }
}
/** @nocollapse */ EuiPageColumnComponent.ɵfac = function EuiPageColumnComponent_Factory(t) { return new (t || EuiPageColumnComponent)(i0.ɵɵdirectiveInject(i1.UxAppShellService)); };
/** @nocollapse */ EuiPageColumnComponent.ɵcmp = i0.ɵɵdefineComponent({ type: EuiPageColumnComponent, selectors: [["eui-page-column"]], contentQueries: function EuiPageColumnComponent_ContentQueries(rf, ctx, dirIndex) { if (rf & 1) {
        i0.ɵɵcontentQuery(dirIndex, EuiPageColumnHeaderBodyContentDirective, true);
        i0.ɵɵcontentQuery(dirIndex, EuiPageColumnHeaderLeftContentDirective, true);
        i0.ɵɵcontentQuery(dirIndex, EuiPageColumnHeaderRightContentDirective, true);
        i0.ɵɵcontentQuery(dirIndex, EuiPageColumnHeaderCollapsedContentDirective, true);
        i0.ɵɵcontentQuery(dirIndex, EuiPageColumnFooterContentDirective, true);
    } if (rf & 2) {
        var _t;
        i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.customHeaderBodyContent = _t.first);
        i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.customHeaderLeftContent = _t.first);
        i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.customHeaderRightContent = _t.first);
        i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.customHeaderCollapsedContent = _t.first);
        i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.customFooterContent = _t.first);
    } }, hostVars: 2, hostBindings: function EuiPageColumnComponent_HostBindings(rf, ctx) { if (rf & 1) {
        i0.ɵɵlistener("scroll", function EuiPageColumnComponent_scroll_HostBindingHandler($event) { return ctx.onBodyScoll($event); }, false, i0.ɵɵresolveWindow);
    } if (rf & 2) {
        i0.ɵɵclassMap(ctx.cssClasses);
    } }, inputs: { size: "size", label: "label", isCollapsible: "isCollapsible", isCollapsed: "isCollapsed", isHighlighted: "isHighlighted", interactiveScrollbars: "interactiveScrollbars", isCollapsedWithIcons: "isCollapsedWithIcons", hasSidebarMenu: "hasSidebarMenu", hasHeaderBodyShrinkable: "hasHeaderBodyShrinkable" }, outputs: { collapsed: "collapsed", headerCollapsed: "headerCollapsed" }, features: [i0.ɵɵInheritDefinitionFeature], ngContentSelectors: _c1, decls: 5, vars: 7, consts: [["class", "eui-page-column__header", 3, "eui-page-column__header--with-icons", 4, "ngIf"], ["class", "eui-page-column__header-left-content-body", 3, "eui-page-column__header-left-content-body--shrinked", 4, "ngIf"], ["tabindex", "0", 1, "eui-page-column__body", 3, "mouseenter", "mouseleave", "scroll"], ["class", "eui-page-column__footer", 3, "eui-page-column__footer--highlighted", 4, "ngIf"], [1, "eui-page-column__header"], ["class", "eui-page-column__header-left-content", 4, "ngIf"], [1, "eui-page-column__header-right-content"], ["class", "eui-page-column__header-right-content-body", 4, "ngIf"], ["euiButton", "", "euiBasicButton", "", "euiSecondary", "", "euiRounded", "", "euiIconButton", "", "euiSizeS", "", "class", "eui-page-column__header-toggle eui-icon", 3, "eui-icon-angle-right", "eui-icon-angle-left", "eui-icon-angle-down", "eui-icon-angle-up", "click", 4, "ngIf"], [1, "eui-page-column__header-left-content"], ["class", "eui-page-column__header-left-content-label", 4, "ngIf"], [1, "eui-page-column__header-left-content-label"], [4, "ngIf"], [1, "eui-page-column__header-right-content-body"], ["euiButton", "", "euiBasicButton", "", "euiSecondary", "", "euiRounded", "", "euiIconButton", "", "euiSizeS", "", 1, "eui-page-column__header-toggle", "eui-icon", 3, "click"], [1, "eui-page-column__header-left-content-body"], [1, "eui-page-column__footer"]], template: function EuiPageColumnComponent_Template(rf, ctx) { if (rf & 1) {
        i0.ɵɵprojectionDef(_c0);
        i0.ɵɵtemplate(0, EuiPageColumnComponent_div_0_Template, 6, 6, "div", 0);
        i0.ɵɵtemplate(1, EuiPageColumnComponent_div_1_Template, 2, 2, "div", 1);
        i0.ɵɵelementStart(2, "div", 2);
        i0.ɵɵlistener("mouseenter", function EuiPageColumnComponent_Template_div_mouseenter_2_listener() { return ctx.onMouseEnter(); })("mouseleave", function EuiPageColumnComponent_Template_div_mouseleave_2_listener() { return ctx.onMouseLeave(); })("scroll", function EuiPageColumnComponent_Template_div_scroll_2_listener($event) { return ctx.hasHeaderBodyShrinkable ? ctx.onBodyScoll($event) : null; });
        i0.ɵɵprojection(3);
        i0.ɵɵelementEnd();
        i0.ɵɵtemplate(4, EuiPageColumnComponent_div_4_Template, 2, 2, "div", 3);
    } if (rf & 2) {
        i0.ɵɵproperty("ngIf", ctx.label || ctx.customHeaderLeftContent || ctx.customHeaderRightContent || ctx.isCollapsible);
        i0.ɵɵadvance(1);
        i0.ɵɵproperty("ngIf", ctx.customHeaderBodyContent);
        i0.ɵɵadvance(1);
        i0.ɵɵclassProp("eui-page-column__body--interactive-scrollbars", ctx.interactiveScrollbars)("eui-page-column--collapsed-with-icons", ctx.isCollapsedWithIcons);
        i0.ɵɵadvance(2);
        i0.ɵɵproperty("ngIf", ctx.customFooterContent);
    } }, directives: [i2.NgIf, i3.EuiButtonComponent], pipes: [i2.AsyncPipe], encapsulation: 2 });
/*@__PURE__*/ (function () { i0.ɵsetClassMetadata(EuiPageColumnComponent, [{
        type: Component,
        args: [{
                selector: 'eui-page-column',
                templateUrl: './eui-page-column.component.html',
                changeDetection: ChangeDetectionStrategy.Default,
                encapsulation: ViewEncapsulation.None,
            }]
    }], function () { return [{ type: i1.UxAppShellService }]; }, { size: [{
            type: Input
        }], label: [{
            type: Input
        }], isCollapsible: [{
            type: Input
        }], isCollapsed: [{
            type: Input
        }], isHighlighted: [{
            type: Input
        }], interactiveScrollbars: [{
            type: Input
        }], isCollapsedWithIcons: [{
            type: Input
        }], hasSidebarMenu: [{
            type: Input
        }], hasHeaderBodyShrinkable: [{
            type: Input
        }], collapsed: [{
            type: Output
        }], headerCollapsed: [{
            type: Output
        }], cssClasses: [{
            type: HostBinding,
            args: ['class']
        }], customHeaderBodyContent: [{
            type: ContentChild,
            args: [forwardRef(() => EuiPageColumnHeaderBodyContentDirective)]
        }], customHeaderLeftContent: [{
            type: ContentChild,
            args: [forwardRef(() => EuiPageColumnHeaderLeftContentDirective)]
        }], customHeaderRightContent: [{
            type: ContentChild,
            args: [forwardRef(() => EuiPageColumnHeaderRightContentDirective)]
        }], customHeaderCollapsedContent: [{
            type: ContentChild,
            args: [forwardRef(() => EuiPageColumnHeaderCollapsedContentDirective)]
        }], customFooterContent: [{
            type: ContentChild,
            args: [forwardRef(() => EuiPageColumnFooterContentDirective)]
        }], onBodyScoll: [{
            type: HostListener,
            args: ['window:scroll', ['$event']]
        }] }); })();
/* tslint:disable */
export class EuiPageColumnHeaderBodyContentDirective {
}
/** @nocollapse */ EuiPageColumnHeaderBodyContentDirective.ɵfac = function EuiPageColumnHeaderBodyContentDirective_Factory(t) { return new (t || EuiPageColumnHeaderBodyContentDirective)(); };
/** @nocollapse */ EuiPageColumnHeaderBodyContentDirective.ɵdir = i0.ɵɵdefineDirective({ type: EuiPageColumnHeaderBodyContentDirective, selectors: [["eui-page-column-header-body"]] });
/*@__PURE__*/ (function () { i0.ɵsetClassMetadata(EuiPageColumnHeaderBodyContentDirective, [{
        type: Directive,
        args: [{ selector: 'eui-page-column-header-body' }]
    }], null, null); })();
export class EuiPageColumnHeaderLeftContentDirective {
}
/** @nocollapse */ EuiPageColumnHeaderLeftContentDirective.ɵfac = function EuiPageColumnHeaderLeftContentDirective_Factory(t) { return new (t || EuiPageColumnHeaderLeftContentDirective)(); };
/** @nocollapse */ EuiPageColumnHeaderLeftContentDirective.ɵdir = i0.ɵɵdefineDirective({ type: EuiPageColumnHeaderLeftContentDirective, selectors: [["eui-page-column-header-left-content"]] });
/*@__PURE__*/ (function () { i0.ɵsetClassMetadata(EuiPageColumnHeaderLeftContentDirective, [{
        type: Directive,
        args: [{ selector: 'eui-page-column-header-left-content' }]
    }], null, null); })();
export class EuiPageColumnHeaderRightContentDirective {
}
/** @nocollapse */ EuiPageColumnHeaderRightContentDirective.ɵfac = function EuiPageColumnHeaderRightContentDirective_Factory(t) { return new (t || EuiPageColumnHeaderRightContentDirective)(); };
/** @nocollapse */ EuiPageColumnHeaderRightContentDirective.ɵdir = i0.ɵɵdefineDirective({ type: EuiPageColumnHeaderRightContentDirective, selectors: [["eui-page-column-header-right-content"]] });
/*@__PURE__*/ (function () { i0.ɵsetClassMetadata(EuiPageColumnHeaderRightContentDirective, [{
        type: Directive,
        args: [{ selector: 'eui-page-column-header-right-content' }]
    }], null, null); })();
export class EuiPageColumnHeaderCollapsedContentDirective {
}
/** @nocollapse */ EuiPageColumnHeaderCollapsedContentDirective.ɵfac = function EuiPageColumnHeaderCollapsedContentDirective_Factory(t) { return new (t || EuiPageColumnHeaderCollapsedContentDirective)(); };
/** @nocollapse */ EuiPageColumnHeaderCollapsedContentDirective.ɵdir = i0.ɵɵdefineDirective({ type: EuiPageColumnHeaderCollapsedContentDirective, selectors: [["eui-page-column-header-collapsed-content"]] });
/*@__PURE__*/ (function () { i0.ɵsetClassMetadata(EuiPageColumnHeaderCollapsedContentDirective, [{
        type: Directive,
        args: [{ selector: 'eui-page-column-header-collapsed-content' }]
    }], null, null); })();
export class EuiPageColumnBodyContentDirective {
}
/** @nocollapse */ EuiPageColumnBodyContentDirective.ɵfac = function EuiPageColumnBodyContentDirective_Factory(t) { return new (t || EuiPageColumnBodyContentDirective)(); };
/** @nocollapse */ EuiPageColumnBodyContentDirective.ɵdir = i0.ɵɵdefineDirective({ type: EuiPageColumnBodyContentDirective, selectors: [["eui-page-column-body"]] });
/*@__PURE__*/ (function () { i0.ɵsetClassMetadata(EuiPageColumnBodyContentDirective, [{
        type: Directive,
        args: [{ selector: 'eui-page-column-body' }]
    }], null, null); })();
export class EuiPageColumnFooterContentDirective {
}
/** @nocollapse */ EuiPageColumnFooterContentDirective.ɵfac = function EuiPageColumnFooterContentDirective_Factory(t) { return new (t || EuiPageColumnFooterContentDirective)(); };
/** @nocollapse */ EuiPageColumnFooterContentDirective.ɵdir = i0.ɵɵdefineDirective({ type: EuiPageColumnFooterContentDirective, selectors: [["eui-page-column-footer"]] });
/*@__PURE__*/ (function () { i0.ɵsetClassMetadata(EuiPageColumnFooterContentDirective, [{
        type: Directive,
        args: [{ selector: 'eui-page-column-footer' }]
    }], null, null); })();
//# sourceMappingURL=data:application/json;base64, 