visual-buried-point-platform-uni 2.0.5 → 2.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e="v_userId",t="v_anonId";function n(e){return"macos"===e.toLowerCase()?"macOS":"harmonyos"===e.toLowerCase()?"Harmony OS":"ios"===e.toLowerCase()?"iOS":"android"===e.toLowerCase()?"Android":"windows"===e.toLowerCase()?"Windows":"linux"===e.toLowerCase()?"Linux":"unknown"}function r(e){return["Windows","Linux","macOS"].every((t=>e.includes(t)))?1:2}function o(){let e=wx.getStorageSync(t);return e||(e="xxxx-4xxx-yxxx-xxxx".replace(/[xy]/g,(function(e){let t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})),wx.setStorageSync(t,e)),e}const i="enter",a="loop",s="leave",u="UNIBPNPVUVSrcData",c="UNIBPNPVUVFailData",l="UNIBPNEventSrcData",p="UNIBPNEventFailData",f="UBPNOneEventData",d="UBPNOneTrackData",g="wxMini",m="v_userId",y="v_anonId";let h={env:"",domain:"",busSegment:"",module:"",flushInterval:"",pageInterval:"",token:"",appData:null,deviceData:null,distinctId:"",anonymousId:"",version:"",trackId:"",platform:"",uAgent:"",upEventUrl:"",upTrackUrl:"",isCompatible:!0,signTrackArray:[],encryptType:"1",utm:null,scene:""},S=[],w=[];const v=()=>{if(h.trackId)return h.trackId;const e=Date.now().toString();return h.trackId=e,w=[],e};function x(){return"xxxx-4xxx-yxxx-xxxx".replace(/[xy]/g,(function(e){let t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))}function b(e){const t=new Date(e);return`${t.getFullYear()}-${t.getMonth()+1<10?"0"+(t.getMonth()+1):t.getMonth()+1}-${t.getDate()<10?"0"+t.getDate():t.getDate()} ${t.getHours()<10?"0"+t.getHours():t.getHours()}:${t.getMinutes()<10?"0"+t.getMinutes():t.getMinutes()}:${t.getSeconds()<10?"0"+t.getSeconds():t.getSeconds()}`}function I(e){if("web"===h.platform){const t=e.ua.toLowerCase();return/(windows|win32|win64|wow64)/.test(t)?1:(/(linux|android)/.test(t)||/(macintosh|mac os x|iphone|ipad|ipod)/.test(t),2)}return"pc"===e.deviceType?1:2}function _(){if("web"===h.platform){let e=window.location.href;if(e&&!e.includes("file://")&&/^(https?:\/\/[^\s$.?#].[^\s]*)$/i.test(e)){const e=window.location.href.split("?")[1];if(e){const t=new URLSearchParams(e);let n={utmSource:t.get("utmSource")||"",utmCampaign:t.get("utmCampaign")||"",utmMedium:t.get("utmMedium")||"",utmTerm:t.get("utmTerm")||"",utmContent:t.get("utmContent")||"",ctk:t.get("ctk")||""};h.utm?Object.keys(n).forEach((e=>{n[e]&&(h.utm[e]=n[e])})):h.utm=n}}}return console.log("getUtmObj ",h.utm),h.utm}function k(){!function(){try{return"undefined"!=typeof wx&&wx.env&&wx.canIUse}catch(e){return!1}}()?(uni.getSystemInfo({success:function(e){h.uAgent=e.ua;const t=e.uniPlatform;if(t.includes("app"))h.platform=e.osName,h.appData=function(e){let t=plus.runtime.version,n={name:e.appName,version:t||"",carrier:"unknown",packageName:"",ecology:""};if("android"===e.platform){n.carrier="Android";let t="Android",r=plus.android.runtimeMainActivity().getPackageName();e.romName.includes("HarmonyOS")&&(t="Harmony OS",n.carrier="Harmony OS"),n.packageName=r||"",n.ecology=t}else if("ios"===e.platform){let e=plus.ios.importClass("NSBundle").mainBundle().bundleIdentifier();n.packageName=e||"",n.carrier="iOS",n.ecology="iOS"}else if("harmonyos"===e.platform){let e=uni.getAppBaseInfo();n.carrier="Harmony OS",n.ecology="Harmony OS",n.version=e.appVersion,n.packageName=e.packageName}else n.ecology="unknown";return n}(e),h.platform="Harmony OS";else if(t.includes("web")||t.includes("h5")){h.platform="web";let t=function(e){let t=e.ua.toLowerCase(),n=window.location.hostname,r=document.title;return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(t),t.includes("alipay")||t.includes("unionPay")||t.includes("onbuygz")||t.includes("onetravel"),t.includes("micromessenger")&&t.includes("miniprogram"),{name:r||"",packageName:n||"",version:"",carrier:"H5",ecology:"h5"}}(e);h.appData={...t,version:h.version?h.version:"unknown"}}else t.includes("weixin")?(h.platform="weixin",h.appData=function(){const e=uni.getAccountInfoSync(),t=uni.getAppBaseInfo();return{name:t.appName?t.appName:"",packageName:e?e.miniProgram.appId:"",version:e?e.miniProgram.envVersion+e.miniProgram.version:"",carrier:"mini",ecology:"mini"}}()):console.log("uni get platform getBaseicInfo error ");h.deviceData=function(e){var t;return{lang:e.osLanguage?e.osLanguage:e.hostLanguage,brand:e.deviceBrand?e.deviceBrand+" "+e.deviceModel:e.deviceModel,os:(t=e.osName,"macos"===t.toLowerCase()?"macOS":"harmonyos"===t.toLowerCase()?"Harmony OS":"ios"===t.toLowerCase()?"iOS":"android"===t.toLowerCase()?"Android":"windows"===t.toLowerCase()?"Windows":"linux"===t.toLowerCase()?"Linux":"unknown"),osVersion:e.osVersion,resolution:e.screenWidth+"x"+e.screenHeight,browser:e.browserName,browserVersion:e.browserVersion,color:"",deviceId:e.deviceId,deviceType:I(e),network:""}}(e)},fail:function(e){h.deviceData={lang:"",brand:"",os:"",osVersion:"",resolution:"",browser:"",browserVersion:"",color:"",deviceId:"",deviceType:"",network:""}},complete:function(){uni.getNetworkType({success(e){h.deviceData.network=e.networkType}})}}),h.distinctId=uni.getStorageSync(m)||"",h.anonymousId=uni.getStorageSync(y),h.anonymousId||(h.anonymousId=x()),uni.setStorageSync(y,h.anonymousId)):(h.platform=g,h.appData=function(){let e=wx.getAccountInfoSync().miniProgram;return{name:"",packageName:e?e.appId:"",version:e?e.envVersion+e.version:"",carrier:"mini",ecology:"mini"}}(),h.deviceData=function(){const e=wx.getSystemInfoSync();let t={lang:e.language,brand:e.brand+" "+e.model,os:n(e.platform),osVersion:e.system,resolution:e.screenWidth+"x"+e.screenHeight,browser:"",browserVersion:"",color:"",deviceId:"",deviceType:r(e.system),network:""};return wx.getNetworkType({success(e){t.network=e.networkType}}),t}(),h.distinctId=wx.getStorageSync(e)?wx.getStorageSync(e):"",h.anonymousId=o(),h.scene="WX"+wx.getLaunchOptionsSync().scene)}var T="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function B(e,t){return e(t={exports:{}},t.exports),t.exports}var O,N=(O=Object.freeze({__proto__:null,default:{}}))&&O.default||O,A=B((function(e,t){var n;e.exports=(n=n||function(e,t){var n;if("undefined"!=typeof window&&window.crypto&&(n=window.crypto),"undefined"!=typeof self&&self.crypto&&(n=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(n=globalThis.crypto),!n&&"undefined"!=typeof window&&window.msCrypto&&(n=window.msCrypto),!n&&void 0!==T&&T.crypto&&(n=T.crypto),!n)try{n=N}catch(e){}var r=function(){if(n){if("function"==typeof n.getRandomValues)try{return n.getRandomValues(new Uint32Array(1))[0]}catch(e){}if("function"==typeof n.randomBytes)try{return n.randomBytes(4).readInt32LE()}catch(e){}}throw new Error("Native crypto module could not be used to get secure random number.")},o=Object.create||function(){function e(){}return function(t){var n;return e.prototype=t,n=new e,e.prototype=null,n}}(),i={},a=i.lib={},s=a.Base={extend:function(e){var t=o(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},u=a.WordArray=s.extend({init:function(e,n){e=this.words=e||[],this.sigBytes=n!=t?n:4*e.length},toString:function(e){return(e||l).stringify(this)},concat:function(e){var t=this.words,n=e.words,r=this.sigBytes,o=e.sigBytes;if(this.clamp(),r%4)for(var i=0;i<o;i++){var a=n[i>>>2]>>>24-i%4*8&255;t[r+i>>>2]|=a<<24-(r+i)%4*8}else for(var s=0;s<o;s+=4)t[r+s>>>2]=n[s>>>2];return this.sigBytes+=o,this},clamp:function(){var t=this.words,n=this.sigBytes;t[n>>>2]&=4294967295<<32-n%4*8,t.length=e.ceil(n/4)},clone:function(){var e=s.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],n=0;n<e;n+=4)t.push(r());return new u.init(t,e)}}),c=i.enc={},l=c.Hex={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],o=0;o<n;o++){var i=t[o>>>2]>>>24-o%4*8&255;r.push((i>>>4).toString(16)),r.push((15&i).toString(16))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r<t;r+=2)n[r>>>3]|=parseInt(e.substr(r,2),16)<<24-r%8*4;return new u.init(n,t/2)}},p=c.Latin1={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],o=0;o<n;o++){var i=t[o>>>2]>>>24-o%4*8&255;r.push(String.fromCharCode(i))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r<t;r++)n[r>>>2]|=(255&e.charCodeAt(r))<<24-r%4*8;return new u.init(n,t)}},f=c.Utf8={stringify:function(e){try{return decodeURIComponent(escape(p.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return p.parse(unescape(encodeURIComponent(e)))}},d=a.BufferedBlockAlgorithm=s.extend({reset:function(){this._data=new u.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=f.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var n,r=this._data,o=r.words,i=r.sigBytes,a=this.blockSize,s=i/(4*a),c=(s=t?e.ceil(s):e.max((0|s)-this._minBufferSize,0))*a,l=e.min(4*c,i);if(c){for(var p=0;p<c;p+=a)this._doProcessBlock(o,p);n=o.splice(0,c),r.sigBytes-=l}return new u.init(n,l)},clone:function(){var e=s.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});a.Hasher=d.extend({cfg:s.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){d.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,n){return new e.init(n).finalize(t)}},_createHmacHelper:function(e){return function(t,n){return new g.HMAC.init(e,n).finalize(t)}}});var g=i.algo={};return i}(Math),n)})),C=(B((function(e,t){var n;e.exports=(n=A,function(e){var t=n,r=t.lib,o=r.WordArray,i=r.Hasher,a=t.algo,s=[],u=[];!function(){function t(t){for(var n=e.sqrt(t),r=2;r<=n;r++)if(!(t%r))return!1;return!0}function n(e){return 4294967296*(e-(0|e))|0}for(var r=2,o=0;o<64;)t(r)&&(o<8&&(s[o]=n(e.pow(r,.5))),u[o]=n(e.pow(r,1/3)),o++),r++}();var c=[],l=a.SHA256=i.extend({_doReset:function(){this._hash=new o.init(s.slice(0))},_doProcessBlock:function(e,t){for(var n=this._hash.words,r=n[0],o=n[1],i=n[2],a=n[3],s=n[4],l=n[5],p=n[6],f=n[7],d=0;d<64;d++){if(d<16)c[d]=0|e[t+d];else{var g=c[d-15],m=(g<<25|g>>>7)^(g<<14|g>>>18)^g>>>3,y=c[d-2],h=(y<<15|y>>>17)^(y<<13|y>>>19)^y>>>10;c[d]=m+c[d-7]+h+c[d-16]}var S=r&o^r&i^o&i,w=(r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22),v=f+((s<<26|s>>>6)^(s<<21|s>>>11)^(s<<7|s>>>25))+(s&l^~s&p)+u[d]+c[d];f=p,p=l,l=s,s=a+v|0,a=i,i=o,o=r,r=v+(w+S)|0}n[0]=n[0]+r|0,n[1]=n[1]+o|0,n[2]=n[2]+i|0,n[3]=n[3]+a|0,n[4]=n[4]+s|0,n[5]=n[5]+l|0,n[6]=n[6]+p|0,n[7]=n[7]+f|0},_doFinalize:function(){var t=this._data,n=t.words,r=8*this._nDataBytes,o=8*t.sigBytes;return n[o>>>5]|=128<<24-o%32,n[14+(o+64>>>9<<4)]=e.floor(r/4294967296),n[15+(o+64>>>9<<4)]=r,t.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=i._createHelper(l),t.HmacSHA256=i._createHmacHelper(l)}(Math),n.SHA256)})),B((function(e,t){var n,r,o;e.exports=(r=(n=A).lib.Base,o=n.enc.Utf8,void(n.algo.HMAC=r.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=o.parse(t));var n=e.blockSize,r=4*n;t.sigBytes>r&&(t=e.finalize(t)),t.clamp();for(var i=this._oKey=t.clone(),a=this._iKey=t.clone(),s=i.words,u=a.words,c=0;c<n;c++)s[c]^=1549556828,u[c]^=909522486;i.sigBytes=a.sigBytes=r,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var t=this._hasher,n=t.finalize(e);return t.reset(),t.finalize(this._oKey.clone().concat(n))}})))})),B((function(e,t){e.exports=A.HmacSHA256}))),D=B((function(e){!function(){var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n={rotl:function(e,t){return e<<t|e>>>32-t},rotr:function(e,t){return e<<32-t|e>>>t},endian:function(e){if(e.constructor==Number)return 16711935&n.rotl(e,8)|4278255360&n.rotl(e,24);for(var t=0;t<e.length;t++)e[t]=n.endian(e[t]);return e},randomBytes:function(e){for(var t=[];e>0;e--)t.push(Math.floor(256*Math.random()));return t},bytesToWords:function(e){for(var t=[],n=0,r=0;n<e.length;n++,r+=8)t[r>>>5]|=e[n]<<24-r%32;return t},wordsToBytes:function(e){for(var t=[],n=0;n<32*e.length;n+=8)t.push(e[n>>>5]>>>24-n%32&255);return t},bytesToHex:function(e){for(var t=[],n=0;n<e.length;n++)t.push((e[n]>>>4).toString(16)),t.push((15&e[n]).toString(16));return t.join("")},hexToBytes:function(e){for(var t=[],n=0;n<e.length;n+=2)t.push(parseInt(e.substr(n,2),16));return t},bytesToBase64:function(e){for(var n=[],r=0;r<e.length;r+=3)for(var o=e[r]<<16|e[r+1]<<8|e[r+2],i=0;i<4;i++)8*r+6*i<=8*e.length?n.push(t.charAt(o>>>6*(3-i)&63)):n.push("=");return n.join("")},base64ToBytes:function(e){e=e.replace(/[^A-Z0-9+\/]/gi,"");for(var n=[],r=0,o=0;r<e.length;o=++r%4)0!=o&&n.push((t.indexOf(e.charAt(r-1))&Math.pow(2,-2*o+8)-1)<<2*o|t.indexOf(e.charAt(r))>>>6-2*o);return n}};e.exports=n}()})),U={utf8:{stringToBytes:function(e){return U.bin.stringToBytes(unescape(encodeURIComponent(e)))},bytesToString:function(e){return decodeURIComponent(escape(U.bin.bytesToString(e)))}},bin:{stringToBytes:function(e){for(var t=[],n=0;n<e.length;n++)t.push(255&e.charCodeAt(n));return t},bytesToString:function(e){for(var t=[],n=0;n<e.length;n++)t.push(String.fromCharCode(e[n]));return t.join("")}}},H=U,P=function(e){return null!=e&&(M(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&M(e.slice(0,0))}(e)||!!e._isBuffer)};function M(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}var L=B((function(e){!function(){var t=D,n=H.utf8,r=P,o=H.bin,i=function(e,a){e.constructor==String?e=a&&"binary"===a.encoding?o.stringToBytes(e):n.stringToBytes(e):r(e)?e=Array.prototype.slice.call(e,0):Array.isArray(e)||e.constructor===Uint8Array||(e=e.toString());for(var s=t.bytesToWords(e),u=8*e.length,c=1732584193,l=-271733879,p=-1732584194,f=271733878,d=0;d<s.length;d++)s[d]=16711935&(s[d]<<8|s[d]>>>24)|4278255360&(s[d]<<24|s[d]>>>8);s[u>>>5]|=128<<u%32,s[14+(u+64>>>9<<4)]=u;var g=i._ff,m=i._gg,y=i._hh,h=i._ii;for(d=0;d<s.length;d+=16){var S=c,w=l,v=p,x=f;c=g(c,l,p,f,s[d+0],7,-680876936),f=g(f,c,l,p,s[d+1],12,-389564586),p=g(p,f,c,l,s[d+2],17,606105819),l=g(l,p,f,c,s[d+3],22,-1044525330),c=g(c,l,p,f,s[d+4],7,-176418897),f=g(f,c,l,p,s[d+5],12,1200080426),p=g(p,f,c,l,s[d+6],17,-1473231341),l=g(l,p,f,c,s[d+7],22,-45705983),c=g(c,l,p,f,s[d+8],7,1770035416),f=g(f,c,l,p,s[d+9],12,-1958414417),p=g(p,f,c,l,s[d+10],17,-42063),l=g(l,p,f,c,s[d+11],22,-1990404162),c=g(c,l,p,f,s[d+12],7,1804603682),f=g(f,c,l,p,s[d+13],12,-40341101),p=g(p,f,c,l,s[d+14],17,-1502002290),c=m(c,l=g(l,p,f,c,s[d+15],22,1236535329),p,f,s[d+1],5,-165796510),f=m(f,c,l,p,s[d+6],9,-1069501632),p=m(p,f,c,l,s[d+11],14,643717713),l=m(l,p,f,c,s[d+0],20,-373897302),c=m(c,l,p,f,s[d+5],5,-701558691),f=m(f,c,l,p,s[d+10],9,38016083),p=m(p,f,c,l,s[d+15],14,-660478335),l=m(l,p,f,c,s[d+4],20,-405537848),c=m(c,l,p,f,s[d+9],5,568446438),f=m(f,c,l,p,s[d+14],9,-1019803690),p=m(p,f,c,l,s[d+3],14,-187363961),l=m(l,p,f,c,s[d+8],20,1163531501),c=m(c,l,p,f,s[d+13],5,-1444681467),f=m(f,c,l,p,s[d+2],9,-51403784),p=m(p,f,c,l,s[d+7],14,1735328473),c=y(c,l=m(l,p,f,c,s[d+12],20,-1926607734),p,f,s[d+5],4,-378558),f=y(f,c,l,p,s[d+8],11,-2022574463),p=y(p,f,c,l,s[d+11],16,1839030562),l=y(l,p,f,c,s[d+14],23,-35309556),c=y(c,l,p,f,s[d+1],4,-1530992060),f=y(f,c,l,p,s[d+4],11,1272893353),p=y(p,f,c,l,s[d+7],16,-155497632),l=y(l,p,f,c,s[d+10],23,-1094730640),c=y(c,l,p,f,s[d+13],4,681279174),f=y(f,c,l,p,s[d+0],11,-358537222),p=y(p,f,c,l,s[d+3],16,-722521979),l=y(l,p,f,c,s[d+6],23,76029189),c=y(c,l,p,f,s[d+9],4,-640364487),f=y(f,c,l,p,s[d+12],11,-421815835),p=y(p,f,c,l,s[d+15],16,530742520),c=h(c,l=y(l,p,f,c,s[d+2],23,-995338651),p,f,s[d+0],6,-198630844),f=h(f,c,l,p,s[d+7],10,1126891415),p=h(p,f,c,l,s[d+14],15,-1416354905),l=h(l,p,f,c,s[d+5],21,-57434055),c=h(c,l,p,f,s[d+12],6,1700485571),f=h(f,c,l,p,s[d+3],10,-1894986606),p=h(p,f,c,l,s[d+10],15,-1051523),l=h(l,p,f,c,s[d+1],21,-2054922799),c=h(c,l,p,f,s[d+8],6,1873313359),f=h(f,c,l,p,s[d+15],10,-30611744),p=h(p,f,c,l,s[d+6],15,-1560198380),l=h(l,p,f,c,s[d+13],21,1309151649),c=h(c,l,p,f,s[d+4],6,-145523070),f=h(f,c,l,p,s[d+11],10,-1120210379),p=h(p,f,c,l,s[d+2],15,718787259),l=h(l,p,f,c,s[d+9],21,-343485551),c=c+S>>>0,l=l+w>>>0,p=p+v>>>0,f=f+x>>>0}return t.endian([c,l,p,f])};i._ff=function(e,t,n,r,o,i,a){var s=e+(t&n|~t&r)+(o>>>0)+a;return(s<<i|s>>>32-i)+t},i._gg=function(e,t,n,r,o,i,a){var s=e+(t&r|n&~r)+(o>>>0)+a;return(s<<i|s>>>32-i)+t},i._hh=function(e,t,n,r,o,i,a){var s=e+(t^n^r)+(o>>>0)+a;return(s<<i|s>>>32-i)+t},i._ii=function(e,t,n,r,o,i,a){var s=e+(n^(t|~r))+(o>>>0)+a;return(s<<i|s>>>32-i)+t},i._blocksize=16,i._digestsize=16,e.exports=function(e,n){if(null==e)throw new Error("Illegal argument "+e);var r=t.wordsToBytes(i(e,n));return n&&n.asBytes?r:n&&n.asString?o.bytesToString(r):t.bytesToHex(r)}}()}));function $(e){return"1"===h.encryptType?L(e):"2"===h.encryptType?C(e,"jCfeIQH52pMcgNUQoXYA").toString():void 0}function J(e,t,n){if(!e)return void console.error("please set upload data upType");var r;const o={...(r=t,{app:h.appData,data:r,device:h.deviceData,lsi:"05a525811db8d1a7e3bba884ec007649#2.0.5",projectId:h.token,userAgent:h.uAgent||"",anonymousId:h.anonymousId,userId:h.distinctId}),dataAbstract:$(JSON.stringify(t))};h.platform===g?wx.request({url:"event"===e?h.upEventUrl:h.upTrackUrl,method:"POST",header:{"Content-Type":"application/json",appKey:h.token,projectId:h.token},data:o,success:function(e){e&&e.data&&(n===f?z(t,p):n===d?z(t,c):wx.setStorageSync(n,JSON.stringify(t)))},fail:function(e){console.error(e),wx.setStorageSync(n,JSON.stringify(t))}}):uni.request({url:"event"===e?h.upEventUrl:h.upTrackUrl,method:"POST",header:{"Content-Type":"application/json",appKey:h.token,projectId:h.token},data:o,success:function(e){e&&e.data&&(n===f?z(t,p):n===d?z(t,c):uni.setStorageSync(n,JSON.stringify(t)))},fail:function(e){console.log("error: ",e),uni.setStorageSync(n,JSON.stringify(t))}})}function z(e,t){if(h.platform===g){let n=wx.getStorageSync(t),r=n?JSON.parse(n):[];r.concat(e),wx.setStorageSync(t,JSON.stringify(r))}else{let n=uni.getStorageSync(t),r=n?JSON.parse(n):[];r.concat(e),uni.setStorageSync(t,JSON.stringify(r))}}function E(e){const t=e.$page?e.$page:"",n=t.path?t.path:function(){const e=getCurrentPages(),t=e[e.length-1];return t?t.route:"/"}();let r={busSegment:e.$busSegment||0===e.$busSegment?e.$busSegment:"",module:e.$module||0===e.$module?e.$module:"",properties:e.$extend_param?JSON.stringify(e.$extend_param):"",traceId:"",trackId:v(),sceneTag:h.scene,eventId:e.$event_id?e.$event_id:"",event:e.$event_code?e.$event_code:"",utm:_(),duration:null,element:e.$element?e.$element:null,triggerTime:b(Date.now()),page:{domain:t.domain?t.domain:"",url:n||"",path:n||"",title:t.title||"",pageId:L(n)}};r&&(!0===e.$sendMode||!0===e.$send?J("event",[r],f):function(e){let t;t=h.platform===g?wx.getStorageSync(l):uni.getStorageSync(l);let n=t?JSON.parse(t):[];n.push(e),h.platform===g?wx.setStorageSync(l,JSON.stringify(n)):uni.setStorageSync(l,JSON.stringify(n))}(r))}let j,V,R,W,F,K,q,G;function Q(){W&&K&&(X(s,null),clearInterval(W),W=null,K=null,G=null)}function X(e,t){if(e===i)K=null,F=1,j=0,V=Date.now(),R=V,q=x(),K=function(e){const t=getCurrentPages(),n=t[t.length-1];let r=h.platform,o="",i="",a="",s="";if("web"===r||"h5"===r){if(o=window.location.href,i=window.location.hostname,document.referrer){let e=new URL(document.referrer);a=e||"",s=e.hostname||""}}else o=n.route,a=t.length>1?t[t.length-2].route:n.route,i=h.domain?h.domain:n.route;if(n)return{path:n.route,busSegment:e.busSegment||0===e.busSegment?e.busSegment:"",module:e.module||0===e.module?e.module:"",properties:e.extend_param?JSON.stringify(e.extend_param):"",title:e.title?e.title:"",domain:i,url:o,visitPage:t.length,sourceDomain:s,sourceUrl:a,send:e.send||e.sendMode}}(t),G=K.send,w.push(K.path);else if(e===a)F=2,j=15,R=Date.now();else if(e===s){F=3;let e=Math.max(1,(Date.now()-R)/1e3);j=Math.ceil(e)}let n={busSegment:K.busSegment,module:K.module,properties:K.properties,traceId:"",trackId:v(),sceneTag:h.scene,utm:_(),domain:K.domain,title:K.title,sourceDomain:K.sourceDomain,url:K.url,path:K.path,sourceUrl:K.sourceUrl,duration:j,circulation:F,visitPage:w.length,visitTime:b(V),uid:q};n&&(!0===G?(delete n.uid,J("track",[n],d)):function(e,t){let n=null;n=h.platform===g?wx.getStorageSync(u):uni.getStorageSync(u);let r=n?JSON.parse(n):[];if(r.length>0){const n=r.findIndex((e=>e.uid===t));-1!==n?r[n]={...r[n],...e}:r.push(e)}else r.push(e);h.platform===g?wx.setStorageSync(u,JSON.stringify(r)):uni.setStorageSync(u,JSON.stringify(r))}(n,q))}let Y=null;exports.clearUtm=function(){h.utm=null},exports.getTrackId=function(){return v()},exports.init=function(e){if(e){const t="test"===e.env?{upEventApi:"https://buryingpoint.gcongo.com.cn/client/api/event",upTrackApi:"https://buryingpoint.gcongo.com.cn/client/api/track",eventListApi:"https://buryingpoint.gcongo.com.cn/api/event/query/eventList"}:{upEventApi:"https://buryingpoint.onebuygz.com/client/api/event",upTrackApi:"https://buryingpoint.onebuygz.com/client/api/track",eventListApi:"https://buryingpoint.onebuygz.com/api/event/query/eventList"};h.upEventUrl=t.upEventApi,h.upTrackUrl=t.upTrackApi,function(){const e=Date.now().toString();h.trackId=e,h.utm=null,w=[],console.log("tid ",e)}(),Object.assign(h,e),k(),clearInterval(Y),Y=null,Y=setInterval((()=>{!function(){let e=null,t=null,n=[];h.platform===g?(e=wx.getStorageSync(l),wx.setStorageSync(l,""),t=wx.getStorageSync(p),wx.setStorageSync(p,"")):(e=uni.getStorageSync(l),uni.setStorageSync(l,""),t=uni.getStorageSync(p),uni.setStorageSync(p,""));const r=e?JSON.parse(e):[],o=t?JSON.parse(t):[];n.push(...r),n.push(...o),n&&n.length&&J("event",n,p)}(),function(){let e=null,t=null,n=[];h.platform===g?(e=wx.getStorageSync(u),wx.setStorageSync(u,""),t=wx.getStorageSync(c),wx.setStorageSync(c,"")):(e=uni.getStorageSync(u),uni.setStorageSync(u,""),t=uni.getStorageSync(c),uni.setStorageSync(c,""));const r=e?JSON.parse(e):[],o=t?JSON.parse(t):[];n.push(...r),n.push(...o),n&&n.length&&(n.forEach((e=>{delete e.uid})),J("track",n,c))}()}),15e3),h.isCompatible||h.platform}else console.log("init config error, please check config!");console.log("Global",h)},exports.onDestroyTrack=function(){Q()},exports.onStartTrack=function(e){var t;e&&(t=e,W&&K&&Q(),clearInterval(W),X(i,t),W=setInterval((()=>{X(a,null)}),15e3))},exports.setCustomEvent=function(e){e&&E(e)},exports.setPageExtraObj=function(e){!function(e){const t=getCurrentPages();let n=t[t.length-1];const r=S.findIndex((e=>e.path===n.route));let o={path:n.route,properties:e.properties?JSON.stringify(e.properties):"",busSegment:e.busSegment?e.busSegment:"",module:e.module?e.module:"",title:e.title?e.title:""};-1!==r?S[r]=o:S.push(o)}(e)},exports.setUserId=function(e){e?(h.distinctId=e,h.platform===g?wx.setStorageSync(m,e):uni.setStorageSync(m,e)):(h.distinctId="",h.platform===g?wx.setStorageSync(m,e):uni.setStorageSync(m,""))},exports.setUtmData=function(e){var t;t=e,h.utm=t?{utmSource:t.utmSource||"",utmCampaign:t.utmCampaign||"",utmMedium:t.utmMedium||"",utmTerm:t.utmTerm||"",utmContent:t.utmContent||"",ctk:t.ctk||""}:null,console.log("设置的Global.utm",h.utm)};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e="v_userId",t="v_anonId";function n(e){return"macos"===e.toLowerCase()?"macOS":"harmonyos"===e.toLowerCase()?"Harmony OS":"ios"===e.toLowerCase()?"iOS":"android"===e.toLowerCase()?"Android":"windows"===e.toLowerCase()?"Windows":"linux"===e.toLowerCase()?"Linux":"unknown"}function r(e){return["Windows","Linux","macOS"].every((t=>e.includes(t)))?1:2}function o(){let e=wx.getStorageSync(t);return e||(e="xxxx-4xxx-yxxx-xxxx".replace(/[xy]/g,(function(e){let t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})),wx.setStorageSync(t,e)),e}const i="enter",a="loop",s="leave",u="UNIBPNPVUVSrcData",c="UNIBPNPVUVFailData",l="UNIBPNEventSrcData",p="UNIBPNEventFailData",f="UBPNOneEventData",d="UBPNOneTrackData",g="wxMini",m="v_userId",y="v_anonId";let h={env:"",domain:"",busSegment:"",module:"",flushInterval:"",pageInterval:"",token:"",appData:null,deviceData:null,distinctId:"",anonymousId:"",version:"",trackId:"",platform:"",uAgent:"",upEventUrl:"",upTrackUrl:"",isCompatible:!0,signTrackArray:[],encryptType:2,utm:null,scene:""},S=[],w=[];const v=()=>{if(h.trackId)return h.trackId;const e=Date.now().toString();return h.trackId=e,w=[],e};function x(){return"xxxx-4xxx-yxxx-xxxx".replace(/[xy]/g,(function(e){let t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))}function b(e){const t=new Date(e);return`${t.getFullYear()}-${t.getMonth()+1<10?"0"+(t.getMonth()+1):t.getMonth()+1}-${t.getDate()<10?"0"+t.getDate():t.getDate()} ${t.getHours()<10?"0"+t.getHours():t.getHours()}:${t.getMinutes()<10?"0"+t.getMinutes():t.getMinutes()}:${t.getSeconds()<10?"0"+t.getSeconds():t.getSeconds()}`}function I(e){if("web"===h.platform){const t=e.ua.toLowerCase();return/(windows|win32|win64|wow64)/.test(t)?1:(/(linux|android)/.test(t)||/(macintosh|mac os x|iphone|ipad|ipod)/.test(t),2)}return"pc"===e.deviceType?1:2}function k(){if("web"===h.platform){let e=window.location.href;if(e&&!e.includes("file://")&&/^(https?:\/\/[^\s$.?#].[^\s]*)$/i.test(e)){const e=window.location.href.split("?")[1];if(e){const t=new URLSearchParams(e);let n={utmSource:t.get("utmSource")||"",utmCampaign:t.get("utmCampaign")||"",utmMedium:t.get("utmMedium")||"",utmTerm:t.get("utmTerm")||"",utmContent:t.get("utmContent")||"",ctk:t.get("ctk")||""};h.utm?Object.keys(n).forEach((e=>{n[e]&&(h.utm[e]=n[e])})):h.utm=n}}}return h.utm}function _(){!function(){try{return"undefined"!=typeof wx&&wx.env&&wx.canIUse}catch(e){return!1}}()?(uni.getSystemInfo({success:function(e){h.uAgent=e.ua;const t=e.uniPlatform;if(t.includes("app"))h.platform=e.osName,h.appData=function(e){let t=plus.runtime.version,n={name:e.appName,version:t||"",carrier:"unknown",packageName:"",ecology:""};if("android"===e.platform){n.carrier="Android";let t="Android",r=plus.android.runtimeMainActivity().getPackageName();e.romName.includes("HarmonyOS")&&(t="Harmony OS",n.carrier="Harmony OS"),n.packageName=r||"",n.ecology=t}else if("ios"===e.platform){let e=plus.ios.importClass("NSBundle").mainBundle().bundleIdentifier();n.packageName=e||"",n.carrier="iOS",n.ecology="iOS"}else if("harmonyos"===e.platform){let e=uni.getAppBaseInfo();n.carrier="Harmony OS",n.ecology="Harmony OS",n.version=e.appVersion,n.packageName=e.packageName}else n.ecology="unknown";return n}(e),h.platform="Harmony OS";else if(t.includes("web")||t.includes("h5")){h.platform="web";let t=function(e){let t=e.ua.toLowerCase(),n=window.location.hostname,r=document.title;return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(t),t.includes("alipay")||t.includes("unionPay")||t.includes("onbuygz")||t.includes("onetravel"),t.includes("micromessenger")&&t.includes("miniprogram"),{name:r||"",packageName:n||"",version:"",carrier:"H5",ecology:"h5"}}(e);h.appData={...t,version:h.version?h.version:"unknown"}}else t.includes("weixin")?(h.platform="weixin",h.appData=function(){const e=uni.getAccountInfoSync(),t=uni.getAppBaseInfo();return{name:t.appName?t.appName:"",packageName:e?e.miniProgram.appId:"",version:e?e.miniProgram.envVersion+e.miniProgram.version:"",carrier:"mini",ecology:"mini"}}()):console.log("uni get platform getBaseicInfo error ");h.deviceData=function(e){var t;return{lang:e.osLanguage?e.osLanguage:e.hostLanguage,brand:e.deviceBrand?e.deviceBrand+" "+e.deviceModel:e.deviceModel,os:(t=e.osName,"macos"===t.toLowerCase()?"macOS":"harmonyos"===t.toLowerCase()?"Harmony OS":"ios"===t.toLowerCase()?"iOS":"android"===t.toLowerCase()?"Android":"windows"===t.toLowerCase()?"Windows":"linux"===t.toLowerCase()?"Linux":"unknown"),osVersion:e.osVersion,resolution:e.screenWidth+"x"+e.screenHeight,browser:e.browserName,browserVersion:e.browserVersion,color:"",deviceId:e.deviceId,deviceType:I(e),network:""}}(e)},fail:function(e){h.deviceData={lang:"",brand:"",os:"",osVersion:"",resolution:"",browser:"",browserVersion:"",color:"",deviceId:"",deviceType:"",network:""}},complete:function(){uni.getNetworkType({success(e){h.deviceData.network=e.networkType}})}}),h.distinctId=uni.getStorageSync(m)||"",h.anonymousId=uni.getStorageSync(y),h.anonymousId||(h.anonymousId=x()),uni.setStorageSync(y,h.anonymousId)):(h.platform=g,h.appData=function(){let e=wx.getAccountInfoSync().miniProgram;return{name:"",packageName:e?e.appId:"",version:e?e.envVersion+e.version:"",carrier:"mini",ecology:"mini"}}(),h.deviceData=function(){const e=wx.getSystemInfoSync();let t={lang:e.language,brand:e.brand+" "+e.model,os:n(e.platform),osVersion:e.system,resolution:e.screenWidth+"x"+e.screenHeight,browser:"",browserVersion:"",color:"",deviceId:"",deviceType:r(e.system),network:""};return wx.getNetworkType({success(e){t.network=e.networkType}}),t}(),h.distinctId=wx.getStorageSync(e)?wx.getStorageSync(e):"",h.anonymousId=o(),h.scene="WX"+wx.getLaunchOptionsSync().scene)}var T="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function B(e,t){return e(t={exports:{}},t.exports),t.exports}var O,N=(O=Object.freeze({__proto__:null,default:{}}))&&O.default||O,A=B((function(e,t){var n;e.exports=(n=n||function(e,t){var n;if("undefined"!=typeof window&&window.crypto&&(n=window.crypto),"undefined"!=typeof self&&self.crypto&&(n=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(n=globalThis.crypto),!n&&"undefined"!=typeof window&&window.msCrypto&&(n=window.msCrypto),!n&&void 0!==T&&T.crypto&&(n=T.crypto),!n)try{n=N}catch(e){}var r=function(){if(n){if("function"==typeof n.getRandomValues)try{return n.getRandomValues(new Uint32Array(1))[0]}catch(e){}if("function"==typeof n.randomBytes)try{return n.randomBytes(4).readInt32LE()}catch(e){}}throw new Error("Native crypto module could not be used to get secure random number.")},o=Object.create||function(){function e(){}return function(t){var n;return e.prototype=t,n=new e,e.prototype=null,n}}(),i={},a=i.lib={},s=a.Base={extend:function(e){var t=o(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},u=a.WordArray=s.extend({init:function(e,n){e=this.words=e||[],this.sigBytes=n!=t?n:4*e.length},toString:function(e){return(e||l).stringify(this)},concat:function(e){var t=this.words,n=e.words,r=this.sigBytes,o=e.sigBytes;if(this.clamp(),r%4)for(var i=0;i<o;i++){var a=n[i>>>2]>>>24-i%4*8&255;t[r+i>>>2]|=a<<24-(r+i)%4*8}else for(var s=0;s<o;s+=4)t[r+s>>>2]=n[s>>>2];return this.sigBytes+=o,this},clamp:function(){var t=this.words,n=this.sigBytes;t[n>>>2]&=4294967295<<32-n%4*8,t.length=e.ceil(n/4)},clone:function(){var e=s.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],n=0;n<e;n+=4)t.push(r());return new u.init(t,e)}}),c=i.enc={},l=c.Hex={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],o=0;o<n;o++){var i=t[o>>>2]>>>24-o%4*8&255;r.push((i>>>4).toString(16)),r.push((15&i).toString(16))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r<t;r+=2)n[r>>>3]|=parseInt(e.substr(r,2),16)<<24-r%8*4;return new u.init(n,t/2)}},p=c.Latin1={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],o=0;o<n;o++){var i=t[o>>>2]>>>24-o%4*8&255;r.push(String.fromCharCode(i))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r<t;r++)n[r>>>2]|=(255&e.charCodeAt(r))<<24-r%4*8;return new u.init(n,t)}},f=c.Utf8={stringify:function(e){try{return decodeURIComponent(escape(p.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return p.parse(unescape(encodeURIComponent(e)))}},d=a.BufferedBlockAlgorithm=s.extend({reset:function(){this._data=new u.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=f.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var n,r=this._data,o=r.words,i=r.sigBytes,a=this.blockSize,s=i/(4*a),c=(s=t?e.ceil(s):e.max((0|s)-this._minBufferSize,0))*a,l=e.min(4*c,i);if(c){for(var p=0;p<c;p+=a)this._doProcessBlock(o,p);n=o.splice(0,c),r.sigBytes-=l}return new u.init(n,l)},clone:function(){var e=s.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});a.Hasher=d.extend({cfg:s.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){d.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,n){return new e.init(n).finalize(t)}},_createHmacHelper:function(e){return function(t,n){return new g.HMAC.init(e,n).finalize(t)}}});var g=i.algo={};return i}(Math),n)})),C=(B((function(e,t){var n;e.exports=(n=A,function(e){var t=n,r=t.lib,o=r.WordArray,i=r.Hasher,a=t.algo,s=[],u=[];!function(){function t(t){for(var n=e.sqrt(t),r=2;r<=n;r++)if(!(t%r))return!1;return!0}function n(e){return 4294967296*(e-(0|e))|0}for(var r=2,o=0;o<64;)t(r)&&(o<8&&(s[o]=n(e.pow(r,.5))),u[o]=n(e.pow(r,1/3)),o++),r++}();var c=[],l=a.SHA256=i.extend({_doReset:function(){this._hash=new o.init(s.slice(0))},_doProcessBlock:function(e,t){for(var n=this._hash.words,r=n[0],o=n[1],i=n[2],a=n[3],s=n[4],l=n[5],p=n[6],f=n[7],d=0;d<64;d++){if(d<16)c[d]=0|e[t+d];else{var g=c[d-15],m=(g<<25|g>>>7)^(g<<14|g>>>18)^g>>>3,y=c[d-2],h=(y<<15|y>>>17)^(y<<13|y>>>19)^y>>>10;c[d]=m+c[d-7]+h+c[d-16]}var S=r&o^r&i^o&i,w=(r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22),v=f+((s<<26|s>>>6)^(s<<21|s>>>11)^(s<<7|s>>>25))+(s&l^~s&p)+u[d]+c[d];f=p,p=l,l=s,s=a+v|0,a=i,i=o,o=r,r=v+(w+S)|0}n[0]=n[0]+r|0,n[1]=n[1]+o|0,n[2]=n[2]+i|0,n[3]=n[3]+a|0,n[4]=n[4]+s|0,n[5]=n[5]+l|0,n[6]=n[6]+p|0,n[7]=n[7]+f|0},_doFinalize:function(){var t=this._data,n=t.words,r=8*this._nDataBytes,o=8*t.sigBytes;return n[o>>>5]|=128<<24-o%32,n[14+(o+64>>>9<<4)]=e.floor(r/4294967296),n[15+(o+64>>>9<<4)]=r,t.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=i._createHelper(l),t.HmacSHA256=i._createHmacHelper(l)}(Math),n.SHA256)})),B((function(e,t){var n,r,o;e.exports=(r=(n=A).lib.Base,o=n.enc.Utf8,void(n.algo.HMAC=r.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=o.parse(t));var n=e.blockSize,r=4*n;t.sigBytes>r&&(t=e.finalize(t)),t.clamp();for(var i=this._oKey=t.clone(),a=this._iKey=t.clone(),s=i.words,u=a.words,c=0;c<n;c++)s[c]^=1549556828,u[c]^=909522486;i.sigBytes=a.sigBytes=r,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var t=this._hasher,n=t.finalize(e);return t.reset(),t.finalize(this._oKey.clone().concat(n))}})))})),B((function(e,t){e.exports=A.HmacSHA256}))),D=B((function(e){!function(){var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n={rotl:function(e,t){return e<<t|e>>>32-t},rotr:function(e,t){return e<<32-t|e>>>t},endian:function(e){if(e.constructor==Number)return 16711935&n.rotl(e,8)|4278255360&n.rotl(e,24);for(var t=0;t<e.length;t++)e[t]=n.endian(e[t]);return e},randomBytes:function(e){for(var t=[];e>0;e--)t.push(Math.floor(256*Math.random()));return t},bytesToWords:function(e){for(var t=[],n=0,r=0;n<e.length;n++,r+=8)t[r>>>5]|=e[n]<<24-r%32;return t},wordsToBytes:function(e){for(var t=[],n=0;n<32*e.length;n+=8)t.push(e[n>>>5]>>>24-n%32&255);return t},bytesToHex:function(e){for(var t=[],n=0;n<e.length;n++)t.push((e[n]>>>4).toString(16)),t.push((15&e[n]).toString(16));return t.join("")},hexToBytes:function(e){for(var t=[],n=0;n<e.length;n+=2)t.push(parseInt(e.substr(n,2),16));return t},bytesToBase64:function(e){for(var n=[],r=0;r<e.length;r+=3)for(var o=e[r]<<16|e[r+1]<<8|e[r+2],i=0;i<4;i++)8*r+6*i<=8*e.length?n.push(t.charAt(o>>>6*(3-i)&63)):n.push("=");return n.join("")},base64ToBytes:function(e){e=e.replace(/[^A-Z0-9+\/]/gi,"");for(var n=[],r=0,o=0;r<e.length;o=++r%4)0!=o&&n.push((t.indexOf(e.charAt(r-1))&Math.pow(2,-2*o+8)-1)<<2*o|t.indexOf(e.charAt(r))>>>6-2*o);return n}};e.exports=n}()})),H={utf8:{stringToBytes:function(e){return H.bin.stringToBytes(unescape(encodeURIComponent(e)))},bytesToString:function(e){return decodeURIComponent(escape(H.bin.bytesToString(e)))}},bin:{stringToBytes:function(e){for(var t=[],n=0;n<e.length;n++)t.push(255&e.charCodeAt(n));return t},bytesToString:function(e){for(var t=[],n=0;n<e.length;n++)t.push(String.fromCharCode(e[n]));return t.join("")}}},U=H,P=function(e){return null!=e&&($(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&$(e.slice(0,0))}(e)||!!e._isBuffer)};function $(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}var M=B((function(e){!function(){var t=D,n=U.utf8,r=P,o=U.bin,i=function(e,a){e.constructor==String?e=a&&"binary"===a.encoding?o.stringToBytes(e):n.stringToBytes(e):r(e)?e=Array.prototype.slice.call(e,0):Array.isArray(e)||e.constructor===Uint8Array||(e=e.toString());for(var s=t.bytesToWords(e),u=8*e.length,c=1732584193,l=-271733879,p=-1732584194,f=271733878,d=0;d<s.length;d++)s[d]=16711935&(s[d]<<8|s[d]>>>24)|4278255360&(s[d]<<24|s[d]>>>8);s[u>>>5]|=128<<u%32,s[14+(u+64>>>9<<4)]=u;var g=i._ff,m=i._gg,y=i._hh,h=i._ii;for(d=0;d<s.length;d+=16){var S=c,w=l,v=p,x=f;c=g(c,l,p,f,s[d+0],7,-680876936),f=g(f,c,l,p,s[d+1],12,-389564586),p=g(p,f,c,l,s[d+2],17,606105819),l=g(l,p,f,c,s[d+3],22,-1044525330),c=g(c,l,p,f,s[d+4],7,-176418897),f=g(f,c,l,p,s[d+5],12,1200080426),p=g(p,f,c,l,s[d+6],17,-1473231341),l=g(l,p,f,c,s[d+7],22,-45705983),c=g(c,l,p,f,s[d+8],7,1770035416),f=g(f,c,l,p,s[d+9],12,-1958414417),p=g(p,f,c,l,s[d+10],17,-42063),l=g(l,p,f,c,s[d+11],22,-1990404162),c=g(c,l,p,f,s[d+12],7,1804603682),f=g(f,c,l,p,s[d+13],12,-40341101),p=g(p,f,c,l,s[d+14],17,-1502002290),c=m(c,l=g(l,p,f,c,s[d+15],22,1236535329),p,f,s[d+1],5,-165796510),f=m(f,c,l,p,s[d+6],9,-1069501632),p=m(p,f,c,l,s[d+11],14,643717713),l=m(l,p,f,c,s[d+0],20,-373897302),c=m(c,l,p,f,s[d+5],5,-701558691),f=m(f,c,l,p,s[d+10],9,38016083),p=m(p,f,c,l,s[d+15],14,-660478335),l=m(l,p,f,c,s[d+4],20,-405537848),c=m(c,l,p,f,s[d+9],5,568446438),f=m(f,c,l,p,s[d+14],9,-1019803690),p=m(p,f,c,l,s[d+3],14,-187363961),l=m(l,p,f,c,s[d+8],20,1163531501),c=m(c,l,p,f,s[d+13],5,-1444681467),f=m(f,c,l,p,s[d+2],9,-51403784),p=m(p,f,c,l,s[d+7],14,1735328473),c=y(c,l=m(l,p,f,c,s[d+12],20,-1926607734),p,f,s[d+5],4,-378558),f=y(f,c,l,p,s[d+8],11,-2022574463),p=y(p,f,c,l,s[d+11],16,1839030562),l=y(l,p,f,c,s[d+14],23,-35309556),c=y(c,l,p,f,s[d+1],4,-1530992060),f=y(f,c,l,p,s[d+4],11,1272893353),p=y(p,f,c,l,s[d+7],16,-155497632),l=y(l,p,f,c,s[d+10],23,-1094730640),c=y(c,l,p,f,s[d+13],4,681279174),f=y(f,c,l,p,s[d+0],11,-358537222),p=y(p,f,c,l,s[d+3],16,-722521979),l=y(l,p,f,c,s[d+6],23,76029189),c=y(c,l,p,f,s[d+9],4,-640364487),f=y(f,c,l,p,s[d+12],11,-421815835),p=y(p,f,c,l,s[d+15],16,530742520),c=h(c,l=y(l,p,f,c,s[d+2],23,-995338651),p,f,s[d+0],6,-198630844),f=h(f,c,l,p,s[d+7],10,1126891415),p=h(p,f,c,l,s[d+14],15,-1416354905),l=h(l,p,f,c,s[d+5],21,-57434055),c=h(c,l,p,f,s[d+12],6,1700485571),f=h(f,c,l,p,s[d+3],10,-1894986606),p=h(p,f,c,l,s[d+10],15,-1051523),l=h(l,p,f,c,s[d+1],21,-2054922799),c=h(c,l,p,f,s[d+8],6,1873313359),f=h(f,c,l,p,s[d+15],10,-30611744),p=h(p,f,c,l,s[d+6],15,-1560198380),l=h(l,p,f,c,s[d+13],21,1309151649),c=h(c,l,p,f,s[d+4],6,-145523070),f=h(f,c,l,p,s[d+11],10,-1120210379),p=h(p,f,c,l,s[d+2],15,718787259),l=h(l,p,f,c,s[d+9],21,-343485551),c=c+S>>>0,l=l+w>>>0,p=p+v>>>0,f=f+x>>>0}return t.endian([c,l,p,f])};i._ff=function(e,t,n,r,o,i,a){var s=e+(t&n|~t&r)+(o>>>0)+a;return(s<<i|s>>>32-i)+t},i._gg=function(e,t,n,r,o,i,a){var s=e+(t&r|n&~r)+(o>>>0)+a;return(s<<i|s>>>32-i)+t},i._hh=function(e,t,n,r,o,i,a){var s=e+(t^n^r)+(o>>>0)+a;return(s<<i|s>>>32-i)+t},i._ii=function(e,t,n,r,o,i,a){var s=e+(n^(t|~r))+(o>>>0)+a;return(s<<i|s>>>32-i)+t},i._blocksize=16,i._digestsize=16,e.exports=function(e,n){if(null==e)throw new Error("Illegal argument "+e);var r=t.wordsToBytes(i(e,n));return n&&n.asBytes?r:n&&n.asString?o.bytesToString(r):t.bytesToHex(r)}}()}));function L(e,t){if(1===h.encryptType)return M(JSON.stringify(e));if(2===h.encryptType){let n="",r=e[0].trackId;n="event"===t?`&triggerTime=${e[0].triggerTime}`:`&visitTime=${e[0].visitTime}`;let o=`projectId=${h.token}&anonymousId=${h.anonymousId}&trackId=${r}${n}`;return C(o,"jCfeIQH52pMcgNUQoXYA").toString()}}function J(e,t,n){if(!e)return void console.error("please set upload data upType");var r;const o={...(r=t,{app:h.appData,data:r,device:h.deviceData,lsi:"f9b0b43338054e472866a63bd8da14a4#2.0.6",projectId:h.token,userAgent:h.uAgent||"",anonymousId:h.anonymousId,userId:h.distinctId}),dataAbstract:L(t,e)};h.platform===g?wx.request({url:"event"===e?h.upEventUrl:h.upTrackUrl,method:"POST",header:{"Content-Type":"application/json",appKey:h.token,projectId:h.token},data:o,success:function(e){e&&e.data&&(n===f?z(t,p):n===d?z(t,c):wx.setStorageSync(n,JSON.stringify(t)))},fail:function(e){console.error(e),wx.setStorageSync(n,JSON.stringify(t))}}):uni.request({url:"event"===e?h.upEventUrl:h.upTrackUrl,method:"POST",header:{"Content-Type":"application/json",appKey:h.token,projectId:h.token},data:o,success:function(e){e&&e.data&&(n===f?z(t,p):n===d?z(t,c):uni.setStorageSync(n,JSON.stringify(t)))},fail:function(e){console.log("error: ",e),uni.setStorageSync(n,JSON.stringify(t))}})}function z(e,t){if(h.platform===g){let n=wx.getStorageSync(t),r=(n?JSON.parse(n):[]).concat(e);wx.setStorageSync(t,JSON.stringify(r))}else{let n=uni.getStorageSync(t),r=(n?JSON.parse(n):[]).concat(e);uni.setStorageSync(t,JSON.stringify(r))}}function E(e){const t=e.$page?e.$page:"",n=t.path?t.path:function(){const e=getCurrentPages(),t=e[e.length-1];return t?t.route:"/"}();let r={busSegment:e.$busSegment||0===e.$busSegment?e.$busSegment:"",module:e.$module||0===e.$module?e.$module:"",properties:e.$extend_param?JSON.stringify(e.$extend_param):"",traceId:"",trackId:v(),sceneTag:h.scene,eventId:e.$event_id?e.$event_id:"",event:e.$event_code?e.$event_code:"",utm:k(),duration:null,element:e.$element?e.$element:null,triggerTime:b(Date.now()),page:{domain:t.domain?t.domain:"",url:n||"",path:n||"",title:t.title||"",pageId:M(n)}};r&&(!0===e.$sendMode||!0===e.$send?J("event",[r],f):function(e){let t;t=h.platform===g?wx.getStorageSync(l):uni.getStorageSync(l);let n=t?JSON.parse(t):[];n.push(e),h.platform===g?wx.setStorageSync(l,JSON.stringify(n)):uni.setStorageSync(l,JSON.stringify(n))}(r))}let j,V,R,W,F,K,q,Q;function X(){W&&K&&(Y(s,null),clearInterval(W),W=null,K=null,Q=null)}function Y(e,t){if(e===i)K=null,F=1,j=0,V=Date.now(),R=V,q=x(),K=function(e){const t=getCurrentPages(),n=t[t.length-1];let r=h.platform,o="",i="",a="",s="";if("web"===r||"h5"===r){if(o=window.location.href,i=window.location.hostname,document.referrer){let e=new URL(document.referrer);a=e||"",s=e.hostname||""}}else o=n.route,a=t.length>1?t[t.length-2].route:n.route,i=h.domain?h.domain:n.route;if(n)return{path:n.route,busSegment:e.busSegment||0===e.busSegment?e.busSegment:"",module:e.module||0===e.module?e.module:"",properties:e.extend_param?JSON.stringify(e.extend_param):"",title:e.title?e.title:"",domain:i,url:o,visitPage:t.length,sourceDomain:s,sourceUrl:a,send:e.send||e.sendMode}}(t),Q=K.send,w.push(K.path);else if(e===a)F=2,j=15,R=Date.now();else if(e===s){F=3;let e=Math.max(1,(Date.now()-R)/1e3);j=Math.ceil(e)}let n={busSegment:K.busSegment,module:K.module,properties:K.properties,traceId:"",trackId:v(),sceneTag:h.scene,utm:k(),domain:K.domain,title:K.title,sourceDomain:K.sourceDomain,url:K.url,path:K.path,sourceUrl:K.sourceUrl,duration:j,circulation:F,visitPage:w.length,visitTime:b(V),uid:q};n&&(!0===Q?(delete n.uid,J("track",[n],d)):function(e,t){let n=null;n=h.platform===g?wx.getStorageSync(u):uni.getStorageSync(u);let r=n?JSON.parse(n):[];if(r.length>0){const n=r.findIndex((e=>e.uid===t));-1!==n?r[n]={...r[n],...e}:r.push(e)}else r.push(e);h.platform===g?wx.setStorageSync(u,JSON.stringify(r)):uni.setStorageSync(u,JSON.stringify(r))}(n,q))}let Z=null;exports.clearUtm=function(){h.utm=null},exports.getTrackId=function(){return v()},exports.init=function(e){if(e){const t="test"===e.env?{upEventApi:"https://buryingpoint.gcongo.com.cn/client/api/event",upTrackApi:"https://buryingpoint.gcongo.com.cn/client/api/track",eventListApi:"https://buryingpoint.gcongo.com.cn/api/event/query/eventList"}:{upEventApi:"https://buryingpoint.onebuygz.com/client/api/event",upTrackApi:"https://buryingpoint.onebuygz.com/client/api/track",eventListApi:"https://buryingpoint.onebuygz.com/api/event/query/eventList"};h.upEventUrl=t.upEventApi,h.upTrackUrl=t.upTrackApi,function(){const e=Date.now().toString();h.trackId=e,h.utm=null,w=[],console.log("tid ",e)}(),Object.assign(h,e),_(),clearInterval(Z),Z=null,Z=setInterval((()=>{!function(){let e=null,t=null,n=[];h.platform===g?(e=wx.getStorageSync(l),wx.setStorageSync(l,""),t=wx.getStorageSync(p),wx.setStorageSync(p,"")):(e=uni.getStorageSync(l),uni.setStorageSync(l,""),t=uni.getStorageSync(p),uni.setStorageSync(p,""));const r=e?JSON.parse(e):[],o=t?JSON.parse(t):[];n.push(...r),n.push(...o),n&&n.length&&J("event",n,p)}(),function(){let e=null,t=null,n=[];h.platform===g?(e=wx.getStorageSync(u),wx.setStorageSync(u,""),t=wx.getStorageSync(c),wx.setStorageSync(c,"")):(e=uni.getStorageSync(u),uni.setStorageSync(u,""),t=uni.getStorageSync(c),uni.setStorageSync(c,""));const r=e?JSON.parse(e):[],o=t?JSON.parse(t):[];n.push(...r),n.push(...o),n&&n.length&&(n.forEach((e=>{delete e.uid})),J("track",n,c))}()}),15e3),h.isCompatible||h.platform}else console.log("init config error, please check config!");"test"===e.env&&console.log("config: ",h)},exports.onDestroyTrack=function(){X()},exports.onStartTrack=function(e){var t;e&&(t=e,W&&K&&X(),clearInterval(W),Y(i,t),W=setInterval((()=>{Y(a,null)}),15e3))},exports.setCustomEvent=function(e){e&&E(e)},exports.setPageExtraObj=function(e){!function(e){const t=getCurrentPages();let n=t[t.length-1];const r=S.findIndex((e=>e.path===n.route));let o={path:n.route,properties:e.properties?JSON.stringify(e.properties):"",busSegment:e.busSegment?e.busSegment:"",module:e.module?e.module:"",title:e.title?e.title:""};-1!==r?S[r]=o:S.push(o)}(e)},exports.setUserId=function(e){e?(h.distinctId=e,h.platform===g?wx.setStorageSync(m,e):uni.setStorageSync(m,e)):(h.distinctId="",h.platform===g?wx.setStorageSync(m,e):uni.setStorageSync(m,""))},exports.setUtmData=function(e){var t;t=e,h.utm=t?{utmSource:t.utmSource||"",utmCampaign:t.utmCampaign||"",utmMedium:t.utmMedium||"",utmTerm:t.utmTerm||"",utmContent:t.utmContent||"",ctk:t.ctk||""}:null};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e="v_userId",t="v_anonId";function n(e){return"macos"===e.toLowerCase()?"macOS":"harmonyos"===e.toLowerCase()?"Harmony OS":"ios"===e.toLowerCase()?"iOS":"android"===e.toLowerCase()?"Android":"windows"===e.toLowerCase()?"Windows":"linux"===e.toLowerCase()?"Linux":"unknown"}function r(e){return["Windows","Linux","macOS"].every((t=>e.includes(t)))?1:2}function o(){let e=wx.getStorageSync(t);return e||(e="xxxx-4xxx-yxxx-xxxx".replace(/[xy]/g,(function(e){let t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})),wx.setStorageSync(t,e)),e}const i="enter",a="loop",s="leave",u="UNIBPNPVUVSrcData",c="UNIBPNPVUVFailData",l="UNIBPNEventSrcData",f="UNIBPNEventFailData",p="UBPNOneEventData",g="UBPNOneTrackData",d="wxMini",m="v_userId",y="v_anonId";let h={env:"",domain:"",busSegment:"",module:"",flushInterval:"",pageInterval:"",token:"",appData:null,deviceData:null,distinctId:"",anonymousId:"",version:"",trackId:"",platform:"",uAgent:"",upEventUrl:"",upTrackUrl:"",isCompatible:!0,signTrackArray:[],encryptType:"1",utm:null,scene:""},S=[],w=[];const v=()=>{if(h.trackId)return h.trackId;const e=Date.now().toString();return h.trackId=e,w=[],e};function x(){return"xxxx-4xxx-yxxx-xxxx".replace(/[xy]/g,(function(e){let t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))}function b(e){const t=new Date(e);return`${t.getFullYear()}-${t.getMonth()+1<10?"0"+(t.getMonth()+1):t.getMonth()+1}-${t.getDate()<10?"0"+t.getDate():t.getDate()} ${t.getHours()<10?"0"+t.getHours():t.getHours()}:${t.getMinutes()<10?"0"+t.getMinutes():t.getMinutes()}:${t.getSeconds()<10?"0"+t.getSeconds():t.getSeconds()}`}function I(e){if("web"===h.platform){const t=e.ua.toLowerCase();return/(windows|win32|win64|wow64)/.test(t)?1:(/(linux|android)/.test(t)||/(macintosh|mac os x|iphone|ipad|ipod)/.test(t),2)}return"pc"===e.deviceType?1:2}function _(){if("web"===h.platform){let e=window.location.href;if(e&&!e.includes("file://")&&/^(https?:\/\/[^\s$.?#].[^\s]*)$/i.test(e)){const e=window.location.href.split("?")[1];if(e){const t=new URLSearchParams(e);let n={utmSource:t.get("utmSource")||"",utmCampaign:t.get("utmCampaign")||"",utmMedium:t.get("utmMedium")||"",utmTerm:t.get("utmTerm")||"",utmContent:t.get("utmContent")||"",ctk:t.get("ctk")||""};h.utm?Object.keys(n).forEach((e=>{n[e]&&(h.utm[e]=n[e])})):h.utm=n}}}return console.log("getUtmObj ",h.utm),h.utm}function k(){!function(){try{return"undefined"!=typeof wx&&wx.env&&wx.canIUse}catch(e){return!1}}()?(uni.getSystemInfo({success:function(e){h.uAgent=e.ua;const t=e.uniPlatform;if(t.includes("app"))h.platform=e.osName,h.appData=function(e){let t=plus.runtime.version,n={name:e.appName,version:t||"",carrier:"unknown",packageName:"",ecology:""};if("android"===e.platform){n.carrier="Android";let t="Android",r=plus.android.runtimeMainActivity().getPackageName();e.romName.includes("HarmonyOS")&&(t="Harmony OS",n.carrier="Harmony OS"),n.packageName=r||"",n.ecology=t}else if("ios"===e.platform){let e=plus.ios.importClass("NSBundle").mainBundle().bundleIdentifier();n.packageName=e||"",n.carrier="iOS",n.ecology="iOS"}else if("harmonyos"===e.platform){let e=uni.getAppBaseInfo();n.carrier="Harmony OS",n.ecology="Harmony OS",n.version=e.appVersion,n.packageName=e.packageName}else n.ecology="unknown";return n}(e),h.platform="Harmony OS";else if(t.includes("web")||t.includes("h5")){h.platform="web";let t=function(e){let t=e.ua.toLowerCase(),n=window.location.hostname,r=document.title;return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(t),t.includes("alipay")||t.includes("unionPay")||t.includes("onbuygz")||t.includes("onetravel"),t.includes("micromessenger")&&t.includes("miniprogram"),{name:r||"",packageName:n||"",version:"",carrier:"H5",ecology:"h5"}}(e);h.appData={...t,version:h.version?h.version:"unknown"}}else t.includes("weixin")?(h.platform="weixin",h.appData=function(){const e=uni.getAccountInfoSync(),t=uni.getAppBaseInfo();return{name:t.appName?t.appName:"",packageName:e?e.miniProgram.appId:"",version:e?e.miniProgram.envVersion+e.miniProgram.version:"",carrier:"mini",ecology:"mini"}}()):console.log("uni get platform getBaseicInfo error ");h.deviceData=function(e){var t;return{lang:e.osLanguage?e.osLanguage:e.hostLanguage,brand:e.deviceBrand?e.deviceBrand+" "+e.deviceModel:e.deviceModel,os:(t=e.osName,"macos"===t.toLowerCase()?"macOS":"harmonyos"===t.toLowerCase()?"Harmony OS":"ios"===t.toLowerCase()?"iOS":"android"===t.toLowerCase()?"Android":"windows"===t.toLowerCase()?"Windows":"linux"===t.toLowerCase()?"Linux":"unknown"),osVersion:e.osVersion,resolution:e.screenWidth+"x"+e.screenHeight,browser:e.browserName,browserVersion:e.browserVersion,color:"",deviceId:e.deviceId,deviceType:I(e),network:""}}(e)},fail:function(e){h.deviceData={lang:"",brand:"",os:"",osVersion:"",resolution:"",browser:"",browserVersion:"",color:"",deviceId:"",deviceType:"",network:""}},complete:function(){uni.getNetworkType({success(e){h.deviceData.network=e.networkType}})}}),h.distinctId=uni.getStorageSync(m)||"",h.anonymousId=uni.getStorageSync(y),h.anonymousId||(h.anonymousId=x()),uni.setStorageSync(y,h.anonymousId)):(h.platform=d,h.appData=function(){let e=wx.getAccountInfoSync().miniProgram;return{name:"",packageName:e?e.appId:"",version:e?e.envVersion+e.version:"",carrier:"mini",ecology:"mini"}}(),h.deviceData=function(){const e=wx.getSystemInfoSync();let t={lang:e.language,brand:e.brand+" "+e.model,os:n(e.platform),osVersion:e.system,resolution:e.screenWidth+"x"+e.screenHeight,browser:"",browserVersion:"",color:"",deviceId:"",deviceType:r(e.system),network:""};return wx.getNetworkType({success(e){t.network=e.networkType}}),t}(),h.distinctId=wx.getStorageSync(e)?wx.getStorageSync(e):"",h.anonymousId=o(),h.scene="WX"+wx.getLaunchOptionsSync().scene)}var B="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function T(e,t){return e(t={exports:{}},t.exports),t.exports}var N,O=(N=Object.freeze({__proto__:null,default:{}}))&&N.default||N,A=T((function(e,t){var n;e.exports=(n=n||function(e,t){var n;if("undefined"!=typeof window&&window.crypto&&(n=window.crypto),"undefined"!=typeof self&&self.crypto&&(n=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(n=globalThis.crypto),!n&&"undefined"!=typeof window&&window.msCrypto&&(n=window.msCrypto),!n&&void 0!==B&&B.crypto&&(n=B.crypto),!n)try{n=O}catch(e){}var r=function(){if(n){if("function"==typeof n.getRandomValues)try{return n.getRandomValues(new Uint32Array(1))[0]}catch(e){}if("function"==typeof n.randomBytes)try{return n.randomBytes(4).readInt32LE()}catch(e){}}throw new Error("Native crypto module could not be used to get secure random number.")},o=Object.create||function(){function e(){}return function(t){var n;return e.prototype=t,n=new e,e.prototype=null,n}}(),i={},a=i.lib={},s=a.Base={extend:function(e){var t=o(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},u=a.WordArray=s.extend({init:function(e,n){e=this.words=e||[],this.sigBytes=n!=t?n:4*e.length},toString:function(e){return(e||l).stringify(this)},concat:function(e){var t=this.words,n=e.words,r=this.sigBytes,o=e.sigBytes;if(this.clamp(),r%4)for(var i=0;i<o;i++){var a=n[i>>>2]>>>24-i%4*8&255;t[r+i>>>2]|=a<<24-(r+i)%4*8}else for(var s=0;s<o;s+=4)t[r+s>>>2]=n[s>>>2];return this.sigBytes+=o,this},clamp:function(){var t=this.words,n=this.sigBytes;t[n>>>2]&=4294967295<<32-n%4*8,t.length=e.ceil(n/4)},clone:function(){var e=s.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],n=0;n<e;n+=4)t.push(r());return new u.init(t,e)}}),c=i.enc={},l=c.Hex={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],o=0;o<n;o++){var i=t[o>>>2]>>>24-o%4*8&255;r.push((i>>>4).toString(16)),r.push((15&i).toString(16))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r<t;r+=2)n[r>>>3]|=parseInt(e.substr(r,2),16)<<24-r%8*4;return new u.init(n,t/2)}},f=c.Latin1={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],o=0;o<n;o++){var i=t[o>>>2]>>>24-o%4*8&255;r.push(String.fromCharCode(i))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r<t;r++)n[r>>>2]|=(255&e.charCodeAt(r))<<24-r%4*8;return new u.init(n,t)}},p=c.Utf8={stringify:function(e){try{return decodeURIComponent(escape(f.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return f.parse(unescape(encodeURIComponent(e)))}},g=a.BufferedBlockAlgorithm=s.extend({reset:function(){this._data=new u.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=p.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var n,r=this._data,o=r.words,i=r.sigBytes,a=this.blockSize,s=i/(4*a),c=(s=t?e.ceil(s):e.max((0|s)-this._minBufferSize,0))*a,l=e.min(4*c,i);if(c){for(var f=0;f<c;f+=a)this._doProcessBlock(o,f);n=o.splice(0,c),r.sigBytes-=l}return new u.init(n,l)},clone:function(){var e=s.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});a.Hasher=g.extend({cfg:s.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){g.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,n){return new e.init(n).finalize(t)}},_createHmacHelper:function(e){return function(t,n){return new d.HMAC.init(e,n).finalize(t)}}});var d=i.algo={};return i}(Math),n)})),C=(T((function(e,t){var n;e.exports=(n=A,function(e){var t=n,r=t.lib,o=r.WordArray,i=r.Hasher,a=t.algo,s=[],u=[];!function(){function t(t){for(var n=e.sqrt(t),r=2;r<=n;r++)if(!(t%r))return!1;return!0}function n(e){return 4294967296*(e-(0|e))|0}for(var r=2,o=0;o<64;)t(r)&&(o<8&&(s[o]=n(e.pow(r,.5))),u[o]=n(e.pow(r,1/3)),o++),r++}();var c=[],l=a.SHA256=i.extend({_doReset:function(){this._hash=new o.init(s.slice(0))},_doProcessBlock:function(e,t){for(var n=this._hash.words,r=n[0],o=n[1],i=n[2],a=n[3],s=n[4],l=n[5],f=n[6],p=n[7],g=0;g<64;g++){if(g<16)c[g]=0|e[t+g];else{var d=c[g-15],m=(d<<25|d>>>7)^(d<<14|d>>>18)^d>>>3,y=c[g-2],h=(y<<15|y>>>17)^(y<<13|y>>>19)^y>>>10;c[g]=m+c[g-7]+h+c[g-16]}var S=r&o^r&i^o&i,w=(r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22),v=p+((s<<26|s>>>6)^(s<<21|s>>>11)^(s<<7|s>>>25))+(s&l^~s&f)+u[g]+c[g];p=f,f=l,l=s,s=a+v|0,a=i,i=o,o=r,r=v+(w+S)|0}n[0]=n[0]+r|0,n[1]=n[1]+o|0,n[2]=n[2]+i|0,n[3]=n[3]+a|0,n[4]=n[4]+s|0,n[5]=n[5]+l|0,n[6]=n[6]+f|0,n[7]=n[7]+p|0},_doFinalize:function(){var t=this._data,n=t.words,r=8*this._nDataBytes,o=8*t.sigBytes;return n[o>>>5]|=128<<24-o%32,n[14+(o+64>>>9<<4)]=e.floor(r/4294967296),n[15+(o+64>>>9<<4)]=r,t.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=i._createHelper(l),t.HmacSHA256=i._createHmacHelper(l)}(Math),n.SHA256)})),T((function(e,t){var n,r,o;e.exports=(r=(n=A).lib.Base,o=n.enc.Utf8,void(n.algo.HMAC=r.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=o.parse(t));var n=e.blockSize,r=4*n;t.sigBytes>r&&(t=e.finalize(t)),t.clamp();for(var i=this._oKey=t.clone(),a=this._iKey=t.clone(),s=i.words,u=a.words,c=0;c<n;c++)s[c]^=1549556828,u[c]^=909522486;i.sigBytes=a.sigBytes=r,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var t=this._hasher,n=t.finalize(e);return t.reset(),t.finalize(this._oKey.clone().concat(n))}})))})),T((function(e,t){e.exports=A.HmacSHA256}))),H=T((function(e){!function(){var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n={rotl:function(e,t){return e<<t|e>>>32-t},rotr:function(e,t){return e<<32-t|e>>>t},endian:function(e){if(e.constructor==Number)return 16711935&n.rotl(e,8)|4278255360&n.rotl(e,24);for(var t=0;t<e.length;t++)e[t]=n.endian(e[t]);return e},randomBytes:function(e){for(var t=[];e>0;e--)t.push(Math.floor(256*Math.random()));return t},bytesToWords:function(e){for(var t=[],n=0,r=0;n<e.length;n++,r+=8)t[r>>>5]|=e[n]<<24-r%32;return t},wordsToBytes:function(e){for(var t=[],n=0;n<32*e.length;n+=8)t.push(e[n>>>5]>>>24-n%32&255);return t},bytesToHex:function(e){for(var t=[],n=0;n<e.length;n++)t.push((e[n]>>>4).toString(16)),t.push((15&e[n]).toString(16));return t.join("")},hexToBytes:function(e){for(var t=[],n=0;n<e.length;n+=2)t.push(parseInt(e.substr(n,2),16));return t},bytesToBase64:function(e){for(var n=[],r=0;r<e.length;r+=3)for(var o=e[r]<<16|e[r+1]<<8|e[r+2],i=0;i<4;i++)8*r+6*i<=8*e.length?n.push(t.charAt(o>>>6*(3-i)&63)):n.push("=");return n.join("")},base64ToBytes:function(e){e=e.replace(/[^A-Z0-9+\/]/gi,"");for(var n=[],r=0,o=0;r<e.length;o=++r%4)0!=o&&n.push((t.indexOf(e.charAt(r-1))&Math.pow(2,-2*o+8)-1)<<2*o|t.indexOf(e.charAt(r))>>>6-2*o);return n}};e.exports=n}()})),D={utf8:{stringToBytes:function(e){return D.bin.stringToBytes(unescape(encodeURIComponent(e)))},bytesToString:function(e){return decodeURIComponent(escape(D.bin.bytesToString(e)))}},bin:{stringToBytes:function(e){for(var t=[],n=0;n<e.length;n++)t.push(255&e.charCodeAt(n));return t},bytesToString:function(e){for(var t=[],n=0;n<e.length;n++)t.push(String.fromCharCode(e[n]));return t.join("")}}},U=D,M=function(e){return null!=e&&(P(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&P(e.slice(0,0))}(e)||!!e._isBuffer)};function P(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}var L=T((function(e){!function(){var t=H,n=U.utf8,r=M,o=U.bin,i=function(e,a){e.constructor==String?e=a&&"binary"===a.encoding?o.stringToBytes(e):n.stringToBytes(e):r(e)?e=Array.prototype.slice.call(e,0):Array.isArray(e)||e.constructor===Uint8Array||(e=e.toString());for(var s=t.bytesToWords(e),u=8*e.length,c=1732584193,l=-271733879,f=-1732584194,p=271733878,g=0;g<s.length;g++)s[g]=16711935&(s[g]<<8|s[g]>>>24)|4278255360&(s[g]<<24|s[g]>>>8);s[u>>>5]|=128<<u%32,s[14+(u+64>>>9<<4)]=u;var d=i._ff,m=i._gg,y=i._hh,h=i._ii;for(g=0;g<s.length;g+=16){var S=c,w=l,v=f,x=p;c=d(c,l,f,p,s[g+0],7,-680876936),p=d(p,c,l,f,s[g+1],12,-389564586),f=d(f,p,c,l,s[g+2],17,606105819),l=d(l,f,p,c,s[g+3],22,-1044525330),c=d(c,l,f,p,s[g+4],7,-176418897),p=d(p,c,l,f,s[g+5],12,1200080426),f=d(f,p,c,l,s[g+6],17,-1473231341),l=d(l,f,p,c,s[g+7],22,-45705983),c=d(c,l,f,p,s[g+8],7,1770035416),p=d(p,c,l,f,s[g+9],12,-1958414417),f=d(f,p,c,l,s[g+10],17,-42063),l=d(l,f,p,c,s[g+11],22,-1990404162),c=d(c,l,f,p,s[g+12],7,1804603682),p=d(p,c,l,f,s[g+13],12,-40341101),f=d(f,p,c,l,s[g+14],17,-1502002290),c=m(c,l=d(l,f,p,c,s[g+15],22,1236535329),f,p,s[g+1],5,-165796510),p=m(p,c,l,f,s[g+6],9,-1069501632),f=m(f,p,c,l,s[g+11],14,643717713),l=m(l,f,p,c,s[g+0],20,-373897302),c=m(c,l,f,p,s[g+5],5,-701558691),p=m(p,c,l,f,s[g+10],9,38016083),f=m(f,p,c,l,s[g+15],14,-660478335),l=m(l,f,p,c,s[g+4],20,-405537848),c=m(c,l,f,p,s[g+9],5,568446438),p=m(p,c,l,f,s[g+14],9,-1019803690),f=m(f,p,c,l,s[g+3],14,-187363961),l=m(l,f,p,c,s[g+8],20,1163531501),c=m(c,l,f,p,s[g+13],5,-1444681467),p=m(p,c,l,f,s[g+2],9,-51403784),f=m(f,p,c,l,s[g+7],14,1735328473),c=y(c,l=m(l,f,p,c,s[g+12],20,-1926607734),f,p,s[g+5],4,-378558),p=y(p,c,l,f,s[g+8],11,-2022574463),f=y(f,p,c,l,s[g+11],16,1839030562),l=y(l,f,p,c,s[g+14],23,-35309556),c=y(c,l,f,p,s[g+1],4,-1530992060),p=y(p,c,l,f,s[g+4],11,1272893353),f=y(f,p,c,l,s[g+7],16,-155497632),l=y(l,f,p,c,s[g+10],23,-1094730640),c=y(c,l,f,p,s[g+13],4,681279174),p=y(p,c,l,f,s[g+0],11,-358537222),f=y(f,p,c,l,s[g+3],16,-722521979),l=y(l,f,p,c,s[g+6],23,76029189),c=y(c,l,f,p,s[g+9],4,-640364487),p=y(p,c,l,f,s[g+12],11,-421815835),f=y(f,p,c,l,s[g+15],16,530742520),c=h(c,l=y(l,f,p,c,s[g+2],23,-995338651),f,p,s[g+0],6,-198630844),p=h(p,c,l,f,s[g+7],10,1126891415),f=h(f,p,c,l,s[g+14],15,-1416354905),l=h(l,f,p,c,s[g+5],21,-57434055),c=h(c,l,f,p,s[g+12],6,1700485571),p=h(p,c,l,f,s[g+3],10,-1894986606),f=h(f,p,c,l,s[g+10],15,-1051523),l=h(l,f,p,c,s[g+1],21,-2054922799),c=h(c,l,f,p,s[g+8],6,1873313359),p=h(p,c,l,f,s[g+15],10,-30611744),f=h(f,p,c,l,s[g+6],15,-1560198380),l=h(l,f,p,c,s[g+13],21,1309151649),c=h(c,l,f,p,s[g+4],6,-145523070),p=h(p,c,l,f,s[g+11],10,-1120210379),f=h(f,p,c,l,s[g+2],15,718787259),l=h(l,f,p,c,s[g+9],21,-343485551),c=c+S>>>0,l=l+w>>>0,f=f+v>>>0,p=p+x>>>0}return t.endian([c,l,f,p])};i._ff=function(e,t,n,r,o,i,a){var s=e+(t&n|~t&r)+(o>>>0)+a;return(s<<i|s>>>32-i)+t},i._gg=function(e,t,n,r,o,i,a){var s=e+(t&r|n&~r)+(o>>>0)+a;return(s<<i|s>>>32-i)+t},i._hh=function(e,t,n,r,o,i,a){var s=e+(t^n^r)+(o>>>0)+a;return(s<<i|s>>>32-i)+t},i._ii=function(e,t,n,r,o,i,a){var s=e+(n^(t|~r))+(o>>>0)+a;return(s<<i|s>>>32-i)+t},i._blocksize=16,i._digestsize=16,e.exports=function(e,n){if(null==e)throw new Error("Illegal argument "+e);var r=t.wordsToBytes(i(e,n));return n&&n.asBytes?r:n&&n.asString?o.bytesToString(r):t.bytesToHex(r)}}()}));function $(e){return"1"===h.encryptType?L(e):"2"===h.encryptType?C(e,"jCfeIQH52pMcgNUQoXYA").toString():void 0}function J(e,t,n){if(!e)return void console.error("please set upload data upType");var r;const o={...(r=t,{app:h.appData,data:r,device:h.deviceData,lsi:"05a525811db8d1a7e3bba884ec007649#2.0.5",projectId:h.token,userAgent:h.uAgent||"",anonymousId:h.anonymousId,userId:h.distinctId}),dataAbstract:$(JSON.stringify(t))};h.platform===d?wx.request({url:"event"===e?h.upEventUrl:h.upTrackUrl,method:"POST",header:{"Content-Type":"application/json",appKey:h.token,projectId:h.token},data:o,success:function(e){e&&e.data&&(n===p?z(t,f):n===g?z(t,c):wx.setStorageSync(n,JSON.stringify(t)))},fail:function(e){console.error(e),wx.setStorageSync(n,JSON.stringify(t))}}):uni.request({url:"event"===e?h.upEventUrl:h.upTrackUrl,method:"POST",header:{"Content-Type":"application/json",appKey:h.token,projectId:h.token},data:o,success:function(e){e&&e.data&&(n===p?z(t,f):n===g?z(t,c):uni.setStorageSync(n,JSON.stringify(t)))},fail:function(e){console.log("error: ",e),uni.setStorageSync(n,JSON.stringify(t))}})}function z(e,t){if(h.platform===d){let n=wx.getStorageSync(t),r=n?JSON.parse(n):[];r.concat(e),wx.setStorageSync(t,JSON.stringify(r))}else{let n=uni.getStorageSync(t),r=n?JSON.parse(n):[];r.concat(e),uni.setStorageSync(t,JSON.stringify(r))}}function E(e){const t=e.$page?e.$page:"",n=t.path?t.path:function(){const e=getCurrentPages(),t=e[e.length-1];return t?t.route:"/"}();let r={busSegment:e.$busSegment||0===e.$busSegment?e.$busSegment:"",module:e.$module||0===e.$module?e.$module:"",properties:e.$extend_param?JSON.stringify(e.$extend_param):"",traceId:"",trackId:v(),sceneTag:h.scene,eventId:e.$event_id?e.$event_id:"",event:e.$event_code?e.$event_code:"",utm:_(),duration:null,element:e.$element?e.$element:null,triggerTime:b(Date.now()),page:{domain:t.domain?t.domain:"",url:n||"",path:n||"",title:t.title||"",pageId:L(n)}};r&&(!0===e.$sendMode||!0===e.$send?J("event",[r],p):function(e){let t;t=h.platform===d?wx.getStorageSync(l):uni.getStorageSync(l);let n=t?JSON.parse(t):[];n.push(e),h.platform===d?wx.setStorageSync(l,JSON.stringify(n)):uni.setStorageSync(l,JSON.stringify(n))}(r))}let V,j,R,W,F,K,q,G;function Q(){W&&K&&(X(s,null),clearInterval(W),W=null,K=null,G=null)}function X(e,t){if(e===i)K=null,F=1,V=0,j=Date.now(),R=j,q=x(),K=function(e){const t=getCurrentPages(),n=t[t.length-1];let r=h.platform,o="",i="",a="",s="";if("web"===r||"h5"===r){if(o=window.location.href,i=window.location.hostname,document.referrer){let e=new URL(document.referrer);a=e||"",s=e.hostname||""}}else o=n.route,a=t.length>1?t[t.length-2].route:n.route,i=h.domain?h.domain:n.route;if(n)return{path:n.route,busSegment:e.busSegment||0===e.busSegment?e.busSegment:"",module:e.module||0===e.module?e.module:"",properties:e.extend_param?JSON.stringify(e.extend_param):"",title:e.title?e.title:"",domain:i,url:o,visitPage:t.length,sourceDomain:s,sourceUrl:a,send:e.send||e.sendMode}}(t),G=K.send,w.push(K.path);else if(e===a)F=2,V=15,R=Date.now();else if(e===s){F=3;let e=Math.max(1,(Date.now()-R)/1e3);V=Math.ceil(e)}let n={busSegment:K.busSegment,module:K.module,properties:K.properties,traceId:"",trackId:v(),sceneTag:h.scene,utm:_(),domain:K.domain,title:K.title,sourceDomain:K.sourceDomain,url:K.url,path:K.path,sourceUrl:K.sourceUrl,duration:V,circulation:F,visitPage:w.length,visitTime:b(j),uid:q};n&&(!0===G?(delete n.uid,J("track",[n],g)):function(e,t){let n=null;n=h.platform===d?wx.getStorageSync(u):uni.getStorageSync(u);let r=n?JSON.parse(n):[];if(r.length>0){const n=r.findIndex((e=>e.uid===t));-1!==n?r[n]={...r[n],...e}:r.push(e)}else r.push(e);h.platform===d?wx.setStorageSync(u,JSON.stringify(r)):uni.setStorageSync(u,JSON.stringify(r))}(n,q))}let Y=null;function Z(e){if(e){const t="test"===e.env?{upEventApi:"https://buryingpoint.gcongo.com.cn/client/api/event",upTrackApi:"https://buryingpoint.gcongo.com.cn/client/api/track",eventListApi:"https://buryingpoint.gcongo.com.cn/api/event/query/eventList"}:{upEventApi:"https://buryingpoint.onebuygz.com/client/api/event",upTrackApi:"https://buryingpoint.onebuygz.com/client/api/track",eventListApi:"https://buryingpoint.onebuygz.com/api/event/query/eventList"};h.upEventUrl=t.upEventApi,h.upTrackUrl=t.upTrackApi,function(){const e=Date.now().toString();h.trackId=e,h.utm=null,w=[],console.log("tid ",e)}(),Object.assign(h,e),k(),clearInterval(Y),Y=null,Y=setInterval((()=>{!function(){let e=null,t=null,n=[];h.platform===d?(e=wx.getStorageSync(l),wx.setStorageSync(l,""),t=wx.getStorageSync(f),wx.setStorageSync(f,"")):(e=uni.getStorageSync(l),uni.setStorageSync(l,""),t=uni.getStorageSync(f),uni.setStorageSync(f,""));const r=e?JSON.parse(e):[],o=t?JSON.parse(t):[];n.push(...r),n.push(...o),n&&n.length&&J("event",n,f)}(),function(){let e=null,t=null,n=[];h.platform===d?(e=wx.getStorageSync(u),wx.setStorageSync(u,""),t=wx.getStorageSync(c),wx.setStorageSync(c,"")):(e=uni.getStorageSync(u),uni.setStorageSync(u,""),t=uni.getStorageSync(c),uni.setStorageSync(c,""));const r=e?JSON.parse(e):[],o=t?JSON.parse(t):[];n.push(...r),n.push(...o),n&&n.length&&(n.forEach((e=>{delete e.uid})),J("track",n,c))}()}),15e3),h.isCompatible||h.platform}else console.log("init config error, please check config!");console.log("Global",h)}function ee(e){e?(h.distinctId=e,h.platform===d?wx.setStorageSync(m,e):uni.setStorageSync(m,e)):(h.distinctId="",h.platform===d?wx.setStorageSync(m,e):uni.setStorageSync(m,""))}function te(e){e&&E(e)}function ne(e){var t;e&&(t=e,W&&K&&Q(),clearInterval(W),X(i,t),W=setInterval((()=>{X(a,null)}),15e3))}function re(){Q()}function oe(e){!function(e){const t=getCurrentPages();let n=t[t.length-1];const r=S.findIndex((e=>e.path===n.route));let o={path:n.route,properties:e.properties?JSON.stringify(e.properties):"",busSegment:e.busSegment?e.busSegment:"",module:e.module?e.module:"",title:e.title?e.title:""};-1!==r?S[r]=o:S.push(o)}(e)}function ie(){return v()}function ae(e){var t;t=e,h.utm=t?{utmSource:t.utmSource||"",utmCampaign:t.utmCampaign||"",utmMedium:t.utmMedium||"",utmTerm:t.utmTerm||"",utmContent:t.utmContent||"",ctk:t.ctk||""}:null,console.log("设置的Global.utm",h.utm)}function se(){h.utm=null}export{se as clearUtm,ie as getTrackId,Z as init,re as onDestroyTrack,ne as onStartTrack,te as setCustomEvent,oe as setPageExtraObj,ee as setUserId,ae as setUtmData};
|
|
1
|
+
const e="v_userId",t="v_anonId";function n(e){return"macos"===e.toLowerCase()?"macOS":"harmonyos"===e.toLowerCase()?"Harmony OS":"ios"===e.toLowerCase()?"iOS":"android"===e.toLowerCase()?"Android":"windows"===e.toLowerCase()?"Windows":"linux"===e.toLowerCase()?"Linux":"unknown"}function r(e){return["Windows","Linux","macOS"].every((t=>e.includes(t)))?1:2}function o(){let e=wx.getStorageSync(t);return e||(e="xxxx-4xxx-yxxx-xxxx".replace(/[xy]/g,(function(e){let t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})),wx.setStorageSync(t,e)),e}const i="enter",a="loop",s="leave",u="UNIBPNPVUVSrcData",c="UNIBPNPVUVFailData",l="UNIBPNEventSrcData",f="UNIBPNEventFailData",p="UBPNOneEventData",d="UBPNOneTrackData",g="wxMini",m="v_userId",y="v_anonId";let h={env:"",domain:"",busSegment:"",module:"",flushInterval:"",pageInterval:"",token:"",appData:null,deviceData:null,distinctId:"",anonymousId:"",version:"",trackId:"",platform:"",uAgent:"",upEventUrl:"",upTrackUrl:"",isCompatible:!0,signTrackArray:[],encryptType:2,utm:null,scene:""},S=[],w=[];const v=()=>{if(h.trackId)return h.trackId;const e=Date.now().toString();return h.trackId=e,w=[],e};function x(){return"xxxx-4xxx-yxxx-xxxx".replace(/[xy]/g,(function(e){let t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))}function b(e){const t=new Date(e);return`${t.getFullYear()}-${t.getMonth()+1<10?"0"+(t.getMonth()+1):t.getMonth()+1}-${t.getDate()<10?"0"+t.getDate():t.getDate()} ${t.getHours()<10?"0"+t.getHours():t.getHours()}:${t.getMinutes()<10?"0"+t.getMinutes():t.getMinutes()}:${t.getSeconds()<10?"0"+t.getSeconds():t.getSeconds()}`}function I(e){if("web"===h.platform){const t=e.ua.toLowerCase();return/(windows|win32|win64|wow64)/.test(t)?1:(/(linux|android)/.test(t)||/(macintosh|mac os x|iphone|ipad|ipod)/.test(t),2)}return"pc"===e.deviceType?1:2}function k(){if("web"===h.platform){let e=window.location.href;if(e&&!e.includes("file://")&&/^(https?:\/\/[^\s$.?#].[^\s]*)$/i.test(e)){const e=window.location.href.split("?")[1];if(e){const t=new URLSearchParams(e);let n={utmSource:t.get("utmSource")||"",utmCampaign:t.get("utmCampaign")||"",utmMedium:t.get("utmMedium")||"",utmTerm:t.get("utmTerm")||"",utmContent:t.get("utmContent")||"",ctk:t.get("ctk")||""};h.utm?Object.keys(n).forEach((e=>{n[e]&&(h.utm[e]=n[e])})):h.utm=n}}}return h.utm}function _(){!function(){try{return"undefined"!=typeof wx&&wx.env&&wx.canIUse}catch(e){return!1}}()?(uni.getSystemInfo({success:function(e){h.uAgent=e.ua;const t=e.uniPlatform;if(t.includes("app"))h.platform=e.osName,h.appData=function(e){let t=plus.runtime.version,n={name:e.appName,version:t||"",carrier:"unknown",packageName:"",ecology:""};if("android"===e.platform){n.carrier="Android";let t="Android",r=plus.android.runtimeMainActivity().getPackageName();e.romName.includes("HarmonyOS")&&(t="Harmony OS",n.carrier="Harmony OS"),n.packageName=r||"",n.ecology=t}else if("ios"===e.platform){let e=plus.ios.importClass("NSBundle").mainBundle().bundleIdentifier();n.packageName=e||"",n.carrier="iOS",n.ecology="iOS"}else if("harmonyos"===e.platform){let e=uni.getAppBaseInfo();n.carrier="Harmony OS",n.ecology="Harmony OS",n.version=e.appVersion,n.packageName=e.packageName}else n.ecology="unknown";return n}(e),h.platform="Harmony OS";else if(t.includes("web")||t.includes("h5")){h.platform="web";let t=function(e){let t=e.ua.toLowerCase(),n=window.location.hostname,r=document.title;return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(t),t.includes("alipay")||t.includes("unionPay")||t.includes("onbuygz")||t.includes("onetravel"),t.includes("micromessenger")&&t.includes("miniprogram"),{name:r||"",packageName:n||"",version:"",carrier:"H5",ecology:"h5"}}(e);h.appData={...t,version:h.version?h.version:"unknown"}}else t.includes("weixin")?(h.platform="weixin",h.appData=function(){const e=uni.getAccountInfoSync(),t=uni.getAppBaseInfo();return{name:t.appName?t.appName:"",packageName:e?e.miniProgram.appId:"",version:e?e.miniProgram.envVersion+e.miniProgram.version:"",carrier:"mini",ecology:"mini"}}()):console.log("uni get platform getBaseicInfo error ");h.deviceData=function(e){var t;return{lang:e.osLanguage?e.osLanguage:e.hostLanguage,brand:e.deviceBrand?e.deviceBrand+" "+e.deviceModel:e.deviceModel,os:(t=e.osName,"macos"===t.toLowerCase()?"macOS":"harmonyos"===t.toLowerCase()?"Harmony OS":"ios"===t.toLowerCase()?"iOS":"android"===t.toLowerCase()?"Android":"windows"===t.toLowerCase()?"Windows":"linux"===t.toLowerCase()?"Linux":"unknown"),osVersion:e.osVersion,resolution:e.screenWidth+"x"+e.screenHeight,browser:e.browserName,browserVersion:e.browserVersion,color:"",deviceId:e.deviceId,deviceType:I(e),network:""}}(e)},fail:function(e){h.deviceData={lang:"",brand:"",os:"",osVersion:"",resolution:"",browser:"",browserVersion:"",color:"",deviceId:"",deviceType:"",network:""}},complete:function(){uni.getNetworkType({success(e){h.deviceData.network=e.networkType}})}}),h.distinctId=uni.getStorageSync(m)||"",h.anonymousId=uni.getStorageSync(y),h.anonymousId||(h.anonymousId=x()),uni.setStorageSync(y,h.anonymousId)):(h.platform=g,h.appData=function(){let e=wx.getAccountInfoSync().miniProgram;return{name:"",packageName:e?e.appId:"",version:e?e.envVersion+e.version:"",carrier:"mini",ecology:"mini"}}(),h.deviceData=function(){const e=wx.getSystemInfoSync();let t={lang:e.language,brand:e.brand+" "+e.model,os:n(e.platform),osVersion:e.system,resolution:e.screenWidth+"x"+e.screenHeight,browser:"",browserVersion:"",color:"",deviceId:"",deviceType:r(e.system),network:""};return wx.getNetworkType({success(e){t.network=e.networkType}}),t}(),h.distinctId=wx.getStorageSync(e)?wx.getStorageSync(e):"",h.anonymousId=o(),h.scene="WX"+wx.getLaunchOptionsSync().scene)}var T="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function B(e,t){return e(t={exports:{}},t.exports),t.exports}var N,O=(N=Object.freeze({__proto__:null,default:{}}))&&N.default||N,A=B((function(e,t){var n;e.exports=(n=n||function(e,t){var n;if("undefined"!=typeof window&&window.crypto&&(n=window.crypto),"undefined"!=typeof self&&self.crypto&&(n=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(n=globalThis.crypto),!n&&"undefined"!=typeof window&&window.msCrypto&&(n=window.msCrypto),!n&&void 0!==T&&T.crypto&&(n=T.crypto),!n)try{n=O}catch(e){}var r=function(){if(n){if("function"==typeof n.getRandomValues)try{return n.getRandomValues(new Uint32Array(1))[0]}catch(e){}if("function"==typeof n.randomBytes)try{return n.randomBytes(4).readInt32LE()}catch(e){}}throw new Error("Native crypto module could not be used to get secure random number.")},o=Object.create||function(){function e(){}return function(t){var n;return e.prototype=t,n=new e,e.prototype=null,n}}(),i={},a=i.lib={},s=a.Base={extend:function(e){var t=o(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},u=a.WordArray=s.extend({init:function(e,n){e=this.words=e||[],this.sigBytes=n!=t?n:4*e.length},toString:function(e){return(e||l).stringify(this)},concat:function(e){var t=this.words,n=e.words,r=this.sigBytes,o=e.sigBytes;if(this.clamp(),r%4)for(var i=0;i<o;i++){var a=n[i>>>2]>>>24-i%4*8&255;t[r+i>>>2]|=a<<24-(r+i)%4*8}else for(var s=0;s<o;s+=4)t[r+s>>>2]=n[s>>>2];return this.sigBytes+=o,this},clamp:function(){var t=this.words,n=this.sigBytes;t[n>>>2]&=4294967295<<32-n%4*8,t.length=e.ceil(n/4)},clone:function(){var e=s.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],n=0;n<e;n+=4)t.push(r());return new u.init(t,e)}}),c=i.enc={},l=c.Hex={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],o=0;o<n;o++){var i=t[o>>>2]>>>24-o%4*8&255;r.push((i>>>4).toString(16)),r.push((15&i).toString(16))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r<t;r+=2)n[r>>>3]|=parseInt(e.substr(r,2),16)<<24-r%8*4;return new u.init(n,t/2)}},f=c.Latin1={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],o=0;o<n;o++){var i=t[o>>>2]>>>24-o%4*8&255;r.push(String.fromCharCode(i))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r<t;r++)n[r>>>2]|=(255&e.charCodeAt(r))<<24-r%4*8;return new u.init(n,t)}},p=c.Utf8={stringify:function(e){try{return decodeURIComponent(escape(f.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return f.parse(unescape(encodeURIComponent(e)))}},d=a.BufferedBlockAlgorithm=s.extend({reset:function(){this._data=new u.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=p.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var n,r=this._data,o=r.words,i=r.sigBytes,a=this.blockSize,s=i/(4*a),c=(s=t?e.ceil(s):e.max((0|s)-this._minBufferSize,0))*a,l=e.min(4*c,i);if(c){for(var f=0;f<c;f+=a)this._doProcessBlock(o,f);n=o.splice(0,c),r.sigBytes-=l}return new u.init(n,l)},clone:function(){var e=s.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});a.Hasher=d.extend({cfg:s.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){d.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,n){return new e.init(n).finalize(t)}},_createHmacHelper:function(e){return function(t,n){return new g.HMAC.init(e,n).finalize(t)}}});var g=i.algo={};return i}(Math),n)})),C=(B((function(e,t){var n;e.exports=(n=A,function(e){var t=n,r=t.lib,o=r.WordArray,i=r.Hasher,a=t.algo,s=[],u=[];!function(){function t(t){for(var n=e.sqrt(t),r=2;r<=n;r++)if(!(t%r))return!1;return!0}function n(e){return 4294967296*(e-(0|e))|0}for(var r=2,o=0;o<64;)t(r)&&(o<8&&(s[o]=n(e.pow(r,.5))),u[o]=n(e.pow(r,1/3)),o++),r++}();var c=[],l=a.SHA256=i.extend({_doReset:function(){this._hash=new o.init(s.slice(0))},_doProcessBlock:function(e,t){for(var n=this._hash.words,r=n[0],o=n[1],i=n[2],a=n[3],s=n[4],l=n[5],f=n[6],p=n[7],d=0;d<64;d++){if(d<16)c[d]=0|e[t+d];else{var g=c[d-15],m=(g<<25|g>>>7)^(g<<14|g>>>18)^g>>>3,y=c[d-2],h=(y<<15|y>>>17)^(y<<13|y>>>19)^y>>>10;c[d]=m+c[d-7]+h+c[d-16]}var S=r&o^r&i^o&i,w=(r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22),v=p+((s<<26|s>>>6)^(s<<21|s>>>11)^(s<<7|s>>>25))+(s&l^~s&f)+u[d]+c[d];p=f,f=l,l=s,s=a+v|0,a=i,i=o,o=r,r=v+(w+S)|0}n[0]=n[0]+r|0,n[1]=n[1]+o|0,n[2]=n[2]+i|0,n[3]=n[3]+a|0,n[4]=n[4]+s|0,n[5]=n[5]+l|0,n[6]=n[6]+f|0,n[7]=n[7]+p|0},_doFinalize:function(){var t=this._data,n=t.words,r=8*this._nDataBytes,o=8*t.sigBytes;return n[o>>>5]|=128<<24-o%32,n[14+(o+64>>>9<<4)]=e.floor(r/4294967296),n[15+(o+64>>>9<<4)]=r,t.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=i._createHelper(l),t.HmacSHA256=i._createHmacHelper(l)}(Math),n.SHA256)})),B((function(e,t){var n,r,o;e.exports=(r=(n=A).lib.Base,o=n.enc.Utf8,void(n.algo.HMAC=r.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=o.parse(t));var n=e.blockSize,r=4*n;t.sigBytes>r&&(t=e.finalize(t)),t.clamp();for(var i=this._oKey=t.clone(),a=this._iKey=t.clone(),s=i.words,u=a.words,c=0;c<n;c++)s[c]^=1549556828,u[c]^=909522486;i.sigBytes=a.sigBytes=r,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var t=this._hasher,n=t.finalize(e);return t.reset(),t.finalize(this._oKey.clone().concat(n))}})))})),B((function(e,t){e.exports=A.HmacSHA256}))),H=B((function(e){!function(){var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n={rotl:function(e,t){return e<<t|e>>>32-t},rotr:function(e,t){return e<<32-t|e>>>t},endian:function(e){if(e.constructor==Number)return 16711935&n.rotl(e,8)|4278255360&n.rotl(e,24);for(var t=0;t<e.length;t++)e[t]=n.endian(e[t]);return e},randomBytes:function(e){for(var t=[];e>0;e--)t.push(Math.floor(256*Math.random()));return t},bytesToWords:function(e){for(var t=[],n=0,r=0;n<e.length;n++,r+=8)t[r>>>5]|=e[n]<<24-r%32;return t},wordsToBytes:function(e){for(var t=[],n=0;n<32*e.length;n+=8)t.push(e[n>>>5]>>>24-n%32&255);return t},bytesToHex:function(e){for(var t=[],n=0;n<e.length;n++)t.push((e[n]>>>4).toString(16)),t.push((15&e[n]).toString(16));return t.join("")},hexToBytes:function(e){for(var t=[],n=0;n<e.length;n+=2)t.push(parseInt(e.substr(n,2),16));return t},bytesToBase64:function(e){for(var n=[],r=0;r<e.length;r+=3)for(var o=e[r]<<16|e[r+1]<<8|e[r+2],i=0;i<4;i++)8*r+6*i<=8*e.length?n.push(t.charAt(o>>>6*(3-i)&63)):n.push("=");return n.join("")},base64ToBytes:function(e){e=e.replace(/[^A-Z0-9+\/]/gi,"");for(var n=[],r=0,o=0;r<e.length;o=++r%4)0!=o&&n.push((t.indexOf(e.charAt(r-1))&Math.pow(2,-2*o+8)-1)<<2*o|t.indexOf(e.charAt(r))>>>6-2*o);return n}};e.exports=n}()})),D={utf8:{stringToBytes:function(e){return D.bin.stringToBytes(unescape(encodeURIComponent(e)))},bytesToString:function(e){return decodeURIComponent(escape(D.bin.bytesToString(e)))}},bin:{stringToBytes:function(e){for(var t=[],n=0;n<e.length;n++)t.push(255&e.charCodeAt(n));return t},bytesToString:function(e){for(var t=[],n=0;n<e.length;n++)t.push(String.fromCharCode(e[n]));return t.join("")}}},$=D,U=function(e){return null!=e&&(M(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&M(e.slice(0,0))}(e)||!!e._isBuffer)};function M(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}var P=B((function(e){!function(){var t=H,n=$.utf8,r=U,o=$.bin,i=function(e,a){e.constructor==String?e=a&&"binary"===a.encoding?o.stringToBytes(e):n.stringToBytes(e):r(e)?e=Array.prototype.slice.call(e,0):Array.isArray(e)||e.constructor===Uint8Array||(e=e.toString());for(var s=t.bytesToWords(e),u=8*e.length,c=1732584193,l=-271733879,f=-1732584194,p=271733878,d=0;d<s.length;d++)s[d]=16711935&(s[d]<<8|s[d]>>>24)|4278255360&(s[d]<<24|s[d]>>>8);s[u>>>5]|=128<<u%32,s[14+(u+64>>>9<<4)]=u;var g=i._ff,m=i._gg,y=i._hh,h=i._ii;for(d=0;d<s.length;d+=16){var S=c,w=l,v=f,x=p;c=g(c,l,f,p,s[d+0],7,-680876936),p=g(p,c,l,f,s[d+1],12,-389564586),f=g(f,p,c,l,s[d+2],17,606105819),l=g(l,f,p,c,s[d+3],22,-1044525330),c=g(c,l,f,p,s[d+4],7,-176418897),p=g(p,c,l,f,s[d+5],12,1200080426),f=g(f,p,c,l,s[d+6],17,-1473231341),l=g(l,f,p,c,s[d+7],22,-45705983),c=g(c,l,f,p,s[d+8],7,1770035416),p=g(p,c,l,f,s[d+9],12,-1958414417),f=g(f,p,c,l,s[d+10],17,-42063),l=g(l,f,p,c,s[d+11],22,-1990404162),c=g(c,l,f,p,s[d+12],7,1804603682),p=g(p,c,l,f,s[d+13],12,-40341101),f=g(f,p,c,l,s[d+14],17,-1502002290),c=m(c,l=g(l,f,p,c,s[d+15],22,1236535329),f,p,s[d+1],5,-165796510),p=m(p,c,l,f,s[d+6],9,-1069501632),f=m(f,p,c,l,s[d+11],14,643717713),l=m(l,f,p,c,s[d+0],20,-373897302),c=m(c,l,f,p,s[d+5],5,-701558691),p=m(p,c,l,f,s[d+10],9,38016083),f=m(f,p,c,l,s[d+15],14,-660478335),l=m(l,f,p,c,s[d+4],20,-405537848),c=m(c,l,f,p,s[d+9],5,568446438),p=m(p,c,l,f,s[d+14],9,-1019803690),f=m(f,p,c,l,s[d+3],14,-187363961),l=m(l,f,p,c,s[d+8],20,1163531501),c=m(c,l,f,p,s[d+13],5,-1444681467),p=m(p,c,l,f,s[d+2],9,-51403784),f=m(f,p,c,l,s[d+7],14,1735328473),c=y(c,l=m(l,f,p,c,s[d+12],20,-1926607734),f,p,s[d+5],4,-378558),p=y(p,c,l,f,s[d+8],11,-2022574463),f=y(f,p,c,l,s[d+11],16,1839030562),l=y(l,f,p,c,s[d+14],23,-35309556),c=y(c,l,f,p,s[d+1],4,-1530992060),p=y(p,c,l,f,s[d+4],11,1272893353),f=y(f,p,c,l,s[d+7],16,-155497632),l=y(l,f,p,c,s[d+10],23,-1094730640),c=y(c,l,f,p,s[d+13],4,681279174),p=y(p,c,l,f,s[d+0],11,-358537222),f=y(f,p,c,l,s[d+3],16,-722521979),l=y(l,f,p,c,s[d+6],23,76029189),c=y(c,l,f,p,s[d+9],4,-640364487),p=y(p,c,l,f,s[d+12],11,-421815835),f=y(f,p,c,l,s[d+15],16,530742520),c=h(c,l=y(l,f,p,c,s[d+2],23,-995338651),f,p,s[d+0],6,-198630844),p=h(p,c,l,f,s[d+7],10,1126891415),f=h(f,p,c,l,s[d+14],15,-1416354905),l=h(l,f,p,c,s[d+5],21,-57434055),c=h(c,l,f,p,s[d+12],6,1700485571),p=h(p,c,l,f,s[d+3],10,-1894986606),f=h(f,p,c,l,s[d+10],15,-1051523),l=h(l,f,p,c,s[d+1],21,-2054922799),c=h(c,l,f,p,s[d+8],6,1873313359),p=h(p,c,l,f,s[d+15],10,-30611744),f=h(f,p,c,l,s[d+6],15,-1560198380),l=h(l,f,p,c,s[d+13],21,1309151649),c=h(c,l,f,p,s[d+4],6,-145523070),p=h(p,c,l,f,s[d+11],10,-1120210379),f=h(f,p,c,l,s[d+2],15,718787259),l=h(l,f,p,c,s[d+9],21,-343485551),c=c+S>>>0,l=l+w>>>0,f=f+v>>>0,p=p+x>>>0}return t.endian([c,l,f,p])};i._ff=function(e,t,n,r,o,i,a){var s=e+(t&n|~t&r)+(o>>>0)+a;return(s<<i|s>>>32-i)+t},i._gg=function(e,t,n,r,o,i,a){var s=e+(t&r|n&~r)+(o>>>0)+a;return(s<<i|s>>>32-i)+t},i._hh=function(e,t,n,r,o,i,a){var s=e+(t^n^r)+(o>>>0)+a;return(s<<i|s>>>32-i)+t},i._ii=function(e,t,n,r,o,i,a){var s=e+(n^(t|~r))+(o>>>0)+a;return(s<<i|s>>>32-i)+t},i._blocksize=16,i._digestsize=16,e.exports=function(e,n){if(null==e)throw new Error("Illegal argument "+e);var r=t.wordsToBytes(i(e,n));return n&&n.asBytes?r:n&&n.asString?o.bytesToString(r):t.bytesToHex(r)}}()}));function L(e,t){if(1===h.encryptType)return P(JSON.stringify(e));if(2===h.encryptType){let n="",r=e[0].trackId;n="event"===t?`&triggerTime=${e[0].triggerTime}`:`&visitTime=${e[0].visitTime}`;let o=`projectId=${h.token}&anonymousId=${h.anonymousId}&trackId=${r}${n}`;return C(o,"jCfeIQH52pMcgNUQoXYA").toString()}}function J(e,t,n){if(!e)return void console.error("please set upload data upType");var r;const o={...(r=t,{app:h.appData,data:r,device:h.deviceData,lsi:"f9b0b43338054e472866a63bd8da14a4#2.0.6",projectId:h.token,userAgent:h.uAgent||"",anonymousId:h.anonymousId,userId:h.distinctId}),dataAbstract:L(t,e)};h.platform===g?wx.request({url:"event"===e?h.upEventUrl:h.upTrackUrl,method:"POST",header:{"Content-Type":"application/json",appKey:h.token,projectId:h.token},data:o,success:function(e){e&&e.data&&(n===p?z(t,f):n===d?z(t,c):wx.setStorageSync(n,JSON.stringify(t)))},fail:function(e){console.error(e),wx.setStorageSync(n,JSON.stringify(t))}}):uni.request({url:"event"===e?h.upEventUrl:h.upTrackUrl,method:"POST",header:{"Content-Type":"application/json",appKey:h.token,projectId:h.token},data:o,success:function(e){e&&e.data&&(n===p?z(t,f):n===d?z(t,c):uni.setStorageSync(n,JSON.stringify(t)))},fail:function(e){console.log("error: ",e),uni.setStorageSync(n,JSON.stringify(t))}})}function z(e,t){if(h.platform===g){let n=wx.getStorageSync(t),r=(n?JSON.parse(n):[]).concat(e);wx.setStorageSync(t,JSON.stringify(r))}else{let n=uni.getStorageSync(t),r=(n?JSON.parse(n):[]).concat(e);uni.setStorageSync(t,JSON.stringify(r))}}function E(e){const t=e.$page?e.$page:"",n=t.path?t.path:function(){const e=getCurrentPages(),t=e[e.length-1];return t?t.route:"/"}();let r={busSegment:e.$busSegment||0===e.$busSegment?e.$busSegment:"",module:e.$module||0===e.$module?e.$module:"",properties:e.$extend_param?JSON.stringify(e.$extend_param):"",traceId:"",trackId:v(),sceneTag:h.scene,eventId:e.$event_id?e.$event_id:"",event:e.$event_code?e.$event_code:"",utm:k(),duration:null,element:e.$element?e.$element:null,triggerTime:b(Date.now()),page:{domain:t.domain?t.domain:"",url:n||"",path:n||"",title:t.title||"",pageId:P(n)}};r&&(!0===e.$sendMode||!0===e.$send?J("event",[r],p):function(e){let t;t=h.platform===g?wx.getStorageSync(l):uni.getStorageSync(l);let n=t?JSON.parse(t):[];n.push(e),h.platform===g?wx.setStorageSync(l,JSON.stringify(n)):uni.setStorageSync(l,JSON.stringify(n))}(r))}let V,j,R,W,F,K,q,Q;function X(){W&&K&&(Y(s,null),clearInterval(W),W=null,K=null,Q=null)}function Y(e,t){if(e===i)K=null,F=1,V=0,j=Date.now(),R=j,q=x(),K=function(e){const t=getCurrentPages(),n=t[t.length-1];let r=h.platform,o="",i="",a="",s="";if("web"===r||"h5"===r){if(o=window.location.href,i=window.location.hostname,document.referrer){let e=new URL(document.referrer);a=e||"",s=e.hostname||""}}else o=n.route,a=t.length>1?t[t.length-2].route:n.route,i=h.domain?h.domain:n.route;if(n)return{path:n.route,busSegment:e.busSegment||0===e.busSegment?e.busSegment:"",module:e.module||0===e.module?e.module:"",properties:e.extend_param?JSON.stringify(e.extend_param):"",title:e.title?e.title:"",domain:i,url:o,visitPage:t.length,sourceDomain:s,sourceUrl:a,send:e.send||e.sendMode}}(t),Q=K.send,w.push(K.path);else if(e===a)F=2,V=15,R=Date.now();else if(e===s){F=3;let e=Math.max(1,(Date.now()-R)/1e3);V=Math.ceil(e)}let n={busSegment:K.busSegment,module:K.module,properties:K.properties,traceId:"",trackId:v(),sceneTag:h.scene,utm:k(),domain:K.domain,title:K.title,sourceDomain:K.sourceDomain,url:K.url,path:K.path,sourceUrl:K.sourceUrl,duration:V,circulation:F,visitPage:w.length,visitTime:b(j),uid:q};n&&(!0===Q?(delete n.uid,J("track",[n],d)):function(e,t){let n=null;n=h.platform===g?wx.getStorageSync(u):uni.getStorageSync(u);let r=n?JSON.parse(n):[];if(r.length>0){const n=r.findIndex((e=>e.uid===t));-1!==n?r[n]={...r[n],...e}:r.push(e)}else r.push(e);h.platform===g?wx.setStorageSync(u,JSON.stringify(r)):uni.setStorageSync(u,JSON.stringify(r))}(n,q))}let Z=null;function G(e){if(e){const t="test"===e.env?{upEventApi:"https://buryingpoint.gcongo.com.cn/client/api/event",upTrackApi:"https://buryingpoint.gcongo.com.cn/client/api/track",eventListApi:"https://buryingpoint.gcongo.com.cn/api/event/query/eventList"}:{upEventApi:"https://buryingpoint.onebuygz.com/client/api/event",upTrackApi:"https://buryingpoint.onebuygz.com/client/api/track",eventListApi:"https://buryingpoint.onebuygz.com/api/event/query/eventList"};h.upEventUrl=t.upEventApi,h.upTrackUrl=t.upTrackApi,function(){const e=Date.now().toString();h.trackId=e,h.utm=null,w=[],console.log("tid ",e)}(),Object.assign(h,e),_(),clearInterval(Z),Z=null,Z=setInterval((()=>{!function(){let e=null,t=null,n=[];h.platform===g?(e=wx.getStorageSync(l),wx.setStorageSync(l,""),t=wx.getStorageSync(f),wx.setStorageSync(f,"")):(e=uni.getStorageSync(l),uni.setStorageSync(l,""),t=uni.getStorageSync(f),uni.setStorageSync(f,""));const r=e?JSON.parse(e):[],o=t?JSON.parse(t):[];n.push(...r),n.push(...o),n&&n.length&&J("event",n,f)}(),function(){let e=null,t=null,n=[];h.platform===g?(e=wx.getStorageSync(u),wx.setStorageSync(u,""),t=wx.getStorageSync(c),wx.setStorageSync(c,"")):(e=uni.getStorageSync(u),uni.setStorageSync(u,""),t=uni.getStorageSync(c),uni.setStorageSync(c,""));const r=e?JSON.parse(e):[],o=t?JSON.parse(t):[];n.push(...r),n.push(...o),n&&n.length&&(n.forEach((e=>{delete e.uid})),J("track",n,c))}()}),15e3),h.isCompatible||h.platform}else console.log("init config error, please check config!");"test"===e.env&&console.log("config: ",h)}function ee(e){e?(h.distinctId=e,h.platform===g?wx.setStorageSync(m,e):uni.setStorageSync(m,e)):(h.distinctId="",h.platform===g?wx.setStorageSync(m,e):uni.setStorageSync(m,""))}function te(e){e&&E(e)}function ne(e){var t;e&&(t=e,W&&K&&X(),clearInterval(W),Y(i,t),W=setInterval((()=>{Y(a,null)}),15e3))}function re(){X()}function oe(e){!function(e){const t=getCurrentPages();let n=t[t.length-1];const r=S.findIndex((e=>e.path===n.route));let o={path:n.route,properties:e.properties?JSON.stringify(e.properties):"",busSegment:e.busSegment?e.busSegment:"",module:e.module?e.module:"",title:e.title?e.title:""};-1!==r?S[r]=o:S.push(o)}(e)}function ie(){return v()}function ae(e){var t;t=e,h.utm=t?{utmSource:t.utmSource||"",utmCampaign:t.utmCampaign||"",utmMedium:t.utmMedium||"",utmTerm:t.utmTerm||"",utmContent:t.utmContent||"",ctk:t.ctk||""}:null}function se(){h.utm=null}export{se as clearUtm,ie as getTrackId,G as init,re as onDestroyTrack,ne as onStartTrack,te as setCustomEvent,oe as setPageExtraObj,ee as setUserId,ae as setUtmData};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).BuriedPointUni={})}(this,(function(e){"use strict";const t="v_userId",n="v_anonId";function r(e){return"macos"===e.toLowerCase()?"macOS":"harmonyos"===e.toLowerCase()?"Harmony OS":"ios"===e.toLowerCase()?"iOS":"android"===e.toLowerCase()?"Android":"windows"===e.toLowerCase()?"Windows":"linux"===e.toLowerCase()?"Linux":"unknown"}function o(e){return["Windows","Linux","macOS"].every((t=>e.includes(t)))?1:2}function i(){let e=wx.getStorageSync(n);return e||(e="xxxx-4xxx-yxxx-xxxx".replace(/[xy]/g,(function(e){let t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})),wx.setStorageSync(n,e)),e}const a="enter",s="loop",u="leave",c="UNIBPNPVUVSrcData",l="UNIBPNPVUVFailData",f="UNIBPNEventSrcData",d="UNIBPNEventFailData",p="UBPNOneEventData",g="UBPNOneTrackData",m="wxMini",y="v_userId",h="v_anonId";let S={env:"",domain:"",busSegment:"",module:"",flushInterval:"",pageInterval:"",token:"",appData:null,deviceData:null,distinctId:"",anonymousId:"",version:"",trackId:"",platform:"",uAgent:"",upEventUrl:"",upTrackUrl:"",isCompatible:!0,signTrackArray:[],encryptType:"1",utm:null,scene:""},w=[],v=[];const x=()=>{if(S.trackId)return S.trackId;const e=Date.now().toString();return S.trackId=e,v=[],e};function b(){return"xxxx-4xxx-yxxx-xxxx".replace(/[xy]/g,(function(e){let t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))}function I(e){const t=new Date(e);return`${t.getFullYear()}-${t.getMonth()+1<10?"0"+(t.getMonth()+1):t.getMonth()+1}-${t.getDate()<10?"0"+t.getDate():t.getDate()} ${t.getHours()<10?"0"+t.getHours():t.getHours()}:${t.getMinutes()<10?"0"+t.getMinutes():t.getMinutes()}:${t.getSeconds()<10?"0"+t.getSeconds():t.getSeconds()}`}function _(e){if("web"===S.platform){const t=e.ua.toLowerCase();return/(windows|win32|win64|wow64)/.test(t)?1:(/(linux|android)/.test(t)||/(macintosh|mac os x|iphone|ipad|ipod)/.test(t),2)}return"pc"===e.deviceType?1:2}function k(){if("web"===S.platform){let e=window.location.href;if(e&&!e.includes("file://")&&/^(https?:\/\/[^\s$.?#].[^\s]*)$/i.test(e)){const e=window.location.href.split("?")[1];if(e){const t=new URLSearchParams(e);let n={utmSource:t.get("utmSource")||"",utmCampaign:t.get("utmCampaign")||"",utmMedium:t.get("utmMedium")||"",utmTerm:t.get("utmTerm")||"",utmContent:t.get("utmContent")||"",ctk:t.get("ctk")||""};S.utm?Object.keys(n).forEach((e=>{n[e]&&(S.utm[e]=n[e])})):S.utm=n}}}return console.log("getUtmObj ",S.utm),S.utm}function T(){!function(){try{return"undefined"!=typeof wx&&wx.env&&wx.canIUse}catch(e){return!1}}()?(uni.getSystemInfo({success:function(e){S.uAgent=e.ua;const t=e.uniPlatform;if(t.includes("app"))S.platform=e.osName,S.appData=function(e){let t=plus.runtime.version,n={name:e.appName,version:t||"",carrier:"unknown",packageName:"",ecology:""};if("android"===e.platform){n.carrier="Android";let t="Android",r=plus.android.runtimeMainActivity().getPackageName();e.romName.includes("HarmonyOS")&&(t="Harmony OS",n.carrier="Harmony OS"),n.packageName=r||"",n.ecology=t}else if("ios"===e.platform){let e=plus.ios.importClass("NSBundle").mainBundle().bundleIdentifier();n.packageName=e||"",n.carrier="iOS",n.ecology="iOS"}else if("harmonyos"===e.platform){let e=uni.getAppBaseInfo();n.carrier="Harmony OS",n.ecology="Harmony OS",n.version=e.appVersion,n.packageName=e.packageName}else n.ecology="unknown";return n}(e),S.platform="Harmony OS";else if(t.includes("web")||t.includes("h5")){S.platform="web";let t=function(e){let t=e.ua.toLowerCase(),n=window.location.hostname,r=document.title;return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(t),t.includes("alipay")||t.includes("unionPay")||t.includes("onbuygz")||t.includes("onetravel"),t.includes("micromessenger")&&t.includes("miniprogram"),{name:r||"",packageName:n||"",version:"",carrier:"H5",ecology:"h5"}}(e);S.appData={...t,version:S.version?S.version:"unknown"}}else t.includes("weixin")?(S.platform="weixin",S.appData=function(){const e=uni.getAccountInfoSync(),t=uni.getAppBaseInfo();return{name:t.appName?t.appName:"",packageName:e?e.miniProgram.appId:"",version:e?e.miniProgram.envVersion+e.miniProgram.version:"",carrier:"mini",ecology:"mini"}}()):console.log("uni get platform getBaseicInfo error ");S.deviceData=function(e){var t;return{lang:e.osLanguage?e.osLanguage:e.hostLanguage,brand:e.deviceBrand?e.deviceBrand+" "+e.deviceModel:e.deviceModel,os:(t=e.osName,"macos"===t.toLowerCase()?"macOS":"harmonyos"===t.toLowerCase()?"Harmony OS":"ios"===t.toLowerCase()?"iOS":"android"===t.toLowerCase()?"Android":"windows"===t.toLowerCase()?"Windows":"linux"===t.toLowerCase()?"Linux":"unknown"),osVersion:e.osVersion,resolution:e.screenWidth+"x"+e.screenHeight,browser:e.browserName,browserVersion:e.browserVersion,color:"",deviceId:e.deviceId,deviceType:_(e),network:""}}(e)},fail:function(e){S.deviceData={lang:"",brand:"",os:"",osVersion:"",resolution:"",browser:"",browserVersion:"",color:"",deviceId:"",deviceType:"",network:""}},complete:function(){uni.getNetworkType({success(e){S.deviceData.network=e.networkType}})}}),S.distinctId=uni.getStorageSync(y)||"",S.anonymousId=uni.getStorageSync(h),S.anonymousId||(S.anonymousId=b()),uni.setStorageSync(h,S.anonymousId)):(S.platform=m,S.appData=function(){let e=wx.getAccountInfoSync().miniProgram;return{name:"",packageName:e?e.appId:"",version:e?e.envVersion+e.version:"",carrier:"mini",ecology:"mini"}}(),S.deviceData=function(){const e=wx.getSystemInfoSync();let t={lang:e.language,brand:e.brand+" "+e.model,os:r(e.platform),osVersion:e.system,resolution:e.screenWidth+"x"+e.screenHeight,browser:"",browserVersion:"",color:"",deviceId:"",deviceType:o(e.system),network:""};return wx.getNetworkType({success(e){t.network=e.networkType}}),t}(),S.distinctId=wx.getStorageSync(t)?wx.getStorageSync(t):"",S.anonymousId=i(),S.scene="WX"+wx.getLaunchOptionsSync().scene)}var B="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function O(e,t){return e(t={exports:{}},t.exports),t.exports}var N,A=(N=Object.freeze({__proto__:null,default:{}}))&&N.default||N,C=O((function(e,t){var n;e.exports=(n=n||function(e,t){var n;if("undefined"!=typeof window&&window.crypto&&(n=window.crypto),"undefined"!=typeof self&&self.crypto&&(n=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(n=globalThis.crypto),!n&&"undefined"!=typeof window&&window.msCrypto&&(n=window.msCrypto),!n&&void 0!==B&&B.crypto&&(n=B.crypto),!n)try{n=A}catch(e){}var r=function(){if(n){if("function"==typeof n.getRandomValues)try{return n.getRandomValues(new Uint32Array(1))[0]}catch(e){}if("function"==typeof n.randomBytes)try{return n.randomBytes(4).readInt32LE()}catch(e){}}throw new Error("Native crypto module could not be used to get secure random number.")},o=Object.create||function(){function e(){}return function(t){var n;return e.prototype=t,n=new e,e.prototype=null,n}}(),i={},a=i.lib={},s=a.Base={extend:function(e){var t=o(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},u=a.WordArray=s.extend({init:function(e,n){e=this.words=e||[],this.sigBytes=n!=t?n:4*e.length},toString:function(e){return(e||l).stringify(this)},concat:function(e){var t=this.words,n=e.words,r=this.sigBytes,o=e.sigBytes;if(this.clamp(),r%4)for(var i=0;i<o;i++){var a=n[i>>>2]>>>24-i%4*8&255;t[r+i>>>2]|=a<<24-(r+i)%4*8}else for(var s=0;s<o;s+=4)t[r+s>>>2]=n[s>>>2];return this.sigBytes+=o,this},clamp:function(){var t=this.words,n=this.sigBytes;t[n>>>2]&=4294967295<<32-n%4*8,t.length=e.ceil(n/4)},clone:function(){var e=s.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],n=0;n<e;n+=4)t.push(r());return new u.init(t,e)}}),c=i.enc={},l=c.Hex={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],o=0;o<n;o++){var i=t[o>>>2]>>>24-o%4*8&255;r.push((i>>>4).toString(16)),r.push((15&i).toString(16))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r<t;r+=2)n[r>>>3]|=parseInt(e.substr(r,2),16)<<24-r%8*4;return new u.init(n,t/2)}},f=c.Latin1={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],o=0;o<n;o++){var i=t[o>>>2]>>>24-o%4*8&255;r.push(String.fromCharCode(i))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r<t;r++)n[r>>>2]|=(255&e.charCodeAt(r))<<24-r%4*8;return new u.init(n,t)}},d=c.Utf8={stringify:function(e){try{return decodeURIComponent(escape(f.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return f.parse(unescape(encodeURIComponent(e)))}},p=a.BufferedBlockAlgorithm=s.extend({reset:function(){this._data=new u.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=d.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var n,r=this._data,o=r.words,i=r.sigBytes,a=this.blockSize,s=i/(4*a),c=(s=t?e.ceil(s):e.max((0|s)-this._minBufferSize,0))*a,l=e.min(4*c,i);if(c){for(var f=0;f<c;f+=a)this._doProcessBlock(o,f);n=o.splice(0,c),r.sigBytes-=l}return new u.init(n,l)},clone:function(){var e=s.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});a.Hasher=p.extend({cfg:s.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){p.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,n){return new e.init(n).finalize(t)}},_createHmacHelper:function(e){return function(t,n){return new g.HMAC.init(e,n).finalize(t)}}});var g=i.algo={};return i}(Math),n)})),U=(O((function(e,t){var n;e.exports=(n=C,function(e){var t=n,r=t.lib,o=r.WordArray,i=r.Hasher,a=t.algo,s=[],u=[];!function(){function t(t){for(var n=e.sqrt(t),r=2;r<=n;r++)if(!(t%r))return!1;return!0}function n(e){return 4294967296*(e-(0|e))|0}for(var r=2,o=0;o<64;)t(r)&&(o<8&&(s[o]=n(e.pow(r,.5))),u[o]=n(e.pow(r,1/3)),o++),r++}();var c=[],l=a.SHA256=i.extend({_doReset:function(){this._hash=new o.init(s.slice(0))},_doProcessBlock:function(e,t){for(var n=this._hash.words,r=n[0],o=n[1],i=n[2],a=n[3],s=n[4],l=n[5],f=n[6],d=n[7],p=0;p<64;p++){if(p<16)c[p]=0|e[t+p];else{var g=c[p-15],m=(g<<25|g>>>7)^(g<<14|g>>>18)^g>>>3,y=c[p-2],h=(y<<15|y>>>17)^(y<<13|y>>>19)^y>>>10;c[p]=m+c[p-7]+h+c[p-16]}var S=r&o^r&i^o&i,w=(r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22),v=d+((s<<26|s>>>6)^(s<<21|s>>>11)^(s<<7|s>>>25))+(s&l^~s&f)+u[p]+c[p];d=f,f=l,l=s,s=a+v|0,a=i,i=o,o=r,r=v+(w+S)|0}n[0]=n[0]+r|0,n[1]=n[1]+o|0,n[2]=n[2]+i|0,n[3]=n[3]+a|0,n[4]=n[4]+s|0,n[5]=n[5]+l|0,n[6]=n[6]+f|0,n[7]=n[7]+d|0},_doFinalize:function(){var t=this._data,n=t.words,r=8*this._nDataBytes,o=8*t.sigBytes;return n[o>>>5]|=128<<24-o%32,n[14+(o+64>>>9<<4)]=e.floor(r/4294967296),n[15+(o+64>>>9<<4)]=r,t.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=i._createHelper(l),t.HmacSHA256=i._createHmacHelper(l)}(Math),n.SHA256)})),O((function(e,t){var n,r,o;e.exports=(r=(n=C).lib.Base,o=n.enc.Utf8,void(n.algo.HMAC=r.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=o.parse(t));var n=e.blockSize,r=4*n;t.sigBytes>r&&(t=e.finalize(t)),t.clamp();for(var i=this._oKey=t.clone(),a=this._iKey=t.clone(),s=i.words,u=a.words,c=0;c<n;c++)s[c]^=1549556828,u[c]^=909522486;i.sigBytes=a.sigBytes=r,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var t=this._hasher,n=t.finalize(e);return t.reset(),t.finalize(this._oKey.clone().concat(n))}})))})),O((function(e,t){e.exports=C.HmacSHA256}))),D=O((function(e){!function(){var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n={rotl:function(e,t){return e<<t|e>>>32-t},rotr:function(e,t){return e<<32-t|e>>>t},endian:function(e){if(e.constructor==Number)return 16711935&n.rotl(e,8)|4278255360&n.rotl(e,24);for(var t=0;t<e.length;t++)e[t]=n.endian(e[t]);return e},randomBytes:function(e){for(var t=[];e>0;e--)t.push(Math.floor(256*Math.random()));return t},bytesToWords:function(e){for(var t=[],n=0,r=0;n<e.length;n++,r+=8)t[r>>>5]|=e[n]<<24-r%32;return t},wordsToBytes:function(e){for(var t=[],n=0;n<32*e.length;n+=8)t.push(e[n>>>5]>>>24-n%32&255);return t},bytesToHex:function(e){for(var t=[],n=0;n<e.length;n++)t.push((e[n]>>>4).toString(16)),t.push((15&e[n]).toString(16));return t.join("")},hexToBytes:function(e){for(var t=[],n=0;n<e.length;n+=2)t.push(parseInt(e.substr(n,2),16));return t},bytesToBase64:function(e){for(var n=[],r=0;r<e.length;r+=3)for(var o=e[r]<<16|e[r+1]<<8|e[r+2],i=0;i<4;i++)8*r+6*i<=8*e.length?n.push(t.charAt(o>>>6*(3-i)&63)):n.push("=");return n.join("")},base64ToBytes:function(e){e=e.replace(/[^A-Z0-9+\/]/gi,"");for(var n=[],r=0,o=0;r<e.length;o=++r%4)0!=o&&n.push((t.indexOf(e.charAt(r-1))&Math.pow(2,-2*o+8)-1)<<2*o|t.indexOf(e.charAt(r))>>>6-2*o);return n}};e.exports=n}()})),H={utf8:{stringToBytes:function(e){return H.bin.stringToBytes(unescape(encodeURIComponent(e)))},bytesToString:function(e){return decodeURIComponent(escape(H.bin.bytesToString(e)))}},bin:{stringToBytes:function(e){for(var t=[],n=0;n<e.length;n++)t.push(255&e.charCodeAt(n));return t},bytesToString:function(e){for(var t=[],n=0;n<e.length;n++)t.push(String.fromCharCode(e[n]));return t.join("")}}},P=H,M=function(e){return null!=e&&(L(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&L(e.slice(0,0))}(e)||!!e._isBuffer)};function L(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}var $=O((function(e){!function(){var t=D,n=P.utf8,r=M,o=P.bin,i=function(e,a){e.constructor==String?e=a&&"binary"===a.encoding?o.stringToBytes(e):n.stringToBytes(e):r(e)?e=Array.prototype.slice.call(e,0):Array.isArray(e)||e.constructor===Uint8Array||(e=e.toString());for(var s=t.bytesToWords(e),u=8*e.length,c=1732584193,l=-271733879,f=-1732584194,d=271733878,p=0;p<s.length;p++)s[p]=16711935&(s[p]<<8|s[p]>>>24)|4278255360&(s[p]<<24|s[p]>>>8);s[u>>>5]|=128<<u%32,s[14+(u+64>>>9<<4)]=u;var g=i._ff,m=i._gg,y=i._hh,h=i._ii;for(p=0;p<s.length;p+=16){var S=c,w=l,v=f,x=d;c=g(c,l,f,d,s[p+0],7,-680876936),d=g(d,c,l,f,s[p+1],12,-389564586),f=g(f,d,c,l,s[p+2],17,606105819),l=g(l,f,d,c,s[p+3],22,-1044525330),c=g(c,l,f,d,s[p+4],7,-176418897),d=g(d,c,l,f,s[p+5],12,1200080426),f=g(f,d,c,l,s[p+6],17,-1473231341),l=g(l,f,d,c,s[p+7],22,-45705983),c=g(c,l,f,d,s[p+8],7,1770035416),d=g(d,c,l,f,s[p+9],12,-1958414417),f=g(f,d,c,l,s[p+10],17,-42063),l=g(l,f,d,c,s[p+11],22,-1990404162),c=g(c,l,f,d,s[p+12],7,1804603682),d=g(d,c,l,f,s[p+13],12,-40341101),f=g(f,d,c,l,s[p+14],17,-1502002290),c=m(c,l=g(l,f,d,c,s[p+15],22,1236535329),f,d,s[p+1],5,-165796510),d=m(d,c,l,f,s[p+6],9,-1069501632),f=m(f,d,c,l,s[p+11],14,643717713),l=m(l,f,d,c,s[p+0],20,-373897302),c=m(c,l,f,d,s[p+5],5,-701558691),d=m(d,c,l,f,s[p+10],9,38016083),f=m(f,d,c,l,s[p+15],14,-660478335),l=m(l,f,d,c,s[p+4],20,-405537848),c=m(c,l,f,d,s[p+9],5,568446438),d=m(d,c,l,f,s[p+14],9,-1019803690),f=m(f,d,c,l,s[p+3],14,-187363961),l=m(l,f,d,c,s[p+8],20,1163531501),c=m(c,l,f,d,s[p+13],5,-1444681467),d=m(d,c,l,f,s[p+2],9,-51403784),f=m(f,d,c,l,s[p+7],14,1735328473),c=y(c,l=m(l,f,d,c,s[p+12],20,-1926607734),f,d,s[p+5],4,-378558),d=y(d,c,l,f,s[p+8],11,-2022574463),f=y(f,d,c,l,s[p+11],16,1839030562),l=y(l,f,d,c,s[p+14],23,-35309556),c=y(c,l,f,d,s[p+1],4,-1530992060),d=y(d,c,l,f,s[p+4],11,1272893353),f=y(f,d,c,l,s[p+7],16,-155497632),l=y(l,f,d,c,s[p+10],23,-1094730640),c=y(c,l,f,d,s[p+13],4,681279174),d=y(d,c,l,f,s[p+0],11,-358537222),f=y(f,d,c,l,s[p+3],16,-722521979),l=y(l,f,d,c,s[p+6],23,76029189),c=y(c,l,f,d,s[p+9],4,-640364487),d=y(d,c,l,f,s[p+12],11,-421815835),f=y(f,d,c,l,s[p+15],16,530742520),c=h(c,l=y(l,f,d,c,s[p+2],23,-995338651),f,d,s[p+0],6,-198630844),d=h(d,c,l,f,s[p+7],10,1126891415),f=h(f,d,c,l,s[p+14],15,-1416354905),l=h(l,f,d,c,s[p+5],21,-57434055),c=h(c,l,f,d,s[p+12],6,1700485571),d=h(d,c,l,f,s[p+3],10,-1894986606),f=h(f,d,c,l,s[p+10],15,-1051523),l=h(l,f,d,c,s[p+1],21,-2054922799),c=h(c,l,f,d,s[p+8],6,1873313359),d=h(d,c,l,f,s[p+15],10,-30611744),f=h(f,d,c,l,s[p+6],15,-1560198380),l=h(l,f,d,c,s[p+13],21,1309151649),c=h(c,l,f,d,s[p+4],6,-145523070),d=h(d,c,l,f,s[p+11],10,-1120210379),f=h(f,d,c,l,s[p+2],15,718787259),l=h(l,f,d,c,s[p+9],21,-343485551),c=c+S>>>0,l=l+w>>>0,f=f+v>>>0,d=d+x>>>0}return t.endian([c,l,f,d])};i._ff=function(e,t,n,r,o,i,a){var s=e+(t&n|~t&r)+(o>>>0)+a;return(s<<i|s>>>32-i)+t},i._gg=function(e,t,n,r,o,i,a){var s=e+(t&r|n&~r)+(o>>>0)+a;return(s<<i|s>>>32-i)+t},i._hh=function(e,t,n,r,o,i,a){var s=e+(t^n^r)+(o>>>0)+a;return(s<<i|s>>>32-i)+t},i._ii=function(e,t,n,r,o,i,a){var s=e+(n^(t|~r))+(o>>>0)+a;return(s<<i|s>>>32-i)+t},i._blocksize=16,i._digestsize=16,e.exports=function(e,n){if(null==e)throw new Error("Illegal argument "+e);var r=t.wordsToBytes(i(e,n));return n&&n.asBytes?r:n&&n.asString?o.bytesToString(r):t.bytesToHex(r)}}()}));function J(e){return"1"===S.encryptType?$(e):"2"===S.encryptType?U(e,"jCfeIQH52pMcgNUQoXYA").toString():void 0}function z(e,t,n){if(!e)return void console.error("please set upload data upType");var r;const o={...(r=t,{app:S.appData,data:r,device:S.deviceData,lsi:"05a525811db8d1a7e3bba884ec007649#2.0.5",projectId:S.token,userAgent:S.uAgent||"",anonymousId:S.anonymousId,userId:S.distinctId}),dataAbstract:J(JSON.stringify(t))};S.platform===m?wx.request({url:"event"===e?S.upEventUrl:S.upTrackUrl,method:"POST",header:{"Content-Type":"application/json",appKey:S.token,projectId:S.token},data:o,success:function(e){e&&e.data&&(n===p?E(t,d):n===g?E(t,l):wx.setStorageSync(n,JSON.stringify(t)))},fail:function(e){console.error(e),wx.setStorageSync(n,JSON.stringify(t))}}):uni.request({url:"event"===e?S.upEventUrl:S.upTrackUrl,method:"POST",header:{"Content-Type":"application/json",appKey:S.token,projectId:S.token},data:o,success:function(e){e&&e.data&&(n===p?E(t,d):n===g?E(t,l):uni.setStorageSync(n,JSON.stringify(t)))},fail:function(e){console.log("error: ",e),uni.setStorageSync(n,JSON.stringify(t))}})}function E(e,t){if(S.platform===m){let n=wx.getStorageSync(t),r=n?JSON.parse(n):[];r.concat(e),wx.setStorageSync(t,JSON.stringify(r))}else{let n=uni.getStorageSync(t),r=n?JSON.parse(n):[];r.concat(e),uni.setStorageSync(t,JSON.stringify(r))}}function j(e){const t=e.$page?e.$page:"",n=t.path?t.path:function(){const e=getCurrentPages(),t=e[e.length-1];return t?t.route:"/"}();let r={busSegment:e.$busSegment||0===e.$busSegment?e.$busSegment:"",module:e.$module||0===e.$module?e.$module:"",properties:e.$extend_param?JSON.stringify(e.$extend_param):"",traceId:"",trackId:x(),sceneTag:S.scene,eventId:e.$event_id?e.$event_id:"",event:e.$event_code?e.$event_code:"",utm:k(),duration:null,element:e.$element?e.$element:null,triggerTime:I(Date.now()),page:{domain:t.domain?t.domain:"",url:n||"",path:n||"",title:t.title||"",pageId:$(n)}};r&&(!0===e.$sendMode||!0===e.$send?z("event",[r],p):function(e){let t;t=S.platform===m?wx.getStorageSync(f):uni.getStorageSync(f);let n=t?JSON.parse(t):[];n.push(e),S.platform===m?wx.setStorageSync(f,JSON.stringify(n)):uni.setStorageSync(f,JSON.stringify(n))}(r))}let V,R,W,F,K,q,G,Q;function X(){F&&q&&(Y(u,null),clearInterval(F),F=null,q=null,Q=null)}function Y(e,t){if(e===a)q=null,K=1,V=0,R=Date.now(),W=R,G=b(),q=function(e){const t=getCurrentPages(),n=t[t.length-1];let r=S.platform,o="",i="",a="",s="";if("web"===r||"h5"===r){if(o=window.location.href,i=window.location.hostname,document.referrer){let e=new URL(document.referrer);a=e||"",s=e.hostname||""}}else o=n.route,a=t.length>1?t[t.length-2].route:n.route,i=S.domain?S.domain:n.route;if(n)return{path:n.route,busSegment:e.busSegment||0===e.busSegment?e.busSegment:"",module:e.module||0===e.module?e.module:"",properties:e.extend_param?JSON.stringify(e.extend_param):"",title:e.title?e.title:"",domain:i,url:o,visitPage:t.length,sourceDomain:s,sourceUrl:a,send:e.send||e.sendMode}}(t),Q=q.send,v.push(q.path);else if(e===s)K=2,V=15,W=Date.now();else if(e===u){K=3;let e=Math.max(1,(Date.now()-W)/1e3);V=Math.ceil(e)}let n={busSegment:q.busSegment,module:q.module,properties:q.properties,traceId:"",trackId:x(),sceneTag:S.scene,utm:k(),domain:q.domain,title:q.title,sourceDomain:q.sourceDomain,url:q.url,path:q.path,sourceUrl:q.sourceUrl,duration:V,circulation:K,visitPage:v.length,visitTime:I(R),uid:G};n&&(!0===Q?(delete n.uid,z("track",[n],g)):function(e,t){let n=null;n=S.platform===m?wx.getStorageSync(c):uni.getStorageSync(c);let r=n?JSON.parse(n):[];if(r.length>0){const n=r.findIndex((e=>e.uid===t));-1!==n?r[n]={...r[n],...e}:r.push(e)}else r.push(e);S.platform===m?wx.setStorageSync(c,JSON.stringify(r)):uni.setStorageSync(c,JSON.stringify(r))}(n,G))}let Z=null;e.clearUtm=function(){S.utm=null},e.getTrackId=function(){return x()},e.init=function(e){if(e){const t="test"===e.env?{upEventApi:"https://buryingpoint.gcongo.com.cn/client/api/event",upTrackApi:"https://buryingpoint.gcongo.com.cn/client/api/track",eventListApi:"https://buryingpoint.gcongo.com.cn/api/event/query/eventList"}:{upEventApi:"https://buryingpoint.onebuygz.com/client/api/event",upTrackApi:"https://buryingpoint.onebuygz.com/client/api/track",eventListApi:"https://buryingpoint.onebuygz.com/api/event/query/eventList"};S.upEventUrl=t.upEventApi,S.upTrackUrl=t.upTrackApi,function(){const e=Date.now().toString();S.trackId=e,S.utm=null,v=[],console.log("tid ",e)}(),Object.assign(S,e),T(),clearInterval(Z),Z=null,Z=setInterval((()=>{!function(){let e=null,t=null,n=[];S.platform===m?(e=wx.getStorageSync(f),wx.setStorageSync(f,""),t=wx.getStorageSync(d),wx.setStorageSync(d,"")):(e=uni.getStorageSync(f),uni.setStorageSync(f,""),t=uni.getStorageSync(d),uni.setStorageSync(d,""));const r=e?JSON.parse(e):[],o=t?JSON.parse(t):[];n.push(...r),n.push(...o),n&&n.length&&z("event",n,d)}(),function(){let e=null,t=null,n=[];S.platform===m?(e=wx.getStorageSync(c),wx.setStorageSync(c,""),t=wx.getStorageSync(l),wx.setStorageSync(l,"")):(e=uni.getStorageSync(c),uni.setStorageSync(c,""),t=uni.getStorageSync(l),uni.setStorageSync(l,""));const r=e?JSON.parse(e):[],o=t?JSON.parse(t):[];n.push(...r),n.push(...o),n&&n.length&&(n.forEach((e=>{delete e.uid})),z("track",n,l))}()}),15e3),S.isCompatible||S.platform}else console.log("init config error, please check config!");console.log("Global",S)},e.onDestroyTrack=function(){X()},e.onStartTrack=function(e){var t;e&&(t=e,F&&q&&X(),clearInterval(F),Y(a,t),F=setInterval((()=>{Y(s,null)}),15e3))},e.setCustomEvent=function(e){e&&j(e)},e.setPageExtraObj=function(e){!function(e){const t=getCurrentPages();let n=t[t.length-1];const r=w.findIndex((e=>e.path===n.route));let o={path:n.route,properties:e.properties?JSON.stringify(e.properties):"",busSegment:e.busSegment?e.busSegment:"",module:e.module?e.module:"",title:e.title?e.title:""};-1!==r?w[r]=o:w.push(o)}(e)},e.setUserId=function(e){e?(S.distinctId=e,S.platform===m?wx.setStorageSync(y,e):uni.setStorageSync(y,e)):(S.distinctId="",S.platform===m?wx.setStorageSync(y,e):uni.setStorageSync(y,""))},e.setUtmData=function(e){var t;t=e,S.utm=t?{utmSource:t.utmSource||"",utmCampaign:t.utmCampaign||"",utmMedium:t.utmMedium||"",utmTerm:t.utmTerm||"",utmContent:t.utmContent||"",ctk:t.ctk||""}:null,console.log("设置的Global.utm",S.utm)},Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).BuriedPointUni={})}(this,(function(e){"use strict";const t="v_userId",n="v_anonId";function r(e){return"macos"===e.toLowerCase()?"macOS":"harmonyos"===e.toLowerCase()?"Harmony OS":"ios"===e.toLowerCase()?"iOS":"android"===e.toLowerCase()?"Android":"windows"===e.toLowerCase()?"Windows":"linux"===e.toLowerCase()?"Linux":"unknown"}function o(e){return["Windows","Linux","macOS"].every((t=>e.includes(t)))?1:2}function i(){let e=wx.getStorageSync(n);return e||(e="xxxx-4xxx-yxxx-xxxx".replace(/[xy]/g,(function(e){let t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})),wx.setStorageSync(n,e)),e}const a="enter",s="loop",u="leave",c="UNIBPNPVUVSrcData",l="UNIBPNPVUVFailData",f="UNIBPNEventSrcData",d="UNIBPNEventFailData",p="UBPNOneEventData",g="UBPNOneTrackData",m="wxMini",y="v_userId",h="v_anonId";let S={env:"",domain:"",busSegment:"",module:"",flushInterval:"",pageInterval:"",token:"",appData:null,deviceData:null,distinctId:"",anonymousId:"",version:"",trackId:"",platform:"",uAgent:"",upEventUrl:"",upTrackUrl:"",isCompatible:!0,signTrackArray:[],encryptType:2,utm:null,scene:""},w=[],v=[];const x=()=>{if(S.trackId)return S.trackId;const e=Date.now().toString();return S.trackId=e,v=[],e};function b(){return"xxxx-4xxx-yxxx-xxxx".replace(/[xy]/g,(function(e){let t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))}function I(e){const t=new Date(e);return`${t.getFullYear()}-${t.getMonth()+1<10?"0"+(t.getMonth()+1):t.getMonth()+1}-${t.getDate()<10?"0"+t.getDate():t.getDate()} ${t.getHours()<10?"0"+t.getHours():t.getHours()}:${t.getMinutes()<10?"0"+t.getMinutes():t.getMinutes()}:${t.getSeconds()<10?"0"+t.getSeconds():t.getSeconds()}`}function k(e){if("web"===S.platform){const t=e.ua.toLowerCase();return/(windows|win32|win64|wow64)/.test(t)?1:(/(linux|android)/.test(t)||/(macintosh|mac os x|iphone|ipad|ipod)/.test(t),2)}return"pc"===e.deviceType?1:2}function _(){if("web"===S.platform){let e=window.location.href;if(e&&!e.includes("file://")&&/^(https?:\/\/[^\s$.?#].[^\s]*)$/i.test(e)){const e=window.location.href.split("?")[1];if(e){const t=new URLSearchParams(e);let n={utmSource:t.get("utmSource")||"",utmCampaign:t.get("utmCampaign")||"",utmMedium:t.get("utmMedium")||"",utmTerm:t.get("utmTerm")||"",utmContent:t.get("utmContent")||"",ctk:t.get("ctk")||""};S.utm?Object.keys(n).forEach((e=>{n[e]&&(S.utm[e]=n[e])})):S.utm=n}}}return S.utm}function T(){!function(){try{return"undefined"!=typeof wx&&wx.env&&wx.canIUse}catch(e){return!1}}()?(uni.getSystemInfo({success:function(e){S.uAgent=e.ua;const t=e.uniPlatform;if(t.includes("app"))S.platform=e.osName,S.appData=function(e){let t=plus.runtime.version,n={name:e.appName,version:t||"",carrier:"unknown",packageName:"",ecology:""};if("android"===e.platform){n.carrier="Android";let t="Android",r=plus.android.runtimeMainActivity().getPackageName();e.romName.includes("HarmonyOS")&&(t="Harmony OS",n.carrier="Harmony OS"),n.packageName=r||"",n.ecology=t}else if("ios"===e.platform){let e=plus.ios.importClass("NSBundle").mainBundle().bundleIdentifier();n.packageName=e||"",n.carrier="iOS",n.ecology="iOS"}else if("harmonyos"===e.platform){let e=uni.getAppBaseInfo();n.carrier="Harmony OS",n.ecology="Harmony OS",n.version=e.appVersion,n.packageName=e.packageName}else n.ecology="unknown";return n}(e),S.platform="Harmony OS";else if(t.includes("web")||t.includes("h5")){S.platform="web";let t=function(e){let t=e.ua.toLowerCase(),n=window.location.hostname,r=document.title;return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(t),t.includes("alipay")||t.includes("unionPay")||t.includes("onbuygz")||t.includes("onetravel"),t.includes("micromessenger")&&t.includes("miniprogram"),{name:r||"",packageName:n||"",version:"",carrier:"H5",ecology:"h5"}}(e);S.appData={...t,version:S.version?S.version:"unknown"}}else t.includes("weixin")?(S.platform="weixin",S.appData=function(){const e=uni.getAccountInfoSync(),t=uni.getAppBaseInfo();return{name:t.appName?t.appName:"",packageName:e?e.miniProgram.appId:"",version:e?e.miniProgram.envVersion+e.miniProgram.version:"",carrier:"mini",ecology:"mini"}}()):console.log("uni get platform getBaseicInfo error ");S.deviceData=function(e){var t;return{lang:e.osLanguage?e.osLanguage:e.hostLanguage,brand:e.deviceBrand?e.deviceBrand+" "+e.deviceModel:e.deviceModel,os:(t=e.osName,"macos"===t.toLowerCase()?"macOS":"harmonyos"===t.toLowerCase()?"Harmony OS":"ios"===t.toLowerCase()?"iOS":"android"===t.toLowerCase()?"Android":"windows"===t.toLowerCase()?"Windows":"linux"===t.toLowerCase()?"Linux":"unknown"),osVersion:e.osVersion,resolution:e.screenWidth+"x"+e.screenHeight,browser:e.browserName,browserVersion:e.browserVersion,color:"",deviceId:e.deviceId,deviceType:k(e),network:""}}(e)},fail:function(e){S.deviceData={lang:"",brand:"",os:"",osVersion:"",resolution:"",browser:"",browserVersion:"",color:"",deviceId:"",deviceType:"",network:""}},complete:function(){uni.getNetworkType({success(e){S.deviceData.network=e.networkType}})}}),S.distinctId=uni.getStorageSync(y)||"",S.anonymousId=uni.getStorageSync(h),S.anonymousId||(S.anonymousId=b()),uni.setStorageSync(h,S.anonymousId)):(S.platform=m,S.appData=function(){let e=wx.getAccountInfoSync().miniProgram;return{name:"",packageName:e?e.appId:"",version:e?e.envVersion+e.version:"",carrier:"mini",ecology:"mini"}}(),S.deviceData=function(){const e=wx.getSystemInfoSync();let t={lang:e.language,brand:e.brand+" "+e.model,os:r(e.platform),osVersion:e.system,resolution:e.screenWidth+"x"+e.screenHeight,browser:"",browserVersion:"",color:"",deviceId:"",deviceType:o(e.system),network:""};return wx.getNetworkType({success(e){t.network=e.networkType}}),t}(),S.distinctId=wx.getStorageSync(t)?wx.getStorageSync(t):"",S.anonymousId=i(),S.scene="WX"+wx.getLaunchOptionsSync().scene)}var B="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function O(e,t){return e(t={exports:{}},t.exports),t.exports}var N,A=(N=Object.freeze({__proto__:null,default:{}}))&&N.default||N,C=O((function(e,t){var n;e.exports=(n=n||function(e,t){var n;if("undefined"!=typeof window&&window.crypto&&(n=window.crypto),"undefined"!=typeof self&&self.crypto&&(n=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(n=globalThis.crypto),!n&&"undefined"!=typeof window&&window.msCrypto&&(n=window.msCrypto),!n&&void 0!==B&&B.crypto&&(n=B.crypto),!n)try{n=A}catch(e){}var r=function(){if(n){if("function"==typeof n.getRandomValues)try{return n.getRandomValues(new Uint32Array(1))[0]}catch(e){}if("function"==typeof n.randomBytes)try{return n.randomBytes(4).readInt32LE()}catch(e){}}throw new Error("Native crypto module could not be used to get secure random number.")},o=Object.create||function(){function e(){}return function(t){var n;return e.prototype=t,n=new e,e.prototype=null,n}}(),i={},a=i.lib={},s=a.Base={extend:function(e){var t=o(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},u=a.WordArray=s.extend({init:function(e,n){e=this.words=e||[],this.sigBytes=n!=t?n:4*e.length},toString:function(e){return(e||l).stringify(this)},concat:function(e){var t=this.words,n=e.words,r=this.sigBytes,o=e.sigBytes;if(this.clamp(),r%4)for(var i=0;i<o;i++){var a=n[i>>>2]>>>24-i%4*8&255;t[r+i>>>2]|=a<<24-(r+i)%4*8}else for(var s=0;s<o;s+=4)t[r+s>>>2]=n[s>>>2];return this.sigBytes+=o,this},clamp:function(){var t=this.words,n=this.sigBytes;t[n>>>2]&=4294967295<<32-n%4*8,t.length=e.ceil(n/4)},clone:function(){var e=s.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],n=0;n<e;n+=4)t.push(r());return new u.init(t,e)}}),c=i.enc={},l=c.Hex={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],o=0;o<n;o++){var i=t[o>>>2]>>>24-o%4*8&255;r.push((i>>>4).toString(16)),r.push((15&i).toString(16))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r<t;r+=2)n[r>>>3]|=parseInt(e.substr(r,2),16)<<24-r%8*4;return new u.init(n,t/2)}},f=c.Latin1={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],o=0;o<n;o++){var i=t[o>>>2]>>>24-o%4*8&255;r.push(String.fromCharCode(i))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r<t;r++)n[r>>>2]|=(255&e.charCodeAt(r))<<24-r%4*8;return new u.init(n,t)}},d=c.Utf8={stringify:function(e){try{return decodeURIComponent(escape(f.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return f.parse(unescape(encodeURIComponent(e)))}},p=a.BufferedBlockAlgorithm=s.extend({reset:function(){this._data=new u.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=d.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var n,r=this._data,o=r.words,i=r.sigBytes,a=this.blockSize,s=i/(4*a),c=(s=t?e.ceil(s):e.max((0|s)-this._minBufferSize,0))*a,l=e.min(4*c,i);if(c){for(var f=0;f<c;f+=a)this._doProcessBlock(o,f);n=o.splice(0,c),r.sigBytes-=l}return new u.init(n,l)},clone:function(){var e=s.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});a.Hasher=p.extend({cfg:s.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){p.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,n){return new e.init(n).finalize(t)}},_createHmacHelper:function(e){return function(t,n){return new g.HMAC.init(e,n).finalize(t)}}});var g=i.algo={};return i}(Math),n)})),D=(O((function(e,t){var n;e.exports=(n=C,function(e){var t=n,r=t.lib,o=r.WordArray,i=r.Hasher,a=t.algo,s=[],u=[];!function(){function t(t){for(var n=e.sqrt(t),r=2;r<=n;r++)if(!(t%r))return!1;return!0}function n(e){return 4294967296*(e-(0|e))|0}for(var r=2,o=0;o<64;)t(r)&&(o<8&&(s[o]=n(e.pow(r,.5))),u[o]=n(e.pow(r,1/3)),o++),r++}();var c=[],l=a.SHA256=i.extend({_doReset:function(){this._hash=new o.init(s.slice(0))},_doProcessBlock:function(e,t){for(var n=this._hash.words,r=n[0],o=n[1],i=n[2],a=n[3],s=n[4],l=n[5],f=n[6],d=n[7],p=0;p<64;p++){if(p<16)c[p]=0|e[t+p];else{var g=c[p-15],m=(g<<25|g>>>7)^(g<<14|g>>>18)^g>>>3,y=c[p-2],h=(y<<15|y>>>17)^(y<<13|y>>>19)^y>>>10;c[p]=m+c[p-7]+h+c[p-16]}var S=r&o^r&i^o&i,w=(r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22),v=d+((s<<26|s>>>6)^(s<<21|s>>>11)^(s<<7|s>>>25))+(s&l^~s&f)+u[p]+c[p];d=f,f=l,l=s,s=a+v|0,a=i,i=o,o=r,r=v+(w+S)|0}n[0]=n[0]+r|0,n[1]=n[1]+o|0,n[2]=n[2]+i|0,n[3]=n[3]+a|0,n[4]=n[4]+s|0,n[5]=n[5]+l|0,n[6]=n[6]+f|0,n[7]=n[7]+d|0},_doFinalize:function(){var t=this._data,n=t.words,r=8*this._nDataBytes,o=8*t.sigBytes;return n[o>>>5]|=128<<24-o%32,n[14+(o+64>>>9<<4)]=e.floor(r/4294967296),n[15+(o+64>>>9<<4)]=r,t.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=i._createHelper(l),t.HmacSHA256=i._createHmacHelper(l)}(Math),n.SHA256)})),O((function(e,t){var n,r,o;e.exports=(r=(n=C).lib.Base,o=n.enc.Utf8,void(n.algo.HMAC=r.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=o.parse(t));var n=e.blockSize,r=4*n;t.sigBytes>r&&(t=e.finalize(t)),t.clamp();for(var i=this._oKey=t.clone(),a=this._iKey=t.clone(),s=i.words,u=a.words,c=0;c<n;c++)s[c]^=1549556828,u[c]^=909522486;i.sigBytes=a.sigBytes=r,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var t=this._hasher,n=t.finalize(e);return t.reset(),t.finalize(this._oKey.clone().concat(n))}})))})),O((function(e,t){e.exports=C.HmacSHA256}))),U=O((function(e){!function(){var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n={rotl:function(e,t){return e<<t|e>>>32-t},rotr:function(e,t){return e<<32-t|e>>>t},endian:function(e){if(e.constructor==Number)return 16711935&n.rotl(e,8)|4278255360&n.rotl(e,24);for(var t=0;t<e.length;t++)e[t]=n.endian(e[t]);return e},randomBytes:function(e){for(var t=[];e>0;e--)t.push(Math.floor(256*Math.random()));return t},bytesToWords:function(e){for(var t=[],n=0,r=0;n<e.length;n++,r+=8)t[r>>>5]|=e[n]<<24-r%32;return t},wordsToBytes:function(e){for(var t=[],n=0;n<32*e.length;n+=8)t.push(e[n>>>5]>>>24-n%32&255);return t},bytesToHex:function(e){for(var t=[],n=0;n<e.length;n++)t.push((e[n]>>>4).toString(16)),t.push((15&e[n]).toString(16));return t.join("")},hexToBytes:function(e){for(var t=[],n=0;n<e.length;n+=2)t.push(parseInt(e.substr(n,2),16));return t},bytesToBase64:function(e){for(var n=[],r=0;r<e.length;r+=3)for(var o=e[r]<<16|e[r+1]<<8|e[r+2],i=0;i<4;i++)8*r+6*i<=8*e.length?n.push(t.charAt(o>>>6*(3-i)&63)):n.push("=");return n.join("")},base64ToBytes:function(e){e=e.replace(/[^A-Z0-9+\/]/gi,"");for(var n=[],r=0,o=0;r<e.length;o=++r%4)0!=o&&n.push((t.indexOf(e.charAt(r-1))&Math.pow(2,-2*o+8)-1)<<2*o|t.indexOf(e.charAt(r))>>>6-2*o);return n}};e.exports=n}()})),H={utf8:{stringToBytes:function(e){return H.bin.stringToBytes(unescape(encodeURIComponent(e)))},bytesToString:function(e){return decodeURIComponent(escape(H.bin.bytesToString(e)))}},bin:{stringToBytes:function(e){for(var t=[],n=0;n<e.length;n++)t.push(255&e.charCodeAt(n));return t},bytesToString:function(e){for(var t=[],n=0;n<e.length;n++)t.push(String.fromCharCode(e[n]));return t.join("")}}},P=H,$=function(e){return null!=e&&(M(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&M(e.slice(0,0))}(e)||!!e._isBuffer)};function M(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}var L=O((function(e){!function(){var t=U,n=P.utf8,r=$,o=P.bin,i=function(e,a){e.constructor==String?e=a&&"binary"===a.encoding?o.stringToBytes(e):n.stringToBytes(e):r(e)?e=Array.prototype.slice.call(e,0):Array.isArray(e)||e.constructor===Uint8Array||(e=e.toString());for(var s=t.bytesToWords(e),u=8*e.length,c=1732584193,l=-271733879,f=-1732584194,d=271733878,p=0;p<s.length;p++)s[p]=16711935&(s[p]<<8|s[p]>>>24)|4278255360&(s[p]<<24|s[p]>>>8);s[u>>>5]|=128<<u%32,s[14+(u+64>>>9<<4)]=u;var g=i._ff,m=i._gg,y=i._hh,h=i._ii;for(p=0;p<s.length;p+=16){var S=c,w=l,v=f,x=d;c=g(c,l,f,d,s[p+0],7,-680876936),d=g(d,c,l,f,s[p+1],12,-389564586),f=g(f,d,c,l,s[p+2],17,606105819),l=g(l,f,d,c,s[p+3],22,-1044525330),c=g(c,l,f,d,s[p+4],7,-176418897),d=g(d,c,l,f,s[p+5],12,1200080426),f=g(f,d,c,l,s[p+6],17,-1473231341),l=g(l,f,d,c,s[p+7],22,-45705983),c=g(c,l,f,d,s[p+8],7,1770035416),d=g(d,c,l,f,s[p+9],12,-1958414417),f=g(f,d,c,l,s[p+10],17,-42063),l=g(l,f,d,c,s[p+11],22,-1990404162),c=g(c,l,f,d,s[p+12],7,1804603682),d=g(d,c,l,f,s[p+13],12,-40341101),f=g(f,d,c,l,s[p+14],17,-1502002290),c=m(c,l=g(l,f,d,c,s[p+15],22,1236535329),f,d,s[p+1],5,-165796510),d=m(d,c,l,f,s[p+6],9,-1069501632),f=m(f,d,c,l,s[p+11],14,643717713),l=m(l,f,d,c,s[p+0],20,-373897302),c=m(c,l,f,d,s[p+5],5,-701558691),d=m(d,c,l,f,s[p+10],9,38016083),f=m(f,d,c,l,s[p+15],14,-660478335),l=m(l,f,d,c,s[p+4],20,-405537848),c=m(c,l,f,d,s[p+9],5,568446438),d=m(d,c,l,f,s[p+14],9,-1019803690),f=m(f,d,c,l,s[p+3],14,-187363961),l=m(l,f,d,c,s[p+8],20,1163531501),c=m(c,l,f,d,s[p+13],5,-1444681467),d=m(d,c,l,f,s[p+2],9,-51403784),f=m(f,d,c,l,s[p+7],14,1735328473),c=y(c,l=m(l,f,d,c,s[p+12],20,-1926607734),f,d,s[p+5],4,-378558),d=y(d,c,l,f,s[p+8],11,-2022574463),f=y(f,d,c,l,s[p+11],16,1839030562),l=y(l,f,d,c,s[p+14],23,-35309556),c=y(c,l,f,d,s[p+1],4,-1530992060),d=y(d,c,l,f,s[p+4],11,1272893353),f=y(f,d,c,l,s[p+7],16,-155497632),l=y(l,f,d,c,s[p+10],23,-1094730640),c=y(c,l,f,d,s[p+13],4,681279174),d=y(d,c,l,f,s[p+0],11,-358537222),f=y(f,d,c,l,s[p+3],16,-722521979),l=y(l,f,d,c,s[p+6],23,76029189),c=y(c,l,f,d,s[p+9],4,-640364487),d=y(d,c,l,f,s[p+12],11,-421815835),f=y(f,d,c,l,s[p+15],16,530742520),c=h(c,l=y(l,f,d,c,s[p+2],23,-995338651),f,d,s[p+0],6,-198630844),d=h(d,c,l,f,s[p+7],10,1126891415),f=h(f,d,c,l,s[p+14],15,-1416354905),l=h(l,f,d,c,s[p+5],21,-57434055),c=h(c,l,f,d,s[p+12],6,1700485571),d=h(d,c,l,f,s[p+3],10,-1894986606),f=h(f,d,c,l,s[p+10],15,-1051523),l=h(l,f,d,c,s[p+1],21,-2054922799),c=h(c,l,f,d,s[p+8],6,1873313359),d=h(d,c,l,f,s[p+15],10,-30611744),f=h(f,d,c,l,s[p+6],15,-1560198380),l=h(l,f,d,c,s[p+13],21,1309151649),c=h(c,l,f,d,s[p+4],6,-145523070),d=h(d,c,l,f,s[p+11],10,-1120210379),f=h(f,d,c,l,s[p+2],15,718787259),l=h(l,f,d,c,s[p+9],21,-343485551),c=c+S>>>0,l=l+w>>>0,f=f+v>>>0,d=d+x>>>0}return t.endian([c,l,f,d])};i._ff=function(e,t,n,r,o,i,a){var s=e+(t&n|~t&r)+(o>>>0)+a;return(s<<i|s>>>32-i)+t},i._gg=function(e,t,n,r,o,i,a){var s=e+(t&r|n&~r)+(o>>>0)+a;return(s<<i|s>>>32-i)+t},i._hh=function(e,t,n,r,o,i,a){var s=e+(t^n^r)+(o>>>0)+a;return(s<<i|s>>>32-i)+t},i._ii=function(e,t,n,r,o,i,a){var s=e+(n^(t|~r))+(o>>>0)+a;return(s<<i|s>>>32-i)+t},i._blocksize=16,i._digestsize=16,e.exports=function(e,n){if(null==e)throw new Error("Illegal argument "+e);var r=t.wordsToBytes(i(e,n));return n&&n.asBytes?r:n&&n.asString?o.bytesToString(r):t.bytesToHex(r)}}()}));function J(e,t){if(1===S.encryptType)return L(JSON.stringify(e));if(2===S.encryptType){let n="",r=e[0].trackId;n="event"===t?`&triggerTime=${e[0].triggerTime}`:`&visitTime=${e[0].visitTime}`;let o=`projectId=${S.token}&anonymousId=${S.anonymousId}&trackId=${r}${n}`;return D(o,"jCfeIQH52pMcgNUQoXYA").toString()}}function z(e,t,n){if(!e)return void console.error("please set upload data upType");var r;const o={...(r=t,{app:S.appData,data:r,device:S.deviceData,lsi:"f9b0b43338054e472866a63bd8da14a4#2.0.6",projectId:S.token,userAgent:S.uAgent||"",anonymousId:S.anonymousId,userId:S.distinctId}),dataAbstract:J(t,e)};S.platform===m?wx.request({url:"event"===e?S.upEventUrl:S.upTrackUrl,method:"POST",header:{"Content-Type":"application/json",appKey:S.token,projectId:S.token},data:o,success:function(e){e&&e.data&&(n===p?E(t,d):n===g?E(t,l):wx.setStorageSync(n,JSON.stringify(t)))},fail:function(e){console.error(e),wx.setStorageSync(n,JSON.stringify(t))}}):uni.request({url:"event"===e?S.upEventUrl:S.upTrackUrl,method:"POST",header:{"Content-Type":"application/json",appKey:S.token,projectId:S.token},data:o,success:function(e){e&&e.data&&(n===p?E(t,d):n===g?E(t,l):uni.setStorageSync(n,JSON.stringify(t)))},fail:function(e){console.log("error: ",e),uni.setStorageSync(n,JSON.stringify(t))}})}function E(e,t){if(S.platform===m){let n=wx.getStorageSync(t),r=(n?JSON.parse(n):[]).concat(e);wx.setStorageSync(t,JSON.stringify(r))}else{let n=uni.getStorageSync(t),r=(n?JSON.parse(n):[]).concat(e);uni.setStorageSync(t,JSON.stringify(r))}}function j(e){const t=e.$page?e.$page:"",n=t.path?t.path:function(){const e=getCurrentPages(),t=e[e.length-1];return t?t.route:"/"}();let r={busSegment:e.$busSegment||0===e.$busSegment?e.$busSegment:"",module:e.$module||0===e.$module?e.$module:"",properties:e.$extend_param?JSON.stringify(e.$extend_param):"",traceId:"",trackId:x(),sceneTag:S.scene,eventId:e.$event_id?e.$event_id:"",event:e.$event_code?e.$event_code:"",utm:_(),duration:null,element:e.$element?e.$element:null,triggerTime:I(Date.now()),page:{domain:t.domain?t.domain:"",url:n||"",path:n||"",title:t.title||"",pageId:L(n)}};r&&(!0===e.$sendMode||!0===e.$send?z("event",[r],p):function(e){let t;t=S.platform===m?wx.getStorageSync(f):uni.getStorageSync(f);let n=t?JSON.parse(t):[];n.push(e),S.platform===m?wx.setStorageSync(f,JSON.stringify(n)):uni.setStorageSync(f,JSON.stringify(n))}(r))}let V,R,W,F,K,q,Q,X;function Y(){F&&q&&(Z(u,null),clearInterval(F),F=null,q=null,X=null)}function Z(e,t){if(e===a)q=null,K=1,V=0,R=Date.now(),W=R,Q=b(),q=function(e){const t=getCurrentPages(),n=t[t.length-1];let r=S.platform,o="",i="",a="",s="";if("web"===r||"h5"===r){if(o=window.location.href,i=window.location.hostname,document.referrer){let e=new URL(document.referrer);a=e||"",s=e.hostname||""}}else o=n.route,a=t.length>1?t[t.length-2].route:n.route,i=S.domain?S.domain:n.route;if(n)return{path:n.route,busSegment:e.busSegment||0===e.busSegment?e.busSegment:"",module:e.module||0===e.module?e.module:"",properties:e.extend_param?JSON.stringify(e.extend_param):"",title:e.title?e.title:"",domain:i,url:o,visitPage:t.length,sourceDomain:s,sourceUrl:a,send:e.send||e.sendMode}}(t),X=q.send,v.push(q.path);else if(e===s)K=2,V=15,W=Date.now();else if(e===u){K=3;let e=Math.max(1,(Date.now()-W)/1e3);V=Math.ceil(e)}let n={busSegment:q.busSegment,module:q.module,properties:q.properties,traceId:"",trackId:x(),sceneTag:S.scene,utm:_(),domain:q.domain,title:q.title,sourceDomain:q.sourceDomain,url:q.url,path:q.path,sourceUrl:q.sourceUrl,duration:V,circulation:K,visitPage:v.length,visitTime:I(R),uid:Q};n&&(!0===X?(delete n.uid,z("track",[n],g)):function(e,t){let n=null;n=S.platform===m?wx.getStorageSync(c):uni.getStorageSync(c);let r=n?JSON.parse(n):[];if(r.length>0){const n=r.findIndex((e=>e.uid===t));-1!==n?r[n]={...r[n],...e}:r.push(e)}else r.push(e);S.platform===m?wx.setStorageSync(c,JSON.stringify(r)):uni.setStorageSync(c,JSON.stringify(r))}(n,Q))}let G=null;e.clearUtm=function(){S.utm=null},e.getTrackId=function(){return x()},e.init=function(e){if(e){const t="test"===e.env?{upEventApi:"https://buryingpoint.gcongo.com.cn/client/api/event",upTrackApi:"https://buryingpoint.gcongo.com.cn/client/api/track",eventListApi:"https://buryingpoint.gcongo.com.cn/api/event/query/eventList"}:{upEventApi:"https://buryingpoint.onebuygz.com/client/api/event",upTrackApi:"https://buryingpoint.onebuygz.com/client/api/track",eventListApi:"https://buryingpoint.onebuygz.com/api/event/query/eventList"};S.upEventUrl=t.upEventApi,S.upTrackUrl=t.upTrackApi,function(){const e=Date.now().toString();S.trackId=e,S.utm=null,v=[],console.log("tid ",e)}(),Object.assign(S,e),T(),clearInterval(G),G=null,G=setInterval((()=>{!function(){let e=null,t=null,n=[];S.platform===m?(e=wx.getStorageSync(f),wx.setStorageSync(f,""),t=wx.getStorageSync(d),wx.setStorageSync(d,"")):(e=uni.getStorageSync(f),uni.setStorageSync(f,""),t=uni.getStorageSync(d),uni.setStorageSync(d,""));const r=e?JSON.parse(e):[],o=t?JSON.parse(t):[];n.push(...r),n.push(...o),n&&n.length&&z("event",n,d)}(),function(){let e=null,t=null,n=[];S.platform===m?(e=wx.getStorageSync(c),wx.setStorageSync(c,""),t=wx.getStorageSync(l),wx.setStorageSync(l,"")):(e=uni.getStorageSync(c),uni.setStorageSync(c,""),t=uni.getStorageSync(l),uni.setStorageSync(l,""));const r=e?JSON.parse(e):[],o=t?JSON.parse(t):[];n.push(...r),n.push(...o),n&&n.length&&(n.forEach((e=>{delete e.uid})),z("track",n,l))}()}),15e3),S.isCompatible||S.platform}else console.log("init config error, please check config!");"test"===e.env&&console.log("config: ",S)},e.onDestroyTrack=function(){Y()},e.onStartTrack=function(e){var t;e&&(t=e,F&&q&&Y(),clearInterval(F),Z(a,t),F=setInterval((()=>{Z(s,null)}),15e3))},e.setCustomEvent=function(e){e&&j(e)},e.setPageExtraObj=function(e){!function(e){const t=getCurrentPages();let n=t[t.length-1];const r=w.findIndex((e=>e.path===n.route));let o={path:n.route,properties:e.properties?JSON.stringify(e.properties):"",busSegment:e.busSegment?e.busSegment:"",module:e.module?e.module:"",title:e.title?e.title:""};-1!==r?w[r]=o:w.push(o)}(e)},e.setUserId=function(e){e?(S.distinctId=e,S.platform===m?wx.setStorageSync(y,e):uni.setStorageSync(y,e)):(S.distinctId="",S.platform===m?wx.setStorageSync(y,e):uni.setStorageSync(y,""))},e.setUtmData=function(e){var t;t=e,S.utm=t?{utmSource:t.utmSource||"",utmCampaign:t.utmCampaign||"",utmMedium:t.utmMedium||"",utmTerm:t.utmTerm||"",utmContent:t.utmContent||"",ctk:t.ctk||""}:null},Object.defineProperty(e,"__esModule",{value:!0})}));
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "visual-buried-point-platform-uni",
|
|
3
|
-
"version": "2.0.
|
|
4
|
-
"lsi": "
|
|
3
|
+
"version": "2.0.6",
|
|
4
|
+
"lsi": "f9b0b43338054e472866a63bd8da14a4#2.0.6",
|
|
5
5
|
"description": "To make it easy for you to get started with GitLab, here's a list of recommended next steps.",
|
|
6
6
|
"main": "dist/cjs/buried-point-uni.js",
|
|
7
7
|
"module": "dist/esm/buried-point-uni.js",
|