收藏
回答

unity导入微信小游戏报错?

框架类型 问题类型 操作系统 工具版本
小游戏 Bug Windows 稳定版

这些问题有没有知道咋改的,试了好多方法,都没变化,报错的这一行很长

"use strict";var e=require("@babel/runtime/helpers/interopRequireDefault");require("@babel/runtime/helpers/Objectvalues"),require("@babel/runtime/helpers/Arrayincludes"),require("@babel/runtime/helpers/Objectentries");var t=require("@babel/runtime/helpers/construct"),n=require("@babel/runtime/helpers/assertThisInitialized"),i=require("@babel/runtime/helpers/createForOfIteratorHelper"),r=e(require("@babel/runtime/regenerator")),a=require("@babel/runtime/helpers/typeof"),o=require("@babel/runtime/helpers/inherits"),s=require("@babel/runtime/helpers/createSuper"),u=require("@babel/runtime/helpers/slicedToArray"),c=require("@babel/runtime/helpers/classCallCheck"),l=require("@babel/runtime/helpers/createClass"),d=require("@babel/runtime/helpers/defineProperty");!function(){var e={388:function(e,t,n){var i,r,a;n.d(t,{QD:function(){return r},C2:function(){return a},ZP:function(){return s},Mi:function(){return f}}),function(e){e.STRING="STRING",e.LONGLONG="LONGLONG",e.UINT="UINT",e.INT="INT"}(r||(r={})),function(e){e.SvrReport="SvrReport",e.KvStat="KvStat"}(a||(a={}));var o=(d(i={},r.STRING,(function(e){return"string"==typeof e&&e.length<=1024})),d(i,r.LONGLONG,(function(e){return"number"==typeof e&&Math.floor(e)===e})),d(i,r.UINT,(function(e){return"number"==typeof e&&Math.floor(e)===e&&e>=0})),d(i,r.INT,(function(e){return"number"==typeof e&&Math.floor(e)===e})),i),s=function(){function e(t){var n=t.logid,i=t.schemas,r=void 0===i?{}:i,a=t.base,o=t.debug,s=void 0!==o&&o,u=t.namespace,l=void 0===u?"":u;c(this,e),this.debug=!1,this.base={},this.namespace="",this.asyncGetBase=function(){return Promise.resolve({})},this.logid=n,this.schemas=r,a&&this.setBase(a),this.debug=s,this.namespace=l?" ".concat(l," "):" "}return l(e,[{key:"setBase",value:function(e){this.validate(e),this.base=Object.assign(Object.assign({},this.base),e)}},{key:"validate",value:function(e){if(Object.keys(this.schemas).length)for(var t=0,n=Object.entries(e);t<n.length;t++){var i=u(n[t],2),r=i[0],a=i[1];if(void 0!==a){var o=this.schemas[r];o?this.validateColumn(o,a)||console.error("[minigamefe".concat(this.namespace,"SchemaValidator]: logid ").concat(this.logid,": ").concat(r," should be ").concat(o,", but now ").concat(a)):console.warn("[minigamefe".concat(this.namespace,"SchemaValidator]: logid").concat(this.logid,": ").concat(r," 缺少类型定义"))}}}},{key:"validateColumn",value:function(e,t){return o[e](t)}}]),e}(),h="";function f(e,t,n){h?e&&e(h):(t({success:function(t){h=t.networkType,e&&e(h)}}),n((function(t){h=t.networkType,t.isConnected||(h="none"),e&&e(h)})))}},512:function(e,t,n){n.d(t,{YP:function(){return r},hQ:function(){return a},yC:function(){return o},hj:function(){return s},p6:function(){return c},xb:function(){return l},HD:function(){return d},Kn:function(){return h},mf:function(){return f},o8:function(){return g},vr:function(){return p},$c:function(){return m}});var i=n(580);function r(){}function a(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20,t=arguments.length>1?arguments[1]:void 0,n=(t?"":"!#%()*+,-./:;=?@[]^_`{|}~")+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",i=n.length,r=[],a=0;a<e;a++)r[a]=n.charAt(Math.random()*i);return r.join("")}function o(e,t){for(var n=e.split("."),i=t.split("."),r=Math.max(n.length,i.length);n.length<r;)n.push("0");for(;i.length<r;)i.push("0");for(var a=0;a<r;a++){var o=parseInt(n[a],10),s=parseInt(i[a],10);if(o>s)return 1;if(o<s)return-1}return 0}function s(e){return"number"==typeof e&&isFinite(e)}function c(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"yyyy-MM-dd";if(!e)return"";for(var n=t,i=10===String(e).toString().length?new Date(1e3*e):new Date(e),r={"y+":i.getFullYear(),"M+":i.getMonth()+1,"d+":i.getDate(),"h+":i.getHours(),"m+":i.getMinutes(),"s+":i.getSeconds(),"q+":Math.floor((i.getMonth()+3)/3),"S+":i.getMilliseconds()},a=function(){var e=u(s[o],2),t=e[0],i=e[1],r=new RegExp("(".concat(t,")"));if(r.test(n)){var a=n.match(r),c=u(a,1)[0];n=n.replace(r,(function(){return"00".concat(i).slice(-"".concat(c).length)}))}},o=0,s=Object.entries(r);o<s.length;o++)a();return n}function l(e){if(null==e)return!0;if("boolean"==typeof e)return!1;if("number"==typeof e)return!e;if(e instanceof Error)return""===e.message;switch(Object.prototype.toString.call(e)){case"[object String]":case"[object Array]":return!e.length;case"[object File]":case"[object Map]":case"[object Set]":return!e.size;case"[object Object]":return!Object.keys(e).length}return!1}function d(e){return"[object String]"===Object.prototype.toString.call(e)}function h(e){return"[object Object]"===Object.prototype.toString.call(e)}function f(e){return e&&"[object Function]"===Object.prototype.toString.call(e)}function g(e){return void 0===e}function p(e,t,n){if(!n)return e;var i=e,r=new RegExp("([?&])".concat(t,"=.*?(&|$)"),"i");if(i.match(r))return i.replace(r,"$1".concat(t,"=").concat(n,"$2"));var a=-1!==i.indexOf("?")?"&":"?",o=i.split("#");return i="".concat(o[0]+a+t,"=").concat(n),o[1]&&(i+="#".concat(o[1])),i}function m(e){var t=i.vm.UnKnow;return e.platform===i.t4.devtools?t=i.vm.Devtools:e.platform===i.t4.ios?(t=(null===n.g||void 0===n.g?void 0:n.g.isIOSHighPerformanceMode)?i.vm.IOSWK:i.vm.IOSJscore,e.model.indexOf("iPad")>-1&&(t=(null===n.g||void 0===n.g?void 0:n.g.isIOSHighPerformanceMode)?i.vm.IPadWK:i.vm.IPadJscore)):e.platform===i.t4.android?t=i.vm.Android:e.platform===i.t4.windows&&(t=i.vm.PC),t}},580:function(e,t,n){var i,r,a,o,s;n.d(t,{t4:function(){return i},hc:function(){return r},tE:function(){return a},dg:function(){return o},vm:function(){return s}}),function(e){e.devtools="devtools",e.android="android",e.ios="ios",e.windows="windows",e.mac="mac"}(i||(i={})),function(e){e.portrait="portrait",e.landscape="landscape",e.landscapeLeft="landscapeLeft",e.landscapeRight="landscapeRight"}(r||(r={})),function(e){e.DEVELOP="develop",e.TRIAL="trial",e.RELEASE="release"}(a||(a={})),function(e){e[e.release=1]="release",e[e.develop=2]="develop",e[e.trial=3]="trial"}(o||(o={})),function(e){e[e.Android=0]="Android",e[e.IOSJscore=1]="IOSJscore",e[e.IOSWK=2]="IOSWK",e[e.UnKnow=3]="UnKnow",e[e.PC=4]="PC",e[e.Devtools=5]="Devtools",e[e.IPadJscore=6]="IPadJscore",e[e.IPadWK=7]="IPadWK"}(s||(s={}))},662:function(e,t,n){n.d(t,{Z:function(){return k}});var i,r,a,o,s,u=n(512),c=n(580),l=!("undefined"==typeof pluginEnv),d="undefined"!=typeof wx&&"undefined"!=typeof Page,h=!("undefined"==typeof wx||d)||l,f=!1,g=!1,p=!1,m=!1,v=!1,y=!1,T=!1,S=!1,E=c.vm.UnKnow,w="",b="";if(h||d){if(l){var I=pluginEnv.customEnv;I.customEnv&&(pluginEnv.customEnv=I.customEnv),s="undefined"!=typeof wx?wx:{}}if(r=l&&pluginEnv.customEnv.wx?pluginEnv.customEnv.wx:wx||{}){try{if(a=r.getSystemInfoSync()||{},E=(0,u.$c)(a),a.platform===c.t4.devtools?p=!0:a.platform===c.t4.ios?(f=!0,T=!!(null===n.g||void 0===n.g?void 0:n.g.isIOSHighPerformanceMode)):a.platform===c.t4.android?g=!0:a.platform===c.t4.windows?v=!0:a.platform===c.t4.mac&&(y=!0),(v||y)&&(m=!0),a.model.indexOf("iPad")>-1&&(S=!0),(0,u.yC)(a.SDKVersion,"2.24.4")>=0&&(null==s?void 0:s.getAccountInfoSync))try{var P=(s.getAccountInfoSync()||{}).plugin,R=void 0===P?{}:P;w=R.appId,b=R.version}catch(e){console.log(e)}}catch(e){console.error(e),a={}}try{o=r.getAccountInfoSync()||{}}catch(e){console.error(e),o={}}}else a={},o={}}else r={},a={},o={};var A={isMiniGamePlugin:l,isMiniGame:h,isMiniProgram:d,isIOS:f,isAndroid:g,isDevtools:p,isWindows:v,isMac:y,isPC:m,isWK:T,isIPad:S,systemInfo:a,accountInfo:o,wx:r,runtimeType:E,pluginWx:s,pluginAppId:w,pluginVersion:b};null===(i=r.onDeviceOrientationChange)||void 0===i||i.call(r,(function(){A.systemInfo=r.getSystemInfoSync()||{}})),l&&(A.pluginEnv=pluginEnv);var k=A},835:function(e,t,n){n.d(t,{Z:function(){return u}});var i=n(388),r=n(580),u=function(e){o(n,e);var t=s(n);function n(e){var r,a=e.reportFunc,o=e.logid,s=e.schemas,u=void 0===s?{}:s,l=e.base,d=e.reportType,h=e.asyncGetBase,f=void 0===h?function(){return Promise.resolve({})}:h,g=e.debug,p=e.namespace,m=void 0===p?"":p;return c(this,n),(r=t.call(this,{logid:o,schemas:u,base:l,debug:g,namespace:m})).reportType=i.C2.SvrReport,r.asyncGetBase=f,a||console.error("[minigamefe".concat(r.namespace,"GameTransferReport]: 未传入上报函数。")),r.reportFunc=a,void 0!==d&&(r.reportType=d),r}return l(n,[{key:"setKvStatBase",value:function(e,t){if(this.reportType===i.C2.KvStat){var n=(e.system||"").split(" ");Object.assign(this.schemas,{DeviceModel:i.QD.STRING,DeviceBrand:i.QD.STRING,OsName:i.QD.STRING,OsVersion:i.QD.STRING,LanguageVersion:i.QD.STRING,Count:i.QD.UINT,AppId:i.QD.STRING,AppVersion:i.QD.UINT,AppState:i.QD.UINT}),this.setBase({DeviceModel:e.model||"",DeviceBrand:e.brand||"",OsName:n[0]||"",OsVersion:n[1]||"",LanguageVersion:e.language||"",Count:1}),(null==t?void 0:t.miniProgram)&&this.setBase({AppState:r.dg[t.miniProgram.envVersion]||r.dg.release,AppId:t.miniProgram.appId,AppVersion:0})}}},{key:"send",value:function(e,t){var n,r=this,o=[],s=this.logid;n=Array.isArray(e)?e:[e],this.asyncGetBase().then((function(e){r.setBase(e),n.forEach((function(e){var t=Object.assign(Object.assign({},r.base),e);if(t.ExternInfo&&"object"==a(t.ExternInfo)&&r.schemas.ExternInfo===i.QD.STRING&&(t.ExternInfo=encodeURIComponent(JSON.stringify(t.ExternInfo))),r.validate(t),r.reportType===i.C2.KvStat){var n=Math.floor(Date.now()/1e3);Object.assign(t,{StartTime:n,EndTime:n})}var u={log_id:r.logid,custom_data:t};o.push(u),r.debug&&console.log("[minigamefe".concat(r.namespace,"GameTransferReport]: ").concat(s,","),t)}));var u={report_list:o};r.reportFunc({req_path:"comm_datareport",json_data:JSON.stringify(u),success:function(){t&&t(s,JSON.stringify(u))},fail:function(e){console.error(e),t&&t(s,e)}})}))}}]),n}(i.ZP)},54:function(e,t,n){n.d(t,{Z:function(){return a}});var i=n(388),r={19283:"GameComponent",19335:"GameWhatsNew",20285:"MidasFriendPayment",21494:"WXGameWASMLaunchClose",21493:"WXGameWASMLaunchException",21492:"WXGameWASMLaunchTime",21898:"GameLifeMiniGameCardAction",20267:"GameAdsSkipCard"},a=function(e){o(n,e);var t=s(n);function n(e){var i,a=e.reportFunc,o=e.logid,s=e.protocolParams,u=e.schemas,l=e.base,d=e.asyncGetBase,h=void 0===d?function(){return Promise.resolve({})}:d,f=e.debug,g=e.namespace,p=void 0===g?"":g;c(this,n);var m=o;return"number"==typeof o&&r[o]&&(m=r[o],f&&console.warn("[minigamefe".concat(p?" ".concat(p," "):" ","KeyValueReporter]: logid ").concat(o," auto map to ").concat(m,"!"))),(i=t.call(this,{logid:m,schemas:u,base:l,debug:f,namespace:p})).asyncGetBase=h,a||console.error("[minigamefe".concat(i.namespace,"KeyValueReporter]: 未传入上报函数。")),i.reportFunc=a||function(){},i.protocolParams=s,i.sendCbk=null,i}return l(n,[{key:"send",value:function(e,t){var n,i=this;n=Array.isArray(e)?e:[e],this.asyncGetBase().then((function(e){i.setBase(e),n.forEach((function(e){var n=Object.assign(Object.assign({},i.base),e);i.validate(n);var r=[];i.protocolParams.forEach((function(e){var t=void 0!==n[e]?n[e]:"";r.push(t)})),i.reportFunc({key:i.logid,value:r.map(encodeURIComponent).join(","),immediately:!0});var a=t||i.sendCbk;a&&a(i.logid,r.map(encodeURIComponent).join(",")),i.debug&&(n.IsError?console.error:console.log)("[minigamefe".concat(i.namespace,"keyValueReport]: ").concat(i.logid),n)}))}))}}]),n}(i.ZP)},865:function(e,t,n){n.r(t),n.d(t,{default:function(){return ne}});var i={};n.r(i),n.d(i,{getSafeArea:function(){return g},navigateToMiniProgram:function(){return h}});var r=n(662),d=n(580);function h(e){r.Z.wx.navigateToMiniProgram&&(r.Z.pluginEnv&&r.Z.pluginEnv.navigateToMiniProgramDirectly?r.Z.pluginEnv.navigateToMiniProgramDirectly({appId:e}):r.Z.wx.navigateToMiniProgram({appId:e}))}var f=null;function g(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1?arguments[1]:void 0;if(e&&f)return f;var n=t||r.Z.systemInfo,i=n.safeArea,a=n.deviceOrientation,o=n.screenWidth,s=n.screenHeight,u=i.left,c=i.top,l=i.right,h=i.bottom,g=i.width,p=i.height;return o>s&&a===d.hc.portrait&&(u=i.top,c=i.left,l=i.bottom,h=i.right,g=i.height,p=i.width),f={left:u,top:c,right:l,bottom:h,width:g,height:p}}JSON.parse;var p,m=JSON.stringify,v=(Object.keys,String),y="object",T=function(e,t){return t},S=function(e,t,n){var i=v(t.push(n)-1);return e.set(n,i),i};!function(e){e.log="log",e.info="info",e.warn="warn",e.error="error"}(p||(p={}));var E,w,b,I,P=function(){function e(t){var n=t.reportFunc,i=t.base,r=t.debug,a=t.delimiter,o=t.namespace;c(this,e),this.reportFunc=null,this.debug=!1,this.base={},this.delimiter=" ",this.namespace="",n?(this.reportFunc=n,i&&this.setBase(i),this.debug=!!r,a&&(this.delimiter=a),this.namespace=o?" ".concat(o," "):" "):console.error("[minigamefe XLog]: 未传入上报函数。")}return l(e,[{key:"setBase",value:function(e){this.base=Object.assign(Object.assign({},this.base),e)}},{key:"log",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this.report(p.log,t)}},{key:"info",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this.report(p.info,t)}},{key:"warn",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this.report(p.warn,t)}},{key:"error",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this.report(p.error,t)}},{key:"getLogStr",value:function(e,t){var n,i=this;if(!this.reportFunc)return console.error("[minigamefe".concat(this.namespace,"XLog]: 未传入上报函数。")),"";if(!t)return"";var o="";t.forEach((function(e){o.length>0&&(o+=i.delimiter);var t=e;"object"==a(t)&&(t=t instanceof TypeError?t.message:function(e,t,n){for(var i=t&&a(t)===y?function(e,n){return""===e||-1<t.indexOf(e)?n:void 0}:t||T,r=new Map,o=[],s=[],u=+S(r,o,i.call({"":e},"",e)),c=!u;u<o.length;)c=!0,s[u]=m(o[u++],l,n);return"["+s.join(",")+"]";function l(e,t){if(c)return c=!c,t;var n=i.call(this,e,t);switch(a(n)){case y:if(null===n)return n;case"string":return r.get(n)||S(r,o,n)}return n}}(t)),o+="".concat(String(t).trim())}));var s="[minigamefe".concat(this.namespace,"XLog]: ").concat(JSON.stringify(Object.assign(Object.assign({},this.base),{type:e,appId:r.Z.accountInfo.miniProgram.appId,content:o})));return this.debug&&(null===(n=console[e])||void 0===n||n.call(console,s)),s}},{key:"report",value:function(e,t){var n=this.reportFunc;if(n)if(n[e]&&"function"==typeof n[e]){var i=this.getLogStr(e,t);i&&n[e](i)}else console.error("[minigamefe".concat(this.namespace,"XLog]: 传入的上报函数格式不对。"));else console.error("[minigamefe".concat(this.namespace,"XLog]: 未传入上报函数。"))}}]),e}(),R=n(512);!function(e){e[e.Front=1]="Front",e[e.Background=2]="Background"}(E||(E={})),function(e){e[e.Default=0]="Default",e[e.GameTransfer=1]="GameTransfer",e[e.Request=2]="Request",e[e.DownloadFile=3]="DownloadFile",e[e.CgiSpeedMeasure=4]="CgiSpeedMeasure",e[e.BadJs=5]="BadJs",e[e.Init=6]="Init",e[e.CostTime=7]="CostTime",e[e.Error=8]="Error",e[e.UploadFile=9]="UploadFile",e[e.Login=10]="Login"}(w||(w={})),function(e){e[e.Info=101]="Info",e[e.Warn=102]="Warn",e[e.Error=103]="Error"}(b||(b={})),function(e){e.GameTransferReport="GameTransferReport",e.KeyValueReport="KeyValueReport",e.WxRequestReport="WxRequestReport"}(I||(I={}));var A,k,L=Object.values(w).filter((function(e){return(0,R.hj)(e)})),C=new(function(){function e(){c(this,e),this.options={debug:!1,logReport:!1,qualityReportType:I.KeyValueReport,pluginAppId:"",pluginVersion:"",xlogName:"minigamefe"}}return l(e,[{key:"set",value:function(e){Object.assign(this.options,e)}},{key:"get",value:function(e){return this.options[e]}}]),e}()),D=function(){function e(t){c(this,e),this.identifier="".concat(C.get("pluginAppId")||r.Z.pluginAppId,"/plugin.js"),this.quality=t,this.init()}return l(e,[{key:"init",value:function(){var e,t=this;null===(e=r.Z.wx)||void 0===e||e.onError((function(e){t.processError(e.message)}))}},{key:"processError",value:function(e){var t;if(e.indexOf(this.identifier)>-1){var n=e.split("\n"),i=n[0],r=null===(t=n[2])||void 0===t?void 0:t.split(":")[0];this.quality.innerReport({Type:w.BadJs,Target:i,CostTime:0,Result:e,CustomKey1:r})}}}]),e}(),M=n(279);!function(e){e.GAMETRANSFER_IS_NOT_EXIST="gameTransfer is not exist",e.REQUEST_IS_NOT_EXIST="request is not exist",e.UPLOADFILE_IS_NOT_EXIST="uploadFile is not exist",e.LOGIN_IS_NOT_EXIST="login is not exist",e.URL_IS_EMPTY="request url is empty.",e.HEADER_INVALID="request header is invalid",e.METHOD_IS_NOT_EXIST="method is not exist"}(A||(A={}));var x=function(e){o(n,e);var t=s(n);function n(){return c(this,n),t.apply(this,arguments)}return l(n)}(M.TinyEmitter);!function(e){e.login="login",e.gameTransfer="gameTransfer",e.request="request",e.uploadFile="uploadFile",e.downloadFile="downloadFile"}(k||(k={}));var _={QualityReportType:I,RequestRejectType:A,ReportType:w,PluginReportType:b},O=n(835),F=n(54),N="https://game.weixin.qq.com",U="minigamefe_session_id",W=n(388),G=function(e){o(n,e);var t=s(n);function n(e){var i,r=e.reportFunc,a=e.logid,o=e.schemas,s=void 0===o?{}:o,u=e.base,l=e.debug,d=e.namespace,h=e.asyncGetBase,f=void 0===h?function(){return Promise.resolve({})}:h,g=e.reportType;return c(this,n),(i=t.call(this,{logid:a,schemas:s,base:u,debug:l,namespace:d})).reportType=W.C2.SvrReport,i.reportFunc=r,r||console.error("[minigamefe".concat(i.namespace,"RequestReport]: 未传入上报函数。")),i.asyncGetBase=f,void 0!==g&&(i.reportType=g),i}return l(n,[{key:"setKvStatBase",value:function(e,t){if(this.reportType===W.C2.KvStat){var n=(e.system||"").split(" ");Object.assign(this.schemas,{DeviceModel:W.QD.STRING,DeviceBrand:W.QD.STRING,OsName:W.QD.STRING,OsVersion:W.QD.STRING,LanguageVersion:W.QD.STRING,Count:W.QD.UINT,AppId:W.QD.STRING,AppVersion:W.QD.UINT,AppState:W.QD.UINT}),this.setBase({DeviceModel:e.model||"",DeviceBrand:e.brand||"",OsName:n[0]||"",OsVersion:n[1]||"",LanguageVersion:e.language||"",Count:1}),(null==t?void 0:t.miniProgram)&&this.setBase({AppState:d.dg[t.miniProgram.envVersion]||d.dg.release,AppId:t.miniProgram.appId,AppVersion:0})}}},{key:"send",value:function(e,t){var n,i=this,r=[],a=this.logid;n=Array.isArray(e)?e:[e],this.asyncGetBase().then((function(e){var o;i.setBase(e),n.forEach((function(e){var t=Object.assign(Object.assign({},i.base),e);i.validate(t);var n={log_id:a,custom_data:t};r.push(n)}));var s=JSON.stringify({report_list:r});i.debug&&(o=console).log.apply(o,["[minigamefe".concat(i.namespace,"RequestReport]: ").concat(a)].concat(r)),i.reportFunc({url:"".concat(N,"/cgi-bin/comm/datareport"),method:"POST",header:{"content-type":"application/x-www-form-urlencoded"},data:s,success:function(){t&&t(a,JSON.stringify(s))},fail:function(e){console.error(e),t&&t(a,e)}})}))}}]),n}(W.ZP),V=["BenchmarkLevel","NetworkType","RuntimeType","PluginAppId","PluginVersion","Scene","SDKVersion","IsVisible","Type","Target","Params","Result","CostTime","ExternInfo","CustomKey1","CustomKey2","CustomKey3","IsError","FELibVersion"],B={BenchmarkLevel:W.QD.UINT,NetworkType:W.QD.STRING,RuntimeType:W.QD.UINT,PluginAppId:W.QD.STRING,PluginVersion:W.QD.STRING,Scene:W.QD.UINT,SDKVersion:W.QD.STRING,IsVisible:W.QD.UINT,Type:W.QD.UINT,Target:W.QD.STRING,Params:W.QD.STRING,Result:W.QD.STRING,CostTime:W.QD.UINT,ExternInfo:W.QD.STRING,CustomKey1:W.QD.STRING,CustomKey2:W.QD.STRING,CustomKey3:W.QD.STRING,IsError:W.QD.UINT,FELibVersion:W.QD.STRING},j="1.1.9";function H(e,t){var n=e||"";if((0,R.Kn)(n))try{n=JSON.stringify(n)}catch(e){console.error("[minigamefe stringify error]: ".concat(e)),n=""}else n=String(n);return n.length&&n.length>=1024&&(n="",console.warn("[minigamefe stringify warning]: ".concat(t," 上报长度超过1024, 已置空"))),n}var Q=function(){function e(t){var n,i;c(this,e),this.benchmarkLevel=0,this.network="",this.runtimeType=d.vm.UnKnow,this.sdkVersion="0.0.0",this.isVisible=E.Front,this.scene=0,this.query="",this.pluginAppId="",this.pluginVersion="",this.inited=!1;var r=t.systemInfo,a=t.launchInfo,o=t.onShow,s=t.onHide,u=t.pluginAppId,l=void 0===u?"":u,h=t.pluginVersion,f=void 0===h?"":h;if(!o||!s)return console.error("[minigamefe stringify warning]: please inject QualityConfig correctly"),void(this.inited=!1);this.inited=!0,this.onShow=o,this.onHide=s,this.benchmarkLevel=r.benchmarkLevel+100,this.sdkVersion=r.SDKVersion,this.launchInfo=a,this.scene=null===(n=this.launchInfo)||void 0===n?void 0:n.scene,this.query=encodeURIComponent(JSON.stringify(null===(i=this.launchInfo)||void 0===i?void 0:i.query)),this.runtimeType=(0,R.$c)(r),this.pluginAppId=l,this.pluginVersion=f,this.bindNativeEvent(),this.reporter=function(e){var t,n=e.type,i=void 0===n?I.KeyValueReport:n,r=e.reportKeyValue,a=e.debug,o=e.gameTransfer,s=e.systemInfo,u=e.accountInfo,c=e.getNetworkType,l=e.onNetworkStatusChange,d=e.request,h=e.namespace,f="";function g(){return new Promise((function(e){f?e({NetworkType:f}):c({success:function(t){f=t.networkType,e({NetworkType:f})},fail:function(){e({NetworkType:f="unknown"})}})}))}return i===I.KeyValueReport?t=new F.Z({reportFunc:r,logid:26340,schemas:B,protocolParams:V,debug:a,namespace:h,asyncGetBase:g}):i===I.GameTransferReport?(t=new O.Z({reportFunc:o,logid:26340,schemas:B,reportType:W.C2.KvStat,debug:a,namespace:h,asyncGetBase:g})).setKvStatBase(s,u):(console.warn("[minigamefe]: 当前选择 reqeust 进行质量上报, 请自行确保兼容性"),(t=new G({reportFunc:d,logid:26340,schemas:B,debug:a,namespace:h,asyncGetBase:g,reportType:W.C2.KvStat})).setKvStatBase(s,u)),i!==I.GameTransferReport&&i!==I.WxRequestReport||(0,W.Mi)((function(e){f=e,t.setBase({NetworkType:e})}),c,l),t}(t),this.reporter.setBase({BenchmarkLevel:this.benchmarkLevel,RuntimeType:this.runtimeType,Scene:+this.scene,SDKVersion:this.sdkVersion,IsVisible:this.isVisible,PluginAppId:l,PluginVersion:f,FELibVersion:j})}return l(e,[{key:"bindNativeEvent",value:function(){var e=this;this.onHide((function(){e.isVisible=E.Background,e.reporter.setBase({IsVisible:e.isVisible})})),this.onShow((function(){e.isVisible=E.Front}))}},{key:"innerReport",value:function(e){this.reporter.send(Object.assign(e,{CostTime:(0,R.hj)(e.CostTime)?e.CostTime:0,Params:H(e.Params,"Params"),Result:H(e.Result,"Result"),ExternInfo:H(e.ExternInfo,"ExternInfo")}))}},{key:"report",value:function(e){L.indexOf(e.Type)>-1&&console.error("[minigamefe quality report]: 若为自定义上报, Type 请不要使用内置枚举值 ".concat(e.Type,", 内置枚举可见 mgp.consts.ReportType")),this.inited&&this.innerReport(e)}},{key:"setCustomKey",value:function(e){this.inited&&this.reporter.setBase({CustomKey1:e.CustomKey1&&H(e.CustomKey1,"CustomKey1")||"",CustomKey2:e.CustomKey2&&H(e.CustomKey2,"CustomKey2")||"",CustomKey3:e.CustomKey3&&H(e.CustomKey3,"CustomKey3")||""})}},{key:"clearCustomKey",value:function(){this.inited&&this.reporter.setBase({CustomKey1:"",CustomKey2:"",CustomKey3:""})}}]),e}(),K=function(e){o(n,e);var t=s(n);function n(e){var i;return c(this,n),(i=t.call(this)).startTime=0,i.costTime=0,i.options=e,i}return l(n,[{key:"optionsFilter",value:function(e){return e.sessionId&&e.data&&!e.data.session_id&&(e.data.session_id=e.sessionId),e.timeout=e.timeout||3e4,e}},{key:"send",value:function(){var e=this;this.startTime=Date.now();var t=this.options,n=t.url,i=t.data,a=t.flat,o=void 0!==a&&a,s=t.timeout,u=i||{},c=u&&(0,R.Kn)(u);c&&(u["requestTime_".concat((0,R.hQ)(10,!0))]=Date.now());var l={req_path:n,timeout:s,success:function(t){e.costTime=Date.now()-e.startTime,e.sourceResponse=t,e.response=function(e){var t=e.rawData,n=void 0===t?"":t,i=e.respData,r=n||(void 0===i?{}:i).data||"";if(!r)return{};try{return JSON.parse(r)}catch(e){return{}}}(t),e.emit("success"),e.emit("complete",0)},fail:function(t){e.costTime=Date.now()-e.startTime,e.emit("error",t),e.emit("complete",1)}};o||(l.json_data=c?JSON.stringify(u):u),o&&c&&(l=Object.assign(Object.assign({},u),l)),r.Z.pluginEnv.gameTransfer(l)}}]),n}(x),z=function(){function e(t){c(this,e),this.sessionId="",this.login=t.login,this.request=t.request}return l(e,[{key:"getSessionId",value:function(e){var t=this;return this.checkSession().catch((function(){return t.loginWxGame(e)}))}},{key:"clearSessionId",value:function(){var e,t;this.sessionId="",null===(t=(e=r.Z.wx).removeStorageSync)||void 0===t||t.call(e,U)}},{key:"checkSession",value:function(){var e=this;return new Promise((function(t,n){var i,a,o,s,u=e.sessionId||(null===(a=(i=r.Z.wx).getStorageSync)||void 0===a?void 0:a.call(i,U));u?null===(s=(o=r.Z.wx).checkSession)||void 0===s||s.call(o,{success:function(){t({sessionId:u})},fail:function(t){e.clearSessionId(),n(t)}}):n({errMsg:"尚未保存sessionId"})}))}},{key:"loginWxGame",value:function(e){var t=this;return this.isLoginPromise||(this.isLoginPromise=new Promise((function(n,i){t.login({}).then((function(n){var i={code:u(n,1)[0].code};return e&&(i.appid=e),t.request({url:"".concat(N,"/cgi-bin/gameweappauthwap/login"),data:i,method:"POST"})})).then((function(e){var a,o,s=u(e,1)[0];s&&s.data?(r.Z.isMiniGamePlugin||null===(o=(a=r.Z.wx).setStorageSync)||void 0===o||o.call(a,U,s.data.session_id),t.sessionId=s.data.session_id||"",n({sessionId:s.data.session_id})):i({errMsg:"登录出错"})})).catch((function(){i({errMsg:"登录出错"})}))}))),this.isLoginPromise.finally((function(){t.isLoginPromise=void 0}))}}]),e}();function X(e,t){var n,i;if(!e)return"";var a=e,o=t;return o||(o=null===(i=(n=r.Z.wx).getStorageSync)||void 0===i?void 0:i.call(n,U)),o&&(a=(0,R.vr)(a,"session_id",o)),a}var q=function(e){o(n,e);var t=s(n);function n(e,i){var r;return c(this,n),(r=t.call(this)).startTime=0,r.costTime=0,r.resAsResponse=!1,r.options=e,r.requestFunc=i,r}return l(n,[{key:"optionsFilter",value:function(e){return e.sessionId&&(e.url=X(e.url,e.sessionId)),e}},{key:"send",value:function(){var e=this;this.startTime=Date.now();var t=this.options,n=Object.assign(t,{success:function(t){e.sourceResponse=t,e.costTime=Date.now()-e.startTime;var n=(e.resAsResponse?t:t.data)||{};if((0,R.HD)(n))try{n=JSON.parse(n)}catch(t){n={}}e.response=n,e.emit("success"),e.emit("complete",0)},fail:function(t){e.costTime=Date.now()-e.startTime,e.emit("error",t),e.emit("complete",1)}});this.requestFunc(n)}}]),n}(x),Z=function(e){o(n,e);var t=s(n);function n(e){return c(this,n),t.call(this,e,r.Z.isMiniGamePlugin?r.Z.pluginWx.request:r.Z.wx.request)}return l(n,[{key:"optionsFilter",value:function(e){return e.timeout=e.timeout||3e4,e.header&&(e.header=Object.assign({"content-type":"application/json; charset=utf-8"},e.header||{})),e.method=e.method?e.method.toUpperCase():"GET",e.sessionId&&(e.url=X(e.url,e.sessionId)),e}}]),n}(q),J=function(e){o(n,e);var t=s(n);function n(e){return c(this,n),t.call(this,e,r.Z.isMiniGamePlugin?r.Z.pluginWx.uploadFile:r.Z.wx.uploadFile)}return l(n)}(q),Y=function(e){o(n,e);var t=s(n);function n(){var e;return c(this,n),(e=t.call(this,{},r.Z.isMiniGamePlugin?r.Z.pluginWx.login:r.Z.wx.login)).resAsResponse=!0,e}return l(n)}(q),$=function(e){o(n,e);var t=s(n);function n(e){var i;return c(this,n),(i=t.call(this,e,r.Z.isMiniGamePlugin?r.Z.pluginWx.downloadFile:r.Z.wx.downloadFile)).resAsResponse=!0,i}return l(n)}(q),ee=function(){function e(t){var n=t.pluginAppId,i=void 0===n?"":n,a=t.debug,o=void 0!==a&&a,s=t.quality,u=t.namespace;c(this,e),this.login=this.initWxMethod({funcName:k.login,Constructor:Y,reportType:w.Login}),this.request=this.initWxMethod({funcName:k.request,Constructor:Z,reportType:w.Request}),this.uploadFile=this.initWxMethod({funcName:k.uploadFile,Constructor:J,reportType:w.UploadFile}),this.downloadFile=this.initWxMethod({funcName:k.downloadFile,Constructor:$,reportType:w.DownloadFile}),this.namespace="",this.errCodeIgnoreList=[],this.debug=o,this.pluginAppId=i,this.quality=s,this.namespace=u?" ".concat(u," "):" ",this.session=new z({login:this.login,request:this.request}),r.Z.isMiniGamePlugin&&(this.gameTransfer=this.initGameTransfer())}return l(e,[{key:"initGameTransfer",value:function(){var e=this;if(r.Z.pluginEnv.gameTransfer){var t={Constructor:K,funcName:k.gameTransfer,reportType:w.GameTransfer};return this.initMethodNeedSession((function(n){return e.innerRequest(n,t)}))}return console.warn("[minigamfe".concat(this.namespace,"]: 当前插件不支持 gameTransfer。")),function(){return new Promise((function(e,t){t(A.GAMETRANSFER_IS_NOT_EXIST)}))}}},{key:"initWxMethod",value:function(e){var t=this,n=e.funcName,i=e.Constructor,a=e.reportType,o=r.Z.isMiniGamePlugin?r.Z.pluginWx:r.Z.wx;if(void 0!==o&&o[n]){var s={Constructor:i,funcName:n,reportType:a},u=function(e){return t.innerRequest(e||{},s)};return n===k.request||n===k.uploadFile?this.initMethodNeedSession(u):u}return console.warn("[minigamfe".concat(this.namespace,"]: 当前环境不支持 ").concat(n,"。")),function(){return new Promise((function(e,t){t(A.METHOD_IS_NOT_EXIST)}))}}},{key:"initMethodNeedSession",value:function(e){var t=this;return function(n){return n.needSession?t.session.getSessionId(t.pluginAppId).then((function(t){return e(Object.assign(n,t))})).then((function(i){var r,a=u(i,2),o=a[0],s=a[1];return 401===(null==s?void 0:s.statusCode)||"-1702220400"=="".concat(r=o.errcode)||"-1702220401"=="".concat(r)||"-1702220407"=="".concat(r)||"-1702220402"=="".concat(r)||"40001"=="".concat(r)?(t.session.clearSessionId(),t.session.getSessionId(t.pluginAppId).then((function(t){return e(Object.assign(n,t))}))):[o,s]})):e(n)}}},{key:"innerRequest",value:function(e,t){var n=this;return new Promise((function(i,r){var a=t.Constructor,o=t.funcName,s=t.reportType;if(o===k.login||e.url){var u=new a(e);u.optionsFilter(e),u.on("success",(function(){var t;n.debug&&!0!==e.silent&&console.log("[minigamefe".concat(n.namespace,"Network]: ").concat(o," end with success"),u.response);var r=u.response,a=u.sourceResponse,c=u.costTime,l=r.errcode,d=r.errmsg;e.reduceErrmsgBeforeReport&&(0,R.mf)(e.reduceErrmsgBeforeReport)&&(d=e.reduceErrmsgBeforeReport(r)),o!==k.login||r.code||(d=r.errMsg,l=9999),(0,R.hj)(l)&&0!==Number(l)&&!0!==e.silent&&-1===n.errCodeIgnoreList.indexOf(Number(l))&&(null===(t=n.quality)||void 0===t||t.innerReport({Type:s,Target:e.url||"",Params:e.data,CostTime:c,Result:{errcode:l,errmsg:d},IsError:1})),i([r,a])})),u.on("error",(function(t){var i;!0!==e.silent&&(n.debug&&console.error("[minigamefe".concat(n.namespace,"Network]: ").concat(o," end with error"),e,t),null===(i=n.quality)||void 0===i||i.innerReport({Type:s,Target:e.url||"",CostTime:u.costTime,Params:e.data,Result:t,IsError:1})),r(t)})),u.on("complete",(function(){var t,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;!0!==e.silent&&Math.random()<.1&&(null===(t=n.quality)||void 0===t||t.innerReport({Type:w.CgiSpeedMeasure,Target:e.url||"",Params:e.data,CostTime:u.costTime,IsError:i}))})),n.debug&&!0!==e.silent&&console.log("[minigamefe".concat(n.namespace,"Network]: ").concat(o," start"),e),u.send()}else r(A.URL_IS_EMPTY)}))}},{key:"addIgnoreErrCode",value:function(e){var t=this;(Array.isArray(e)?e:[e]).forEach((function(e){-1===t.errCodeIgnoreList.indexOf(e)&&t.errCodeIgnoreList.push(e)}))}},{key:"removeIgnoreErrCode",value:function(e){var t=this;(Array.isArray(e)?e:[e]).forEach((function(e){t.errCodeIgnoreList.indexOf(e)>-1&&t.errCodeIgnoreList.splice(t.errCodeIgnoreList.indexOf(e),1)}))}},{key:"setRequestQualityReporter",value:function(e){this.quality=e}}]),e}(),te=Date.now(),ne=new(function(){function e(){c(this,e),this.version=j,this.consts=_,this.env=r.Z,this.util=i,this.config=C,this.reporter={GameTransferReport:O.Z,KeyValueReporter:F.Z}}return l(e,[{key:"init",value:function(e){var t;if(console.log("[minigamefe mgp]: inited"),n.g.mgp=this,this.config.set(e),this.network=new ee({pluginAppId:this.config.get("pluginAppId")||r.Z.pluginAppId||"",debug:this.config.get("debug")||!1,namespace:"mgp"}),r.Z.isMiniGamePlugin){var i=r.Z.pluginEnv;i.gameTransfer||i.reportKeyValue?(this.quality=new Q({debug:this.config.get("debug")&&this.config.get("logReport"),type:this.config.get("qualityReportType"),pluginAppId:this.config.get("pluginAppId")||r.Z.pluginAppId||"",pluginVersion:this.config.get("pluginVersion")||r.Z.pluginVersion||"",launchInfo:r.Z.wx.getLaunchOptionsSync(),accountInfo:r.Z.accountInfo,systemInfo:r.Z.systemInfo,onShow:r.Z.wx.onShow,onHide:r.Z.wx.onHide,getNetworkType:r.Z.wx.getNetworkType,onNetworkStatusChange:r.Z.wx.onNetworkStatusChange,gameTransfer:null===r.Z||void 0===r.Z?void 0:r.Z.pluginEnv.gameTransfer,reportKeyValue:null===(t=null===r.Z||void 0===r.Z?void 0:r.Z.pluginEnv)||void 0===t?void 0:t.reportKeyValue,request:r.Z.pluginWx.request,namespace:"mgp"}),this.network.setRequestQualityReporter(this.quality),this.quality.innerReport({Type:w.Default,Target:"init",CostTime:Date.now()-te}),new D(this.quality)):(console.warn("[minigamefe mgp]: 当前环境不支持质量上报。"),this.quality={report:R.YP});var a=this.config.get("debug");i.getXLogManager?(this.xlog=new P({reportFunc:i.getXLogManager(),namespace:"mgp",base:{name:this.config.get("xlogName")},debug:a}),a&&console.info("[minigamefe mgp]: 当前插件已支持 xlog, 建议在关键操作打客户端日志。")):(this.xlog=console,a&&console.info("[minigamefe MGP]: 当前客户端不支持 xlog, 降级为 console。"))}else console.warn("[minigamefe mgp]: please use mgp in minigame plugin")}}]),e}())},729:function(e){var t=Object.prototype.hasOwnProperty,n="~";function i(){}function r(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function a(e,t,i,a,o){if("function"!=typeof i)throw new TypeError("The listener must be a function");var s=new r(i,a||e,o),u=n?n+t:t;return e._events[u]?e._events[u].fn?e._events[u]=[e._events[u],s]:e._events[u].push(s):(e._events[u]=s,e._eventsCount++),e}function o(e,t){0==--e._eventsCount?e._events=new i:delete e._events[t]}function s(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(n=!1)),s.prototype.eventNames=function(){var e,i,r=[];if(0===this._eventsCount)return r;for(i in e=this._events)t.call(e,i)&&r.push(n?i.slice(1):i);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(e)):r},s.prototype.listeners=function(e){var t=n?n+e:e,i=this._events[t];if(!i)return[];if(i.fn)return[i.fn];for(var r=0,a=i.length,o=new Array(a);r<a;r++)o[r]=i[r].fn;return o},s.prototype.listenerCount=function(e){var t=n?n+e:e,i=this._events[t];return i?i.fn?1:i.length:0},s.prototype.emit=function(e,t,i,r,a,o){var s=n?n+e:e;if(!this._events[s])return!1;var u,c,l=this._events[s],d=arguments.length;if(l.fn){switch(l.once&&this.removeListener(e,l.fn,void 0,!0),d){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,t),!0;case 3:return l.fn.call(l.context,t,i),!0;case 4:return l.fn.call(l.context,t,i,r),!0;case 5:return l.fn.call(l.context,t,i,r,a),!0;case 6:return l.fn.call(l.context,t,i,r,a,o),!0}for(c=1,u=new Array(d-1);c<d;c++)u[c-1]=arguments[c];l.fn.apply(l.context,u)}else{var h,f=l.length;for(c=0;c<f;c++)switch(l[c].once&&this.removeListener(e,l[c].fn,void 0,!0),d){case 1:l[c].fn.call(l[c].context);break;case 2:l[c].fn.call(l[c].context,t);break;case 3:l[c].fn.call(l[c].context,t,i);break;case 4:l[c].fn.call(l[c].context,t,i,r);break;default:if(!u)for(h=1,u=new Array(d-1);h<d;h++)u[h-1]=arguments[h];l[c].fn.apply(l[c].context,u)}}return!0},s.prototype.on=function(e,t,n){return a(this,e,t,n,!1)},s.prototype.once=function(e,t,n){return a(this,e,t,n,!0)},s.prototype.removeListener=function(e,t,i,r){var a=n?n+e:e;if(!this._events[a])return this;if(!t)return o(this,a),this;var s=this._events[a];if(s.fn)s.fn!==t||r&&!s.once||i&&s.context!==i||o(this,a);else{for(var u=0,c=[],l=s.length;u<l;u++)(s[u].fn!==t||r&&!s[u].once||i&&s[u].context!==i)&&c.push(s[u]);c.length?this._events[a]=1===c.length?c[0]:c:o(this,a)}return this},s.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&o(this,t)):(this._events=new i,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=n,s.EventEmitter=s,e.exports=s},279:function(e){function t(){}t.prototype={on:function(e,t,n){var i=this.e||(this.e={});return(i[e]||(i[e]=[])).push({fn:t,ctx:n}),this},once:function(e,t,n){var i=this;function r(){i.off(e,r),t.apply(n,arguments)}return r._=t,this.on(e,r,n)},emit:function(e){for(var t=[].slice.call(arguments,1),n=((this.e||(this.e={}))[e]||[]).slice(),i=0,r=n.length;i<r;i++)n[i].fn.apply(n[i].ctx,t);return this},off:function(e,t){var n=this.e||(this.e={}),i=n[e],r=[];if(i&&t)for(var a=0,o=i.length;a<o;a++)i[a].fn!==t&&i[a].fn._!==t&&r.push(i[a]);return r.length?n[e]=r:delete n[e],this}},e.exports=t,e.exports.TinyEmitter=t}},h={};function f(t){var n=h[t];if(void 0!==n)return n.exports;var i=h[t]={exports:{}};return e[t](i,i.exports,f),i.exports}f.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return f.d(t,{a:t}),t},f.d=function(e,t){for(var n in t)f.o(t,n)&&!f.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},f.g=function(){if("object"==("undefined"==typeof globalThis?"undefined":a(globalThis)))return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==("undefined"==typeof window?"undefined":a(window)))return window}}(),f.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},f.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var g={};(function(){var e;f.r(g),f.d(g,{default:function(){return ri}});var a,h,p,m,v,y,T,S,E,w,b,I,P,R,A=f(865).default,k=A.env,L="1.1.16";if(A.init({debug:!1,pluginAppId:"wxe5a48f1ed5f544b7",pluginVersion:L,xlogName:"unityPlugin"}),k.isMiniGamePlugin){var C,D=k.pluginEnv,M=D.customEnv;a=k.wx,h=M.unityNamespace,p=M.canvas,M.document,m=D.reportKeyValue||function(){console.warn("当前环境没有reportKeyValue函数!!")},v=D.gameTransfer||function(){console.warn("当前环境没有gameTransfer函数")},P=D.instanceId||"",I=D.setFileSpaceStatistics,R=D.getPrivateFileSystemManager,(y=D.coverview)?(T=(C=y).Component,S=C.getPrivateThis,C.removePrivateThis,C.create,E=C.init,w=C.webviewLayout,b=C.xmlParser):T=l((function e(){c(this,e)}))}else a=wx,h=GameGlobal.unityNamespace,p=GameGlobal.canvas,GameGlobal.document,m=function(){},v=function(){},T=function(){},S=function(e){return e},P="";h.isCacheableFile=h.isCacheableFile||function(e){return e.includes("StreamingAssets")};var x=f(512),_=f(580),O=k.systemInfo,F=k.accountInfo,N=O.pixelRatio,U=(O.platform,O.benchmarkLevel),W=O.screenHeight,G=O.screenWidth,V=O.enableDebug,B=O.SDKVersion,j=O.version,H=(F||{}).miniProgram,Q=a.getFileSystemManager(),K=H.envVersion,z=K===_.tE.RELEASE,X=(_.tE.DEVELOP,k.isWK&&(0,x.yC)(B,"2.19.1")>=0),q=V,Z=!!h.enableDebugLog,J=!!q||!!k.isDevtools,Y=(0,x.yC)(B,"2.21.2")>=0,$=!!y,ee=k.isAndroid&&0===(0,x.yC)(j,"8.0.25"),te=!!a.reportScene&&(0,x.yC)(j,"8.0.27")>-1,ne=!!h.instantiateWasm,ie=a.getLogManager({level:1}),re=a.getRealtimeLogManager?a.getRealtimeLogManager():{info:function(){console.warn("当前环境不支持实时日志")},error:function(){console.warn("当前环境不支持实时日志")}};p.id="",p.style.width=G,p.style.height=W,p.width=G*N,p.height=W*N,p.widthNative=0,p.heightNative=0,h.eventLog=function(){for(var e,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];ie.log.apply(ie,["[PLUGIN LOG] "].concat(n)),J&&(e=console).log.apply(e,["[PLUGIN LOG]"].concat(n))},h.timeLog=function(){for(var e,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];ie.log.apply(ie,["[PLUGIN TIME LOG] "].concat(n)),(e=console).log.apply(e,["[PLUGIN TIME LOG] "].concat(n))};var ae,oe,se,ue,ce,le,de,he,fe=a.env.USER_DATA_PATH,ge="__GAME_FILE_CACHE",pe="".concat(fe,"/__GAME_FILE_CACHE"),me="wxfile://__wxprivate__",ve=1024,ye=((k.isPC?2048:h.maxStorage||200)-5)*ve*ve;!function(e){e[e.LONG_VIDEO=0]="LONG_VIDEO",e[e.INTERACTIVE_VIDEO=1]="INTERACTIVE_VIDEO",e[e.COVER_VIEW=2]="COVER_VIEW"}(ae||(ae={})),function(e){e[e.NEED_NOT_DOWNLOAD=0]="NEED_NOT_DOWNLOAD",e[e.NEED_DOWNLOAD=1]="NEED_DOWNLOAD"}(oe||(oe={})),function(e){e[e.GAME_LAUNCH=0]="GAME_LAUNCH",e[e.LOAD_SUBPACKAGE=1]="LOAD_SUBPACKAGE",e[e.COMPILE_WASM=2]="COMPILE_WASM",e[e.LOAD_ASSETS=3]="LOAD_ASSETS",e[e.UNZIP_ASSETS=4]="UNZIP_ASSETS",e[e.READ_ASSETS=5]="READ_ASSETS",e[e.PREPARE_GAME=6]="PREPARE_GAME",e[e.GAME_START=7]="GAME_START",e[e.LOAD_ASSET_BUNDLE=8]="LOAD_ASSET_BUNDLE",e[e.FILE_SYSTEM_INIT=9]="FILE_SYSTEM_INIT",e[e.GET_CONTEXT=10]="GET_CONTEXT",e[e.LOAD_BACKGROUND_IMAGE=11]="LOAD_BACKGROUND_IMAGE",e[e.COVER_VIEW_INIT=12]="COVER_VIEW_INIT"}(se||(se={})),function(e){e[e.DEFAULT=50]="DEFAULT",e[e.UNZIP=51]="UNZIP",e[e.WRITEFILE=52]="WRITEFILE",e[e.RELEASE_ERROR=53]="RELEASE_ERROR",e[e.DELETE_FILE=54]="DELETE_FILE",e[e.EXCEED_MAX=55]="EXCEED_MAX",e[e.QUOTA_CONTROL=56]="QUOTA_CONTROL",e[e.STAT_SIZE_EXCEED=57]="STAT_SIZE_EXCEED",e[e.STAT_SIZE_NORMAL=58]="STAT_SIZE_NORMAL",e[e.OUT_OF_RANGE=59]="OUT_OF_RANGE"}(ue||(ue={})),function(e){e[e.ON_ABORT=100]="ON_ABORT"}(ce||(ce={})),function(e){e[e.WAIT_SUB_WASM_END=30]="WAIT_SUB_WASM_END",e[e.BEFORE_LOAD_SUB_WASM=31]="BEFORE_LOAD_SUB_WASM",e[e.LOAD_SUB_WASM_VERY_EARLY=32]="LOAD_SUB_WASM_VERY_EARLY",e[e.SUB_WASM_LOAD=33]="SUB_WASM_LOAD",e[e.SUB_WASM_COMPILED=34]="SUB_WASM_COMPILED",e[e.FETCH_JS=35]="FETCH_JS",e[e.WRITE_PATCH=36]="WRITE_PATCH",e[e.COMPILE_PATCH=37]="COMPILE_PATCH",e[e.DOWNLOAD_PATCH=38]="DOWNLOAD_PATCH"}(le||(le={})),function(e){e[e.normal=0]="normal",e[e.codeSplit=1]="codeSplit"}(de||(de={})),function(e){e[e.Normal=0]="Normal",e[e.WK=1]="WK"}(he||(he={}));var Te,Se,Ee,we,be={1:"webgl",2:"webgl2"};!function(e){e.AdSpaceType="adSpaceType",e.AdType="adType",e.MaterialType="materialType"}(Te||(Te={})),function(e){e[e.Default=0]="Default",e[e.Min=1]="Min",e[e.Max=200]="Max"}(Se||(Se={})),function(e){e[e.Subpackage=0]="Subpackage",e[e.Cdn=1]="Cdn"}(Ee||(Ee={})),function(e){e.close="0",e.open="1"}(we||(we={}));var Ie="wasmsplit",Pe="filequota",Re=function(){function e(){var t;c(this,e),this.config=(d(t={},Ie,we.open),d(t,Pe,we.close),t)}return l(e,[{key:"init",value:function(e){var t=this;(null==e?void 0:e.length)&&e.forEach((function(e){var n=e.key,i=e.value;t.set(n,i)}))}},{key:"get",value:function(e){return this.config[e]}},{key:"set",value:function(e,t){this.config[e]=t}},{key:"getFeatureString",value:function(){return Object.entries(this.config).map((function(e){var t=u(e,2),n=t[0],i=t[1];return"".concat(n,"_").concat(i)})).join(",")}},{key:"getFeatures",value:function(){return Object.assign({},this.config)}}],[{key:"getInstance",value:function(){return e.instance||(e.instance=new e),e.instance}}]),e}().getInstance(),Ae=O.pixelRatio;function ke(e){return e*Ae}function Le(e){return e.then((function(e){return[null,e]})).catch((function(e){return[e,null]}))}var Ce=function(){var e=[];return function(t){return!("string"!=typeof t||!(t.includes("end of list")||t.includes("still waiting on run dependencies")||t.includes("dependency"))||!e.includes(t)&&(e.push(t),1))}}();function De(e){return!isNaN(e)}function Me(e){return De(e)&&Number.isInteger(e)}function xe(e){var t=Number(e);return t&&!Number.isNaN(t)?Number((t/ve/ve).toFixed(2)):0}function _e(e){var t=Number(e);return t&&!Number.isNaN(t)?Number((t/ve).toFixed(2)):0}var Oe=f(388),Fe=f(662).Z.wx;function Ne(e){(0,Oe.Mi)(e,Fe.getNetworkType,Fe.onNetworkStatusChange)}var Ue=!0;function We(e){Ue=e}function Ge(){return Ue}var Ve,Be=0;function je(e){(function(e){var t=Number(e);return!(!Me(t)||t<200||t>1e4)})(e)&&(Be=Number(e))}function He(){return Be}function Qe(e){return!!(Me(e)&&e>=0&&e<=1e4)}!function(e){e.wifi="wifi",e.unknown="unknow",e.none="none",e["2g"]="2g",e["3g"]="3g",e["4g"]="4g",e["5g"]="5g"}(Ve||(Ve={}));var Ke=function(){function e(){c(this,e)}return l(e,null,[{key:"init",value:function(){Ne((function(t){e.networkType=t}))}}]),e}();Ke.networkType=Ve["4g"],Ke.init();var ze,Xe=f(54),qe=f(835),Ze=a.getAccountInfoSync()||{},Je=J&&Z,Ye=k.isWK&&-1===(0,x.yC)(O.SDKVersion,"2.20.1");!function(e){e.False="0",e.True="1"}(ze||(ze={}));var $e=l((function e(t){var n=this;c(this,e),Object.keys(t).forEach((function(e){n[e]=t[e]}))}));function et(){var e=Ge()?1:0,t=h,n=t.unityVersion,i=t.convertPluginVersion,r=new $e({PluginVersion:L,IsVisible:e,RuntimeType:k.isWK?he.WK:he.Normal,UnityVersion:n,ConvertPluginVersion:i,LibVersion:O.SDKVersion,WechatClientVersion:O.version,InstanceId:P||""});return new Promise((function(e){Ne((function(t){e(Object.assign(Object.assign({},r),{NetworkType:t}))}))}))}var tt,nt,it,rt=Ye?{AppId:Oe.QD.STRING,AppVersion:Oe.QD.UINT,AppState:Oe.QD.UINT}:{},at={logid:21492,protocolParams:(Ye?["AppId","AppVersion","AppState"]:[]).concat(["PluginVersion","IsDownloadCode","ReportType","CostTimeMs","NetworkType","RunTimeMs","PreloadedSize","Scene","LoadingPageType","ExternInfo","CodeType","IsVisible","BenchmarkLevel","RuntimeType","UnityVersion","ConvertPluginVersion","LibVersion","WechatClientVersion","DataPackageLoadType","AdSpaceType","AdType","MaterialType","ABTest","InstanceId"]),schemas:Object.assign(Object.assign({PluginVersion:Oe.QD.STRING,IsDownloadCode:Oe.QD.UINT,ReportType:Oe.QD.UINT,CostTimeMs:Oe.QD.UINT,NetworkType:Oe.QD.STRING,RunTimeMs:Oe.QD.UINT,PreloadedSize:Oe.QD.UINT,Scene:Oe.QD.UINT,LoadingPageType:Oe.QD.UINT,ExternInfo:Oe.QD.STRING,CodeType:Oe.QD.UINT,IsVisible:Oe.QD.UINT,BenchmarkLevel:Oe.QD.INT,RuntimeType:Oe.QD.UINT,UnityVersion:Oe.QD.STRING,ConvertPluginVersion:Oe.QD.STRING,LibVersion:Oe.QD.STRING,WechatClientVersion:Oe.QD.STRING,DataPackageLoadType:Oe.QD.UINT,AdSpaceType:Oe.QD.UINT,AdType:Oe.QD.UINT,MaterialType:Oe.QD.UINT,ABTest:Oe.QD.STRING,InstanceId:Oe.QD.STRING},rt)),asyncGetBase:et,debug:Je},ot={logid:21493,protocolParams:(Ye?["AppId","AppVersion","AppState"]:[]).concat(["PluginVersion","NetworkType","IsDownloadCode","ReportType","ErrorMsg","RunTimeMs","Scene","LoadingPageType","ExternInfo","CodeType","ErrorType","IsVisible","BenchmarkLevel","RuntimeType","UnityVersion","ConvertPluginVersion","LibVersion","WechatClientVersion","DataPackageLoadType","AdSpaceType","AdType","MaterialType","ABTest","InstanceId"]),schemas:Object.assign(Object.assign({PluginVersion:Oe.QD.STRING,NetworkType:Oe.QD.STRING,IsDownloadCode:Oe.QD.UINT,ReportType:Oe.QD.UINT,ErrorMsg:Oe.QD.STRING,RunTimeMs:Oe.QD.UINT,Scene:Oe.QD.UINT,LoadingPageType:Oe.QD.UINT,ExternInfo:Oe.QD.STRING,CodeType:Oe.QD.UINT,ErrorType:Oe.QD.UINT,IsVisible:Oe.QD.UINT,BenchmarkLevel:Oe.QD.INT,RuntimeType:Oe.QD.UINT,UnityVersion:Oe.QD.STRING,ConvertPluginVersion:Oe.QD.STRING,LibVersion:Oe.QD.STRING,WechatClientVersion:Oe.QD.STRING,DataPackageLoadType:Oe.QD.UINT,AdSpaceType:Oe.QD.UINT,AdType:Oe.QD.UINT,MaterialType:Oe.QD.UINT,ABTest:Oe.QD.STRING,InstanceId:Oe.QD.STRING},rt)),asyncGetBase:et,debug:Je},st={logid:21494,protocolParams:(Ye?["AppId","AppVersion","AppState"]:[]).concat(["PluginVersion","IsDownloadCode","NetworkType","RunTimeMs","StageType","Scene","LoadingPageType","ActionType","PositionID","ActionID","ExternInfo","CodeType","IsVisible","BenchmarkLevel","RuntimeType","UnityVersion","ConvertPluginVersion","LibVersion","WechatClientVersion","DataPackageLoadType","AdSpaceType","AdType","MaterialType","ABTest","InstanceId"]),schemas:Object.assign(Object.assign({PluginVersion:Oe.QD.STRING,IsDownloadCode:Oe.QD.UINT,NetworkType:Oe.QD.STRING,RunTimeMs:Oe.QD.UINT,StageType:Oe.QD.STRING,Scene:Oe.QD.UINT,LoadingPageType:Oe.QD.UINT,ActionType:Oe.QD.UINT,PositionID:Oe.QD.UINT,ActionID:Oe.QD.UINT,ExternInfo:Oe.QD.STRING,CodeType:Oe.QD.UINT,IsVisible:Oe.QD.UINT,BenchmarkLevel:Oe.QD.INT,RuntimeType:Oe.QD.UINT,UnityVersion:Oe.QD.STRING,ConvertPluginVersion:Oe.QD.STRING,LibVersion:Oe.QD.STRING,WechatClientVersion:Oe.QD.STRING,DataPackageLoadType:Oe.QD.UINT,AdSpaceType:Oe.QD.UINT,AdType:Oe.QD.UINT,MaterialType:Oe.QD.UINT,ABTest:Oe.QD.STRING,InstanceId:Oe.QD.STRING},rt)),asyncGetBase:et,debug:Je};if(Ye){tt=new qe.Z(Object.assign(Object.assign({},at),{reportType:Oe.C2.KvStat,reportFunc:v})),nt=new qe.Z(Object.assign(Object.assign({},ot),{reportType:Oe.C2.KvStat,reportFunc:v})),it=new qe.Z(Object.assign(Object.assign({},st),{reportType:Oe.C2.KvStat,reportFunc:v})),tt.setKvStatBase(O),nt.setKvStatBase(O),it.setKvStatBase(O);var ut=new $e({AppId:Ze.miniProgram.appId,AppState:_.dg[K]});tt.setBase(ut),nt.setBase(ut),it.setBase(ut)}else tt=new Xe.Z(Object.assign(Object.assign({},at),{reportFunc:m,logid:"WXGameWASMLaunchTime"})),nt=new Xe.Z(Object.assign(Object.assign({},ot),{reportFunc:m,logid:"WXGameWASMLaunchException"})),it=new Xe.Z(Object.assign(Object.assign({},st),{reportFunc:m,logid:"WXGameWASMLaunchClose"}));var ct=function(){function e(){c(this,e)}return l(e,null,[{key:"timeStart",value:function(t){if(!e.timeMap.has(t)){var n=Date.now();return e.timeMap.set(t,n),n}return 0}},{key:"printTime",value:function(t){var n=t.indexOf("callMain耗时")>-1&&h.DO_RUN_START,i=t.indexOf("wasm编译耗时")>-1&&h.WASM_BEGIN_TIME;if(e.timeMap.has(t)||i||n){var r=e.timeEnd(t,!1),a="[PLUGIN TIME LOG ".concat((0,x.p6)(Date.now(),"hh:mm.ss.SSS"),"] ").concat(t,": ").concat((r/1e3).toFixed(2),"s");ie.log(a),console.log(a),e.timeStrList.push(a)}}},{key:"timeEnd",value:function(t){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=t.indexOf("callMain耗时")>-1&&h.DO_RUN_START,r=t.indexOf("wasm编译耗时")>-1&&h.WASM_BEGIN_TIME;if(e.timeMap.has(t)||i||r){var a=Date.now(),o=e.timeMap.get(t);return i&&(o=h.DO_RUN_START),r&&(o=h.WASM_BEGIN_TIME),n&&e.timeMap.delete(t),a-o}return 0}},{key:"getRuntime",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],n=Date.now()-e.logStartTime;return t?+(n/1e3).toFixed(2):n}},{key:"printRuntime",value:function(t){var n="[PLUGIN TIME LOG ".concat((0,x.p6)(Date.now(),"hh:mm.ss.SSS"),"] ").concat(t,": ").concat(e.getRuntime(!0),"s");ie.log(n),console.log(n),n.indexOf("游戏启动耗时")>-1&&(e.timeStrList.push(n),h.hideTimeLogModal||!h.showTimeLogInAllVersion&&K!==_.tE.DEVELOP||(a.showModal({title:"timelog",content:e.timeStrList.join("\r\n")}),e.timeStrList=[]))}},{key:"storeTime",value:function(t){e.storeTimeMap.has(t)||e.storeTimeMap.set(t,{CostTimeMs:e.timeEnd(t),RunTimeMs:e.getRuntime()})}},{key:"popTime",value:function(t){if(e.storeTimeMap.has(t)){var n=e.storeTimeMap.get(t);return e.storeTimeMap.delete(t),n}return null}}]),e}();ct.logStartTime=Date.now(),ct.timeMap=new Map,ct.storeTimeMap=new Map,ct.timeStrList=[];var lt=function(){function e(){c(this,e)}return l(e,null,[{key:"eventLog",value:function(){for(var e,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];ie.log.apply(ie,["[PLUGIN LOG] "].concat(n)),J&&(e=console).log.apply(e,["[PLUGIN LOG ".concat((0,x.p6)(Date.now(),"hh:mm.ss.SSS"),"] ")].concat(n))}},{key:"pluginLog",value:function(){for(var e,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];ie.log.apply(ie,["[PLUGIN LOG] "].concat(n)),J&&Z&&(e=console).log.apply(e,["[PLUGIN LOG ".concat((0,x.p6)(Date.now(),"hh:mm.ss.SSS"),"] ")].concat(n))}},{key:"pluginWarn",value:function(){for(var e,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];ie.warn.apply(ie,["[PLUGIN WARN] "].concat(n)),J&&(e=console).warn.apply(e,["[PLUGIN WARN ".concat((0,x.p6)(Date.now(),"hh:mm.ss.SSS"),"] ")].concat(n))}},{key:"pluginError",value:function(){for(var e,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];ie.warn.apply(ie,["[PLUGIN ERROR] "].concat(n)),re.error.apply(re,["[PLUGIN ERROR] "].concat(n)),J&&(e=console).error.apply(e,["[PLUGIN ERROR ".concat((0,x.p6)(Date.now(),"hh:mm.ss.SSS"),"] ")].concat(n))}}]),e}(),dt=h,ht=dt.bundleHashLength,ft=void 0===ht?32:ht,gt=dt.texturesHashLength,pt=void 0===gt?8:gt,mt=dt.texturesPath,vt=void 0===mt?"Assets/Textures":mt,yt=dt.needCacheTextures,Tt=!1,St="/",Et="data.unityweb",wt=/[^:]\/{2,}/gi,bt=/\.[./]+/gi,It=/[<>]+/gi,Pt=/\\+/gi,Rt=new RegExp("/?__GAME_FILE_CACHE");function At(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return(null==t?void 0:t.length)?kt(t.filter((function(e){var t;return!!(null===(t=null==e?void 0:e.trim)||void 0===t?void 0:t.call(e))})).join(St)):""}function kt(e){return(null==e?void 0:e.trim())?e.replace(bt,"").replace(It,"").replace(wt,(function(e){return e.replace(/\/+/g,St)})):""}function Lt(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(!(null===(t=null==e?void 0:e.trim)||void 0===t?void 0:t.call(e))||e.endsWith(St))return"";var i=n;i&&(i=i.startsWith(".")?i:".".concat(i));var r=e.substring(e.lastIndexOf(St)+1);return r.includes("?")&&(r=r.substring(0,r.indexOf("?"))),r.includes("#")&&(r=r.substring(0,r.indexOf("#"))),r.replace(null==i?void 0:i.toLowerCase(),"").replace(null==i?void 0:i.toUpperCase(),"")}function Ct(e){var t,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!(null===(t=null==e?void 0:e.trim)||void 0===t?void 0:t.call(e)))return"";var i=h.STREAMING_CDN||h.DATA_CDN,r=e.replace(i,"").replace(pe,"").replace(fe,"").replace(me,"");return n&&(r=r.replace(Rt,"")),(r=r.substring(0,r.lastIndexOf(St)))?r.startsWith(St)?r:"/".concat(r):r}function Dt(e){var t,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!(null===(t=null==e?void 0:e.trim)||void 0===t?void 0:t.call(e)))return"";if(e.includes(fe))return e;var i=Ct(e,n),r=Lt(e);if(!Tt){Tt=!0;var a=At(i,r);(a.includes("//")||a.includes("?"))&&lt.pluginError(a,"缓存路径包含//或? 请检查DATA_CDN配置和请求URL是否匹配")}return At(n?pe:fe,i,r)}function Mt(e){var t=Lt(e);if(!t)return"";var n=t.includes(Et),i=e.includes(vt),r=((n?/([a-zA-Z0-9]{16}\.)/gi:i?new RegExp("(.[a-zA-Z0-9]{".concat(pt,"})")):new RegExp("([_-][a-zA-Z0-9]{".concat(ft,"})(\\.\\w+)*$"))).exec(t)||[])[1];return r?t.replace(r,""):t}function xt(e){var t=Lt(e);if(!t)return"";var n=t.includes(Et),i=e.includes(vt),r=(n?/([a-zA-Z0-9]{16})\./gi:i?new RegExp("\\.([a-zA-Z0-9]{".concat(pt,"})")):new RegExp("[_-]([a-zA-Z0-9]{".concat(ft,"})(\\.\\w+)*$"))).exec(t),a="";return r&&(a=u(r,2)[1]),a||""}function _t(e){var t;return!(!(null===(t=null==e?void 0:e.trim)||void 0===t?void 0:t.call(e))||"string"!=typeof e||!e.includes("http"))}function Ot(e){return!!_t(e)&&(!(!yt||!function(e){return!!_t(e)&&!!e.includes(vt)}(e))||h.isCacheableFile(e))}function Ft(e){var t=h.STREAMING_CDN||h.DATA_CDN,n=h.streamingUrlPrefixPath||"",i=e.match(/(http|https|ftp|file):\/\//),r=e;return i||(r=At(t,n,e)),r}function Nt(e){return k.isPC?e.replace(Pt,St):e}var Ut=function(e,t,n,i){return new(n||(n=Promise))((function(r,a){function o(e){try{u(i.next(e))}catch(e){a(e)}}function s(e){try{u(i.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,s)}u((i=i.apply(e,t||[])).next())}))},Wt=function(){function e(){c(this,e),this.inited=!1,this.fileStats=[],this.fileInfoMap=new Map,this.dirs=[],this.fs=Q,this.totalSize=0,this.isOldUser=!1,this.cacheDirInited=!1,this.firstInitPromise=this.init()}return l(e,[{key:"cleanAllCache",value:function(){return Ut(this,void 0,void 0,r.default.mark((function e(){return r.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(this.cleanAllCachePromise||(this.cleanAllCachePromise=this.executeCleanAllTask()),this.cleanAllCachePromise));case 1:case"end":return e.stop()}}),e,this)})))}},{key:"executeCleanAllTask",value:function(){return Ut(this,void 0,void 0,r.default.mark((function e(){var t;return r.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,this.fs.rmdirSync(pe,!0),t=this.isOldUser,this.cacheDirInited=!1,e.next=6,this.init();case 6:return this.isOldUser=t,this.cleanAllCachePromise=null,e.abrupt("return",!0);case 11:return e.prev=11,e.t0=e.catch(0),e.abrupt("return",(lt.pluginError("删除插件缓存目录失败: ",e.t0.errMsg||e.t0.message,e.t0),this.cleanAllCachePromise=null,!1));case 14:case"end":return e.stop()}}),e,this,[[0,11]])})))}},{key:"createCacheDir",value:function(){var e=this.fs,t=pe;try{e.accessSync(t),this.isOldUser=!0}catch(n){e.mkdirSync(t,!0),lt.pluginWarn("".concat(t,"目录不存在,创建目录")),this.isOldUser=!1}return this.isOldUser}},{key:"init",value:function(){return Ut(this,void 0,void 0,r.default.mark((function e(){return r.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(this.initPromise||(this.initPromise=this.executeInit()),this.initPromise));case 1:case"end":return e.stop()}}),e,this)})))}},{key:"executeInit",value:function(){return Ut(this,void 0,void 0,r.default.mark((function e(){return r.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.cacheDirInited||(this.cacheDirInited=!0,this.createCacheDir()),this.dirs=[],this.fileStats=[],this.fileInfoMap=new Map,this.totalSize=0,e.next=7,this.getStats();case 7:this.handleStats(),this.calculateSize(),this.fileStats=[],this.initPromise=null,this.inited=!0,this.checkNeedReportStat();case 13:case"end":return e.stop()}}),e,this)})))}},{key:"checkNeedReportStat",value:function(){this.totalSize>=ye?nt.send(new $e({ReportType:ue.STAT_SIZE_EXCEED,ErrorMsg:"ecceed_max_size",RunTimeMs:ct.getRuntime(),ExternInfo:JSON.stringify({totalSize:this.totalSize,maxAllowSize:ye})})):nt.send(new $e({ReportType:ue.STAT_SIZE_NORMAL,RunTimeMs:ct.getRuntime(),ExternInfo:JSON.stringify({totalSize:this.totalSize,maxAllowSize:ye})}))}},{key:"removeOldCache",value:function(){var e=this,t=this.getErasableFiles(),n={};t.forEach((function(e){var t="".concat(e.dirname,"/").concat(e.shortFilename),i="".concat(e.dirname,"/").concat(e.filename);if(n[t]){n[t].sameFiles.push(i);var r=n[t].latestTime;e.lastAccessedTime>r&&(n[t].latestFile=i,n[t].latestTime=e.lastAccessedTime)}else n[t]={sameFiles:[i],latestFile:i,latestTime:e.lastAccessedTime}})),Object.keys(n).forEach((function(t){n[t].sameFiles.length>1&&e.removeFilesExclude(n[t].latestFile)}))}},{key:"mkdir",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:pe;return new Promise((function(i,r){var a=At(n,e);t.dirs.includes(a)?i(null):t.fs.access({path:a,success:function(){t.dirs.push(a),i(null)},fail:function(){t.fs.mkdir({dirPath:a,recursive:!0,success:function(){t.dirs.push(a),i(null)},fail:function(e){if(e.errMsg.includes("exist"))return i(null);r(e)}})}})}))}},{key:"removeFile",value:function(e,t){var n=this;return new Promise((function(i,a){return Ut(n,void 0,void 0,r.default.mark((function n(){var o,s,u,c,l=this;return r.default.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(e){n.next=2;break}return n.abrupt("return",void i());case 2:if(n.t0=this.initPromise,!n.t0){n.next=6;break}return n.next=6,this.initPromise;case 6:if(!(o=this.findFile(e,!0))){n.next=17;break}if((s=o).isReadyToDelete=!0,!t){n.next=17;break}return n.next=12,this.checkFileExistInSystem(s.path);case 12:if(n.sent){n.next=16;break}return nt.send(new $e({ReportType:ue.DELETE_FILE,ErrorMsg:"file not exist",RunTimeMs:ct.getRuntime(),ExternInfo:JSON.stringify({type:"deletefile",filepath:s.path,totalSize:this.totalSize})})),u=s.size,c=this.totalSize-u,n.abrupt("return",(this.fileInfoMap.delete(s.subPath),this.totalSize=c,void i()));case 16:try{ct.timeStart("删除文件".concat(s.path)),this.fs.unlink({filePath:s.path,success:function(){var e=s.size,t=l.totalSize-e;l.fileInfoMap.delete(s.subPath),l.totalSize=t,lt.pluginLog("删除文件: ".concat(s.shortFilename,", md5:").concat(s.md5,",size:").concat(_e(s.size),"KB,耗时:").concat(ct.timeEnd("删除文件".concat(s.path),!0),"ms")),i()},fail:function(e){a(e)}})}catch(e){lt.pluginError("删除文件失败: ".concat(s.path),e.errMsg||e.message,e),this.init(),nt.send(new $e({ReportType:ue.DELETE_FILE,ErrorMsg:"".concat(e.message||e.errMsg),RunTimeMs:ct.getRuntime(),ExternInfo:JSON.stringify({type:"deletefile",filepath:s.path,totalSize:this.totalSize})})),a(e)}case 17:case"end":return n.stop()}}),n,this)})))}))}},{key:"removeFilesExclude",value:function(e){return Ut(this,void 0,void 0,r.default.mark((function t(){var n,i,a,o,s=this;return r.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=Mt(e),i=xt(e),a=Ct(e),e&&e.trim()&&n&&i){t.next=3;break}return t.abrupt("return");case 3:return(o=(o=this.findFilesByShortFilename(n,a)).filter((function(e){return i&&e.md5&&e.md5!==i}))).length&&lt.pluginLog("删除".concat(n,"旧缓存")),t.next=8,Promise.all(o.map((function(e){return Ut(s,void 0,void 0,r.default.mark((function t(){return r.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.removeFile(e.path,!0);case 2:case"end":return t.stop()}}),t,this)})))})));case 8:case"end":return t.stop()}}),t,this)})))}},{key:"getErasableFiles",value:function(){return Array.from(this.fileInfoMap.values()).filter((function(e){var t=e.erasable,n=e.isReadyToDelete;return!!t&&!n})).filter((function(e){return!h.isErasableFile||h.isErasableFile({path:"".concat(e.dirname,"/").concat(e.filename),filename:e.filename,shortFilename:e.shortFilename,dirname:e.dirname,lastAccessedTime:e.lastAccessedTime,size:e.size,md5:e.md5})})).sort((function(e,t){return e.lastAccessedTime-t.lastAccessedTime}))}},{key:"releaseMemory",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:h.releaseMemorySize||31457280;return Ut(this,void 0,void 0,r.default.mark((function n(){var i,a,o,s,u,c=this;return r.default.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(i=this.getErasableFiles(),a=e-ye+this.totalSize,e&&i&&i.length&&!(a<=0)){n.next=4;break}return n.abrupt("return",Qt.NO_NEED_RELEASE_MEMORY);case 4:if(!(e>ye)){n.next=6;break}return n.abrupt("return",(lt.pluginWarn("所需存储容量".concat(xe(e),"MB超过最大值").concat(xe(ye),"MB, 不执行清理")),Qt.EXCEED_MEMORY));case 6:o=[],s=a=t+a;case 9:if(!(a>0)){n.next=16;break}if(u=i.shift()){n.next=13;break}return n.abrupt("break",16);case 13:u.isReadyToDelete||(u.isReadyToDelete=!0,o.push(u)),a-=u.size;case 14:n.next=9;break;case 16:return o.length&&lt.eventLog("需要释放".concat(xe(s),"MB存储空间")),n.next=19,Promise.all(o.map((function(e){return Ut(c,void 0,void 0,r.default.mark((function t(){return r.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.removeFile(e.path,!0);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})))})));case 19:return n.abrupt("return",Qt.RELEASED_MEMORY);case 20:case"end":return n.stop()}}),n,this)})))}},{key:"addFile",value:function(e){var t=e.size,n=e.path,i=Dt(n);if(!this.findFile(n)){var r=Lt(n),a=Ct(n),o={path:i,subPath:At(a,r),size:t,filename:r,dirname:a,shortFilename:Mt(r),md5:xt(r),lastAccessedTime:parseInt(String(Date.now()/1e3),10),erasable:!0};this.fileInfoMap.set(o.subPath,o),this.totalSize+=t}}},{key:"calculateSize",value:function(){var e,t=this.fileInfoMap.values(),n=0,r=i(t);try{for(r.s();!(e=r.n()).done;){n+=e.value.size}}catch(e){r.e(e)}finally{r.f()}this.totalSize=n}},{key:"getUsedSize",value:function(){return lt.pluginLog("getUsedSize: ".concat(fe,"目录总大小: ").concat(xe(this.totalSize),"MB")),this.totalSize}},{key:"updateAccessTime",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!(e.includes("wxfile://")||e.includes("http://")||e.includes("https://"))||e.includes(fe)){var n=this.findFile(e);n&&(n.lastAccessedTime=parseInt(String(Date.now()/1e3),10),t&&this.fs.readFile({filePath:n.path,success:function(){}}))}}},{key:"findFile",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e||!e.trim())return null;var n=e.includes(ge),i=Ct(e,n),r=Lt(e),a=this.fileInfoMap.get(At(i,r));return!a||!t&&a.isReadyToDelete?null:a}},{key:"getFileInfo",value:function(e){return this.findFile(e)||null}},{key:"findFilesByShortFilename",value:function(e,t){return Array.from(this.fileInfoMap.values()).filter((function(n){return n.shortFilename===e&&n.dirname===t}))}},{key:"isSameFile",value:function(e,t){var n=Ct(e),i=Lt(e),r=t.filename;return n===t.dirname&&i===r}},{key:"checkFileExistInSystem",value:function(e){var t;return Ut(this,void 0,void 0,r.default.mark((function n(){var i;return r.default.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(null===(t=null==e?void 0:e.trim)||void 0===t?void 0:t.call(e)){n.next=2;break}return n.abrupt("return",!1);case 2:return i=Dt(e),n.next=5,this.statAsyncCatch(i);case 5:return n.abrupt("return",!!n.sent);case 6:case"end":return n.stop()}}),n,this)})))}},{key:"statAsyncCatch",value:function(e,t){var n=this;return new Promise((function(i){n.fs.stat({path:e,recursive:t,success:function(e){i(e.stats)},fail:function(t){lt.pluginError("FileSystem_statAsyncCatch: ".concat(e," "),t.errMsg,t),i(null)}})}))}},{key:"statSyncCatch",value:function(e,t){var n=this.fs.statSync;try{return n(e,t)}catch(t){return lt.pluginError("FileSystem_statSyncCatch: ".concat(e," "),t.errMsg||t.message,t),null}}},{key:"handleStats",value:function(){var e=this,t=this.fileStats;t&&Array.isArray(t)&&t.forEach((function(t){var n=e.handleFileInfo(t);e.fileInfoMap.set(At(n.dirname,n.filename),n)}))}},{key:"handleFileInfo",value:function(e){var t=e.path,n=e.stats,i=Nt(t),r=Lt(i),a=i.includes(ge),o=Ct(i,a);return{path:Dt(i,a),subPath:At(o,r),filename:r,dirname:o,shortFilename:Mt(i),md5:xt(i),size:n.size,lastAccessedTime:n.lastAccessedTime,erasable:a}}},{key:"getStats",value:function(){return Ut(this,void 0,void 0,r.default.mark((function e(){var t,n;return r.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=[],!this.inited){e.next=7;break}return e.next=4,this.statAsyncCatch(fe,!0)
回答关注问题邀请回答
收藏

1 个回答

  • Wei
    Wei
    2023-05-16

    错误提示很明显啊,downloadFile:fail exceed max file size 。文件大小超出最大限制了

    2023-05-16
    有用
    回复
登录 后发表内容