觉醒时刻
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
juexingshike/assets/Scripts/gravityengine.mg.cocoscreat...

1 lines
90 KiB

"use strict";function ownKeys(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 _objectSpread2(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?ownKeys(Object(n),!0).forEach(function(e){_defineProperty(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ownKeys(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function _regeneratorRuntime(){_regeneratorRuntime=function(){return o};var o={},e=Object.prototype,c=e.hasOwnProperty,u=Object.defineProperty||function(e,t,n){e[t]=n.value},t="function"==typeof Symbol?Symbol:{},i=t.iterator||"@@iterator",n=t.asyncIterator||"@@asyncIterator",r=t.toStringTag||"@@toStringTag";function a(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{a({},"")}catch(e){a=function(e,t,n){return e[t]=n}}function s(e,t,n,i){var r,a,o,s,t=t&&t.prototype instanceof h?t:h,t=Object.create(t.prototype),i=new S(i||[]);return u(t,"_invoke",{value:(r=e,a=n,o=i,s="suspendedStart",function(e,t){if("executing"===s)throw new Error("Generator is already running");if("completed"===s){if("throw"===e)throw t;return{value:void 0,done:!0}}for(o.method=e,o.arg=t;;){var n=o.delegate;if(n){n=function e(t,n){var i=n.method,r=t.iterator[i];if(void 0===r)return n.delegate=null,"throw"===i&&t.iterator.return&&(n.method="return",n.arg=void 0,e(t,n),"throw"===n.method)||"return"!==i&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+i+"' method")),p;i=l(r,t.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,p;r=i.arg;return r?r.done?(n[t.resultName]=r.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=void 0),n.delegate=null,p):r:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,p)}(n,o);if(n){if(n===p)continue;return n}}if("next"===o.method)o.sent=o._sent=o.arg;else if("throw"===o.method){if("suspendedStart"===s)throw s="completed",o.arg;o.dispatchException(o.arg)}else"return"===o.method&&o.abrupt("return",o.arg);s="executing";n=l(r,a,o);if("normal"===n.type){if(s=o.done?"completed":"suspendedYield",n.arg===p)continue;return{value:n.arg,done:o.done}}"throw"===n.type&&(s="completed",o.method="throw",o.arg=n.arg)}})}),t}function l(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}o.wrap=s;var p={};function h(){}function f(){}function g(){}var t={},d=(a(t,i,function(){return this}),Object.getPrototypeOf),d=d&&d(d(b([]))),m=(d&&d!==e&&c.call(d,i)&&(t=d),g.prototype=h.prototype=Object.create(t));function _(e){["next","throw","return"].forEach(function(t){a(e,t,function(e){return this._invoke(t,e)})})}function v(o,s){var t;u(this,"_invoke",{value:function(n,i){function e(){return new s(function(e,t){!function t(e,n,i,r){var a,e=l(o[e],o,n);if("throw"!==e.type)return(n=(a=e.arg).value)&&"object"==typeof n&&c.call(n,"__await")?s.resolve(n.__await).then(function(e){t("next",e,i,r)},function(e){t("throw",e,i,r)}):s.resolve(n).then(function(e){a.value=e,i(a)},function(e){return t("throw",e,i,r)});r(e.arg)}(n,i,e,t)})}return t=t?t.then(e,e):e()}})}function y(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function k(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function S(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(y,this),this.reset(!0)}function b(t){if(t||""===t){var n,e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length))return n=-1,(e=function e(){for(;++n<t.length;)if(c.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e}).next=e}throw new TypeError(typeof t+" is not iterable")}return u(m,"constructor",{value:f.prototype=g,configurable:!0}),u(g,"constructor",{value:f,configurable:!0}),f.displayName=a(g,r,"GeneratorFunction"),o.isGeneratorFunction=function(e){e="function"==typeof e&&e.constructor;return!!e&&(e===f||"GeneratorFunction"===(e.displayName||e.name))},o.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,g):(e.__proto__=g,a(e,r,"GeneratorFunction")),e.prototype=Object.create(m),e},o.awrap=function(e){return{__await:e}},_(v.prototype),a(v.prototype,n,function(){return this}),o.AsyncIterator=v,o.async=function(e,t,n,i,r){void 0===r&&(r=Promise);var a=new v(s(e,t,n,i),r);return o.isGeneratorFunction(t)?a:a.next().then(function(e){return e.done?e.value:a.next()})},_(m),a(m,r,"Generator"),a(m,i,function(){return this}),a(m,"toString",function(){return"[object Generator]"}),o.keys=function(e){var t,n=Object(e),i=[];for(t in n)i.push(t);return i.reverse(),function e(){for(;i.length;){var t=i.pop();if(t in n)return e.value=t,e.done=!1,e}return e.done=!0,e}},o.values=b,S.prototype={constructor:S,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(k),!e)for(var t in this)"t"===t.charAt(0)&&c.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(n){if(this.done)throw n;var i=this;function e(e,t){return a.type="throw",a.arg=n,i.next=e,t&&(i.method="next",i.arg=void 0),!!t}for(var t=this.tryEntries.length-1;0<=t;--t){var r=this.tryEntries[t],a=r.completion;if("root"===r.tryLoc)return e("end");if(r.tryLoc<=this.prev){var o=c.call(r,"catchLoc"),s=c.call(r,"finallyLoc");if(o&&s){if(this.prev<r.catchLoc)return e(r.catchLoc,!0);if(this.prev<r.finallyLoc)return e(r.finallyLoc)}else if(o){if(this.prev<r.catchLoc)return e(r.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<r.finallyLoc)return e(r.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;0<=n;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&c.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var r=i;break}}var a=(r=r&&("break"===e||"continue"===e)&&r.tryLoc<=t&&t<=r.finallyLoc?null:r)?r.completion:{};return a.type=e,a.arg=t,r?(this.method="next",this.next=r.finallyLoc,p):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),p},finish:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),k(n),p}},catch:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var n,i,r=this.tryEntries[t];if(r.tryLoc===e)return"throw"===(n=r.completion).type&&(i=n.arg,k(r)),i}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:b(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),p}},o}function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function asyncGeneratorStep(e,t,n,i,r,a,o){try{var s=e[a](o),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(i,r)}function _asyncToGenerator(s){return function(){var e=this,o=arguments;return new Promise(function(t,n){var i=s.apply(e,o);function r(e){asyncGeneratorStep(i,t,n,r,a,"next",e)}function a(e){asyncGeneratorStep(i,t,n,r,a,"throw",e)}r(void 0)})}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,_toPropertyKey(i.key),i)}}function _createClass(e,t,n){return t&&_defineProperties(e.prototype,t),n&&_defineProperties(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function _defineProperty(e,t,n){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _toPrimitive(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);n=n.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}function _toPropertyKey(e){e=_toPrimitive(e,"string");return"symbol"==typeof e?e:String(e)}var Config={LIB_VERSION:"4.8.1",LIB_NAME:"MG",LIB_STACK:"cocoscreator",BASE_URL:"https://backend.gravity-engine.com/event_center/api/v1"},_={},ArrayProto=Array.prototype,ObjProto=Object.prototype,slice=ArrayProto.slice,nativeToString=ObjProto.toString,nativeHasOwnProperty=Object.prototype.hasOwnProperty,nativeForEach=ArrayProto.forEach,nativeIsArray=Array.isArray,breaker={},logger$1=(_.isNumber=function(e){return"number"==typeof e?0==e-e:"string"==typeof e&&""!==e.trim()&&(Number.isFinite?Number.isFinite(+e):isFinite(+e))},_.each=function(e,t,n){if(null==e)return!1;if(nativeForEach&&e.forEach===nativeForEach)e.forEach(t,n);else if(e.length===+e.length){for(var i=0,r=e.length;i<r;i++)if(i in e&&t.call(n,e[i],i,e)===breaker)return!1}else for(var a in e)if(nativeHasOwnProperty.call(e,a)&&t.call(n,e[a],a,e)===breaker)return!1},_.sleep=function(t){return new Promise(function(e){return setTimeout(e,t)})},_.extend=function(n){return _.each(slice.call(arguments,1),function(e){for(var t in e)void 0!==e[t]&&(n[t]=e[t])}),n},_.extend2Layers=function(n){return _.each(slice.call(arguments,1),function(e){for(var t in e)void 0!==e[t]&&(_.isObject(e[t])&&_.isObject(n[t])?_.extend(n[t],e[t]):n[t]=e[t])}),n},_.isArray=nativeIsArray||function(e){return"[object Array]"===nativeToString.call(e)},_.isFunction=function(e){try{return"function"==typeof e}catch(e){return!1}},_.isPromise=function(e){return"[object Promise]"===nativeToString.call(e)&&null!=e},_.isObject=function(e){return"[object Object]"===nativeToString.call(e)&&null!=e},_.isEmptyObject=function(e){if(_.isObject(e)){for(var t in e)if(nativeHasOwnProperty.call(e,t))return!1;return!0}return!1},_.isUndefined=function(e){return void 0===e},_.isString=function(e){return"[object String]"===nativeToString.call(e)},_.isDate=function(e){return"[object Date]"===nativeToString.call(e)},_.isBoolean=function(e){return"[object Boolean]"===nativeToString.call(e)},_.isNumber=function(e){return"[object Number]"===nativeToString.call(e)&&/[\d\.]+/.test(String(e))},_.isJSONString=function(e){try{JSON.parse(e)}catch(e){return!1}return!0},_.decodeURIComponent=function(t){var n="";try{n=decodeURIComponent(t)}catch(e){n=t}return n},_.encodeURIComponent=function(t){var n="";try{n=encodeURIComponent(t)}catch(e){n=t}return n},_.utf8Encode=function(e){for(var t,n="",i=t=0,r=(e=(e+"").replace(/\r\n/g,"\n").replace(/\r/g,"\n")).length,a=0;a<r;a++){var o=e.charCodeAt(a),s=null;o<128?t++:s=127<o&&o<2048?String.fromCharCode(o>>6|192,63&o|128):String.fromCharCode(o>>12|224,o>>6&63|128,63&o|128),null!==s&&(i<t&&(n+=e.substring(i,t)),n+=s,i=t=a+1)}return i<t&&(n+=e.substring(i,e.length)),n},_.base64Encode=function(e){var t,n,i,r,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",o=0,s=0,c="",u=[];if(!e)return e;for(e=_.utf8Encode(e);t=(r=e.charCodeAt(o++)<<16|e.charCodeAt(o++)<<8|e.charCodeAt(o++))>>12&63,n=r>>6&63,i=63&r,u[s++]=a.charAt(r>>18&63)+a.charAt(t)+a.charAt(n)+a.charAt(i),o<e.length;);switch(c=u.join(""),e.length%3){case 1:c=c.slice(0,-2)+"==";break;case 2:c=c.slice(0,-1)+"="}return c},_.encodeDates=function(i){return _.each(i,function(e,t){if(_.isDate(e))i[t]=_.formatDate(e);else if(_.isObject(e))i[t]=_.encodeDates(e);else if(_.isArray(e))for(var n=0;n<e.length;n++)_.isDate(e[n])&&(i[t][n]=_.formatDate(e[n]))}),i},_.formatDate=function(e){function t(e){return e<10?"0"+e:e}return e.getFullYear()+"-"+t(e.getMonth()+1)+"-"+t(e.getDate())+" "+t(e.getHours())+":"+t(e.getMinutes())+":"+t(e.getSeconds())+"."+((e=e.getMilliseconds())<100&&9<e?"0"+e:e<10?"00"+e:e)},_.searchObjDate=function(n){try{(_.isObject(n)||_.isArray(n))&&_.each(n,function(e,t){_.isObject(e)||_.isArray(e)?_.searchObjDate(n[t]):_.isDate(e)&&(n[t]=_.formatDate(e))})}catch(e){logger$1.warn(e)}},_.UUID=function(){var e=(new Date).getTime();return String(Math.random()).replace(".","").slice(1,11)+"-"+e},_.UUIDv4=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})},_.setMpPlatform=function(e){_.mpPlatform=e},_.getMpPlatform=function(){return _.mpPlatform},_.createExtraHeaders=function(){return{"GE-Integration-Type":Config.LIB_NAME,"GE-Integration-Version":Config.LIB_VERSION,"GE-Integration-Count":"1","GE-Integration-Extra":_.getMpPlatform()}},_.checkAppId=function(e){if("number"==typeof e)e=String(e);else if("string"!=typeof e)return"";return e=e.replace(/\s*/g,"")},_.checkUrl=function(e){return e=e.replace(/\s*/g,""),e=_.url("basic",e)},_.url=function(){function r(){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 a(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 o(e,t){for(var n,i=e.charAt(0),r=t.split("&"),a=[],o={},s=e.substring(1),c=0,u=r.length;c<u;c++)if(""!==(a=(a=r[c].match(/(.*?)=(.*)/))||[r[c],r[c],""])[1].replace(/\s/g,"")){if(a[2]=(n=a[2]||"",_.decodeURIComponent(n.replace(/\+/g," "))),s===a[1])return a[2];(n=a[1].match(/(.*)\[([0-9]+)\]/))?(o[n[1]]=o[n[1]]||[],o[n[1]][n[2]]=a[2]):o[a[1]]=a[2]}return i===e?o:o[s]}return function(e,t){var n,i={};if("tld?"===e)return r();if(t=t||window.location.toString(),!e)return t;if(e=e.toString(),t.match(/^mailto:([^/].+)/))n=t.match(/^mailto:([^/].+)/),i.protocol="mailto",i.email=n[1];else{if((t=t.match(/(.*?)\/#!(.*)/)?(n=t.match(/(.*?)\/#!(.*)/))[1]+n[2]:t).match(/(.*?)#(.*)/)&&(n=t.match(/(.*?)#(.*)/),i.hash=n[2],t=n[1]),i.hash&&e.match(/^#/))return o(e,i.hash);if(t.match(/(.*?)\?(.*)/)&&(n=t.match(/(.*?)\?(.*)/),i.query=n[2],t=n[1]),i.query&&e.match(/^\?/))return o(e,i.query);if(t.match(/(.*?):?\/\/(.*)/)&&(n=t.match(/(.*?):?\/\/(.*)/),i.protocol=n[1].toLowerCase(),t=n[2]),t.match(/(.*?)(\/.*)/)&&(n=t.match(/(.*?)(\/.*)/),i.path=n[2],t=n[1]),i.path=(i.path||"").replace(/^([^/])/,"/$1").replace(/\/$/,""),(e=e.match(/^[-0-9]+$/)?e.replace(/^([^/])/,"/$1"):e).match(/^\//))return a(e,i.path.substring(1));if((n=(n=a("/-1",i.path.substring(1)))&&n.match(/(.*?)\.(.*)/))&&(i.file=n[0],i.filename=n[1],i.fileext=n[2]),t.match(/(.*):([0-9]+)$/)&&(n=t.match(/(.*):([0-9]+)$/),i.port=n[2],t=n[1]),t.match(/(.*?)@(.*)/)&&(n=t.match(/(.*?)@(.*)/),i.auth=n[1],t=n[2]),i.auth&&(n=i.auth.match(/(.*):(.*)/),i.user=n?n[1]:i.auth,i.pass=n?n[2]:void 0),i.hostname=t.toLowerCase(),"."===e.charAt(0))return a(e,i.hostname);r()&&(n=i.hostname.match(r()))&&(i.tld=n[3],i.domain=n[2]?n[2]+"."+n[3]:void 0,i.sub=n[1]||void 0);t=i.port?":"+i.port:"";i.protocol=i.protocol||window.location.protocol.replace(":",""),i.port=i.port||("https"===i.protocol?"443":"80"),i.protocol=i.protocol||("443"===i.port?"https":"http"),i.basic=i.protocol+"://"+i.hostname+t}return e in i?i[e]:"{}"===e?i:""}}(),_.createString=function(e){for(var t=e,n=Math.random().toString(36).substr(2);n.length<t;)n+=Math.random().toString(36).substr(2);return n=n.substr(0,e)},_.createAesKey=function(){return _.createString(16)},_.setQuery=function(e){var t,n=[];for(t in e)e.hasOwnProperty(t)&&n.push(encodeURIComponent(t)+"="+encodeURIComponent(e[t]));return n.join("&")},_.generateEncryptyData=function(e,t){if(void 0!==t){var n=t.publicKey,t=t.version;if(void 0!==n&&void 0!==t&&"undefined"!=typeof CryptoJS&&"undefined"!=typeof JSEncrypt){var i=_.createAesKey();try{var r=CryptoJS.enc.Utf8.parse(i),a=CryptoJS.enc.Utf8.parse(JSON.stringify(e)),o=_.isUndefined(CryptoJS.pad.Pkcs7)?CryptoJS.pad.PKCS7:CryptoJS.pad.Pkcs7,s=CryptoJS.AES.encrypt(a,r,{mode:CryptoJS.mode.ECB,padding:o}).toString(),c=new JSEncrypt,u=(c.setPublicKey(n),c.encrypt(i));return!1===u?(logger$1.warn("私钥加密失败,返回原数据"),e):{pkv:t,ekey:u,payload:s}}catch(e){logger$1.warn("数据加密失败,返回原数据: "+e)}}}return e},"object"===_typeof(logger$1)?logger$1:{}),PlatformProxy=(logger$1.info=function(){if("object"===("undefined"==typeof console?"undefined":_typeof(console))&&console.log&&logger$1.enabled)try{return console.log.apply(console,arguments)}catch(e){console.log(arguments[0])}},logger$1.warn=function(){if("object"===("undefined"==typeof console?"undefined":_typeof(console))&&console.log&&logger$1.enabled)try{return console.warn.apply(console,arguments)}catch(e){console.warn(arguments[0])}},function(){function e(){_classCallCheck(this,e),this.config={persistenceName:"GravityEngine",persistenceNameOld:"GravityEngine_mg"}}return _createClass(e,[{key:"getConfig",value:function(){return this.config}},{key:"getStorage",value:function(e,t,n){e=localStorage.getItem(e);if(!t)return _.isJSONString(e)?JSON.parse(e):{};_.isJSONString(e)?n(JSON.parse(e)):n({})}},{key:"setStorage",value:function(e,t){localStorage.setItem(e,t)}},{key:"_setSystemProxy",value:function(e){this._sysCallback=e}},{key:"getSystemInfo",value:function(e){var t={mp_platform:"web",system:this._getOs(),screenWidth:window.screen.width,screenHeight:window.screen.height,systemLanguage:navigator.language};this._sysCallback&&(t=_.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,_.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&&(_.extend(e={},this.autoTrack.properties),_.isFunction(this.autoTrack.callback)&&_.extend(e,this.autoTrack.callback("appShow")),this.instance._internalTrack("$WebPageView",e))}},{key:"onPageHide",value:function(e){var t;this.autoTrack.appHide&&(_.extend(t={},this.autoTrack.properties),_.isFunction(this.autoTrack.callback)&&_.extend(t,this.autoTrack.callback("appHide")),this.instance._internalTrack("$WebPageHide",t,new Date,null,e))}}],[{key:"createInstance",value:function(){return new e}}]),e}()),AutoTrackBridge=function(){function n(e,t){_classCallCheck(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 _createClass(n,[{key:"_initPageExtension",value:function(a){var o=this;return function(e){var t=e.onLoad,n=e.onShow,i=e.onShareAppMessage,r={};return e.onLoad=function(e){r=e||{},"function"==typeof t&&t.call(this,e)},e.onShow=function(e){o.onPageShow(r),"function"==typeof n&&n.call(this,e)},"function"==typeof i&&(e.onShareAppMessage=function(e){e=i.call(this,e);return o.onPageShare(e)}),a(e)}}},{key:"_initAppExtention",value:function(r){var a=this;return function(e){var t=e.onLaunch,n=e.onShow,i=e.onHide;return e.onLaunch=function(e){a.onAppLaunch(e,this),"function"==typeof t&&t.call(this,e)},e.onShow=function(e){a.onAppShow(e),"function"==typeof n&&n.call(this,e)},e.onHide=function(){a.onAppHide(),"function"==typeof i&&i.call(this)},r(e)}}},{key:"onAppLaunch",value:function(e,t){this._setAutoTrackProperties(e),_.isUndefined(t)||(t[this.taInstance.name]=this.taInstance),this.config.appLaunch&&(t={},e&&e.path&&(t.$url_query=_.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=_.setQuery(e.query),t.$scene=String(e.scene||e.from)),_.extend(t,this.config.properties),_.isFunction(this.config.callback)&&_.extend(t,this.config.callback("appShow")),this.taInstance._internalTrack("$MPShow",t))}},{key:"onAppHide",value:function(){var e;this.config.appHide&&(_.extend(e={},this.config.properties),_.isFunction(this.config.callback)&&_.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){logger$1.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 _.isObject(e)?e:{}}},{key:"onPageShow",value:function(e){var t;this.config.pageShow&&(e={$url_path:(t=this._getCurrentPath())||"The system did not get a value",$url_query:_.setQuery(e)},this.referrer=t,this.taInstance._internalTrack("$MPViewScreen",e))}}]),n}(),AutoTrackBridge$1=function(){function r(e,t,n){var i=this,e=(_classCallCheck(this,r),this.taInstance=e,this.config=t||{},n.getLaunchOptionsSync());this._onShow(e),this.startTracked=!0,n.onShow(function(e){i._onShow(e)}),n.onHide(function(){var e;i.startTracked=!1,i.config.appHide&&(_.extend(e={},i.config.properties),_.isFunction(i.config.callback)&&_.extend(e,i.config.callback("appHide")),i.taInstance._internalTrack("$MPHide",e))})}return _createClass(r,[{key:"_onShow",value:function(e){var t;this.startTracked||(this.config.appHide&&this.taInstance.timeEvent("$MPHide"),this.config.appShow&&(_.extend(t={},this.config.properties),_.isFunction(this.config.callback)&&_.extend(t,this.config.callback("appShow")),this.taInstance._internalTrack("$MPShow",_objectSpread2(_objectSpread2({},t),{},{$scene:String(e.scene||e.from),$url_query:_.setQuery(PlatformAPI.getAppOptions().query)}))))}}]),r}(),PlatformProxy$1=function(){function i(e,t,n){_classCallCheck(this,i),this.api=e,this.config=t,this._config=n}return _createClass(i,[{key:"getConfig",value:function(){return this.config}},{key:"getStorage",value:function(e,t,n){if(!t)return"dd_mp"===this._config.platform?(t=this.api.getStorageSync({key:e}),_.isJSONString(t.data)?JSON.parse(t.data):{}):(t=this.api.getStorageSync(e),_.isJSONString(t)?JSON.parse(t):{});this.api.getStorage({key:e,success:function(e){e=_.isJSONString(e.data)?JSON.parse(e.data):{};n(e)},fail:function(){logger$1.warn("getStorage faild"),n({})}})}},{key:"setStorage",value:function(e,t){this.api.setStorage({key:e,data:t})}},{key:"_getPlatform",value:function(){return""}},{key:"getSystemInfo",value:function(t){var n=this._config.mpPlatform;this.api.getSystemInfo({success:function(e){_.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){_.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){_.isFunction(this.api.onNetworkStatusChange)?this.api.onNetworkStatusChange(e):e({})}},{key:"request",value:function(t){var e;return"ali_mp"===this._config.platform||"dd_mp"===this._config.platform?((e=_.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)):this.api.request(t)}},{key:"initAutoTrackInstance",value:function(e,t){return _.isObject(t.autoTrack)&&(t.autoTrack.isPlugin=t.is_plugin),new(this._config.mp?AutoTrackBridge:AutoTrackBridge$1)(e,t.autoTrack,this.api)}},{key:"setGlobal",value:function(e,t){this._config.mp?logger$1.warn("GravityAnalytics: we do not set global name for GE instance when you do not enable auto track."):GameGlobal[t]=e}},{key:"getAppOptions",value:function(e){var t={};try{t=this.api.getLaunchOptionsSync()}catch(e){logger$1.warn("Cannot get launch options.")}if(_.isFunction(e))try{this._config.mp?this.api.onAppShow(e):this.api.onShow(e)}catch(e){logger$1.warn("Cannot register onShow callback.")}return t}},{key:"showToast",value:function(e){var t;_.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"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"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_mg"},{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 PlatformProxy.createInstance}}}]),i}(),AutoTrackBridge$2=_createClass(function e(t,n){var i=this;_classCallCheck(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&&(_.extend(e={},i.config.properties),_.isFunction(i.config.callback)&&_.extend(e,i.config.callback("appShow")),i.taInstance._internalTrack("$MPShow"))}),qg.onHide(function(){var e;i.config.appHide&&(_.extend(e={},i.config.properties),_.isFunction(i.config.callback)&&_.extend(e,i.config.callback("appHide")),i.taInstance._internalTrack("$MPHide"))})}),PlatformProxy$2=function(){function e(){_classCallCheck(this,e),this.config={persistenceName:"gravityengine",persistenceNameOld:"gravityengine_qg_vivo_game",asyncPersistence:!0}}return _createClass(e,[{key:"getConfig",value:function(){return this.config||{}}},{key:"getStorage",value:function(e,t,n){if(!t)return t=qg.getStorageSync({key:e}),_.isJSONString(t)?JSON.parse(t):{};qg.getStorage({key:e,success:function(e){e=_.isJSONString(e)?JSON.parse(e):{};n(e)},fail:function(){n({})}})}},{key:"setStorage",value:function(e,t){qg.setStorage({key:e,value:t})}},{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 AutoTrackBridge$2(e,t.autoTrack)}},{key:"setGlobal",value:function(e,t){globalThis[t]=e}},{key:"getAppOptions",value:function(){return{}}},{key:"showToast",value:function(e){qg.showToast({message:e,duration:0})}}],[{key:"createInstance",value:function(){return new e}}]),e}(),AutoTrackBridge$3=_createClass(function e(t,n,i){var r=this;_classCallCheck(this,e),this.taInstance=t,this.config=n||{},this.config.appShow&&(_.extend(t={},this.config.properties),_.isFunction(this.config.callback)&&_.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&&(_.extend(e={},r.config.properties),_.isFunction(r.config.callback)&&_.extend(e,r.config.callback("appShow")),r.taInstance._internalTrack("$MPShow",e))}),i.onHide(function(){var e;r.config.appHide&&(_.extend(e={},r.config.properties),_.isFunction(r.config.callback)&&_.extend(e,r.config.callback("appHide")),r.taInstance._internalTrack("$MPHide",e))})}),PlatformProxy$3=function(){function i(e,t,n){_classCallCheck(this,i),this.api=e,this.config=t,this._config=n}return _createClass(i,[{key:"getConfig",value:function(){return this.config||{}}},{key:"getStorage",value:function(e,t,n){e=localStorage.getItem(e);if(!t)return _.isJSONString(e)?JSON.parse(e):{};_.isJSONString(e)?n(JSON.parse(e)):n({})}},{key:"setStorage",value:function(e,t){localStorage.setItem(e,t)}},{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,_.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 AutoTrackBridge$3(e,t.autoTrack,this.api)}},{key:"setGlobal",value:function(e,t){globalThis[t]=e}},{key:"getAppOptions",value:function(){return this.api.getLaunchOptionsSync()}},{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"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"},{mpPlatform:"xiaomi"})}}}]),i}(),PlatformProxyCC=function(){function e(){_classCallCheck(this,e)}return _createClass(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,WECHAT_MINI_GAME:"WECHAT_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"});return cc.sys.platform===e.WECHAT_GAME||cc.sys.platform===e.WECHAT_MINI_GAME?PlatformProxy$1._createInstance("wechat_mg"):cc.sys.platform===e.BAIDU_GAME||cc.sys.platform===e.BAIDU_MIN_GAME?PlatformProxy$1._createInstance("baidu_mg"):cc.sys.platform===e.VIVO_GAME||cc.sys.platform===e.VIVO_MINI_GAME?PlatformProxy$2.createInstance():cc.sys.platform===e.QQ_PLAY?PlatformProxy$1._createInstance("qq_mg"):cc.sys.platform===e.OPPO_GAME||cc.sys.platform===e.OPPO_MINI_GAME?PlatformProxy$3._createInstance("oppo"):cc.sys.platform===e.HUAWEI_GAME||cc.sys.platform===e.HUAWEI_QUICK_GAME?PlatformProxy$3._createInstance("huawei"):cc.sys.platform===e.XIAOMI_GAME||cc.sys.platform===e.XIAOMI_QUICK_GAME?PlatformProxy$3._createInstance("xiaomi"):cc.sys.platform===e.BYTEDANCE_GAME||cc.sys.platform===e.BYTEDANCE_MINI_GAME?PlatformProxy$1._createInstance("tt_mg"):((n=PlatformProxy.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=_.extend(t,n._sysCallback(e))),e.success(t),e.complete()},n)}}]),e}(),PlatformAPI=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"_getCurrentPlatform",value:function(){return this.currentPlatform||(this.currentPlatform=PlatformProxyCC.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:"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}(),KEY_NAME_MATCH_REGEX=/^\$?[a-zA-Z][a-zA-Z0-9_]{0,49}$/,PropertyChecker=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"stripProperties",value:function(e){return _.isObject(e)&&_.each(e,function(e,t){_.isString(e)||_.isNumber(e)||_.isDate(e)||_.isBoolean(e)||_.isArray(e)||_.isObject(e)||logger$1.warn("Your data -",t,e,"- format does not meet requirements and may not be stored correctly. Attribute values only support String, Number, Date, Boolean, Array, Object")}),e}},{key:"_checkPropertiesKey",value:function(e){var n=!0;return _.each(e,function(e,t){KEY_NAME_MATCH_REGEX.test(t)||(logger$1.warn("Invalid KEY: "+t),n=!1)}),n}},{key:"event",value:function(e){return!(!_.isString(e)||!KEY_NAME_MATCH_REGEX.test(e))||(logger$1.warn("Check the parameter format. The eventName must start with an English letter and contain no more than 50 characters including letters, digits, and underscores: "+e),!1)}},{key:"propertyName",value:function(e){return!(!_.isString(e)||!KEY_NAME_MATCH_REGEX.test(e))||(logger$1.warn("Check the parameter format. PropertyName must start with a letter and contain letters, digits, and underscores (_). The value is a string of no more than 50 characters: "+e),!1)}},{key:"properties",value:function(e){return this.stripProperties(e),!(e&&(_.isObject(e)?!this._checkPropertiesKey(e)&&(logger$1.warn("Check the parameter format. The properties key must start with a letter, contain digits, letters, and underscores (_), and contain a maximum of 50 characters"),1):(logger$1.warn("properties can be none, but it must be an object"),1)))}},{key:"propertiesMust",value:function(e){return this.stripProperties(e),void 0===e||!_.isObject(e)||_.isEmptyObject(e)?(logger$1.warn("properties must be an object with a value"),!1):!!this._checkPropertiesKey(e)||(logger$1.warn("Check the parameter format. The properties key must start with a letter, contain digits, letters, and underscores (_), and contain a maximum of 50 characters"),!1)}},{key:"userId",value:function(e){return!(!_.isString(e)||!/^.{1,64}$/.test(e))||(logger$1.warn("The user ID must be a string of less than 64 characters and cannot be null"),!1)}},{key:"userAddProperties",value:function(e){if(!this.propertiesMust(e))return!1;for(var t in e)if(!_.isNumber(e[t]))return logger$1.warn("The attributes of userAdd need to be Number"),!1;return!0}},{key:"userAppendProperties",value:function(e){if(!this.propertiesMust(e))return!1;for(var t in e)if(!_.isArray(e[t]))return logger$1.warn("The attribute of userAppend must be Array"),!1;return!0}}]),e}(),HttpTask=function(){function o(e,t,n,i,r,a){_classCallCheck(this,o),this.data=e,this.serverUrl=t,this.callback=a,this.debugMode=r,this.tryCount=_.isNumber(n)?n:1,this.permissionTryCount=6,this.timeout=_.isNumber(i)?i:3e3,this.taClassName="HttpTask"}return _createClass(o,[{key:"run",value:function(){var n=this,e=_.createExtraHeaders(),t=(e["content-type"]="application/json","debug"===this.debugMode&&(e["Turbo-Debug-Mode"]=1),PlatformAPI.request({url:this.serverUrl,method:"POST",data:this.data,header:e,success:function(e){var t;0===(null==e||null==(t=e.data)?void 0:t.code)?n.onSuccess(e):n.onFailed(e)},fail:function(e){n.onFailed(e)}}));setTimeout(function(){(_.isObject(t)||_.isPromise(t))&&_.isFunction(t.abort)&&t.abort()},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:-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)})}}]),o}(),SenderQueue=function(){function e(){_classCallCheck(this,e),this.items=[],this.isRunning=!1,this.showDebug=!1}return _createClass(e,[{key:"enqueue",value:function(e,t,n){var i=!(3<arguments.length&&void 0!==arguments[3])||arguments[3],r="debug"===n.debugMode,a=this,e=new HttpTask(JSON.stringify(e),t,n.maxRetries,n.sendTimeout,n.debugMode,function(e){a.isRunning=!1,_.isFunction(n.callback)&&n.callback(e),a._runNext(r),r&&logger$1.info("code ".concat(e.code," and msg is ").concat(e.msg))});!0===i?(this.items.push(e),this._runNext(r)):e.run()}},{key:"_dequeue",value:function(){return this.items.shift()}},{key:"_runNext",value:function(e){if(0<this.items.length&&!this.isRunning)if(this.isRunning=!0,e)this._dequeue().run();else{for(var t=this.items.splice(0,this.items.length),e=t[0],n=JSON.parse(e.data),i=1;i<t.length;i++){var r=t[i],r=JSON.parse(r.data);n.event_list=n.event_list.concat(r.event_list)}var a=(new Date).getTime();n.$flush_time=a,new HttpTask(JSON.stringify(n),e.serverUrl,e.tryCount,e.timeout,null==e?void 0:e.debugMode,e.callback).run()}}}]),e}(),senderQueue=new SenderQueue,DEFAULT_CONFIG={name:"GravityEngine",is_plugin:!1,maxRetries:3,sendTimeout:5e3,enablePersistence:!0,asyncPersistence:!1,strict:!1,debugMode:"none"},systemInformation={properties:{$lib_version:Config.LIB_VERSION,$lib:Config.LIB_STACK,$scene:"",$today_first_scene:""},getSystemInfo:function(e){var n=this;PlatformAPI.onNetworkStatusChange(function(e){n.properties.$network_type=e.networkType}),PlatformAPI.getNetworkType({success:function(e){n.properties.$network_type=e.networkType},complete:function(){PlatformAPI.getSystemInfo({success:function(e){logger$1.info(JSON.stringify(e,null,4));var t={$manufacturer:e.brand,$brand:e.brand,$model:e.model,$screen_width:Number(e.screenWidth),$screen_height:Number(e.screenHeight),$system_language:e.language,$os:e.platform,$os_version:e.system};_.extend(n.properties,t),_.setMpPlatform(e.mp_platform)},complete:function(){e()}})}})}},GravityEnginePersistence=function(){function e(t,n){var i=this;_classCallCheck(this,e),this.enabled=t.enablePersistence,this.enabled?(t.isChildInstance?(this.name=t.persistenceName+"_"+t.name,this.nameOld=t.persistenceNameOld+"_"+t.name):(this.name=t.persistenceName,this.nameOld=t.persistenceNameOld),t.asyncPersistence?(this._state={},PlatformAPI.getStorage(this.name,!0,function(e){_.isEmptyObject(e)?PlatformAPI.getStorage(i.nameOld,!0,function(e){i._state=_.extend2Layers({},e,i._state),i._init(t,n),i._save()}):(i._state=_.extend2Layers({},e,i._state),i._init(t,n),i._save())})):(this._state=PlatformAPI.getStorage(this.name)||{},_.isEmptyObject(this._state)&&(this._state=PlatformAPI.getStorage(this.nameOld)||{}),this._init(t,n))):(this._state={},this._init(t,n))}return _createClass(e,[{key:"_init",value:function(e,t){this.getDistinctId()||this.setDistinctId(_.UUID()),e.isChildInstance||this.getDeviceId()||this._setDeviceId(_.UUID()),this.initComplete=!0,"function"==typeof t&&t();var e=PlatformAPI.getStorage(this.name),t=null==e?void 0:e.current_first_scene_date,n=null==e?void 0:e.current_first_scene,i=(new Date).toLocaleDateString();n&&t&&t===i?systemInformation.properties.$today_first_scene=String(null==e?void 0:e.current_first_scene):(e=String((null==(n=PlatformAPI.getAppOptions())?void 0:n.scene)||(null==(t=PlatformAPI.getAppOptions())?void 0:t.from)),systemInformation.properties.$today_first_scene=e,this._state.current_first_scene=e,this._state.current_first_scene_date=i),this._save()}},{key:"_save",value:function(){this.enabled&&this.initComplete&&PlatformAPI.setStorage(this.name,JSON.stringify(this._state))}},{key:"_set",value:function(e,t){var n,i=this;"string"==typeof e?(n={})[e]=t:"object"===_typeof(e)&&(n=e),_.each(n,function(e,t){i._state[t]=e}),this._save()}},{key:"_get",value:function(e){return this._state[e]}},{key:"setEventTimer",value:function(e,t){var n=this._state.event_timers||{};n[e]=t,this._set("event_timers",n)}},{key:"removeEventTimer",value:function(e){var t=(this._state.event_timers||{})[e];return _.isUndefined(t)||(delete this._state.event_timers[e],this._save()),t}},{key:"getDeviceId",value:function(){return this._state.device_id}},{key:"_setDeviceId",value:function(e){this.getDeviceId()?logger$1.warn("cannot modify the device id."):this._set("device_id",e)}},{key:"getDistinctId",value:function(){return this._state.distinct_id}},{key:"setDistinctId",value:function(e){this._set("distinct_id",e)}},{key:"getAccountId",value:function(){return this._state.account_id}},{key:"setAccountId",value:function(e){this._set("account_id",e)}},{key:"getSuperProperties",value:function(){return this._state.props||{}}},{key:"setSuperProperties",value:function(e,t){t=t?e:_.extend(this.getSuperProperties(),e);this._set("props",t)}}]),e}();function getPlatFormName(){return PlatformAPI.getConfig().persistenceNameOld}var GravityEngineAPI=function(){function n(e){_classCallCheck(this,n),e.appId=_.checkAppId((null==e?void 0:e.clientId)||""),e.accessToken=e.accessToken,e.accessToken||console.warn("GravityAnalytics: accessToken must be required"),e.serverUrl="".concat(Config.BASE_URL,"/event/collect/?access_token=").concat(e.accessToken);var t=_.extend({},DEFAULT_CONFIG,PlatformAPI.getConfig());_.isObject(e)?this.config=_.extend(t,e):this.config=t,this._init(this.config)}var e,t,i;return _createClass(n,[{key:"_init",value:function(e){var t=this,n=(this.name=e.name,this.appId=e.clientId,this.accessToken=e.accessToken,e.serverUrl||e.server_url),n=(this.serverUrl=n,this.serverDebugUrl=n,this.configUrl=n+"/config",this.autoTrackProperties={},this._queue=[],this.config.syncBatchSize=100,this.config.syncInterval=60,e.isChildInstance?this._state={}:(logger$1.enabled="debug"===e.debugMode,this.instances=[],this._state={getSystemInfo:!1,initComplete:!1},systemInformation.getSystemInfo(function(){t._updateState({getSystemInfo:!0})}),PlatformAPI.setGlobal(this,this.name)),systemInformation.properties.$scene=String((null==(n=PlatformAPI.getAppOptions())?void 0:n.scene)||(null==(n=PlatformAPI.getAppOptions())?void 0:n.from)),this.store=new GravityEnginePersistence(e,function(){t.config.asyncPersistence&&_.isFunction(t.config.persistenceComplete)&&t.config.persistenceComplete(t),t._updateState()}),this.enabled=!_.isBoolean(this.store._get("ge_enabled"))||this.store._get("ge_enabled"),this.isOptOut=!!_.isBoolean(this.store._get("ge_isOptOut"))&&this.store._get("ge_isOptOut"),getPlatFormName());("GravityEngine_wechat_game"===n||"GravityEngine_tt_game"===n||n.includes("gravityengine_qg"))&&e.autoTrack.appLaunch&&this.track("$MPLaunch",{$url_query:this.setQuery(this.getQuery())}),!e.isChildInstance&&e.autoTrack&&(this.autoTrack=PlatformAPI.initAutoTrackInstance(this,e))}},{key:"updateConfig",value:function(e,t){}},{key:"initInstance",value:function(e,t){if(!this.config.isChildInstance)return _.isString(e)&&e!==this.name&&_.isUndefined(this[e])?(t=new n(_.extend({},this.config,{enablePersistence:!1,isChildInstance:!0,name:e},t)),this[e]=t,this.instances.push(e),this[e]._state=this._state,t):void logger$1.warn("initInstance() failed due to the name is invalid: "+e);logger$1.warn("initInstance() cannot be called on child instance")}},{key:"lightInstance",value:function(e){return this[e]}},{key:"_setAutoTrackProperties",value:function(e){_.extend(this.autoTrackProperties,e)}},{key:"setupAndStart",value:function(e){if(null!=e&&e.clientId&&(this.config.appId=e.clientId,this.appId=e.clientId),this._state.initComplete)return!1;this._updateState({initComplete:!0})}},{key:"_isReady",value:function(){return this._state.getSystemInfo&&this._state.initComplete&&this.store.initComplete&&this.config.appId&&this.config.accessToken}},{key:"_updateState",value:function(e){var t=this;_.isObject(e)&&_.extend(this._state,e),this._onStateChange(),_.each(this.instances,function(e){t[e]._onStateChange()})}},{key:"_onStateChange",value:function(){var t=this;this._isReady()&&this._queue&&0<this._queue.length&&(_.each(this._queue,function(e){t[e[0]].apply(t,slice.call(e[1]))}),this._queue=[])}},{key:"_hasDisabled",value:function(){var e=!this.enabled||this.isOptOut;return e&&logger$1.info("GravityEngine is Pause or Stop!"),e}},{key:"_sendRequest",value:function(e,t,n){var i,r;this._hasDisabled()||(!_.isUndefined(this.config.disableEventList)&&this.config.disableEventList.includes(e.eventName)?logger$1.info("disabled Event : "+e.eventName):(t=_.isDate(t)?t:new Date,(t={event_list:[{type:e.type,time:new Date(t).getTime()}]}).event_list[0].event=e.eventName,"track"===e.type?(t.event_list[0].properties=this.getSendProperties(),i=this.store.removeEventTimer(e.eventName),_.isUndefined(i)||(i=(new Date).getTime()-i,86400<(i=parseFloat((i/1e3).toFixed(3)))?i=86400:i<0&&(i=0),t.event_list[0].properties.$event_duration=i)):t.event_list[0].properties={},_.isObject(e.properties)&&!_.isEmptyObject(e.properties)&&_.extend(t.event_list[0].properties,e.properties),_.searchObjDate(t.event_list[0]),t.client_id=this.appId,logger$1.info(JSON.stringify(t,null,4)),i=this.serverUrl,_.isBoolean(this.config.enableEncrypt)&&1==this.config.enableEncrypt&&(t.event_list[0]=_.generateEncryptyData(t.event_list[0],void 0)),n?(n=new FormData,"debug"===this.config.debugMode?(n.append("source","client"),n.append("appid",this.appId),n.append("deviceId",this.getDeviceId()),n.append("data",JSON.stringify(t.event_list[0]))):(r=_.base64Encode(JSON.stringify(t)),n.append("data",r)),navigator.sendBeacon(i,n),_.isFunction(e.onComplete)&&e.onComplete({statusCode:200})):senderQueue.enqueue(t,i,{maxRetries:this.config.maxRetries,sendTimeout:this.config.sendTimeout,callback:e.onComplete,debugMode:this.config.debugMode})))}},{key:"_isObjectParams",value:function(e){return _.isObject(e)&&_.isFunction(e.onComplete)}},{key:"track",value:function(e,t,n,i){var r;this._hasDisabled()||(this._isObjectParams(e)&&(e=(r=e).eventName,t=r.properties,n=r.time,i=r.onComplete),PropertyChecker.event(e)&&PropertyChecker.properties(t)||!this.config.strict?this._internalTrack(e,t,n,i):_.isFunction(i)&&i({code:-1,msg:"invalid parameters"}))}},{key:"_internalTrack",value:function(e,t,n,i,r){this._hasDisabled()||(n=_.isDate(n)?n:new Date,this._isReady()?this._sendRequest({type:"track",eventName:e,properties:t,onComplete:i},n,r):this._queue.push(["_internalTrack",[e,t,n,i]]))}},{key:"userSet",value:function(e,t,n){var i;this._hasDisabled()||(this._isObjectParams(e)&&(e=(i=e).properties,t=i.time,n=i.onComplete),PropertyChecker.propertiesMust(e)||!this.config.strict?(t=_.isDate(t)?t:new Date,this._isReady()?this._sendRequest({type:"profile",eventName:"profile_set",properties:e,onComplete:n},t):this._queue.push(["userSet",[e,t,n]])):(logger$1.warn("calling userSet failed due to invalid arguments"),_.isFunction(n)&&n({code:-1,msg:"invalid parameters"})))}},{key:"userSetOnce",value:function(e,t,n){var i;this._hasDisabled()||(this._isObjectParams(e)&&(e=(i=e).properties,t=i.time,n=i.onComplete),PropertyChecker.propertiesMust(e)||!this.config.strict?(t=_.isDate(t)?t:new Date,this._isReady()?this._sendRequest({type:"profile",eventName:"profile_set_once",properties:e,onComplete:n},t):this._queue.push(["userSetOnce",[e,t,n]])):(logger$1.warn("calling userSetOnce failed due to invalid arguments"),_.isFunction(n)&&n({code:-1,msg:"invalid parameters"})))}},{key:"userAdd",value:function(e,t,n){var i;this._hasDisabled()||(this._isObjectParams(e)&&(e=(i=e).properties,t=i.time,n=i.onComplete),PropertyChecker.propertiesMust(e)||!this.config.strict?(t=_.isDate(t)?t:new Date,this._isReady()?this._sendRequest({type:"profile",eventName:"profile_increment",properties:e,onComplete:n},t):this._queue.push(["userAdd",[e,t,n]])):(logger$1.warn("calling userAdd failed due to invalid arguments"),_.isFunction(n)&&n({code:-1,msg:"invalid parameters"})))}},{key:"userNumberMax",value:function(e,t,n){if(!this._hasDisabled()){var i,r,a;for(r in this._isObjectParams(e)&&(e=(i=e).properties,t=i.time,n=i.onComplete),e)if("number"!=typeof e[r])return a="The key ".concat(r," must be type of number"),console.warn(a),void(_.isFunction(n)&&n({code:-1,msg:a}));PropertyChecker.propertiesMust(e)||!this.config.strict?(t=_.isDate(t)?t:new Date,this._isReady()?this._sendRequest({type:"profile",eventName:"profile_number_max",properties:e,onComplete:n},t):this._queue.push(["userNumberMax",[e,t,n]])):(logger$1.warn("calling userNumberMax failed due to invalid arguments"),_.isFunction(n)&&n({code:-1,msg:"invalid parameters"}))}}},{key:"userNumberMin",value:function(e,t,n){if(!this._hasDisabled()){var i,r,a;for(r in this._isObjectParams(e)&&(e=(i=e).properties,t=i.time,n=i.onComplete),e)if("number"!=typeof e[r])return a="The key ".concat(r," must be type of number"),console.warn(a),void(_.isFunction(n)&&n({code:-1,msg:a}));PropertyChecker.propertiesMust(e)||!this.config.strict?(t=_.isDate(t)?t:new Date,this._isReady()?this._sendRequest({type:"profile",eventName:"profile_number_min",properties:e,onComplete:n},t):this._queue.push(["userNumberMin",[e,t,n]])):(logger$1.warn("calling userNumberMin failed due to invalid arguments"),_.isFunction(n)&&n({code:-1,msg:"invalid parameters"}))}}},{key:"userDel",value:function(e,t){var n,i={};this._hasDisabled()||(this._isObjectParams(i)&&(i=(n=i).properties,e=n.time,t=n.onComplete),PropertyChecker.propertiesMust(i)||!this.config.strict?(e=_.isDate(e)?e:new Date,this._isReady()?this._sendRequest({type:"profile",eventName:"profile_delete",properties:i,onComplete:t},e):this._queue.push(["userDel",[i,e,t]])):(logger$1.warn("calling userDel failed due to invalid arguments"),_.isFunction(t)&&t({code:-1,msg:"invalid parameters"})))}},{key:"userAppend",value:function(e,t,n){var i;this._hasDisabled()||(this._isObjectParams(e)&&(e=(i=e).properties,t=i.time,n=i.onComplete),PropertyChecker.propertiesMust(e)||!this.config.strict?(t=_.isDate(t)?t:new Date,this._isReady()?this._sendRequest({type:"profile",eventName:"profile_append",properties:e,onComplete:n},t):this._queue.push(["userAppend",[e,t,n]])):(logger$1.warn("calling userAppend failed due to invalid arguments"),_.isFunction(n)&&n({code:-1,msg:"invalid parameters"})))}},{key:"userUniqAppend",value:function(e,t,n){var i;this._hasDisabled()||(this._isObjectParams(e)&&(e=(i=e).properties,t=i.time,n=i.onComplete),PropertyChecker.userAppendProperties(e)||!this.config.strict?(t=_.isDate(t)?t:new Date,this._isReady()?this._sendRequest({type:"profile",eventName:"profile_uniq_append",properties:e,onComplete:n},t):this._queue.push(["userUniqAppend",[e,t,n]])):(logger$1.warn("calling userAppend failed due to invalid arguments"),_.isFunction(n)&&n({code:-1,msg:"invalid parameters"})))}},{key:"userUnset",value:function(e,t,n){var i,e=_defineProperty({},e,null);this._hasDisabled()||(this._isObjectParams(e)&&(e=(i=e).properties,t=i.time,n=i.onComplete),PropertyChecker.propertiesMust(e)||!this.config.strict?(t=_.isDate(t)?t:new Date,this._isReady()?this._sendRequest({type:"profile",eventName:"profile_unset",properties:e,onComplete:n},t):this._queue.push(["userUnset",[e,t,n]])):(logger$1.warn("calling userUnset failed due to invalid arguments"),_.isFunction(n)&&n({code:-1,msg:"invalid parameters"})))}},{key:"uploadQuickAppDeviceInfo",value:function(){var o=this;return new Promise(function(r,a){var t;PlatformAPI.getQuickDevice({success:(t=_asyncToGenerator(_regeneratorRuntime().mark(function e(t){var n,i;return _regeneratorRuntime().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n={os_name:"android",android_id:t.user,imei:t.device,oaid:t.device,mac:t.mac,android_version:t.system,api_version:t.osVersionCode,rom:t.vendorOsName,rom_version:t.vendorOsVersion,phone_brand:t.manufacturer,phone_model:t.model},i="".concat(Config.BASE_URL,"/user/device_info/?access_token=").concat(o.accessToken,"&client_id=").concat(o.appId),e.next=4,o.sendNetWork(i,{data:n});case 4:return i=e.sent,e.abrupt("return",(0===i.code?r:a)(i));case 6:case"end":return e.stop()}},e)})),function(e){return t.apply(this,arguments)})})})}},{key:"uploadQuickGameDeviceInfo",value:function(){var o=this;return new Promise(function(r,a){var t,e=getPlatFormName();PlatformAPI.getQuickDevice({platform:e,success:(t=_asyncToGenerator(_regeneratorRuntime().mark(function e(t){var n,i;return _regeneratorRuntime().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=t,i="".concat(Config.BASE_URL,"/user/device_info/?access_token=").concat(o.accessToken,"&client_id=").concat(o.appId),e.next=4,o.sendNetWork(i,{data:n});case 4:return i=e.sent,e.abrupt("return",(0===i.code?r:a)(i));case 6:case"end":return e.stop()}},e)})),function(e){return t.apply(this,arguments)})})})}},{key:"logoutEvent",value:function(){this.track("$MPLogout",{})}},{key:"loginEvent",value:function(){this.track("$MPLogin",{})}},{key:"registerEvent",value:function(){"GravityEngine_quick_mp"===getPlatFormName()?this.track("$AppRegister",{}):this.track("$MPRegister",{})}},{key:"payEvent",value:function(e,t,n,i,r){if("number"!=typeof e)throw new Error("pay_amount must be a number");if("string"!=typeof t)throw new Error("pay_type must be a string");if("string"!=typeof n)throw new Error("order_id must be a string");if("string"!=typeof i)throw new Error("pay_reason must be a string");if("string"!=typeof r)throw new Error("pay_method must be a string");this.track("$PayEvent",{$pay_amount:e,$pay_type:t,$order_id:n,$pay_reason:i,$pay_method:r})}},{key:"bindTAThirdPlatform",value:function(e,t){if(!e&&!t)throw new Error("taAccountId or taDistinctId must be required");if(e&&"string"!=typeof e)throw new Error("taAccountId must be a string");if(t&&"string"!=typeof t)throw new Error("taDistinctId must be a string");this.track("$BindThirdPlatform",{$third_platform_type:"ta",$ta_account_id:e,$ta_distinct_id:t})}},{key:"adShowEvent",value:function(e,t,n){var i=getPlatFormName();if("GravityEngine_wechat"===i||"GravityEngine_wechat_game"===i){if("string"!=typeof e)throw new Error("ad_type must be a string");if("string"!=typeof t)throw new Error("ad_unit_id must be a string");i={$ad_type:e,$ad_unit_id:t,$adn_type:"wechat"};"[object Object]"===Object.prototype.toString.call(n)&&Object.assign(i,n),this.track("$AdShow",i)}}},{key:"getQuery",value:function(){return PlatformAPI.getAppOptions().query||{}}},{key:"setQuery",value:function(e){var t,n=[];for(t in e)e.hasOwnProperty(t)&&n.push(encodeURIComponent(t)+"="+encodeURIComponent(e[t]));return n.join("&")}},{key:"sendNetWork",value:function(e,i){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"POST";return new Promise(function(t,n){PlatformAPI.request({url:e,method:r,data:"string"==typeof i?i:JSON.stringify(i),header:{"content-type":"application/json"},success:function(e){200===e.statusCode?t(e.data):n(e)},fail:function(e){n(e)}})})}},{key:"_errorPromise",value:function(e){return Promise.reject(new Error(e))}},{key:"initializeWithHistoryUserInfo",value:(i=_asyncToGenerator(_regeneratorRuntime().mark(function e(){var t,n,i=arguments;return _regeneratorRuntime().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=0<i.length&&void 0!==i[0]?i[0]:{},n=1<i.length?i[1]:void 0,e.abrupt("return",this.initialize(t,n));case 3:case"end":return e.stop()}},e,this)})),function(){return i.apply(this,arguments)})},{key:"initialize",value:(t=_asyncToGenerator(_regeneratorRuntime().mark(function e(){var d,m,v=this,t=arguments;return _regeneratorRuntime().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return d=0<t.length&&void 0!==t[0]?t[0]:{},m=1<t.length?t[1]:void 0,e.abrupt("return",new Promise(function(){var n=_asyncToGenerator(_regeneratorRuntime().mark(function e(f,g){return _regeneratorRuntime().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:PlatformAPI.getStorage("is_ge_registered",!0,function(){var t=_asyncToGenerator(_regeneratorRuntime().mark(function e(t){var n,i,r,a,o,s,c,u,l,p,h;return _regeneratorRuntime().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n="",v._state.initComplete?null!=d&&d.name?null!=d&&d.version||0===(null==d?void 0:d.version)?_.isNumber(null==d?void 0:d.version)&&"number"==typeof(null==d?void 0:d.version)?void 0!==m&&("[object Object]"!==Object.prototype.toString.call(m)?n="history_info must be type: Object":null!=m&&m.company?"string"!=typeof m.company?n="history_info.company must be type: String":null!=m&&m.create_time||0===m.create_time?_.isNumber(m.create_time)&&"number"==typeof m.create_time||(n="history_info.create_time must be type: Number"):n="history_info.create_time must be required":n="history_info.company must be required"):n="version must be type: Number":n="version must be required":n="name must be required":n="initialize must be called after setupAndStart",n)return e.abrupt("return",v._errorPromise(n));e.next=4;break;case 4:return n=v.getQuery(),i=(null==d?void 0:d.channel)||"base_channel",o={client_id:v.appId,name:d.name,channel:i,version:d.version,wx_openid:(null==d?void 0:d.openid)||(null==d?void 0:d.wx_openid)||"",wx_unionid:(null==d?void 0:d.wx_unionid)||"",promoted_object_id:(null==d?void 0:d.promoted_object_id)||"",need_return_attribution:(null==d?void 0:d.enable_sync_attribution)||!1,ad_data:n},m&&(o.history_info=m),a="".concat(Config.BASE_URL,"/user/initialize/?access_token=").concat(v.accessToken),e.next=11,v.sendNetWork(a,o);case 11:if(0!==(r=e.sent).code)return e.abrupt("return",g(r));e.next=14;break;case 14:return a=getPlatFormName(),console.log("gravity current platform: "+a),"GravityEngine_quick_mp"===a?v.uploadQuickAppDeviceInfo():a.includes("gravityengine_qg")&&v.uploadQuickGameDeviceInfo(),o=systemInformation.properties,u=new Date,l=u.getFullYear(),p=("0"+(u.getMonth()+1)).slice(-2),h=("0"+u.getDate()).slice(-2),s=("0"+u.getHours()).slice(-2),c=("0"+u.getMinutes()).slice(-2),u=("0"+u.getSeconds()).slice(-2),l="".concat(l,"-").concat(p,"-").concat(h," ").concat(s,":").concat(c,":").concat(u),"Y"!==t&&(v.userSetOnce({$channel:i,$manufacturer:o.$manufacturer,$model:o.$model,$brand:o.$brand,$os:o.$os,$first_visit_time:l,$first_scene:String(null==(p=PlatformAPI.getAppOptions())?void 0:p.scene)}),h=v.setQuery(v.getQuery()),v.track("$MPLaunch",{$url_query:h}),v.track("$MPShow",{$url_query:h})),PlatformAPI.setStorage("is_ge_registered",JSON.stringify("Y")),e.abrupt("return",f(r));case 29:case"end":return e.stop()}},e)}));return function(e){return t.apply(this,arguments)}}());case 1:case"end":return e.stop()}},e)}));return function(e,t){return n.apply(this,arguments)}}()));case 3:case"end":return e.stop()}},e)})),function(){return t.apply(this,arguments)})},{key:"queryUserInfo",value:(e=_asyncToGenerator(_regeneratorRuntime().mark(function e(){var r=this;return _regeneratorRuntime().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this._state.initComplete){e.next=2;break}return e.abrupt("return",this._errorPromise("queryUserInfo must be called after setupAndStart"));case 2:return e.abrupt("return",new Promise(function(){var n=_asyncToGenerator(_regeneratorRuntime().mark(function e(t,n){var i;return _regeneratorRuntime().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return i="".concat(Config.BASE_URL,"/user/get/?access_token=").concat(r.accessToken,"&client_id=").concat(r.appId),e.next=3,r.sendNetWork(i,{},"GET");case 3:return i=e.sent,e.abrupt("return",(0===i.code?t:n)(i));case 5:case"end":return e.stop()}},e)}));return function(e,t){return n.apply(this,arguments)}}()));case 3:case"end":return e.stop()}},e,this)})),function(){return e.apply(this,arguments)})},{key:"authorizeOpenID",value:function(e){this.identify(e)}},{key:"identify",value:function(e){if(!this._hasDisabled()){if("number"==typeof e)e=String(e);else if("string"!=typeof e)return!1;this.store.setDistinctId(e)}}},{key:"getDistinctId",value:function(){return this.store.getDistinctId()}},{key:"login",value:function(e){if(!this._hasDisabled()){if("number"==typeof e)e=String(e);else if("string"!=typeof e)return!1;this.store.setAccountId(e)}}},{key:"getAccountId",value:function(){return this.store.getAccountId()}},{key:"logout",value:function(){this._hasDisabled()||this.store.setAccountId(null)}},{key:"setSuperProperties",value:function(e){this._hasDisabled()||(PropertyChecker.propertiesMust(e)||!this.config.strict?this.store.setSuperProperties(e):logger$1.warn("setSuperProperties parameter must be a valid property value"))}},{key:"registerApp",value:function(e){this.setSuperProperties(e)}},{key:"clearSuperProperties",value:function(){this._hasDisabled()||this.store.setSuperProperties({},!0)}},{key:"unsetSuperProperty",value:function(e){var t;this._hasDisabled()||_.isString(e)&&(delete(t=this.getSuperProperties())[e],this.store.setSuperProperties(t,!0))}},{key:"getSuperProperties",value:function(){return this.store.getSuperProperties()}},{key:"getSendProperties",value:function(){try{var e,t=_.extend({},systemInformation.properties,this.autoTrackProperties,this.store.getSuperProperties(),this.dynamicProperties?this.dynamicProperties():{});for(e in t)"string"==typeof t[e]&&(t[e]=t[e].substring(0,8192));return t}catch(e){return{}}}},{key:"getPresetProperties",value:function(){var e=systemInformation.properties,t={},n=e.$system_language,n=(t.system_language=_.isUndefined(n)?"":n,e.$os),n=(t.os=_.isUndefined(n)?"":n,e.$screen_width),n=(t.screenWidth=_.isUndefined(n)?0:n,e.$screen_height),n=(t.screenHeight=_.isUndefined(n)?0:n,e.$network_type),n=(t.networkType=_.isUndefined(n)?"":n,e.$model),n=(t.deviceModel=_.isUndefined(n)?"":n,e.$os_version),n=(t.osVersion=_.isUndefined(n)?"":n,t.deviceId=this.getDeviceId(),0-(new Date).getTimezoneOffset()/60),n=(t.zoneOffset=n,e.$manufacturer),n=(t.manufacturer=_.isUndefined(n)?"":n,e.$manufacturer);return t.brand=_.isUndefined(n)?"":n,t.toEventPresetProperties=function(){var e;return{$app_id:this.appId,$model:t.deviceModel,$screen_width:t.screenWidth,$screen_height:t.screenHeight,$system_language:t.system_language,$os:t.os,$os_version:t.osVersion,$network_type:t.networkType,$manufacturer:t.manufacturer,$brand:t.manufacturer,$scene:String((null==(e=PlatformAPI.getAppOptions())?void 0:e.scene)||(null==(e=PlatformAPI.getAppOptions())?void 0:e.from))}},t}},{key:"setDynamicSuperProperties",value:function(e){this._hasDisabled()||("function"==typeof e?PropertyChecker.properties(e())||!this.config.strict?this.dynamicProperties=e:logger$1.warn("A dynamic public property must return a valid property value"):logger$1.warn("setDynamicSuperProperties parameter must be a function type"))}},{key:"timeEvent",value:function(e,t){this._hasDisabled()||(t=_.isDate(t)?t:new Date,this._isReady()?PropertyChecker.event(e)||!this.config.strict?this.store.setEventTimer(e,t.getTime()):logger$1.warn("calling timeEvent failed due to invalid eventName: "+e):this._queue.push(["timeEvent",[e,t]]))}},{key:"getDeviceId",value:function(){return systemInformation.properties.$device_id}},{key:"enableTracking",value:function(e){this.enabled=e,this.store._set("ta_enabled",e)}},{key:"optOutTracking",value:function(){this.store.setSuperProperties({},!0),this.store.setDistinctId(_.UUID()),this.store.setAccountId(null),this._queue.splice(0,this._queue.length),this.isOptOut=!0,this.store._set("ge_isOptOut",!0)}},{key:"optOutTrackingAndDeleteUser",value:function(){var e=new Date;this._sendRequest({type:"user_del"},e),this.optOutTracking()}},{key:"optInTracking",value:function(){this.isOptOut=!1,this.store._set("ge_isOptOut",!1)}},{key:"setTrackStatus",value:function(e){switch(e){case"PAUSE":this.eventSaveOnly=!1,this.optInTracking(),this.enableTracking(!1);break;case"STOP":this.eventSaveOnly=!1,this.optOutTracking(!0);break;default:this.eventSaveOnly=!1,this.optInTracking(),this.enableTracking(!0)}}}]),n}(),DEFAULT_CONFIG$1={name:"GravityEngine",enableLog:!0,enableNative:!1},GravityEngineAPIForNative=function(){function n(e){_classCallCheck(this,n),e.appId=_.checkAppId(e.clientId),e.accessToken=e.accessToken,e.appId?e.accessToken||console.warn("GravityAnalytics: accessToken must be required"):console.warn("GravityAnalytics: clientId must be required"),e.serverUrl="".concat(Config.BASE_URL,"/event/collect/?access_token=").concat(e.accessToken);var t=_.extend({},DEFAULT_CONFIG$1,PlatformAPI.getConfig());_.isObject(e)?this.config=_.extend(t,e):this.config=t,this._init(this.config)}var e;return _createClass(n,[{key:"_isNativePlatform",value:function(){return!(!this._isIOS()&&!this._isAndroid()||!this.config.enableNative)}},{key:"_isIOS",value:function(){return!(!cc.sys.isNative||"iOS"!==cc.sys.os)}},{key:"_isAndroid",value:function(){return!(!cc.sys.isNative||"Android"!==cc.sys.os)}},{key:"_init",value:function(e){this.name=e.name,this.appId=e.clientId,this.accessToken=e.accessToken;var t=e.serverUrl||e.server_url;this.serverUrl=t,this.serverDebugUrl=t+"/data_debug",this.configUrl=t+"/config",this._isNativePlatform()?(this.initInstanceForNative(this.name,e,this.appId),this._readStorage(e)):this.geJs=new GravityAnalyticsAPIForJS(e)}},{key:"_readStorage",value:function(e){var t=this,n=e.persistenceName,i=e.persistenceNameOld;e.isChildInstance&&(n=e.persistenceName+"_"+e.name,i=e.persistenceNameOld+"_"+e.name),this._state=PlatformAPI.getStorage(n)||{},_.isEmptyObject(this._state)&&(this._state=PlatformAPI.getStorage(i)||{}),_.isEmptyObject(this._state)?PlatformAPI.getStorage(n,!0,function(e){_.isEmptyObject(e)?PlatformAPI.getStorage(i,!0,function(e){t._state=_.extend2Layers({},e,t._state)}):t._state=_.extend2Layers({},e,t._state),t._state.distinct_id&&t.identifyForNative(t._state.distinct_id),t._state.account_id&&t.loginForNative(t._state.account_id)}):(this._state.distinct_id&&this.identifyForNative(this._state.distinct_id),this._state.account_id&&this.loginForNative(this._state.account_id))}},{key:"initInstance",value:function(e,t){return this._isNativePlatform()?_.isUndefined(t)?this[e]=new GravityAnalyticsAPI(this.config):this[e]=new GravityAnalyticsAPI(t):this[e]=this.geJs.initInstance(e,t),this[e]}},{key:"lightInstance",value:function(e){return this[e]}},{key:"setupAndStart",value:function(){var e,t;this._isNativePlatform()?(e=window,t=this,e.__autoTrackCallback=function(e){return _.isFunction(t.config.autoTrack.callback)?(e=t.config.autoTrack.callback(e),JSON.stringify(e)):"{}"},this.startGravityAnalyticsForNative()):this.geJs.setupAndStart()}},{key:"track",value:function(e,t,n,i){this._isNativePlatform()?this.trackForNative(e,t,n,this.appId):this.geJs.track(e,t,n,i)}},{key:"initializeWithHistoryUserInfo",value:(e=_asyncToGenerator(_regeneratorRuntime().mark(function e(){var t,n,i=arguments;return _regeneratorRuntime().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=0<i.length&&void 0!==i[0]?i[0]:{},n=1<i.length?i[1]:void 0,e.abrupt("return",this.geJs.initializeWithHistoryUserInfo(t,n));case 3:case"end":return e.stop()}},e,this)})),function(){return e.apply(this,arguments)})},{key:"initialize",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=1<arguments.length?arguments[1]:void 0;if(!this._isNativePlatform())return this.geJs.initialize(e,t)}},{key:"queryUserInfo",value:function(){if(!this._isNativePlatform())return this.geJs.queryUserInfo()}},{key:"registerApp",value:function(e){if(!this._isNativePlatform())return this.geJs.registerApp(e)}},{key:"registerEvent",value:function(){if(!this._isNativePlatform())return this.geJs.registerEvent()}},{key:"loginEvent",value:function(){if(!this._isNativePlatform())return this.geJs.loginEvent()}},{key:"logoutEvent",value:function(){if(!this._isNativePlatform())return this.geJs.logoutEvent()}},{key:"payEvent",value:function(e,t,n,i,r){if(!this._isNativePlatform())return this.geJs.payEvent(e,t,n,i,r)}},{key:"bindTAThirdPlatform",value:function(e,t){if(!this._isNativePlatform())return this.geJs.bindTAThirdPlatform(e,t)}},{key:"adShowEvent",value:function(e,t,n){if(!this._isNativePlatform())return this.geJs.adShowEvent(e,t,n)}},{key:"userSet",value:function(e,t,n){this._isNativePlatform()?this.userSetForNative(e,this.appId):this.geJs.userSet(e,t,n)}},{key:"userSetOnce",value:function(e,t,n){this._isNativePlatform()?this.userSetOnceForNative(e,this.appId):this.geJs.userSetOnce(e,t,n)}},{key:"userUnset",value:function(e,t,n){this._isNativePlatform()?this.userUnsetForNative(e,this.appId):this.geJs.userUnset(e,t,n)}},{key:"userDel",value:function(e,t){this._isNativePlatform()?this.userDelForNative(this.appId):this.geJs.userDel(e,t)}},{key:"userAdd",value:function(e,t,n){this._isNativePlatform()?this.userAddForNative(e,this.appId):this.geJs.userAdd(e,t,n)}},{key:"userNumberMax",value:function(e,t,n){this._isNativePlatform()||this.geJs.userNumberMax(e,t,n)}},{key:"userNumberMin",value:function(e,t,n){this._isNativePlatform()||this.geJs.userNumberMin(e,t,n)}},{key:"userAppend",value:function(e,t,n){this._isNativePlatform()?this.userAppendForNative(e,this.appId):this.geJs.userAppend(e,t,n)}},{key:"userUniqAppend",value:function(e,t,n){this._isNativePlatform()?this.userUniqAppendForNative(e,this.appId):this.geJs.userUniqAppend(e,t,n)}},{key:"authorizeOpenID",value:function(e){this.identify(e)}},{key:"identify",value:function(e){this._isNativePlatform()?this.identifyForNative(e,this.appId):this.geJs.identify(e)}},{key:"getDistinctId",value:function(){return this._isNativePlatform()?this.getDistinctIdForNative(this.appId):this.geJs.getDistinctId()}},{key:"login",value:function(e){this._isNativePlatform()?this.loginForNative(e,this.appId):this.geJs.login(e)}},{key:"getAccountId",value:function(){return this._isNativePlatform()?this.getAccountIdForNative(this.appId):this.geJs.getAccountId()}},{key:"logout",value:function(){this._isNativePlatform()?this.logoutForNative(this.appId):this.geJs.logout()}},{key:"setSuperProperties",value:function(e){this._isNativePlatform()?this.setSuperPropertiesForNative(e,this.appId):this.geJs.setSuperProperties(e)}},{key:"clearSuperProperties",value:function(){this._isNativePlatform()?this.clearSuperPropertiesForNative(this.appId):this.geJs.clearSuperProperties()}},{key:"unsetSuperProperty",value:function(e){this._isNativePlatform()?this.unsetSuperPropertyForNative(e,this.appId):this.geJs.unsetSuperProperty(e)}},{key:"getSuperProperties",value:function(){return this._isNativePlatform()?this.getSuperPropertiesForNative(this.appId):this.geJs.getSuperProperties()}},{key:"getPresetProperties",value:function(){var e,t,n,i;return this._isNativePlatform()?(e=this.getPresetPropertiesForNative(this.appId),t={},i=e.$system_language,t.system_language=_.isUndefined(i)?"":i,i=e.$os,t.os=_.isUndefined(i)?"":i,i=e.$screen_width,t.screenWidth=_.isUndefined(i)?0:i,i=e.$screen_height,t.screenHeight=_.isUndefined(i)?0:i,i=e.$network_type,t.networkType=_.isUndefined(i)?"":i,i=e.$device_model,t.deviceModel=_.isUndefined(i)?"":i,i=e.$os_version,t.osVersion=_.isUndefined(i)?"":i,t.deviceId=this.getDeviceId(),n=0-(new Date).getTimezoneOffset()/60,t.zoneOffset=n,i=e.$manufacturer,t.manufacturer=_.isUndefined(i)?"":i,i=e.$manufacturer,t.brand=_.isUndefined(i)?"":i,t.toEventPresetProperties=function(){return{$device_model:t.deviceModel,$device_id:t.deviceId,$screen_width:t.screenWidth,$screen_height:t.screenHeight,$system_language:t.system_language,$os:t.os,$os_version:t.osVersion,$network_type:t.networkType,$zone_offset:n,$manufacturer:t.manufacturer,$brand:t.manufacturer}},t):this.geJs.getPresetProperties()}},{key:"setDynamicSuperProperties",value:function(t){this._isNativePlatform()?"function"==typeof t?(this.dynamicProperties=t,window.__dynamicPropertiesForNative=function(e){console.log("__dynamicPropertiesForNative: native msg: ",e);e=t(),e=_.encodeDates(e);return JSON.stringify(e)},this.setDynamicSuperPropertiesForNative("__dynamicPropertiesForNative")):logger.warn("setDynamicSuperProperties parameter must be a function type"):this.geJs.setDynamicSuperProperties(t)}},{key:"timeEvent",value:function(e,t){return this._isNativePlatform()?this.timeEventForNative(e,this.appId):this.geJs.timeEvent(e,t)}},{key:"getDeviceId",value:function(){return this._isNativePlatform()?this.getDeviceIdForNative(this.appId):this.geJs.getDeviceId()}},{key:"enableTracking",value:function(e){this._isNativePlatform()?this.enableTrackingForNative(e,this.appId):this.geJs.enableTracking(e)}},{key:"optOutTracking",value:function(){this._isNativePlatform()?this.optOutTrackingForNative(this.appId):this.geJs.optOutTracking()}},{key:"optOutTrackingAndDeleteUser",value:function(){this._isNativePlatform()?this.optOutTrackingAndDeleteUserForNative(this.appId):this.geJs.optOutTrackingAndDeleteUser()}},{key:"optInTracking",value:function(){this._isNativePlatform()?this.optInTrackingForNative(this.appId):this.geJs.optInTracking()}},{key:"setTrackStatus",value:function(e){this._isNativePlatform()?this.setTrackStatusForNative(e,this.appId):this.geJs.setTrackStatus(e)}},{key:"trackForNative",value:function(e,t,n,i){n=_.isDate(n)?_.formatDate(n):"";_.isUndefined(t)&&(t={}),t=_.extend(t,this.dynamicProperties?this.dynamicProperties():{}),t=_.encodeDates(t),this._isAndroid()?jsb.reflection.callStaticMethod("com/cocos/game/CocosCreatorProxyApi","track","(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V",e,JSON.stringify(t),n,i):this._isIOS()&&jsb.reflection.callStaticMethod("CocosCreatorProxyApi","track:properties:time:appId:",e,JSON.stringify(t),n,i)}},{key:"timeEventForNative",value:function(e,t){this._isAndroid()?jsb.reflection.callStaticMethod("com/cocos/game/CocosCreatorProxyApi","timeEvent","(Ljava/lang/String;Ljava/lang/String;)V",e,t):this._isIOS()&&jsb.reflection.callStaticMethod("CocosCreatorProxyApi","timeEvent:appId:",e,t)}},{key:"loginForNative",value:function(e,t){this._isAndroid()?jsb.reflection.callStaticMethod("com/cocos/game/CocosCreatorProxyApi","login","(Ljava/lang/String;Ljava/lang/String;)V",e,t):this._isIOS()&&jsb.reflection.callStaticMethod("CocosCreatorProxyApi","login:appId:",e,t)}},{key:"logoutForNative",value:function(e){this._isAndroid()?jsb.reflection.callStaticMethod("com/cocos/game/CocosCreatorProxyApi","logout","(Ljava/lang/String;)V",e):this._isIOS()&&jsb.reflection.callStaticMethod("CocosCreatorProxyApi","logout:",e)}},{key:"setSuperPropertiesForNative",value:function(e,t){e=_.encodeDates(e),this._isAndroid()?jsb.reflection.callStaticMethod("com/cocos/game/CocosCreatorProxyApi","setSuperProperties","(Ljava/lang/String;Ljava/lang/String;)V",JSON.stringify(e),t):this._isIOS()&&jsb.reflection.callStaticMethod("CocosCreatorProxyApi","setSuperProperties:appId:",JSON.stringify(e),t)}},{key:"getSuperPropertiesForNative",value:function(e){var t="{}";return this._isAndroid()?t=jsb.reflection.callStaticMethod("com/cocos/game/CocosCreatorProxyApi","getSuperProperties","(Ljava/lang/String;)V",e):this._isIOS()&&(t=jsb.reflection.callStaticMethod("CocosCreatorProxyApi","getSuperProperties:",e)),JSON.parse(t)}},{key:"unsetSuperPropertyForNative",value:function(e,t){this._isAndroid()?jsb.reflection.callStaticMethod("com/cocos/game/CocosCreatorProxyApi","unsetSuperProperty","(Ljava/lang/String;Ljava/lang/String;)V",e,t):this._isIOS()&&jsb.reflection.callStaticMethod("CocosCreatorProxyApi","unsetSuperProperty:appId:",e,t)}},{key:"clearSuperPropertiesForNative",value:function(e){this._isAndroid()?jsb.reflection.callStaticMethod("com/cocos/game/CocosCreatorProxyApi","clearSuperProperties","(Ljava/lang/String;)V",e):this._isIOS()&&jsb.reflection.callStaticMethod("CocosCreatorProxyApi","clearSuperProperties:",e)}},{key:"userSetForNative",value:function(e,t){e=_.encodeDates(e),this._isAndroid()?jsb.reflection.callStaticMethod("com/cocos/game/CocosCreatorProxyApi","userSet","(Ljava/lang/String;Ljava/lang/String;)V",JSON.stringify(e),t):this._isIOS()&&jsb.reflection.callStaticMethod("CocosCreatorProxyApi","userSet:appId:",JSON.stringify(e),t)}},{key:"userSetOnceForNative",value:function(e,t){e=_.encodeDates(e),this._isAndroid()?jsb.reflection.callStaticMethod("com/cocos/game/CocosCreatorProxyApi","userSetOnce","(Ljava/lang/String;Ljava/lang/String;)V",JSON.stringify(e),t):this._isIOS()&&jsb.reflection.callStaticMethod("CocosCreatorProxyApi","userSetOnce:appId:",JSON.stringify(e),t)}},{key:"userAppendForNative",value:function(e,t){e=_.encodeDates(e),this._isAndroid()?jsb.reflection.callStaticMethod("com/cocos/game/CocosCreatorProxyApi","userAppend","(Ljava/lang/String;Ljava/lang/String;)V",JSON.stringify(e),t):this._isIOS()&&jsb.reflection.callStaticMethod("CocosCreatorProxyApi","userAppend:appId:",JSON.stringify(e),t)}},{key:"userUniqAppendForNative",value:function(e,t){e=_.encodeDates(e),this._isAndroid()?jsb.reflection.callStaticMethod("com/cocos/game/CocosCreatorProxyApi","userUniqAppend","(Ljava/lang/String;Ljava/lang/String;)V",JSON.stringify(e),t):this._isIOS()&&jsb.reflection.callStaticMethod("CocosCreatorProxyApi","userUniqAppend:appId:",JSON.stringify(e),t)}},{key:"userAddForNative",value:function(e,t){e=_.encodeDates(e),this._isAndroid()?jsb.reflection.callStaticMethod("com/cocos/game/CocosCreatorProxyApi","userAdd","(Ljava/lang/String;Ljava/lang/String;)V",JSON.stringify(e),t):this._isIOS()&&jsb.reflection.callStaticMethod("CocosCreatorProxyApi","userAdd:appId:",JSON.stringify(e),t)}},{key:"userUnsetForNative",value:function(e,t){this._isAndroid()?jsb.reflection.callStaticMethod("com/cocos/game/CocosCreatorProxyApi","userUnset","(Ljava/lang/String;Ljava/lang/String;)V",e,t):this._isIOS()&&jsb.reflection.callStaticMethod("CocosCreatorProxyApi","userUnset:appId:",e,t)}},{key:"userDelForNative",value:function(e){this._isAndroid()?jsb.reflection.callStaticMethod("com/cocos/game/CocosCreatorProxyApi","userDel","(Ljava/lang/String;)V",e):this._isIOS()&&jsb.reflection.callStaticMethod("CocosCreatorProxyApi","userDel:",e)}},{key:"authorizeOpenIDForNative",value:function(e,t){this._isAndroid()?jsb.reflection.callStaticMethod("com/cocos/game/CocosCreatorProxyApi","authorizeOpenID","(Ljava/lang/String;Ljava/lang/String;)V",e,t):this._isIOS()&&jsb.reflection.callStaticMethod("CocosCreatorProxyApi","authorizeOpenID:appId:",e,t)}},{key:"identifyForNative",value:function(e,t){this._isAndroid()?jsb.reflection.callStaticMethod("com/cocos/game/CocosCreatorProxyApi","identify","(Ljava/lang/String;Ljava/lang/String;)V",e,t):this._isIOS()&&jsb.reflection.callStaticMethod("CocosCreatorProxyApi","identify:appId:",e,t)}},{key:"initInstanceForNative",value:function(e,t,n){this._isAndroid()?(jsb.reflection.callStaticMethod("com/cocos/game/CocosCreatorProxyApi","setCustomerLibInfo","(Ljava/lang/String;Ljava/lang/String;)V",Config.LIB_NAME,Config.LIB_VERSION),_.isUndefined(t)?jsb.reflection.callStaticMethod("com/cocos/game/CocosCreatorProxyApi","initInstanceAppId","(Ljava/lang/String;Ljava/lang/String;)V",e,n):jsb.reflection.callStaticMethod("com/cocos/game/CocosCreatorProxyApi","initInstanceConfig","(Ljava/lang/String;Ljava/lang/String;)V",e,JSON.stringify(t))):this._isIOS()&&(jsb.reflection.callStaticMethod("CocosCreatorProxyApi","setCustomerLibInfoWithLibName:libVersion:",Config.LIB_NAME,Config.LIB_VERSION),_.isUndefined(t)?jsb.reflection.callStaticMethod("CocosCreatorProxyApi","initInstance:appId:",e,n):jsb.reflection.callStaticMethod("CocosCreatorProxyApi","initInstance:config:",e,JSON.stringify(t)))}},{key:"lightInstanceForNative",value:function(e,t){return this._isAndroid()?jsb.reflection.callStaticMethod("com/cocos/game/CocosCreatorProxyApi","lightInstance","(Ljava/lang/String;Ljava/lang/String;)V",e,t):this._isIOS()?jsb.reflection.callStaticMethod("CocosCreatorProxyApi","lightInstance:appId:",e,t):void 0}},{key:"startGravityAnalyticsForNative",value:function(e){this._isAndroid()?jsb.reflection.callStaticMethod("com/cocos/game/CocosCreatorProxyApi","startGravityAnalytics","(Ljava/lang/String;)V",e):this._isIOS()&&jsb.reflection.callStaticMethod("CocosCreatorProxyApi","startGravityAnalytics:",e)}},{key:"setDynamicSuperPropertiesForNative",value:function(e,t){this._isAndroid()?jsb.reflection.callStaticMethod("com/cocos/game/CocosCreatorProxyApi","setDynamicSuperProperties","(Ljava/lang/String;Ljava/lang/String;)V",e,t):this._isIOS()&&jsb.reflection.callStaticMethod("CocosCreatorProxyApi","setDynamicSuperProperties:appId:",e,t)}},{key:"getDeviceIdForNative",value:function(e){return this._isAndroid()?jsb.reflection.callStaticMethod("com/cocos/game/CocosCreatorProxyApi","getDeviceId","(Ljava/lang/String;)Ljava/lang/String;",e):this._isIOS()?jsb.reflection.callStaticMethod("CocosCreatorProxyApi","getDeviceId:",e):void 0}},{key:"getDistinctIdForNative",value:function(e){return this._isAndroid()?jsb.reflection.callStaticMethod("com/cocos/game/CocosCreatorProxyApi","getDistinctId","(Ljava/lang/String;)Ljava/lang/String;",e):this._isIOS()?jsb.reflection.callStaticMethod("CocosCreatorProxyApi","getDistinctId:",e):void 0}},{key:"getAccountIdForNative",value:function(e){return this._isAndroid()?jsb.reflection.callStaticMethod("com/cocos/game/CocosCreatorProxyApi","getAccountId","(Ljava/lang/String;)Ljava/lang/String;",e):this._isIOS()?jsb.reflection.callStaticMethod("CocosCreatorProxyApi","getAccountId:",e):void 0}},{key:"getPresetPropertiesForNative",value:function(e){var t="{}";return this._isAndroid()?t=jsb.reflection.callStaticMethod("com/cocos/game/CocosCreatorProxyApi","getPresetProperties","(Ljava/lang/String;)Ljava/lang/String;",e):this._isIOS()&&(t=jsb.reflection.callStaticMethod("CocosCreatorProxyApi","getPresetProperties:",e)),JSON.parse(t)}},{key:"enableTrackingForNative",value:function(e,t){this._isAndroid()?jsb.reflection.callStaticMethod("com/cocos/game/CocosCreatorProxyApi","enableTracking","(Ljava/lang/String;Ljava/lang/String;)V",e.toString(),t):this._isIOS()&&jsb.reflection.callStaticMethod("CocosCreatorProxyApi","enableTracking:appId:",e.toString(),t)}},{key:"optOutTrackingForNative",value:function(e){this._isAndroid()?jsb.reflection.callStaticMethod("com/cocos/game/CocosCreatorProxyApi","optOutTracking","(Ljava/lang/String;)V",e):this._isIOS()&&jsb.reflection.callStaticMethod("CocosCreatorProxyApi","optOutTracking:",e)}},{key:"optOutTrackingAndDeleteUserForNative",value:function(e){this._isAndroid()?jsb.reflection.callStaticMethod("com/cocos/game/CocosCreatorProxyApi","optOutTrackingAndDeleteUser","(Ljava/lang/String;)V",e):this._isIOS()&&jsb.reflection.callStaticMethod("CocosCreatorProxyApi","optOutTrackingAndDeleteUser:",e)}},{key:"optInTrackingForNative",value:function(e){this._isAndroid()?jsb.reflection.callStaticMethod("com/cocos/game/CocosCreatorProxyApi","optInTracking","(Ljava/lang/String;)V",e):this._isIOS()&&jsb.reflection.callStaticMethod("CocosCreatorProxyApi","optInTracking:",e)}},{key:"setTrackStatusForNative",value:function(e,t){this._isAndroid()?jsb.reflection.callStaticMethod("com/cocos/game/CocosCreatorProxyApi","setTrackStatus","(Ljava/lang/String;Ljava/lang/String;)V",e,t):this._isIOS()&&jsb.reflection.callStaticMethod("CocosCreatorProxyApi","setTrackStatus:appId:",e,t)}}]),n}();window.GravityAnalyticsAPI=GravityEngineAPIForNative,window.GravityAnalyticsAPIForJS=GravityEngineAPI,module.exports=GravityEngineAPIForNative;