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 { MapToComponentField, MapToComponentMethod, VegaSlimmer } from 'vega-slimmer/core';
import { executeAfterTransition } from '../../../../../utils/effect';
import InternalVegaZIndexManager from '../../../../../helpers/zindex/internal-vega-z-index-manager';
export class VegaLeftNavZIndexController extends VegaSlimmer {
  watchOpenState() {
    this.updateZIndex();
  }
  /**
   * The below method is e2e-test covered in
   * @see{module:vega-left-nav-e2e-z-index}
   */
  /* istanbul ignore next */
  updateZIndex() {
    const backDrop = this.backdropController.getBackdrop();
    if (this.openState == 'open') {
      InternalVegaZIndexManager.setZIndex(backDrop, 'base');
      InternalVegaZIndexManager.setZIndex(this.host, 'base');
    }
    else {
      executeAfterTransition(() => {
        InternalVegaZIndexManager.removeZIndex(backDrop, 'base');
        InternalVegaZIndexManager.removeZIndex(this.host, 'base');
      }, this.host, 300);
    }
  }
}
__decorate([
  MapToComponentField()
], VegaLeftNavZIndexController.prototype, "host", void 0);
__decorate([
  MapToComponentField()
], VegaLeftNavZIndexController.prototype, "openState", void 0);
__decorate([
  MapToComponentField()
], VegaLeftNavZIndexController.prototype, "backdropController", void 0);
__decorate([
  MapToComponentMethod('watchOpenState')
], VegaLeftNavZIndexController.prototype, "watchOpenState", null);
