gio-miniprogram-sdk 4.1.0 → 4.3.0

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.
Files changed (45) hide show
  1. package/.github/workflows/publish.yml +2 -0
  2. package/dist/alipay.js +1 -1
  3. package/dist/baidu.js +1 -1
  4. package/dist/bytedance.js +1 -1
  5. package/dist/jingdong.js +1 -1
  6. package/dist/kuaishou.js +1 -1
  7. package/dist/plugins/gioABTest.js +1 -1
  8. package/dist/plugins/gioCompress.js +1 -1
  9. package/dist/plugins/gioEventAutoTracking.js +1 -1
  10. package/dist/plugins/gioImpressionTracking.js +1 -1
  11. package/dist/plugins/gioMultipleInstances.js +1 -1
  12. package/dist/qq.js +1 -1
  13. package/dist/quickapp.js +1 -1
  14. package/dist/taobao.js +1 -1
  15. package/dist/taro.js +1 -1
  16. package/dist/uniapp.js +1 -1
  17. package/dist/wechat.js +1 -1
  18. package/package.json +1 -1
  19. package/rollup.config.js +1 -1
  20. package/rollup.plugins.config.js +6 -1
  21. package/src/adapters/gioTaobaoAdapter.ts +7 -3
  22. package/src/adapters/gioTaroAdapter.ts +18 -10
  23. package/src/adapters/gioUniAppAdapter.ts +3 -32
  24. package/src/constants/config.ts +1 -0
  25. package/src/core/dataStore/eventContextBuilder.ts +27 -13
  26. package/src/core/dataStore/eventHooks/appEffects.ts +62 -76
  27. package/src/core/dataStore/eventHooks/index.ts +45 -24
  28. package/src/core/dataStore/eventHooks/minipPage.ts +129 -30
  29. package/src/core/dataStore/eventHooks/pageEffects.ts +25 -53
  30. package/src/core/dataStore/index.ts +67 -74
  31. package/src/core/growingIO.ts +93 -45
  32. package/src/index.ts +12 -12
  33. package/src/minipInstance/base.ts +53 -26
  34. package/src/minipInstance/my.ts +5 -0
  35. package/src/minipInstance/tb.ts +5 -0
  36. package/src/platformConfig/base.ts +0 -1
  37. package/src/plugins/gioABTest.ts +15 -8
  38. package/src/plugins/gioCompress.ts +2 -0
  39. package/src/plugins/gioEventAutoTracking.ts +20 -3
  40. package/src/plugins/gioImpressionTracking.ts +13 -2
  41. package/src/plugins/gioMultipleInstances.ts +14 -3
  42. package/src/types/dataStore.ts +5 -1
  43. package/src/types/eventHooks.ts +13 -8
  44. package/src/types/growingIO.ts +52 -33
  45. package/src/utils/tools.ts +26 -3
