'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _class, _temp, _class3, _temp4, _class4, _temp5, _class5, _temp6;

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _propTypes = require('prop-types');

var _propTypes2 = _interopRequireDefault(_propTypes);

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

var _reactBootstrap = require('react-bootstrap');

var _reactFontawesome = require('react-fontawesome');

var _reactFontawesome2 = _interopRequireDefault(_reactFontawesome);

var _electron = require('electron');

var _mousetrap = require('mousetrap');

var _mousetrap2 = _interopRequireDefault(_mousetrap);

var _lodash = require('lodash');

var _divider = require('./divider');

var _divider2 = _interopRequireDefault(_divider);

var _navigatorBar = require('./navigator-bar');

var _navigatorBar2 = _interopRequireDefault(_navigatorBar);

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

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

const { config, toggleModal, i18n } = window;
const __ = i18n.setting.__.bind(i18n.setting);
const { session } = _electron.remote.require('electron');

let language = window.language;
if (!['zh-CN', 'zh-TW', 'ja-JP', 'en-US', 'ko-KR'].includes(language)) {
  switch (language.substr(0, 1).toLowerCase()) {
    case 'zh':
      language = 'zh-TW';
      break;
    case 'ja':
      language = 'ja-JP';
      break;
    case 'ko':
      language = 'ko-KR';
      break;
    default:
      language = 'en-US';
  }
}

let keyListener;

config.on('config.set', (path, value) => {
  switch (path) {
    case 'poi.shortcut.bosskey':
      _electron.ipcRenderer.send('refresh-shortcut');
      break;
  }
});

