text: 'use strict';
  
  Object.defineProperty(exports, '__esModule', { value: true });
  
  var _extends = require('@babel/runtime/helpers/extends');
  var _objectWithoutPropertiesLoose = require('@babel/runtime/helpers/objectWithoutPropertiesLoose');
  var React = require('react');
  var THREE = require('three');
  var Sky$1 = require('three/examples/jsm/objects/Sky');
  
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
  
  var _extends__default = /*#__PURE__*/_interopDefaultLegacy(_extends);
  var _objectWithoutPropertiesLoose__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutPropertiesLoose);
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
  
  function calcPosFromAngles(inclination, azimuth, vector) {
    if (vector === void 0) {
      vector = new THREE.Vector3();
    }
  
    var theta = Math.PI * (inclination - 0.5);
    var phi = 2 * Math.PI * (azimuth - 0.5);
    vector.x = Math.cos(phi);
    vector.y = Math.sin(theta);
    vector.z = Math.sin(phi);
    return vector;
  }
  var Sky = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
    var _ref$inclination = _ref.inclination,
        inclination = _ref$inclination === void 0 ? 0 : _ref$inclination,
        _ref$azimuth = _ref.azimuth,
        azimuth = _ref$azimuth === void 0 ? 0.25 : _ref$azimuth,
        _ref$distance = _ref.distance,
        distance = _ref$distance === void 0 ? 100 : _ref$distance,
        _ref$mieCoefficient = _ref.mieCoefficient,
        mieCoefficient = _ref$mieCoefficient === void 0 ? 0.005 : _ref$mieCoefficient,
        _ref$mieDirectionalG = _ref.mieDirectionalG,
        mieDirectionalG = _ref$mieDirectionalG === void 0 ? 0.8 : _ref$mieDirectionalG,
        _ref$rayleigh = _ref.rayleigh,
        rayleigh = _ref$rayleigh === void 0 ? 1 : _ref$rayleigh,
        _ref$turbidity = _ref.turbidity,
        turbidity = _ref$turbidity === void 0 ? 2 : _ref$turbidity,
        _ref$sunPosition = _ref.sunPosition,
        sunPosition = _ref$sunPosition === void 0 ? calcPosFromAngles(inclination, azimuth) : _ref$sunPosition,
        props = _objectWithoutPropertiesLoose__default['default'](_ref, ["inclination", "azimuth", "distance", "mieCoefficient", "mieDirectionalG", "rayleigh", "turbidity", "sunPosition"]);
  
    var scale = React.useMemo(function () {
      return new THREE.Vector3().setScalar(distance);
    }, [distance]);
  
    var _useState = React.useState(function () {
      return new Sky$1.Sky();
    }),
        sky = _useState[0];
  
    return /*#__PURE__*/React__default['default'].createElement("primitive", _extends__default['default']({
      dispose: undefined,
      object: sky,
      ref: ref,
      "material-uniforms-mieCoefficient-value": mieCoefficient,
      "material-uniforms-mieDirectionalG-value": mieDirectionalG,
      "material-uniforms-rayleigh-value": rayleigh,
      "material-uniforms-sunPosition-value": sunPosition,
      "material-uniforms-turbidity-value": turbidity,
      scale: scale
    }, props));
  });
  
  exports.Sky = Sky;
  exports.calcPosFromAngles = calcPosFromAngles;
  