'use strict'
!(function(require, directRequire) {
  const a = require('react'),
    { Provider: b } = require('react-redux'),
    c = require('./bc78839ccca8df9e5ceeb7fae11b7be2.js'),
    d = require('./db2217eb4cff896bdcbc50abe005058f.js')
  module.exports = class extends a.Component {
    constructor(a) {
      super(a), (this._onMessage = this.onMessage.bind(this))
    }
    componentDidMount() {
      window.addEventListener('message', this._onMessage),
        this.openWindow(this.props.url)
    }
    componentDidUpdate(a) {
      a.url !== this.props.url &&
        this.child &&
        (this.child.window.location.href = a.url)
    }
    componentWillUnmount() {
      if (((this.unmounted = !0), this.child))
        try {
          this.closeWindow()
        } catch (a) {}
      window.removeEventListener('message', this._onMessage)
    }
    openWindow(a) {
      nw.Window.open(a, this.getWindowOptions(), a => {
        return this.unmounted
          ? void a.close(!0)
          : void ((this.registryId = this.props.registryId),
            (this.child = a),
            a.on('close', () => {
              this.props.onWindowClose && this.props.onWindowClose(a),
                this.closeWindow()
            }),
            a.on('new-win-policy', (a, b, c) => {
              console.log(a, b, c), c.forceCurrent()
            }),
            this.props.onWindowOpen && this.props.onWindowOpen(a),
            this.registryId && d.register({ id: this.registryId, window: a }))
      })
    }
    closeWindow() {
      this.child &&
        (this.registryId && d.unregister(this.registryId),
        this.child.close(!0),
        (this.child = null))
    }
    getWindowOptions() {
      return function(a) {
        const b = {}
        for (let c of a) this.props.hasOwnProperty(c) && (b[c] = this.props[c])
        return b
      }.bind(this)([
        'id',
        'title',
        'icon',
        'position',
        'always_on_top',
        'width',
        'height',
        'min_width',
        'min_height',
        'max_width',
        'max_height',
        'resizable',
        'kiosk',
        'fullscreen',
        'show_in_taskbar',
        'frame',
        'transparent'
      ])
    }
    onMessage(a) {
      this.props.onMessage && this.props.onMessage(a)
    }
    render() {
      return a.createElement('div', { style: { display: 'none' } })
    }
  }
})(require('lazyload'), require)
