'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('fs'),
    b = require('path'),
    c = require('./common/locales/index.js'),
    d = require('./9fdd4ac31a05c27355910f0d74accd4c.js'),
    f = {},
    e = a =>
      Object.prototype.toString
        .call(a)
        .toLowerCase()
        .slice(8, -1)
  ;(f.configFileExists = c => {
    if (!c) return { error: new Error('project not valid') }
    const d = { error: null },
      e = b.join(c.projectpath, 'project.config.json')
    try {
      const b = a.existsSync(e)
      d.exists = b
    } catch (a) {
      d.error = a
    }
    return d
  }),
    (f.getConfigFileInfo = c => {
      if (!c) return { error: new Error('project not valid') }
      const d = { error: null },
        g = b.join(c.projectpath, 'project.config.json')
      try {
        let b, h, i
        try {
          h = a.readFileSync(g)
        } catch (a) {
          b = a
          let d = f.configFileExists(c)
          throw ((b.type = d.error || d.exists ? 'readerror' : 'notexists'), a)
        }
        try {
          i = JSON.parse(h)
        } catch (a) {
          throw ((b = a), (a.type = 'parseerror'), a)
        }
        if ('object' !== e(i))
          throw ((b = new Error('config is not an object')),
          (b.type = 'parseerror'),
          b)
        ;(d.raw = h),
          (i.condiction = i.condition),
          delete i.condition,
          (d.config = i),
          'miniprogram' == d.config.compileType &&
            (d.config.compileType = 'weapp'),
          d.config.condiction &&
            d.config.condiction.miniprogram &&
            ((d.config.condiction.weapp = d.config.condiction.miniprogram),
            delete d.config.condiction.miniprogram),
          (d.config.setting && !1 === d.config.setting.newFeature) ||
            (d.config.setting = _extends({}, d.config.setting, {
              newFeature: !0
            }))
      } catch (a) {
        d.error = a
      }
      return d
    }),
    (f.writeObjectToConfigFile = (c, d) => {
      if (!c) return { error: new Error('project not valid') }
      if ('object' !== e(d))
        return { error: new Error('content is not an object') }
      const f = { error: null },
        g = b.join(c.projectpath, 'project.config.json')
      try {
        ;(d = _extends({}, d)),
          (d.condition = _extends({}, d.condiction)),
          delete d.condiction,
          'weapp' == d.compileType && (d.compileType = 'miniprogram'),
          d.condition &&
            d.condition.weapp &&
            ((d.condition.miniprogram = d.condition.weapp),
            delete d.condition.weapp),
          c.isGameTourist &&
            ((d.isGameTourist = !0), (d.appid = 'touristappid'))
        const b = JSON.stringify(d, null, '\t')
        a.writeFileSync(g, b)
      } catch (a) {
        ;(a.type = 'writeerror'), (f.error = a)
      }
      return f
    }),
    (f.generateConfigTemplate = () => {
      return {
        description: '\u9879\u76EE\u914D\u7F6E\u6587\u4EF6\u3002',
        packOptions: { ignore: [] }
      }
    }),
    (module.exports = f)
})(require('lazyload'), require)
