-
Notifications
You must be signed in to change notification settings - Fork 30
Expand file tree
/
Copy pathuma.js
More file actions
1 lines (1 loc) · 38.5 KB
/
uma.js
File metadata and controls
1 lines (1 loc) · 38.5 KB
1
"use strict";var e,t,n="[UMENG] -- ",p=(t=!1,function(){null===e&&(e=new i);return e});function i(){this.setDebug=function(e){t=e};this.d=function(){if(t)try{"string"==typeof arguments[0]&&(arguments[0]=n+arguments[0]);console.debug.apply(console,arguments)}catch(e){}};this.i=function(){try{if(t)try{"string"==typeof arguments[0]&&(arguments[0]=n+arguments[0]);console.info.apply(console,arguments)}catch(e){}}catch(e){}};this.e=function(){if(t)try{"string"==typeof arguments[0]&&(arguments[0]=n+arguments[0]);console.error.apply(console,arguments)}catch(e){}};this.w=function(){if(t)try{"string"==typeof arguments[0]&&(arguments[0]=n+arguments[0]);console.warn.apply(console,arguments)}catch(e){}};this.v=function(){if(t)try{"string"==typeof arguments[0]&&(arguments[0]=n+arguments[0]);console.log.apply(console,arguments)}catch(e){}};this.t=function(){if(t)try{console.table.apply(console,arguments)}catch(e){}};this.tip=function(){try{"string"==typeof arguments[0]&&(arguments[0]=n+arguments[0]);console.log.apply(console,arguments)}catch(e){}};this.tip_w=function(e){try{console.log("%c "+n+e,"background:red; padding: 4px; padding-right: 8px; border-radius: 4px; color: #fff;")}catch(e){}};this.err=function(){try{"string"==typeof arguments[0]&&(arguments[0]=n+arguments[0]);console.error.apply(console,arguments)}catch(e){}};this.repeat=function(e){for(var t=e;t.length<86;)t+=e;return t}}var r,f=(r=e=null,function(){return r=r||new o});function o(){var n={};this.useOpenid=function(){return!!n.useOpenid};this.useSwanid=function(){return!!n.useSwanid};this.autoGetOpenid=function(){return!!n.autoGetOpenid};this.appKey=function(){return n.appKey};this.uploadUserInfo=function(){return n.uploadUserInfo};this.enableVerify=function(){return n.enableVerify};this.set=function(e){n=e};this.get=function(){return n};this.setItem=function(e,t){n[e]=t};this.getItem=function(e){return n[e]}}function s(){}s.prototype={on:function(e,t,n){var i=this.e||(this.e={});(i[e]||(i[e]=[])).push({fn:t,ctx:n});return this},once:function(e,t,n){var i=this;function r(){i.off(e,r);t.apply(n,arguments)}r._=t;return this.on(e,r,n)},emit:function(e){for(var t=[].slice.call(arguments,1),n=((this.e||(this.e={}))[e]||[]).slice(),i=0,r=n.length;i<r;i++)n[i].fn.apply(n[i].ctx,t);return this},off:function(e,t){var n=this.e||(this.e={}),i=n[e],r=[];if(i&&t)for(var o=0,s=i.length;o<s;o++)i[o].fn!==t&&i[o].fn._!==t&&r.push(i[o]);r.length?n[e]=r:delete n[e];return this}};var a=new s;a.messageType={CONFIG_LOADED:0,UMA_LIB_INITED:1};var h=new(function(){function e(){}e.prototype.setStorage=function(e,t,n){wx.setStorage({key:e,data:t,success:function(){"function"==typeof n&&n(!0)},fail:function(){"function"==typeof n&&n(!1)}})};e.prototype.getStorage=function(t,n){wx.getStorage({key:t,success:function(e){"function"==typeof n&&n(e.data)},fail:function(e){p().w(t+": "+e.errMsg);"function"==typeof n&&n()}})};e.prototype.removeStorage=function(e,t){wx.removeStorage({key:e,success:function(){"function"==typeof t&&t(!0)},fail:function(){"function"==typeof t&&t(!1)}})};e.prototype.getSystemInfo=function(s){wx.getSystemInfo({success:function(e){e.safeArea=e.safeArea||{};var t="";e.host&&"string"==typeof e.host.env&&(t=e.host.env);var n={model:e.model,brand:e.brand,pixelRatio:e.pixelRatio,screenWidth:e.screenWidth,screenHeight:e.screenHeight,fontSizeSetting:e.fontSizeSetting,platform:e.platform,platformVersion:e.version,platformSDKVersion:e.SDKVersion,language:e.language,deviceName:e.model,OSVersion:e.system,resolution:"",theme:e.theme,benchmarkLevel:e.benchmarkLevel,safeArea:{width:e.safeArea.width,height:e.safeArea.height,top:e.safeArea.top,left:e.safeArea.left,bottom:e.safeArea.bottom,right:e.safeArea.right},statusBarHeight:e.statusBarHeight,host:t},i=e.system.split(" ");Array.isArray(i)&&(n.OS=i[0]);var r=Math.round(e.screenWidth*e.pixelRatio),o=Math.round(e.screenHeight*e.pixelRatio);n.resolution=o<r?r+"*"+o:o+"*"+r;"function"==typeof s&&s(n)},fail:function(){"function"==typeof s&&s()}})};e.prototype.getDeviceInfo=function(e){"function"==typeof e&&e("")};e.prototype.checkNetworkAvailable=function(t){wx.getNetworkType({success:function(e){"function"==typeof t&&t(e&&"none"!==e.networkType)},fail:function(){"function"==typeof t&&t(!1)}})};e.prototype.getNetworkInfo=function(t){wx.getNetworkType({success:function(e){"function"==typeof t&&t({networkAvailable:"none"!==e.networkType,networkType:e.networkType})},fail:function(){"function"==typeof t&&t()}})};e.prototype.getDeviceId=function(e){e("")};e.prototype.getAdvertisingId=function(e){"function"==typeof e&&e("")};e.prototype.onNetworkStatusChange=function(t){wx.onNetworkStatusChange(function(e){"function"==typeof t&&t(e.isConnected)})};e.prototype.request=function(e){var t=e.success,n=e.fail,i=!1,r=null;e.success=function(e){if(!i){r&&clearTimeout(r);"function"==typeof t&&t(e)}};e.fail=function(){if(!i){r&&clearTimeout(r);"function"==typeof n&&n(!1)}};wx.request(e);r=setTimeout(function(){r&&clearTimeout(r);i=!0;"function"==typeof n&&n(i)},e.timeout||5e3)};e.prototype.getSdkType=function(){return"wxmp"};e.prototype.getPlatform=function(){return"wx"};e.prototype.getUserInfo=function(e){e()};e.prototype.getAppInfoSync=function(){if(wx.getAccountInfoSync){var e=wx.getAccountInfoSync(),t=e&&e.miniProgram?e.miniProgram:{};return{appId:t.appId,appEnv:t.envVersion,appVersion:t.version}}return{}};e.prototype.onShareAppMessage=function(e){wx.onShareAppMessage(e)};e.prototype.shareAppMessage=function(e){wx.shareAppMessage(e)};return e}()),u=function(e,t){return(u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function c(e,t){u(e,t);function n(){this.constructor=e}e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var d={SESSION_INTERVAL:3e4,LOG_URL:"/wxm_logs",GET_OPENID_URL:"/uminiprogram_logs/wx/getuut",USERINFO_URL:"/uminiprogram_logs/comm/uif",ENDPOINT:"https://umini.shujupie.com",ENDPOINTB:"https://ulogs.umeng.com",DEVICE_INFO_KEY:"device_info",ADVERTISING_ID:"mobile_ad_id",ANDROID_ID:"android_id",CURRENT_SESSION:"current_session",SESSION_PAUSE_TIME:"session_pause_time",EVENT_SEND_DEFAULT_INTERVAL:15e3,EVENT_LAST_SEND_TIME:"last_send_time",MAX_EVENTID_LENGTH:128,MAX_PROPERTY_KEY_LENGTH:256,MAX_PROPERTY_KEYS_COUNT:100,REPORT_POLICY:"report_policy",REPORT_INTERVAL_TIME:"report_interval_time",REPORT_POLICY_START_SEND:"1",REPORT_POLICY_INTERVAL:"6",IMPRINT:"imprint",SEED_VERSION:"1.0.0",IMPL_VERSION:"2.4.4",ALIPAY_AVAILABLE_VERSION:"10.1.52",SHARE_PATH:"um_share_path",SHARES:"shares",REQUESTS:"requests",UUID:"um_uuid",UUID_SUFFIX:"ud",OPENID:"um_od",UNIONID:"um_unid",ALIPAYID:"um_alipayid",USERID:"um_userid",PROVIDER:"um_provider",SWANID:"um_swanid",ANONYMOUSID:"um_anonymousid",LAUNCH_OPTIONS:"LAUNCH_OPTIONS",UM_SSRC:"_um_ssrc",USER_INFO:"user_info",IS_ALIYUN:!1};var l,g,v={isNumber:function(e){return!Number.isNaN(parseInt(e,10))},compareVersion:function(e,t){for(var n=String(e).split("."),i=String(t).split("."),r=0;r<Math.max(n.length,i.length);r++){var o=parseInt(n[r]||0,10),s=parseInt(i[r]||0,10);if(s<o)return 1;if(o<s)return-1}return 0},getRandomStr:function(e){for(var t="",n=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],i=0;i<Number(e);i++){t+=n[Math.round(Math.random()*(n.length-1))]}return t},clone:function(e){return JSON.parse(JSON.stringify(e))},startsWith:function(e,t){return!(!e||!t||0===t.length||t.length>e.length)&&e.substr(0,t.length)===t},endsWith:function(e,t){return!(!t||0===e.length||t.length>e.length)&&e.substring(e.length-t.length)===t},assign:function(e){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),n=1;n<arguments.length;n++){var i=arguments[n];if(i)for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(t[r]=i[r])}return t},deepEqual:function e(t,n){if(t===n)return!0;if(t&&"object"==typeof t&&n&&"object"==typeof n){if(Object.keys(t).length!==Object.keys(n).length)return!1;for(var i in t){if(Object.prototype.hasOwnProperty.call(n,i))return!1;if(!e(t[i],n[i]))return!1}return!0}return!1},trimStart:function(e,t){if(!e)return"";if("string"==typeof t&&t.length){var n=new RegExp("^"+t+"*");e=e.replace(n,"")}else e=e.replace(/^s*/,"");return e},trimEnd:function(e,t){if(!e)return"";var n,i;if("string"==typeof t&&t.length){n=new RegExp(t);i=e.length;for(;n.test(e.charAt(i));)--i;return e.slice(0,i+1)}n=/s/;i=e.length-1;for(;n.test(e.charAt(i));)--i;return e.slice(0,i+1)},isFunction:function(e){return"function"==typeof e}},_=function(e){c(t,e);function t(){return null!==e&&e.apply(this,arguments)||this}t.prototype.getOpenIdAsync=function(t,n){var i=this;wx.login({success:function(e){e.code?h.request({url:d.ENDPOINT+d.GET_OPENID_URL,method:"GET",data:{key:t,code:e.code},success:function(e){if(e&&200===e.statusCode&&e.data&&e.data.data){var t=e.data.data;i.setOpenid(t.oid);i.setUnionid(t.uid);return n&&n(!0)}n&&n()},fail:function(e){p().v("wx request failed...",e);n&&n()}}):n&&n()},fail:function(){n&&n()}})};return t}(function(t){c(e,t);function e(){var e=null!==t&&t.apply(this,arguments)||this;e._openid="";e._unionid="";e._useOpenid=!1;return e}e.prototype.initID=function(t){var n=this;n._idType=n._useOpenid?"openid":"uuid";p().v("id type: ",n._idType);h.getStorage(d.UNIONID,function(e){n._unionid=e});this._useOpenid?h.getStorage(d.OPENID,function(e){n._openid=e;t&&t()}):t&&t()};e.prototype.setUseOpenid=function(e){this._useOpenid=e};e.prototype.setOpenid=function(e){if(!this._openid&&e){this._openid=e;h.setStorage(d.OPENID,e)}};e.prototype.setUnionid=function(e){if(!this._unionid&&e){this._unionid=e;h.setStorage(d.UNIONID,e)}};e.prototype.getIdTracking=function(){var e=t.prototype.getIdTracking.call(this);this._openid&&(e.openid=this._openid);this._unionid&&(e.unionid=this._unionid);this._userid&&(e.userid=this._userid);return e};e.prototype.getId=function(){return this._useOpenid?this._openid:this._uuid};return e}(function(){function e(){this._uuid="";this._userid="";this._provider="";this._idType=""}e.prototype.createUUID=function(){return v.getRandomStr(10)+Date.now()+v.getRandomStr(7)+d.UUID_SUFFIX};e.prototype.initUUID=function(t){var n=this;h.getStorage(d.UUID,function(e){if(e)n._uuid=e;else{n._uuid=n.createUUID();h.setStorage(d.UUID,n._uuid)}t&&t(e)})};e.prototype.initUserid=function(){var t=this;h.getStorage(d.USERID,function(e){if(!t._userid&&e){t._userid=e;p().v("userId is ",e)}});h.getStorage(d.PROVIDER,function(e){if(!t._provider&&e){t._provider=e;p().v("provider is ",e)}})};e.prototype.init=function(e){var t=this;t.initUUID(function(){t.initUserid();t.initID(e)})};e.prototype.setUserid=function(e,t){if(!this._userid&&e){this._userid=e;this._provider=t;h.setStorage(d.USERID,e);h.setStorage(d.PROVIDER,t)}};e.prototype.getUserId=function(){return this._userid};e.prototype.getProvider=function(){return this._provider};e.prototype.getIdType=function(){return this._idType};e.prototype.getIdTracking=function(){var e={};this._uuid&&(e.uuid=this._uuid);this._userid&&(e.userid=this._userid);return e};return e}())),y=function(){return l=l||new _},m=function(){return g=g||new S};function S(){var n=!1,i=null,r=[];this.addPageStart=function(e){if(e&&!n){i={ts:Date.now(),path:e,page_name:e};n=!0}};this.addPageEnd=function(e){if(n&&e&&i&&e===i.page_name){var t=Date.now()-i.ts;i.duration=Math.abs(t);r.push(i);i=null;n=!1}};this.get=function(){return r};this.getCurrentPage=function(){return i};this.clear=function(){r.length=0}}var I={};function E(){return function(e){var t=[];for(var n in e)"_um_ssrc"!==n&&"_um_sts"!==n&&t.push(n+"="+e[n]);return t.join("&")}(I)}var O,A,N,T=function(){return O=O||new w};function w(){return{add:function(e,t){p().v("share origin: %o",e);var n={title:e&&e.title,path:e&&e.path&&e.path.split("?")[0],_um_sts:Date.now()};n.path&&1<n.path.length&&v.startsWith(n.path,"/")&&(n.path=v.trimStart(n.path,"/"));var i=e.path||"",r=y().getId();if(r){var o=N.split(","),s=(o=o.filter(function(e){return 0<e.length})).indexOf(r);0<=s&&(o=o.slice(0,s));o.length<3&&o.push(r);var a=o.join(",");-1!==i.indexOf("?")?i+="&_um_ssrc="+a:i+="?_um_ssrc="+a;var u=Date.now();i+="&_um_sts="+u;if(t){var c=E(),f=c?c+"&_um_ssrc="+a+"&_um_sts="+u:"_um_ssrc="+a+"&_um_sts="+u;e.query=e.query?e.query+"&_um_ssrc="+a+"&_um_sts="+u:f}else e.path=i;n._um_ssrc=a;n._um_sts=u}A.push(n);p().v("share: %o",e);return e},setShareSource:function(e){N=e},clear:function(){A.length=0},get:function(){return A}}}var k,b,R,D,U={stringify:function(e){if(e)try{return JSON.stringify(e)}catch(e){}return""},parse:function(e){if(e)try{return JSON.parse(e)}catch(e){}return null},parseToArray:function(e){if(e)try{return JSON.parse(e)}catch(e){}return[]}},P=(D=!(A=[]),function(){return k=k||new L});function L(){this.load=function(t){if(R){h.removeStorage(b);t()}else{b="um_cache_"+f().appKey();h.getStorage(b,function(e){R=U.parse(e)||{};D=!0;h.removeStorage(b);t()})}};this.save=function(){R&&h.setStorage(b,U.stringify(R))};this.set=function(e,t){R&&(R[e]=t)};this.get=function(e){return(R||{})[e]};this.remove=function(e){R&&R[e]&&delete R[e]};this.getAll=function(){return R};this.clear=function(){R=null};this.has=function(e){return!!this.get(e)};this.isLoaded=function(){return D}}var C,M,V,x,j="ekvs",K=1e4,G=(V=[],x=[],function(){return C=C||{addEvent:function(e){if(M){V.unshift(e);if(1<V.length){F();V.length=0}}else{p().w("session id is null: ",M);x.unshift(e)}},setSessionId:function(e){M=e;p().v("setSessionId: ",M);if(Array.isArray(x)&&x.length&&M){for(var t=0;t<x.length;t++)this.addEvent(x[t]);x.length=0}},getEkvs:function(){var e=P().get(j);V&&V.length&&(e=H(e,V));return e},clear:function(){P().remove(j);V.length=0}}});function F(){if(V.length){var e=P().get(j);if(function(e){var t=0;for(var n in e)Array.isArray(e[n])&&(t+=e[n].length);return t}(e)+V.length<=K){e=H(e,V);P().set(j,e)}}}function H(e,t){var n=(e=e||{})[M];Array.isArray(n)&&n.length?e[M]=n.concat(t):e[M]=[].concat(t);return e}var q,B="2g",Y="3g",W="4g",J={HALF_SESSION:"half_session",CLOSE_SESSION:"close_session",EKV:"ekv",ENTER_PAGE:"enter_page",LEAVE_PAGE:"leave_page"},X=["access","access_subtype"],z={instance:function(){return q=q||Q()}};function Q(){var e=!1,r={};function t(i){var e=P().get(d.IMPRINT);e&&(r.imprint=e);r.device_type="Phone";r.sdk_version=d.IMPL_VERSION;r.appkey=f().appKey();h.getDeviceInfo(function(e){r.device_info=e||""});var t=h.getAppInfoSync();r.appid=t.appId;r.app_env=t.appEnv;r.app_version=t.appVersion;h.getSystemInfo(function(n){h.getNetworkInfo(function(e){var t=function(e,t){var n={};(e=e||{}).safeArea=e.safeArea||{};var i=(t=t||{}).networkType;"none"===i&&(i="unknown");var r=e.model||"",o=e.platform||"",s=e.brand||"",a=s.toLowerCase();n.sdk_type=h.getSdkType();n.platform=h.getPlatform();n.platform_sdk_version=e.platformSDKVersion;n.platform_version=e.platformVersion;n.resolution=e.resolution;n.pixel_ratio=e.pixelRatio;n.os=o;n.font_size_setting=e.fontSizeSetting;n.device_model=r;n.device_brand=s;n.device_manufacturer=a;n.device_manuid=r;n.device_name=r;n.os_version=e.OSVersion;n.language=e.language;n.theme=e.theme;n.benchmark_level=e.benchmarkLevel;n.status_bar_height=e.statusBarHeight;n.safe_area_top=e.safeArea.top;n.safe_area_left=e.safeArea.left;n.safe_area_right=e.safeArea.right;n.safe_area_bottom=e.safeArea.bottom;n.safe_area_height=e.safeArea.height;n.safe_area_width=e.safeArea.width;n.storage=e.storage;n.screen_width=e.screenWidth;n.screen_height=e.screenHeight;n.host=e.host;switch(i=i?i.toLowerCase():""){case W:n.access_subtype="LTE";n.access="4G";break;case Y:n.access_subtype="CDMA";n.access="3G";break;case B:n.access_subtype="GRPS";n.access="2G";break;default:n.access=i;delete n.access_subtype}return n}(n,e);v.assign(r,t);i&&i()})})}return{init:function(){t(function(){e=!0})},isLoaded:function(){return e},get:function(){return r},getRealtimeFields:function(){var t={};X.forEach(function(e){t[e]=r[e]});return t},setIdTracking:function(e){this.setItem("id_tracking",e)},setIdType:function(e){this.setItem("id_type",e)},setAppVersion:function(e){this.setItem("app_version",e)},setSuperProperty:function(e){r.sp||(r.sp={});r.sp.isv=e},getSuperProperty:function(){return r&&r.sp?r.sp.isv:""},setItem:function(e,t){r[e]=t},getItem:function(e){return r[e]}}}var Z,$,ee,te=(ee=$=Z=q=R=k=O=g=l=null,function(){return Z=Z||ne()});function ne(){return{resume:function(e){var t=!1;ee=ee||P().get(d.CURRENT_SESSION);var n=new Date;$=n.getTime();if(!ee||!ee.end_time||$-ee.end_time>d.SESSION_INTERVAL){t=!0;!function(e){try{var t=(ee||{}).options||{},n=v.assign({},function(e){var t={};for(var n in e)0===n.indexOf("_um_")&&(t[n]=e[n]);p().v("query: ",e);p().v("_um_params: ",t);return t}(e.query));n.path=e.path||t.path;n.scene=e.scene?h.getPlatform()+"_"+e.scene:t.scene;var i=e.referrerInfo;i&&(n.referrerAppId=i.appId);p().v("session options: ",n);var r=n[d.UM_SSRC];r&&T().setShareSource(r);var o=Date.now();ee={id:v.getRandomStr(10)+o,start_time:o,options:n}}catch(e){p().e("生成新session失败: ",e)}}(e);p().v("开始新的session(%s): ",ee.id,ee)}else p().v("延续上一次session(%s): %s ",ee.id,n.toLocaleTimeString(),ee);return t},pause:function(){!function(){if(ee){var e=new Date;ee.end_time=e.getTime();"number"!=typeof ee.duration&&(ee.duration=0);ee.duration=ee.end_time-$;P().set(d.CURRENT_SESSION,ee);p().v("退出会话(%s): %s ",ee.id,e.toLocaleTimeString(),ee)}}()},getCurrentSessionId:function(){return(ee||{}).id},getCurrentSession:function(){return ee},cloneCurrentSession:function(){return v.clone(ee)}}}function ie(e){var t=null;switch(e){case J.HALF_SESSION:t=function(){var e=null,t=te().cloneCurrentSession();t&&(e={header:{st:"1"},analytics:{sessions:[t]}});return e}();break;case J.CLOSE_SESSION:t=function(){var e=null,t={},n=te().cloneCurrentSession();if(n){var i=m().get(),r=T().get();Array.isArray(i)&&i.length&&(n.pages=v.clone(i));Array.isArray(r)&&r.length&&(n.shares=v.clone(r));m().clear();T().clear();t.sessions=[n]}var o=G().getEkvs();if(o){t.ekvs=v.clone(o);G().clear()}(t.sessions||t.ekvs)&&(e={analytics:t});return e}();break;case J.EKV:t=function(){var e=null,t=G().getEkvs();if(t){e={analytics:{ekvs:v.clone(t)}};G().clear()}return e}()}return t}var re={sessions:"sn",ekvs:"e",active_user:"active_user"},oe={sdk_type:"sdt",access:"ac",access_subtype:"acs",device_model:"dm",language:"lang",device_type:"dt",device_manufacturer:"dmf",device_name:"dn",platform_version:"pv",id_type:"it",font_size_setting:"fss",os_version:"ov",device_manuid:"did",platform_sdk_version:"psv",device_brand:"db",appkey:"ak",_id:"id",id_tracking:"itr",imprint:"imp",sdk_version:"sv",resolution:"rl",testToken:"ttn",theme:"t5",benchmark_level:"bml",screen_width:"sw",screen_height:"sh",status_bar_height:"sbh",safe_area_top:"sat",safe_area_left:"sal",safe_area_right:"sar",safe_area_bottom:"sab",safe_area_height:"sah",safe_area_width:"saw",pixel_ratio:"pr",storage:"s7",host:"hs"},se={uuid:"ud",unionid:"und",openid:"od",anonymousid:"nd",alipay_id:"ad",device_id:"dd",userid:"puid"};function ae(e){return{h:function(e,t){var n=ue(e,t);e&&e.id_tracking&&(n[t.id_tracking||"id_tracking"]=ue(e.id_tracking,se));return n}(e.header,oe),a:function(e,t){var n={};if(e)for(var i in e)e[i]&&(n[t[i]]=e[i]);return n}(e.analytics,re)}}function ue(e,t){var n={};for(var i in e)t[i]?n[t[i]]=e[i]:n[i]=e[i];return n}var ce=b=N="";function fe(e){if(e.length<2){return(t=e.charCodeAt(0))<128?e:t<2048?ye(192|t>>>6)+ye(128|63&t):ye(224|t>>>12&15)+ye(128|t>>>6&63)+ye(128|63&t)}var t=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320);return ye(240|t>>>18&7)+ye(128|t>>>12&63)+ye(128|t>>>6&63)+ye(128|63&t)}function pe(e){var t=[0,2,1][e.length%3],n=e.charCodeAt(0)<<16|(1<e.length?e.charCodeAt(1):0)<<8|(2<e.length?e.charCodeAt(2):0);return[ve.charAt(n>>>18),ve.charAt(n>>>12&63),2<=t?"=":ve.charAt(n>>>6&63),1<=t?"=":ve.charAt(63&n)].join("")}function he(e){return e.replace(me,fe).replace(/[\s\S]{1,3}/g,pe)}function de(e){switch(e.length){case 4:var t=((7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3))-65536;return ye(55296+(t>>>10))+ye(56320+(1023&t));case 3:return ye((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return ye((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}}function le(e){var t=e.length,n=t%4,i=(0<t?_e[e.charAt(0)]<<18:0)|(1<t?_e[e.charAt(1)]<<12:0)|(2<t?_e[e.charAt(2)]<<6:0)|(3<t?_e[e.charAt(3)]:0),r=[ye(i>>>16),ye(i>>>8&255),ye(255&i)];r.length-=[0,0,2,1][n];return r.join("")}function ge(e){return e.replace(/[\s\S]{1,4}/g,le).replace(Se,de)}var ve="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",_e=function(e){for(var t={},n=0,i=e.length;n<i;n++)t[e.charAt(n)]=n;return t}(ve),ye=String.fromCharCode,me=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,Se=new RegExp(["[À-ß][-¿]","[à-ï][-¿]{2}","[ð-÷][-¿]{3}"].join("|"),"g"),Ie={encode:function(e,t){return t?he(String(e)).replace(/[+\/]/g,function(e){return"+"==e?"-":"_"}).replace(/=/g,""):he(String(e))},decode:function(e){return ge(String(e).replace(/[-_]/g,function(e){return"-"==e?"+":"/"}).replace(/[^A-Za-z0-9\+\/]/g,""))}};var Ee=new function(){var t="",n=this;this.set=function(e){t=e};this.get=function(){return t};this.getImpObj=function(){return U.parse(Ie.decode(t))};this.getItem=function(e){var t=n.getImpObj();return t&&t[e]||""};this.load=function(){t=P().get(d.IMPRINT)};this.save=function(){t&&P().set(d.IMPRINT,t)}};function Oe(n,i,r,e){z.instance().setIdType(y().getIdType());z.instance().setIdTracking(y().getIdTracking());var t=y().getUserId();t&&n.analytics&&(n.analytics.active_user={puid:t,provider:y().getProvider()});var o=v.clone(z.instance().get());n.header=v.assign(o,n.header,{ts:Date.now(),testToken:ce,traceId:v.getRandomStr(10)+Date.now()+v.getRandomStr(9)});var s,a=ae(n),u=U.stringify(a),c={url:d.ENDPOINT+d.LOG_URL,method:"POST",data:Ie.encode(u),success:function(e){var t=e.code||e.status||e.statusCode;if(200===t||413===t){p().i("数据发送成功: ",n,u);!function(e){if(e){z.instance().setItem(d.IMPRINT,e);Ee.set(e);Ee.save();p().v("imprint: ",Ee.getImpObj());Ee.getItem("ttn_invalid")&&(ce="")}}((e.data||{}).imprint);"function"==typeof i&&i(e)}else{p().w("数据发送失败: ",u);"function"==typeof r&&r()}},fail:function(e){p().w("超时: ",u);"function"==typeof r&&r()},complete:function(){"function"==typeof e&&e()}};h.request(v.assign(c,{header:{"Content-Type":s=h.getSdkType()+"/json","Msg-Type":s}}))}function Ae(e){var t=e,n=[];this.enqueue=function(e){"number"==typeof t&&this.size()>=t&&this.dequeue();n.push(e)};this.dequeue=function(){return n.shift()};this.front=function(){return n[0]};this.isEmpty=function(){return 0===n.length};this.clear=function(){n.length=0};this.size=function(){return n.length};this.items=function(){return n};this.print=function(){console.log(n.toString())}}var Ne,Te,we,ke,be=(Ne=null,Te=!1,we=[],ke=new Ae(50),function(){return Ne=Ne||new Ue});function Re(t){var e=ke.front();if(e)Oe(e,function(){ke.dequeue();Re(t)},function(){var e=ke.dequeue();e&&!e.noCache&&we.push(e);Re(t)});else{!function(){we.forEach(function(e){ke.enqueue(e)});we.length=0}();t()}}function De(e){if(y().getId())if(Te)p().i("队列正在发送中");else{Te=!0;Re(function(){Te=!1;"function"==typeof e&&e()})}else{p().i("获取id标识失败,暂缓发送");"function"==typeof e&&e()}}function Ue(){this.send=function(e,t,n){e?this.add(e,t,function(){De(n)}):De(n)};this.add=function(e,t,n){!function e(t,n,i){if(z.instance().isLoaded()){n=n||{};var r=ie(t);if(r){var o=z.instance().getRealtimeFields();r.header=v.assign({},r.header,o);r.noCache=n.noCache;ke.enqueue(r)}"function"==typeof i&&i()}else setTimeout(function(){e(t,n,i)},100)}(e,t,n)};this.load=function(){var e=P().get(d.REQUESTS);e&&e.length&&e.forEach(function(e){ke.enqueue(e)});P().remove(d.REQUESTS)};this.save=function(){P().set(d.REQUESTS,v.clone(ke.items()));ke.clear()}}var Pe,Le,Ce=(Le=Pe=null,function(){return Pe=Pe||new Me});function Me(){this.setUserInfo=function(e){Le=e};this.update=function(){t(Le)||h.getUserInfo(function(e){t(e)})};function t(t){if(t&&"object"==typeof t){var e=P().get(d.USER_INFO);e&&v.deepEqual(t,e)||function(t,n){var e=f().appKey(),i=h.getSdkType(),r=y().getId(),o=y().getIdType();if(!(e&&i&&r&&o))return;var s={ak:f().appKey(),sdt:h.getSdkType(),uin:t.nickName,uia:t.avatar||t.avatarUrl,uig:t.gender,uit:t.country,uip:t.province,uic:t.city,uil:t.language,id:y().getId(),it:y().getIdType()},a=JSON.stringify(s);a=Ie.encode(a);h.request({url:d.ENDPOINT+d.USERINFO_URL,method:"POST",header:{"content-type":"application/x-www-form-urlencoded"},data:"ui="+a,success:function(e){p().v("用户信息上传成功: ",t);n&&n(e&&e.data&&200===e.data.code)},fail:function(){p().e("用户信息上传失败: ",t);n&&n(!1)}})}(t,function(e){e&&P().set(d.USER_INFO,t)});return 1}}}function Ve(e,t){this.id=e;this.ts=Date.now();var n=typeof t;if("string"==n&&t)this[e]=t;else if("object"==n)for(var i in t)!{}.hasOwnProperty.call(t,i)||(this[i]=t[i])}function xe(){var u=!1,n=!1,c=0;this.init=function(e){p().v("sdk version: "+d.IMPL_VERSION);u?p().v("Lib重复实例化"):P().load(function(){p().v("cache初始化成功: ",P().getAll());!function(){y().setUseOpenid&&y().setUseOpenid(f().useOpenid());y().init(function(){z.instance().init();p().v("Header初始化成功")})}();u=!0;"function"==typeof e&&e();p().tip("SDK集成成功")})};this.resume=function(e){if(u&&!n){p().v("showOptions: ",e);var t;n=!0;f().enableVerify()&&e&&e.query&&(t=e.query._ttn,ce=t||ce);this._resume(e)}};this._resume=function(e){be().load();var t=te().resume(e),n=te().getCurrentSessionId();G().setSessionId(n);t&&be().add(J.HALF_SESSION,{},function(){y().setUseOpenid&&y().setUseOpenid(f().useOpenid());if(f().useOpenid()&&f().autoGetOpenid()&&!y().getId()){p().v("get id async");!function t(n,i){if(y().getId()||n<=0)return;y().getOpenIdAsync(f().appKey(),function(e){if(e){p().v("获取id成功");be().send()}else{p().v("获取openid失败,启动重试,剩余可用次数",n-1);setTimeout(function(){t(n-1,i)},i)}})}(10,3e3)}else{p().v("session auto send");be().send()}})};this.pause=function(e){if(u){n=!1;c=0;te().pause();f().uploadUserInfo()&&Ce().update();be().send(J.CLOSE_SESSION,{},function(){be().save();P().save();p().v("cache save success");"function"==typeof e&&e()})}};this.setOpenid=function(e){p().v("setOpenId: %s",e);y().setOpenid(e);be().send()};this.setUnionid=function(e){p().v("setUnionid: %s",e);y().setUnionid(e)};this.setUserid=function(e,t){p().v("setUserid: %s",e,t);y().setUserid(e,t)};this.setUserInfo=function(e){p().v("setUserInfo: %s",e);Ce().setUserInfo(e)};this.setAnonymousid=function(e){p().v("setAnonymousId: %s",e);y().setAnonymousid(e);be().send()};this.setAppVersion=function(e){e&&"string"!=typeof e?p().w("setAppVersion方法只接受字符串类型参数"):z.instance().setAppVersion(e)};this.setAlipayUserid=function(e){if(e&&"string"!=typeof e)p().w("setAlipayUserid方法只接受字符串类型参数");else{p().v("setAlipayUserid: %s",e);y().setAlipayUserid(e)}};this.setDeviceId=function(e){if("string"==typeof e){y().setDeviceId(e);return e}};this.setSuperProperty=function(e){if(e&&"string"!=typeof e)p().w("超级属性只支持字符串类型");else{var t=this;if(z.instance().getSuperProperty()!==e){z.instance().setSuperProperty(e);t.pause(function(){t.resume()})}}};this.trackEvent=function(e,t){if(u){p().v("event: ",e,t);if(function(e,t){if(e&&"string"==typeof e){var n=["id","ts","du"],i={};n.forEach(function(e){i[e]=1});if(i[e])p().e("eventId不能与以下保留字冲突: "+n.join(","));else if(e.length>d.MAX_EVENTID_LENGTH)p().e("The maximum length of event id shall not exceed "+d.MAX_EVENTID_LENGTH);else{if(!t||"object"==typeof t&&!Array.isArray(t)||"string"==typeof t){if("object"==typeof t){var r=0;for(var o in t)if({}.hasOwnProperty.call(t,o)){if(o.length>d.MAX_PROPERTY_KEY_LENGTH){p().e("The maximum length of property key shall not exceed "+d.MAX_PROPERTY_KEY_LENGTH);return}if(r>=d.MAX_PROPERTY_KEYS_COUNT){p().e("The maximum count of properties shall not exceed "+d.MAX_PROPERTY_KEYS_COUNT);return}if(i[o]){p().e("属性中的key不能与以下保留字冲突: "+n.join(","));return}r+=1}}return 1}p().e("please check trackEvent properties. properties should be string or object(not include Array)")}}else p().e('please check trackEvent id. id should be "string" and not null')}(e,t)){var n=new Ve(e,t);G().addEvent(n);var i=!!ce,r=i?0:d.EVENT_SEND_DEFAULT_INTERVAL,o=Date.now();if(s=o,a=r,"number"!=typeof c||"number"!=typeof a||c<=0||a<s-c){c=o;be().send(J.EKV,{noCache:i},function(){})}}var s,a}};this.trackShare=function(e){if(u)try{if(-1<h.getSdkType().indexOf("game")){e=T().add(e,!0);p().v("shareQuery: ",e)}else{e=T().add(e,!1);p().v("sharePath: ",e.path)}}catch(e){p().v("shareAppMessage: ",e)}return e};this.trackPageStart=function(e){u&&m().addPageStart(e)};this.trackPageEnd=function(e){u&&m().addPageEnd(e)};this.onShareAppMessage=function(e){var t=this;h.onShareAppMessage(function(){return t.trackShare(e())})};this.shareAppMessage=function(e){this.trackShare(e);h.shareAppMessage(e)}}var je=[];function Ke(){}Ke.prototype={createMethod:function(e,t,n){try{e[t]=n&&n[t]?function(){return n[t].apply(n,arguments)}:function(){je.push([t,[].slice.call(arguments)])}}catch(e){p().v("create method errror: ",e)}},installApi:function(e,t){try{for(var n="resume,pause,trackEvent,trackPageStart,trackPageEnd,trackShare,setUserid,setOpenid,setUnionid,setSuperProperty,setUserInfo".split(","),i=0,r=n.length;i<r;i++)this.createMethod(e,n[i],t);if(t)for(i=0,r=je.length;i<r;i++){var o=je[i];try{t[o[0]].apply(t,o[1])}catch(e){p().v("impl[v[0]].apply error: ",o[0],e)}}}catch(e){p().v("install api errror: ",e)}}};var Ge=[d.ENDPOINT,d.ENDPOINTB];function Fe(t,e){var n,i;0===t||1===t&&e?n=d.ENDPOINT:2===t&&e?n=d.ENDPOINTB:e&&(n=Ge[t]);if(t>=Ge.length||e){e&&(i=n,d.ENDPOINT=i);e&&p().v("命中可用服务",n);e||p().tip_w("未命中可用服务")}else{h.request({url:d.ENDPOINT+"/uminiprogram_logs/ckdh",success:function(e){200===(e.code||e.status||e.statusCode)&&e.data&&200===e.data.code?Fe(t+1,!0):Fe(t+1,!1)},fail:function(){Fe(t+1,!1)}})}}({init:function(e){d.ENDPOINTB&&setTimeout(function(){Fe(0,!1)},e)}}).init(3e3);var He=new Ke,qe={_inited:!1,_log:p(),preinit:function(e){if(e&&"object"==typeof e)for(var t in e)d[t]=e[t];return d},use:function(e,t){e&&v.isFunction(e.install)?e.install(qe,t):v.isFunction(e)&&e(qe,t);return qe},messager:a,init:function(e){if(this._inited)p().v("已经实例过,请避免重复初始化");else if(e)if(e.appKey){"boolean"!=typeof e.useOpenid&&(e.useOpenid=!0);f().set(e);p().setDebug(e.debug);this._inited=!0;var t=this;a.emit(a.messageType.CONFIG_LOADED,e);try{var n=new xe;p().v("成功创建Lib对象");n.init(function(){p().v("Lib对象初始化成功");He.installApi(t,n);p().v("安装Lib接口成功");a.emit(a.messageType.UMA_LIB_INITED,e)})}catch(e){p().w("创建Lib对象异常: "+e)}}else p().err("请确保传入正确的appkey");else p().err("请正确设置相关信息!")}};try{He.installApi(qe,null)}catch(e){p().w("uma赋值异常: ",e)}var Be={FETCH_URL:"https://ucc.umeng.com/v1/mini/fetch",ABLOG_URL:"https://pslog.umeng.com/mini_ablog",SDK_VERSION:"2.4.4",MOBILE_NETWORK_NONE:"none",MOBILE_NETWORK_2G:"2g",MOBILE_NETWORK_3G:"3g",MOBILE_NETWORK_4G:"4g",MOBILE_NETWORK_5G:"5g",MOBILE_NETWORK_WIFI:"wifi",IMPRINT:"imprint"},Ye={},We=Array.isArray;Ye.isArray=We||function(e){return"[object Array]"===toString.call(e)};Ye.isObject=function(e){return e===Object(e)&&!Ye.isArray(e)};Ye.isEmptyObject=function(e){if(Ye.isObject(e)){for(var t in e)if(hasOwnProperty.call(e,t))return!1;return!0}return!1};Ye.isUndefined=function(e){return void 0===e};Ye.isString=function(e){return"[object String]"===toString.call(e)};Ye.isDate=function(e){return"[object Date]"===toString.call(e)};Ye.isNumber=function(e){return"[object Number]"===toString.call(e)};Ye.each=function(e,t,n){if(null!=e){var i={},r=Array.prototype.forEach;if(r&&e.forEach===r)e.forEach(t,n);else if(e.length===+e.length){for(var o=0,s=e.length;o<s;o++)if(o in e&&t.call(n,e[o],o,e)===i)return}else for(var a in e)if(hasOwnProperty.call(e,a)&&t.call(n,e[a],a,e)===i)return}};Ye.buildQuery=function(e,t){var n,i,r=[];void 0===t&&(t="&");Ye.each(e,function(e,t){n=encodeURIComponent(e.toString());i=encodeURIComponent(t);r[r.length]=i+"="+n});return r.join(t)};Ye.JSONDecode=function(e){if(e){try{return JSON.parse(e)}catch(e){console.error("JSONDecode error",e)}return null}};Ye.JSONEncode=function(e){try{return JSON.stringify(e)}catch(e){console.error("JSONEncode error",e)}};var Je=Object.create(null);function Xe(i){p().v("开始构建 fetch body");h.getSystemInfo(function(n){h.getNetworkInfo(function(e){var t=(t=(e=e||{}).networkType)===Be.MOBILE_NETWORK_NONE?"unknown":t.toUpperCase();Je.access=t;!function(e,t){var n=e.brand||"";Je.deviceType="Phone";Je.sdkVersion=Be.SDK_VERSION;Je.appkey=f().appKey();Je.sdkType=h.getSdkType();Je.umid=y().getId();if(e){Je.language=e.language||"";Je.os=e.OS;Je.osVersion=e.OSVersion;Je.deviceName=e.deviceName;Je.platformVersion=e.platformVersion;Je.platformSdkVersion=e.platformSDKVersion;Je.deviceBrand=n;var i=e.resolution.split("*");if(Ye.isArray(i)){Je.resolutionHeight=Number(i[0]);Je.resolutionWidth=Number(i[1])}}!function(e){if(e){Je.installTime=e.install_datetime&&Date.parse(e.install_datetime);Je.scene=e.install_scene;Je.channel=e.install_channel;Je.campaign=e.install_campaign}}(Ee.getImpObj());t&&t(Je)}(n,i)})})}var ze=Object.create(null),Qe=null,Ze=!1,$e={minFetchIntervalSeconds:43200};function et(e){e&&Ye.each(e,function(e){ze[e.k]=e})}function tt(){var t=this;this.STORAGE_NAME=null;a.once(a.messageType.CONFIG_LOADED,function(e){p().v("云配初始化开始...");t.init(e)})}var nt={install:function(e,t){e.rc||(e.rc=new tt);e.messager.once(e.messager.messageType.CONFIG_LOADED,function(){e._log.v("plugin rc installed")});return e.rc}},it=!(tt.prototype={setDefaultValues:function(e){Ze&&Ye.isObject(e)&&Ye.each(e,function(e,t){ze[t]&&ze[t].v||(ze[t]={v:e})})},getValue:function(t){p().v("从配置项中读取 value, 当前配置为: ",ze);p().v("待读取的 key : ",t);try{if(!Ze)return;var e=ze[t]||{};p().v("读取相应配置ing..., 结果为: ",e);if(Ye.isNumber(e.e)&&Ye.isNumber(e.g)){p().v("读取到相应配置, 开始数据上报...");!function(e){var t={appkey:f().appKey(),sdkType:h.getSdkType(),expId:e&&e.e,groupId:e&&e.g,clientTs:Date.now(),key:e&&e.k,value:e&&e.v,umid:y().getId()};try{h.request({url:Be.ABLOG_URL,method:"POST",data:[t],success:function(e){e&&200===e.statusCode?p().v("上传数据成功",t):p().w("ablog 请求成功, 返回结果异常 ",e)},fail:function(e){p().w("ablog 请求数据错误 ",t,e)}})}catch(e){p().w("urequest 调用错误",e)}}(e)}return e.v}catch(e){p().w("getValue error, key: ",t)}},active:function(e){try{if(!Ze)return;var t,n;e&&e.params&&(t=e.params);e&&e.callback&&(n=e.callback);p().v("激活配置项: ",t);if(t){p().v("本地已缓存的配置项: ",ze);et(t);p().v("合并后的配置项: ",ze);n&&n(ze);p().v("active 结束")}else{p().v("配置项为空!! 读取本地配置...");h.getStorage(this.STORAGE_NAME,function(e){if(e){et((e=Ye.JSONDecode(e)||{}).params);p().v("当前本地配置项为: ",ze);n&&n(ze);p().v("active 结束")}else p().v("当前本地配置项为空, 退出激活")})}}catch(e){p().w("SDK active 错误",e)}},init:function(e){if(e.appKey){Qe=e.appKey;this.STORAGE_NAME="um_remote_config_{{"+Qe+"}}"}if(Qe)if(Ze)p().w("SDK 已经初始化, 请避免重复初始化");else{Ze=!0;this.setOptions(e);this.active()}else p().err("请检查您的小程序 appKey, appKey 不能为空")},setOptions:function(e){if(Ye.isObject(e)){var t=e.minFetchIntervalSeconds;Ye.isNumber(t)&&($e.minFetchIntervalSeconds=Math.max(t,5))}},fetch:function(e){if(Ze&&this.STORAGE_NAME){var i,r;e&&e.active&&(i=e.active);e&&e.callback&&(r=e.callback);var o=this;h.getStorage(this.STORAGE_NAME,function(e){p().v("开始读缓存 data is ",e);if((e=Ye.JSONDecode(e)||{}).params&&e.ts&&Date.now()-e.ts<1e3*$e.minFetchIntervalSeconds){p().v("缓存数据存在, 并且本次触发时间距离上次fetch触发时间未超过 fetch 时间间隔, 无需 fetch");r&&r(e.params)}else Xe(function(t){p().v("缓存数据不存在, 构建 fetch body :",t);try{h.request({url:Be.FETCH_URL,method:"POST",data:t,success:function(e){if(e&&200===e.statusCode&&e.data&&e.data.cc){p().v("fetch 请求成功, 响应数据: ",e.data);var t=Object.create(null);Ye.each(e.data.cc,function(e){t[e.k]=e});var n={ts:Date.now(),params:t};p().v("开始缓存 fetch 请求的云配置结果...");h.setStorage(o.STORAGE_NAME,Ye.JSONEncode(n),function(e){p().v("缓存云配置成功, 缓存数据为: ",n);p().v("缓存云配置成功, 成功消息为: ",e);p().v("云配拉取数据是否自动激活: ",i);if(e&&i){p().v("激活云配置...");o.active({params:t,callback:r})}})}else{p().w("fetch 请求成功,返回结果异常 ",e.data);r&&r()}},fail:function(e){p().w("fetch请求数据错误 ",t,e);r&&r()}})}catch(e){p().w("urequest调用错误",e)}})})}}}),rt={install:function(t,e){t.wxpluginwraper||(t.wxpluginwraper=function(e){if(!it){e.onAppShow&&e.onAppShow(function(e){t.resume(e)});e.onAppHide&&e.onAppHide(function(e){t.pause(e)});it=!0}})}},ot="",st={};function at(e){e&&(ot=e)}function ut(){return function(e,t){if(!e)return"";var n=[];for(var i in t)"_um_ssrc"!==i&&"_um_sts"!==i&&n.push(i+"="+t[i]);var r=n.join("&");return r?e+"?"+r:e}(ot,st[ot])}function ct(e,r){if(e.onShareAppMessage){var o=e.onShareAppMessage;e.onShareAppMessage=function(e){var t=o.call(this,e)||{},n=ut();!t.path&&n&&(t.path=n);var i=r.trackShare.call(this,t);return void 0===i?t:i}}}function ft(e,t,n){var i=e[t];e[t]=function(e){n.call(this,e);i&&i.call(this,e)}}function pt(e){try{qe.resume(e,!0)}catch(e){p().v("onAppShow: ",e)}}function ht(){try{qe.pause()}catch(e){p().v("onAppHide: ",e)}}function dt(){try{at(this.route);qe.trackPageStart(this.route)}catch(e){p().v("onPageShow: ",e)}}function lt(e){try{at(this.route);e&&(t=this.route,n=e,t&&(st[t]=n));p().v("Page onLoad: ",this.route,e)}catch(e){p().v("onPageLoad: ",e)}var t,n}function gt(){try{qe.trackPageEnd(this.route)}catch(e){p().v("onPageHide: ",e)}}try{var vt=App;App=function(e){ft(e,"onLaunch",function(){!function(e){try{qe.init(e)}catch(e){p().v("onAppLaunch: ",e)}}(e.umengConfig)});ft(e,"onShow",pt);ft(e,"onHide",ht);vt(e)}}catch(e){p().w("App重写异常")}try{var _t=Page;Page=function(e){ft(e,"onShow",dt);ft(e,"onHide",gt);ft(e,"onUnload",gt);ft(e,"onLoad",lt);ct(e,qe);_t(e)}}catch(e){p().w("Page重写异常")}try{var yt=Component;Component=function(t){try{t.methods=t.methods||{};var e=t.methods;ft(e,"onShow",dt);ft(e,"onHide",gt);ft(e,"onUnload",gt);ft(e,"onLoad",lt);ct(e,qe);yt(t)}catch(e){yt(t)}}}catch(e){p().w("Component重写异常")}var mt=qe.init;qe.init=function(e){if(e&&e.useOpenid){p().tip_w(p().repeat("!"));p().tip_w("openid已开启,请确保使用setOpenid设置openid或通过设置autoGetOpenid为true,并在友盟后台设置secret由友盟帮您获取");p().tip_w(p().repeat("!"))}mt.call(qe,e)};qe.use(nt);qe.use(rt);wx.uma=qe;module.exports=qe;