const SetNotifyIndividualConfig = (0, _reactRedux.connect)(() => {
  return (state, props) => ({
    enabled: (0, _lodash.get)(state.config, 'poi.notify.enabled', true),
    expedition: (0, _lodash.get)(state.config, 'poi.notify.expedition.enabled', true),
    expeditionValue: (0, _lodash.get)(state.config, 'poi.notify.expedition.value', 60),
    construction: (0, _lodash.get)(state.config, 'poi.notify.construction.enabled', true),
    repair: (0, _lodash.get)(state.config, 'poi.notify.repair.enabled', true),
    morale: (0, _lodash.get)(state.config, 'poi.notify.morale.enabled', true),
    moraleValue: (0, _lodash.get)(state.config, 'poi.notify.morale.value', 49),
    others: (0, _lodash.get)(state.config, 'poi.notify.others.enabled', true),
    volume: (0, _lodash.get)(state.config, 'poi.notify.volume', 0.8)
  });
})((_temp = _class = class setNotifyIndividualConfig extends _react.Component {
  constructor(props) {
    super(props);

    this.handleSetNotify = path => {
      if (!path) {
        config.set(`poi.notify.enabled`, !this.props.enabled);
      } else {
        config.set(`poi.notify.${path}.enabled`, !(0, _lodash.get)(this.props, path, true));
      }
    };

    this.handleChangeNotifyVolume = e => {
      let volume = e.target.value;
      volume = parseFloat(volume);
      if (isNaN(volume)) {
        return;
      }
      config.set('poi.notify.volume', volume);
    };

    this.handleEndChangeNotifyVolume = e => {
      window.notify(null);
    };

    this.handleSetTimeSettingShow = () => {
      const timeSettingShow = !this.state.timeSettingShow;
      this.setState({ timeSettingShow });
    };

    this.selectInput = id => {
      document.getElementById(id).select();
    };

    this.handleSetExpedition = e => {
      const value = parseInt(e.target.value) || 0;
      if (isNaN(value) || value < 0) {
        return;
      }
      this.setState({ expeditionValue: value });
    };

    this.handleSetMorale = e => {
      const value = parseInt(e.target.value) || 0;
      if (isNaN(value) || value < 0) {
        return;
      }
      this.setState({ moraleValue: value });
    };

    this.saveNotifySetting = () => {
      const { moraleValue, expeditionValue } = this.state;
      config.set('poi.notify.expedition.value', expeditionValue);
      config.set('poi.notify.morale.value', moraleValue);
      this.setState({ timeSettingShow: false });
    };

    this.state = {
      timeSettingShow: false,
      moraleValue: props.moraleValue,
      expeditionValue: props.expeditionValue
    };
  }

  render() {
    return _react2.default.createElement(
      _reactBootstrap.Grid,
      null,
      _react2.default.createElement(
        'div',
        null,
        _react2.default.createElement(
          _reactBootstrap.Col,
          { xs: 6 },
          _react2.default.createElement(
            _reactBootstrap.Button,
            {
              bsStyle: this.props.enabled ? 'success' : 'danger',
              onClick: this.handleSetNotify.bind(this, null),
              style: { width: '100%' } },
            (0, _lodash.get)(this.props, 'enabled', true) ? '√ ' : '',
            __('Enable notification')
          )
        ),
        _react2.default.createElement(
          _reactBootstrap.Col,
          { xs: 6 },
          _react2.default.createElement(
            _reactBootstrap.OverlayTrigger,
            { placement: 'top', overlay: _react2.default.createElement(
                _reactBootstrap.Tooltip,
                { id: 'poiconfig-volume' },
                __('Volume'),
                ' ',
                _react2.default.createElement(
                  'strong',
                  null,
                  parseInt(this.props.volume * 100),
                  '%'
                )
              ) },
            _react2.default.createElement(_reactBootstrap.FormControl, { type: 'range',
              onChange: this.handleChangeNotifyVolume, onMouseUp: this.handleEndChangeNotifyVolume,
              min: 0.0, max: 1.0, step: 0.05, defaultValue: this.props.volume })
          )
        )
      ),
      _react2.default.createElement(
        'div',
        null,
        _react2.default.createElement(
          _reactBootstrap.Col,
          { xs: 12, style: { marginTop: 10 } },
          _react2.default.createElement(
            _reactBootstrap.ButtonGroup,
            { style: { display: 'flex' } },
            _react2.default.createElement(
              _reactBootstrap.Button,
              { bsStyle: this.props.construction ? 'success' : 'danger',
                onClick: this.handleSetNotify.bind(this, 'construction'),
                className: 'notif-button' },
              __('Construction')
            ),
            _react2.default.createElement(
              _reactBootstrap.Button,
              { bsStyle: this.props.expedition ? 'success' : 'danger',
                onClick: this.handleSetNotify.bind(this, 'expedition'),
                className: 'notif-button' },
              __('Expedition')
            ),
            _react2.default.createElement(
              _reactBootstrap.Button,
              { bsStyle: this.props.repair ? 'success' : 'danger',
                onClick: this.handleSetNotify.bind(this, 'repair'),
                className: 'notif-button' },
              __('Docking')
            ),
            _react2.default.createElement(
              _reactBootstrap.Button,
              { bsStyle: this.props.morale ? 'success' : 'danger',
                onClick: this.handleSetNotify.bind(this, 'morale'),
                className: 'notif-button' },
              __('Morale')
            ),
            _react2.default.createElement(
              _reactBootstrap.Button,
              { bsStyle: this.props.others ? 'success' : 'danger',
                onClick: this.handleSetNotify.bind(this, 'others'),
                className: 'notif-button' },
              __('Others')
            ),
            _react2.default.createElement(
              _reactBootstrap.Button,
              { onClick: this.handleSetTimeSettingShow, bsStyle: 'primary', style: { width: 40 } },
              _react2.default.createElement(_reactFontawesome2.default, { name: this.state.timeSettingShow ? 'angle-up' : 'angle-down' })
            )
          ),
          _react2.default.createElement(
            _reactBootstrap.Collapse,
            { 'in': this.state.timeSettingShow },
            _react2.default.createElement(
              'div',
              null,
              _react2.default.createElement(
                _reactBootstrap.Well,
                null,
                _react2.default.createElement(
                  _reactBootstrap.Row,
                  null,
                  _react2.default.createElement(
                    _reactBootstrap.Col,
                    { xs: 9, className: 'notif-container' },
                    _react2.default.createElement(
                      'div',
                      { className: 'notif-input-desc' },
                      __('Expedition'),
                      ': ',
                      __('Notify when expedition returns in')
                    )
                  ),
                  _react2.default.createElement(
                    _reactBootstrap.Col,
                    { xs: 3, className: 'notif-container' },
                    _react2.default.createElement(
                      _reactBootstrap.FormGroup,
                      null,
                      _react2.default.createElement(
                        _reactBootstrap.InputGroup,
                        { bsSize: 'small' },
                        _react2.default.createElement(_reactBootstrap.FormControl, { type: 'number', ref: 'expeditionValue', id: 'expeditionValue',
                          disabled: !this.props.expedition,
                          onChange: this.handleSetExpedition,
                          value: this.state.expeditionValue,
                          onClick: this.selectInput.bind(this, "expeditionValue"),
                          className: 'notif-input' }),
                        _react2.default.createElement(
                          _reactBootstrap.InputGroup.Addon,
                          null,
                          'S'
                        )
                      )
                    )
                  )
                ),
                _react2.default.createElement(
                  _reactBootstrap.Row,
                  null,
                  _react2.default.createElement(
                    _reactBootstrap.Col,
                    { xs: 9, className: 'notif-container' },
                    _react2.default.createElement(
                      'div',
                      { className: 'notif-input-desc' },
                      __('Morale'),
                      ': ',
                      __('Notify when morale is greater than')
                    )
                  ),
                  _react2.default.createElement(
                    _reactBootstrap.Col,
                    { xs: 3, className: 'notif-container' },
                    _react2.default.createElement(
                      _reactBootstrap.InputGroup,
                      { bsSize: 'small' },
                      _react2.default.createElement(_reactBootstrap.FormControl, { type: 'number', ref: 'moraleValue', id: 'moraleValue',
                        disabled: !this.props.morale,
                        onChange: this.handleSetMorale,
                        value: this.state.moraleValue,
                        onClick: this.selectInput.bind(this, "moraleValue"),
                        className: 'notif-input' })
                    )
                  )
                ),
                _react2.default.createElement(
                  _reactBootstrap.Row,
                  null,
                  _react2.default.createElement(
                    _reactBootstrap.Col,
                    { xs: 2, xsOffset: 10 },
                    _react2.default.createElement(
                      _reactBootstrap.Button,
                      { bsSize: 'small', onClick: this.saveNotifySetting },
                      __('Save')
                    )
                  )
                )
              )
            )
          )
        )
      )
    );
  }
}, _class.propTypes = {
  enabled: _propTypes2.default.bool
}, _temp));

