"use strict";

exports.__esModule = true;
exports.default = exports.About = exports.getClickOutsideHandler = exports.AboutLink = exports.AboutParagraph = exports.CloseButton = exports.AboutBox = exports.ABOUT_NAME = void 0;

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

var _reactDom = _interopRequireDefault(require("react-dom"));

var _reactRedux = require("react-redux");

var _styledComponents = _interopRequireWildcard(require("styled-components"));

var _styledTransitionGroup = _interopRequireDefault(require("styled-transition-group"));

var _utils = require("../../utils");

var _Text = _interopRequireDefault(require("../Text"));

var _withClickOutside = _interopRequireDefault(require("../../hocs/withClickOutside"));

var _useViewState3 = _interopRequireDefault(require("../../hooks/useViewState"));

var _aboutBackground = _interopRequireDefault(require("../../content/aboutBackground.png"));

var _aboutLogo = _interopRequireDefault(require("../../content/aboutLogo.png"));

var _close = _interopRequireDefault(require("../../content/close.png"));

var _versionInfo = require("../../selectors/versionInfo");

var _locale = require("../../selectors/locale");

var _sharedMessages = _interopRequireDefault(require("./../../sharedMessages"));

var _templateObject;

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; }

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

(function () {
  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
  enterModule && enterModule(module);
})();

(function () {
  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
  enterModule && enterModule(module);
})();

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }

function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }

function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }

function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }

function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }

function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }

function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }

var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
  return a;
};

var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
  return a;
};

var ABOUT_NAME = "__aboutBox";
exports.ABOUT_NAME = ABOUT_NAME;

var getModalRoot = function getModalRoot() {
  return document.getElementById("modal");
};

var AboutBox = (0, _withClickOutside.default)(_styledTransitionGroup.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n\tbox-sizing: border-box;\n\tz-index: 9999;\n\tposition: absolute;\n\ttop: calc(50% - 210px);\n\tleft: calc(50% - 210px);\n\theight: 420px;\n\twidth: 420px;\n\tpadding: 15px 20px;\n\tcolor: #ffffff;\n\tfont-size: 13px;\n\tline-height: 16px;\n\tbackground: #0a0a07 url(", ");\n\ttransition: opacity ", "ms ease-out;\n\n\t&:enter {\n\t\topacity: 0;\n\t}\n\t&:enter-active {\n\t\topacity: 1;\n\t}\n\t&:exit {\n\t\topacity: 1;\n\t}\n\t&:exit-active {\n\t\topacity: 0;\n\t}\n"])), _aboutBackground.default, function (props) {
  return props.timeout;
}));
exports.AboutBox = AboutBox;
AboutBox.defaultProps = {
  timeout: 800,
  unmountOnExit: true
};

var CloseButton = _styledComponents.default.p.withConfig({
  displayName: "About__CloseButton",
  componentId: "sc-1y9zgcc-0"
})(["z-index:9999;position:absolute;color:#ffffff;top:15px;right:20px;margin:0;cursor:pointer;opacity:1;&:hover{opacity:0.75;}"]);

exports.CloseButton = CloseButton;

var AboutParagraph = _styledComponents.default.p.withConfig({
  displayName: "About__AboutParagraph",
  componentId: "sc-1y9zgcc-1"
})(["margin-top:20px;", ""], (0, _utils.ifFlag)("long", (0, _styledComponents.css)(["html[lang^=\"fr\"] &{font-size:10px;}"])));

exports.AboutParagraph = AboutParagraph;

var AboutLink = _styledComponents.default.a.withConfig({
  displayName: "About__AboutLink",
  componentId: "sc-1y9zgcc-2"
})(["color:#23527c;text-decoration:none;"]);

exports.AboutLink = AboutLink;

var getClickOutsideHandler = function getClickOutsideHandler(_ref, updateViewState) {
  var show = _ref.show;
  return show ? function (event) {
    event.stopPropagation();
    updateViewState("show", false);
  } : function () {};
};

exports.getClickOutsideHandler = getClickOutsideHandler;

