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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGFiLXJvdXRlci1pdGVtLmNvbXBvbmVudC5qcyIsInNvdXJjZVJvb3QiOiJDOi9Vc2Vycy91c2VyL0RvY3VtZW50cy9saWItY29yZS11aS9wcm9qZWN0cy9zZC1jb3JlL3RhYi1yb3V0ZXIvIiwic291cmNlcyI6WyJzcmMvbGliL2NvbXBvbmVudHMvdGFiLXJvdXRlci1pdGVtL3RhYi1yb3V0ZXItaXRlbS5jb21wb25lbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7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