"use strict";

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

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

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

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

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

var _core = require("../core");

var _EventListener = _interopRequireDefault(require("../event/EventListener"));

function toCylinderProps(_ref) {
  var ambientOcclusionMap = _ref.ambientOcclusionMap,
      ambientOcclusionMapIntensity = _ref.ambientOcclusionMapIntensity,
      ambientOcclusionTextureOffset = _ref.ambientOcclusionTextureOffset,
      ambientOcclusionTextureRepeat = _ref.ambientOcclusionTextureRepeat,
      color = _ref.color,
      displacementBias = _ref.displacementBias,
      displacementMap = _ref.displacementMap,
      displacementScale = _ref.displacementScale,
      displacementTextureOffset = _ref.displacementTextureOffset,
      displacementTextureRepeat = _ref.displacementTextureRepeat,
      envMap = _ref.envMap,
      fog = _ref.fog,
      height = _ref.height,
      metalness = _ref.metalness,
      normalMap = _ref.normalMap,
      normalScale = _ref.normalScale,
      normalTextureOffset = _ref.normalTextureOffset,
      normalTextureRepeat = _ref.normalTextureRepeat,
      openEnded = _ref.openEnded,
      radiusBottom = _ref.radiusBottom,
      radiusTop = _ref.radiusTop,
      repeat = _ref.repeat,
      roughness = _ref.roughness,
      segmentsHeight = _ref.segmentsHeight,
      segmentsRadial = _ref.segmentsRadial,
      sphericalEnvMap = _ref.sphericalEnvMap,
      src = _ref.src,
      thetaLength = _ref.thetaLength,
      thetaStart = _ref.thetaStart,
      width = _ref.width,
      wireframe = _ref.wireframe,
      wireframeLinewidth = _ref.wireframeLinewidth;
  return {
    'ambient-occlusion-map': ambientOcclusionMap,
    'ambient-occlusion-map-intensity': ambientOcclusionMapIntensity,
    'ambient-occlusion-texture-offset': ambientOcclusionTextureOffset && new _components.Vec2(ambientOcclusionTextureOffset).toString(),
    'ambient-occlusion-texture-repeat': ambientOcclusionTextureRepeat && new _components.Vec2(ambientOcclusionTextureRepeat).toString(),
    color: color,
    'displacement-bias': displacementBias,
    'displacement-map': displacementMap,
    'displacement-scale': displacementScale,
    'displacement-texture-offset': displacementTextureOffset && new _components.Vec2(displacementTextureOffset).toString(),
    'displacement-texture-repeat': displacementTextureRepeat && new _components.Vec2(displacementTextureRepeat).toString(),
    'env-map': envMap,
    fog: fog,
    height: height,
    metalness: metalness,
    'normal-map': normalMap,
    'normal-scale': normalScale && new _components.Vec2(normalScale).toString(),
    'normal-texture-offset': normalTextureOffset && new _components.Vec2(normalTextureOffset).toString(),
    'normal-texture-repeat': normalTextureRepeat && new _components.Vec2(normalTextureRepeat).toString(),
    'open-ended': openEnded,
    'radius-bottom': radiusBottom,
    'radius-top': radiusTop,
    repeat: repeat && new _components.Vec2(repeat).toString(),
    roughness: roughness,
    'segments-height': segmentsHeight,
    'segments-radial': segmentsRadial,
    'spherical-env-map': sphericalEnvMap,
    src: src,
    'theta-length': thetaLength,
    'theta-start': thetaStart,
    width: width,
    wireframe: wireframe,
    'wireframe-linewidth': wireframeLinewidth
  };
}
/**
 * The cylinder primitive is used to create tubes and curved surfaces.
 *
 * @see https://aframe.io/docs/1.3.0/primitives/a-cylinder.html
 *
 * @example
 * ```tsx
 * // Basic cylinder.
 * <Cylinder
 *   color="crimson"
 *   height={3}
 *   radius={1.5}
 * />
 *
 * // Hexagon.
 * <Cylinder
 *   color="cyan"
 *   segments-radial={6}
 * />
 *
 * // Pac-man.
 * <Cylinder
 *   color="yellow"
 *   theta-start={50}
 *   theta-length={280}
 *   side="double"
 * />
 *
 * // Green pipe.
 * <Cylinder
 *   color="green"
 *   open-ended={true}
 * />
 * ```
 */


var Cylinder = function Cylinder(props) {
  var cylinderKeys = ['ambientOcclusionMap', 'ambientOcclusionMapIntensity', 'ambientOcclusionTextureOffset', 'ambientOcclusionTextureRepeat', 'color', 'displacementBias', 'displacementMap', 'displacementScale', 'displacementTextureOffset', 'displacementTextureRepeat', 'envMap', 'fog', 'height', 'metalness', 'normalMap', 'normalScale', 'normalTextureOffset', 'normalTextureRepeat', 'openEnded', 'radiusBottom', 'radiusTop', 'repeat', 'roughness', 'segmentsHeight', 'segmentsRadial', 'sphericalEnvMap', 'src', 'thetaLength', 'thetaStart', 'width', 'wireframe', 'wireframeLinewidth'];
  var children = props.children;
  return /*#__PURE__*/_react.default.createElement(_EventListener.default, (0, _extends2.default)({
    primitive: "a-cylinder"
  }, (0, _core.toProps)(props, cylinderKeys), toCylinderProps(props)), children);
};

exports.Cylinder = Cylinder;