import { __extends, __decorate, __metadata } from 'tslib';
import { Prop, Component } from 'vue-property-decorator';
import { css, Async, EventGroup } from '@uifabric-vue/utilities';
import Vue from 'vue';
import { getTheme, registerOnThemeChangeCallback } from '@uifabric/styling';

var BaseComponent = function(_super) {
  __extends(BaseComponent2, _super);
  function BaseComponent2() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.componentRef = null;
    _this.css = css;
    _this.__async = null;
    _this.__events = null;
    _this.__disposables = null;
    _this.state = {};
    _this.props = {};
    _this.theme = getTheme();
    return _this;
  }
  BaseComponent2.prototype.created = function() {
    var _this = this;
    registerOnThemeChangeCallback(function(theme) {
      _this.theme = theme;
    });
  };
  BaseComponent2.prototype.mounted = function() {
    this.componentRef = this.$el;
  };
  BaseComponent2.prototype.beforeDestroy = function() {
    if (this.__disposables) {
      for (var i = 0, len = this._disposables.length; i < len; i++) {
        var disposable = this.__disposables[i];
        if (disposable.dispose) {
          disposable.dispose();
        }
      }
      this.__disposables = null;
    }
  };
  Object.defineProperty(BaseComponent2.prototype, "uid", {
    get: function() {
      return this._uid;
    },
    enumerable: false,
    configurable: true
  });
  Object.defineProperty(BaseComponent2.prototype, "classNames", {
    get: function() {
      return {};
    },
    enumerable: false,
    configurable: true
  });
  Object.defineProperty(BaseComponent2.prototype, "_disposables", {
    get: function() {
      if (!this.__disposables) {
        this.__disposables = [];
      }
      return this.__disposables;
    },
    enumerable: false,
    configurable: true
  });
  Object.defineProperty(BaseComponent2.prototype, "_async", {
    get: function() {
      if (!this.__async) {
        this.__async = new Async(this);
        this._disposables.push(this.__async);
      }
      return this.__async;
    },
    enumerable: false,
    configurable: true
  });
  Object.defineProperty(BaseComponent2.prototype, "events", {
    get: function() {
      if (!this.__events) {
        this.__events = new EventGroup(this);
        this._disposables.push(this.__events);
      }
      return this.__events;
    },
    enumerable: false,
    configurable: true
  });
  BaseComponent2.prototype.setState = function(newState) {
    for (var key in newState) {
      this.$set(this.state, key, newState[key]);
    }
    return this.state;
  };
  __decorate([
    Prop({ type: [String, Array], default: "" }),
    __metadata("design:type", String)
  ], BaseComponent2.prototype, "className", void 0);
  __decorate([
    Prop({ type: [Object, Function], default: function() {
    } }),
    __metadata("design:type", Object)
  ], BaseComponent2.prototype, "styles", void 0);
  BaseComponent2 = __decorate([
    Component
  ], BaseComponent2);
  return BaseComponent2;
}(Vue);
var BaseComponent$1 = BaseComponent;

export { BaseComponent$1 as default };
