'use strict'
!(function(require, directRequire) {
  const a = require('react'),
    b = require('./3b5f8e2469c474c8d433c1c6926d8999.js'),
    c = require('classnames')
  class d extends a.Component {
    constructor(a) {
      super(a),
        (this.state = { lazyLoaded: !1, show: !1, animationType: 'none' })
    }
    componentDidMount() {
      this.props.show && this.setState({ show: !0, animationType: 'show' })
    }
    componentWillReceiveProps(a) {
      if (a.show != this.props.show) {
        let b = { lazyLoaded: !0, animationType: a.show ? 'show' : 'hide' }
        a.show && (b.show = !0), this.setState(b)
      }
      !this.props.show && a.show
        ? this.setState({ show: !0, animationType: 'show' })
        : this.props.show && !a.show && this.setState({ animationType: 'hide' })
    }
    handleCancelClick() {
      'function' == typeof this.props.onCancel && this.props.onCancel()
    }
    handleItemClick(a) {
      'function' == typeof this.props.onSelect && this.props.onSelect(a)
    }
    onMaskClick() {
      'function' == typeof this.props.onMaskClick && this.props.onMaskClick()
    }
    render() {
      if (!this.state.lazyLoaded) return null
      const d = this.props,
        e = this.state
      let f = d.itemList.map((b, c) => {
        let e = d.itemColor
        return (
          c == d.alertIndex && (e = '#ff0000'),
          a.createElement(
            'div',
            {
              className: 'weui-actionsheet__cell',
              key: c,
              style: { color: e },
              onClick: this.handleItemClick.bind(this, c)
            },
            b
          )
        )
      })
      let g = {},
        h = { 'ui-dark': 'dark' == d.style, 'ui-landscape': d.landscape }
      return (
        d.landscape
          ? ((g.width = 310),
            (h['ui-animate-swipeInLeft'] = 'show' === this.state.animationType),
            (h['ui-animate-swipeOutRight'] =
              'hide' === this.state.animationType))
          : ((h['ui-animate-swipeInUp'] = 'show' === this.state.animationType),
            (h['ui-animate-swipeInDown'] =
              'hide' === this.state.animationType)),
        a.createElement(
          'div',
          { style: this.state.show ? {} : b.displayNone },
          a.createElement('div', {
            className: c('weui-mask', {
              'ui-animate-fadeIn': 'show' === this.state.animationType,
              'ui-animate-fadeOut': 'hide' === this.state.animationType,
              'ui-dark': 'dark' == d.style
            }),
            onAnimationEnd: () => {
              'hide' === this.state.animationType && this.setState({ show: !1 })
            },
            onClick: this.onMaskClick.bind(this)
          }),
          d.landscape
            ? a.createElement('div', {
                className: c('weui-actionsheet-container', {
                  'ui-animate-swipeInLeft': 'show' === this.state.animationType,
                  'ui-animate-swipeOutRight':
                    'hide' === this.state.animationType,
                  'ui-dark': 'dark' == d.style
                })
              })
            : null,
          a.createElement(
            'div',
            { className: c('weui-actionsheet', h), style: g },
            a.createElement('div', { className: 'weui-actionsheet__menu' }, f),
            a.createElement(
              'div',
              { className: 'weui-actionsheet__action' },
              a.createElement(
                'div',
                {
                  className: 'weui-actionsheet__cell',
                  onClick: this.handleCancelClick.bind(this),
                  style: { color: d.cancelColor }
                },
                d.cancelText
              )
            )
          )
        )
      )
    }
  }
  module.exports = d
})(require('lazyload'), require)
