'use strict'
var _extends =
  Object.assign ||
  function(a) {
    for (var b, c = 1; c < arguments.length; c++)
      for (var d in ((b = arguments[c]), b))
        Object.prototype.hasOwnProperty.call(b, d) && (a[d] = b[d])
    return a
  }
!(function(require, directRequire) {
  const a = require('path'),
    b = require('./1dea83a77e99a7c94f6b6f01f5c175b0.js'),
    c = require('./6242f55dbdfe53c2f07b7a51568311f2.js'),
    d = require('./37be435102276ea9cf47609ff6535cd4.js'),
    e = require('./bc78839ccca8df9e5ceeb7fae11b7be2.js'),
    f = require('./cc2c2970ff81ae4a83123e81ee123da2.js'),
    g = require('./3bfffbe88b3d923921f851c0697974fe.js')
  var h = { USER_DATA_PATH: d.USER_DATA_PATH }
  module.exports = async function(d) {
    let i = await b(d),
      j = (d.attr && d.attr.setting) || {}
    j = _extends({}, c.setting, j)
    let k = _extends({}, i, {
      wxAppInfo: {
        maxRequestConcurrent: j.MaxRequestConcurrent,
        maxUploadConcurrent: j.MaxUploadConcurrent,
        maxDownloadConcurrent: j.MaxDownloadConcurrent,
        maxWorkerConcurrent: j.MaxWorkerConcurrent
      }
    })
    if (k.subPackages) {
      let b = []
      k.subPackages.forEach(c => {
        b = b.concat(
          c.pages.map(b => {
            return a.posix.join(c.root, b)
          })
        )
      }),
        (k.pages = k.pages.concat(b))
    }
    if (k.plugins) {
      let a,
        b = !1,
        c = !1
      if (d.pluginInfo) {
        const a = {}
        for (const b in k.plugins)
          a[k.plugins[b].provider] = k.plugins[b].version
        for (const e of d.pluginInfo) {
          if (!e || !e.current || !e.current.innerVersion) {
            b = !0
            break
          }
          if (e.current.version !== a[e.appid]) {
            c = !0
            break
          }
        }
      } else b = !0
      if (b || c)
        try {
          const b = await g.getLatestPluginInfo()
          ;(a = b.map(a => {
            return { plugin_id: a.appid, inner_version: a.current.innerVersion }
          })),
            setTimeout(() => {
              e.dispatch(f.setPluginInfo(b))
            })
        } catch (a) {}
      else
        a = d.pluginInfo.map(a => {
          return { plugin_id: a.appid, inner_version: a.current.innerVersion }
        })
      for (const b in k.plugins)
        k.plugins[b] &&
          'dev' === k.plugins[b].version &&
          (a || (a = []),
          a.push({ plugin_id: k.plugins[b].provider, inner_version: 0 }))
      k.appContactInfo = { call_plugin_info: a }
    }
    const l = e.getState()
    let m = l.simulator.appLaunchInfo || {
      path: k.pages[0],
      scene: c.SCENE_DEFAULT,
      query: {}
    }
    return (
      (k = _extends({}, k, { platform: 'devtools', appLaunchInfo: m, env: h })),
      k
    )
  }
})(require('lazyload'), require)