let t;
const ClearCacheCookieConfig = (0, _reactRedux.connect)(state => ({
  cacheSize: (0, _lodash.get)(state.config, 'poi.cacheSize', 320)
}))(class clearCacheCookieConfig extends _react.Component {
  constructor(...args) {
    var _temp2;

    return _temp2 = super(...args), this.state = {
      cacheSize: 0
    }, this.handleClearCookie = e => {
      _electron.remote.getCurrentWebContents().session.clearStorageData({ storages: ['cookies'] }, () => {
        toggleModal(__('Delete cookies'), __('Success!'));
      });
    }, this.handleClearCache = e => {
      _electron.remote.getCurrentWebContents().session.clearCache(() => {
        toggleModal(__('Delete cache'), __('Success!'));
      });
    }, this.handleValueChange = e => {
      config.set('poi.cacheSize', e.target.value);
    }, this.handleUpdateCacheSize = () => {
      session.defaultSession.getCacheSize(cacheSize => this.setState({ cacheSize }));
    }, this.componentDidMount = () => {
      this.handleUpdateCacheSize();
      t = setInterval(this.handleUpdateCacheSize, 6000000);
    }, this.componentWillUnmount = () => {
      clearInterval(t);
    }, _temp2;
  }

  render() {
    return _react2.default.createElement(
      _reactBootstrap.Grid,
      null,
      _react2.default.createElement(
        _reactBootstrap.Col,
        { xs: 6 },
        _react2.default.createElement(
          _reactBootstrap.FormGroup,
          null,
          _react2.default.createElement(
            _reactBootstrap.ControlLabel,
            null,
            __('Current cache size')
          ),
          _react2.default.createElement(
            _reactBootstrap.InputGroup,
            null,
            _react2.default.createElement(
              _reactBootstrap.InputGroup.Button,
              null,
              _react2.default.createElement(
                _reactBootstrap.Button,
                { onClick: this.handleUpdateCacheSize },
                __('Update')
              )
            ),
            _react2.default.createElement(_reactBootstrap.FormControl, { type: 'number',
              disabled: true,
              value: Math.round(this.state.cacheSize / 1048576),
              className: '' }),
            _react2.default.createElement(
              _reactBootstrap.InputGroup.Addon,
              null,
              'MB'
            )
          )
        )
      ),
      _react2.default.createElement(
        _reactBootstrap.Col,
        { xs: 6 },
        _react2.default.createElement(
          _reactBootstrap.FormGroup,
          null,
          _react2.default.createElement(
            _reactBootstrap.ControlLabel,
            null,
            __('Maximum cache size')
          ),
          _react2.default.createElement(
            _reactBootstrap.InputGroup,
            null,
            _react2.default.createElement(_reactBootstrap.FormControl, { type: 'number',
              onChange: this.handleValueChange,
              value: this.props.cacheSize,
              className: '' }),
            _react2.default.createElement(
              _reactBootstrap.InputGroup.Addon,
              null,
              'MB'
            )
          )
        )
      ),
      _react2.default.createElement(
        _reactBootstrap.Col,
        { xs: 6 },
        _react2.default.createElement(
          _reactBootstrap.Button,
          { bsStyle: 'danger', onClick: this.handleClearCookie, style: { width: '100%' } },
          __('Delete cookies')
        )
      ),
      _react2.default.createElement(
        _reactBootstrap.Col,
        { xs: 6 },
        _react2.default.createElement(
          _reactBootstrap.Button,
          { bsStyle: 'danger', onClick: this.handleClearCache, style: { width: '100%' } },
          __('Delete cache')
        )
      ),
      _react2.default.createElement(
        _reactBootstrap.Col,
        { xs: 12 },
        _react2.default.createElement(
          _reactBootstrap.Alert,
          { bsStyle: 'warning', style: { marginTop: '10px' } },
          __('If connection error occurs frequently, delete both of them.')
        )
      )
    );
  }
});

