import * as i0 from '@angular/core';
import { Directive, NgModule } from '@angular/core';
import * as i1 from '@wm/components/page';
import * as i2 from '@wm/components/page/left-panel';
import { addClass } from '@wm/core';
import * as i3 from '@wm/mobile/core';
import { CommonModule } from '@angular/common';
import { WmComponentsModule } from '@wm/components/base';

class MobileLeftPanelDirective {
    constructor(page, leftPanelRef, deviceService, elRef) {
        this.page = page;
        this.leftPanelRef = leftPanelRef;
        this.deviceService = deviceService;
        addClass(elRef.nativeElement, 'wm-mobile-app-left-panel');
        page.notify('wmLeftPanel:ready', leftPanelRef);
        page.subscribe('wmLeftPanel:expand', () => {
            this._backBtnListenerDestroyer = deviceService.onBackButtonTap(() => {
                leftPanelRef.collapse();
                return false;
            });
        });
        page.subscribe('wmLeftPanel:collapse', () => {
            this.destroyBackBtnListener();
        });
    }
    ngOnDestroy() {
        this.destroyBackBtnListener();
    }
    destroyBackBtnListener() {
        if (this._backBtnListenerDestroyer) {
            this._backBtnListenerDestroyer();
            this._backBtnListenerDestroyer = null;
        }
    }
    static { this.ɵfac = function MobileLeftPanelDirective_Factory(t) { return new (t || MobileLeftPanelDirective)(i0.ɵɵdirectiveInject(i1.PageDirective), i0.ɵɵdirectiveInject(i2.LeftPanelDirective), i0.ɵɵdirectiveInject(i3.DeviceService), i0.ɵɵdirectiveInject(i0.ElementRef)); }; }
    static { this.ɵdir = /*@__PURE__*/ i0.ɵɵdefineDirective({ type: MobileLeftPanelDirective, selectors: [["", "wmLeftPanel", ""]] }); }
}
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MobileLeftPanelDirective, [{
        type: Directive,
        args: [{
                selector: '[wmLeftPanel]'
            }]
    }], () => [{ type: i1.PageDirective }, { type: i2.LeftPanelDirective }, { type: i3.DeviceService }, { type: i0.ElementRef }], null); })();

const components = [
    MobileLeftPanelDirective
];
class LeftPanelModule {
    static { this.ɵfac = function LeftPanelModule_Factory(t) { return new (t || LeftPanelModule)(); }; }
    static { this.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: LeftPanelModule }); }
    static { this.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ imports: [CommonModule,
            WmComponentsModule] }); }
}
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(LeftPanelModule, [{
        type: NgModule,
        args: [{
                imports: [
                    CommonModule,
                    WmComponentsModule
                ],
                declarations: [...components],
                exports: [...components]
            }]
    }], null, null); })();
(function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(LeftPanelModule, { declarations: [MobileLeftPanelDirective], imports: [CommonModule,
        WmComponentsModule], exports: [MobileLeftPanelDirective] }); })();

/**
 * Generated bundle index. Do not edit.
 */

export { LeftPanelModule, MobileLeftPanelDirective };
//# sourceMappingURL=index.mjs.map
