import _extends from "@babel/runtime/helpers/esm/extends";
import React from 'react';
import { toProps } from '../core';
import EventListener from '../event/EventListener';

function toLightProps(_ref) {
  var angle = _ref.angle,
      color = _ref.color,
      decay = _ref.decay,
      distance = _ref.distance,
      groundColor = _ref.groundColor,
      intensity = _ref.intensity,
      penumbra = _ref.penumbra,
      type = _ref.type,
      target = _ref.target;
  return {
    angle: angle,
    color: color,
    decay: decay,
    distance: distance,
    'ground-color': groundColor,
    intensity: intensity,
    penumbra: penumbra,
    type: type,
    target: target
  };
}
/**
 * A light changes the lighting and shading of the scene.
 *
 * @see https://aframe.io/docs/1.3.0/primitives/a-light.html
 *
 * @example
 * ```tsx
 * // Red directional light shining from the top left.
 * <Light color="red" position={{ x: -1, y: 1, z: 0 }} />
 *
 * // Blue point light, 5 meters in the air.
 * <Light type="point" color="blue" position={{ x: 0, y: 5, z: 0 }} />
 *
 * // Dim ambient lighting.
 * <Light type="ambient" color="#222" />
 * ```
 */


export var Light = function Light(props) {
  var lightKeys = ['angle', 'color', 'decay', 'distance', 'groundColor', 'intensity', 'penumbra', 'type', 'target'];
  var children = props.children;
  return /*#__PURE__*/React.createElement(EventListener, _extends({
    primitive: "a-light"
  }, toProps(props, lightKeys), toLightProps(props)), children);
};