const SelectLanguageConfig = (0, _reactRedux.connect)(() => {
  return (state, props) => ({
    value: (0, _lodash.get)(state.config, 'poi.language', language)
  });
})((_temp4 = _class3 = class selectLanguageConfig extends _react.Component {
  constructor(...args) {
    var _temp3;

    return _temp3 = super(...args), this.handleSetLanguage = e => {
      const language = e.target.value;
      config.set('poi.language', language);
    }, _temp3;
  }

  render() {
    return _react2.default.createElement(
      _reactBootstrap.Grid,
      null,
      _react2.default.createElement(
        _reactBootstrap.Col,
        { xs: 6 },
        _react2.default.createElement(
          _reactBootstrap.FormControl,
          { componentClass: 'select', ref: 'language', value: this.props.value, onChange: this.handleSetLanguage },
          _react2.default.createElement(
            'option',
            { value: 'zh-CN' },
            '\u7B80\u4F53\u4E2D\u6587'
          ),
          _react2.default.createElement(
            'option',
            { value: 'zh-TW' },
            '\u6B63\u9AD4\u4E2D\u6587'
          ),
          _react2.default.createElement(
            'option',
            { value: 'ja-JP' },
            '\u65E5\u672C\u8A9E'
          ),
          _react2.default.createElement(
            'option',
            { value: 'en-US' },
            'English'
          ),
          _react2.default.createElement(
            'option',
            { value: 'ko-KR' },
            '\uD55C\uAD6D\uC5B4'
          )
        )
      )
    );
  }
}, _class3.propTypes = {
  value: _propTypes2.default.string
}, _temp4));

