System.register(["__unresolved_0", "cc", "__unresolved_1", "__unresolved_2"], function (_export, _context) {
  "use strict";

  var _reporterNs, _cclegacy, UserModel, GameConst, Data, _crd;

  function _reportPossibleCrUseOfUserModel(extras) {
    _reporterNs.report("UserModel", "../../modules/user/UserModel", _context.meta, extras);
  }

  function _reportPossibleCrUseOfGameConst(extras) {
    _reporterNs.report("GameConst", "../common/GameConst", _context.meta, extras);
  }

  _export("default", void 0);

  return {
    setters: [function (_unresolved_) {
      _reporterNs = _unresolved_;
    }, function (_cc) {
      _cclegacy = _cc.cclegacy;
    }, function (_unresolved_2) {
      UserModel = _unresolved_2.default;
    }, function (_unresolved_3) {
      GameConst = _unresolved_3.default;
    }],
    execute: function () {
      _crd = true;

      _cclegacy._RF.push({}, "1f51eZt1oBJSb+sFNAgk0kG", "Data", undefined);

      _export("default", Data = class Data {
        static save(bRemote = false) {
          var obj = {};
          obj['user'] = Data.user.getUploadData();
          Data.savedata(obj, bRemote);
        }

        static getGameData() {
          let strdata = localStorage.getItem((_crd && GameConst === void 0 ? (_reportPossibleCrUseOfGameConst({
            error: Error()
          }), GameConst) : GameConst).local_data_key);
          return strdata;
        }

        static loadData() {
          var localdata = localStorage.getItem((_crd && GameConst === void 0 ? (_reportPossibleCrUseOfGameConst({
            error: Error()
          }), GameConst) : GameConst).local_data_key);

          if (localdata) {
            localdata = JSON.parse(localdata);
            console.log('本地数据', localdata);
            Data.user.setData(localdata['user']);
          }
        }

        //本地存数据
        static savedata(data, bRemote = false) {
          localStorage.setItem("savedatatime", Date.now().toString());
          var strdata = JSON.stringify(data); //  console.log('存储数据',strdata)

          localStorage.setItem((_crd && GameConst === void 0 ? (_reportPossibleCrUseOfGameConst({
            error: Error()
          }), GameConst) : GameConst).local_data_key, strdata);
          data.game = {};

          if (Date.now() - this.savedatatime > 60 * 3 * 1000 || bRemote) {
            this.savedatatime = Date.now();
          }
        }

      });

      Data.user = new (_crd && UserModel === void 0 ? (_reportPossibleCrUseOfUserModel({
        error: Error()
      }), UserModel) : UserModel)();
      Data.savedatatime = 0;

      _cclegacy._RF.pop();

      _crd = false;
    }
  };
});
//# sourceMappingURL=082f4a5220d0c75dd20633478deceda258dabc78.js.map