'use strict'
!(function(require, directRequire) {
  async function a(a) {
    return new Promise(b => {
      d.existsSync(a) && b(),
        i(a, () => {
          b()
        })
    })
  }
  async function b(b, c) {
    const e = f.join(u, `${+new Date()}`),
      g = c.map(c => {
        return new Promise(async (g, h) => {
          const i = f.join(e, c),
            j = f.dirname(i)
          await a(j),
            d
              .createReadStream(f.join(b, c))
              .on('error', a => {
                h(a)
              })
              .pipe(d.createWriteStream(i))
              .on('close', () => {
                g()
              })
              .on('error', a => {
                h(a)
              })
        })
      })
    return await Promise.all(g), e
  }
  async function c(a) {
    let c, e
    ;(c = s.getCurrentConfig()), (e = s.getCurrent())
    let h = f.join(e.projectpath, 'doc')
    let i = await z('**/*.+(md|jpg|jpeg|png|icon|gif|svg|cer)', {
      nodir: !0,
      ignore: [
        '**/.git/**',
        '.git/**/*',
        '**/.svn/**',
        '.svn/**/*',
        '.DS_Store',
        '**/.DS_Store'
      ],
      nosort: !0,
      strict: !1,
      silent: !0,
      cwd: h,
      absolute: !1,
      mark: !0,
      dot: !0,
      nocase: !0
    })
    i = i.filter(a => {
      return /\.md$/i.test(a) && !/readme\.md/i.test(a) ? !1 : !0
    })
    let k = await b(h, i),
      m = f.join(u, `${+new Date()}.wx`),
      n = await o(k, m)
    d.unlink(k, () => {}), d.unlink(m, () => {})
    let p,
      q = n.data,
      r = n.pDestPath,
      t = encodeURIComponent(a.desc),
      v = encodeURIComponent(a.version),
      x = encodeURIComponent(a.uuid)
    p = `${l.uploadPluginDoc}?user-version=${v}&user-desc=${t}&gzip=1`
    let y = g.gzipSync(q)
    const A = 1 * new Date(),
      B = {
        url: `${p}&devplugin=${e.compileType == w.plugin ? 1 : 0}`,
        method: 'post',
        body: y,
        needToken: 1,
        needAppID: 1
      }
    let { body: C } = await j(B)
    1 * new Date()
    return C
  }
  const d = require('fs'),
    e = require('glob'),
    f = require('path'),
    g = require('zlib'),
    h = require('rmdir'),
    i = require('mkdir-p'),
    j = require('./15ba1827c7f6564a45df6bd44da3a977.js'),
    k = require('./92320c1386e6db6a6f2556736a9bc280.js'),
    l = require('./f171257bbcaef547a3cf27266ccb0db2.js'),
    m = require('./949d8235c744ced2a80121e4dba34c28.js'),
    n = require('./911222a6723da8db7ca8a8e3689591e1.js'),
    o = require('./e5fa35c3c8e81bc6466b4b8eb436113b.js'),
    p = require('./84858de8a097c9cf84ff2c2e3d86e2a9.js'),
    q = require('./1dea83a77e99a7c94f6b6f01f5c175b0.js'),
    r = require('./common/locales/index.js'),
    s = require('./3bfffbe88b3d923921f851c0697974fe.js'),
    t = require('./logger.js'),
    u = k.Weappdest,
    v = require('./da7c31daaf542cf1796023d8e344b98a.js'),
    w = require('./9fdd4ac31a05c27355910f0d74accd4c.js'),
    x = require('./1c8a8c710417d102ab574145dc51b4b0.js'),
    y = require('./a932aac82ac84fc9c6c92194bd88204e.js'),
    z = function(a, b) {
      return new Promise(c => {
        e(a, b, (a, b) => {
          a ? c([]) : c(b)
        })
      })
    }
  module.exports = async function(a) {
    return y.enqueueBuildTask(c.bind(null, a), y.buildType.uploadPluginDoc)
  }
})(require('lazyload'), require)