const SlotCheckConfig = (0, _reactRedux.connect)(() => {
  return (state, props) => ({
    type: props.type,
    enable: (0, _lodash.get)(state.config, `poi.mapStartCheck.${props.type}.enable`, false),
    minFreeSlots: (0, _lodash.get)(state.config, `poi.mapStartCheck.${props.type}.minFreeSlots`, '')
  });
})((_temp5 = _class4 = class slotCheckConfig extends _react.Component {
  constructor(props) {
    super(props);

    this.CheckValid = v => !isNaN(parseInt(v)) && parseInt(v) >= 0;

    this.handleToggleInput = () => {
      if (this.state.showInput) {
        this.handleDisable();
      } else {
        const num = this.state.value;
        this.setState({
          showInput: true,
          value: this.CheckValid(num) ? parseInt(num) : ''
        });
      }
    };

    this.handleChange = e => {
      this.setState({ value: e.target.value });
    };

    this.handleSubmit = e => {
      e.preventDefault();
      if (this.CheckValid(this.state.value)) {
        const n = parseInt(this.state.value);
        config.set(`poi.mapStartCheck.${this.props.type}`, {
          enable: true,
          minFreeSlots: n
        });
        this.setState({
          showInput: false,
          value: n
        });
      } else {
        this.handleDisable();
      }
    };

    this.handleDisable = () => {
      config.set(`poi.mapStartCheck.${this.props.type}.enable`, false);
      this.setState({ showInput: false });
    };

    this.state = {
      showInput: false,
      value: props.minFreeSlots
    };
  }

  render() {
    let toggleBtnStyle = this.props.enable ? 'success' : 'default';
    if (this.state.showInput) {
      toggleBtnStyle = 'danger';
    }
    let toggleBtnTxt = this.props.enable ? 'ON' : 'OFF';
    if (this.state.showInput) {
      toggleBtnTxt = __('Disable');
    }
    const toggleBtn = _react2.default.createElement(
      _reactBootstrap.Button,
      { onClick: this.handleToggleInput, bsSize: 'xs',
        bsStyle: toggleBtnStyle, style: { verticalAlign: 'text-bottom' } },
      toggleBtnTxt
    );
    const inputValid = this.CheckValid(this.state.value);
    const submitBtn = _react2.default.createElement(
      _reactBootstrap.Button,
      { type: 'submit',
        bsStyle: inputValid ? 'success' : 'danger' },
      inputValid ? __('Save') : __('Disable')
    );
    return _react2.default.createElement(
      'div',
      { style: { margin: '5px 15px' } },
      _react2.default.createElement(
        'form',
        { onSubmit: this.handleSubmit },
        _react2.default.createElement(
          'div',
          null,
          __(`${this.props.type} slots`),
          ' ',
          toggleBtn
        ),
        _react2.default.createElement(
          _reactBootstrap.Collapse,
          { 'in': this.state.showInput },
          _react2.default.createElement(
            'div',
            null,
            _react2.default.createElement(
              _reactBootstrap.Well,
              null,
              _react2.default.createElement(
                _reactBootstrap.FormGroup,
                null,
                _react2.default.createElement(
                  _reactBootstrap.ControlLabel,
                  null,
                  __(`Warn if the number of free ${this.props.type} slots is less than`)
                ),
                _react2.default.createElement(
                  _reactBootstrap.InputGroup,
                  { bsSize: 'small' },
                  _react2.default.createElement(_reactBootstrap.FormControl, { type: 'text',
                    bsStyle: inputValid ? 'success' : 'error',
                    value: this.state.value,
                    onChange: this.handleChange }),
                  _react2.default.createElement(
                    _reactBootstrap.InputGroup.Button,
                    null,
                    submitBtn
                  )
                )
              )
            )
          )
        )
      )
    );
  }
}, _class4.propTypes = {
  minFreeSlots: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.number]),
  type: _propTypes2.default.string,
  enable: _propTypes2.default.bool
}, _temp5));

