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

  var _reporterNs, _cclegacy, __checkObsolete__, __checkObsoleteInNamespace__, Color, sys, tween, v3, isValid, EventManager, GameConst, LogMgr, GFunc, _crd;

  function _reportPossibleCrUseOfEventManager(extras) {
    _reporterNs.report("EventManager", "./Manager/EventManager", _context.meta, extras);
  }

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

  function _reportPossibleCrUseOfLogMgr(extras) {
    _reporterNs.report("LogMgr", "./Manager/LogMgr", _context.meta, extras);
  }

  _export("default", void 0);

  return {
    setters: [function (_unresolved_) {
      _reporterNs = _unresolved_;
    }, function (_cc) {
      _cclegacy = _cc.cclegacy;
      __checkObsolete__ = _cc.__checkObsolete__;
      __checkObsoleteInNamespace__ = _cc.__checkObsoleteInNamespace__;
      Color = _cc.Color;
      sys = _cc.sys;
      tween = _cc.tween;
      v3 = _cc.v3;
      isValid = _cc.isValid;
    }, function (_unresolved_2) {
      EventManager = _unresolved_2.default;
    }, function (_unresolved_3) {
      GameConst = _unresolved_3.GameConst;
    }, function (_unresolved_4) {
      LogMgr = _unresolved_4.default;
    }],
    execute: function () {
      _crd = true;

      _cclegacy._RF.push({}, "c3619XtRsNL57640e5XSXvK", "GFunc", undefined);

      __checkObsolete__(['Color', 'instantiate', 'sys', 'tween', 'UIOpacity', 'v3', 'Vec3', 'Node', 'Sprite', 'sp', 'resources', 'isValid', 'director', 'UITransform']);

      _export("default", GFunc = class GFunc {
        static openPages() {
          return (_crd && GameConst === void 0 ? (_reportPossibleCrUseOfGameConst({
            error: Error()
          }), GameConst) : GameConst).openPages;
        } //---------以上代码在正式环境中不能运行------------
        //关闭当前最上层的页面


        static closePage() {
          //EventManager.emit('closePage', GameConst.openPages[GameConst.openPages.length - 1]);
          var lastPage = (_crd && GameConst === void 0 ? (_reportPossibleCrUseOfGameConst({
            error: Error()
          }), GameConst) : GameConst).openPages[(_crd && GameConst === void 0 ? (_reportPossibleCrUseOfGameConst({
            error: Error()
          }), GameConst) : GameConst).openPages.length - 1]; //----读取openPages里面的顺序关掉最后一个页面，然后打开上一个页面

          var upPage = (_crd && GameConst === void 0 ? (_reportPossibleCrUseOfGameConst({
            error: Error()
          }), GameConst) : GameConst).openPages[(_crd && GameConst === void 0 ? (_reportPossibleCrUseOfGameConst({
            error: Error()
          }), GameConst) : GameConst).openPages.length - 2];
          (_crd && LogMgr === void 0 ? (_reportPossibleCrUseOfLogMgr({
            error: Error()
          }), LogMgr) : LogMgr).error('要切换到的页面是：', upPage);

          if (upPage) {
            var pIdx = (_crd && GameConst === void 0 ? (_reportPossibleCrUseOfGameConst({
              error: Error()
            }), GameConst) : GameConst).menuPage.indexOf(upPage);

            if (pIdx >= 0) {
              (_crd && EventManager === void 0 ? (_reportPossibleCrUseOfEventManager({
                error: Error()
              }), EventManager) : EventManager).emit('switchPage', '' + pIdx);
            } else {
              (_crd && EventManager === void 0 ? (_reportPossibleCrUseOfEventManager({
                error: Error()
              }), EventManager) : EventManager).emit('showPage', upPage);
            }
          } else {
            (_crd && EventManager === void 0 ? (_reportPossibleCrUseOfEventManager({
              error: Error()
            }), EventManager) : EventManager).emit('switchPage', '0');
          }

          (_crd && EventManager === void 0 ? (_reportPossibleCrUseOfEventManager({
            error: Error()
          }), EventManager) : EventManager).emit('closePage', lastPage);
          (_crd && EventManager === void 0 ? (_reportPossibleCrUseOfEventManager({
            error: Error()
          }), EventManager) : EventManager).emit('closePop');
          (_crd && EventManager === void 0 ? (_reportPossibleCrUseOfEventManager({
            error: Error()
          }), EventManager) : EventManager).emit('clearGuide');
        } //添加打开的页面名到 openPages 数组中


        static addToOpenPage(pageName) {
          var idx = (_crd && GameConst === void 0 ? (_reportPossibleCrUseOfGameConst({
            error: Error()
          }), GameConst) : GameConst).openPages.indexOf(pageName);

          if (idx >= 0) {
            (_crd && GameConst === void 0 ? (_reportPossibleCrUseOfGameConst({
              error: Error()
            }), GameConst) : GameConst).openPages.splice(idx);
          }

          (_crd && GameConst === void 0 ? (_reportPossibleCrUseOfGameConst({
            error: Error()
          }), GameConst) : GameConst).openPages.push(pageName);
        } //获取品质的颜色


        static getColor(str) {
          return new Color().fromHEX(this.getColorCode('' + str));
        }

        static getColorCode(str) {
          var color = {
            '1': '#C8CED0',
            //白装黑色
            '2': '#A2C082',
            //绿
            '3': '#8AB3D8',
            //蓝
            '4': '#A47DC6',
            //紫色
            '5': '#FFD651',
            //橙色
            'Gray': '#999999',
            //灰色
            'Normal': '#FFFFFF',
            //白色
            'Yellow': '#FFC03F',
            //黄色
            'BLACK': '#333333',
            //黑色
            '(Failed)': '#9E0000',
            //失败的红色
            '(Completed)': '#00FF00',
            //完成的绿色
            '(Pending)': '#333333',
            //等待中的黑色
            'less': '#9E0000',
            //不足的红色
            'enough': '#00FF00',
            //足够的绿色
            'notEnough': '#666666',
            //进度不足的灰黑色
            'taskNot': '#333333',
            //任务没完成的黑色标题
            'taskFinish': '#FF9F0B',
            //任务已完成的橙色标题
            'inviteReach': '#666666',
            //邀请进度已达成的黑色文字
            'inviteNot': '#999999',
            //邀请进度没达成的灰色文字
            'redTip': '#B13636',
            //红字提示
            'greenTip': '#72A937',
            //绿字提示
            'yellowTip': '#FF9F0B',
            //黄字提示
            "greenClock": "6FE27A",
            //签到文字
            "yellowClock": "FFC70A",
            'soundOn': '#8ADF80',
            //声音开的绿色
            'soundOff': '#917163' //声音关的赭色

          };
          return color['' + str];
        } //获取日期时间信息 输出：2024/08/29 13:04


        static formatDateString(timeStamp, dateString) {
          if (timeStamp === void 0) {
            timeStamp = 0;
          }

          if (dateString === void 0) {
            dateString = '';
          }

          var date = new Date((_crd && GameConst === void 0 ? (_reportPossibleCrUseOfGameConst({
            error: Error()
          }), GameConst) : GameConst).netTime);

          if (timeStamp) {
            date = new Date(timeStamp);
          } else if (dateString) {
            date = new Date(dateString);
          }

          var year = date.getFullYear();
          var month = date.getMonth() + 1;
          var day = date.getDate();
          var hours = date.getHours();
          var minutes = date.getMinutes();
          return year + "/" + (month < 10 ? "0" + month : month) + "/" + (day < 10 ? "0" + day : day) + " " + (hours < 10 ? "0" + hours : hours) + ":" + (minutes < 10 ? "0" + minutes : minutes);
        }

        static formatDateString1(timeStamp, dateString, needSecond) {
          if (timeStamp === void 0) {
            timeStamp = 0;
          }

          if (dateString === void 0) {
            dateString = '';
          }

          if (needSecond === void 0) {
            needSecond = false;
          }

          var date = new Date((_crd && GameConst === void 0 ? (_reportPossibleCrUseOfGameConst({
            error: Error()
          }), GameConst) : GameConst).netTime);

          if (timeStamp) {
            date = new Date(timeStamp);
          } else if (dateString) {
            date = new Date(dateString);
          } //let year = date.getFullYear();


          var month = date.getMonth() + 1;
          var day = date.getDate();
          var hours = date.getHours();
          var minutes = date.getMinutes();
          var str = (month < 10 ? "0" + month : month) + "/" + (day < 10 ? "0" + day : day) + " " + (hours < 10 ? "0" + hours : hours) + ":" + (minutes < 10 ? "0" + minutes : minutes);

          if (needSecond) {
            var second = date.getSeconds();
            str += ":" + (second < 10 ? "0" + second : second);
          }

          return str;
        }

        //格式化倒计时显示
        static formatDjs(second) {
          if (second === void 0) {
            second = 0;
          }

          if (second <= 0) {
            return '00:00:00';
          }

          var djsStr = '';
          var hour = Math.floor(second / 3600);
          var minute = Math.floor((second - hour * 3600) / 60);
          var sec = Math.floor(second - hour * 3600 - minute * 60);
          djsStr = (hour < 10 ? "0" + hour : hour) + ":" + (minute < 10 ? "0" + minute : minute) + ":" + (sec < 10 ? "0" + sec : sec);
          return djsStr;
        } //获取当前时间戳,这个时间戳不严密，是手机本地时间而不是联网时间戳的


        static getTimeSign(isSecond, timeStr) {
          if (isSecond === void 0) {
            isSecond = true;
          }

          if (timeStr === void 0) {
            timeStr = null;
          }

          var date = new Date((_crd && GameConst === void 0 ? (_reportPossibleCrUseOfGameConst({
            error: Error()
          }), GameConst) : GameConst).netTime);

          if (timeStr) {
            date = new Date(timeStr);
          }

          if (isSecond) {
            return Math.floor(date.getTime() / 1000);
          } else {
            return date.getTime();
          }
        }

        static getTimeStr() {
          var date = new Date((_crd && GameConst === void 0 ? (_reportPossibleCrUseOfGameConst({
            error: Error()
          }), GameConst) : GameConst).netTime);
          return date.toLocaleString(); //'2025/4/18 17:56:04'
        } //读取本地存储的数据


        static getLocal(key) {
          var str = sys.localStorage.getItem('AIMine-' + key);

          if (!str) {
            return false;
          } else {
            try {
              return JSON.parse(str);
            } catch (error) {
              return str;
            }
          }
        }

        //保存数据到本地存储
        static setLocal(key, value) {
          var saveData = GFunc.copyData(value);

          if (typeof saveData == 'object') {
            saveData = JSON.stringify(saveData);
          }

          sys.localStorage.setItem('AIMine-' + key, saveData);
        }

        static removeLocal(key) {
          sys.localStorage.removeItem('AIMine-' + key);
        }

        //浅拷贝数据
        static copyData(data) {
          if (typeof data == 'object') {
            return JSON.parse(JSON.stringify(data));
          } else {
            return data;
          }
        }

        //获取日期信息
        static getNYR(timeStamp) {
          if (timeStamp === void 0) {
            timeStamp = 0;
          }

          var date = new Date((_crd && GameConst === void 0 ? (_reportPossibleCrUseOfGameConst({
            error: Error()
          }), GameConst) : GameConst).netTime);

          if (timeStamp) {
            date = new Date(timeStamp);
          }

          return date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate();
        }

        //重新显示合适的名称长度，超过限制的显示...
        static showName(name, len) {
          if (len === void 0) {
            len = 10;
          }

          if (name.length > len) {
            return name.slice(0, len - 3) + '...';
          } else {
            return name;
          }
        } //重新显示合适的名称长度，超过限制的显示...


        static showNameMid(name, len) {
          if (len === void 0) {
            len = 10;
          }

          if (name.length > len) {
            return name.slice(0, 4) + '...' + name.slice(name.length - 4, name.length);
          } else {
            return name;
          }
        }
        /**
         * 重新显示较长的数字为短数字,省略精度,保留4个小数位
         * @param num number 输入的数字
         * @param digit number 保留的小数位数，默认4个
         */


        static showShorter(num, digit, maxLen) {
          if (digit === void 0) {
            digit = 4;
          }

          if (maxLen === void 0) {
            maxLen = 10;
          }

          if (num.toString().length <= maxLen) {
            return '' + num;
          } else {
            if (typeof num == 'number' && num.toString().length - num.toString().indexOf('.') > maxLen - digit) {
              return num.toFixed(digit) + '...';
            } else if (typeof num == 'string') {
              if (digit) {
                if (num.length >= digit - 4) {
                  return num.slice(0, digit) + '...';
                }
              } else {
                if (num.length >= maxLen) {
                  return num.slice(0, maxLen) + '...';
                }
              }
            } else {
              return '' + num;
            }
          }
        }
        /**
         * 显示千分位分隔的数字形式
         * @param num number 输入的数字
         * @param digit number 保留的小数位数，默认4个
         */


        static commasNumber(num, digit) {
          if (digit === void 0) {
            digit = 4;
          }

          if (typeof num == 'number') {
            num = num.toString();
          } // 将数字转换为字符串


          var parts = num.split('.'); // 对整数部分进行千分位格式化

          parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ','); // 如果有小数部分，返回格式化后的字符串
          //return parts.length > 1 ? parts.join('.') : parts[0];

          if (parts.length > 1) {
            if (digit > 0) {
              parts[1] = parts[1].slice(0, digit);
              return parts.join('.');
            } else {
              return parts[0];
            }
          } else {
            return parts[0];
          }
        }
        /**
         * 使用 K M B 显示数字
         * @param num number 输入的数字
         * @param digit number 保留的小数位数，默认2个
         */


        static shorterKMB(num, digit) {
          if (digit === void 0) {
            digit = 2;
          }

          if (num >= 1000000000) {
            return (num / 1000000000).toFixed(digit) + 'B';
          } else if (num >= 1000000) {
            return (num / 1000000).toFixed(digit) + 'M';
          } else if (num >= 1000) {
            return (num / 1000).toFixed(digit) + 'K';
          } else {
            return '' + num.toFixed(digit);
          }
        } //使用kmb格式化数字，省略末尾的0


        static formatNumber(value, decimals) {
          if (decimals === void 0) {
            decimals = 3;
          }

          if (value < 1000) {
            // 小于 1000 不加后缀
            return this.trimNum(value, decimals); // 调用自定义的截取小数方法
          }

          var units = ['k', 'm', 'b', 't']; // 后缀单位

          var unitIndex = -1;

          while (value >= 1000 && unitIndex < units.length - 1) {
            value /= 1000; // 继续缩小数字，添加单位

            unitIndex++;
          }

          return "" + this.trimNum(value, decimals) + units[unitIndex];
        }

        static trimNum(value, decimals) {
          var factor = Math.pow(10, decimals); // 计算 10^decimals

          return (Math.floor(value * factor) / factor).toString(); // 截取多余的小数位
        } //保留3位小数


        static trimDecimal(value) {
          // 将输入转换为字符串
          var valueStr = value.toString(); // 检查是否是小数

          if (valueStr.includes('.')) {
            var [integerPart, decimalPart] = valueStr.split('.'); // 拆分整数部分和小数部分

            if (decimalPart.length > 3) {
              // 如果小数部分超过三位，舍弃多余部分
              return parseFloat(integerPart + "." + decimalPart.substring(0, 3));
            }
          } // 如果没有小数部分，或小数部分不超过三位，直接返回


          return value;
        } ///-----


        static GFormatNumber(value, decimals) {
          if (decimals === void 0) {
            decimals = 3;
          }

          //不带四舍五入，用于钱包余额的显示
          if (value < 1000) {
            // 小于 1000 不加单位，保留指定小数位但不四舍五入
            return this.GnoRound(value, decimals).toString();
          }

          var units = ['k', 'm', 'b', 't']; // 单位数组

          var unitIndex = -1;

          while (value >= 1000 && unitIndex < units.length - 1) {
            value /= 1000; // 缩放数字到 1000 以下

            unitIndex++;
          } // 确保缩放后的值保留小数位但不四舍五入


          return "" + this.GnoRound(value, decimals) + units[unitIndex];
        } // 不进行四舍五入的方法


        static GnoRound(value, decimals) {
          var strValue = value.toString();
          var [integerPart, decimalPart] = strValue.split('.');

          if (!decimalPart || decimalPart.length <= decimals) {
            // 如果没有小数部分或小数位数不超过指定长度，直接返回原值
            return value;
          } // 截取到指定小数位长度但不进行四舍五入


          var truncatedDecimal = decimalPart.slice(0, decimals);
          return parseFloat(integerPart + "." + truncatedDecimal);
        }

        static formatNumberSR(value, decimals) {
          if (decimals === void 0) {
            decimals = 3;
          }

          //有四舍五入的，用于上架是售价的显示
          if (value < 1000) {
            return parseFloat(value.toFixed(decimals)).toString();
          }

          var units = ['k', 'm', 'b', 't'];
          var unitIndex = -1;

          while (value >= 1000 && unitIndex < units.length - 1) {
            value /= 1000;
            unitIndex++;
          }

          return "" + parseFloat(value.toFixed(decimals)).toString() + units[unitIndex];
        } //----

        /**根据给定属性key重新对数组进行排序，会改变原数组 */


        static sortArrayByKey(arr, key, isMinToMax) {
          if (isMinToMax === void 0) {
            isMinToMax = true;
          }

          if (!arr || arr.length < 1 || !key || !arr[0].hasOwnProperty(key)) {
            (_crd && LogMgr === void 0 ? (_reportPossibleCrUseOfLogMgr({
              error: Error()
            }), LogMgr) : LogMgr).warn('sortArrayByKey参数错误,len:', arr.length, 'key:', key, !arr[0].hasOwnProperty(key));
            return;
          }

          arr.sort((a, b) => {
            if (isMinToMax) {
              return a[key] - b[key];
            } else {
              return b[key] - a[key];
            }
          });
        }
        /**
         * 对数组进行随机排序，会改变原数组
         * @param arr 数组
         */


        static randSortArray(arr) {
          if (!arr || arr.length < 1) {
            (_crd && LogMgr === void 0 ? (_reportPossibleCrUseOfLogMgr({
              error: Error()
            }), LogMgr) : LogMgr).warn('randSortArray参数错误,len:', arr.length);
            return;
          }

          arr.sort(function () {
            return Math.random() - 0.5;
          });
        }

        static getJuXingPoints(count, pos, width, height) {
          var points = [];

          for (var i = 0; i < count; i++) {
            /*
            //以下三行会得到一个椭圆圆周上的落点
            let angle = (pos.x - width / 2) + Math.random() * 100 * width / count; // 当前角度
            let x = pos.x + width / 2 * Math.sin((Math.PI / 180) * angle);
            let y = pos.y + height / 2 * Math.cos((Math.PI / 180) * angle);*/
            //在矩形中心pos的基础上，在矩形范围内纯随机落点
            var x = pos.x - width / 2 + Math.random() * width;
            var y = pos.y - height / 2 + Math.random() * height;
            points.unshift(v3(x, y, 0));
          }

          return points;
        }
        /**
         * 以某点为圆心，生成圆周上等分点的坐标
         *
         * @param {number} r 半径
         * @param {cc.Vec2} pos 圆心坐标
         * @param {number} count 等分点数量
         * @param {number} [randomScope=80] 等分点的随机波动范围
         * @returns {cc.Vec2[]} 返回等分点坐标
         */


        static getCirclePoints(r, pos, count, randomScope) {
          if (randomScope === void 0) {
            randomScope = 60;
          }

          var points = [];
          var radians = Math.PI / 180 * Math.round(360 / count);

          for (var i = 0; i < count; i++) {
            var x = pos.x + r * Math.sin(radians * i);
            var y = pos.y + r * Math.cos(radians * i);
            points.unshift(v3(x + Math.random() * randomScope, y + Math.random() * randomScope, 0));
          }

          return points;
        } //以某点为圆心，扇形等分点的坐标


        static getShanXingPoints(r, pos, count, randomScope) {
          if (randomScope === void 0) {
            randomScope = 60;
          }

          var points = [];
          var startAngle = -135; // 起始角度

          var endAngle = -215; // 结束角度

          var angleRange = endAngle - startAngle; // 角度范围

          var radians = Math.PI / 180 * angleRange / count; // 每个点之间的弧度差

          for (var i = 0; i < count; i++) {
            var angle = startAngle + i * angleRange / count; // 当前角度

            var x = pos.x + r * Math.sin(Math.PI / 180 * angle);
            var y = pos.y + r * Math.cos(Math.PI / 180 * angle);
            points.unshift(v3(x + Math.random() * randomScope, y + Math.random() * randomScope, 0));
          }

          return points;
        }
        /**
         * 使用贝塞尔曲线移动的tween动画
         * @param node 移动的节点
         * @param pos 移动的坐标数组
         * @param time 移动的时长
         * @param delayTime 移动的延迟时间
         * @param bezier 贝塞尔曲线控制点数组
         * */


        static tweenBezierMove(node, pos, time, delayTime) {
          if (time === void 0) {
            time = 2;
          }

          if (delayTime === void 0) {
            delayTime = 1;
          }

          if (!node || !pos || pos.length < 3) {
            return;
          }

          var quadraticCurve = (t, p1, cp, p2, out) => {
            out.x = (1 - t) * (1 - t) * p1.x + 2 * t * (1 - t) * cp.x + t * t * p2.x;
            out.y = (1 - t) * (1 - t) * p1.y + 2 * t * (1 - t) * cp.y + t * t * p2.y;
            out.z = (1 - t) * (1 - t) * p1.z + 2 * t * (1 - t) * cp.z + t * t * p2.z;
          };

          var startPos = v3(pos[0].x, pos[0].y, 0);
          var controlPos = v3(pos[1].x, pos[1].y + 200, 0);
          var endPos = v3(pos[pos.length - 1].x, pos[pos.length - 1].y, 0);
          var tempVec3 = v3();
          tween(node).delay(delayTime).to(time, {
            position: endPos
          }, {
            onUpdate: (target, ratio) => {
              quadraticCurve(ratio, startPos, controlPos, endPos, tempVec3);
              node.setPosition(tempVec3);
            }
          }).call(() => {
            node.destroy();
          }).start();
        } //获取最终子节点


        static seekChild(path, parentNode) {
          var pathArr = path.split('/'),
              pNode = parentNode;

          for (var i = 0; i < pathArr.length; i++) {
            var cNode = pNode.getChildByName(pathArr[i]);

            if (cNode && isValid(cNode)) {
              pNode = cNode;
            } else {
              return null;
            }
          }

          return pNode;
        }

      });

      _cclegacy._RF.pop();

      _crd = false;
    }
  };
});
//# sourceMappingURL=6e3d9221b04ba0b95276ab26726b194d0a342c4d.js.map