'use strict'
!(function(require, directRequire) {
  const a = require('react'),
    b = require('./fc137838572a83604db39acff8e909e0.js'),
    c = require('./1fcc6bd55b687d154a4247e57fe3011d.js'),
    d = require('./eadce02c750c875a10680bcfedadec88.js'),
    e = require('redux'),
    f = require('./d3976cc01aeebc5b09e11c4135b6bd8d.js'),
    g = require('./875171e7b864aa58d026d4fa0999fbd1.js'),
    h = require('./97bb45d1f540ee20771bd8470a70e195.js'),
    { connect: i } = require('react-redux')
  class j extends a.Component {
    constructor(a) {
      super(a), (this.state = { show: a.show, left: 0, top: 0 })
    }
    componentWillReceiveProps(a) {
      a.show != this.props.show && this.setState({ show: a.show })
    }
    onShowClick(a) {
      a.stopPropagation()
      const b = a.currentTarget.getBoundingClientRect()
      this.setState({ left: b.left, top: b.top + b.height }),
        this.props.onShowClick()
    }
    onSelectClick(a, b) {
      b.stopPropagation(), this.props.onSelectClick(a)
    }
    render() {
      let b = this.props,
        c = b.show ? 'ui-icon-arrow-up-o' : 'ui-icon-arrow-down-o'
      return a.createElement(
        'div',
        {
          className: 'simulator-toolbar-item',
          id: 'simulator-toolbar-device',
          onClick: this.onShowClick.bind(this)
        },
        a.createElement('p', null, b.currentWording),
        a.createElement('i', { className: c }),
        a.createElement(h, {
          show: b.show,
          left: this.state.left,
          top: this.state.top
        })
      )
    }
  }
  module.exports = i(
    a => {
      let b = a.toolbar.device
      return {
        show: a.toolbar.clickKey == d.DEVICE,
        list: b.list,
        currentWording: b.list[b.current].name,
        current: b.current,
        left: 0,
        top: 27
      }
    },
    a => {
      return {
        onShowClick: f.bindActionCreators(b.toggleDeviceToolbar, a),
        onSelectClick: f.bindActionCreators(b.selectDevice, a),
        removeDevice: f.bindActionCreators(b.removeDevice, a),
        setAddDevicePopUp: f.bindActionCreators(c.setAddDevicePopUp, a)
      }
    }
  )(j)
})(require('lazyload'), require)