const ShortcutConfig = (0, _reactRedux.connect)(() => {
  return (state, props) => ({
    value: (0, _lodash.get)(state.config, props.configName, props.defaultVal),
    configName: props.configName
  });
})((_temp6 = _class5 = class shortcutConfig extends _react.Component {
  constructor(props) {
    super(props);

    this.displayText = () => {
      if (this.recording()) {
        return __('Press the key, or Esc to cancel');
      } else if (this.enabled()) {
        return `<${this.props.value}>`;
      } else {
        return __('Disabled');
      }
    };

    this.active = () => typeof this.props.active === "undefined" ? true : this.props.active;

    this.showDisableButton = () => this.active() && this.enabled() && !this.recording();

    this.recording = () => this.state.recording;

    this.enabled = () => !!this.props.value;

    this.handleClickAnywhere = e => {
      document.removeEventListener('mousedown', this.handleClickAnywhere);
      this.abortRecording();
    };

    this.keyShouldIgnore = (character, modifiers) => {
      if (character.length === 0) {
        return true;
      }
      if (character.charCodeAt(0) < 32) {
        return true;
      }
      return false;
    };

    this.handleClickRecord = e => {
      keyListener = (character, modifiers, e) => {
        if (this.keyShouldIgnore(character, modifiers)) {
          return;
        }
        keyListener = null;
        if (character === 'esc' && modifiers.length === 0) {
          this.abortRecording();
        } else {
          this.setKey(character, modifiers);
        }
      };
      document.addEventListener('mousedown', this.handleClickAnywhere);
      this.setState({ recording: true });
    };

    this.handleDisable = () => {
      this.setState({
        myval: null,
        recording: false
      });
      this.newVal('');
    };

    this.abortRecording = () => {
      this.setState({ recording: false });
    };

    this.transformKeyStr = (character, modifiers) => {
      const mapping = {
        shift: 'Shift',
        alt: 'Alt',
        ctrl: 'Ctrl',
        meta: 'ctrl' in modifiers ? 'Cmd' : 'CmdOrCtrl',
        Del: 'Delete',
        Ins: 'Insert'
      };
      const str_modifiers = (() => {
        const results = [];
        for (let i = 0; i < modifiers.length; i++) {
          results.push(mapping[modifiers[i]]);
        }
        return results;
      })();
      character = character[0].toUpperCase() + character.substr(1);
      const s = str_modifiers.concat([mapping[character] || character]).join('+');
      return s;
    };

    this.setKey = (character, modifiers) => {
      const s = this.transformKeyStr(character, modifiers);
      this.setState({
        recording: false
      });
      this.newVal(s);
    };

    this.newVal = val => {
      config.set(this.props.configName, val);
    };

    this.state = {
      recording: false
    };
  }

  render() {
    return _react2.default.createElement(
      'div',
      null,
      _react2.default.createElement(
        _reactBootstrap.Col,
        { xs: 12 },
        _react2.default.createElement(
          _reactBootstrap.ButtonGroup,
          { justified: true },
          _react2.default.createElement(
            _reactBootstrap.Button,
            {
              active: false,
              bsStyle: 'link',
              style: { width: '25%', align: 'left', cursor: 'default' } },
            this.props.label
          ),
          _react2.default.createElement(
            _reactBootstrap.Button,
            {
              active: this.active(),
              disabled: !this.active() || this.recording(),
              bsStyle: !this.active() ? 'default' : this.enabled() ? "success" : "danger",
              onClick: this.recording() || (!this.active() ? null : this.handleClickRecord),
              style: { width: '60%' } },
            this.displayText()
          ),
          this.showDisableButton() ? _react2.default.createElement(
            _reactBootstrap.Button,
            { bsStyle: 'danger',
              onMouseDown: this.handleDisable,
              style: { width: '15%' } },
            _react2.default.createElement('i', { className: 'fa fa-times' })
          ) : null
        )
      )
    );
  }
}, _class5.propTypes = {
  value: _propTypes2.default.string,
  active: _propTypes2.default.bool,
  configName: _propTypes2.default.string,
  label: _propTypes2.default.string
}, _temp6));

