'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var _regeneratorRuntime = require('@babel/runtime/regenerator');
var tslib_es6 = require('../../tslib.es6-0d92ef81.js');
var pixui_env = require('../env.js');
var pixui_gamelet = require('../gamelet.js');
var pixui_aegis_init = require('./init.js');
require('@babel/runtime/helpers/classCallCheck');
require('@babel/runtime/helpers/createClass');
require('./core.js');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var _regeneratorRuntime__default = /*#__PURE__*/_interopDefaultLegacy(_regeneratorRuntime);

function reportCoreInfoInPixUI() {
  var _a, _b;
  return tslib_es6.__awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee() {
    var _getGameletPixuiFrame, GameletAPI, _getGameletPixuiFrame2, _GameletAPI, _t, _t2, _t3, _t4, _t5, _t6, _t7, _t8, _t9, _t0, _t1, _t10, _t11, _t12, _t13, _t14, _t15, _t16;
    return _regeneratorRuntime__default["default"].wrap(function (_context) {
      while (1) switch (_context.prev = _context.next) {
        case 0:
          _context.prev = 0;
          // eslint-disable-next-line @typescript-eslint/naming-convention
          _getGameletPixuiFrame = pixui_gamelet.getGameletPixuiFrame(), GameletAPI = _getGameletPixuiFrame.GameletAPI;
          _context.next = 1;
          return (_a = pixui_aegis_init.AegisReportInPixui.report) === null || _a === void 0 ? void 0 : _a.call(pixui_aegis_init.AegisReportInPixui, {
            msg: 'appEnv',
            appId: GameletAPI.getAppID(),
            appKey: GameletAPI.getAppKey(),
            appName: GameletAPI.getAppName()
          });
        case 1:
          _context.next = 3;
          break;
        case 2:
          _context.prev = 2;
          _t = _context["catch"](0);
          console.log('[reportCorePixUI] err', _t);
        case 3:
          _context.prev = 3;
          // eslint-disable-next-line @typescript-eslint/naming-convention
          _getGameletPixuiFrame2 = pixui_gamelet.getGameletPixuiFrame(), _GameletAPI = _getGameletPixuiFrame2.GameletAPI;
          if (!((_b = pixui_aegis_init.AegisReportInPixui.report) === null || _b === void 0)) {
            _context.next = 4;
            break;
          }
          _t2 = void 0;
          _context.next = 6;
          break;
        case 4:
          _t3 = _b;
          _t4 = pixui_aegis_init.AegisReportInPixui;
          _t5 = _GameletAPI.getAppID();
          _t6 = _GameletAPI.getAppKey();
          _t7 = _GameletAPI.getAppName();
          _t8 = _GameletAPI.getAppVersion();
          _t9 = _GameletAPI.getRuntimeEnv();
          _t0 = _GameletAPI.canUsePlatformAPI();
          _t1 = !pixui_env.isTestEnvInPixui();
          _t10 = _GameletAPI.getPlatformDesc();
          _t11 = JSON;
          _context.next = 5;
          return _GameletAPI.getUserData();
        case 5:
          _t12 = _context.sent;
          _t13 = _t11.stringify.call(_t11, _t12);
          _t14 = _GameletAPI.getOpenArgs();
          _t15 = {
            msg: 'GameletAPI',
            appId: _t5,
            appKey: _t6,
            appName: _t7,
            appVersion: _t8,
            runtimeEnv: _t9,
            canUsePlatformAPI: _t0,
            getIsProductEnvironment: _t1,
            getPlatformDesc: _t10,
            userdata: _t13,
            openArgs: _t14
          };
          _t2 = _t3.call.call(_t3, _t4, _t15);
        case 6:
          _context.next = 7;
          return _t2;
        case 7:
          _context.next = 9;
          break;
        case 8:
          _context.prev = 8;
          _t16 = _context["catch"](3);
          console.log('[reportCorePixUI] err', _t16);
        case 9:
        case "end":
          return _context.stop();
      }
    }, _callee, null, [[0, 2], [3, 8]]);
  }));
}

exports.reportCoreInfoInPixUI = reportCoreInfoInPixUI;
