'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) {
  function a() {
    j = void 0
  }
  function b(b, c) {
    let d = e.extname(c)
    '.json' === d && a()
  }
  async function c(c) {
    let d = await h(c)
    ;(k && k.srcPath == d.srcPath) ||
      (a(), k && k.unWatch(b), (k = d), k.watch(b)),
      l != c.compileType && (a(), (l = c.compileType))
  }
  async function d(a) {
    let b = await f(a),
      c = {},
      d = b.pages || []
    ;(c.subPackages = b.subPackages),
      (c.pages = d),
      (c.entryPagePath = b.entryPagePath
        ? `${b.entryPagePath}.html`
        : `${d[0]}.html`),
      (c.debug = b.debug || !1),
      (c.networkTimeout = Object.assign(
        {
          request: 6e4,
          uploadFile: 6e4,
          connectSocket: 6e4,
          downloadFile: 6e4
        },
        b.networkTimeout
      )),
      (c.widgets = b.widgets || []),
      (c.global = { window: b.window || {} }),
      (c.customClose = !!b.customClose),
      (c.ext = b.ext || {}),
      (c.extAppid = b.extAppid || ''),
      (c.page = {}),
      (c.plugins = b.plugins || {})
    for (var h = 0; h < d.length; h++) {
      var i = d[h],
        k = {}
      ;(k = await g(a, `${i}`)), (c.page[`${i}.html`] = { window: k })
    }
    if (c.subPackages) {
      let b = {}
      for (var h = 0; h < c.subPackages.length; h++) {
        let d = c.subPackages[h]
        for (var l = 0; l < d.pages.length; l++) {
          var i = e.posix.join(d.root, d.pages[l]),
            k = {}
          ;(k = await g(a, `${i}`)), (c.page[`${i}.html`] = { window: k })
        }
        b = _extends({}, b, d.plugins)
      }
      c.plugins = _extends({}, c.plugins, b)
    }
    if (
      (0 == Object.keys(c.plugins).length && delete c.plugins,
      '[object Object]' == Object.prototype.toString.call(b.tabBar))
    ) {
      for (
        var j,
          m = Object.assign({}, b.tabBar),
          n = [].concat(m.list || []),
          o = [],
          h = 0;
        h < n.length;
        h++
      )
        (j = Object.assign({}, n[h])), (j.pagePath += '.html'), o.push(j)
      ;(m.list = o), (c.tabBar = m)
    }
    return c
  }
  const e = require('path'),
    f = require('./8267de7f4ec7b70a147f3fa5ef2bdea4.js'),
    g = require('./d260ebf687a29f24aed49f66b233ab7d.js'),
    h = require('./162bf2ee28b76d3b3d95b685cede4146.js'),
    i = require('./8a145c66a3f53e0aff94a871ac692d06.js')
  var j, k, l
  module.exports = async function(a) {
    if (a.isOnline) {
      let b = await i(a)
      return JSON.parse(b['/app-config.json'])
    }
    return await c(a), j || (j = await d(a)), j
  }
})(require('lazyload'), require)