var About = function About(_ref2) {
  var currentApplication = _ref2.currentApplication;

  var _useViewState = (0, _useViewState3.default)(ABOUT_NAME),
      _useViewState2 = _slicedToArray(_useViewState, 2),
      viewState = _useViewState2[0],
      updateViewState = _useViewState2[1];

  var version = (0, _reactRedux.useSelector)(_versionInfo.getVersionSelector);
  var locale = (0, _reactRedux.useSelector)(_locale.currentLocaleOrDefault);
  var closeAboutBox = getClickOutsideHandler(viewState, updateViewState);
  var aboutLinkUrl = "https://www.orckestra.com".concat(locale.substr(0, 2).toLowerCase() === "fr" ? "/fr" : "");
  return /*#__PURE__*/_react.default.createElement(AboutBox, {
    in: viewState.show,
    onClickOutside: closeAboutBox
  }, /*#__PURE__*/_react.default.createElement(CloseButton, {
    onClick: closeAboutBox
  }, /*#__PURE__*/_react.default.createElement("img", {
    src: _close.default,
    alt: "X"
  })), /*#__PURE__*/_react.default.createElement("img", {
    src: _aboutLogo.default,
    alt: "Orckestra"
  }), /*#__PURE__*/_react.default.createElement(AboutParagraph, null, /*#__PURE__*/_react.default.createElement(_Text.default, {
    message: _objectSpread(_objectSpread({}, _sharedMessages.default.ccVersion), {}, {
      values: {
        version: version
      }
    })
  }), currentApplication && currentApplication.displayName ? [/*#__PURE__*/_react.default.createElement("br", {
    key: "application-br"
  }), /*#__PURE__*/_react.default.createElement(_Text.default, {
    key: "application-version",
    message: currentApplication.displayName.concat(" ", window.BUILD_NUMBER)
  })] : null, DEPENDENCIES && DEPENDENCIES["orc-shared"] ? [/*#__PURE__*/_react.default.createElement("br", {
    key: "orc-shared-br"
  }), /*#__PURE__*/_react.default.createElement(_Text.default, {
    key: "orc-shared-version",
    message: _objectSpread(_objectSpread({}, _sharedMessages.default.orcSharedVersion), {}, {
      values: {
        version: DEPENDENCIES["orc-shared"]
      }
    })
  })] : null, DEPENDENCIES && DEPENDENCIES["orc-scripts"] ? [/*#__PURE__*/_react.default.createElement("br", {
    key: "orc-scripts-br"
  }), /*#__PURE__*/_react.default.createElement(_Text.default, {
    key: "orc-scripts-version",
    message: _objectSpread(_objectSpread({}, _sharedMessages.default.orcScriptsVersion), {}, {
      values: {
        version: DEPENDENCIES["orc-scripts"]
      }
    })
  })] : null, DEPENDENCIES && DEPENDENCIES["orc-secret"] ? [/*#__PURE__*/_react.default.createElement("br", {
    key: "orc-secret-br"
  }), /*#__PURE__*/_react.default.createElement(_Text.default, {
    key: "orc-secret-version",
    message: _objectSpread(_objectSpread({}, _sharedMessages.default.orcSecretVersion), {}, {
      values: {
        version: DEPENDENCIES["orc-secret"]
      }
    })
  })] : null), /*#__PURE__*/_react.default.createElement(AboutParagraph, {
    long: true
  }, /*#__PURE__*/_react.default.createElement(_Text.default, {
    message: _sharedMessages.default.copyrightTermsNotice
  })), /*#__PURE__*/_react.default.createElement(AboutParagraph, null, /*#__PURE__*/_react.default.createElement(AboutLink, {
    href: aboutLinkUrl,
    target: "_blank"
  }, /*#__PURE__*/_react.default.createElement(_Text.default, {
    message: _sharedMessages.default.ccName
  }))), /*#__PURE__*/_react.default.createElement(AboutParagraph, null, /*#__PURE__*/_react.default.createElement(_Text.default, {
    message: _sharedMessages.default.copyright
  }), /*#__PURE__*/_react.default.createElement("br", null), /*#__PURE__*/_react.default.createElement(_Text.default, {
    message: _sharedMessages.default.allRightsReserved
  })));
};

