'use strict'
!(function(require, directRequire) {
  const a = require('path'),
    b = require('./949d8235c744ced2a80121e4dba34c28.js'),
    c = require('./common/locales/index.js'),
    d = require('./162bf2ee28b76d3b3d95b685cede4146.js'),
    e = require('./tools.js'),
    f = require('./6238a86bb7a55c11aa0f9eb335d0f34c.js')
  module.exports = async function(a, g = {}) {
    if (!a.attr || !a.attr.platform) return
    let h,
      i,
      j = 'ext.json',
      k = await d(a)
    try {
      h = k.getFile(j)
    } catch (a) {
      return
    }
    try {
      i = JSON.parse(h)
    } catch (a) {
      let c = f.parseJsonParseErr({ data: h, error: a }),
        d = new Error(c)
      throw ((d.code = b.EXT_JSON_PARSE_ERR), d)
    }
    if (!i.extEnable) return {}
    let l = i.extPages || {},
      m = {}
    for (let d in l) {
      if (m[d]) {
        let a = new Error(c.config.JSON_PAGES_REPEAT.format([j, d]))
        throw ((a.code = b.EXT_JSON_PAGES_ERR), a)
      }
      m[d] = !0
    }
    let n = [],
      o = {}
    if (
      ([
        { key: 'extAppid', type: 'string' },
        { key: 'ext', type: 'object' },
        { key: 'extPages', type: 'object' },
        { key: 'window', type: 'object' },
        { key: 'tabBar', type: 'object' },
        { key: 'networkTimeout', type: 'object' }
      ].forEach(a => {
        let b = i[a.key]
        b &&
          (e.getType(b) == a.type
            ? (o[a.key] = b)
            : n.push(c.config.EXT_JSON_CONTENT_ERR.format([a.key, a.type])))
      }),
      0 < n.length)
    ) {
      let a = new Error(n.join('\n'))
      throw ((a.code = b.EXT_JSON_CONTENT_ERR), a)
    }
    return i
  }
})(require('lazyload'), require)
