var _subsctiption;
import { __classPrivateFieldGet } from "tslib";
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, } from "@angular/core";
import { Subscription } from "rxjs";
import { debounceTime } from "rxjs/operators";
import { SdTabRouterService } from "../../services/tab-router.service";
export class SdTabRouterItemComponent {
    constructor(cdRef, tabRouterService) {
        this.cdRef = cdRef;
        this.tabRouterService = tabRouterService;
        _subsctiption.set(this, new Subscription());
        this.close = (event) => {
            event.preventDefault();
            event.stopPropagation();
            this.tabRouterService.close(this.tab);
        };
    }
    ngOnInit() {
        __classPrivateFieldGet(this, _subsctiption).add(this.tabRouterService.events.pipe(debounceTime(100)).subscribe(() => {
            this.cdRef.markForCheck();
        }));
    }
    ngOnDestroy() {
        __classPrivateFieldGet(this, _subsctiption).unsubscribe();
    }
}
_subsctiption = new WeakMap();
SdTabRouterItemComponent.decorators = [
    { type: Component, args: [{
                selector: "sd-tab-router-item",
                template: "<a [routerLink]=\"[tab.url]\" [queryParams]=\"tab.queryParams\" [state]=\"{ switchTab: true }\"\r\n  class=\"tab-router__item d-flex align-items-center\" [ngClass]=\"{\r\n    'tab-router__item--active': tab.isActive\r\n  }\">\r\n  <ng-container *ngIf=\"tab.overrideTabInfo | sdTabInfo:tab | async as tabInfo\">\r\n    <div class=\"\r\n    tab-router__icon\r\n    mr-8\r\n  \" [ngStyle]=\"{\r\n    'background-color': tabInfo.color\r\n  }\" [matTooltip]=\"tabInfo.tooltip || tabInfo.name\" matTooltipPosition=\"below\" matTooltipShowDelay=\"1000\">\r\n      {{ tabInfo.initialName || 'SD' }}\r\n    </div>\r\n    <div class=\"flex-1 overflow-hidden\">\r\n      <div class=\"tab-router__name\" [matTooltip]=\"tabInfo.tooltip || tabInfo.name\" matTooltipPosition=\"below\"\r\n        matTooltipShowDelay=\"1000\">\r\n        {{ tabInfo.name }}\r\n      </div>\r\n    </div>\r\n    <button aria-hidden=\"true\" type=\"button\"\r\n      class=\"tab-router__close d-flex align-items-center justify-content-center ml-4\" (click)=\"close($event)\"\r\n      (mousedown)=\"$event.stopPropagation()\">\r\n      <mat-icon aria-hidden=\"true\">close</mat-icon>\r\n    </button>\r\n  </ng-container>\r\n</a>",
                changeDetection: ChangeDetectionStrategy.OnPush,
                styles: [":host{display:block;flex:1 1 64px;max-width:240px;overflow:hidden;position:relative}:host:after{background:#dde0e5;bottom:0;content:\"\";height:16px;margin:auto;position:absolute;right:0;top:0;width:1px}:host:last-child:after{content:none}.flex-1{flex:1}.tab-router__icon{background-color:#5c6bc0;border-radius:2px;color:#fff;font-size:10px;height:16px;line-height:16px;text-align:center;text-transform:uppercase;width:16px}.tab-router__icon .mat-icon{font-size:10px;height:10px;width:10px}.tab-router__close{background:none;border:0;border-radius:50%;color:#757575;height:16px;outline:none;width:16px}.tab-router__close:hover{background-color:rgba(0,0,0,.12)}.tab-router__close .mat-icon{font-size:12px;height:12px;width:12px}.tab-router__item{background:#f2f3f4;color:inherit;font-size:12px;line-height:16px;overflow:hidden;padding:16px 16px 8px;text-decoration:none}.tab-router__item:hover{background-color:#fff}.tab-router__name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tab-router__item--active{background-color:#fff;border-radius:8px 8px 0 0}"]
            },] }
];
SdTabRouterItemComponent.ctorParameters = () => [
    { type: ChangeDetectorRef },
    { type: SdTabRouterService }
];
SdTabRouterItemComponent.propDecorators = {
    tab: [{ type: Input }]
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGFiLXJvdXRlci1pdGVtLmNvbXBvbmVudC5qcyIsInNvdXJjZVJvb3QiOiJDOi9Vc2Vycy9uZ2hpYXR0MTVfb25lbW91bnQvRG9jdW1lbnRzL2xpYi1jb3JlLXVpL3Byb2plY3RzL3NkLWNvcmUvdGFiLXJvdXRlci8iLCJzb3VyY2VzIjpbInNyYy9saWIvY29tcG9uZW50cy90YWItcm91dGVyLWl0ZW0vdGFiLXJvdXRlci1pdGVtLmNvbXBvbmVudC50cyJdLCJuYW1lcyI6W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