"use strict";

exports.__esModule = true;
exports["default"] = void 0;

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

var _reactYoutube = _interopRequireDefault(require("react-youtube"));

var _md = require("react-icons/md");

require("./style.css");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }

function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var BetaStartScreen = function BetaStartScreen(props) {
  var _useState = (0, _react.useState)(false),
      videoPromo = _useState[0],
      setVideoPromo = _useState[1];

  var opts = {
    width: props.aspectArea.width && props.aspectArea.width > 1280 ? 1280 : props.aspectArea.width,
    height: props.aspectArea.height && props.aspectArea.height > 720 ? 720 : props.aspectArea.height,
    playerVars: {
      // https://developers.google.com/youtube/player_parameters
      autoplay: 1
    }
  };

  var handleVideoPromo = function handleVideoPromo() {
    setVideoPromo(true);
  };

  var onVideoFinish = function onVideoFinish() {
    setVideoPromo(false);
  };

  var onClickSnakePreview = function onClickSnakePreview() {
    props.setShowBetaScreen(false);
  };

  return /*#__PURE__*/_react["default"].createElement("div", {
    className: "beta-start-screen"
  }, /*#__PURE__*/_react["default"].createElement("div", {
    className: "container"
  }, !videoPromo && /*#__PURE__*/_react["default"].createElement("div", {
    className: "text-content"
  }, /*#__PURE__*/_react["default"].createElement("p", null, "Performance+ is in development, but you can experience a sneak preview of the future potential. Please be patient, as it\u2019s far from perfect."), /*#__PURE__*/_react["default"].createElement("p", null, "Meanwhile, view the promo video to see what Performance+ will become when it\u2019s launched in full glory.")), videoPromo && /*#__PURE__*/_react["default"].createElement("div", {
    className: "video"
  }, /*#__PURE__*/_react["default"].createElement(_reactYoutube["default"], {
    videoId: "b7ZKo2NnKjw",
    opts: opts,
    onEnd: onVideoFinish
  })), !videoPromo && /*#__PURE__*/_react["default"].createElement("div", {
    className: "beta-start-screen-actions"
  }, /*#__PURE__*/_react["default"].createElement("button", {
    className: "btn-outline",
    onClick: handleVideoPromo
  }, "View Promo Video"), /*#__PURE__*/_react["default"].createElement("button", {
    className: "btn-outline",
    onClick: onClickSnakePreview
  }, "Go to Sneak Preview"))), videoPromo && /*#__PURE__*/_react["default"].createElement("button", {
    className: "btn-outline btn-close",
    onClick: onVideoFinish
  }, /*#__PURE__*/_react["default"].createElement(_md.MdClose, {
    size: "30px"
  })));
};

var _default = (0, _react.memo)(BetaStartScreen);

exports["default"] = _default;
module.exports = exports.default;