'use strict'
!(function(require, directRequire) {
  const a = require('./bc78839ccca8df9e5ceeb7fae11b7be2.js'),
    b = require('./6ff091369f442a4678a2ed4a1f758495.js'),
    c = require('./15ba1827c7f6564a45df6bd44da3a977.js'),
    d = require('./f171257bbcaef547a3cf27266ccb0db2.js'),
    e = require('./2dfc6a3df6d6fc51266b293c8420e88b.js'),
    f = require('./56c390e04c10e91a4aa2a2c19d9a885d.js')
  module.exports = {
    getAppConfig: async function(b, c) {
      try {
        const b = a.getState().debug.customAnalysis.config
        return b
          ? (e.display({
              command: f.DISPLAY_INFO,
              type: f.DISPLAY_TYPES.CUSTOM_ANALYSIS_GET_APP_CONFIG,
              data: { config: b }
            }),
            { errMsg: `${c.api}:ok`, data: b })
          : { errMsg: `${c.api}:fail` }
      } catch (a) {
        return { errMsg: `${c.api}:fail` }
      }
    },
    reportRealtimeAction: async function(b, g) {
      const h = a.getState().debug.customAnalysis
      if (!h.isOpen)
        return { errMsg: `${g.api}:fail custom analysis isn't active` }
      const i = g.args.actionData,
        j = h.config
      return i
        ? j
          ? (c({
              url: d.IDKeyBatchReport,
              needToken: 1,
              needAppID: 1,
              method: 'post',
              body: JSON.stringify({
                RecordList: [
                  {
                    type: 2,
                    appid: a.getState().project.current.appid,
                    time: Math.round(new Date().getTime() / 1e3),
                    ext: i,
                    appstate: 2
                  }
                ]
              })
            })
              .then(a => {
                try {
                  const b = JSON.parse(a.resp.body)
                  0 === b.BaseResponse.Ret
                    ? (e.display({
                        command: f.DISPLAY_INFO,
                        type: f.DISPLAY_TYPES.CUSTOM_ANALYSIS_REPORT,
                        data: { actionData: i, config: j }
                      }),
                      console.info(
                        `reportRealtimeAction successfully reported`
                      ))
                    : console.info(`reportRealtimeAction fail with error: ${b}`)
                } catch (a) {
                  console.info(
                    `reportRealtimeAction fail with error: ${a.toString()}`
                  )
                }
              })
              .catch(a => {
                console.info(
                  `reportRealtimeAction fail with error: ${a.toString()}`
                )
              }),
            { errMsg: `${g.api}:ok` })
          : { errMsg: `${g.api}:fail` }
        : { errMsg: `${g.api}:fail actionData must be provided` }
    },
    reportIDKey: async function(a, b) {
      return { errMsg: `${b.api}:ok` }
    },
    reportKeyValue: async function(a, b) {
      return { errMsg: `${b.api}:ok` }
    }
  }
})(require('lazyload'), require)
