"use strict";

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

exports.__esModule = true;
exports.default = Mixin;

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

var _react = _interopRequireDefault(require("react"));

var _components = require("../components");

function Mixin(props) {
  var id = props.id,
      className = props.className,
      material = props.material,
      geometry = props.geometry,
      children = props.children;
  var defaultKeys = ['id', 'className', 'material', 'geometry', 'children'];
  var extraKeys = Object.keys(props).filter(function (key) {
    return !defaultKeys.includes(key);
  });
  var extraProps = extraKeys.reduce(function (acc, key) {
    var _extends2;

    return (0, _extends3.default)({}, acc, (_extends2 = {}, _extends2[key] = props[key], _extends2));
  }, {});
  return /*#__PURE__*/_react.default.createElement("a-mixin", (0, _extends3.default)({
    id: id,
    class: className,
    material: material && new _components.Material(material).toString(),
    geometry: geometry && new _components.Geometry(geometry).toString()
  }, extraProps), children);
}