'use strict'
!(function(require, directRequire) {
  const a = require('systeminformation'),
    b = require('./84858de8a097c9cf84ff2c2e3d86e2a9.js'),
    c = require('./c016c015550b8c8e4a79e8e85062bd17.js'),
    d = require('./76d9df7b0b3e47fbe17881420a4bef86.js'),
    e = require('./0634ee2ebd3e560d9d4804ecc960160f.js'),
    f = require('./dca9191eced65b3831d60c02d8d487c2.js'),
    g = require('./ba23d8b47b1f4ea08b9fd49939b9443f.js'),
    h = require('./a8c87029da0fa06e986298d447ab0fe2.js'),
    i = require('./cc2c2970ff81ae4a83123e81ee123da2.js'),
    j = require('./tools.js'),
    k = require('./56c390e04c10e91a4aa2a2c19d9a885d.js'),
    l = require('./205e69607c4b60711b15f5ac95b40ce4.js'),
    m = require('./bc78839ccca8df9e5ceeb7fae11b7be2.js'),
    n = m.dispatch.bind(m)
  module.exports = {
    [c.Name.QUIT]: async () => {
      return (
        setTimeout(() => {
          j.quit()
        }),
        { status: d.Success }
      )
    },
    [c.Name.CLOSE]: async () => {
      return m.dispatch(i.closeProject()), { status: d.Success }
    },
    [c.Name.COMPILE]: async () => {
      return m.dispatch(g.compileImmediate()), { status: d.Success }
    },
    [c.Name.WEIXINJSBRIDGE_INVOKE]: async (a, b) => {
      let c = a.getParameter('api'),
        e = `${Math.random()}${Date.now()}`
      return new Promise(a => {
        n(f.exec({ api: c, callbackID: e, args: b.parameters })),
          m.subscribe(() => {
            let b = m.getState(),
              c = b.simulator.assdkCallbackInfo
            c.callbackID == e && a({ status: d.Success, value: c.res })
          })
      })
    },
    [c.Name.GET_WECHATDEVTOOLS_STORE_STATE]: async () => {
      const a = m.getState()
      return { status: d.Success, value: a }
    },
    [c.Name.REFRESH_TICKET]: async (a, c) => {
      const f = {
        city: 'Guangzhou',
        contry: 'CN',
        headUrl:
          'http://wx.qlogo.cn/mmhead/PiajxSqBRaEJU1TapG4Amk5WtRy7mD4NrNU5ibZ15ITVw004CxHGjsCw/132',
        newticket: c.ticket,
        nickName: 'Can\uD83C\uDF34',
        openid: 'o6zAJswvMl4_S2x88N5vmH5NwMEk',
        province: 'Guangdong',
        sex: 'male',
        signature: 'JGe3uQ1dylqLXtPSQWk_kwEofTpraqi9CPxGvdRHtF0',
        signatureExpiredTime: Date.now() + 86400000,
        ticketExpiredTime: Date.now() + 86400000
      }
      return (
        (b.userInfo = f),
        n({ type: e.USER_LOGIN_SUCCESS, userInfo: f }),
        n(h.setMainWindow(k.MAIN_WINDOW_TYPE.ENTRANCE)),
        { status: d.Success }
      )
    },
    [c.Name.GET_APP_CACHE_STATUS]: async () => {
      return { status: d.Success }
    },
    [c.Name.GET_RUNTIME_INFO]: async () => {
      return new Promise(b => {
        chrome.processes.getProcessInfo([], !0, async c => {
          const d = {}
          let e = 0
          for (let a in c) {
            let b = c[a]
            b.privateMemory && ((e += b.privateMemory), (d[b.osProcessId] = !0))
          }
          e = e / 1024 / 1024
          const f = await a.processes(),
            g = f.list
              .filter(a => d[a.pid])
              .map(a => a.pcpu)
              .reduce((a, b) => a + b, 0)
          b({ status: 0, value: { cpu: g, memory: e } })
        })
      })
    }
  }
})(require('lazyload'), require)