_mousetrap2.default.prototype.handleKey = (character, modifiers, e) => {
  if (e.type !== 'keydown' || ['shift', 'alt', 'ctrl', 'meta'].includes(character)) {
    return;
  }
  const fn = keyListener;
  if (typeof fn === 'function') {
    fn(character, modifiers, e);
  }
};

class PoiConfig extends _react.Component {
  render() {
    return _react2.default.createElement(
      'div',
      null,
      _react2.default.createElement(
        'div',
        { className: 'form-group', id: 'navigator-bar' },
        _react2.default.createElement(_divider2.default, { text: __('Browser') }),
        _react2.default.createElement(_navigatorBar2.default, null)
      ),
      _react2.default.createElement(
        'div',
        { className: 'form-group' },
        _react2.default.createElement(_divider2.default, { text: __('Notification') }),
        _react2.default.createElement(SetNotifyIndividualConfig, null)
      ),
      _react2.default.createElement(
        'div',
        { className: 'form-group' },
        _react2.default.createElement(_divider2.default, { text: __('Slot Check') }),
        _react2.default.createElement(SlotCheckConfig, { type: 'ship' }),
        _react2.default.createElement(SlotCheckConfig, { type: 'item' })
      ),
      _react2.default.createElement(
        'div',
        { className: 'form-group' },
        _react2.default.createElement(_divider2.default, { text: __('Cache and cookies') }),
        _react2.default.createElement(ClearCacheCookieConfig, null)
      ),
      _react2.default.createElement(
        'div',
        { className: 'form-group' },
        _react2.default.createElement(_divider2.default, { text: __('Language') }),
        _react2.default.createElement(SelectLanguageConfig, null)
      ),
      _react2.default.createElement(
        'div',
        { className: 'form-group' },
        _react2.default.createElement(_divider2.default, { text: __('Screenshot Format') }),
        _react2.default.createElement(_utils.RadioConfig, {
          label: __('Screenshot Format'),
          configName: 'poi.screenshotFormat',
          defaultVal: 'png',
          availableVal: [{ name: 'PNG', value: 'png' }, { name: 'JPEG', value: 'jpg' }] })
      ),
      _react2.default.createElement(
        'div',
        { className: 'form-group' },
        _react2.default.createElement(_divider2.default, { text: __('Screenshot Folder') }),
        _react2.default.createElement(_utils.FolderPickerConfig, {
          label: __('Screenshot Folder'),
          configName: 'poi.screenshotPath',
          defaultVal: window.screenshotPath })
      ),
      _react2.default.createElement(
        'div',
        { className: 'form-group' },
        _react2.default.createElement(_divider2.default, { text: __('Cache Folder') }),
        _react2.default.createElement(_utils.FolderPickerConfig, {
          label: __('Cache Folder'),
          configName: 'poi.cachePath',
          defaultVal: _electron.remote.getGlobal('DEFAULT_CACHE_PATH') })
      ),
      _react2.default.createElement(
        'div',
        { className: 'form-group' },
        _react2.default.createElement(_divider2.default, { text: __('Other settings') }),
        _react2.default.createElement(
          _reactBootstrap.Grid,
          null,
          _react2.default.createElement(
            _reactBootstrap.Col,
            { xs: 12 },
            process.platform !== 'darwin' ? _react2.default.createElement(ShortcutConfig, {
              label: __('Boss key'),
              configName: 'poi.shortcut.bosskey' }) : _react2.default.createElement(ShortcutConfig, {
              label: __('Boss key'),
              defaultVal: 'Cmd+H',
              active: false }),
            process.platform !== 'darwin' ? _react2.default.createElement(_utils.CheckboxLabelConfig, {
              label: __('Confirm before exit'),
              configName: 'poi.confirm.quit',
              defaultVal: false }) : _react2.default.createElement(
              _reactBootstrap.OverlayTrigger,
              { placement: 'top',
                overlay: _react2.default.createElement(
                  _reactBootstrap.Tooltip,
                  { id: 'tooltip-confirm-before-exit' },
                  __('Set this in the OS X App Menu')
                ) },
              _react2.default.createElement(
                'div',
                null,
                _react2.default.createElement(_utils.CheckboxLabelConfig, {
                  label: __('Confirm before exit'),
                  undecided: true })
              )
            ),
            _react2.default.createElement(_utils.CheckboxLabelConfig, {
              label: __('Display \"Tips\"'),
              configName: 'poi.doyouknow.enabled',
              defaultVal: true }),
            _react2.default.createElement(_utils.CheckboxLabelConfig, {
              label: __('Display Final Stage Notification'),
              configName: 'poi.lastbattle.enabled',
              defaultVal: true })
          )
        )
      ),
      _react2.default.createElement(
        'div',
        { className: 'form-group' },
        _react2.default.createElement(_divider2.default, { text: __('Advanced functionalities') }),
        _react2.default.createElement(
          _reactBootstrap.Grid,
          null,
          _react2.default.createElement(
            _reactBootstrap.Col,
            { xs: 12 },
            _react2.default.createElement(_utils.CheckboxLabelConfig, {
              label: __('Disable Hardware Acceleration'),
              configName: 'poi.disableHA',
              defaultVal: false }),
            _react2.default.createElement(_utils.CheckboxLabelConfig, {
              label: __('Editing DMM Cookie\'s Region Flag'),
              configName: 'poi.enableDMMcookie',
              defaultVal: false }),
            _react2.default.createElement(_utils.CheckboxLabelConfig, {
              label: __('Prevent DMM Network Change Popup'),
              configName: 'poi.disableNetworkAlert',
              defaultVal: false }),
            _react2.default.createElement(_utils.CheckboxLabelConfig, {
              label: __('Show network status in notification bar'),
              configName: 'poi.showNetworkLog',
              defaultVal: true }),
            process.platform === 'win32' ? _react2.default.createElement(_utils.CheckboxLabelConfig, {
              label: __('Create shortcut on startup (Notification may not be working without shortcut)'),
              configName: 'poi.createShortcut',
              defaultVal: true }) : null,
            process.platform === 'linux' ? _react2.default.createElement(_utils.CheckboxLabelConfig, {
              label: __('Display tray icon'),
              configName: 'poi.linuxTrayIcon',
              defaultVal: true }) : null,
            _react2.default.createElement(_utils.CheckboxLabelConfig, {
              label: __('Enter safe mode on next startup'),
              configName: 'poi.enterSafeMode',
              defaultVal: false }),
            _react2.default.createElement(_utils.CheckboxLabelConfig, {
              label: __('Send data to Google Analytics'),
              configName: 'poi.sendAnalytics',
              defaultVal: true })
          )
        )
      )
    );
  }
}

exports.default = PoiConfig;
module.exports = exports['default'];