package/dist/uniapp.js CHANGED
@@ -1 +1 @@
1
- const e=/^e[0-9]+$/,t=/^[a-zA-Z_][0-9a-zA-Z_]{0,100}$/,i=e=>["undefined","null"].includes(T(e)),s=e=>"string"===T(e),n=e=>"number"===T(e),r=e=>"boolean"===T(e),o=e=>"[object Object]"==={}.toString.call(e)&&!i(e),a=e=>["function","asyncfunction"].includes(T(e)),g=e=>Array.isArray(e)&&"array"===T(e),l=e=>{try{return Array.from(e)[0]}catch(e){return}},u=e=>{try{const t=Array.from(e);return t[t.length-1]}catch(e){return}},c=(e,t=1)=>g(e)&&n(t)?e.slice(t>0?t:1,e.length):e,d=(e,t=!1)=>{if(g(e)){let i=0;const s=[];for(const n of e)n&&!P(n)&&(s[i++]=n),t&&0===n&&(s[i++]=n);return s}return e},h=(e,t)=>{if(g(e)){const i=e.findIndex(t);return 0>i?void 0:e[i]}},p=e=>i(e)?"":""+e,v=(e,t)=>"string"===T(e)?e.split(t):e,m=e=>{if(s(e)){const t=v(e,"");return`${l(t).toLowerCase()}${c(t).join("")}`}return e},f=(e,t)=>(s(e)||(e=p(e)),e.slice(0,t.length)===t),I={}.hasOwnProperty,y=(e,t)=>!i(e)&&I.call(e,t),O=e=>o(e)?Object.keys(e):[],S=(e,t)=>{O(e).forEach((i=>t(e[i],i)))},w=(e,t)=>{const i=O(e);return!(!o(e)||!o(t)||i.length!==O(t).length||i.map(((i,s)=>o(e[i])?w(e[i],t[i]):e[i]===t[i])).includes(!1))},b=(e,t,i)=>{let s=e;return o(e)?(t.split(".").forEach((e=>{s=s?s[e]:i})),s):i},k=(e,t)=>{if(!o(e))return!1;try{if("string"===T(t))return delete e[t];if("array"===T(t))return t.map((t=>delete e[t]));"object"===T(t)&&t.constructor===RegExp&&O(e).forEach((i=>{t.test(i)&&k(e,i)}))}catch(e){return!1}},_=(e,t=250,i,s)=>{let n,r=0;return"boolean"!==T(i)&&(s=e,e=i,i=void 0),function(...o){let a=this,g=Date.now()-r;function l(){r=Date.now(),e.apply(a,o)}s&&!n&&l(),n&&clearTimeout(n),void 0===s&&g>t?l():!0!==i&&(n=setTimeout(s?function(){n=void 0}:l,void 0===s?t-g:t))}},P=e=>g(e)?0===e.length:o(e)?0===O(e).length:!e,T=e=>({}.toString.call(e).slice(8,-1).toLowerCase());var E=Object.freeze({__proto__:null,isNil:i,isString:s,isNaN:e=>"NaN"===p(Number(e)),isNumber:n,isBoolean:r,isObject:o,isRegExp:e=>"[object RegExp]"==={}.toString.call(e),isFunction:a,isArray:g,isDate:e=>"date"===T(e),fixed:(e,t)=>n(e)?Number(e.toFixed(n(t)?t:2)):s(e)&&"NaN"!==p(Number(e))?Number(Number(e).toFixed(n(t)?t:2)):e,head:l,last:u,drop:c,dropWhile:(e,t)=>g(e)?e.filter((e=>!t(e))):e,compact:d,find:h,isEqualArray:(e,t)=>!(!g(e)||!g(t)||e.length!==t.length)&&e.every(((e,i)=>e===t[i])),toString:p,split:v,lowerFirst:m,upperFirst:e=>{if(s(e)){const t=v(e,"");return`${l(t).toUpperCase()}${c(t).join("")}`}return e},startsWith:f,endsWith:(e,t)=>{const{length:i}=e;let s=i;s>i&&(s=i);const n=s;return s-=t.length,s>=0&&e.slice(s,n)===t},hasOwnProperty:I,has:y,keys:O,forEach:S,isEqual:w,get:b,unset:k,throttle:_,isEmpty:P,typeOf:T,formatDate:e=>{function t(e){return 10>e?"0"+e:e}return e.getFullYear()+"-"+t(e.getMonth()+1)+"-"+t(e.getDate())+" "+t(e.getHours())+":"+t(e.getMinutes())+":"+t(e.getSeconds())+"."+t(e.getMilliseconds())}});const C=(e,t)=>{console.log("%c[GrowingIO]:"+e,{info:"color: #3B82F6;",error:"color: #EF4444",warn:"color: #F59E0B",success:"color: #10B981"}[t]||"")},j=(e,t=!0,i="参数不合法")=>C(`${t?"调用":"设置"} ${e} 失败,${i}!`,"warn"),x=e=>{try{return e()}catch(e){return}},A=(e,t)=>{if(a(e))try{e(t)}catch(e){C("回调执行失败!"+e,"error")}},q=e=>s(e)?e.trim().substring(0,100):e,N=(e,i)=>s(e)&&!P(e)&&e.match(t)?i():(C("事件名格式不正确,只能包含数字、字母和下划线,且不能以数字开头,字符总长度不能超过100!","error"),!1),U=e=>(i(e)||O(e).forEach((t=>{a(e[t])?e[t]=x((()=>e[t]())):o(e[t])?k(e,t):g(e[t])||(e[t]=p(e[t]))})),e),$=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})),H=e=>e.pixelRatio?Math.round(e.screenHeight*e.pixelRatio):e.screenHeight,K=e=>e.pixelRatio?Math.round(e.screenWidth*e.pixelRatio):e.screenWidth,D=(e,t)=>{if(e){const i=e.toLowerCase();return-1!==i.indexOf("android")?t+"-Android":-1!==i.indexOf("ios")?t+"-iOS":e}},V=e=>{if(s(e)){const t=e.indexOf("?");return-1!==t?[e.substring(0,t),e.substring(t+1)]:[e,""]}return["",""]},L=e=>s(e)?e.startsWith("/")?e:"/"+e:"",F=e=>x((()=>{switch(e){case"wx":return wx;case"my":case"tb":return my;case"swan":return swan;case"tt":return tt;case"qq":return qq;case"ks":return ks;case"jd":return jd;default:{let e;return e||(e=x((()=>swan))),e||(e=x((()=>my))),e||(e=x((()=>tt))),e||(e=x((()=>qq))),e||(e=x((()=>ks))),e||(e=x((()=>jd))),e||(e=x((()=>wx))),e}}})),R=e=>x((()=>{switch(e){case"wx":return __wxConfig;case"swan":return appConfig;case"tt":return __ttConfig;case"qq":return __qqConfig;case"ks":return __ksConfig;case"jd":return __jdConfig;default:return}})),B=()=>{let e;return!e&&x((()=>swan))&&(e="swan"),!e&&x((()=>tt))&&(e="tt"),!e&&x((()=>qq))&&(e="qq"),!e&&x((()=>my.tb))&&(e="tb"),!e&&x((()=>my))&&(e="my"),!e&&x((()=>ks))&&(e="ks"),!e&&x((()=>jd))&&(e="jd"),!e&&x((()=>wx))&&(e="wx"),e||h(O(global),(e=>p(e).toLowerCase().includes("quickapp")))&&(e="quickapp"),e},G=()=>{var e;return null!==(e=x((()=>$global)))&&void 0!==e?e:global},M=e=>{const t={};return o(e)&&(k(e,"&&sendTo"),S(e,((e,s)=>{const n=p(s).slice(0,100);o(e)?t[n]=M(e):g(e)?(t[n]=d(e.slice(0,100),!0),t[n]=t[n].join("||").slice(0,1e3)):t[n]=i(e)?"":p(e).slice(0,1e3)}))),t},Q=(e,t)=>{const i=()=>t.map((t=>e.getStorageSync(t)));try{return e.minip.canIUse("batchGetStorageSync")?e.minip.batchGetStorageSync(t):i()}catch(e){return i()}},z=(e,t)=>{const i=()=>t.map((({key:t,value:i})=>e.setStorageSync(t,i)));try{return e.minip.canIUse("batchSetStorageSync")?e.minip.batchSetStorageSync(t):i()}catch(e){return i()}},W=e=>O(e||{}).map((t=>t?`${t}=${i(e[t])?"":e[t]}`:"")).join("&"),J=e=>{(f(e,"?")||f(e,"&"))&&(e=e.slice(1,e.length));const t={};return e.split("&").forEach((e=>{const i=e.split("=");i[0]&&(t[i[0]]=i[1])})),t};var Y=Object.freeze({__proto__:null,consoleText:C,callError:j,niceTry:x,niceCallback:A,limitString:q,eventNameValidate:N,getDynamicAttributes:U,guid:$,getScreenHeight:H,getScreenWidth:K,getOS:D,compareVersion:(e="",t="")=>{const i=e=>e.replace(/\s+/g,""),s=e=>e.replace(/[vV]/g,""),n=i(s(e)),r=i(s(t)),o=n.split("."),a=r.split(".");for(let e=0;3>e;e++){let t=Number(o[e]),i=Number(a[e]);if(t>i)return 1;if(i>t)return-1;if(!isNaN(t)&&isNaN(i))return 1;if(isNaN(t)&&!isNaN(i))return-1}return 0},getVueVersion:e=>{if(e){const t=Number(l(v(e.version,".")));return Number.isNaN(t)?0:t}return 0},splitPath:V,normalPath:L,isTaro3:e=>{const{Current:t,createComponent:i}=e;return!(!e||!t||i)},getPlainMinip:F,getPlainConfig:R,getPlainPlatform:B,getSubKeys:e=>O(e).filter((e=>e.indexOf("__sub")>-1&&e.indexOf("gio__")>-1)).sort(),getAppInst:()=>{let e=x((()=>getApp({allowDefault:!0})));return e||(e=G()),e},getGlobal:G,limitObject:M,batchGetStorageSync:Q,batchSetStorageSync:z,qsStringify:W,qsParse:J,hashCode:(e,t=!1)=>{let i=0;if(P(e)||"boolean"==typeof e)return i;let s=0;for(;s<e.length;)i=(i<<5)-i+e.charCodeAt(s),i|=0,s++;return t?Math.abs(i):i}});const Z=e=>s(e)&&e.length>0||n(e)&&e>0,X={autotrack:{type:"boolean",default:!0},compress:{type:"boolean",default:!0},dataCollect:{type:"boolean",default:!0},debug:{type:"boolean",default:!1},idMapping:{type:"boolean",default:!1},enableIdMapping:{type:"boolean",default:!1},extraParams:{type:"array",default:[]},followShare:{type:"boolean",default:!0},forceLogin:{type:"boolean",default:!1},ignoreFields:{type:"array",default:[]},pluginMode:{type:"boolean",default:!1},originalSource:{type:"boolean",default:!0},keepAlive:{type:"number",default:3e5},performance:{type:"object",default:{monitor:!0,exception:!0}},serverUrl:{type:"string",default:"https://napi.growingio.com"},requestTimeout:{type:"number",default:5e3},taro:{type:["object","module"],default:!1},taroVue:{type:["object","function"],default:!1},tbConfig:{type:"object",default:{cloud:void 0,cloudFuncSend:!1,cloudFuncName:"httpTunnel",cloudFuncHandler:"main",cloudAppId:void 0,path:void 0}},trackPage:{type:"boolean",default:!0},uniVue:{type:["object","function"],default:!1},uploadInterval:{type:"number",default:1e3},version:{type:"string",default:"1.0.0"}},ee=["clearGeneralProps","clearTrackTimer","clearUserId","getABTest","getGioInfo","getOption","identify","removeTimer","sendPage","sendVisit","setGeneralProps","setLocation","setOption","setPageAttributes","setUserAttributes","setUserId","track","trackTimerEnd","trackTimerPause","trackTimerResume","trackTimerStart"],te=["init","registerPlugins","getPlugins","getDeviceId","updateImpression",...ee],ie={autotrack:"无埋点",dataCollect:"数据采集",debug:"调试模式",serverUrl:"数据上报服务地址"},se=["enableDebug","setAutotrack","setDataCollect","setTrackerHost","setTrackerScheme","setConfig","collectImp","setPlatformProfile","getLocation"],ne=["deviceBrand","deviceModel","deviceType","networkState","screenHeight","screenWidth","operatingSystem"],re=[...ne,"appChannel","language","platformVersion"],oe={gsid:"_growing_gsid_",originalSource:"_gdp_original_source_",userId:"_growing_userId_",userKey:"_growing_userKey_",gioId:"_growing_gioId_",plugin_gsid:"_growing_plugin_gsid_",plugin_originalSource:"_gdp_plugin_original_source_",plugin_userId:"_growing_plugin_userId_",plugin_userKey:"_growing_plugin_userKey_",plugin_gioId:"_growing_plugin_gioId_"};var ae="MINIP_LIFECYCLE",ge="ON_COMMIT_REQUEST",le="ON_COMPOSE_AFTER",ue="ON_COMPOSE_BEFORE",ce="ON_ERROR",de="ON_INSTALL",he="ON_SEND_AFTER",pe="ON_SEND_BEFORE",ve="OPTION_CHANGE",me="OPTION_INITIALIZED",fe="SDK_INITIALIZED";class Ie{constructor(e){this.growingIO=e,this.main=(e,t)=>{var i,s,n,r,o,a;e||(e=this.growingIO.trackingId);const{sdkVersion:g,platformConfig:l,minipInstance:u,userStore:c,dataStore:d,dataStore:{scene:h,eventHooks:p,lastVisitEvent:v,lastPageEvent:m}}=this.growingIO,{version:f,dataSourceId:I,appId:y,idMapping:O,ignoreFields:S}=d.getTrackerVds(e),w=d.locationData[e],{systemInfo:b={},network:_={}}=u,{brand:T,model:E,platform:C,language:j}=b,x={appChannel:"scn:"+(h||"NA"),appVersion:f,dataSourceId:I,deviceBrand:T,deviceId:c.getUid(),deviceModel:E,deviceType:D(C,l.name),domain:y,language:j,latitude:null==w?void 0:w.latitude,longitude:null==w?void 0:w.longitude,networkState:(null==_?void 0:_.networkType)||(null==_?void 0:_.type)||(null==_?void 0:_.subtype),operatingSystem:D(C,l.name),path:(null===(i=p.currentPage)||void 0===i?void 0:i.path)?null===(s=p.currentPage)||void 0===s?void 0:s.path:v.path,platform:l.platform,platformVersion:l.name+(b.version?" "+b.version:""),query:(null===(n=p.currentPage)||void 0===n?void 0:n.path)?null===(r=p.currentPage)||void 0===r?void 0:r.query:v.query,screenHeight:H(b),screenWidth:K(b),sdkVersion:g,sessionId:c.getSessionId(e),title:(null===(o=m[e])||void 0===o?void 0:o.title)||(null===(a=p.currentPage)||void 0===a?void 0:a.title)||u.getPageTitle(u.getCurrentPage()),timestamp:Date.now(),timezoneOffset:(new Date).getTimezoneOffset(),userId:c.getUserId(e)};return O&&(x.userKey=c.getUserKey(e)),P(S)||S.forEach((e=>{k(x,e)})),P(t)?Object.assign(Object.assign({},x),{trackingId:e}):Object.assign(Object.assign(Object.assign({},x),t),{trackingId:e})}}}function ye(e,t,i,s){return new(i||(i=Promise))((function(n,r){function o(e){try{g(s.next(e))}catch(e){r(e)}}function a(e){try{g(s.throw(e))}catch(e){r(e)}}function g(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}g((s=s.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;class Oe{constructor(e){this.growingIO=e,this.main=(e,t)=>{var i,s;const n=Date.now(),{emitter:r,userStore:o,vdsConfig:a,platformConfig:g,uploader:l,dataStore:u,dataStore:{trackersExecute:c,shareOut:d,lastCloseTime:h,eventHooks:p,saveStorageInfo:v,setOriginalSource:m}}=this.growingIO;r.emit(ae,{event:"App "+e,timestamp:n,params:null!==(i=t[0])&&void 0!==i?i:{}}),a.debug&&console.log("App:",e,n);const f=g.listeners.app;switch(r.emit(ue,{event:"App "+e,params:null!==(s=t[0])&&void 0!==s?s:{}}),e){case f.appCreate:case f.appShow:{const{path:e,query:i}=this.enterParamsParse(t[0]);!d&&a.originalSource&&c((t=>{m(t,{path:e,query:i})})),h?(Date.now()-h>a.keepAlive||u.lastScene&&u.scene!==u.lastScene)&&(c((e=>{o.setSessionId(e)})),p.currentPage.time=void 0,c((t=>{this.buildVisitEvent(t,{path:e,query:i})}))):(u.lastVisitEvent={path:e,query:i},c((t=>{this.buildVisitEvent(t,{path:e,query:i})})));break}case f.appClose:u.lastScene=u.scene,u.lastCloseTime=Date.now(),v(),o.saveUserInfo(),c((e=>{this.buildCloseEvent(e),a.forceLogin||l.initiateRequest(e,!0)}))}},this.enterParamsParse=e=>{const{gioPlatform:t,minipInstance:i,dataStore:s}=this.growingIO;let n="",r="";const a=(e,t={})=>{n=e,r=O(t).map((e=>`${e}=${t[e]}`)).join("&")};if("quickapp"!==t&&i.minip.canIUse("getEnterOptionsSync")){const{path:t,query:n,scene:g,referrerInfo:l}=i.minip.getEnterOptionsSync()||{},u=e.query||n;if(a(e.path||t,u),s.scene=e.scene||g,!P(l)&&o(null==l?void 0:l.extraData)){let e=[];S(l.extraData,((t,i)=>{!y(u,i)&&["string","number","boolean"].includes(T(t))&&e.push(`${i}=${t}`)}));const t=e.join("&");r=r&&t?`${r}&${t}`:r||t}}else{const{path:t,query:i}=e;a(t,i),this.parseScene(e)}return{path:n,query:r}},this.parseScene=e=>{var t;const{minipInstance:i,gioPlatform:s,dataStore:n}=this.growingIO;let r;if("quickapp"===s){const{extra:e,type:t}=i.getAppSource();r=(null==e?void 0:e.scene)||t}else P(e)||((null===(t=null==e?void 0:e.query)||void 0===t?void 0:t.wxShoppingListScene)?r=e.query.wxShoppingListScene:(null==e?void 0:e.scene)?r=e.scene:n.scene="NA");n.scene=r},this.buildVisitEvent=(e,t)=>{var s;const{dataStore:{getOriginalSource:n,eventContextBuilder:r,eventInterceptor:o,eventHooks:a},minipInstance:g,vdsConfig:l}=this.growingIO,u=n(e),c=(null==t?void 0:t.query)||"";let d=Object.assign({eventType:"VISIT"},r(e,{path:(null==t?void 0:t.path)||"",query:"string"===T(c)?c:W(c),title:(null===(s=a.currentPage)||void 0===s?void 0:s.title)||g.getPageTitle(g.getCurrentPage()),timestamp:a.currentPage.time?a.currentPage.time-1:+Date.now()}));l.originalSource&&!i(u)&&(d=Object.assign(Object.assign({},d),u)),o(d)},this.buildCloseEvent=e=>{const{dataStore:{eventContextBuilder:t,eventInterceptor:i}}=this.growingIO;i(Object.assign({eventType:"APP_CLOSED"},t(e)))}}}class Se{constructor(e){this.growingIO=e,this.parsePage=(e,t)=>{var i;const s=e.route||e.uri||e.__route__||(null===(i=null==e?void 0:e.$page)||void 0===i?void 0:i.fullPath)||"";P(t)?this.query=void 0:this.query=this.getQuery(t),this.path!==s&&(this.time=Date.now()),this.path=s,this.title=this.settedTitle[this.path]||this.growingIO.minipInstance.getPageTitle(e||this.growingIO.minipInstance.getCurrentPage())},this.getQuery=e=>{const t=Object.assign({},e);return k(t,"wxShoppingListScene"),W(t)},this.getReferralPage=e=>{var t;const{minipInstance:i,dataStore:{lastPageEvent:s,scene:n}}=this.growingIO;return(null===(t=s[e])||void 0===t?void 0:t.path)||(n?`scn:${i.scnPrefix}${n}`:null)},this.updateShareResult=e=>{const[t,i]=this.buildShareQuery(e);return e.path=L(t+(i?"?"+i:"")),e.query=i,e},this.updateAppMessageResult=this.updateShareResult,this.updateTimelineResult=this.updateShareResult,this.updateAddFavoritesResult=e=>{const[t,i]=this.buildShareQuery(e);return e.path=L(t+(i?"?"+i:"")),e.query=i,e},this.query=void 0,this.settedTitle={},this.pageProps={}}buildShareQuery(e){var t,i,s;const n=V(null!==(t=e.path)&&void 0!==t?t:"");let r=this.path,o={},a=y(e,"path");return a&&(r=l(n),o=J(u(n))||{}),P(o)&&(o=J(null!==(i=e.query)&&void 0!==i?i:"")||{}),!a&&P(o)&&(o=J(null!==(s=this.query)&&void 0!==s?s:"")||{}),[r,W(o)]}}class we{constructor(e){this.growingIO=e,this.main=(e,t,i)=>{var s,n;const r=Date.now(),{emitter:o,minipInstance:g,plugins:l,vdsConfig:u,platformConfig:c,dataStore:{getTrackerVds:d,trackersExecute:h,shareOut:p,eventHooks:v,toggleShareOut:m,buildAppMessageEvent:f,buildTimelineEvent:I,buildAddFavorites:y},inPlugin:O}=this.growingIO,{currentPage:S}=v;if(this.prevEvent[t]&&50>Date.now()-Number(this.prevEvent[t]))return;e||(e=g.getCurrentPage()),e.route||(e.route=g.getCurrentPath(e));const w=e.route||e.uri||e.__route__||(null===(s=null==e?void 0:e.$page)||void 0===s?void 0:s.fullPath)||"";o.emit(ae,{event:"Page "+t,timestamp:r,params:{page:e,args:i[0]}}),u.debug&&console.log("Page:",w,"#",t,r),this.prevEvent[t]=Date.now();const _=c.listeners.page;switch(o.emit(ue,{page:e,event:"Page "+t,params:{page:e,args:i[0]}}),S.lastLifecycle=S.currentLifecycle,S.currentLifecycle=t,t){case _.pageLoad:this.argQuery[w]=b(e,"options")||b(e,"__displayReporter.query")||b(e,"$page.query")||b(e,"$wx.__displayReporter.query")||i[0]||{},k(this.argQuery[w],"$taroTimestamp"),S.parsePage(e,this.argQuery[w]);break;case _.pageShow:O?(S.parsePage(e,this.argQuery[w]),S.path||(S.path=`/插件${u.appId}}`,S.title=`/插件${u.appId}}`),h((e=>{const{trackPage:t}=d(e);t&&this.buildPageEvent(e)}))):p&&v.currentPage.time||(S.parsePage(e,this.argQuery[w]),v.currentPage.time=Date.now(),h((e=>{const{trackPage:t}=d(e);t&&this.buildPageEvent(e)}))),m(!1);break;case _.pageHide:case _.pageUnload:break;case _.shareApp:m(!0),h((e=>{const{followShare:t}=d(e);t&&f(e,i)}));break;case _.shareTime:h((e=>{const{followShare:t}=d(e);t&&I(e,i)}));break;case _.addFavorites:h((e=>{const{followShare:t}=d(e);t&&y(e,i)}));break;case _.tabTap:{const e=null===(n=null==l?void 0:l.gioEventAutoTracking)||void 0===n?void 0:n.buildTabClickEvent;u.autotrack&&e&&a(e)&&e(this.growingIO.trackingId,i[0]);break}}t===_.pageUnload&&h((e=>{S.pageProps[e]=void 0}))},this.buildPageEvent=(e,t)=>{const{dataStore:{eventContextBuilder:i,eventInterceptor:s,eventHooks:{currentPage:n}},minipInstance:r}=this.growingIO,o=Object.assign(Object.assign({eventType:"PAGE",referralPage:n.getReferralPage(e)},i(e)),{title:(null==n?void 0:n.title)||r.getPageTitle(r.getCurrentPage()),timestamp:n.time});!P(t)&&t.title&&(o.title=t.title);const a=x((()=>n.pageProps[e]));P(a)||(o.attributes=a,n.pageProps[e]=void 0),s(o)},this.prevEvent={},this.argQuery={}}}class be{constructor(e){var t;this.growingIO=e,this.isNormalFc=(e,t)=>a(t)&&"constructor"!==e,this.objectTraverse=(e,t)=>{Object.getOwnPropertyNames(e).forEach((i=>t(i,e))),y(e,"methods")&&Object.getOwnPropertyNames(e.methods).forEach((i=>{e[i]||t(i,e.methods)})),y(e,"lifetimes")&&Object.getOwnPropertyNames(e.lifetimes).forEach((i=>{e[i]||t(i,e.lifetimes)})),y(e,"pageLifetimes")&&Object.getOwnPropertyNames(e.pageLifetimes).forEach((i=>{e[i]||t(i,e.pageLifetimes)}))},this.supLifeFcs=(e,t)=>{g(this[t+"Handlers"])&&this[t+"Handlers"].forEach((t=>{a(e[t])||["onShareAppMessage","onShareTimeline"].includes(t)||(e[t]=()=>{})}))},this.lifeFcEffects=(e,t,i)=>{const s=this;return["onShareTimeline","onAddToFavorites"].includes(e)?function(...n){let r=t.apply(this,n);"onShareTimeline"===e&&s.growingIO.vdsConfig.followShare&&(r=s.currentPage.updateTimelineResult(null!=r?r:{})),"onAddToFavorites"===e&&(r=s.currentPage.updateAddFavoritesResult(null!=r?r:{}));const o=[].slice.call(n);return r&&o.push(r),s[`def${i}Cbs`][e].apply(this,o),r}:function(...n){var r;return ye(this,void 0,void 0,(function*(){let o;try{if("onShareAppMessage"===e){if(o=null!==(r=yield t.apply(this,n))&&void 0!==r?r:{},"promise"===T(o.promise)){const e=function(){return ye(this,void 0,void 0,(function*(){let e=o;return new Promise((t=>{let i=setTimeout((()=>{t(Object.assign({},e)),clearTimeout(i),i=void 0}),3e3);o.promise.then((s=>{e=s,t(Object.assign({},e)),clearTimeout(i),i=void 0}))}))}))};o=Object.assign(Object.assign({},o),yield e()),k(o,"promise")}s.growingIO.vdsConfig.followShare&&(o=s.currentPage.updateAppMessageResult(null!=o?o:{}))}const a=[].slice.call(n);o&&a.push(o),s[`def${i}Cbs`][e].apply(this,a)}catch(e){C(e,"error")}return"onShareAppMessage"!==e&&(o=t.apply(this,n)),s.growingIO.emitter.emit(ae,{event:`${i} ${e}End`,timestamp:Date.now(),params:{instance:this,arguments:Array.from(n)}}),o}))}},this.customFcEffects=(e,t)=>{const i=this;return function(...s){var n,r;let o;if(i.growingIO.vdsConfig.autotrack&&i.growingIO.plugins.gioEventAutoTracking)try{let t=s[0]||{};y(t,"type")&&((null==t?void 0:t.currentTarget)||(null==t?void 0:t.target))||(t=s[s.length-1]),((null==t?void 0:t.currentTarget)||(null==t?void 0:t.target))&&i.actionEventTypes.includes(t.type)&&(a(i.actionEffects)||(i.actionEffects=(null===(r=null===(n=i.growingIO.plugins)||void 0===n?void 0:n.gioEventAutoTracking)||void 0===r?void 0:r.main)||function(){}),null==i||i.actionEffects(t,e))}catch(e){C(e,"error")}return o=t.apply(this,s),o}},this.appApplyProxy=(e,t)=>this.appHandlers.includes(e)?this.lifeFcEffects(e,t,"App"):this.customFcEffects(e,t),this.pageApplyProxy=(e,t)=>this.pageHandlers.includes(e)?this.lifeFcEffects(e,t,"Page"):this.customFcEffects(e,t),this.appOverriding=e=>(this.setAppEffectCbs(),this.supLifeFcs(e,"app"),this.objectTraverse(e,((e,t)=>{this.isNormalFc(e,t[e])&&(t[e]=this.appApplyProxy(e,t[e]))})),e),this.pageOverriding=e=>(this.setPageEffectCbs(),this.supLifeFcs(e,"page"),this.objectTraverse(e,((e,t)=>{this.isNormalFc(e,t[e])&&(t[e]=this.pageApplyProxy(e,t[e]))})),e),this.componentOverriding=e=>(this.setPageEffectCbs(),e.methods||(e.methods={}),this.supLifeFcs(this.growingIO.inPlugin?e:e.methods,"page"),this.objectTraverse(this.growingIO.inPlugin?e:e.methods,((e,t)=>{this.isNormalFc(e,t[e])&&(t[e]=this.pageApplyProxy(e,t[e]))})),e),this.setAppEffectCbs=()=>{const e=this;this.appHandlers.forEach((t=>{this.defAppCbs[t]=function(...i){e.appEffects.main(t,i)}}))},this.setPageEffectCbs=()=>{const e=this;this.pageHandlers.forEach((t=>{this.defPageCbs[t]=function(...i){e.pageEffects.main(this,t,i)}}))},this.growingApp=e=>this.originalApp(this.appOverriding(e)),this.growingPage=e=>this.originalPage(this.pageOverriding(e)),this.growingComponent=e=>this.originalComponent(this.componentOverriding(e)),this.growingBehavior=e=>this.originalBehavior(this.componentOverriding(e)),this.nativeGrowing=(e=["App","Page","Component","Behavior"])=>{const t=this,{platformConfig:i}=this.growingIO,s=i.hooks;if(this.setAppEffectCbs(),this.setPageEffectCbs(),e.includes("App"))try{s.App&&!this.appHooked&&(this.originalApp=App||global.App||function(){},App=function(...e){return t.growingApp(e[0])},this.appHooked=!0)}catch(e){}if(e.includes("Page"))try{s.Page&&!this.pageHooked&&(this.originalPage=Page||global.Page||function(){},Page=function(...e){return t.growingPage(e[0])},this.pageHooked=!0)}catch(e){}if(e.includes("Component"))try{s.Component&&!this.componentHooked&&(this.originalComponent=Component||global.Component||function(){},Component=function(...e){return t.growingComponent(e[0])},this.componentHooked=!0)}catch(e){}if(e.includes("Behavior"))try{s.Behavior&&!this.behaviorHooked&&(this.originalBehavior=Behavior||global.Behavior||function(){},Behavior=function(...e){return t.growingBehavior(e[0])},this.behaviorHooked=!0)}catch(e){}},this.initEventHooks=()=>{const e=this,{platformConfig:t,gioPlatform:i}=this.growingIO;t.canHook?(this.nativeGrowing(),G().GioApp=x((()=>null!==App&&void 0!==App?App:window.GioApp)),G().GioPage=x((()=>null!==Page&&void 0!==Page?Page:window.GioPage)),G().GioComponent=x((()=>null!==Component&&void 0!==Component?Component:window.GioComponent)),G().GioBehavior=x((()=>Behavior))):"quickapp"===i&&(window.GioApp=function(...t){return e.appOverriding(t[0])},window.GioPage=function(...t){return e.pageOverriding(t[0])},window.GioComponent=function(...t){return e.pageOverriding(t[0])})};const i=null===(t=this.growingIO)||void 0===t?void 0:t.platformConfig;this.defAppCbs={},this.defPageCbs={},this.appHandlers=i.appHandlers,this.pageHandlers=i.pageHandlers,this.actionEventTypes=i.actionEventTypes,this.appEffects=new Oe(this.growingIO),this.pageEffects=new we(this.growingIO),this.currentPage=new Se(this.growingIO)}}class ke{constructor(e){var t,n;this.growingIO=e,this.ALLOW_SETTING_KEYS=O(X),this.getStorageKey=(e,t)=>{const{inPlugin:i}=this.growingIO;return`${e===this.growingIO.trackingId?"":e}${oe[i?"plugin_"+t:t]}`},this.getGsid=e=>{let t=Number(this._gsid[e]);return Number.isNaN(t)||t>=1e9||1>t?(this.setGsid(e,1),1):t},this.setGsid=(e,t)=>{let i=Number(t);(Number.isNaN(i)||i>=1e9||1>i)&&(i=1),this._gsid[e]=i,10>this._gsid[e]-this._stid[e]||this.saveStorageInfo()},this.initStorageInfo=e=>{const{minipInstance:t}=this.growingIO,i=t.getStorageSync(this.getStorageKey(e,"gsid"));let s=Number(i);(Number.isNaN(s)||s>=1e9||1>s)&&(s=1),this._gsid[e]=s,this._stid[e]=s,s!==i&&t.setStorageSync(this.getStorageKey(e,"gsid"),s)},this.saveStorageInfo=()=>{const{minipInstance:e}=this.growingIO;this._stid=Object.assign({},this._gsid),z(e,this.initializedTrackingIds.map((e=>({key:this.getStorageKey(e,"gsid"),value:this._gsid[e]}))))},this.setOriginalSource=(e,{path:t,query:s})=>{const{minipInstance:n}=this.growingIO;if(i(this.getOriginalSource(e))){const i={path:t,query:s,title:""};n.setStorageSync(this.getStorageKey(e,"originalSource"),JSON.stringify(i))}},this.getOriginalSource=e=>{const{minipInstance:t}=this.growingIO;return x((()=>JSON.parse(t.getStorageSync(this.getStorageKey(e,"originalSource")))))},this.getTrackerVds=e=>this.growingIO.trackingId===e?Object.assign({},this.growingIO.vdsConfig):void 0,this.initTrackerOptions=e=>{const t=this.initOptions(e);return t.trackingId=e.trackingId,this.growingIO.trackingId=e.trackingId,this.growingIO.vdsConfig=t,t},this.initTrackerHooker=e=>{var t,i;const{platformConfig:s,inPlugin:n,minipInstance:r,plugins:o}=this.growingIO,{uniVue:a,taro:g}=e;a||g||(s.canHook=!0),n&&!["tbp","jdp"].includes(r.platform)||this.eventHooks.initEventHooks(),a&&(null===(t=null==o?void 0:o.gioUniAppAdapter)||void 0===t||t.main()),g&&(null===(i=null==o?void 0:o.gioTaroAdapter)||void 0===i||i.main())},this.initOptions=e=>{var t,i,s,n,r,o;const{projectId:a,dataSourceId:l,appId:u,trackingId:c}=e,d={};return this.ALLOW_SETTING_KEYS.forEach((t=>{const i=X[t].type;(g(i)?i.includes(T(e[t])):T(e[t])===X[t].type)?"ignoreFields"===t?d.ignoreFields=e.ignoreFields.filter((e=>ne.includes(e))):"extraParams"===t?d.extraParams=e.extraParams.filter((e=>re.includes(e))):(d[t]=e[t],["dataCollect","autotrack"].includes(t)&&!d[t]&&C("已关闭"+ie[t],"info")):d[t]=X[t].default})),d.uploadInterval=Math.round(d.uploadInterval),(Number.isNaN(d.uploadInterval)||0>d.uploadInterval||d.uploadInterval>3e3)&&(d.uploadInterval=1e3),d.enableIdMapping&&!d.idMapping&&(d.idMapping=!0,d.idMapping||this.growingIO.userStore.setUserKey(c,"")),k(d,"enableIdMapping"),d.pluginMode&&(this.growingIO.inPlugin=!0),!isNaN(Number(d.requestTimeout))&&d.requestTimeout>0||(d.requestTimeout=5e3),Object.assign(Object.assign({},d),{projectId:a,dataSourceId:l,appId:u,trackingId:c,performance:{monitor:null===(i=null===(t=d.performance)||void 0===t?void 0:t.monitor)||void 0===i||i,exception:null===(n=null===(s=d.performance)||void 0===s?void 0:s.exception)||void 0===n||n,network:null!==(o=null===(r=d.performance)||void 0===r?void 0:r.network)&&void 0!==o&&o}})},this.setOption=(e,t,i)=>{var n;const{userStore:r,emitter:o}=this.growingIO,a=this.getTrackerVds(e),g=s(t)&&this.ALLOW_SETTING_KEYS.includes(t),l=g&&typeof i===(null===(n=X[t])||void 0===n?void 0:n.type);if(g&&l){const s=Object.assign({},a);if(this.updateVdsConfig(e,Object.assign(Object.assign({},a),{[t]:i})),"dataCollect"===t&&s.dataCollect!==i&&i){r.setSessionId(e);const{path:t,query:i,settedTitle:s}=this.eventHooks.currentPage;this.eventHooks.currentPage.title=s[t]||this.growingIO.minipInstance.getPageTitle(this.growingIO.minipInstance.getCurrentPage()),this.sendVisit(e,{path:t,query:i}),this.eventHooks.currentPage.time=Date.now(),this.sendPage(e,{path:t,query:i})}return o.emit(ve,{optionName:t,optionValue:i}),!0}return j("setOption > "+t),!1},this.getOption=(e,t)=>{const i=this.getTrackerVds(e);return t&&y(this.growingIO.vdsConfig,t)?y(i,t)?i[t]:this.growingIO.vdsConfig[t]:P(t)?i:void j("getOption > "+t)},this.updateVdsConfig=(e,t)=>{e===this.growingIO.trackingId?(this.growingIO.vdsConfig=Object.assign(Object.assign({},this.growingIO.vdsConfig),t),G().vdsConfig=this.growingIO.vdsConfig):(this.growingIO.subInstance[e]=Object.assign(Object.assign({},this.growingIO.subInstance[e]),t),G().vdsConfig.subInstance[e]=this.growingIO.subInstance[e])},this.toggleShareOut=e=>{r(e)?this.shareOut=e:this.shareOut=!this.shareOut},this.sendVisit=(e,t)=>{this.eventHooks.appEffects.buildVisitEvent(e,null!=t?t:this.lastVisitEvent)},this.sendPage=(e,t)=>{this.eventHooks.pageEffects.buildPageEvent(e,t)},this.eventConverter=e=>{const{dataStore:t,uploader:i}=this.growingIO,{dataCollect:s}=this.getTrackerVds(e.trackingId);if(s){["LOGIN_USER_ATTRIBUTES","APP_CLOSED"].includes(e.eventType)||(e.eventSequenceId=t.getGsid(e.trackingId),t.setGsid(e.trackingId,e.eventSequenceId+1));const s={};S(e,((e,t)=>{var i;if("element"===t){const t=null!==(i=l(e))&&void 0!==i?i:{};S(t,((e,t)=>{P(e)&&0!==e||(s[t]=e)}))}else P(e)&&0!==e||(s[t]=e)})),this.growingIO.emitter.emit(le,{composedEvent:s}),i.commitRequest(Object.assign(Object.assign({},s),{requestId:$()}))}},this.eventInterceptor=e=>{const{systemInfo:t,network:i}=this.growingIO.minipInstance;P(t)||P(i)?this.interceptEvents.push(e):P(this.interceptEvents)?this.eventConverter(e):([...this.interceptEvents,e].forEach((t=>{const i=Object.assign(Object.assign({},t),this.eventContextBuilder(e.trackingId,{path:t.path,query:t.query,timestamp:t.timestamp}));this.eventConverter(i)})),this.interceptEvents=[])},this.eventReleaseInspector=()=>{const{minipInstance:{systemInfo:e,network:t}}=this.growingIO;e&&t&&!P(this.interceptEvents)&&([...this.interceptEvents].forEach((e=>{const t=Object.assign(Object.assign({},e),this.eventContextBuilder(e.trackingId,{path:e.path,query:e.query,timestamp:e.timestamp}));this.eventConverter(t)})),this.interceptEvents=[])},this.buildAppMessageEvent=(e,t)=>{var i;const s=t[0];let n;2>t.length?1===t.length&&(n=s):n=t[1];const{dataStore:{eventContextBuilder:r,eventInterceptor:o}}=this.growingIO,a=((null==n?void 0:n.path)||"").split("?");o(Object.assign({eventType:"CUSTOM",eventName:"$mp_on_share",attributes:Object.assign({$from:s.from,$target:null===(i=null==s?void 0:s.target)||void 0===i?void 0:i.id,$share_title:null==n?void 0:n.title,$share_path:l(a),$share_query:a[1]},null==n?void 0:n.attributes)},r(e)))},this.buildTimelineEvent=(e,t)=>{var i;const s=t[0];let n;2>t.length?1===t.length&&(n=s):n=t[1];const{dataStore:{eventContextBuilder:r,eventInterceptor:o}}=this.growingIO,a=((null==n?void 0:n.path)||"").split("?");o(Object.assign({eventType:"CUSTOM",eventName:"$mp_share_timeline",attributes:Object.assign({$target:null===(i=null==s?void 0:s.target)||void 0===i?void 0:i.id,$share_title:null==n?void 0:n.title,$share_path:l(a),$share_query:a[1]},null==n?void 0:n.attributes)},r(e)))},this.buildAddFavorites=(e,t)=>{const i=t[0];let s;2>t.length?1===t.length&&(s=i):s=t[1];const{dataStore:{eventContextBuilder:n,eventInterceptor:r}}=this.growingIO,o=((null==s?void 0:s.path)||"").split("?");r(Object.assign({eventType:"CUSTOM",eventName:"$mp_add_favorites",attributes:{$share_title:null==s?void 0:s.title,$share_path:l(o),$share_query:o[1]}},n(e)))},this.trackersExecute=e=>{this.initializedTrackingIds.forEach((t=>{"function"===T(e)&&e(t)}))},this.initializedTrackingIds=[],this.eventContextBuilder=new Ie(this.growingIO).main,this.eventHooks=new be(this.growingIO),this.shareOut=!1,this._gsid={},this._stid={},this.lastVisitEvent={},this.lastPageEvent={},this.locationData={},this.generalProps={},this.trackTimers={},this.interceptEvents=[];const{emitter:o,minipInstance:u}=this.growingIO;o.on(fe,(({trackingId:e})=>{this.initializedTrackingIds.push(e),this.initStorageInfo(e)})),o.on(ge,(({eventData:e,trackingId:t})=>{"VISIT"===e.eventType&&(this.lastVisitEvent=e),"PAGE"===e.eventType&&(this.lastPageEvent[t]=e)})),a(null===(t=u.minip)||void 0===t?void 0:t.onAppHide)&&u.minip.onAppHide((()=>{this.trackersExecute((e=>{const t=this.trackTimers[e];S(t,(e=>{e.start&&(e.leng=e.leng+(+Date.now()-e.start))}))}))})),a(null===(n=u.minip)||void 0===n?void 0:n.onAppShow)&&u.minip.onAppShow((()=>{this.trackersExecute((e=>{const t=this.trackTimers[e];S(t,(e=>{e.start&&(e.start=+Date.now())}))}))})),o.on(ve,(({optionName:e,optionValue:t})=>{"dataCollect"===e&&!1===t&&this.trackersExecute((e=>{this.growingIO.clearTrackTimer(e)}))}))}get scene(){return this._scene}set scene(e){const t=this._scene;this._scene=e,t!==this._scene&&this.growingIO.emitter.emit("SCENE_UPDATE",{newScene:e,oldScene:t})}}const _e={scnPrefix:"",appHandlers:["onLaunch","onShow","onHide","onError","onPageNotFound","onUnhandledRejection","onThemeChange"],pageHandlers:["onLoad","onShow","onReady","onHide","onShareAppMessage","onTabItemTap","onUnload","onPullDownRefresh","onReachBottom","onResize"],actionEventTypes:["onclick","tap","onTap","longpress","longTap","blur","change","onChange","submit","confirm","getuserinfo","getphonenumber","contact","mouseup"],canHook:!0,hooks:{App:!0,Page:!0,Component:!0,Behavior:!0},listeners:{app:{appLaunch:"onLaunch",appShow:"onShow",appClose:"onHide"},page:{pageLoad:"onLoad",pageShow:"onShow",pageReady:"onReady",pageHide:"onHide",pageUnload:"onUnload",tabTap:"onTabItemTap",shareApp:"onShareAppMessage"},actions:{click:["onclick","tap","longpress","longTap","getuserinfo","getphonenumber","contact","mouseup"],change:["blur","change","confirm"],submit:["submit"]}}},Pe=Object.assign(Object.assign({},_e),{listeners:Object.assign({},_e.listeners),name:"JingDong",platform:"jdp",scnPrefix:"jd_"}),Te=Object.assign(Object.assign({},_e),{listeners:Object.assign({},_e.listeners),name:"KuaiShou",platform:"kuaishoup",scnPrefix:"ks_"}),Ee=Object.assign(Object.assign({},_e),{listeners:Object.assign({},_e.listeners),name:"Alipay",platform:"alip",scnPrefix:"alip_",hooks:Object.assign(Object.assign({},_e.hooks),{Behavior:!1})}),Ce=Object.assign(Object.assign({},_e),{pageHandlers:[..._e.pageHandlers,"onInit","didMount","didUnmount"],listeners:Object.assign(Object.assign({},_e.listeners),{page:Object.assign(Object.assign({},_e.listeners.page),{onInit:"onInit",didMount:"didMount",didUnmount:"didUnmount"})}),name:"Taobao",platform:"tbp",scnPrefix:"tbp_",hooks:Object.assign(Object.assign({},_e.hooks),{Behavior:!1})}),je=Object.assign(Object.assign({},_e),{listeners:Object.assign({},_e.listeners),name:"QQ",platform:"qq",scnPrefix:"qq_"});je.pageHandlers=[..._e.pageHandlers,"onAddToFavorites"],je.listeners.page.addFavorites="onAddToFavorites";const xe=Object.assign(Object.assign({},_e),{listeners:Object.assign({},_e.listeners),name:"Baidu",platform:"baidup",scnPrefix:"baidup_"}),Ae=Object.assign(Object.assign({},_e),{listeners:Object.assign({},_e.listeners),name:"Bytedance",platform:"bytedance",scnPrefix:"bytedance_"}),qe=Object.assign(Object.assign({},_e),{listeners:Object.assign({},_e.listeners),name:"Weixin",platform:"MinP"});qe.pageHandlers=[..._e.pageHandlers,"onShareTimeline","onAddToFavorites"],qe.listeners.page=Object.assign(Object.assign({},_e.listeners.page),{shareTime:"onShareTimeline",addFavorites:"onAddToFavorites"});const Ne=B(),Ue=x((()=>{const e={jd:Pe,ks:Te,my:Ee,tb:Ce,qq:je,swan:xe,tt:Ae,wx:qe}[Ne];return e.canHook=!1,e}));class $e{constructor(e){this.growingIO=e,this.minip=F("framework"),this.hookSetTitle=()=>{var e;const t=null===(e=this.minip)||void 0===e?void 0:e.setNavigationBarTitle,i=this;t&&Object.defineProperty(this.minip,"setNavigationBarTitle",{writable:!0,enumerable:!0,configurable:!0,value:function(){if(i.growingIO.gioSDKInitialized){const e=i.getCurrentPath(),{title:t}=arguments[0]||{};i.growingIO.dataStore.eventHooks.currentPage.settedTitle[e]=t}return t.apply(this,arguments)}})},this.navigateTo=e=>{var t;return null===(t=this.minip)||void 0===t?void 0:t.navigateTo(e)},this.switchTab=e=>{var t;null===(t=this.minip)||void 0===t||t.switchTab(e)},this.navigateToMiniProgram=e=>{var t;return null===(t=this.minip)||void 0===t?void 0:t.navigateToMiniProgram(e)},this.getImageInfo=({src:e,success:t,fail:i,complete:s})=>{var n;return null===(n=this.minip)||void 0===n?void 0:n.getImageInfo({src:e,success:t,fail:i,complete:s})},this.initImpression=e=>{var t,i;null===(i=null===(t=this.growingIO.plugins)||void 0===t?void 0:t.gioImpressionTracking)||void 0===i||i.main(e,"observeAll")},this.getCurrentPage=()=>x((()=>u(getCurrentPages())))||{},this.getCurrentPath=()=>{const e=this.getCurrentPage();return(null==e?void 0:e.route)||(null==e?void 0:e.uri)||(null==e?void 0:e.__route__)||""},this.getPageTitle=e=>{var t,i;let n="";const r=R(B());try{const o=(null==e?void 0:e.data)||e.$data||{};if(n=s(null==o?void 0:o.gioPageTitle)?null==o?void 0:o.gioPageTitle:"",0===n.length){const t=r.page[e.route]||r.page[e.route+".html"];n=t?t.window.navigationBarTitleText:r.global.window.navigationBarTitleText}if(0===n.length){const s=null===(i=null===(t=null==r?void 0:r.tabBar)||void 0===t?void 0:t.list)||void 0===i?void 0:i.find((t=>t.pagePath===e.route||t.pagePath===e.route+".html"));n=(null==s?void 0:s.text)||""}}catch(e){return""}return q(n)},this.getStorageSync=e=>{var t;let i=null===(t=this.minip)||void 0===t?void 0:t.getStorageSync(e);return o(i)&&i.expiredAt?i.expiredAt<Date.now()?"":i.value:i},this.getStorage=e=>new Promise((t=>{var i;null===(i=this.minip)||void 0===i||i.getStorage({key:e,success:({data:e})=>t(e),fail:()=>t("")})})),this.setStorageSync=(e,t,i)=>{var s;i&&(t={value:t,expiredAt:i}),null===(s=this.minip)||void 0===s||s.setStorageSync(e,t)},this.setStorage=(e,t)=>{var i;null===(i=this.minip)||void 0===i||i.setStorage({key:e,data:t})},this.removeStorageSync=e=>{var t;null===(t=this.minip)||void 0===t||t.removeStorageSync(e)},this.removeStorage=e=>{var t;null===(t=this.minip)||void 0===t||t.removeStorage(e)},this.getNetworkType=()=>{const e=this;return new Promise((t=>{var i;null===(i=this.minip)||void 0===i||i.getNetworkType({success:i=>{e.network=i,t(i)},fail:()=>t(null)})}))},this.request=({url:e,data:t,header:i,timeout:s,method:n,success:r,fail:o,complete:g})=>{var l;const u=null===(l=this.minip)||void 0===l?void 0:l.request({url:e,data:t,header:i,headers:i,timeout:s,method:n,success:r,fail:o,complete:g});let c=setTimeout((()=>{(null==u?void 0:u.abort)&&a(null==u?void 0:u.abort)&&(null==u||u.abort()),clearTimeout(c),c=null}),(s||1e4)+10);return u},this.getSystemInfo=()=>{const e=this;return new Promise((t=>{var i;null===(i=this.minip)||void 0===i||i.getSystemInfo({success:i=>{e.systemInfo=i,t(i)},fail:()=>t(null)})}))},this.getSetting=()=>new Promise((e=>{var t;null===(t=this.minip)||void 0===t||t.getSetting({success:e,fail:e})}));const{platformConfig:{platform:t,scnPrefix:i}}=this.growingIO;this.platform=t,this.scnPrefix=i,this.growingIO.emitter.on(me,(()=>{this.getNetworkType().then((()=>{var e;return null===(e=this.growingIO.dataStore)||void 0===e?void 0:e.eventReleaseInspector()})),this.getSystemInfo().then((()=>{var e;return null===(e=this.growingIO.dataStore)||void 0===e?void 0:e.eventReleaseInspector()}))}))}}const He=B();var Ke={wx:class extends $e{constructor(e){super(e),this.growingIO=e,this.hookSetTitle()}},swan:class extends $e{constructor(e){super(e),this.growingIO=e,this.initImpression=e=>{var t,i;null===(i=null===(t=this.growingIO.plugins)||void 0===t?void 0:t.gioImpressionTracking)||void 0===i||i.main(e,"selectAll")},this.hookSetTitle()}},my:class extends $e{constructor(e){super(e),this.growingIO=e,this.hookSetTitle=()=>{var e;const t=null===(e=this.minip)||void 0===e?void 0:e.setNavigationBar,i=this;t&&Object.defineProperty(this.minip,"setNavigationBar",{writable:!0,enumerable:!0,configurable:!0,value:function(){if(i.growingIO.gioSDKInitialized){const e=i.getCurrentPath(),{title:t}=arguments[0]||{};i.growingIO.dataStore.eventHooks.currentPage.settedTitle[e]=t}return t.apply(this,arguments)}})},this.initImpression=e=>{var t,i;null===(i=null===(t=this.growingIO.plugins)||void 0===t?void 0:t.gioImpressionTracking)||void 0===i||i.main(e,"selectAll")},this.getStorageSync=e=>{const{data:t}=my.getStorageSync({key:e});return t},this.setStorageSync=(e,t)=>{var i;null===(i=this.minip)||void 0===i||i.setStorageSync({key:e,data:t})},this.hookSetTitle()}},qq:class extends $e{constructor(e){super(e),this.growingIO=e,this.hookSetTitle()}},tt:class extends $e{constructor(e){super(e),this.growingIO=e,this.hookSetTitle()}},ks:class extends $e{constructor(e){super(e),this.growingIO=e,this.hookSetTitle()}},jd:class extends $e{constructor(e){super(e),this.growingIO=e,this.hookSetTitle()}}}[He];const De=["gioPerformance"];class Ve{constructor(e){var t,i,s,n,r,o;this.growingIO=e,this.innerPluginInit=()=>{var e;De.forEach((e=>{var t;return k(null===(t=this.pluginsContext)||void 0===t?void 0:t.plugins,e)})),O(null===(e=this.pluginsContext)||void 0===e?void 0:e.plugins).forEach((e=>{var t,i;const{name:s,method:n}=null!==(i=null===(t=this.pluginsContext)||void 0===t?void 0:t.plugins[e])&&void 0!==i?i:{};h(this.pluginItems,(e=>e.name===s))||this.pluginItems.push({name:m(s||e),method:n||(e=>{})})})),P(this.pluginItems)||this.installAll()},this.install=(e,t,i)=>{var s,n;const{emitter:r}=this.growingIO,o=t||h(this.pluginItems,(t=>t.name===e));if((null===(s=this.growingIO)||void 0===s?void 0:s.plugins)[e])return C(`重复加载插件 ${e} 或插件重名,已跳过加载!`,"warn"),!1;if(!o)return C(`插件加载失败!不存在名为 ${e} 的插件!`,"error"),!1;try{return(null===(n=this.growingIO)||void 0===n?void 0:n.plugins)[e]=new o.method(this.growingIO,i),t&&(r.emit(de,e),C("加载插件 "+e,"info")),!0}catch(i){return this.lifeError(t,i),C(`插件【${e}】加载异常 ${i}`,"error"),!1}},this.installAll=e=>{(e||this.pluginItems).forEach((t=>{this.install(t.name,e?t:void 0,e?null==t?void 0:t.options:void 0)&&!h(this.pluginItems,(e=>e.name===t.name))&&this.pluginItems.push({name:m(t.name),method:t.method?t.method:()=>{}})}))},this.uninstall=e=>{var t;k(this.pluginItems,e);const i=k(null===(t=this.growingIO)||void 0===t?void 0:t.plugins,e);return i||C(`卸载插件 ${e} 失败!`,"error"),i},this.uninstallAll=()=>{this.pluginItems.forEach((e=>this.uninstall(e.name)))},this.lifeError=(e,t)=>{this.growingIO.emitter.emit(ce,{plugin:e,error:t}),C(`插件执行错误 ${e.name} ${t}`,"error")},this.callLifeCycle=(e,t)=>{this.pluginItems.forEach((i=>{const s=this.growingIO.plugins[i.name]?this.growingIO.plugins[i.name][e]:void 0;if(s&&a(s))try{s(t)}catch(e){this.lifeError(i,e)}}))},this.pluginsContext={plugins:{}},this.pluginItems=[],null===(t=this.growingIO.emitter)||void 0===t||t.on(de,(e=>this.callLifeCycle("onInstall",e))),null===(i=this.growingIO.emitter)||void 0===i||i.on(ce,(e=>this.callLifeCycle("onError",e))),null===(s=this.growingIO.emitter)||void 0===s||s.on(ue,(e=>this.callLifeCycle("onComposeBefore",e))),null===(n=this.growingIO.emitter)||void 0===n||n.on(le,(e=>this.callLifeCycle("onComposeAfter",e))),null===(r=this.growingIO.emitter)||void 0===r||r.on(pe,(e=>this.callLifeCycle("onSendBefore",e))),null===(o=this.growingIO.emitter)||void 0===o||o.on(he,(e=>this.callLifeCycle("onSendAfter",e)))}}let Le;var Fe={name:"gioUniAppAdapter",method:class{constructor(t){var i,s;this.growingIO=t,this.main=()=>{var e,t;switch(this.uniVue||(this.uniVue=null===(t=null===(e=this.growingIO)||void 0===e?void 0:e.vdsConfig)||void 0===t?void 0:t.uniVue),console.log("Vue version: ",this.uniVue.version),Number(Le.head(Le.split(this.uniVue.version,".")))){case 2:this.uniVue2Proxy(this.uniVue);break;case 3:this.uniVue3Proxy(this.uniVue);break;default:Le.consoleText("不支持的Vue版本,请使用 Vue2 或 Vue3!","error")}},this.getHandlerName=(e,t)=>{var i;if("__e"===e){let e="__e";const{type:i,currentTarget:s,target:n}=t,r=(null==s?void 0:s.dataset)||(null==n?void 0:n.dataset);if(r){const t=r.eventOpts||r["event-opts"],s=(e,t)=>e===t||"regionchange"===t&&("begin"===e||"end"===e);t&&t.forEach((t=>{let n=Le.head(t);const r="^"===n.charAt(0);n=r?n.slice(1):i;const o="~"===n.charAt(0);n=o?n.slice(1):i;const a=Le.last(t);s(i,n)&&(e=Le.head(Le.head(a)))}))}return e}return Le.isEmpty(this.exposedNames)?e:null!==(i=this.exposedNames[e])&&void 0!==i?i:e},this.uniVue2Proxy=e=>{const{dataStore:{eventHooks:t},minipInstance:i}=this.growingIO;t.nativeGrowing(["App","Component","Behavior"]),e.mixin({beforeMount(){if("page"===this.mpType){t.pageOverriding(this.$scope);const e=this,s=i.getPageTitle;i.getPageTitle=function(...i){var n,r,o;return(e.$scope.route===t.currentPage.path?null===(o=null===(r=null===(n=e.$scope)||void 0===n?void 0:n.$vm)||void 0===r?void 0:r._data)||void 0===o?void 0:o.gioPageTitle:void 0)||s.apply(this,i)}}}})},this.uniVue3Proxy=t=>{const{dataStore:{eventHooks:i},minipInstance:s}=this.growingIO;i.objectTraverse=(e,t)=>{Le.has(e,"methods")&&Object.getOwnPropertyNames(e.methods).forEach((i=>{t(i,e.methods)})),Le.has(e,"lifetimes")&&Object.getOwnPropertyNames(e.lifetimes).forEach((i=>{t(i,e.lifetimes)})),Le.has(e,"pageLifetimes")&&Object.getOwnPropertyNames(e.pageLifetimes).forEach((i=>{t(i,e.pageLifetimes)})),Object.getOwnPropertyNames(e).forEach((i=>{Le.niceTry((()=>!(null==e?void 0:e.methods[i])&&!(null==e?void 0:e.lifetimes[i])&&!(null==e?void 0:e.pageLifetimes[i])))||t(i,e)}))},i.nativeGrowing();const n=s.getPageTitle;s.getPageTitle=function(...e){var t,i,r;let o=Le.isEmpty(e[0])?s.getCurrentPage():e[0];if("page"===(null===(t=null==o?void 0:o.$vm)||void 0===t?void 0:t.mpType)&&(null===(i=null==o?void 0:o.$vm)||void 0===i?void 0:i.__route__)){return(null===(r=null==o?void 0:o.$vm)||void 0===r?void 0:r.gioPageTitle)||n.apply(this,e)}return n.apply(this,e)};const r=this;t.mixin({beforeMount(){var t,s;const n=(e,t)=>Le.isFunction(t)&&!i.pageHandlers.includes(e)?function(...s){return i.customFcEffects(e,t).apply(this,s)}:t,o=(e,t)=>Le.keys(e).forEach((e=>{Le.isFunction(t[e])&&Object.defineProperty(t,e,{value:n(e,t[e]),configurable:!0,writable:!0})})),a=this.$options.methods;a&&o(a,this);const g=null===(t=null==this?void 0:this._)||void 0===t?void 0:t.setupState;g&&o(g,g);const l=null===(s=null==this?void 0:this._)||void 0===s?void 0:s.exposed;if(r.exposedNames={},l){const t=Le.keys(l);t.forEach((e=>{Le.isFunction(l[e])&&(r.exposedNames[l[e].name]=e)})),Le.keys(this.$scope).filter((t=>e.test(t)&&Le.isFunction(this.$scope[t]))).forEach(((e,s)=>{const n=this.$scope[e].value,o=r.splicingMethodName(n.name,e,t[s]);this.$scope[e].value=i.customFcEffects(o,n)}))}const u=this._.emit;this._.emit=function(...e){return(()=>{i.customFcEffects(e[0],(()=>{})).apply(this,e)})(),u.apply(this,e)}}})},this.splicingMethodName=(e,t,i)=>e||(i?`${t}#${i}`:t),Le=this.growingIO.utils,this.uniVue=null===(s=null===(i=this.growingIO)||void 0===i?void 0:i.vdsConfig)||void 0===s?void 0:s.uniVue,this.exposedNames={}}}};class Re extends Ve{constructor(e){super(e),this.growingIO=e,this.pluginsContext={plugins:{gioUniAppAdapter:Fe}}}}var Be={},Ge={}.hasOwnProperty;function Me(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(e){return null}}function Qe(e){try{return encodeURIComponent(e)}catch(e){return null}}Be.stringify=function(e,t){t=t||"";var i,s,n=[];for(s in"string"!=typeof t&&(t="?"),e)if(Ge.call(e,s)){if((i=e[s])||null!=i&&!isNaN(i)||(i=""),s=Qe(s),i=Qe(i),null===s||null===i)continue;n.push(s+"="+i)}return n.length?t+n.join("&"):""},Be.parse=function(e){for(var t,i=/([^=?#&]+)=?([^&]*)/g,s={};t=i.exec(e);){var n=Me(t[1]),r=Me(t[2]);null===n||null===r||n in s||(s[n]=r)}return s};class ze{constructor(e){this.growingIO=e,this.generateURL=e=>{const{serverUrl:t,projectId:i}=this.growingIO.dataStore.getTrackerVds(e);return f(t,"http")?`${t}/v3/projects/${i}/collect`:`https://${t}/v3/projects/${i}/collect`},this.getHoardingQueue=e=>{var t;return null!==(t=this.hoardingQueue[e])&&void 0!==t?t:[]},this.getRequestQueue=e=>{var t;return null!==(t=this.requestQueue[e])&&void 0!==t?t:[]},this.commitRequest=e=>{var t,s;const n=Object.assign({},e),{vdsConfig:r,emitter:o}=this.growingIO;o.emit(ge,{eventData:e,trackingId:e.trackingId}),r.forceLogin?(i(this.hoardingQueue[e.trackingId])&&(this.hoardingQueue[e.trackingId]=[]),null===(t=this.hoardingQueue[e.trackingId])||void 0===t||t.push(n)):(i(this.requestQueue[e.trackingId])&&(this.requestQueue[e.trackingId]=[]),null===(s=this.requestQueue[e.trackingId])||void 0===s||s.push(n),this.initiateRequest(e.trackingId))},this.initiateRequest=(e,t)=>{const{plugins:i,vdsConfig:s,minipInstance:n,dataStore:r}=this.growingIO,o=[...this.getHoardingQueue(e),...this.getRequestQueue(e)],a=e=>{var a,g;if(null===(a=null==s?void 0:s.tbConfig)||void 0===a?void 0:a.cloudFuncSend)null===(g=null==i?void 0:i.gioTaobaoAdapter)||void 0===g||g.singleInvoke(e);else if(t)this.batchInvoke(e);else{const{uploadInterval:t}=this.growingIO.dataStore.getTrackerVds(e);_(this.batchInvoke,t,!1,!1)(e)}o.some((e=>"VISIT"===e.eventType))&&n.removeStorageSync(r.getStorageKey(e,"originalSource"))};if(o.length>0)if(this.requestingNum<this.requestLimit)a(e);else{let t=setInterval((()=>{this.requestingNum<this.requestLimit&&(a(e),clearInterval(t),t=void 0)}),500)}},this.batchInvoke=e=>{const{vdsConfig:t,emitter:i}=this.growingIO,s=this.getHoardingQueue(e),n=this.getRequestQueue(e);let r=[...s,...n];r.length>50?(r=r.slice(0,50),s.length>50?this.hoardingQueue[e]=s.slice(50):(this.requestQueue[e]=n.slice(50-s.length),this.hoardingQueue[e]=[])):(this.hoardingQueue[e]=[],this.requestQueue[e]=[]);let o=r.filter((e=>(this.retryIds[e.requestId]||0)<=this.retryLimit));if(P(o))return;const a=o.map((e=>{const t=Object.assign({},e);return k(t,["requestId","trackingId"]),t}));t.debug&&console.log("[GrowingIO Debug]:",JSON.stringify(a,null,2)),i.emit(pe,{eventsQueue:o,requestData:a,trackingId:e})},this.sendEvent=(e,t)=>{var i;const s=l(e).trackingId,{minipInstance:n,dataStore:r,emitter:o,plugins:a}=this.growingIO,{compress:g,requestTimeout:u}=r.getTrackerVds(s);this.requestingNum+=1;const c={"content-type":"jdp"===n.platform?"application/json":"application/json;charset=UTF-8"};let d=[...t];const h=!!g&&(null===(i=null==a?void 0:a.gioCompress)||void 0===i?void 0:i.compressToUTF16);h&&(d=a.gioCompress.compressToUTF16(JSON.stringify(t)),c["X-Compress-Codec"]="1");const p=this.generateURL(s);n.request({url:`${p}?stm=${Date.now()}&compress=${h?"1":"0"}`,header:c,method:"POST",data:d,timeout:u,fail:t=>{[200,204].includes(t.code)||(e.forEach((e=>{this.requestFailFn(e)})),C("请求失败!"+JSON.stringify(t),"error"))},complete:e=>{this.requestingNum-=1,o.emit(he,{result:e,requestData:t}),this.initiateRequest(s)}})},this.requestFailFn=e=>{if(this.retryIds[e.requestId]||(this.retryIds[e.requestId]=0),this.retryIds[e.requestId]+=1,!this.requestQueue[e.trackingId].some((t=>t.requestId===e.requestId))){let t=setTimeout((()=>{P(this.requestQueue[e.trackingId])?(this.requestQueue[e.trackingId].push(e),this.initiateRequest(e.trackingId)):this.requestQueue[e.trackingId].push(e),clearTimeout(t),t=null}),800)}},this.hoardingQueue={},this.requestQueue={},this.requestLimit=3,this.retryLimit=2,this.retryIds={},this.requestingNum=0;const{emitter:t,vdsConfig:s,plugins:n}=this.growingIO;t.on(pe,(({eventsQueue:e,requestData:t,trackingId:i})=>{var r,o;i===this.growingIO.trackingId&&((null===(r=null==s?void 0:s.tbConfig)||void 0===r?void 0:r.cloudAppId)?null===(o=null==n?void 0:n.gioTaobaoAdapter)||void 0===o||o.tbCloudAppInvoke(e,t):this.sendEvent(e,t))}))}}class We{constructor(e){this.growingIO=e,this._getUidKey=()=>this.growingIO.inPlugin?"_growing_plugin_uid_":"_growing_uid_",this.getUid=()=>{const{minipInstance:e}=this.growingIO;return this._uid||(this._uid=e.getStorageSync(this._getUidKey())),this._uid||(this._uid=$(),e.setStorage(this._getUidKey(),this._uid)),this._uid},this.setUid=e=>{const t=this._uid;this._uid=e,t!==this._uid&&(this.growingIO.minipInstance.setStorage(this._getUidKey(),this._uid),this.growingIO.emitter.emit("UID_UPDATE",{newUId:e,oldUId:t}))},this.getSessionId=e=>(this._sessionId[e]||this.setSessionId(e),this._sessionId[e]),this.setSessionId=(e,t)=>{const i=this._sessionId[e];t||(t=$()),this._sessionId[e]=t,i!==t&&this.growingIO.emitter.emit("SESSIONID_UPDATE",{newSessionId:t,oldSessionId:i})},this._getUserIdKey=e=>this.growingIO.dataStore.getStorageKey(e,"userId"),this.getUserId=e=>{const{minipInstance:t}=this.growingIO;return this._userId[e]||(this._userId[e]=t.getStorageSync(this._getUserIdKey(e))),this._userId[e]},this.setUserId=(e,t)=>{const s=this._userId[e];this._userId[e]=i(t)?"":t,s!==this._userId[e]&&(this.growingIO.minipInstance.setStorage(this._getUserIdKey(e),this._userId[e]),this.growingIO.emitter.emit("USERID_UPDATE",{newUserId:t,oldUserId:s})),t&&this.setGioId(e,t)},this._getUserKeyKey=e=>this.growingIO.dataStore.getStorageKey(e,"userKey"),this.getUserKey=e=>{const{minipInstance:t}=this.growingIO;return this._userKey[e]||(this._userKey[e]=t.getStorageSync(this._getUserKeyKey(e))),this._userKey[e]},this.setUserKey=(e,t)=>{const s=this._userKey[e];this._userKey[e]=i(t)?"":t,s!==this._userKey[e]&&(this.growingIO.minipInstance.setStorage(this._getUserKeyKey(e),this._userKey[e]),this.growingIO.emitter.emit("USERKEY_UPDATE",{newUserKey:t,oldUserKey:s}))},this._getGioIdKey=e=>this.growingIO.dataStore.getStorageKey(e,"gioId"),this.getGioId=e=>{const{minipInstance:t}=this.growingIO;return this._gioId[e]||(this._gioId[e]=t.getStorageSync(this._getGioIdKey(e))),this._gioId[e]},this.setGioId=(e,t)=>{const s=this._gioId[e];this._gioId[e]=i(t)?"":t,s!==this._gioId[e]&&(this.growingIO.minipInstance.setStorage(this._getGioIdKey(e),this._gioId[e]),this.growingIO.emitter.emit("GIOID_UPDATE",{newGioId:t,oldGioId:s}))},this.initUserInfo=e=>{var t;const{minipInstance:i}=this.growingIO,s=[this._getUidKey(),this._getUserIdKey(e),this._getUserKeyKey(e),this._getGioIdKey(e)],n=null!==(t=Q(i,s))&&void 0!==t?t:[];["_uid","_userId","_userKey","_gioId"].forEach(((t,i)=>{"_uid"===t?this.getUid():this[t][e]=n[i]}))},this.saveUserInfo=()=>{const{minipInstance:e,dataStore:{trackersExecute:t}}=this.growingIO;t((t=>{z(e,[{key:this._getUidKey(),value:this._uid},{key:this._getUserIdKey(t),value:this._userId[t]},{key:this._getUserKeyKey(t),value:this._userKey[t]},{key:this._getGioIdKey(t),value:this._gioId[t]}])}))},this._uid=void 0,this._sessionId={},this._userId={},this._userKey={},this._gioId={}}}const Je=new class{constructor(){var e;this.init=e=>{var t;this.emitter.emit("ON_SDK_INITIALIZE_BEFORE",{options:e});try{if(C("Gio小程序SDK 初始化中...","info"),e.trackingId&&this.dataStore.initializedTrackingIds.includes(e.trackingId))throw Error(`已存在实例 ${e.trackingId},请勿重复初始化!`);if(this.trackingId&&!this.plugins.gioMultipleInstances)throw Error("您正在尝试初始化另一个实例,请集成多实例插件后重试!");const i=this.dataStore.initTrackerOptions(e);return null===(t=this.emitter)||void 0===t||t.emit(me,i),this.gioSDKInitialized=!0,this.dataStore.initTrackerHooker(i),"quickapp"!==this.gioPlatform&&this.userStore.initUserInfo(e.trackingId),this.emitter.emit(fe,i),this.trackingId&&this.trackingId!==e.trackingId||(G().__gio__=()=>this),C("Gio小程序SDK 初始化完成!","success"),this.inPlugin&&"tbp"!==this.minipInstance.platform&&this.dataStore.sendVisit(i.trackingId),this.vdsConfig.forceLogin&&C("forceLogin已开启,请调用 identify 方法设置 openId 以继续上报!","info"),!0}catch(e){return C(e,"error"),!1}},this.handlerDistribute=(e,t,i)=>{const{initializedTrackingIds:s,getTrackerVds:n}=this.dataStore;if(n(e)&&s.includes(e))return this[t](e,...i);C(`不存在实例:${e},请检查!`,"warn")},this.registerPlugins=e=>{this.plugins.pluginItems=[...this.plugins.pluginItems,...e],this.plugins.installAll(e)},this.getPlugins=()=>this.plugins.pluginItems,this.getDeviceId=()=>this.userStore.getUid(),this.getOption=(e,t)=>this.dataStore.getOption(e,t),this.setOption=(e,t,i)=>{var s;return O(ie).includes(t)?typeof i===(null===(s=X[t])||void 0===s?void 0:s.type)?(this.dataStore.setOption(e,t,i),C(`已修改${ie[t]}: ${i}`,"info"),!0):(C(`参数格式不正确:${i},请检查后重试!`,"error"),!1):(C(`不存在可修改的配置项:${t},请检查后重试!`,"error"),!1)},this.setPageAttributes=(e,t)=>{const{currentPage:i}=this.dataStore.eventHooks;P(i.pageProps[e])&&(i.pageProps[e]={}),P(t)||(i.pageProps[e]=Object.assign(Object.assign({},i.pageProps[e]),M(t)))},this.sendPage=(e,t)=>{const{trackPage:i}=this.dataStore.getTrackerVds(e);i?C("仅在关闭trackPage时允许调用sendPage,请确认后修改初始化配置项!","error"):this.dataStore.sendPage(e,t)},this.identify=(e,t)=>{if(e===this.trackingId)if(this.vdsConfig.forceLogin){if(!Z(t))return void j("identify");const e=p(t).slice(0,1e3);this.userStore.setUid(e),this.dataStore.setOption(this.trackingId,"forceLogin",!1),this.dataStore.trackersExecute((t=>{const i=this.uploader.getHoardingQueue(t);i.forEach(((t,s)=>i[s].deviceId=e)),this.uploader.initiateRequest(t,!0)}))}else j("identify",!1,"forceLogin未开启");else j("identify",!1,"子实例不允许调用identify")},this.setUserAttributes=(e,t)=>{if(!P(t)&&o(t)){const{eventContextBuilder:i,eventInterceptor:s,lastVisitEvent:n}=this.dataStore,r=Object.assign({eventType:"LOGIN_USER_ATTRIBUTES",attributes:M(t)},i(e));r.path||(r.path=n.path,r.query=n.query,r.title=n.title),s(r)}else j("setUserAttributes")},this.setUserId=(e,t,s)=>{if(Z(t)){const n=this.userStore.getGioId(e);t=p(t).slice(0,1e3),s=p(s).slice(0,1e3),this.userStore.setUserId(e,t);const{idMapping:r}=this.dataStore.getTrackerVds(e);if(r&&this.userStore.setUserKey(e,i(s)?"":s),n&&n!==t){this.userStore.setSessionId(e);const{path:t,query:i,settedTitle:s}=this.dataStore.eventHooks.currentPage;this.dataStore.eventHooks.currentPage.title=s[t]||this.minipInstance.getPageTitle(this.minipInstance.getCurrentPage()),this.dataStore.sendVisit(e,{path:t,query:i})}}else j("setUserId")},this.clearUserId=e=>{this.userStore.setUserId(e,void 0),this.userStore.setUserKey(e,void 0)},this.setGeneralProps=(e,t)=>{var i;return P(t)?(j("setGeneralProps"),!1):(this.dataStore.generalProps[e]=Object.assign(Object.assign({},null!==(i=this.dataStore.generalProps[e])&&void 0!==i?i:{}),t),!0)},this.clearGeneralProps=(e,t)=>{try{P(this.dataStore.generalProps[e])||(g(t)&&!P(t)?t.forEach((t=>{k(this.dataStore.generalProps[e],t)})):this.dataStore.generalProps[e]={})}catch(e){return j("setGeneralProps"),!1}},this.track=(e,t,i)=>{N(t,(()=>{var s;const{eventContextBuilder:n,eventInterceptor:r,generalProps:a}=this.dataStore,g=Object.assign(Object.assign({},null!==(s=a[e])&&void 0!==s?s:{}),o(i)&&!P(i)?i:{}),l=Object.assign({eventType:"CUSTOM",eventName:t,attributes:M(U(g))},n(e));this.plugins.gioMultipleInstances&&i&&i["&&sendTo"]&&(l["&&sendTo"]=i["&&sendTo"]),r(l)}))},this.trackTimerStart=(e,t)=>{const{dataCollect:i}=this.dataStore.getTrackerVds(e);return i?N(t,(()=>{const i=$();return this.dataStore.trackTimers[e]||(this.dataStore.trackTimers[e]={}),this.dataStore.trackTimers[e][i]={eventName:t,leng:0,start:+Date.now()},i})):(C("指定实例未开启数据采集,请检查!","error"),!1)},this.trackTimerPause=(e,t)=>{const i=this.dataStore.trackTimers[e];if(t&&i&&i[t]){const e=i[t];return e.start&&(e.leng=e.leng+(+Date.now()-e.start)),e.start=0,!0}return!1},this.trackTimerResume=(e,t)=>{const i=this.dataStore.trackTimers[e];if(t&&i&&i[t]){const e=i[t];return 0===e.start&&(e.start=+Date.now()),!0}return!1},this.trackTimerEnd=(e,t,i)=>{const{dataCollect:s}=this.dataStore.getTrackerVds(e),n=this.dataStore.trackTimers[e];if(t&&n&&n[t]){if(s){const s=864e5,r=n[t];if(0!==r.start){const e=+Date.now()-r.start;r.leng=e>0?r.leng+e:0}const{eventContextBuilder:o,eventInterceptor:a}=this.dataStore,g=Object.assign({eventType:"CUSTOM",eventName:r.eventName,attributes:M(Object.assign(Object.assign({},i),{event_duration:r.leng>s?0:r.leng/1e3}))},o(e));return this.plugins.gioMultipleInstances&&i&&i["&&sendTo"]&&(g["&&sendTo"]=i["&&sendTo"]),a(g),!0}return C("指定实例未开启数据采集,计时器已移除,请检查!","error"),!1}return C("未查询到指定计时器,请检查!","error"),!1},this.removeTimer=(e,t)=>{const i=this.dataStore.trackTimers[e];return t&&i&&i[t]?(delete i[t],!0):(C("未查询到指定计时器,请检查!","error"),!1)},this.clearTrackTimer=e=>{this.dataStore.trackTimers[e]={}},this.setLocation=(e,t,i)=>{P(this.dataStore.locationData[e])&&(this.dataStore.locationData[e]={});const s=this.dataStore.locationData[e],n=e=>e>=-180&&180>=e;n(t)&&n(i)&&(s.latitude!==t||s.longitude!==i)&&(this.dataStore.locationData[e]={latitude:t,longitude:i})},this.updateImpression=()=>{C("updateImpression 错误! 请集成半自动埋点浏览插件后重试!","error")},this.getABTest=(e,t,i)=>{C("获取ABTest数据错误! 请集成ABTest插件后重试!","error"),A(i,{})},this.getGioInfo=e=>{const{getUid:t,getUserId:i,getUserKey:s,getSessionId:n}=this.userStore,{projectId:r,appId:o,dataSourceId:a,dataCollect:g,idMapping:l,extraParams:u,ignoreFields:c}=this.dataStore.getTrackerVds(e),d={gioappid:o,giocs1:i(e)||"",gioplatform:this.platformConfig.platform,gioprojectid:r,gios:n(e),giou:t()};return d.giodatacollect=g,d.giodatasourceid=a,l&&(d.giouserkey=s(e)),P(u)||u.forEach((e=>{c.includes(e)||(d["gio"+e]=this.dataStore.lastVisitEvent[e])})),Be.stringify(d)},this.utils=Object.assign(Object.assign(Object.assign({},E),Y),{qs:Be}),this.emitter={all:e=e||new Map,on:function(t,i){var s=e.get(t);s?s.push(i):e.set(t,[i])},off:function(t,i){var s=e.get(t);s&&(i?s.splice(s.indexOf(i)>>>0,1):e.set(t,[]))},emit:function(t,i){var s=e.get(t);s&&s.slice().map((function(e){e(i)})),(s=e.get("*"))&&s.slice().map((function(e){e(t,i)}))}},this.gioPlatform=B(),this.gioFramework="uniapp",this.sdkVersion="4.1.0";try{"quickapp"===this.gioPlatform||a(getApp)&&a(App)?this.inPlugin=!1:this.inPlugin=!0}catch(e){this.inPlugin=!0}this.inPlugin&&C("未检测到小程序实例,自动切换为插件模式!","info"),this.platformConfig=Ue,this.minipInstance=new Ke(this),this.dataStore=new ke(this),this.userStore=new We(this),this.uploader=new ze(this),this.plugins=new Re(this),this.plugins.innerPluginInit()}},Ye=function(){var e;const t=arguments[0];let i="g0",n=t;if(t.indexOf(".")>-1&&(i=null!==(e=t.split(".")[0])&&void 0!==e?e:"g0",n=t.split(".")[1]),s(n)&&te.includes(n)&&Je[n]){const e=c(Array.from(arguments));if("init"===n){const t=((e,t)=>{const i=p(t[0]),s=p(t[1]),n=(4===t.length?t[3]:t[2])||{};return i&&s?e.dataStore.initializedTrackingIds.some(((t,n)=>{const r=0===n?e.vdsConfig:e.subInstance[t];return r.projectId===i&&r.dataSourceId===s}))?(C("SDK初始化失败,重复初始化,请检查初始化参数!","error"),!1):{projectId:i,dataSourceId:s,appId:p(4===t.length?t[2]:""),userOptions:n}:(C('SDK初始化失败,请使用 gdp("init", "您的GrowingIO项目 accountId", "您项目的 dataSourceId", "您的小程序 AppId(可选)", options: { host: "您的数据上报地址host" }); 进行初始化!',"error"),!1)})(Je,e);if(t){const{projectId:e,dataSourceId:s,appId:n,userOptions:r}=t;return Je.init(Object.assign(Object.assign({},r),{projectId:e,dataSourceId:s,appId:n,trackingId:i}))}return!1}if("registerPlugins"===n)Je.registerPlugins(e[0]);else{if(Je.gioSDKInitialized&&Je.vdsConfig)return ee.includes(n)?x((()=>Je.handlerDistribute(i,n,e))):x((()=>Je[n](...e)));C("SDK未初始化!","error")}}else if(se.includes(n))C(`方法 ${p(n)} 已被弃用,请移除!`,"warn");else{if("canIUse"===n)return te.includes(arguments[1])&&!!Je[arguments[1]];C(`不存在名为 ${p(n)} 的方法调用!`,"error")}};G().gdp=Ye,G().gioSDKVersion=Je.sdkVersion;const Ze=x((()=>{var e;return null!==(e=Je.dataStore.eventHooks.growingApp)&&void 0!==e?e:App})),Xe=x((()=>{var e;return null!==(e=Je.dataStore.eventHooks.growingPage)&&void 0!==e?e:Page})),et=x((()=>{var e;return null!==(e=Je.dataStore.eventHooks.growingComponent)&&void 0!==e?e:Component})),it=x((()=>{var e;return null!==(e=Je.dataStore.eventHooks.growingBehavior)&&void 0!==e?e:Behavior}));export{Ze as GioApp,it as GioBehavior,et as GioComponent,Xe as GioPage,Ye as default};
1
+ const e=/^e[0-9]+$/,t=/^[a-zA-Z_][0-9a-zA-Z_]{0,100}$/,i=e=>["undefined","null"].includes(E(e)),s=e=>"string"===E(e),n=e=>"number"===E(e),r=e=>"boolean"===E(e),o=e=>"[object Object]"==={}.toString.call(e)&&!i(e),a=e=>["function","asyncfunction"].includes(E(e)),l=e=>Array.isArray(e)&&"array"===E(e),g=e=>"date"===E(e),u=e=>{try{return Array.from(e)[0]}catch(e){return}},c=e=>{try{const t=Array.from(e);return t[t.length-1]}catch(e){return}},d=(e,t=1)=>l(e)&&n(t)?e.slice(t>0?t:1,e.length):e,h=(e,t=!1)=>{if(l(e)){let i=0;const s=[];for(const n of e)n&&!T(n)&&(s[i++]=n),t&&0===n&&(s[i++]=n);return s}return e},p=(e,t)=>{if(l(e)){const i=e.findIndex(t);return 0>i?void 0:e[i]}},v=e=>i(e)?"":""+e,m=(e,t)=>"string"===E(e)?e.split(t):e,f=e=>{if(s(e)){const t=m(e,"");return`${u(t).toLowerCase()}${d(t).join("")}`}return e},I=(e,t)=>(s(e)||(e=v(e)),e.slice(0,t.length)===t),O={}.hasOwnProperty,y=(e,t)=>!i(e)&&O.call(e,t),b=e=>o(e)?Object.keys(e):[],S=(e,t)=>{b(e).forEach((i=>t(e[i],i)))},w=(e,t)=>{const i=b(e);return!(!o(e)||!o(t)||i.length!==b(t).length||i.map(((i,s)=>o(e[i])?w(e[i],t[i]):e[i]===t[i])).includes(!1))},P=(e,t,i)=>{let s=e;return o(e)?(t.split(".").forEach((e=>{s=s?s[e]:i})),s):i},k=(e,t)=>{if(!o(e))return!1;try{if("string"===E(t))return delete e[t];if("array"===E(t))return t.map((t=>delete e[t]));"object"===E(t)&&t.constructor===RegExp&&b(e).forEach((i=>{t.test(i)&&k(e,i)}))}catch(e){return!1}},_=(e,t=250,i,s)=>{let n,r=0;return"boolean"!==E(i)&&(s=e,e=i,i=void 0),function(...o){let a=this,l=Date.now()-r;function g(){r=Date.now(),e.apply(a,o)}s&&!n&&g(),n&&clearTimeout(n),void 0===s&&l>t?g():!0!==i&&(n=setTimeout(s?function(){n=void 0}:g,void 0===s?t-l:t))}},T=e=>l(e)?0===e.length:o(e)?0===b(e).length:!e,E=e=>({}.toString.call(e).slice(8,-1).toLowerCase()),C=e=>{function t(e){return 10>e?"0"+e:e}return e.getFullYear()+"-"+t(e.getMonth()+1)+"-"+t(e.getDate())+" "+t(e.getHours())+":"+t(e.getMinutes())+":"+t(e.getSeconds())+"."+t(e.getMilliseconds())};var j=Object.freeze({__proto__:null,isNil:i,isString:s,isNaN:e=>"NaN"===v(Number(e)),isNumber:n,isBoolean:r,isObject:o,isRegExp:e=>"[object RegExp]"==={}.toString.call(e),isFunction:a,isArray:l,isDate:g,fixed:(e,t)=>n(e)?Number(e.toFixed(n(t)?t:2)):s(e)&&"NaN"!==v(Number(e))?Number(Number(e).toFixed(n(t)?t:2)):e,head:u,last:c,drop:d,dropWhile:(e,t)=>l(e)?e.filter((e=>!t(e))):e,compact:h,find:p,isEqualArray:(e,t)=>!(!l(e)||!l(t)||e.length!==t.length)&&e.every(((e,i)=>e===t[i])),toString:v,split:m,lowerFirst:f,upperFirst:e=>{if(s(e)){const t=m(e,"");return`${u(t).toUpperCase()}${d(t).join("")}`}return e},startsWith:I,endsWith:(e,t)=>{const{length:i}=e;let s=i;s>i&&(s=i);const n=s;return s-=t.length,s>=0&&e.slice(s,n)===t},hasOwnProperty:O,has:y,keys:b,forEach:S,isEqual:w,get:P,unset:k,throttle:_,isEmpty:T,typeOf:E,formatDate:C});const A=(e,t)=>{console.log("%c[GrowingIO]:"+e,{info:"color: #3B82F6;",error:"color: #EF4444",warn:"color: #F59E0B",success:"color: #10B981"}[t]||"")},x=(e,t=!0,i="参数不合法")=>A(`${t?"调用":"设置"} ${e} 失败,${i}!`,"warn"),q=e=>{try{return e()}catch(e){return}},N=(e,t)=>{if(a(e))try{e(t)}catch(e){A("回调执行失败!"+e,"error")}},U=e=>s(e)?e.trim().substring(0,100):e,K=(e,i)=>s(e)&&!T(e)&&e.match(t)?i():(A("事件名格式不正确,只能包含数字、字母和下划线,且不能以数字开头,字符总长度不能超过100!","error"),!1),$=e=>(i(e)||b(e).forEach((t=>{a(e[t])?e[t]=q((()=>e[t]())):o(e[t])?k(e,t):l(e[t])||(e[t]=v(e[t]))})),e),H=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})),V=e=>e.pixelRatio?Math.round(e.screenHeight*e.pixelRatio):e.screenHeight,D=e=>e.pixelRatio?Math.round(e.screenWidth*e.pixelRatio):e.screenWidth,L=(e,t)=>{if(e){const i=e.toLowerCase();return-1!==i.indexOf("android")?t+"-Android":-1!==i.indexOf("ios")?t+"-iOS":e}},F=e=>{if(s(e)){const t=e.indexOf("?");return-1!==t?[e.substring(0,t),e.substring(t+1)]:[e,""]}return["",""]},R=e=>s(e)?e.startsWith("/")?e:"/"+e:"",B=e=>q((()=>{switch(e){case"wx":return wx;case"my":case"tb":return my;case"swan":return swan;case"tt":return tt;case"qq":return qq;case"ks":return ks;case"jd":return jd;default:{let e;return e||(e=q((()=>swan))),e||(e=q((()=>my))),e||(e=q((()=>tt))),e||(e=q((()=>qq))),e||(e=q((()=>ks))),e||(e=q((()=>jd))),e||(e=q((()=>wx))),e}}})),M=e=>q((()=>{switch(e){case"wx":return __wxConfig;case"swan":return appConfig;case"tt":return q((()=>__ttConfig))||(null===global||void 0===global?void 0:global.TMAConfig)||(null===globalThis||void 0===globalThis?void 0:globalThis.TMAConfig);case"qq":return __qqConfig;case"ks":return __ksConfig;case"jd":return __jdConfig;default:return}})),G=()=>{let e;return!e&&q((()=>swan))&&(e="swan"),!e&&q((()=>tt))&&(e="tt"),!e&&q((()=>qq))&&(e="qq"),!e&&q((()=>my.tb))&&(e="tb"),!e&&q((()=>my))&&(e="my"),!e&&q((()=>ks))&&(e="ks"),!e&&q((()=>jd))&&(e="jd"),!e&&q((()=>wx))&&(e="wx"),e||p(b(global),(e=>v(e).toLowerCase().includes("quickapp")))&&(e="quickapp"),e},Q=()=>{var e;return null!==(e=q((()=>{var e;return null!==(e=q((()=>{var e;return null!==(e=q((()=>$global)))&&void 0!==e?e:global})))&&void 0!==e?e:window})))&&void 0!==e?e:globalThis},z=e=>{const t={};return o(e)&&(k(e,"&&sendTo"),S(e,((e,s)=>{const n=v(s).slice(0,100);o(e)?t[n]=z(e):l(e)?(t[n]=h(e.slice(0,100),!0),t[n]=t[n].join("||").slice(0,1e3)):g(e)?t[n]=C(e):t[n]=i(e)?"":v(e).slice(0,1e3)}))),t},W=(e,t)=>{const i=()=>t.map((t=>e.getStorageSync(t)));try{return e.minip.canIUse("batchGetStorageSync")?e.minip.batchGetStorageSync(t):i()}catch(e){return i()}},J=(e,t)=>{const i=()=>t.map((({key:t,value:i})=>e.setStorageSync(t,i)));try{return e.minip.canIUse("batchSetStorageSync")?e.minip.batchSetStorageSync(t):i()}catch(e){return i()}},Y=e=>b(e||{}).map((t=>t?`${t}=${i(e[t])?"":e[t]}`:"")).join("&"),Z=e=>{(I(e,"?")||I(e,"&"))&&(e=e.slice(1,e.length));const t={};return e.split("&").forEach((e=>{const i=e.split("=");i[0]&&(t[i[0]]=i[1])})),t},X=(e={},t={})=>{const i={};return b(t).forEach((e=>{["string","number","boolean"].includes(E(t[e]))&&(i[e]=t[e])})),Object.assign({},i,e)};var ee=Object.freeze({__proto__:null,consoleText:A,callError:x,niceTry:q,niceCallback:N,limitString:U,eventNameValidate:K,getDynamicAttributes:$,guid:H,getScreenHeight:V,getScreenWidth:D,getOS:L,compareVersion:(e="",t="")=>{const i=e=>e.replace(/\s+/g,""),s=e=>e.replace(/[vV]/g,""),n=i(s(e)),r=i(s(t)),o=n.split("."),a=r.split(".");for(let e=0;3>e;e++){let t=Number(o[e]),i=Number(a[e]);if(t>i)return 1;if(i>t)return-1;if(!isNaN(t)&&isNaN(i))return 1;if(isNaN(t)&&!isNaN(i))return-1}return 0},getVueVersion:e=>{if(e){const t=Number(u(m(e.version,".")));return Number.isNaN(t)?0:t}return 0},splitPath:F,normalPath:R,isTaro3:e=>{const{Current:t,createComponent:i}=e;return!(!e||!t||i)},getPlainMinip:B,getPlainConfig:M,getPlainPlatform:G,getSubKeys:e=>b(e).filter((e=>e.indexOf("__sub")>-1&&e.indexOf("gio__")>-1)).sort(),getAppInst:()=>{let e=q((()=>getApp({allowDefault:!0})));return e||(e=Q()),e},getGlobal:Q,limitObject:z,batchGetStorageSync:W,batchSetStorageSync:J,qsStringify:Y,qsParse:Z,hashCode:(e,t=!1)=>{let i=0;if(T(e)||"boolean"==typeof e)return i;let s=0;for(;s<e.length;)i=(i<<5)-i+e.charCodeAt(s),i|=0,s++;return t?Math.abs(i):i},getLaunchQuery:X});const te=e=>s(e)&&e.length>0||n(e)&&e>0,ie={autotrack:{type:"boolean",default:!0},compress:{type:"boolean",default:!0},dataCollect:{type:"boolean",default:!0},debug:{type:"boolean",default:!1},idMapping:{type:"boolean",default:!1},enableIdMapping:{type:"boolean",default:!1},extraParams:{type:"array",default:[]},followShare:{type:"boolean",default:!0},forceLogin:{type:"boolean",default:!1},ignoreFields:{type:"array",default:[]},pluginMode:{type:"boolean",default:!1},originalSource:{type:"boolean",default:!0},keepAlive:{type:"number",default:3e5},performance:{type:"object",default:{monitor:!0,exception:!0}},serverUrl:{type:"string",default:"https://napi.growingio.com"},requestTimeout:{type:"number",default:5e3},taro:{type:["object","module"],default:!1},taroVue:{type:["object","function"],default:!1},tbConfig:{type:"object",default:{cloud:void 0,cloudFuncSend:!1,cloudFuncName:"httpTunnel",cloudFuncHandler:"main",cloudAppId:void 0,path:void 0}},trackPage:{type:"boolean",default:!0},uniVue:{type:["object","function"],default:!1},uploadInterval:{type:"number",default:1e3},version:{type:"string",default:"1.0.0"}},se=["clearGeneralProps","clearPageAttributes","clearTrackTimer","clearUserId","getABTest","getGioInfo","getOption","identify","removeTimer","sendPage","sendVisit","setGeneralProps","setLocation","setOption","setPageAttributes","setUserAttributes","setUserId","track","trackTimerEnd","trackTimerPause","trackTimerResume","trackTimerStart"],ne=["init","registerPlugins","getPlugins","getDeviceId","updateImpression",...se],re={autotrack:"无埋点",dataCollect:"数据采集",debug:"调试模式",serverUrl:"数据上报服务地址"},oe=["enableDebug","setAutotrack","setDataCollect","setTrackerHost","setTrackerScheme","setConfig","collectImp","setPlatformProfile","getLocation"],ae=["deviceBrand","deviceModel","deviceType","networkState","screenHeight","screenWidth","operatingSystem"],le=[...ae,"appChannel","language","platformVersion"],ge={gsid:"_growing_gsid_",originalSource:"_gdp_original_source_",userId:"_growing_userId_",userKey:"_growing_userKey_",gioId:"_growing_gioId_",plugin_gsid:"_growing_plugin_gsid_",plugin_originalSource:"_gdp_plugin_original_source_",plugin_userId:"_growing_plugin_userId_",plugin_userKey:"_growing_plugin_userKey_",plugin_gioId:"_growing_plugin_gioId_"};var ue="MINIP_LIFECYCLE",ce="ON_COMMIT_REQUEST",de="ON_COMPOSE_AFTER",he="ON_COMPOSE_BEFORE",pe="ON_ERROR",ve="ON_INSTALL",me="ON_SEND_AFTER",fe="ON_SEND_BEFORE",Ie="OPTION_CHANGE",Oe="OPTION_INITIALIZED",ye="SDK_INITIALIZED";class be{constructor(e){this.growingIO=e,this.main=(e,t,i=!0)=>{e||(e=this.growingIO.trackingId);const{sdkVersion:s,platformConfig:n,minipInstance:r,userStore:o,dataStore:a,dataStore:{scene:l,eventHooks:{currentPage:g},generalProps:u}}=this.growingIO,{version:c,dataSourceId:d,appId:h,idMapping:p,ignoreFields:v}=a.getTrackerVds(e),m=a.locationData[e],{systemInfo:f={},network:I={}}=r,{brand:O,model:y,platform:b,language:S}=f,w=g.getPagePath(),P={appChannel:"scn:"+(l||"NA"),appVersion:c,dataSourceId:d,deviceBrand:O,deviceId:o.getUid(),deviceModel:y,deviceType:L(b,n.name),domain:h,language:S,latitude:null==m?void 0:m.latitude,longitude:null==m?void 0:m.longitude,networkState:(null==I?void 0:I.networkType)||(null==I?void 0:I.type)||(null==I?void 0:I.subtype),operatingSystem:L(b,n.name),path:w,platform:n.platform,platformVersion:n.name+(f.version?" "+f.version:""),query:w?g.getPageQeury():"",screenHeight:V(f),screenWidth:D(f),sdkVersion:s,sessionId:o.getSessionId(e),title:g.getPageTitle(),timestamp:Date.now(),timezoneOffset:(new Date).getTimezoneOffset(),userId:o.getUserId(e)};return p&&(P.userKey=o.getUserKey(e)),i&&!T(u[e])&&(P.attributes=Object.assign({},u[e])),T(P.attributes)||(P.attributes=z($(Object.assign({},P.attributes)))),T(v)||v.forEach((e=>{k(P,e)})),T(t)?Object.assign(Object.assign({},P),{trackingId:e}):Object.assign(Object.assign(Object.assign({},P),t),{trackingId:e})}}}function Se(e,t,i,s){return new(i||(i=Promise))((function(n,r){function o(e){try{l(s.next(e))}catch(e){r(e)}}function a(e){try{l(s.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((s=s.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;class we{constructor(e){this.growingIO=e,this.enterParams={},this.main=(e,t)=>{var i,s;const n=Date.now(),{emitter:r,userStore:o,vdsConfig:a,platformConfig:l,uploader:g,dataStore:u,dataStore:{trackersExecute:c,shareOut:d,lastCloseTime:h,saveStorageInfo:p,setOriginalSource:v}}=this.growingIO;r.emit(ue,{event:"App "+e,timestamp:n,params:null!==(i=t[0])&&void 0!==i?i:{}}),a.debug&&console.log("App:",e,n);const m=l.listeners.app;switch(r.emit(he,{event:"App "+e,params:null!==(s=t[0])&&void 0!==s?s:{}}),e){case m.appLaunch:this.enterParams=Object.assign({},t[0]);break;case m.appCreate:case m.appShow:{const{path:e,query:i,referralPage:s}=this.enterParamsParse(t[0]);!d&&a.originalSource&&e&&c((t=>{v(t,{path:e,query:i,referralPage:s})})),h?(Date.now()-h>a.keepAlive||u.lastScene&&u.scene!==u.lastScene)&&(c((e=>{o.setSessionId(e)})),c((t=>{if(e)this.buildVisitEvent(t,{path:e,query:i});else{const e=u.lastPageEvent[t];this.buildVisitEvent(t,{path:e.path,query:e.query})}}))):c((t=>{u.lastVisitEvent[t]={path:e,query:i,referralPage:s},this.buildVisitEvent(t,{path:e,query:i,referralPage:s})}));break}case m.appClose:u.lastScene=u.scene,u.lastCloseTime=Date.now(),p(),o.saveUserInfo(),c((e=>{this.buildCloseEvent(e),a.forceLogin||g.initiateRequest(e,!0)}))}},this.enterParamsParse=(e={})=>{var t;const{gioPlatform:i,minipInstance:s,dataStore:n}=this.growingIO;let r="",o="",a="";if("quickapp"!==i&&s.minip.canIUse("getEnterOptionsSync")){const{path:i,query:l,scene:g,referrerInfo:u}=s.minip.getEnterOptionsSync()||{};r=i||e.path,o=l||e.query,a=(null==u?void 0:u.appId)||(null===(t=null==e?void 0:e.referrerInfo)||void 0===t?void 0:t.appId)||"",n.scene=g||e.scene,o=T(null==u?void 0:u.extraData)?Y(o):Y(X(o,u.extraData))}else{const{path:t,query:i,referrerInfo:s}=e;r=t,o=Y(i),a=(null==s?void 0:s.appId)||"",this.parseScene(e)}return{path:r,query:o,referralPage:a}},this.parseScene=e=>{var t;const{minipInstance:i,gioPlatform:s,dataStore:n}=this.growingIO;let r;if("quickapp"===s){const{extra:e,type:t}=i.getAppSource();r=(null==e?void 0:e.scene)||t}else T(e)||((null===(t=null==e?void 0:e.query)||void 0===t?void 0:t.wxShoppingListScene)?r=e.query.wxShoppingListScene:(null==e?void 0:e.scene)?r=e.scene:n.scene="NA");n.scene=r},this.buildVisitEvent=(e,t)=>{const{dataStore:{getOriginalSource:i,eventContextBuilder:s,eventInterceptor:n},vdsConfig:r}=this.growingIO,o=i(e),a=(null==t?void 0:t.query)||"";let l=Object.assign({eventType:"VISIT"},s(e,{}));!T(t)&&t.path&&(l.path=t.path||"",l.query="string"===E(a)?a:Y(a),t.referralPage&&(l.referralPage=t.referralPage)),r.originalSource&&!T(o)&&(l=Object.assign(Object.assign({},l),o)),n(l)},this.buildCloseEvent=e=>{const{dataStore:{eventContextBuilder:t,eventInterceptor:i}}=this.growingIO;i(Object.assign({eventType:"APP_CLOSED"},t(e)))}}}class Pe{constructor(e){this.growingIO=e,this.getPagePath=()=>{var e,t,i;const{minipInstance:s,inPlugin:n,dataStore:r,trackingId:o}=this.growingIO,a=s.getCurrentPath();if(n){const e=r.getTrackerVds(o);return a||"/插件"+e.appId}return a||(null===(e=r.eventHooks.appEffects.enterParams)||void 0===e?void 0:e.path)||(null===(t=r.lastPageEvent[o])||void 0===t?void 0:t.path)||(null===(i=r.lastVisitEvent[o])||void 0===i?void 0:i.path)},this.getPageQeury=()=>{var e,t,i,s,n,r;const{minipInstance:o,dataStore:a,trackingId:l}=this.growingIO,g=o.getCurrentPage(),u=o.getCurrentPath(),{enterParams:c={}}=a.eventHooks.appEffects;if(!u)return c.path?this.qsQuery(X(null==c?void 0:c.query,null===(i=null==c?void 0:c.referrerInfo)||void 0===i?void 0:i.extraData)):(null===(s=a.lastPageEvent[l])||void 0===s?void 0:s.path)?null===(n=a.lastPageEvent[l])||void 0===n?void 0:n.query:null===(r=a.lastVisitEvent[l])||void 0===r?void 0:r.query;{const i=null!==(e=g.options)&&void 0!==e?e:g.$taroParams;if(!T(i))return k(i,"$taroTimestamp"),this.qsQuery(i);if(!T(this.queryOption[u]))return this.qsQuery(this.queryOption[u]);if(u===c.path)return this.qsQuery(X(null==c?void 0:c.query,null===(t=null==c?void 0:c.referrerInfo)||void 0===t?void 0:t.extraData))}},this.getPageTitle=e=>{const{minipInstance:t,inPlugin:i,dataStore:s}=this.growingIO,n=t.getCurrentPath(),r=this.settedTitle[n]||t.getPageTitle(t.getCurrentPage());if(i){const t=s.getTrackerVds(e||this.growingIO.trackingId);return r||`/插件${t.appId}${n?"_"+c(n.split("/")):""}`}return r},this.qsQuery=(e={})=>{const t=Object.assign({},e);return k(t,"wxShoppingListScene"),Y(t)},this.getReferralPage=e=>{var t,i,s;const{minipInstance:n,dataStore:{lastPageEvent:r,scene:o,eventHooks:a}}=this.growingIO;return(null===(t=r[e])||void 0===t?void 0:t.path)||(null===(s=null===(i=a.appEffects.enterParams)||void 0===i?void 0:i.referrerInfo)||void 0===s?void 0:s.appId)||(o?`scn:${n.scnPrefix}${o}`:null)},this.updateShareResult=e=>{const[t,i]=this.buildShareQuery(e);return e.path=R(t+(i?"?"+i:"")),e.query=i,e},this.updateAppMessageResult=this.updateShareResult,this.updateTimelineResult=this.updateShareResult,this.updateAddFavoritesResult=e=>{const[t,i]=this.buildShareQuery(e);return e.path=R(t+(i?"?"+i:"")),e.query=i,e},this.eventSetPageProps=(e,t)=>{const i=q((()=>this.pageProps[e][this.getPagePath()]));return T(i)?t.attributes:z($(Object.assign(Object.assign({},t.attributes),i)))},this.queryOption={},this.settedTitle={},this.pageProps={}}buildShareQuery(e){var t,i;const s=F(null!==(t=e.path)&&void 0!==t?t:"");let n=this.getPagePath(),r={},o=y(e,"path");if(o&&(n=u(s),r=Z(c(s))||{}),T(r)&&(r=Z(null!==(i=e.query)&&void 0!==i?i:"")||{},h(b(r)).forEach((e=>{e.toLowerCase().startsWith("utm_")&&k(r,e)}))),!o&&T(r)){const e=this.growingIO.minipInstance.getCurrentPage();r=e.options||this.queryOption[e.route]||{}}return[n,Y(r)]}}class ke{constructor(e){this.growingIO=e,this.main=(e,t,i)=>{var s,n;const r=Date.now(),{emitter:o,minipInstance:l,plugins:g,vdsConfig:u,platformConfig:c,dataStore:{getTrackerVds:d,getOriginalSource:h,setOriginalSource:p,trackersExecute:v,eventHooks:m,toggleShareOut:f,buildAppMessageEvent:I,buildTimelineEvent:O,buildAddFavorites:y}}=this.growingIO,{currentPage:b}=m;if(this.prevEvent[t]&&50>Date.now()-Number(this.prevEvent[t]))return;e||(e=l.getCurrentPage()),e.route||(e.route=l.getCurrentPath(e));const S=e.route||e.uri||e.__route__||(null===(s=null==e?void 0:e.$page)||void 0===s?void 0:s.fullPath)||"";o.emit(ue,{event:"Page "+t,timestamp:r,params:{page:e,args:i[0]}}),u.debug&&console.log("Page:",S,"#",t,r),this.prevEvent[t]=Date.now();const w=c.listeners.page;switch(o.emit(he,{page:e,event:"Page "+t,params:{page:e,args:i[0]}}),b.lastLifecycle=b.currentLifecycle,b.currentLifecycle=t,t){case w.pageLoad:b.queryOption[S]=P(e,"options")||P(e,"__displayReporter.query")||P(e,"$page.query")||P(e,"$wx.__displayReporter.query")||P(e,"$taroParams")||i[0]||{},k(b.queryOption[S],"$taroTimestamp");break;case w.pageShow:v((e=>{const t=h(e);T(t)||t.path!==S||p(e,Object.assign(Object.assign({},t),{title:b.getPageTitle()}));const{trackPage:i}=d(e);i&&this.buildPageEvent(e)})),f(!1);break;case w.pageHide:case w.pageUnload:break;case w.shareApp:f(!0),v((e=>{const{followShare:t}=d(e);t&&I(e,i)}));break;case w.shareTime:v((e=>{const{followShare:t}=d(e);t&&O(e,i)}));break;case w.addFavorites:v((e=>{const{followShare:t}=d(e);t&&y(e,i)}));break;case w.tabTap:{const e=null===(n=null==g?void 0:g.gioEventAutoTracking)||void 0===n?void 0:n.buildTabClickEvent;u.autotrack&&e&&a(e)&&e(this.growingIO.trackingId,i[0]);break}}},this.buildPageEvent=(e,t)=>{const{dataStore:{eventContextBuilder:i,eventInterceptor:s,eventHooks:{currentPage:n}}}=this.growingIO,r=Object.assign({eventType:"PAGE",referralPage:n.getReferralPage(e)},i(e));r.attributes=n.eventSetPageProps(e,r),!T(t)&&t.title&&(r.title=t.title),s(r)},this.prevEvent={}}}class _e{constructor(e){var t;this.growingIO=e,this.isNormalFc=(e,t)=>a(t)&&"constructor"!==e,this.objectTraverse=(e,t)=>{Object.getOwnPropertyNames(e).forEach((i=>t(i,e))),y(e,"methods")&&Object.getOwnPropertyNames(e.methods).forEach((i=>{e[i]||t(i,e.methods)})),y(e,"lifetimes")&&Object.getOwnPropertyNames(e.lifetimes).forEach((i=>{e[i]||t(i,e.lifetimes)})),y(e,"pageLifetimes")&&Object.getOwnPropertyNames(e.pageLifetimes).forEach((i=>{e[i]||t(i,e.pageLifetimes)}))},this.supLifeFcs=(e,t)=>{l(this[t+"Handlers"])&&this[t+"Handlers"].forEach((t=>{a(e[t])||["onShareAppMessage","onShareTimeline"].includes(t)||(e[t]=()=>{})}))},this.lifeFcEffects=(e,t,i)=>{const s=this;return["onShareTimeline","onAddToFavorites"].includes(e)?function(...n){let r=t.apply(this,n);"onShareTimeline"===e&&s.growingIO.vdsConfig.followShare&&(r=s.currentPage.updateTimelineResult(null!=r?r:{})),"onAddToFavorites"===e&&(r=s.currentPage.updateAddFavoritesResult(null!=r?r:{}));const o=[].slice.call(n);return r&&o.push(r),s[`def${i}Cbs`][e].apply(this,o),r}:function(...n){var r;return Se(this,void 0,void 0,(function*(){let o;try{if("onShareAppMessage"===e){if(o=null!==(r=t.apply(this,n))&&void 0!==r?r:{},"promise"===E(o)&&(o=yield o.then((e=>e))),"promise"===E(o.promise)){const e=function(){return Se(this,void 0,void 0,(function*(){let e=o;return new Promise((t=>{let i=setTimeout((()=>{t(Object.assign({},e)),clearTimeout(i),i=void 0}),3e3);o.promise.then((s=>{e=s,t(Object.assign({},e)),clearTimeout(i),i=void 0}))}))}))};o=Object.assign(Object.assign({},o),yield e()),k(o,"promise")}s.growingIO.vdsConfig.followShare&&(o=s.currentPage.updateAppMessageResult(null!=o?o:{}))}const a=[].slice.call(n);o&&a.push(o),s[`def${i}Cbs`][e].apply(this,a)}catch(e){A(e,"error")}return"onShareAppMessage"!==e&&(o=t.apply(this,n)),s.growingIO.emitter.emit(ue,{event:`${i} ${e}End`,timestamp:Date.now(),params:{instance:this,arguments:Array.from(n)}}),o}))}},this.customFcEffects=(e,t)=>{const i=this;return function(...s){var n,r;let o;if(i.growingIO.vdsConfig.autotrack&&i.growingIO.plugins.gioEventAutoTracking)try{let t=s[0]||{};y(t,"type")&&((null==t?void 0:t.currentTarget)||(null==t?void 0:t.target))||(t=s[s.length-1]),((null==t?void 0:t.currentTarget)||(null==t?void 0:t.target))&&i.actionEventTypes.includes(t.type)&&(a(i.actionEffects)||(i.actionEffects=(null===(r=null===(n=i.growingIO.plugins)||void 0===n?void 0:n.gioEventAutoTracking)||void 0===r?void 0:r.main)||function(){}),null==i||i.actionEffects(t,e))}catch(e){A(e,"error")}return o=t.apply(this,s),o}},this.appApplyProxy=(e,t)=>this.appHandlers.includes(e)?this.lifeFcEffects(e,t,"App"):this.customFcEffects(e,t),this.pageApplyProxy=(e,t)=>this.pageHandlers.includes(e)?this.lifeFcEffects(e,t,"Page"):this.customFcEffects(e,t),this.appOverriding=e=>(this.setAppEffectCbs(),this.supLifeFcs(e,"app"),this.objectTraverse(e,((e,t)=>{this.isNormalFc(e,t[e])&&(t[e]=this.appApplyProxy(e,t[e]))})),e),this.pageOverriding=e=>(this.setPageEffectCbs(),this.supLifeFcs(e,"page"),this.objectTraverse(e,((e,t)=>{this.isNormalFc(e,t[e])&&(t[e]=this.pageApplyProxy(e,t[e]))})),e),this.componentOverriding=e=>(this.setPageEffectCbs(),e.methods||(e.methods={}),this.supLifeFcs(this.growingIO.inPlugin?e:e.methods,"page"),this.objectTraverse(this.growingIO.inPlugin?e:e.methods,((e,t)=>{this.isNormalFc(e,t[e])&&(t[e]=this.pageApplyProxy(e,t[e]))})),e),this.setAppEffectCbs=()=>{const e=this;this.appHandlers.forEach((t=>{this.defAppCbs[t]=function(...i){e.appEffects.main(t,i)}}))},this.setPageEffectCbs=()=>{const e=this;this.pageHandlers.forEach((t=>{this.defPageCbs[t]=function(...i){e.pageEffects.main(this,t,i)}}))},this.growingApp=e=>a(this.originalApp)?this.originalApp(this.appOverriding(e)):this.appOverriding(e),this.growingPage=e=>a(this.originalPage)?this.originalPage(this.pageOverriding(e)):this.pageOverriding(e),this.growingComponent=e=>a(this.originalComponent)?this.originalComponent(this.componentOverriding(e)):this.componentOverriding(e),this.growingBehavior=e=>a(this.originalBehavior)?this.originalBehavior(this.componentOverriding(e)):this.componentOverriding(e),this.nativeGrowing=(e=["App","Page","Component","Behavior"])=>{const t=this,{platformConfig:i}=this.growingIO,s=i.hooks;if(e.includes("App"))try{s.App&&!this.appHooked&&(App=function(...e){return t.originalApp(t.appOverriding(e[0]))},this.appHooked=!0)}catch(e){}if(e.includes("Page"))try{s.Page&&!this.pageHooked&&(Page=function(...e){return t.originalPage(t.pageOverriding(e[0]))},this.pageHooked=!0)}catch(e){}if(e.includes("Component"))try{s.Component&&!this.componentHooked&&(Component=function(...e){return t.originalComponent(t.componentOverriding(e[0]))},this.componentHooked=!0)}catch(e){}if(e.includes("Behavior"))try{s.Behavior&&!this.behaviorHooked&&(Behavior=function(...e){return t.originalBehavior(t.componentOverriding(e[0]))},this.behaviorHooked=!0)}catch(e){}},this.initOriginalValue=()=>{this.setAppEffectCbs(),this.setPageEffectCbs(),this.originalApp=q((()=>App||global.App)),this.originalPage=q((()=>Page||global.Page)),this.originalComponent=q((()=>Component||global.Component)),this.originalBehavior=q((()=>Behavior||global.Behavior))},this.initEventHooks=()=>{const e=this,{platformConfig:t,gioPlatform:i}=this.growingIO;this.initOriginalValue(),t.canHook?(this.nativeGrowing(),Q().GioApp=q((()=>null!==App&&void 0!==App?App:this.originalApp)),Q().GioPage=q((()=>null!==Page&&void 0!==Page?Page:this.originalPage)),Q().GioComponent=q((()=>null!==Component&&void 0!==Component?Component:this.originalComponent)),Q().GioBehavior=q((()=>null!==Behavior&&void 0!==Behavior?Behavior:this.originalBehavior))):"quickapp"===i&&(Q().GioApp=function(...t){return e.appOverriding(t[0])},Q().GioPage=function(...t){return e.pageOverriding(t[0])},Q().GioComponent=function(...t){return e.pageOverriding(t[0])})};const i=null===(t=this.growingIO)||void 0===t?void 0:t.platformConfig;this.defAppCbs={},this.defPageCbs={},this.appHandlers=i.appHandlers,this.pageHandlers=i.pageHandlers,this.actionEventTypes=i.actionEventTypes,this.appEffects=new we(this.growingIO),this.pageEffects=new ke(this.growingIO),this.currentPage=new Pe(this.growingIO)}}class Te{constructor(e){var t,i;this.growingIO=e,this.ALLOW_SETTING_KEYS=b(ie),this.getStorageKey=(e,t)=>{const{inPlugin:i}=this.growingIO;return`${e===this.growingIO.trackingId?"":e}${ge[i?"plugin_"+t:t]}`},this.getGsid=e=>{let t=Number(this._gsid[e]);return Number.isNaN(t)||t>=1e9||1>t?(this.setGsid(e,1),1):t},this.setGsid=(e,t)=>{let i=Number(t);(Number.isNaN(i)||i>=1e9||1>i)&&(i=1),this._gsid[e]=i,10>this._gsid[e]-this._stid[e]||this.saveStorageInfo()},this.initStorageInfo=e=>{const{minipInstance:t}=this.growingIO,i=t.getStorageSync(this.getStorageKey(e,"gsid"));let s=Number(i);(Number.isNaN(s)||s>=1e9||1>s)&&(s=1),this._gsid[e]=s,this._stid[e]=s,s!==i&&t.setStorageSync(this.getStorageKey(e,"gsid"),s)},this.saveStorageInfo=()=>{const{minipInstance:e}=this.growingIO;this._stid=Object.assign({},this._gsid),J(e,this.initializedTrackingIds.map((e=>({key:this.getStorageKey(e,"gsid"),value:this._gsid[e]}))))},this.setOriginalSource=(e,t)=>{const{minipInstance:i}=this.growingIO;i.setStorageSync(this.getStorageKey(e,"originalSource"),JSON.stringify(t))},this.getOriginalSource=e=>{var t;const{minipInstance:i}=this.growingIO;return null!==(t=q((()=>JSON.parse(i.getStorageSync(this.getStorageKey(e,"originalSource"))))))&&void 0!==t?t:{}},this.getTrackerVds=e=>this.growingIO.trackingId===e?Object.assign({},this.growingIO.vdsConfig):void 0,this.initTrackerOptions=e=>{const t=this.initOptions(e);return t.trackingId=e.trackingId,this.growingIO.trackingId=e.trackingId,this.growingIO.vdsConfig=t,t},this.initTrackerHooker=e=>{var t,i;const{platformConfig:s,inPlugin:n,minipInstance:r,plugins:o}=this.growingIO,{uniVue:a,taro:l}=e;a||l||"quickapp"===r.platform||(s.canHook=!0),!n||["tbp","jdp"].includes(r.platform)?this.eventHooks.initEventHooks():this.eventHooks.initOriginalValue(),a&&(null===(t=null==o?void 0:o.gioUniAppAdapter)||void 0===t||t.main()),l&&(null===(i=null==o?void 0:o.gioTaroAdapter)||void 0===i||i.main())},this.initOptions=e=>{var t,i,s,n,r,o;const{projectId:a,dataSourceId:g,appId:u,trackingId:c}=e,d={};return this.ALLOW_SETTING_KEYS.forEach((t=>{const i=ie[t].type;(l(i)?i.includes(E(e[t])):E(e[t])===ie[t].type)?"ignoreFields"===t?d.ignoreFields=e.ignoreFields.filter((e=>ae.includes(e))):"extraParams"===t?d.extraParams=e.extraParams.filter((e=>le.includes(e))):(d[t]=e[t],["dataCollect","autotrack"].includes(t)&&!d[t]&&A("已关闭"+re[t],"info")):d[t]=ie[t].default})),d.uploadInterval=Math.round(d.uploadInterval),(Number.isNaN(d.uploadInterval)||0>d.uploadInterval||d.uploadInterval>3e3)&&(d.uploadInterval=1e3),d.enableIdMapping&&!d.idMapping&&(d.idMapping=!0,d.idMapping||this.growingIO.userStore.setUserKey(c,"")),k(d,"enableIdMapping"),d.pluginMode&&(this.growingIO.inPlugin=!0),!isNaN(Number(d.requestTimeout))&&d.requestTimeout>0||(d.requestTimeout=5e3),Object.assign(Object.assign({},d),{projectId:a,dataSourceId:g,appId:u,trackingId:c,performance:{monitor:null===(i=null===(t=d.performance)||void 0===t?void 0:t.monitor)||void 0===i||i,exception:null===(n=null===(s=d.performance)||void 0===s?void 0:s.exception)||void 0===n||n,network:null!==(o=null===(r=d.performance)||void 0===r?void 0:r.network)&&void 0!==o&&o}})},this.setOption=(e,t,i)=>{var n;const{userStore:r,emitter:o}=this.growingIO,a=this.getTrackerVds(e),l=s(t)&&this.ALLOW_SETTING_KEYS.includes(t),g=l&&typeof i===(null===(n=ie[t])||void 0===n?void 0:n.type);if(l&&g){const s=Object.assign({},a);return this.updateVdsConfig(e,Object.assign(Object.assign({},a),{[t]:i})),"dataCollect"===t&&s.dataCollect!==i&&i&&(r.setSessionId(e),this.sendVisit(e),this.sendPage(e)),o.emit(Ie,{optionName:t,optionValue:i}),!0}return x("setOption > "+t),!1},this.getOption=(e,t)=>{const i=this.getTrackerVds(e);return t&&y(this.growingIO.vdsConfig,t)?y(i,t)?i[t]:this.growingIO.vdsConfig[t]:T(t)?i:void x("getOption > "+t)},this.updateVdsConfig=(e,t)=>{e===this.growingIO.trackingId?(this.growingIO.vdsConfig=Object.assign(Object.assign({},this.growingIO.vdsConfig),t),Q().vdsConfig=this.growingIO.vdsConfig):(this.growingIO.subInstance[e]=Object.assign(Object.assign({},this.growingIO.subInstance[e]),t),Q().vdsConfig.subInstance[e]=this.growingIO.subInstance[e])},this.toggleShareOut=e=>{r(e)?this.shareOut=e:this.shareOut=!this.shareOut},this.sendVisit=(e,t)=>{this.eventHooks.appEffects.buildVisitEvent(e,t)},this.sendPage=(e,t)=>{this.eventHooks.pageEffects.buildPageEvent(e,t)},this.eventConverter=e=>{const{dataStore:t,uploader:i}=this.growingIO,{dataCollect:s}=this.getTrackerVds(e.trackingId);if(s){["LOGIN_USER_ATTRIBUTES","APP_CLOSED"].includes(e.eventType)||(e.eventSequenceId=t.getGsid(e.trackingId),t.setGsid(e.trackingId,e.eventSequenceId+1));const s={};S(e,((e,t)=>{var i;if("element"===t){const t=null!==(i=u(e))&&void 0!==i?i:{};S(t,((e,t)=>{T(e)&&0!==e||(s[t]=e)}))}else T(e)&&0!==e||(s[t]=e)})),this.growingIO.emitter.emit(de,{composedEvent:s}),i.commitRequest(Object.assign(Object.assign({},s),{requestId:H()}))}},this.eventRefactor=e=>{var t,i;const s=Object.assign(Object.assign({},e),this.eventContextBuilder(e.trackingId,{path:e.path,query:e.query,timestamp:e.timestamp}));return s.attributes=Object.assign(Object.assign({},null!==(t=s.attributes)&&void 0!==t?t:{}),null!==(i=e.attributes)&&void 0!==i?i:{}),s},this.eventInterceptor=e=>{const{systemInfo:t,network:i}=this.growingIO.minipInstance;T(t)||T(i)?this.interceptEvents.push(e):T(this.interceptEvents)?this.eventConverter(e):([...this.interceptEvents,e].forEach((e=>{this.eventConverter(this.eventRefactor(e))})),this.interceptEvents=[])},this.eventReleaseInspector=()=>{const{minipInstance:{systemInfo:e,network:t}}=this.growingIO;e&&t&&!T(this.interceptEvents)&&([...this.interceptEvents].forEach((e=>{this.eventConverter(this.eventRefactor(e))})),this.interceptEvents=[])},this.buildAppMessageEvent=(e,t)=>{var i,s;const n=t[0];let r;2>t.length?1===t.length&&(r=n):r=t[1];const{dataStore:{eventContextBuilder:o,eventInterceptor:a}}=this.growingIO,l=((null==r?void 0:r.path)||"").split("?"),g=Object.assign({eventType:"CUSTOM",eventName:"$mp_on_share"},o(e));g.attributes=z(Object.assign(Object.assign(Object.assign({},null!==(i=g.attributes)&&void 0!==i?i:{}),{$from:n.from,$target:null===(s=null==n?void 0:n.target)||void 0===s?void 0:s.id,$share_title:null==r?void 0:r.title,$share_path:u(l),$share_query:l[1]}),null==r?void 0:r.attributes)),a(g)},this.buildTimelineEvent=(e,t)=>{var i,s;const n=t[0];let r;2>t.length?1===t.length&&(r=n):r=t[1];const{dataStore:{eventContextBuilder:o,eventInterceptor:a}}=this.growingIO,l=((null==r?void 0:r.path)||"").split("?"),g=Object.assign({eventType:"CUSTOM",eventName:"$mp_share_timeline"},o(e));g.attributes=z(Object.assign(Object.assign(Object.assign({},null!==(i=g.attributes)&&void 0!==i?i:{}),{$target:null===(s=null==n?void 0:n.target)||void 0===s?void 0:s.id,$share_title:null==r?void 0:r.title,$share_path:u(l),$share_query:l[1]}),null==r?void 0:r.attributes)),a(g)},this.buildAddFavorites=(e,t)=>{var i;const s=t[0];let n;2>t.length?1===t.length&&(n=s):n=t[1];const{dataStore:{eventContextBuilder:r,eventInterceptor:o}}=this.growingIO,a=((null==n?void 0:n.path)||"").split("?"),l=Object.assign({eventType:"CUSTOM",eventName:"$mp_add_favorites"},r(e));l.attributes=z(Object.assign(Object.assign({},null!==(i=l.attributes)&&void 0!==i?i:{}),{$share_title:null==n?void 0:n.title,$share_path:u(a),$share_query:a[1]})),o(l)},this.trackersExecute=e=>{this.initializedTrackingIds.forEach((t=>{"function"===E(e)&&e(t)}))},this.initializedTrackingIds=[],this.eventContextBuilder=new be(this.growingIO).main,this.eventHooks=new _e(this.growingIO),this.shareOut=!1,this._gsid={},this._stid={},this.lastVisitEvent={},this.lastPageEvent={},this.locationData={},this.generalProps={},this.trackTimers={},this.interceptEvents=[];const{emitter:n,minipInstance:o}=this.growingIO;n.on(ye,(({trackingId:e})=>{this.initializedTrackingIds.push(e),this.initStorageInfo(e)})),n.on(ce,(({eventData:e,trackingId:t})=>{"VISIT"===e.eventType&&(this.lastVisitEvent[t]=e),"PAGE"===e.eventType&&(this.lastPageEvent[t]=e)})),a(null===(t=o.minip)||void 0===t?void 0:t.onAppHide)&&o.minip.onAppHide((()=>{this.trackersExecute((e=>{const t=this.trackTimers[e];S(t,(e=>{e.start&&(e.leng=e.leng+(+Date.now()-e.start))}))}))})),a(null===(i=o.minip)||void 0===i?void 0:i.onAppShow)&&o.minip.onAppShow((()=>{this.trackersExecute((e=>{const t=this.trackTimers[e];S(t,(e=>{e.start&&(e.start=+Date.now())}))}))})),n.on(Ie,(({optionName:e,optionValue:t})=>{"dataCollect"===e&&!1===t&&this.trackersExecute((e=>{this.growingIO.clearTrackTimer(e)}))}))}get scene(){return this._scene}set scene(e){const t=this._scene;this._scene=e,t!==this._scene&&this.growingIO.emitter.emit("SCENE_UPDATE",{newScene:e,oldScene:t})}}const Ee={scnPrefix:"",appHandlers:["onLaunch","onShow","onHide","onError","onPageNotFound","onUnhandledRejection","onThemeChange"],pageHandlers:["onLoad","onShow","onReady","onHide","onShareAppMessage","onTabItemTap","onUnload","onPullDownRefresh","onReachBottom","onResize"],actionEventTypes:["onclick","tap","onTap","longpress","longTap","blur","change","onChange","submit","confirm","getuserinfo","getphonenumber","contact","mouseup"],canHook:!0,hooks:{App:!0,Page:!0,Component:!0,Behavior:!0},listeners:{app:{appLaunch:"onLaunch",appShow:"onShow",appClose:"onHide"},page:{pageLoad:"onLoad",pageShow:"onShow",pageReady:"onReady",pageHide:"onHide",pageUnload:"onUnload",tabTap:"onTabItemTap",shareApp:"onShareAppMessage"},actions:{click:["onclick","tap","longpress","longTap","getuserinfo","getphonenumber","contact","mouseup"],change:["blur","change","confirm"],submit:["submit"]}}},Ce=Object.assign(Object.assign({},Ee),{listeners:Object.assign({},Ee.listeners),name:"JingDong",platform:"jdp",scnPrefix:"jd_"}),je=Object.assign(Object.assign({},Ee),{listeners:Object.assign({},Ee.listeners),name:"KuaiShou",platform:"kuaishoup",scnPrefix:"ks_"}),Ae=Object.assign(Object.assign({},Ee),{listeners:Object.assign({},Ee.listeners),name:"Alipay",platform:"alip",scnPrefix:"alip_",hooks:Object.assign(Object.assign({},Ee.hooks),{Behavior:!1})}),xe=Object.assign(Object.assign({},Ee),{pageHandlers:[...Ee.pageHandlers,"onInit","didMount","didUnmount"],listeners:Object.assign(Object.assign({},Ee.listeners),{page:Object.assign(Object.assign({},Ee.listeners.page),{onInit:"onInit",didMount:"didMount",didUnmount:"didUnmount"})}),name:"Taobao",platform:"tbp",scnPrefix:"tbp_",hooks:Object.assign(Object.assign({},Ee.hooks),{Behavior:!1})}),qe=Object.assign(Object.assign({},Ee),{listeners:Object.assign({},Ee.listeners),name:"QQ",platform:"qq",scnPrefix:"qq_"});qe.pageHandlers=[...Ee.pageHandlers,"onAddToFavorites"],qe.listeners.page.addFavorites="onAddToFavorites";const Ne=Object.assign(Object.assign({},Ee),{listeners:Object.assign({},Ee.listeners),name:"Baidu",platform:"baidup",scnPrefix:"baidup_"}),Ue=Object.assign(Object.assign({},Ee),{listeners:Object.assign({},Ee.listeners),name:"Bytedance",platform:"bytedance",scnPrefix:"bytedance_"}),Ke=Object.assign(Object.assign({},Ee),{listeners:Object.assign({},Ee.listeners),name:"Weixin",platform:"MinP"});Ke.pageHandlers=[...Ee.pageHandlers,"onShareTimeline","onAddToFavorites"],Ke.listeners.page=Object.assign(Object.assign({},Ee.listeners.page),{shareTime:"onShareTimeline",addFavorites:"onAddToFavorites"});const $e=G(),He=q((()=>{const e={jd:Ce,ks:je,my:Ae,tb:xe,qq:qe,swan:Ne,tt:Ue,wx:Ke}[$e];return e.canHook=!1,e}));class Ve{constructor(e){this.growingIO=e,this.minip=B("framework"),this.hookSetTitle=()=>{var e;const t=null===(e=this.minip)||void 0===e?void 0:e.setNavigationBarTitle,i=this;t&&Object.defineProperty(this.minip,"setNavigationBarTitle",{writable:!0,enumerable:!0,configurable:!0,value:function(){if(i.growingIO.gioSDKInitialized){const e=i.getCurrentPath(),{title:t}=arguments[0]||{};i.growingIO.dataStore.eventHooks.currentPage.settedTitle[e]=t}return t.apply(this,arguments)}})},this.navigateTo=e=>{var t;return null===(t=this.minip)||void 0===t?void 0:t.navigateTo(e)},this.switchTab=e=>{var t;null===(t=this.minip)||void 0===t||t.switchTab(e)},this.navigateToMiniProgram=e=>{var t;return null===(t=this.minip)||void 0===t?void 0:t.navigateToMiniProgram(e)},this.getImageInfo=({src:e,success:t,fail:i,complete:s})=>{var n;return null===(n=this.minip)||void 0===n?void 0:n.getImageInfo({src:e,success:t,fail:i,complete:s})},this.initImpression=e=>{var t,i;null===(i=null===(t=this.growingIO.plugins)||void 0===t?void 0:t.gioImpressionTracking)||void 0===i||i.main(e,"observeAll")},this.getCurrentPage=()=>q((()=>c(getCurrentPages())))||{},this.getCurrentPath=()=>{const e=this.getCurrentPage();return(null==e?void 0:e.route)||(null==e?void 0:e.uri)||(null==e?void 0:e.__route__)||""},this.getPageTitle=e=>{var t;const i=G();let n="",r=M(i);"string"===E(r)&&(r=null!==(t=q((()=>JSON.parse(r))))&&void 0!==t?t:{});const o=(null==e?void 0:e.data)||e.$data||{};if(n=s(null==o?void 0:o.gioPageTitle)?null==o?void 0:o.gioPageTitle:"",r){const{enterParams:t}=this.growingIO.dataStore.eventHooks.appEffects;e.route||T(t)||(e.route=t.path||"",n=this._getTitleFromTabbar(r,e.route)),q((()=>{var t,s,o,a,l,g;if(!n){const u=r.page||{},c=u[e.route]||u[e.route+".html"];n=c?null===(t=null==c?void 0:c.window)||void 0===t?void 0:t.navigationBarTitleText:["wx","tt"].includes(i)?null===(a=null===(o=null===(s=r||global||$global)||void 0===s?void 0:s.global)||void 0===o?void 0:o.window)||void 0===a?void 0:a.navigationBarTitleText:null===(g=null===(l=r||global||$global)||void 0===l?void 0:l.window)||void 0===g?void 0:g.navigationBarTitleText}})),n||(n=this._getTitleFromTabbar(r,e.route))}return U(n)},this._getTitleFromTabbar=(e,t)=>{var i,s;const n=null===(s=null===(i=null==e?void 0:e.tabBar)||void 0===i?void 0:i.list)||void 0===s?void 0:s.find((e=>e.pagePath===t||e.pagePath===t+".html"));return(null==n?void 0:n.text)||""},this.getStorageSync=e=>{var t;let i=null===(t=this.minip)||void 0===t?void 0:t.getStorageSync(e);return o(i)&&i.expiredAt?i.expiredAt<Date.now()?"":i.value:i},this.getStorage=e=>new Promise((t=>{var i;null===(i=this.minip)||void 0===i||i.getStorage({key:e,success:({data:e})=>t(e),fail:()=>t("")})})),this.setStorageSync=(e,t,i)=>{var s;i&&(t={value:t,expiredAt:i}),null===(s=this.minip)||void 0===s||s.setStorageSync(e,t)},this.setStorage=(e,t)=>{var i;null===(i=this.minip)||void 0===i||i.setStorage({key:e,data:t})},this.removeStorageSync=e=>{var t;null===(t=this.minip)||void 0===t||t.removeStorageSync(e)},this.removeStorage=e=>{var t;null===(t=this.minip)||void 0===t||t.removeStorage(e)},this.getNetworkType=()=>{const e=this;return new Promise((t=>{var i;null===(i=this.minip)||void 0===i||i.getNetworkType({success:i=>{e.network=i,t(i)},fail:()=>t(null)})}))},this.request=({url:e,data:t,header:i,timeout:s,method:n,success:r,fail:o,complete:l})=>{var g;const u=null===(g=this.minip)||void 0===g?void 0:g.request({url:e,data:t,header:i,headers:i,timeout:s,method:n,success:r,fail:o,complete:l});let c=setTimeout((()=>{(null==u?void 0:u.abort)&&a(null==u?void 0:u.abort)&&(null==u||u.abort()),clearTimeout(c),c=null}),(s||1e4)+10);return u},this.getSystemInfo=()=>{const e=this;return new Promise((t=>{var i;null===(i=this.minip)||void 0===i||i.getSystemInfo({success:i=>{e.systemInfo=i,t(i)},fail:()=>t(null)})}))},this.getSetting=()=>new Promise((e=>{var t;null===(t=this.minip)||void 0===t||t.getSetting({success:e,fail:e})}));const{platformConfig:{platform:t,scnPrefix:i}}=this.growingIO;this.platform=t,this.scnPrefix=i,this.growingIO.emitter.on(Oe,(()=>{this.getNetworkType().then((()=>{var e;return null===(e=this.growingIO.dataStore)||void 0===e?void 0:e.eventReleaseInspector()})),this.getSystemInfo().then((()=>{var e;return null===(e=this.growingIO.dataStore)||void 0===e?void 0:e.eventReleaseInspector()}))}))}}const De=G();var Le={wx:class extends Ve{constructor(e){super(e),this.growingIO=e,this.hookSetTitle()}},swan:class extends Ve{constructor(e){super(e),this.growingIO=e,this.initImpression=e=>{var t,i;null===(i=null===(t=this.growingIO.plugins)||void 0===t?void 0:t.gioImpressionTracking)||void 0===i||i.main(e,"selectAll")},this.hookSetTitle()}},my:class extends Ve{constructor(e){super(e),this.growingIO=e,this.hookSetTitle=()=>{var e;const t=null===(e=this.minip)||void 0===e?void 0:e.setNavigationBar,i=this;t&&Object.defineProperty(this.minip,"setNavigationBar",{writable:!0,enumerable:!0,configurable:!0,value:function(){if(i.growingIO.gioSDKInitialized){const e=i.getCurrentPath(),{title:t}=arguments[0]||{};i.growingIO.dataStore.eventHooks.currentPage.settedTitle[e]=t}return t.apply(this,arguments)}})},this.initImpression=e=>{var t,i;null===(i=null===(t=this.growingIO.plugins)||void 0===t?void 0:t.gioImpressionTracking)||void 0===i||i.main(e,"selectAll")},this.getStorageSync=e=>{const{data:t}=my.getStorageSync({key:e});return t},this.setStorageSync=(e,t)=>{var i;null===(i=this.minip)||void 0===i||i.setStorageSync({key:e,data:t})},this.removeStorageSync=e=>{var t;null===(t=this.minip)||void 0===t||t.removeStorageSync({key:e})},this.hookSetTitle()}},qq:class extends Ve{constructor(e){super(e),this.growingIO=e,this.hookSetTitle()}},tt:class extends Ve{constructor(e){super(e),this.growingIO=e,this.hookSetTitle()}},ks:class extends Ve{constructor(e){super(e),this.growingIO=e,this.hookSetTitle()}},jd:class extends Ve{constructor(e){super(e),this.growingIO=e,this.hookSetTitle()}}}[De];const Fe=["gioPerformance"];class Re{constructor(e){var t,i,s,n,r,o;this.growingIO=e,this.innerPluginInit=()=>{var e;Fe.forEach((e=>{var t;return k(null===(t=this.pluginsContext)||void 0===t?void 0:t.plugins,e)})),b(null===(e=this.pluginsContext)||void 0===e?void 0:e.plugins).forEach((e=>{var t,i;const{name:s,method:n}=null!==(i=null===(t=this.pluginsContext)||void 0===t?void 0:t.plugins[e])&&void 0!==i?i:{};p(this.pluginItems,(e=>e.name===s))||this.pluginItems.push({name:f(s||e),method:n||(e=>{})})})),T(this.pluginItems)||this.installAll()},this.install=(e,t,i)=>{var s,n;const{emitter:r}=this.growingIO,o=t||p(this.pluginItems,(t=>t.name===e));if((null===(s=this.growingIO)||void 0===s?void 0:s.plugins)[e])return A(`重复加载插件 ${e} 或插件重名,已跳过加载!`,"warn"),!1;if(!o)return A(`插件加载失败!不存在名为 ${e} 的插件!`,"error"),!1;try{return(null===(n=this.growingIO)||void 0===n?void 0:n.plugins)[e]=new o.method(this.growingIO,i),t&&(r.emit(ve,e),A("加载插件 "+e,"info")),!0}catch(i){return this.lifeError(t,i),A(`插件【${e}】加载异常 ${i}`,"error"),!1}},this.installAll=e=>{(e||this.pluginItems).forEach((t=>{this.install(t.name,e?t:void 0,e?null==t?void 0:t.options:void 0)&&!p(this.pluginItems,(e=>e.name===t.name))&&this.pluginItems.push({name:f(t.name),method:t.method?t.method:()=>{}})}))},this.uninstall=e=>{var t;k(this.pluginItems,e);const i=k(null===(t=this.growingIO)||void 0===t?void 0:t.plugins,e);return i||A(`卸载插件 ${e} 失败!`,"error"),i},this.uninstallAll=()=>{this.pluginItems.forEach((e=>this.uninstall(e.name)))},this.lifeError=(e,t)=>{this.growingIO.emitter.emit(pe,{plugin:e,error:t}),A(`插件执行错误 ${e.name} ${t}`,"error")},this.callLifeCycle=(e,t)=>{this.pluginItems.forEach((i=>{const s=this.growingIO.plugins[i.name]?this.growingIO.plugins[i.name][e]:void 0;if(s&&a(s))try{s(t)}catch(e){this.lifeError(i,e)}}))},this.pluginsContext={plugins:{}},this.pluginItems=[],null===(t=this.growingIO.emitter)||void 0===t||t.on(ve,(e=>this.callLifeCycle("onInstall",e))),null===(i=this.growingIO.emitter)||void 0===i||i.on(pe,(e=>this.callLifeCycle("onError",e))),null===(s=this.growingIO.emitter)||void 0===s||s.on(he,(e=>this.callLifeCycle("onComposeBefore",e))),null===(n=this.growingIO.emitter)||void 0===n||n.on(de,(e=>this.callLifeCycle("onComposeAfter",e))),null===(r=this.growingIO.emitter)||void 0===r||r.on(fe,(e=>this.callLifeCycle("onSendBefore",e))),null===(o=this.growingIO.emitter)||void 0===o||o.on(me,(e=>this.callLifeCycle("onSendAfter",e)))}}let Be;var Me={name:"gioUniAppAdapter",method:class{constructor(t){var i,s;this.growingIO=t,this.main=()=>{var e,t;switch(this.uniVue||(this.uniVue=null===(t=null===(e=this.growingIO)||void 0===e?void 0:e.vdsConfig)||void 0===t?void 0:t.uniVue),console.log("Vue version: ",this.uniVue.version),Number(Be.head(Be.split(this.uniVue.version,".")))){case 2:this.growingIO.dataStore.eventHooks.nativeGrowing();break;case 3:this.uniVue3Proxy(this.uniVue);break;default:Be.consoleText("不支持的Vue版本,请使用 Vue2 或 Vue3!","error")}},this.getHandlerName=(e,t)=>{var i;if("__e"===e){let e="__e";const{type:i,currentTarget:s,target:n}=t,r=(null==s?void 0:s.dataset)||(null==n?void 0:n.dataset);if(r){const t=r.eventOpts||r["event-opts"],s=(e,t)=>e===t||"regionchange"===t&&("begin"===e||"end"===e);t&&t.forEach((t=>{let n=Be.head(t);const r="^"===n.charAt(0);n=r?n.slice(1):i;const o="~"===n.charAt(0);n=o?n.slice(1):i;const a=Be.last(t);s(i,n)&&(e=Be.head(Be.head(a)))}))}return e}return Be.isEmpty(this.exposedNames)?e:null!==(i=this.exposedNames[e])&&void 0!==i?i:e},this.uniVue3Proxy=t=>{const{dataStore:{eventHooks:i},minipInstance:s}=this.growingIO;i.objectTraverse=(e,t)=>{Be.has(e,"methods")&&Object.getOwnPropertyNames(e.methods).forEach((i=>{t(i,e.methods)})),Be.has(e,"lifetimes")&&Object.getOwnPropertyNames(e.lifetimes).forEach((i=>{t(i,e.lifetimes)})),Be.has(e,"pageLifetimes")&&Object.getOwnPropertyNames(e.pageLifetimes).forEach((i=>{t(i,e.pageLifetimes)})),Object.getOwnPropertyNames(e).forEach((i=>{Be.niceTry((()=>!(null==e?void 0:e.methods[i])&&!(null==e?void 0:e.lifetimes[i])&&!(null==e?void 0:e.pageLifetimes[i])))||t(i,e)}))},i.nativeGrowing();const n=s.getPageTitle;s.getPageTitle=function(...e){var t,i,r;let o=Be.isEmpty(e[0])?s.getCurrentPage():e[0];if("page"===(null===(t=null==o?void 0:o.$vm)||void 0===t?void 0:t.mpType)&&(null===(i=null==o?void 0:o.$vm)||void 0===i?void 0:i.__route__)){return(null===(r=null==o?void 0:o.$vm)||void 0===r?void 0:r.gioPageTitle)||n.apply(this,e)}return n.apply(this,e)};const r=this;t.mixin({beforeMount(){var t,s;const n=(e,t)=>Be.isFunction(t)&&!i.pageHandlers.includes(e)?function(...s){return i.customFcEffects(e,t).apply(this,s)}:t,o=(e,t)=>Be.keys(e).forEach((e=>{Be.isFunction(t[e])&&Object.defineProperty(t,e,{value:n(e,t[e]),configurable:!0,writable:!0})})),a=this.$options.methods;a&&o(a,this);const l=null===(t=null==this?void 0:this._)||void 0===t?void 0:t.setupState;l&&o(l,l);const g=null===(s=null==this?void 0:this._)||void 0===s?void 0:s.exposed;if(r.exposedNames={},g){const t=Be.keys(g);t.forEach((e=>{Be.isFunction(g[e])&&(r.exposedNames[g[e].name]=e)})),Be.keys(this.$scope).filter((t=>e.test(t)&&Be.isFunction(this.$scope[t]))).forEach(((e,s)=>{const n=this.$scope[e].value,o=r.splicingMethodName(n.name,e,t[s]);this.$scope[e].value=i.customFcEffects(o,n)}))}const u=this._.emit;this._.emit=function(...e){return(()=>{i.customFcEffects(e[0],(()=>{})).apply(this,e)})(),u.apply(this,e)}}})},this.splicingMethodName=(e,t,i)=>e||(i?`${t}#${i}`:t),this.pluginVersion="__PLUGIN_VERSION__",Be=this.growingIO.utils,this.uniVue=null===(s=null===(i=this.growingIO)||void 0===i?void 0:i.vdsConfig)||void 0===s?void 0:s.uniVue,this.exposedNames={}}}};class Ge extends Re{constructor(e){super(e),this.growingIO=e,this.pluginsContext={plugins:{gioUniAppAdapter:Me}}}}var Qe={},ze={}.hasOwnProperty;function We(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(e){return null}}function Je(e){try{return encodeURIComponent(e)}catch(e){return null}}Qe.stringify=function(e,t){t=t||"";var i,s,n=[];for(s in"string"!=typeof t&&(t="?"),e)if(ze.call(e,s)){if((i=e[s])||null!=i&&!isNaN(i)||(i=""),s=Je(s),i=Je(i),null===s||null===i)continue;n.push(s+"="+i)}return n.length?t+n.join("&"):""},Qe.parse=function(e){for(var t,i=/([^=?#&]+)=?([^&]*)/g,s={};t=i.exec(e);){var n=We(t[1]),r=We(t[2]);null===n||null===r||n in s||(s[n]=r)}return s};class Ye{constructor(e){this.growingIO=e,this.generateURL=e=>{const{serverUrl:t,projectId:i}=this.growingIO.dataStore.getTrackerVds(e);return I(t,"http")?`${t}/v3/projects/${i}/collect`:`https://${t}/v3/projects/${i}/collect`},this.getHoardingQueue=e=>{var t;return null!==(t=this.hoardingQueue[e])&&void 0!==t?t:[]},this.getRequestQueue=e=>{var t;return null!==(t=this.requestQueue[e])&&void 0!==t?t:[]},this.commitRequest=e=>{var t,s;const n=Object.assign({},e),{vdsConfig:r,emitter:o}=this.growingIO;o.emit(ce,{eventData:e,trackingId:e.trackingId}),r.forceLogin?(i(this.hoardingQueue[e.trackingId])&&(this.hoardingQueue[e.trackingId]=[]),null===(t=this.hoardingQueue[e.trackingId])||void 0===t||t.push(n)):(i(this.requestQueue[e.trackingId])&&(this.requestQueue[e.trackingId]=[]),null===(s=this.requestQueue[e.trackingId])||void 0===s||s.push(n),this.initiateRequest(e.trackingId))},this.initiateRequest=(e,t)=>{const{plugins:i,vdsConfig:s,minipInstance:n,dataStore:r}=this.growingIO,o=[...this.getHoardingQueue(e),...this.getRequestQueue(e)],a=e=>{var a,l;if(null===(a=null==s?void 0:s.tbConfig)||void 0===a?void 0:a.cloudFuncSend)null===(l=null==i?void 0:i.gioTaobaoAdapter)||void 0===l||l.singleInvoke(e);else if(t)this.batchInvoke(e);else{const{uploadInterval:t}=this.growingIO.dataStore.getTrackerVds(e);_(this.batchInvoke,t,!1,!1)(e)}o.some((e=>"VISIT"===e.eventType))&&n.removeStorageSync(r.getStorageKey(e,"originalSource"))};if(o.length>0)if(this.requestingNum<this.requestLimit)a(e);else{let t=setInterval((()=>{this.requestingNum<this.requestLimit&&(a(e),clearInterval(t),t=void 0)}),500)}},this.batchInvoke=e=>{const{vdsConfig:t,emitter:i}=this.growingIO,s=this.getHoardingQueue(e),n=this.getRequestQueue(e);let r=[...s,...n];r.length>50?(r=r.slice(0,50),s.length>50?this.hoardingQueue[e]=s.slice(50):(this.requestQueue[e]=n.slice(50-s.length),this.hoardingQueue[e]=[])):(this.hoardingQueue[e]=[],this.requestQueue[e]=[]);let o=r.filter((e=>(this.retryIds[e.requestId]||0)<=this.retryLimit));if(T(o))return;const a=o.map((e=>{const t=Object.assign({},e);return k(t,["requestId","trackingId"]),t}));t.debug&&console.log("[GrowingIO Debug]:",JSON.stringify(a,null,2)),i.emit(fe,{eventsQueue:o,requestData:a,trackingId:e})},this.sendEvent=(e,t)=>{var i;const s=u(e).trackingId,{minipInstance:n,dataStore:r,emitter:o,plugins:a}=this.growingIO,{compress:l,requestTimeout:g}=r.getTrackerVds(s);this.requestingNum+=1;const c={"content-type":"jdp"===n.platform?"application/json":"application/json;charset=UTF-8"};let d=[...t];const h=!!l&&(null===(i=null==a?void 0:a.gioCompress)||void 0===i?void 0:i.compressToUTF16);h&&(d=a.gioCompress.compressToUTF16(JSON.stringify(t)),c["X-Compress-Codec"]="1");const p=this.generateURL(s);n.request({url:`${p}?stm=${Date.now()}&compress=${h?"1":"0"}`,header:c,method:"POST",data:d,timeout:g,fail:t=>{[200,204].includes(t.code)||(e.forEach((e=>{this.requestFailFn(e)})),A("请求失败!"+JSON.stringify(t),"error"))},complete:e=>{this.requestingNum-=1,o.emit(me,{result:e,requestData:t}),this.initiateRequest(s)}})},this.requestFailFn=e=>{if(this.retryIds[e.requestId]||(this.retryIds[e.requestId]=0),this.retryIds[e.requestId]+=1,!this.requestQueue[e.trackingId].some((t=>t.requestId===e.requestId))){let t=setTimeout((()=>{T(this.requestQueue[e.trackingId])?(this.requestQueue[e.trackingId].push(e),this.initiateRequest(e.trackingId)):this.requestQueue[e.trackingId].push(e),clearTimeout(t),t=null}),800)}},this.hoardingQueue={},this.requestQueue={},this.requestLimit=3,this.retryLimit=2,this.retryIds={},this.requestingNum=0;const{emitter:t,vdsConfig:s,plugins:n}=this.growingIO;t.on(fe,(({eventsQueue:e,requestData:t,trackingId:i})=>{var r,o;i===this.growingIO.trackingId&&((null===(r=null==s?void 0:s.tbConfig)||void 0===r?void 0:r.cloudAppId)?null===(o=null==n?void 0:n.gioTaobaoAdapter)||void 0===o||o.tbCloudAppInvoke(e,t):this.sendEvent(e,t))}))}}class Ze{constructor(e){this.growingIO=e,this._getUidKey=()=>this.growingIO.inPlugin?"_growing_plugin_uid_":"_growing_uid_",this.getUid=()=>{const{minipInstance:e}=this.growingIO;return this._uid||(this._uid=e.getStorageSync(this._getUidKey())),this._uid||(this._uid=H(),e.setStorage(this._getUidKey(),this._uid)),this._uid},this.setUid=e=>{const t=this._uid;this._uid=e,t!==this._uid&&(this.growingIO.minipInstance.setStorage(this._getUidKey(),this._uid),this.growingIO.emitter.emit("UID_UPDATE",{newUId:e,oldUId:t}))},this.getSessionId=e=>(this._sessionId[e]||this.setSessionId(e),this._sessionId[e]),this.setSessionId=(e,t)=>{const i=this._sessionId[e];t||(t=H()),this._sessionId[e]=t,i!==t&&this.growingIO.emitter.emit("SESSIONID_UPDATE",{newSessionId:t,oldSessionId:i})},this._getUserIdKey=e=>this.growingIO.dataStore.getStorageKey(e,"userId"),this.getUserId=e=>{const{minipInstance:t}=this.growingIO;return this._userId[e]||(this._userId[e]=t.getStorageSync(this._getUserIdKey(e))),this._userId[e]},this.setUserId=(e,t)=>{const s=this._userId[e];this._userId[e]=i(t)?"":t,s!==this._userId[e]&&(this.growingIO.minipInstance.setStorage(this._getUserIdKey(e),this._userId[e]),this.growingIO.emitter.emit("USERID_UPDATE",{newUserId:t,oldUserId:s})),t&&this.setGioId(e,t)},this._getUserKeyKey=e=>this.growingIO.dataStore.getStorageKey(e,"userKey"),this.getUserKey=e=>{const{minipInstance:t}=this.growingIO;return this._userKey[e]||(this._userKey[e]=t.getStorageSync(this._getUserKeyKey(e))),this._userKey[e]},this.setUserKey=(e,t)=>{const s=this._userKey[e];this._userKey[e]=i(t)?"":t,s!==this._userKey[e]&&(this.growingIO.minipInstance.setStorage(this._getUserKeyKey(e),this._userKey[e]),this.growingIO.emitter.emit("USERKEY_UPDATE",{newUserKey:t,oldUserKey:s}))},this._getGioIdKey=e=>this.growingIO.dataStore.getStorageKey(e,"gioId"),this.getGioId=e=>{const{minipInstance:t}=this.growingIO;return this._gioId[e]||(this._gioId[e]=t.getStorageSync(this._getGioIdKey(e))),this._gioId[e]},this.setGioId=(e,t)=>{const s=this._gioId[e];this._gioId[e]=i(t)?"":t,s!==this._gioId[e]&&(this.growingIO.minipInstance.setStorage(this._getGioIdKey(e),this._gioId[e]),this.growingIO.emitter.emit("GIOID_UPDATE",{newGioId:t,oldGioId:s}))},this.initUserInfo=e=>{var t;const{minipInstance:i}=this.growingIO,s=[this._getUidKey(),this._getUserIdKey(e),this._getUserKeyKey(e),this._getGioIdKey(e)],n=null!==(t=W(i,s))&&void 0!==t?t:[];["_uid","_userId","_userKey","_gioId"].forEach(((t,i)=>{"_uid"===t?this.getUid():this[t][e]=n[i]}))},this.saveUserInfo=()=>{const{minipInstance:e,dataStore:{trackersExecute:t}}=this.growingIO;t((t=>{J(e,[{key:this._getUidKey(),value:this._uid},{key:this._getUserIdKey(t),value:this._userId[t]},{key:this._getUserKeyKey(t),value:this._userKey[t]},{key:this._getGioIdKey(t),value:this._gioId[t]}])}))},this._uid=void 0,this._sessionId={},this._userId={},this._userKey={},this._gioId={}}}const Xe=new class{constructor(){var e;this.init=e=>{var t;this.emitter.emit("ON_SDK_INITIALIZE_BEFORE",{options:e});try{if(A("Gio小程序SDK 初始化中...","info"),e.trackingId&&this.dataStore.initializedTrackingIds.includes(e.trackingId))throw Error(`已存在实例 ${e.trackingId},请勿重复初始化!`);if(this.trackingId&&!this.plugins.gioMultipleInstances)throw Error("您正在尝试初始化另一个实例,请集成多实例插件后重试!");const i=this.dataStore.initTrackerOptions(e);return null===(t=this.emitter)||void 0===t||t.emit(Oe,i),this.gioSDKInitialized=!0,this.dataStore.initTrackerHooker(i),"quickapp"!==this.gioPlatform&&this.userStore.initUserInfo(e.trackingId),this.emitter.emit(ye,i),this.trackingId&&this.trackingId!==e.trackingId||(Q().__gio__=()=>this),A("Gio小程序SDK 初始化完成!","success"),this.inPlugin&&"tbp"!==this.minipInstance.platform&&this.dataStore.sendVisit(i.trackingId),this.vdsConfig.forceLogin&&A("forceLogin已开启,请调用 identify 方法设置 openId 以继续上报!","info"),!0}catch(e){return A(e,"error"),!1}},this.handlerDistribute=(e,t,i)=>{const{initializedTrackingIds:s,getTrackerVds:n}=this.dataStore;if(n(e)&&s.includes(e))return this[t](e,...i);A(`不存在实例:${e},请检查!`,"warn")},this.registerPlugins=e=>{this.plugins.pluginItems=[...this.plugins.pluginItems,...e],this.plugins.installAll(e)},this.getPlugins=()=>this.plugins.pluginItems,this.getDeviceId=()=>this.userStore.getUid(),this.getOption=(e,t)=>this.dataStore.getOption(e,t),this.setOption=(e,t,i)=>{var s;return b(re).includes(t)?typeof i===(null===(s=ie[t])||void 0===s?void 0:s.type)?(this.dataStore.setOption(e,t,i),A(`已修改${re[t]}: ${i}`,"info"),!0):(A(`参数格式不正确:${i},请检查后重试!`,"error"),!1):(A(`不存在可修改的配置项:${t},请检查后重试!`,"error"),!1)},this.setPageAttributes=(e,t)=>{if(o(t)&&!T(t)){const{currentPage:i}=this.dataStore.eventHooks,s=i.getPagePath();return T(i.pageProps[e])&&(i.pageProps[e]={}),T(i.pageProps[e][s])&&(i.pageProps[e][s]={}),T(t)||S(t,((t,n)=>{a(i.pageProps[e][s][n])&&!a(t)||(i.pageProps[e][s][n]=t)})),!0}return x("setPageAttributes"),!1},this.clearPageAttributes=(e,t)=>{try{if(!T(this.dataStore.eventHooks.currentPage.pageProps[e])){const{currentPage:i}=this.dataStore.eventHooks,s=i.getPagePath();l(t)&&!T(t)?t.forEach((t=>{k(i.pageProps[e][s],t)})):i.pageProps[e][s]={}}}catch(e){return x("clearPageAttributes"),!1}},this.sendPage=(e,t)=>{const{trackPage:i}=this.dataStore.getTrackerVds(e);i?A("仅在关闭trackPage时允许调用sendPage,请确认后修改初始化配置项!","error"):this.dataStore.sendPage(e,t)},this.identify=(e,t)=>{if(e===this.trackingId)if(this.vdsConfig.forceLogin){if(!te(t))return void x("identify");const e=v(t).slice(0,1e3);this.userStore.setUid(e),this.dataStore.setOption(this.trackingId,"forceLogin",!1),this.dataStore.trackersExecute((t=>{const i=this.uploader.getHoardingQueue(t);i.forEach(((t,s)=>i[s].deviceId=e)),this.uploader.initiateRequest(t,!0)}))}else x("identify",!1,"forceLogin未开启");else x("identify",!1,"子实例不允许调用identify")},this.setUserAttributes=(e,t)=>{var i,s,n,r;if(o(t)&&!T(t)){const{eventContextBuilder:o,eventInterceptor:a,lastVisitEvent:l}=this.dataStore,g=Object.assign({eventType:"LOGIN_USER_ATTRIBUTES"},o(e));g.attributes=z(Object.assign(Object.assign({},null!==(i=g.attributes)&&void 0!==i?i:{}),$(t))),g.path||(g.path=null===(s=l[e])||void 0===s?void 0:s.path,g.query=null===(n=l[e])||void 0===n?void 0:n.query,g.title=null===(r=l[e])||void 0===r?void 0:r.title),a(g)}else x("setUserAttributes")},this.setUserId=(e,t,s)=>{if(te(t)){const n=this.userStore.getGioId(e);t=v(t).slice(0,1e3),s=v(s).slice(0,1e3),this.userStore.setUserId(e,t);const{idMapping:r}=this.dataStore.getTrackerVds(e);r&&this.userStore.setUserKey(e,i(s)?"":s),n&&n!==t&&(this.userStore.setSessionId(e),this.dataStore.sendVisit(e))}else x("setUserId")},this.clearUserId=e=>{this.userStore.setUserId(e,void 0),this.userStore.setUserKey(e,void 0)},this.setGeneralProps=(e,t)=>o(t)&&!T(t)?(T(this.dataStore.generalProps[e])&&(this.dataStore.generalProps[e]={}),S(t,((t,i)=>{a(this.dataStore.generalProps[e][i])&&!a(t)||(this.dataStore.generalProps[e][i]=t)})),!0):(x("setGeneralProps"),!1),this.clearGeneralProps=(e,t)=>{try{T(this.dataStore.generalProps[e])||(l(t)&&!T(t)?t.forEach((t=>{k(this.dataStore.generalProps[e],t)})):this.dataStore.generalProps[e]={})}catch(e){return x("clearGeneralProps"),!1}},this.track=(e,t,i)=>{K(t,(()=>{var s;const{eventContextBuilder:n,eventInterceptor:r}=this.dataStore,a=Object.assign({eventType:"CUSTOM",eventName:t},n(e));a.attributes=z(Object.assign(Object.assign({},null!==(s=a.attributes)&&void 0!==s?s:{}),$(Object.assign({},o(i)&&!T(i)?i:{})))),this.plugins.gioMultipleInstances&&i&&i["&&sendTo"]&&(a["&&sendTo"]=i["&&sendTo"]),r(a)}))},this.trackTimerStart=(e,t)=>{const{dataCollect:i}=this.dataStore.getTrackerVds(e);return i?K(t,(()=>{const i=H();return this.dataStore.trackTimers[e]||(this.dataStore.trackTimers[e]={}),this.dataStore.trackTimers[e][i]={eventName:t,leng:0,start:+Date.now()},i})):(A("指定实例未开启数据采集,请检查!","error"),!1)},this.trackTimerPause=(e,t)=>{const i=this.dataStore.trackTimers[e];if(t&&i&&i[t]){const e=i[t];return e.start&&(e.leng=e.leng+(+Date.now()-e.start)),e.start=0,!0}return!1},this.trackTimerResume=(e,t)=>{const i=this.dataStore.trackTimers[e];if(t&&i&&i[t]){const e=i[t];return 0===e.start&&(e.start=+Date.now()),!0}return!1},this.trackTimerEnd=(e,t,i)=>{var s;const{dataCollect:n}=this.dataStore.getTrackerVds(e),r=this.dataStore.trackTimers[e];if(t&&r&&r[t]){if(n){const n=864e5,a=r[t];if(0!==a.start){const e=+Date.now()-a.start;a.leng=e>0?a.leng+e:0}const{eventContextBuilder:l,eventInterceptor:g}=this.dataStore,u=Object.assign({eventType:"CUSTOM",eventName:a.eventName},l(e));return u.attributes=z(Object.assign(Object.assign({},null!==(s=u.attributes)&&void 0!==s?s:{}),$(Object.assign(Object.assign({},o(i)&&!T(i)?i:{}),{event_duration:a.leng>n?0:a.leng/1e3})))),this.plugins.gioMultipleInstances&&i&&i["&&sendTo"]&&(u["&&sendTo"]=i["&&sendTo"]),g(u),!0}return A("指定实例未开启数据采集,计时器已移除,请检查!","error"),!1}return A("未查询到指定计时器,请检查!","error"),!1},this.removeTimer=(e,t)=>{const i=this.dataStore.trackTimers[e];return t&&i&&i[t]?(delete i[t],!0):(A("未查询到指定计时器,请检查!","error"),!1)},this.clearTrackTimer=e=>{this.dataStore.trackTimers[e]={}},this.setLocation=(e,t,i)=>{T(this.dataStore.locationData[e])&&(this.dataStore.locationData[e]={});const s=this.dataStore.locationData[e],n=e=>e>=-180&&180>=e;n(t)&&n(i)&&(s.latitude!==t||s.longitude!==i)&&(this.dataStore.locationData[e]={latitude:t,longitude:i})},this.updateImpression=()=>{A("updateImpression 错误! 请集成半自动埋点浏览插件后重试!","error")},this.getABTest=(e,t,i)=>{A("获取ABTest数据错误! 请集成ABTest插件后重试!","error"),N(i,{})},this.getGioInfo=e=>{const{getUid:t,getUserId:i,getUserKey:s,getSessionId:n}=this.userStore,{projectId:r,appId:o,dataSourceId:a,dataCollect:l,idMapping:g,extraParams:u,ignoreFields:c}=this.dataStore.getTrackerVds(e),d={gioappid:o,giocs1:i(e)||"",gioplatform:this.platformConfig.platform,gioprojectid:r,gios:n(e),giou:t()};return d.giodatacollect=l,d.giodatasourceid=a,g&&(d.giouserkey=s(e)),T(u)||u.forEach((t=>{var i;c.includes(t)||(d["gio"+t]=(null!==(i=this.dataStore.lastVisitEvent[e])&&void 0!==i?i:{})[t])})),Qe.stringify(d)},this.utils=Object.assign(Object.assign(Object.assign({},j),ee),{qs:Qe}),this.emitter={all:e=e||new Map,on:function(t,i){var s=e.get(t);s?s.push(i):e.set(t,[i])},off:function(t,i){var s=e.get(t);s&&(i?s.splice(s.indexOf(i)>>>0,1):e.set(t,[]))},emit:function(t,i){var s=e.get(t);s&&s.slice().map((function(e){e(i)})),(s=e.get("*"))&&s.slice().map((function(e){e(t,i)}))}},this.gioPlatform=G(),this.gioFramework="uniapp",this.sdkVersion="4.3.0";try{"quickapp"===this.gioPlatform||a(getApp)&&a(App)?this.inPlugin=!1:this.inPlugin=!0}catch(e){this.inPlugin=!0}this.inPlugin&&A("未检测到小程序实例,自动切换为插件模式!","info"),this.platformConfig=He,this.minipInstance=new Le(this),this.dataStore=new Te(this),this.userStore=new Ze(this),this.uploader=new Ye(this),this.plugins=new Ge(this),this.plugins.innerPluginInit()}},et=function(){var e;const t=arguments[0];let i="g0",n=t;if(t.indexOf(".")>-1&&(i=null!==(e=t.split(".")[0])&&void 0!==e?e:"g0",n=t.split(".")[1]),s(n)&&ne.includes(n)&&Xe[n]){const e=d(Array.from(arguments));if("init"===n){const t=((e,t)=>{const i=v(t[0]),s=v(t[1]),n=(4===t.length?t[3]:t[2])||{};return i&&s?e.dataStore.initializedTrackingIds.some(((t,n)=>{const r=0===n?e.vdsConfig:e.subInstance[t];return r.projectId===i&&r.dataSourceId===s}))?(A("SDK初始化失败,重复初始化,请检查初始化参数!","error"),!1):{projectId:i,dataSourceId:s,appId:v(4===t.length?t[2]:""),userOptions:n}:(A('SDK初始化失败,请使用 gdp("init", "您的GrowingIO项目 accountId", "您项目的 dataSourceId", "您的小程序 AppId(可选)", options: { host: "您的数据上报地址host" }); 进行初始化!',"error"),!1)})(Xe,e);if(t){const{projectId:e,dataSourceId:s,appId:n,userOptions:r}=t;return Xe.init(Object.assign(Object.assign({},r),{projectId:e,dataSourceId:s,appId:n,trackingId:i}))}return!1}if("registerPlugins"===n)Xe.registerPlugins(e[0]);else{if(Xe.gioSDKInitialized&&Xe.vdsConfig)return se.includes(n)?q((()=>Xe.handlerDistribute(i,n,e))):q((()=>Xe[n](...e)));A("SDK未初始化!","error")}}else if(oe.includes(n))A(`方法 ${v(n)} 已被弃用,请移除!`,"warn");else{if("canIUse"===n)return ne.includes(arguments[1])&&!!Xe[arguments[1]];A(`不存在名为 ${v(n)} 的方法调用!`,"error")}};Q().gdp=et,Q().gioSDKVersion=Xe.sdkVersion;const{growingApp:it,growingPage:st,growingComponent:nt,growingBehavior:rt,initOriginalValue:ot}=Xe.dataStore.eventHooks;ot();const at=q((()=>null!=it?it:App)),lt=q((()=>null!=st?st:Page)),gt=q((()=>null!=nt?nt:Component)),ut=q((()=>null!=rt?rt:Behavior));export{at as GioApp,ut as GioBehavior,gt as GioComponent,lt as GioPage,et as default};