text: define(["require", "exports", "tslib", "react", "./Async", "./EventGroup", "./warn", "./initializeFocusRects", "./initializeDir"], function (require, exports, tslib_1, React, Async_1, EventGroup_1, warn_1, initializeFocusRects_1, initializeDir_1) {
      "use strict";
      Object.defineProperty(exports, "__esModule", { value: true });
      /**
       * BaseComponent class, which provides basic helpers for all components.
       *
       * @public
       */
      var BaseComponent = /** @class */ (function (_super) {
          tslib_1.__extends(BaseComponent, _super);
          // tslint:enable:variable-name
          /**
           * BaseComponent constructor
           * @param props - The props for the component.
           * @param context - The context for the component.
           */
          // tslint:disable-next-line:no-any
          function BaseComponent(props, context) {
              var _this = _super.call(this, props, context) || this;
              // Ensure basic assumptions about the environment.
              initializeFocusRects_1.initializeFocusRects();
              initializeDir_1.initializeDir();
              _this._shouldUpdateComponentRef = true;
              _makeAllSafe(_this, BaseComponent.prototype, [
                  'componentWillMount',
                  'componentDidMount',
                  'shouldComponentUpdate',
                  'componentWillUpdate',
                  'componentWillReceiveProps',
                  'render',
                  'componentDidUpdate',
                  'componentWillUnmount'
              ]);
              return _this;
          }
          /**
           * When the component will receive props, make sure the componentRef is updated.
           */
          // tslint:disable-next-line:no-any
          BaseComponent.prototype.componentWillReceiveProps = function (newProps, newContext) {
              this._updateComponentRef(this.props, newProps);
          };
          /**
           * When the component has mounted, update the componentRef.
           */
          BaseComponent.prototype.componentDidMount = function () {
              this._updateComponentRef(undefined, this.props);
          };
          /**
           * If we have disposables, dispose them automatically on unmount.
           */
          BaseComponent.prototype.componentWillUnmount = 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(BaseComponent.prototype, "className", {
              /**
               * Gets the object's class name.
               */
              get: function () {
                  if (!this.__className) {
                      var funcNameRegex = /function (.{1,})\(/;
                      var results = (funcNameRegex).exec((this).constructor.toString());
                      this.__className = (results && results.length > 1) ? results[1] : '';
                  }
                  return this.__className;
              },
              enumerable: true,
              configurable: true
          });
          Object.defineProperty(BaseComponent.prototype, "_disposables", {
              /**
               * Allows subclasses to push things to this._disposables to be auto disposed.
               */
              get: function () {
                  if (!this.__disposables) {
                      this.__disposables = [];
                  }
                  return this.__disposables;
              },
              enumerable: true,
              configurable: true
          });
          Object.defineProperty(BaseComponent.prototype, "_async", {
              /**
               * Gets the async instance associated with the component, created on demand. The async instance gives
               * subclasses a way to execute setTimeout/setInterval async calls safely, where the callbacks
               * will be cleared/ignored automatically after unmounting. The helpers within the async object also
               * preserve the this pointer so that you don't need to "bind" the callbacks.
               */
              get: function () {
                  if (!this.__async) {
                      this.__async = new Async_1.Async(this);
                      this._disposables.push(this.__async);
                  }
                  return this.__async;
              },
              enumerable: true,
              configurable: true
          });
          Object.defineProperty(BaseComponent.prototype, "_events", {
              /**
               * Gets the event group instance assocaited with the component, created on demand. The event instance
               * provides on/off methods for listening to DOM (or regular javascript object) events. The event callbacks
               * will be automatically disconnected after unmounting. The helpers within the events object also
               * preserve the this reference so that you don't need to "bind" the callbacks.
               */
              get: function () {
                  if (!this.__events) {
                      this.__events = new EventGroup_1.EventGroup(this);
                      this._disposables.push(this.__events);
                  }
                  return this.__events;
              },
              enumerable: true,
              configurable: true
          });
          /**
           * Helper to return a memoized ref resolver function.
           * @param refName - Name of the member to assign the ref to.
           * @returns A function instance keyed from the given refname.
           * @deprecated Use `createRef` from `@uifabric/utilities`
           */
          BaseComponent.prototype._resolveRef = function (refName) {
              var _this = this;
              if (!this.__resolves) {
                  this.__resolves = {};
              }
              if (!this.__resolves[refName]) {
                  // tslint:disable-next-line:no-any
                  this.__resolves[refName] = function (ref) {
                      // tslint:disable-next-line:no-any
                      return _this[refName] = ref;
                  };
              }
              return this.__resolves[refName];
          };
          /**
           * Updates the componentRef (by calling it with "this" when necessary.)
           */
          BaseComponent.prototype._updateComponentRef = function (currentProps, newProps) {
              if (newProps === void 0) { newProps = {}; }
              if (this._shouldUpdateComponentRef &&
                  ((!currentProps && newProps.componentRef) ||
                      (currentProps && currentProps.componentRef !== newProps.componentRef))) {
                  if (currentProps && currentProps.componentRef) {
                      currentProps.componentRef(null);
                  }
                  if (newProps.componentRef) {
                      newProps.componentRef(this);
                  }
              }
          };
          /**
           * Warns when a deprecated props are being used.
           *
           * @param deprecationMap - The map of deprecations, where key is the prop name and the value is
           * either null or a replacement prop name.
           */
          BaseComponent.prototype._warnDeprecations = function (deprecationMap) {
              warn_1.warnDeprecations(this.className, this.props, deprecationMap);
          };
          /**
           * Warns when props which are mutually exclusive with each other are both used.
           *
           * @param mutuallyExclusiveMap - The map of mutually exclusive props.
           */
          BaseComponent.prototype._warnMutuallyExclusive = function (mutuallyExclusiveMap) {
              warn_1.warnMutuallyExclusive(this.className, this.props, mutuallyExclusiveMap);
          };
          /**
           * Warns when props are required if a condition is met.
           *
           * @param requiredProps - The name of the props that are required when the condition is met.
           * @param conditionalPropName - The name of the prop that the condition is based on.
           * @param condition - Whether the condition is met.
           */
          BaseComponent.prototype._warnConditionallyRequiredProps = function (requiredProps, conditionalPropName, condition) {
              warn_1.warnConditionallyRequiredProps(this.className, this.props, requiredProps, conditionalPropName, condition);
          };
          return BaseComponent;
      }(React.Component));
      exports.BaseComponent = BaseComponent;
      /**
       * Helper to override a given method with a wrapper method that can try/catch the original, but also
       * ensures that the BaseComponent's methods are called before the subclass's. This ensures that
       * componentWillUnmount in the base is called and that things in the _disposables array are disposed.
       */
      function _makeAllSafe(obj, prototype, methodNames) {
          for (var i = 0, len = methodNames.length; i < len; i++) {
              _makeSafe(obj, prototype, methodNames[i]);
          }
      }
      function _makeSafe(obj, prototype, methodName) {
          // tslint:disable:no-any
          var classMethod = obj[methodName];
          var prototypeMethod = prototype[methodName];
          // tslint:enable:no-any
          if (classMethod || prototypeMethod) {
              // tslint:disable-next-line:no-any
              obj[methodName] = function () {
                  var retVal;
                  if (prototypeMethod) {
                      retVal = prototypeMethod.apply(this, arguments);
                  }
                  if (classMethod !== prototypeMethod) {
                      retVal = classMethod.apply(this, arguments);
                  }
                  return retVal;
              };
          }
      }
      /**
       * Simple constant function for returning null, used to render empty templates in JSX.
       *
       * @public
       */
      function nullRender() { return null; }
      exports.nullRender = nullRender;
  });
  //# sourceMappingURL=BaseComponent.js.map