!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).gravityengine=t()}(this,function(){"use strict";function j(t,e){var n,i=Object.keys(t);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(t),e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,n)),i}function L(t){for(var e=1;ee.length)&&(t=e.length);for(var n=0,i=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function H(e){e=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0===n)return("string"===t?String:Number)(e);if("object"!=typeof(n=n.call(e,t||"default")))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}(e,"string");return"symbol"==typeof e?e:String(e)}var W="4.8.54",B="MG",K="cocoscreator",Q="https://backend.gravity-engine.com/event_center/api/v1",z=function(){function e(){f(this,e),this.config={persistenceName:"GravityEngine",persistenceNameOld:"GravityEngine_web"}}return d(e,[{key:"getConfig",value:function(){return this.config}},{key:"getStorage",value:function(e,t,n){e=localStorage.getItem(e);if(!t)return S.isJSONString(e)?JSON.parse(e):{};S.isJSONString(e)?n(JSON.parse(e)):n({})}},{key:"setStorage",value:function(e,t){localStorage.setItem(e,t)}},{key:"removeStorage",value:function(e){localStorage.removeItem(e)}},{key:"_setSystemProxy",value:function(e){this._sysCallback=e}},{key:"getSystemInfo",value:function(e){var t=this._getOs(),t={mp_platform:"web",system:t,platform:t,screenWidth:window.screen.width,screenHeight:window.screen.height,systemLanguage:navigator.language};this._sysCallback&&(t=S.extend(t,this._sysCallback(e))),e.success(t),e.complete()}},{key:"_getOs",value:function(){var e=navigator.userAgent;return/Windows/i.test(e)?/Phone/.test(e)||/WPDesktop/.test(e)?"Windows Phone":"Windows":/(iPhone|iPad|iPod)/.test(e)?"iOS":/Android/.test(e)?"Android":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":/Mac/i.test(e)?"MacOS":/Linux/.test(e)?"Linux":/CrOS/.test(e)?"ChromeOS":""}},{key:"getNetworkType",value:function(e){e.complete()}},{key:"onNetworkStatusChange",value:function(){}},{key:"request",value:function(e){var t={},n=new XMLHttpRequest;if(n.open(e.method,e.url),e.header)for(var i in e.header)n.setRequestHeader(i,e.header[i]);return n.onreadystatechange=function(){4===n.readyState&&200===n.status?(t.statusCode=200,S.isJSONString(n.responseText)&&(t.data=JSON.parse(n.responseText)),e.success(t)):200!==n.status&&(t.errMsg="network error",e.fail(t))},n.ontimeout=function(){t.errMsg="timeout",e.fail(t)},n.send(e.data),n}},{key:"initAutoTrackInstance",value:function(e,t){this.instance=e,this.autoTrack=t.autoTrack;var n=this;"onpagehide"in window?window.onpagehide=function(){n.onPageHide(!0)}:window.onbeforeunload=function(){n.onPageHide(!0)},n.onPageShow(),n.autoTrack.appHide&&n.instance.timeEvent("ta_page_hide"),"onvisibilitychange"in document&&(document.onvisibilitychange=function(){document.hidden?n.onPageHide(!1):(n.onPageShow(),n.autoTrack.appHide&&n.instance.timeEvent("ta_page_hide"))})}},{key:"setGlobal",value:function(e,t){window[t]=e}},{key:"getAppOptions",value:function(){}},{key:"showToast",value:function(){}},{key:"onPageShow",value:function(){var e;this.autoTrack.appShow&&(S.extend(e={},this.autoTrack.properties),S.isFunction(this.autoTrack.callback)&&S.extend(e,this.autoTrack.callback("appShow")),this.instance._internalTrack("$WebPageView",e))}},{key:"onPageHide",value:function(e){var t;this.autoTrack.appHide&&(S.extend(t={},this.autoTrack.properties),S.isFunction(this.autoTrack.callback)&&S.extend(t,this.autoTrack.callback("appHide")),this.instance._internalTrack("$WebPageHide",t,new Date,null,e))}}],[{key:"createInstance",value:function(){return new e}}]),e}(),Y=function(){function n(e,t){f(this,n),this.taInstance=e,this.config=t||{},this.referrer="Directly open",this.config.isPlugin?(e.App=function(){App.apply(this,arguments)},inension(e.Page)):(t=App,App=this._initAppExtention(t),e=Page,Page=this._initPageExtension(e))}return d(n,[{key:"_initPageExtension",value:function(r){var o=this;return function(e){var t=e.onLoad,n=e.onShow,i=(e.onShareAppMessage,{});return e.onLoad=function(e){i=e||{},"function"==typeof t&&t.call(this,e)},e.onShow=function(e){o.onPageShow(i),"function"==typeof n&&n.call(this,e)},r(e)}}},{key:"_initAppExtention",value:function(r){var o=this;return function(e){var t=e.onLaunch,n=e.onShow,i=e.onHide;return e.onLaunch=function(e){o.onAppLaunch(e,this),"function"==typeof t&&t.call(this,e)},e.onShow=function(e){o.onAppShow(e),"function"==typeof n&&n.call(this,e)},e.onHide=function(){o.onAppHide(),"function"==typeof i&&i.call(this)},r(e)}}},{key:"onAppLaunch",value:function(e,t){this._setAutoTrackProperties(e),S.isUndefined(t)||(t[this.taInstance.name]=this.taInstance),this.config.appLaunch&&(t={},e&&e.path&&(t.$url_query=S.setQuery(e.query),t.$scene=String(e.scene||e.from)),this.taInstance._internalTrack("$MPLaunch",t))}},{key:"onAppShow",value:function(e){var t;this.config.appHide&&this.taInstance.timeEvent("$MPHide"),this._setAutoTrackProperties(e),this.config.appShow&&(t={},e&&e.path&&(t.$url_path=this._getPath(e.path),t.$url_query=S.setQuery(e.query),t.$scene=String(e.scene||e.from)),S.extend(t,this.config.properties),S.isFunction(this.config.callback)&&S.extend(t,this.config.callback("appShow")),this.taInstance._internalTrack("$MPShow",t))}},{key:"onAppHide",value:function(){var e;this.config.appHide&&(S.extend(e={},this.config.properties),S.isFunction(this.config.callback)&&S.extend(e,this.config.callback("appHide")),this.taInstance._internalTrack("$MPHide",e))}},{key:"_getCurrentPath",value:function(){var e="Not to get";try{var t=getCurrentPages(),e=t[t.length-1].route}catch(e){h.info(e)}return e}},{key:"_setAutoTrackProperties",value:function(e){this.taInstance._setAutoTrackProperties({})}},{key:"_getPath",value:function(e){return"string"==typeof e?e.replace(/^\//,""):"Abnormal values"}},{key:"onPageShare",value:function(e){if(this.config.pageShare){var t=1;try{t=getCurrentPages().length}catch(e){t=1}this.taInstance._internalTrack("$MPShare",{$share_method:"转发消息卡片",$share_depth:t,$url_path:this._getCurrentPath()})}return S.isObject(e)?e:{}}},{key:"onPageShow",value:function(e){var t;this.config.pageShow&&(t=this._getCurrentPath(),S.setQuery(e),this.referrer=t)}}]),n}(),X=function(){function r(t,e,n){var i=this,t=(f(this,r),this.taInstance=t,this.config=e||{},{});try{t=n.getLaunchOptionsSync()}catch(e){t={}}this._onShow(t),this.startTracked=!0,n.onShow(function(e){i._onShow(e)}),n.onHide(function(){var e;i.startTracked=!1,i.config.appHide&&(S.extend(e={},i.config.properties),S.isFunction(i.config.callback)&&S.extend(e,i.config.callback("appHide")),i.taInstance._internalTrack("$MPHide",e))})}return d(r,[{key:"_onShow",value:function(e){var t;S.isObject(e)||(e={}),this.startTracked||(this.config.appHide&&this.taInstance.timeEvent("$MPHide"),this.config.appShow&&(S.extend(t={},this.config.properties),S.isFunction(this.config.callback)&&S.extend(t,this.config.callback("appShow")),this.taInstance._internalTrack("$MPShow",L(L({},t),{},{$scene:String((null==(t=e)?void 0:t.scene)||(null==(t=e)?void 0:t.from)),$url_query:S.setQuery((null==(e=b.getAppOptions())?void 0:e.query)||{})}))))}}]),r}();var Z=function(){function i(e,t,n){f(this,i),this.api=e,this.config=t,this._config=n}return d(i,[{key:"getConfig",value:function(){return this.config}},{key:"getStorage",value:function(e,t,n){if(t)this.api.getStorage({key:e,success:function(e){e=S.isJSONString(e.data)?JSON.parse(e.data):{};n(e)},fail:function(){n({})}});else try{var i,r;return["dd_mp","ali_mp","ali_mg"].includes(this._config.platform)?(i=this.api.getStorageSync({key:e}),S.isJSONString(i.data)?JSON.parse(i.data):{}):(r=this.api.getStorageSync(e),S.isJSONString(r)?JSON.parse(r):S.isObject(r)?r:{})}catch(e){return{}}}},{key:"setStorage",value:function(e,t){try{["ali_mp","tb_mp","dd_mp","ali_mg"].includes(this._config.platform)?this.api.setStorageSync({key:e,data:t}):this.api.setStorageSync(e,t)}catch(e){}}},{key:"removeStorage",value:function(e){try{S.isFunction(this.api.removeStorage)?this.api.removeStorage({key:e}):S.isFunction(this.api.deleteStorage)&&this.api.deleteStorage({key:e})}catch(e){}}},{key:"_getPlatform",value:function(){return""}},{key:"getSystemInfo",value:function(t){var n=this._config.mpPlatform;this.api.getSystemInfo({success:function(e){S.isFunction(n)?e.mp_platform=n(e):e.mp_platform=n,t.success(e),"wechat"===n&&t.complete()},complete:function(){t.complete()}})}},{key:"getNetworkType",value:function(t){S.isFunction(this.api.getNetworkType)?this.api.getNetworkType({success:function(e){t.success(e)},complete:function(){t.complete()}}):(t.success({}),t.complete())}},{key:"onNetworkStatusChange",value:function(e){S.isFunction(this.api.onNetworkStatusChange)?this.api.onNetworkStatusChange(e):e({})}},{key:"request",value:function(t){var e;if("ali_mp"===this._config.platform||"dd_mp"===this._config.platform)return(e=S.extend({},t)).headers=t.header,e.success=function(e){e.statusCode=e.status,t.success(e)},e.fail=function(e){e.errMsg=e.errorMessage,t.fail(e)},"dd_mp"===this._config.platform?this.api.httpRequest(e):this.api.request(e);try{if("taobao_mg"!==this._config.platform)return this.api.request(t);var n=t,i={},r=new XMLHttpRequest;if(r.open(n.method,n.url),n.header)for(var o in n.header)r.setRequestHeader(o,n.header[o]);return r.onreadystatechange=function(){4===r.readyState&&200===r.status?(i.statusCode=200,S.isJSONString(r.responseText)&&(i.data=JSON.parse(r.responseText)),n.success(i)):200!==r.status&&(i.errMsg="network error",n.fail(i))},r.ontimeout=function(){i.errMsg="timeout",n.fail(i)},r.send(JSON.parse(n.data)),r}catch(e){}}},{key:"initAutoTrackInstance",value:function(e,t){return S.isObject(t.autoTrack)&&(t.autoTrack.isPlugin=t.is_plugin),new(this._config.mp?Y:X)(e,t.autoTrack,this.api)}},{key:"setGlobal",value:function(e,t){if(this._config.mp)h.warn("GravityAnalytics: we do not set global name for GE instance when you do not enable auto track.");else if("ali_mg"!==this._config.platform)try{GameGlobal[t]=e}catch(e){}}},{key:"getAppOptions",value:function(e){var t={};try{t=this.api.getLaunchOptionsSync()}catch(e){t={}}if(S.isFunction(e))try{this._config.mp?this.api.onAppShow(e):this.api.onShow(e)}catch(e){h.warn("Cannot register onShow callback.")}return t}},{key:"showToast",value:function(e){var t;S.isFunction(this.api.showToast)&&(t={title:e},"dd_mp"!==this._config.platform&&"ali_mp"!==this._config.platform||(t.content=e),this.api.showToast(t))}}],[{key:"createInstance",value:function(){return this._createInstance("R_CURRENT_PLATFORM")}},{key:"_createInstance",value:function(e){switch(e){case"wechat_mp":return new i(wx,{persistenceName:"GravityEngine",persistenceNameOld:"GravityEngine_wechat"},{mpPlatform:"wechat",mp:!0,platform:e});case"wechat_mg":return new i(wx,{persistenceName:"GravityEngine",persistenceNameOld:"GravityEngine_wechat_game"},{mpPlatform:"wechat",platform:e});case"qq_mp":return new i(qq,{persistenceName:"GravityEngine",persistenceNameOld:"GravityEngine_qq"},{mpPlatform:"qq",mp:!0,platform:e});case"qq_mg":return new i(qq,{persistenceName:"GravityEngine",persistenceNameOld:"GravityEngine_qq_game"},{mpPlatform:"qq",platform:e});case"baidu_mp":return new i(swan,{persistenceName:"GravityEngine",persistenceNameOld:"GravityEngine_swan"},{mpPlatform:function(e){return e.host},mp:!0,platform:e});case"baidu_mg":return new i(swan,{persistenceName:"GravityEngine",persistenceNameOld:"GravityEngine_swan_game"},{mpPlatform:function(e){return e.host},platform:e});case"taobao_mg":return new i(my,{persistenceName:"GravityEngine",persistenceNameOld:"GravityEngine_taobao_game"},{mpPlatform:"taobao",platform:e});case"tt_mg":return new i(tt,{persistenceName:"GravityEngine",persistenceNameOld:"GravityEngine_tt_game"},{mpPlatform:function(e){return e.appName},platform:e});case"tt_mp":return new i(tt,{persistenceName:"GravityEngine",persistenceNameOld:"GravityEngine_tt"},{mpPlatform:function(e){return e.appName},mp:!0,platform:e});case"ali_mp":return new i(my,{persistenceName:"GravityEngine",persistenceNameOld:"GravityEngine_ali"},{mpPlatform:function(e){return e.app},mp:!0,platform:e});case"ali_mg":return new i(my,{persistenceName:"GravityEngine",persistenceNameOld:"GravityEngine_ali_game"},{mpPlatform:function(e){return e.app},platform:e});case"dd_mp":return new i(dd,{persistenceName:"GravityEngine",persistenceNameOld:"GravityEngine_dd"},{mpPlatform:"dingding",mp:!0,platform:e});case"bl_mg":return new i(bl,{persistenceName:"GravityEngine",persistenceNameOld:"GravityEngine_bl_game"},{mpPlatform:"bilibili",platform:e});case"kuaishou_mp":return new i(ks,{persistenceName:"GravityEngine",persistenceNameOld:"GravityEngine_kuaishou_program"},{mpPlatform:"kuaishou",mp:!0,platform:e});case"kuaishou_mg":return new i(ks,{persistenceName:"GravityEngine",persistenceNameOld:"GravityEngine_kuaishou_game"},{mpPlatform:"kuaishou_game",platform:e});case"qh360_mg":return new i(qh,{persistenceName:"GravityEngine",persistenceNameOld:"GravityEngine_qh360"},{mpPlatform:"qh360",platform:e});case"tb_mp":return new i(my,{persistenceName:"GravityEngine",persistenceNameOld:"GravityEngine_tb"},{mpPlatform:"tb",mp:!0,platform:e});case"jd_mp":return new i(jd,{persistenceName:"GravityEngine",persistenceNameOld:"GravityEngine_jd"},{mpPlatform:"jd",mp:!0,platform:e});case"qh360_mp":return new i(qh,{persistenceName:"GravityEngine",persistenceNameOld:"GravityEngine_qh360"},{mpPlatform:"qh360",mp:!0,platform:e});case"WEB":return new z.createInstance}}}]),i}(),ee=d(function e(t,n){var i=this;f(this,e),this.taInstance=t,this.config=n||{},this.config.appShow&&this.taInstance._internalTrack("$MPShow"),this.config.appHide&&this.taInstance.timeEvent("$MPHide"),qg.onShow(function(){var e;i.config.appHide&&i.taInstance.timeEvent("$MPHide"),i.config.appShow&&(S.extend(e={},i.config.properties),S.isFunction(i.config.callback)&&S.extend(e,i.config.callback("appShow")),i.taInstance._internalTrack("$MPShow"))}),qg.onHide(function(){var e;i.config.appHide&&(S.extend(e={},i.config.properties),S.isFunction(i.config.callback)&&S.extend(e,i.config.callback("appHide")),i.taInstance._internalTrack("$MPHide"))})}),te=function(){function e(){f(this,e),this.config={persistenceName:"gravityengine",persistenceNameOld:"gravityengine_qg_vivo_game",asyncPersistence:!0}}return d(e,[{key:"getConfig",value:function(){return this.config||{}}},{key:"getStorage",value:function(e,t,n){if(!t)return t=qg.getStorageSync({key:e}),S.isJSONString(t)?JSON.parse(t):{};qg.getStorage({key:e,success:function(e){e=S.isJSONString(e)?JSON.parse(e):{};n(e)},fail:function(){n({})}})}},{key:"setStorage",value:function(e,t){qg.setStorage({key:e,value:t})}},{key:"removeStorage",value:function(e){qg.deleteStorage({key:e})}},{key:"getSystemInfo",value:function(i){qg.getSystemInfo({success:function(e){var t=e,n=[e.osType,e.osVersionName].join(" ");t.brand=e.manufacturer,t.system=n,t.mp_platform="vivo_qg",i.success(t)},complete:function(){i.complete()}})}},{key:"getQuickDevice",value:function(n){var i={os_name:"android",android_id:"",imei:"",oaid:"",mac:"",android_version:"",api_version:0,rom:{gravityengine_qg_huawei_game:"EMUI",gravityengine_qg:"MIUI",gravityengine_qg_oppo_game:"ColorOS",gravityengine_qg_vivo_game:"FuntouchOS",gravityengine_qg_mz_game:"Flyme"}[n.platform],rom_version:"",phone_brand:"",phone_model:""};qg.getSystemInfo({success:function(e){var t;i.android_version=e.system,i.api_version=e.platformVersionCode,i.rom_version=e.COREVersion,i.phone_brand=e.brand,i.phone_model=e.model,qg.getOAID&&(e=null!=(t=null==(t=(e=qg).getOAID)?void 0:t.call(e).oaid)?t:"",i.android_id=e,i.imei=e,i.oaid=e),n.success(i)}})}},{key:"getNetworkType",value:function(n){qg.getNetworkType({success:function(e){var t=e;t.networkType=e.type,n.success(t)},complete:function(){n.complete()}})}},{key:"onNetworkStatusChange",value:function(n){qg.subscribeNetworkStatus({callback:function(e){var t=e;t.networkType=e.type,n(t)}})}},{key:"request",value:function(t){return qg.request({url:t.url,data:t.data,method:t.method,header:t.header,success:function(e){t.success(e)},fail:function(e){t.fail(e)}})}},{key:"initAutoTrackInstance",value:function(e,t){return new ee(e,t.autoTrack)}},{key:"setGlobal",value:function(e,t){globalThis[t]=e}},{key:"getAppOptions",value:function(){try{if(!qg.getLaunchOptionsSync)return{};var e=qg.getLaunchOptionsSync(),t=e.referrerInfo.extraData,n=e.query.internal,i=n&&n.channel?n.channel:"";if(t)return{query:t,scene:""};if("deeplink"!==i)return{};var r,o=n.custom_params,a=JSON.parse(o).cus_origin_uri,s=new URLSearchParams(a.split("?")[1]),c={},u=V(s);try{for(u.s();!(r=u.n()).done;){var l=F(r.value,2),p=l[0],f=l[1];c[p]=f}}catch(e){u.e(e)}finally{u.f()}return{query:c,scene:""}}catch(e){return{}}}},{key:"showToast",value:function(e){qg.showToast({message:e,duration:0})}}],[{key:"createInstance",value:function(){return new e}}]),e}(),ne=d(function e(t,n,i){var r=this;f(this,e),this.taInstance=t,this.config=n||{},this.config.appShow&&(S.extend(t={},this.config.properties),S.isFunction(this.config.callback)&&S.extend(t,this.config.callback("appShow")),this.taInstance._internalTrack("$MPShow",t)),this.config.appHide&&this.taInstance.timeEvent("$MPHide"),i.onShow(function(){var e;r.config.appHide&&r.taInstance.timeEvent("$MPHide"),r.config.appShow&&(S.extend(e={},r.config.properties),S.isFunction(r.config.callback)&&S.extend(e,r.config.callback("appShow")),r.taInstance._internalTrack("$MPShow",e))}),i.onHide(function(){var e;r.config.appHide&&(S.extend(e={},r.config.properties),S.isFunction(r.config.callback)&&S.extend(e,r.config.callback("appHide")),r.taInstance._internalTrack("$MPHide",e))})}),ie=function(){function i(e,t,n){f(this,i),this.api=e,this.config=t,this._config=n}return d(i,[{key:"getConfig",value:function(){return this.config||{}}},{key:"getStorage",value:function(e,t,n){e=localStorage.getItem(e);if(!t)return S.isJSONString(e)?JSON.parse(e):{};S.isJSONString(e)?n(JSON.parse(e)):n({})}},{key:"setStorage",value:function(e,t){localStorage.setItem(e,t)}},{key:"removeStorage",value:function(e){localStorage.removeItem(e)}},{key:"getSystemInfo",value:function(t){var n=this._config.mpPlatform;this.api.getSystemInfo({success:function(e){e.mp_platform=n,t.success(e)},complete:function(){t.complete()}})}},{key:"getQuickDevice",value:function(n){var i={os_name:"android",android_id:"",imei:"",oaid:"",mac:"",android_version:"",api_version:0,rom:{gravityengine_qg_huawei_game:"EMUI",gravityengine_qg:"MIUI",gravityengine_qg_oppo_game:"ColorOS",gravityengine_qg_vivo_game:"FuntouchOS",gravityengine_qg_mz_game:"Flyme"}[n.platform],rom_version:"",phone_brand:"",phone_model:""},r=this;this.api.getSystemInfo({success:function(e){function t(){n.success(i)}i.android_version=e.system,i.api_version=e.platformVersionCode,i.rom_version=e.COREVersion,i.phone_brand=e.brand,i.phone_model=e.model,r.api.getDeviceId?r.api.getDeviceId({success:function(e){i.android_id=e.deviceId,i.imei=e.deviceId,i.oaid=e.deviceId,t()}}):r.api.getOAID?r.api.getOAID({success:function(e){i.android_id=e.oaid,i.imei=e.oaid,i.oaid=e.oaid,t()}}):t()}})}},{key:"getNetworkType",value:function(t){this.api.getNetworkType({success:function(e){t.success(e)},complete:function(){t.complete()}})}},{key:"onNetworkStatusChange",value:function(t){this.api.onNetworkStatusChange({callback:function(e){t(e)}})}},{key:"request",value:function(e){var t={},n=new XMLHttpRequest;if(n.open(e.method,e.url),e.header)for(var i in e.header)n.setRequestHeader(i,e.header[i]);return n.onreadystatechange=function(){4===n.readyState&&200===n.status?(t.statusCode=200,S.isJSONString(n.responseText)&&(t.data=JSON.parse(n.responseText)),e.success(t)):200!==n.status&&(t.errMsg="network error",e.fail(t))},n.ontimeout=function(){t.errMsg="timeout",e.fail(t)},n.send(e.data),n}},{key:"initAutoTrackInstance",value:function(e,t){return new ne(e,t.autoTrack,this.api)}},{key:"setGlobal",value:function(e,t){globalThis[t]=e}},{key:"getAppOptions",value:function(){var e=this._config.mpPlatform;if("oppo_qg"===e)return this.api.getEnterOptionsSync();var t=this.api.getLaunchOptionsSync();if("huawei_qg"!==e)return t;if(S.isObject(t))return t;if(S.isString(t))try{return JSON.parse(t)}catch(e){}return{}}},{key:"showToast",value:function(e){this.api.showToast({title:e,icon:"none",duration:2e3})}}],[{key:"createInstance",value:function(){return this._createInstance("R_CURRENT_PLATFORM")}},{key:"_createInstance",value:function(e){switch(e){case"oppo":return new i(qg,{persistenceName:"gravityengine",persistenceNameOld:"gravityengine_qg_oppo_game"},{mpPlatform:"oppo_qg"});case"honor":return new i(qg,{persistenceName:"gravityengine",persistenceNameOld:"gravityengine_qg_honor_game"},{mpPlatform:"honor_qg"});case"huawei":return new i(hbs,{persistenceName:"gravityengine",persistenceNameOld:"gravityengine_qg_huawei_game"},{mpPlatform:"huawei_qg"});case"mz":return new i(qg,{persistenceName:"gravityengine",persistenceNameOld:"gravityengine_qg_mz_game"},{mpPlatform:"mz"});case"xiaomi":return new i(qg,{persistenceName:"gravityengine",persistenceNameOld:"gravityengine_qg_xiaomi_game"},{mpPlatform:"xiaomi"})}}}]),i}(),re=function(){function e(){f(this,e)}return d(e,null,[{key:"createInstance",value:function(){var n,e=Object.freeze({WECHAT_GAME:104,QQ_PLAY:105,BAIDU_GAME:107,VIVO_GAME:108,OPPO_GAME:109,HUAWEI_GAME:110,XIAOMI_GAME:111,BYTEDANCE_GAME:117,QTT_GAME:116,LINKSURE:119,ALIPAY_GAME:113,HONOR_MINIGAME:123,TAOBAO_MINIGAME:121,TAOBAO_MINI_GAME:"TAOBAO_MINI_GAME",WECHAT_MINI_GAME:"WECHAT_GAME",HONOR_MINI_GAME:"HONOR_MINI_GAME",BAIDU_MINI_GAME:"BAIDU_MINI_GAME",XIAOMI_QUICK_GAME:"XIAOMI_QUICK_GAME",OPPO_MINI_GAME:"OPPO_MINI_GAME",VIVO_MINI_GAME:"VIVO_MINI_GAME",HUAWEI_QUICK_GAME:"HUAWEI_QUICK_GAME",BYTEDANCE_MINI_GAME:"BYTEDANCE_MINI_GAME",QTT_MINI_GAME:"QTT_MINI_GAME",LINKSURE_MINI_GAME:"LINKSURE_MINI_GAME",ALIPAY_MINI_GAME:"ALIPAY_MINI_GAME"});return cc.sys.platform===e.WECHAT_GAME||cc.sys.platform===e.WECHAT_MINI_GAME?Z._createInstance("wechat_mg"):cc.sys.platform===e.BAIDU_GAME||cc.sys.platform===e.BAIDU_MIN_GAME?Z._createInstance("baidu_mg"):cc.sys.platform===e.TAOBAO_MINI_GAME||cc.sys.platform===e.TAOBAO_MINIGAME?Z._createInstance("taobao_mg"):cc.sys.platform===e.VIVO_GAME||cc.sys.platform===e.VIVO_MINI_GAME?te.createInstance():cc.sys.platform===e.QQ_PLAY?Z._createInstance("qq_mg"):cc.sys.platform===e.OPPO_GAME||cc.sys.platform===e.OPPO_MINI_GAME?ie._createInstance("oppo"):cc.sys.platform===e.HUAWEI_GAME||cc.sys.platform===e.HUAWEI_QUICK_GAME?ie._createInstance("huawei"):cc.sys.platform===e.HONOR_MINIGAME||cc.sys.platform===e.HONOR_MINI_GAME?ie._createInstance("honor"):cc.sys.platform===e.XIAOMI_GAME||cc.sys.platform===e.XIAOMI_QUICK_GAME?ie._createInstance("xiaomi"):cc.sys.platform===e.ALIPAY_GAME||cc.sys.platform===e.ALIPAY_MINI_GAME?Z._createInstance("ali_mg"):cc.sys.platform===e.BYTEDANCE_GAME||cc.sys.platform===e.BYTEDANCE_MINI_GAME?Z._createInstance("tt_mg"):((n=z.createInstance())._sysCallback=function(){return{system:cc.sys.os.replace(" ","")+" "+cc.sys.osVersion}},n.getNetworkType=function(e){var t={};switch(cc.sys.getNetworkType()){case cc.sys.NetworkType.LAN:t.networkType="WIFI";break;case cc.sys.NetworkType.WWAN:t.networkType="WWAN";break;default:t.networkType="NONE"}e.success(t),e.complete()},n.getSystemInfo=function(e){var t={mp_platform:cc.sys.platform.toString(),system:n._getOs(),screenWidth:window.screen.width,screenHeight:window.screen.height};n._sysCallback&&(t=S.extend(t,n._sysCallback(e))),e.success(t),e.complete()},n)}}]),e}(),b=function(){function e(){f(this,e)}return d(e,null,[{key:"_getCurrentPlatform",value:function(){return this.currentPlatform||(this.currentPlatform=re.createInstance())}},{key:"getConfig",value:function(){return this._getCurrentPlatform().getConfig()}},{key:"getStorage",value:function(e,t,n){return this._getCurrentPlatform().getStorage(e,t,n)}},{key:"setStorage",value:function(e,t){return this._getCurrentPlatform().setStorage(e,t)}},{key:"removeStorage",value:function(e){return this._getCurrentPlatform().removeStorage(e)}},{key:"getSystemInfo",value:function(e){return this._getCurrentPlatform().getSystemInfo(e)}},{key:"getNetworkType",value:function(e){return this._getCurrentPlatform().getNetworkType(e)}},{key:"getQuickDevice",value:function(e){return this._getCurrentPlatform().getQuickDevice(e)}},{key:"onNetworkStatusChange",value:function(e){this._getCurrentPlatform().onNetworkStatusChange(e)}},{key:"request",value:function(e){return this._getCurrentPlatform().request(e)}},{key:"initAutoTrackInstance",value:function(e,t){return this._getCurrentPlatform().initAutoTrackInstance(e,t)}},{key:"setGlobal",value:function(e,t){e&&t&&this._getCurrentPlatform().setGlobal(e,t)}},{key:"getAppOptions",value:function(e){return this._getCurrentPlatform().getAppOptions(e)}},{key:"showDebugToast",value:function(e){this._getCurrentPlatform().showToast(e)}}]),e}(),S={},e=Array.prototype,t=Object.prototype,oe=e.slice,ae=t.toString,se=Object.prototype.hasOwnProperty,ce=e.forEach,t=Array.isArray,ue={};function le(){return new RegExp(/(.*?)\.?([^.]*?)\.(com|net|org|biz|ws|in|me|co\.uk|co|org\.uk|ltd\.uk|plc\.uk|me\.uk|edu|mil|br\.com|cn\.com|eu\.com|hu\.com|no\.com|qc\.com|sa\.com|se\.com|se\.net|us\.com|uy\.com|ac|co\.ac|gv\.ac|or\.ac|ac\.ac|af|am|as|at|ac\.at|co\.at|gv\.at|or\.at|asn\.au|com\.au|edu\.au|org\.au|net\.au|id\.au|be|ac\.be|adm\.br|adv\.br|am\.br|arq\.br|art\.br|bio\.br|cng\.br|cnt\.br|com\.br|ecn\.br|eng\.br|esp\.br|etc\.br|eti\.br|fm\.br|fot\.br|fst\.br|g12\.br|gov\.br|ind\.br|inf\.br|jor\.br|lel\.br|med\.br|mil\.br|net\.br|nom\.br|ntr\.br|odo\.br|org\.br|ppg\.br|pro\.br|psc\.br|psi\.br|rec\.br|slg\.br|tmp\.br|tur\.br|tv\.br|vet\.br|zlg\.br|br|ab\.ca|bc\.ca|mb\.ca|nb\.ca|nf\.ca|ns\.ca|nt\.ca|on\.ca|pe\.ca|qc\.ca|sk\.ca|yk\.ca|ca|cc|ac\.cn|net\.cn|com\.cn|edu\.cn|gov\.cn|org\.cn|bj\.cn|sh\.cn|tj\.cn|cq\.cn|he\.cn|nm\.cn|ln\.cn|jl\.cn|hl\.cn|js\.cn|zj\.cn|ah\.cn|gd\.cn|gx\.cn|hi\.cn|sc\.cn|gz\.cn|yn\.cn|xz\.cn|sn\.cn|gs\.cn|qh\.cn|nx\.cn|xj\.cn|tw\.cn|hk\.cn|mo\.cn|cn|cx|cz|de|dk|fo|com\.ec|tm\.fr|com\.fr|asso\.fr|presse\.fr|fr|gf|gs|co\.il|net\.il|ac\.il|k12\.il|gov\.il|muni\.il|ac\.in|co\.in|org\.in|ernet\.in|gov\.in|net\.in|res\.in|is|it|ac\.jp|co\.jp|go\.jp|or\.jp|ne\.jp|ac\.kr|co\.kr|go\.kr|ne\.kr|nm\.kr|or\.kr|li|lt|lu|asso\.mc|tm\.mc|com\.mm|org\.mm|net\.mm|edu\.mm|gov\.mm|ms|nl|no|nu|pl|ro|org\.ro|store\.ro|tm\.ro|firm\.ro|www\.ro|arts\.ro|rec\.ro|info\.ro|nom\.ro|nt\.ro|se|si|com\.sg|org\.sg|net\.sg|gov\.sg|sk|st|tf|ac\.th|co\.th|go\.th|mi\.th|net\.th|or\.th|tm|to|com\.tr|edu\.tr|gov\.tr|k12\.tr|net\.tr|org\.tr|com\.tw|org\.tw|net\.tw|ac\.uk|uk\.com|uk\.net|gb\.com|gb\.net|vg|sh|kz|ch|info|ua|gov|name|pro|ie|hk|com\.hk|org\.hk|net\.hk|edu\.hk|us|tk|cd|by|ad|lv|eu\.lv|bz|es|jp|cl|ag|mobi|eu|co\.nz|org\.nz|net\.nz|maori\.nz|iwi\.nz|io|la|md|sc|sg|vc|tw|travel|my|se|tv|pt|com\.pt|edu\.pt|asia|fi|com\.ve|net\.ve|fi|org\.ve|web\.ve|info\.ve|co\.ve|tel|im|gr|ru|net\.ru|org\.ru|hr|com\.hr|ly|xyz)$/)}function pe(e,t){var n=e.charAt(0),t=t.split(n);return n===e?t:t[(e=parseInt(e.substring(1),10))<0?t.length+e:e-1]}function fe(e,t){for(var n,i=e.charAt(0),r=t.split("&"),o=[],a={},s=e.substring(1),c=0,u=r.length;c>6|192,63&a|128):String.fromCharCode(a>>12|224,a>>6&63|128,63&a|128),null!==s&&(i>12&63,n=r>>6&63,i=63&r,u[s++]=o.charAt(r>>18&63)+o.charAt(t)+o.charAt(n)+o.charAt(i),ae.length)&&(t=e.length);for(var n=0,i=new Array(t);nc[u])return 1;if(c[u]>s[u])return-1}else if(e||t)return e?-1:1;return 0}var ut=/^v?(?:\d+)(\.(?:[x*]|\d+)(\.(?:[x*]|\d+)(\.(?:[x*]|\d+))?(?:-[\da-z\-]+(?:\.[\da-z\-]+)*)?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,lt=function(e){if("string"!=typeof e)throw new TypeError("Invalid argument expected string");if(!ut.test(e))throw new Error("Invalid argument not valid semver ('".concat(e,"' received)"))},pt=function(e){return isNaN(Number(e))?e:Number(e)},ft=function(e){var e=e.replace(/^v/,"").replace(/\+.*$/,""),t=-1===(t=e).indexOf("-")?t.length:t.indexOf("-"),n=e.substring(0,t).split(".");return n.push(e.substring(t+1)),n};function dt(e,t){return Object.prototype.hasOwnProperty.call(e,t)}n(ht,null,[{key:"error",value:function(e){for(var t,n=arguments.length,i=new Array(1=this.maxLength?(t="队列长度超过最大限制".concat(this.maxLength,"条,SDK将按照行为优先级排序,丢弃优先级最低的行为事件"),m.warn(t),Qe({user_action_set_id:this.userActionSetId,log_type:y.JS_QUEUE_LOG,message:t}),t=this.sortQueue(e,n),m.debug&&m.info("超过".concat(this.maxLength,"条按优先级排序的队列:"),t.concat([])),n=t.pop(),this.updateAllStack(t),this.updateLostAction((null==n?void 0:n.session_id)||"")):this.addItem(e),this.updateToStorage()}},{key:"removeActions",value:function(e){this.removeItems(e),this.updateToStorage()}},{key:"updateActionsForReportFail",value:function(e){this.updateForReportFail(e),this.updateToStorage()}},{key:"updateActionsForReporting",value:function(e){this.updateForReporting(e),this.updateToStorage()}},{key:"getReportableActionsLength",value:function(){var e=this.getItems().filter(function(e){return(null==e?void 0:e.inner_status)!==(null==i?void 0:i.reporting)});return null==e?void 0:e.length}},{key:"sortQueue",value:function(e,t){function n(e){return r[e.action_id]||(r[e.action_id]=i.caculateWeight(o,e)),r[e.action_id]}var i=this,r={},o=null==e?void 0:e.action_time,t=t.concat([e]);return t.sort(function(e,t){return n(t)-n(e)})}},{key:"caculateWeight",value:function(e,t){var n=0,i=this.formatWeight(e,null==t?void 0:t.action_time),r=i.ogWeight,o=i.sdkWeight,i=i.userWeight,a=(null!=(a=this.ogEvents)&&a.includes(null==t?void 0:t.action_type)&&(n+=r),null!=t&&t.is_sdk_auto_track?n+=o:n+=i,e-(null==t?void 0:t.action_time)+1);return 0>16)+(t>>16)+(n>>16)<<16|65535&n}function rn(e,t,n,i,r,o){return nn((t=nn(nn(t,e),nn(i,o)))<>>32-r,n)}function N(e,t,n,i,r,o,a){return rn(t&n|~t&i,e,t,r,o,a)}function P(e,t,n,i,r,o,a){return rn(t&i|n&~i,e,t,r,o,a)}function T(e,t,n,i,r,o,a){return rn(t^n^i,e,t,r,o,a)}function C(e,t,n,i,r,o,a){return rn(n^(t|~i),e,t,r,o,a)}function on(e,t){e[t>>5]|=128<>>9<<4)]=t;for(var n,i,r,o,a=1732584193,s=-271733879,c=-1732584194,u=271733878,l=0;l>5]>>>i%32&255);return t}function sn(e){var t=[];for(t[(e.length>>2)-1]=void 0,i=0;i>5]|=(255&e.charCodeAt(i/8))<>>4&15)+n.charAt(15&t);return i}function un(e){return unescape(encodeURIComponent(e))}function ln(e){return an(on(sn(e=un(e)),8*e.length))}function pn(e,t){var n,e=un(e),t=un(t),i=sn(e),r=[],o=[];for(r[15]=o[15]=void 0,16>>6)+R(128|63&t):R(224|t>>>12&15)+R(128|t>>>6&63)+R(128|63&t):(t=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320),R(240|t>>>18&7)+R(128|t>>>12&63)+R(128|t>>>6&63)+R(128|63&t))}function gn(e,t,n,i){for(var r,o=1>18&63]+yn[t>>12&63]+yn[t>>6&63]+yn[63&t]}return o?r.slice(0,o-3)+"===".substring(o):r}),_n=e?function(e){return Buffer.from(e).toString("base64")}:function(e){for(var t=[],n=0,i=e.length;n=this.reportThreshold||(t=(null==(e=this.configManager)?void 0:e.getRealTimeActionList())||v.realTimeActionList,n.some(function(e){return-1=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(i);try{for(o.s();!(r=o.n()).done;){var a=r.value;if(function(e,t){try{if(0===e.length)return t.length;if(0===t.length)return e.length;for(var n=[],i=0;i<=t.length;i++)n[i]=[i];for(var r=0;r<=e.length;r++)n[0][r]=r;for(var o=1;o<=t.length;o++)for(var a=1;a<=e.length;a++)t.charAt(o-1)===e.charAt(a-1)?n[o][a]=n[o-1][a-1]:n[o][a]=Math.min(n[o-1][a-1]+1,n[o][a-1]+1,n[o-1][a]+1);return n[t.length][e.length]}catch(n){m.error(n)}}(a,n)<=parseInt((.3*a.length).toString())){m.warn("通过SDK上报的".concat(n,"行为名称可能有误,请检查该行为类型是否为腾讯广告提供的标准行为!").concat(Nn));break}}}catch(n){o.e(n)}finally{o.f()}}}catch(i){m.error(i)}if("minigame"===t){var s,c,u,l=e,p=t;try{["PURCHASE","ADD_TO_CART"].includes(l.action_type)&&l.action_param&&dt(l.action_param,"value")&&("number"!=typeof(null==(s=l.action_param)?void 0:s.value)?m.warn("通过SDK上报的".concat(l.action_type,"行为携带的金额参数需要为数字!")):(null==(c=l.action_param)?void 0:c.value)<=0?m.warn("通过SDK上报的".concat(l.action_type,"行为携带的金额参数需要大于0!")):"minigame"===p&&(null==(u=l.action_param)?void 0:u.value)<100&&m.warn("通过SDK上报的".concat(l.action_type,"行为携带的金额参数可能有误,金额的单位为‘分’,请检查金额是否正确!").concat(Nn)))}catch(l){m.error(l)}}else if("miniprogram"===t){var f=e;try{var d=null==f?void 0:f.action_type,h=(null==f?void 0:f.action_param)||{};"PURCHASE"===d&&dt(h,"value")&&("number"!=typeof(null==h?void 0:h.value)?m.warn("通过SDK上报的".concat(d,"行为携带的金额参数需要为数字!")):(null==h?void 0:h.value)<=0&&m.warn("通过SDK上报的".concat(d,"行为携带的金额参数需要大于0!")))}catch(d){m.error(d)}}}}catch(e){m.error(e)}}function xn(e){try{e&&!/^[a-zA-Z0-9_\-]+$/.test(e)&&m.warn("通过SDK上报的openid:".concat(e,"可能有误,请检查openid是否正确!").concat(Nn))}catch(e){m.error(e)}}function Mn(e,t,n,i){for(var r,o=1n?m.error("监测到超过".concat(n,"的上报日志:").concat(e," ").concat(t)):(i=!(null==t||!t[Gn]),n=this.createAction(e,t||{},i),"release"!==(null==(e=Ke())?void 0:e.envVersion)&&Dn(n,"minigame"),null!=(t=this.queueManage)&&t.addAction(n),null!=(i=this.actionReporter)&&i.batchSend()))}},{key:"flush",value:function(){var e;null!=(e=this.actionReporter)&&e.flushSend()}},{key:"setOpenId",value:function(e){var t;e&&"string"==typeof e?(this.openid=e,this.gameInfo.ad_trace_id&&!a.getSync(Ge)&&k.publish("START_APP"),this.flush(),this.saveValidOpenidToStorage(),"release"!==(null==(t=Ke())?void 0:t.envVersion)&&xn(e)):m.error("openid 格式错误")}},{key:"setUnionId",value:function(e){e&&"string"==typeof e?(this.unionid=e,this.flush()):m.error("unionid 格式错误")}},{key:"setUserUniqueId",value:function(e){e&&"string"==typeof e?this.user_unique_id=e:m.error("user_unique_id 格式错误")}},{key:"doReportOnEnterBackground",value:function(){var t=this;wx.onHide(function(){var e;null!=(e=t.actionReporter)&&e.flushSend(),null!=(e=t.queueManage)&&e.reportLostNum()})}},{key:"getTrackBaseInfo",value:function(){var t,n,e=Ke();return Object.assign({},this.deviceInfo,(t=this.config,n={},["user_action_set_id","appid","openid","secret_key","user_unique_id","unionid"].forEach(function(e){dt(t,e)&&(n[e]=t[e])}),n),{local_id:He(),sdk_name:this.sdk_name,sdk_version:this.sdk_version,openid:this.openid||Be(),unionid:this.unionid,user_unique_id:this.user_unique_id,inner_param:{app_env_version:e.envVersion,app_version:e.version}})}},{key:"createAction",value:function(e,t){var n=2=r.maxSdkInstance?m.error("初始化超过上限"):(i=function(e){{if(ot(e)){var t,n=["user_action_set_id","secret_key","appid","openid","unionid","user_unique_id","auto_track","auto_attr"];for(t in e)n.includes(t)||m.warn("Invalid property '".concat(t,"' found in config"));return"number"!=typeof e.user_action_set_id?"user_action_set_id 参数需为 number 类型":e.user_action_set_id<=0?"user_action_set_id 参数需大于 0":"string"!=typeof e.secret_key?"secret_key 参数需为 string 类型":""===e.secret_key.trim()?"缺少 secret_key 参数":32!==e.secret_key.length?"secret_key 参数需为 32 位字符串":"string"!=typeof e.appid?"appid 参数需为 string 类型":""!==e.appid.trim()||"缺少 appid"}return"初始化参数需为 object 类型"}}(e),n=Ke(),!0!==i?m.error(i):(i=null==n?void 0:n.appId)&&i!==e.appid?m.error("初始化失败,传入的appid与当前小游戏appid不一致"):(dt(t.config=e,"auto_track")||(t.config.auto_track=v.autoTrack),t.openid=e.openid,t.unionid=e.unionid,t.user_unique_id=e.user_unique_id,t.saveValidOpenidToStorage(),i=e.user_action_set_id,$n[qn].includes(i)?m.error("请勿重复初始化SDK"):(t.reportLog=t.reportLog.bind(Se(t)),t.getTrackBaseInfo=t.getTrackBaseInfo.bind(Se(t)),t.deviceInfo=Ve(),t.gameInfo=vt(),t.session_id=st(),t.queueManage=new _({userActionSetId:i,maxLength:r.maxQueueLength,ogEvents:Et}),t.actionReporter=new An({getBaseInfo:t.getTrackBaseInfo,reportLog:t.reportLog,queueManager:t.queueManage,configManager:Mt}),t.inited=!0,$n[qn].push(i),t.useAutoTrack(),t.doReportOnEnterBackground(),"release"===(null==n?void 0:n.envVersion)?m.info("初始化成功"):(r={conf_name:"mini_game_sdk_common",conf_key:"version",sdk_version:t.sdk_version,default_download_url:"https://sr-home-1257214331.cos.ap-guangzhou.myqcloud.com/sdk/dn-sdk-minigame/dn-sdk-minigame.zip",fail_handler:function(){t.inited=!1}},o=r.sdk_version,a=r.default_download_url,s=r.fail_handler,Xe({conf_name:r.conf_name,conf_key:r.conf_key}).then(function(e){var t,n,i,r;if(ot(e))return t=null==e?void 0:e.blackVersions,n=null==e?void 0:e.minVersion,i=null==e?void 0:e.bestVersion,e=null==e?void 0:e.downloadUrl,r=a,e&&/^https/.test(e)&&(r=e),u(t)&&-1<(null==t?void 0:t.indexOf(o))?(null!=s&&s(),void m.error("初始化失败!当前SDK版本存在兼容问题,请尽快升级至最新版!下载地址:".concat(r))):n&&ct(o,n)<0?(null!=s&&s(),void m.error("初始化失败!当前SDK版本过低,请尽快升级至最新版!下载地址:".concat(r))):(i&&ct(o,i)<0&&m.warn("新版本SDK已上线,强烈建议您升级至最新版,尽早享受新特性!下载地址:".concat(r)),void m.info("初始化成功"));m.info("初始化成功")}).catch(function(){m.info("初始化成功")}),Pn.requestActionList(),xn(e.openid)))))):m.error("SDK只可以用在微信小游戏中使用"),be(t)}x[qn]=[],Mn([o,yt],x.prototype,"track",1),Mn([o,yt],x.prototype,"flush",1),Mn([o],x.prototype,"setOpenId",1),Mn([o],x.prototype,"setUnionId",1),Mn([o],x.prototype,"setUserUniqueId",1),Mn([o],x.prototype,"doReportOnEnterBackground",1),Mn([o],x.prototype,"getTrackBaseInfo",1),Mn([o],x.prototype,"useAutoTrack",1);var Jn=function(){function s(e,t,n,i,r,o,a){f(this,s),this.data=e,this.serverUrl=t,this.callback=a,this.debugMode=r,this.platFormName=o,this.tryCount=S.isNumber(n)?n:1,this.permissionTryCount=6,this.timeout=S.isNumber(i)?i:3e3,this.taClassName="HttpTask"}return d(s,[{key:"run",value:function(){var e,n=this,t=S.createExtraHeaders(),i=(t["content-type"]="application/json","debug"===this.debugMode&&(t["Turbo-Debug-Mode"]=1),"GravityEngine_ali_game"===this.platFormName?"headers":"header"),r=b.request((U(e={url:this.serverUrl,method:"POST",data:this.data},i,t),U(e,"success",function(e){var t;0===(null==e||null==(t=e.data)?void 0:t.code)?n.onSuccess(e):n.onFailed(e)}),U(e,"fail",function(e){n.onFailed(e)}),e));setTimeout(function(){if((S.isObject(r)||S.isPromise(r))&&S.isFunction(r.abort))try{r.abort()}catch(e){}},this.timeout)}},{key:"onSuccess",value:function(e){var t,n;200===e.statusCode?(n="Data Verified",null!=e&&null!=(t=e.data)&&null!=(t=t.extra)&&null!=(t=t.errors)&&t.length&&(n=e.data.extra.errors),this.callback({code:null==e||null==(t=e.data)?void 0:t.code,msg:n})):this.callback({code:(null==e?void 0:e.statusCode)||-3,msg:e.statusCode})}},{key:"onFailed",value:function(e){var t,n=this;0<--this.tryCount?setTimeout(function(){n.run()},1e3):this.callback({code:-3,msg:"".concat(null==e||null==(t=e.data)?void 0:t.msg,":").concat(null==e||null==(t=e.data)||null==(t=t.extra)?void 0:t.error)})}}]),s}(),Vn=new(function(){function e(){f(this,e),this.items=[],this.isRunning=!1,this.showDebug=!1}return d(e,[{key:"enqueue",value:function(e,t,n){var i=!(3