'use strict'
!(function(require, directRequire) {
  const a = require('react'),
    b = require('./3b5f8e2469c474c8d433c1c6926d8999.js')
  class c extends a.Component {
    constructor(a) {
      super(a)
    }
    componentDidMount() {
      this.initWebview()
    }
    componentWillUnmount() {
      this.webview && this.webview.remove()
    }
    initWebview() {
      if (!this.webview) {
        let a = (this.webview = document.createElement('webview'))
        ;(a.className = `simulator-bd-webview_body webviewbody`),
          a.setAttribute('partition', 'persist:simulator'),
          a.setAttribute(
            'style',
            `position:absolute;height:${this.props.height}px;width:${
              this.props.width
            }px`
          ),
          this.initEvent(this.webview),
          (a.src = this.props.src),
          this.refs.container.appendChild(a)
      }
    }
    initEvent(a) {
      a.addEventListener('dialog', a => {
        let b = a.messageType || '',
          c = a.messageText,
          d = a.dialog
        if ('alert' === b && 0 === c.indexOf('map handle:')) {
          let a = c.replace('map handle:', '')
          this.props.chooseLocation(JSON.parse(a))
        }
      }),
        a.addEventListener('permissionrequest', function(a) {
          'geolocation' === a.permission && a.request.allow()
        })
    }
    render() {
      return a.createElement('div', { ref: 'container' })
    }
  }
  module.exports = c
})(require('lazyload'), require)
