"use strict";

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

exports.__esModule = true;
exports.default = void 0;

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

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

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

/* eslint-disable react/destructuring-assignment */

/* eslint-disable @typescript-eslint/ban-types */
var Mixin = 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);
};

var _default = Mixin;
exports.default = _default;