'use strict'
!(function(require, directRequire) {
  function a(a) {
    const { data: b } = a
    switch (b.type) {
      case c.EVENT_HEARTBEAT: {
        b.id === g && f.postMessage({ type: c.EVENT_HEARTBEAT, id: g })
        break
      }
      case c.COMMAND_DEV_WINDOW_CLOSE: {
        ;`${global.devInfo.appid}_${global.devInfo.projectname}` === b.id &&
          d.dispatch(e.closeProject())
        break
      }
      case c.EVENT_SVR_WINDOW_CLI_PORT_UPDATE: {
        b[c.CLI_PORT] && h.set(c.CLI_PORT, b[c.CLI_PORT])
        break
      }
    }
  }
  const b = require('events'),
    c = require('./09060286633d09fb81fefc8ff1294dd7.js'),
    d = require('./bc78839ccca8df9e5ceeb7fae11b7be2.js'),
    e = require('./cc2c2970ff81ae4a83123e81ee123da2.js')
  let f,
    g = global.devInfo.id
  const h = new Map()
  module.exports = {
    init: () => {
      ;(f = new BroadcastChannel(c.BROADCAST_CHANNEL_NAME)),
        (f.onmessage = a),
        f.postMessage({
          type: c.EVENT_DEV_WINDOW_OPENED,
          id: g,
          projectid: global.devInfo.projectid
        })
    },
    serverWindowInfo: h,
    notifyCloseWindow: a => {
      f &&
        f.postMessage({
          type: c.EVENT_DEV_WINDOW_CLOSE,
          id: global.devInfo.id,
          projectid: global.devInfo.projectid,
          fromAction: a
        })
    },
    notifyCliPortUpdate: a => {
      f &&
        f.postMessage({
          type: c.EVENT_DEV_WINDOW_CLI_PORT_UPDATE,
          id: global.devInfo.id,
          projectid: global.devInfo.projectid,
          [c.CLI_PORT]: a
        })
    }
  }
})(require('lazyload'), require)
