'use strict'
!(function(require, directRequire) {
  const a = require('react')
  module.exports = class extends a.Component {
    constructor(a) {
      if ((super(a), !this.props.items))
        throw new TypeError(
          'Dropdown component: attribute "items" must be provided'
        )
      this.state = {}
    }
    getDropdownStyle() {
      return this.props.getDropdownStyle ? this.props.getDropdownStyle() : {}
    }
    getItemStyle(a) {
      return this.props.getItemStyle ? this.props.getItemStyle(a) : {}
    }
    onItemSelected(a, b) {
      this.props.onItemSelected && this.props.onItemSelected(a, b)
    }
    onCancel() {
      this.props.onCancel && this.props.onCancel()
    }
    render() {
      let b = []
      for (let c = 0, d = this.props.items.length; c < d; c++) {
        let d,
          e = this.getItemStyle(c),
          f = c,
          g = this.props.items[c]
        ;(d = a.createElement(
          'div',
          {
            className: 'ui-dropdown-item',
            style: e,
            key: c,
            onClick: this.onItemSelected.bind(this, f, g)
          },
          g
        )),
          b.push(d)
      }
      let c = this.props.open ? this.getDropdownStyle() : { display: 'none' },
        d = { WebkitAppRegion: 'no-drag' }
      return (
        this.props.open &&
          ['left', 'top'].forEach(a => {
            this.props.hasOwnProperty(a) && (d[a] = this.props[a])
          }),
        this.props.open &&
          ['width', 'height'].forEach(a => {
            this.props.hasOwnProperty(a) && (c[a] = this.props[a])
          }),
        a.createElement(
          'div',
          { className: 'ui-popover', style: d },
          a.createElement('div', { className: 'ui-dropdown', style: c }, b)
        )
      )
    }
  }
})(require('lazyload'), require)
