"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));

var _constants = require("./constants");

var _createProps = require("./create-props");

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }

var counter = 0;

var Component = function () {
  function Component() {
    (0, _classCallCheck2.default)(this, Component);
    this.id = void 0;
    this.props = void 0;
    this.count = void 0;

    for (var _len = arguments.length, propObjects = new Array(_len), _key = 0; _key < _len; _key++) {
      propObjects[_key] = arguments[_key];
    }

    this.props = (0, _createProps.createProps)(this, propObjects);
    this.id = this.props.id;
    this.count = counter++;
  }

  var _proto = Component.prototype;

  _proto.clone = function clone(newProps) {
    var props = this.props;
    var asyncProps = {};

    for (var key in props[_constants.ASYNC_DEFAULTS_SYMBOL]) {
      if (key in props[_constants.ASYNC_RESOLVED_SYMBOL]) {
        asyncProps[key] = props[_constants.ASYNC_RESOLVED_SYMBOL][key];
      } else if (key in props[_constants.ASYNC_ORIGINAL_SYMBOL]) {
        asyncProps[key] = props[_constants.ASYNC_ORIGINAL_SYMBOL][key];
      }
    }

    return new this.constructor(_objectSpread(_objectSpread(_objectSpread({}, props), asyncProps), newProps));
  };

  return Component;
}();

exports.default = Component;
Component.componentName = 'Component';
Component.defaultProps = {};
//# sourceMappingURL=component.js.map