/**
 *
 * @ai-apps/angular v2.147.1-next.0 | tab.component.js
 *
 * Copyright 2014, 2022 IBM
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0

 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */


import { Component, Input } from '@angular/core';
import { Tab } from 'carbon-components-angular';
import { TabController } from './tab-controller.class';
import * as i0 from "@angular/core";
import * as i1 from "@angular/common";
const _c0 = function (a0) { return { display: a0 }; };
function TabComponent_div_0_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 1);
    i0.ɵɵprojection(1);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r0 = i0.ɵɵnextContext();
    i0.ɵɵproperty("ngStyle", i0.ɵɵpureFunction1(3, _c0, ctx_r0.active ? null : "none"));
    i0.ɵɵattribute("tabindex", ctx_r0.tabIndex)("aria-labelledby", ctx_r0.id + "-header");
} }
const _c1 = ["*"];
export class TabComponent extends Tab {
    ngOnInit() {
        // use a subscription to set this.active since that affects a number of other
        // tab internals
        this.selectionSubscription = this.controller.selection.subscribe((key) => {
            this.active = key === this.key;
        });
    }
    ngOnDestroy() {
        this.selectionSubscription.unsubscribe();
    }
}
TabComponent.ɵfac = function TabComponent_Factory(t) { return ɵTabComponent_BaseFactory(t || TabComponent); };
TabComponent.ɵcmp = i0.ɵɵdefineComponent({ type: TabComponent, selectors: [["ai-tab"]], inputs: { key: "key", controller: "controller" }, features: [i0.ɵɵInheritDefinitionFeature], ngContentSelectors: _c1, decls: 1, vars: 1, consts: [["role", "tabpanel", "class", "bx--tab-content", "aria-live", "polite", 3, "ngStyle", 4, "ngIf"], ["role", "tabpanel", "aria-live", "polite", 1, "bx--tab-content", 3, "ngStyle"]], template: function TabComponent_Template(rf, ctx) { if (rf & 1) {
        i0.ɵɵprojectionDef();
        i0.ɵɵtemplate(0, TabComponent_div_0_Template, 2, 5, "div", 0);
    } if (rf & 2) {
        i0.ɵɵproperty("ngIf", ctx.shouldRender());
    } }, directives: [i1.NgIf, i1.NgStyle], encapsulation: 2 });
const ɵTabComponent_BaseFactory = /*@__PURE__*/ i0.ɵɵgetInheritedFactory(TabComponent);
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TabComponent, [{
        type: Component,
        args: [{
                selector: 'ai-tab',
                template: `
    <div
      [attr.tabindex]="tabIndex"
      role="tabpanel"
      *ngIf="shouldRender()"
      class="bx--tab-content"
      [ngStyle]="{
        display: active ? null : 'none'
      }"
      [attr.aria-labelledby]="id + '-header'"
      aria-live="polite"
    >
      <ng-content></ng-content>
    </div>
  `,
            }]
    }], null, { key: [{
            type: Input
        }], controller: [{
            type: Input
        }] }); })();
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGFiLmNvbXBvbmVudC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy90YWJzL3RhYi5jb21wb25lbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFNBQVMsRUFBRSxLQUFLLEVBQXFCLE1BQU0sZUFBZSxDQUFDO0FBQ3BFLE9BQU8sRUFBRSxHQUFHLEVBQUUsTUFBTSwyQkFBMkIsQ0FBQztBQUVoRCxPQUFPLEVBQUUsYUFBYSxFQUFFLE1BQU0sd0JBQXdCLENBQUM7Ozs7O0lBS25ELDhCQVdFO0lBQUEsa0JBQXlCO0lBQzNCLGlCQUFNOzs7SUFQSixtRkFFRTtJQU5GLDJDQUEwQiwwQ0FBQTs7O0FBY2hDLE1BQU0sT0FBTyxZQUFhLFNBQVEsR0FBRztJQU1uQyxRQUFRO1FBQ04sNkV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