var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  return c > 3 && r && Object.defineProperty(target, key, r), r;
};
import { Component, h, Host, Element, Prop } from '@stencil/core';
import { sanitizeVegaComponent } from '../../../utils/component';
import changeManager from '../../../helpers/change-manager/change-manager';
import { TAB_PANEL_ADD_OR_DEL_TO_GROUP } from '../../../helpers/change-manager/subject/static-subject/static-subject-title';
import { ChildNodesEventPreventSlimmer } from '../../../helpers/event-manager/slimmers/child-nodes-event-prevent-slimmer';
import { VegaClick } from '../../../helpers/event-manager/event-id/vega-event-id';
import { InjectVegaGlobalSlimmer, InjectVegaSlimmer } from 'vega-slimmer/core';
import { VegaComponentUsageRuntimeMetricsSlimmer } from '../../../helpers/slimmers/component-usage-runtime-metrics';
/**
 * @vegaVersion 1.26.0
 */
export class VegaTabGroupPanel {
  constructor() {
    this.globalSlimmers = {};
    this.clickEventPrevent = new ChildNodesEventPreventSlimmer([VegaClick], () => this.host, undefined, true);
    this.vegaComponentUsageRuntimeMetricsSlimmer = new VegaComponentUsageRuntimeMetricsSlimmer();
    /**
     * Controls the visibility of the tab panel within the tab group.
     *
     * @vegaVersion 1.26.0
     */
    this.isActive = false;
  }
  /**
   * add the panel to group when dom re-append to the group
   */
  connectedCallback() {
    this.notifyGroupAddOrDelPanel('ADD');
  }
  disconnectedCallback() {
    this.notifyGroupAddOrDelPanel('DEL');
  }
  /**
   * add the panel to group when first render
   */
  componentWillLoad() {
    this.notifyGroupAddOrDelPanel('ADD');
  }
  render() {
    return sanitizeVegaComponent(h(Host, { class: this.isActive ? 'active' : '' },
      h("slot", null)), this.host);
  }
  /**
   * The function notifies the change manager about adding or deleting a panel to a group.
   *
   * @param {PanelUpdatePayload['type']} type - The type of panel update, such as adding or deleting a panel.
   */
  notifyGroupAddOrDelPanel(type) {
    changeManager.notify(TAB_PANEL_ADD_OR_DEL_TO_GROUP, { host: this.host, type });
  }
  static get is() { return "vega-tab-group-panel"; }
  static get encapsulation() { return "shadow"; }
  static get originalStyleUrls() { return {
    "$": ["vega-tab-group-panel.scss"]
  }; }
  static get styleUrls() { return {
    "$": ["vega-tab-group-panel.css"]
  }; }
  static get properties() { return {
    "isActive": {
      "type": "boolean",
      "mutable": false,
      "complexType": {
        "original": "boolean",
        "resolved": "boolean",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "name": "vegaVersion",
            "text": "1.26.0"
          }],
        "text": "Controls the visibility of the tab panel within the tab group."
      },
      "attribute": "is-active",
      "reflect": false,
      "defaultValue": "false"
    }
  }; }
  static get elementRef() { return "host"; }
}
__decorate([
  InjectVegaGlobalSlimmer()
], VegaTabGroupPanel.prototype, "globalSlimmers", void 0);
__decorate([
  InjectVegaSlimmer()
], VegaTabGroupPanel.prototype, "clickEventPrevent", void 0);
__decorate([
  InjectVegaSlimmer()
], VegaTabGroupPanel.prototype, "vegaComponentUsageRuntimeMetricsSlimmer", void 0);