exports.About = About;

__signature__(About, "useViewState{[viewState, updateViewState]}\nuseSelector{version}\nuseSelector{locale}", function () {
  return [_useViewState3.default, _reactRedux.useSelector, _reactRedux.useSelector];
});

__signature__(About, "useViewState{[viewState, updateViewState]}\nuseSelector{version}\nuseSelector{locale}", function () {
  return [_useViewState3.default, _reactRedux.useSelector, _reactRedux.useSelector];
});

var WiredAbout = About;

var _default = function _default(props) {
  return _reactDom.default.createPortal( /*#__PURE__*/_react.default.createElement(WiredAbout, props), getModalRoot());
};

var _default2 = _default;
var _default3 = _default2;
exports.default = _default3;
;

(function () {
  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;

  if (!reactHotLoader) {
    return;
  }

  reactHotLoader.register(ABOUT_NAME, "ABOUT_NAME", "/home/vsts/work/1/s/src/components/AppFrame/About.js");
  reactHotLoader.register(getModalRoot, "getModalRoot", "/home/vsts/work/1/s/src/components/AppFrame/About.js");
  reactHotLoader.register(AboutBox, "AboutBox", "/home/vsts/work/1/s/src/components/AppFrame/About.js");
  reactHotLoader.register(CloseButton, "CloseButton", "/home/vsts/work/1/s/src/components/AppFrame/About.js");
  reactHotLoader.register(AboutParagraph, "AboutParagraph", "/home/vsts/work/1/s/src/components/AppFrame/About.js");
  reactHotLoader.register(AboutLink, "AboutLink", "/home/vsts/work/1/s/src/components/AppFrame/About.js");
  reactHotLoader.register(getClickOutsideHandler, "getClickOutsideHandler", "/home/vsts/work/1/s/src/components/AppFrame/About.js");
  reactHotLoader.register(About, "About", "/home/vsts/work/1/s/src/components/AppFrame/About.js");
  reactHotLoader.register(WiredAbout, "WiredAbout", "/home/vsts/work/1/s/src/components/AppFrame/About.js");
  reactHotLoader.register(_default, "default", "/home/vsts/work/1/s/src/components/AppFrame/About.js");
})();

;

(function () {
  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
  leaveModule && leaveModule(module);
})();

;

(function () {
  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;

  if (!reactHotLoader) {
    return;
  }

  reactHotLoader.register(ABOUT_NAME, "ABOUT_NAME", "/home/vsts/work/1/s/src/components/AppFrame/About.js");
  reactHotLoader.register(getModalRoot, "getModalRoot", "/home/vsts/work/1/s/src/components/AppFrame/About.js");
  reactHotLoader.register(AboutBox, "AboutBox", "/home/vsts/work/1/s/src/components/AppFrame/About.js");
  reactHotLoader.register(CloseButton, "CloseButton", "/home/vsts/work/1/s/src/components/AppFrame/About.js");
  reactHotLoader.register(AboutParagraph, "AboutParagraph", "/home/vsts/work/1/s/src/components/AppFrame/About.js");
  reactHotLoader.register(AboutLink, "AboutLink", "/home/vsts/work/1/s/src/components/AppFrame/About.js");
  reactHotLoader.register(getClickOutsideHandler, "getClickOutsideHandler", "/home/vsts/work/1/s/src/components/AppFrame/About.js");
  reactHotLoader.register(About, "About", "/home/vsts/work/1/s/src/components/AppFrame/About.js");
  reactHotLoader.register(WiredAbout, "WiredAbout", "/home/vsts/work/1/s/src/components/AppFrame/About.js");
  reactHotLoader.register(_default2, "default", "/home/vsts/work/1/s/src/components/AppFrame/About.js");
})();

;

(function () {
  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
  leaveModule && leaveModule(module);
})();