From 7782e7ca8b771d80b153770f503c9e72a870b7e2 Mon Sep 17 00:00:00 2001 From: ShenXiaowei Date: Mon, 15 Apr 2024 10:12:01 +0800 Subject: [PATCH] feat: 3.8.7 --- gdp-es5.js | 2 +- gdp-es5.umd.js | 2 +- gdp-full-es5.js | 2 +- gdp-full-es5.umd.js | 2 +- gdp-full.js | 2 +- gdp-full.umd.js | 2 +- gdp.js | 2 +- gdp.umd.js | 2 +- package.json | 2 +- plugins/gioCustomTracking.js | 2 +- plugins/gioEmbeddedAdapter.js | 2 +- plugins/gioEventAutoTracking.js | 2 +- plugins/gioHybridAdapter.js | 2 +- plugins/gioHybridCircle.js | 2 +- plugins/gioImpressionTracking.js | 2 +- plugins/umd/gioCustomTracking.js | 2 +- plugins/umd/gioEmbeddedAdapter.js | 2 +- plugins/umd/gioEventAutoTracking.js | 2 +- plugins/umd/gioHybridAdapter.js | 2 +- plugins/umd/gioHybridCircle.js | 2 +- plugins/umd/gioImpressionTracking.js | 2 +- 21 files changed, 21 insertions(+), 21 deletions(-) diff --git a/gdp-es5.js b/gdp-es5.js index f212afd..9136192 100644 --- a/gdp-es5.js +++ b/gdp-es5.js @@ -1 +1 @@ -var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)({}).hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};function t(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+n+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}var n=function(){return n=Object.assign||function(e){for(var t,n=1,i=arguments.length;i>n;n++)for(var r in t=arguments[n])({}).hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},n.apply(this,arguments)};function i(e,t,n){if(n||2===arguments.length)for(var i,r=0,o=t.length;o>r;r++)!i&&r in t||(i||(i=[].slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||[].slice.call(t))}var r=["web","wxwv","minp","alip","baidup","qq","bytedance"],o={autotrack:{type:"boolean",default:!0},compress:{type:"boolean",default:!0},dataCollect:{type:"boolean",default:!0},debug:{type:"boolean",default:!1},hashtag:{type:"boolean",default:!1},touch:{type:"boolean",default:!1},version:{type:"string",default:"1.0.0"},platform:{type:"string",default:"web"},cookieDomain:{type:"string",default:""},sendType:{type:"string",default:"beacon"}},a={enableIdMapping:{type:"boolean",default:!1},gtouchHost:{type:"string",default:""},host:{type:"string",default:"napi.growingio.com"},ignoreFields:{type:"array",default:[]},penetrateHybrid:{type:"boolean",default:!0},scheme:{type:"string",default:location.protocol.indexOf("http")>-1?location.protocol.replace(":",""):"https"},sessionExpires:{type:"number",default:30},performance:{type:"object",default:{monitor:!0,exception:!0}},embeddedIgnore:{type:"array",default:[]},storageType:{type:"string",default:"cookie"},requestTimeout:{type:"number",default:5e3}},s={},u=["clearUserId","getGioInfo","getLocation","getOption","init","setDataCollect","setOption","setUserId","track","setGeneralProps","clearGeneralProps"];i(i([],u,!0),["setEvar","setPage","setUser","setVisitor"],!1);var c,d,l,g,f,m=i(i([],u,!0),["enableDebug","enableHT","setAutotrack","setTrackerHost","setTrackerScheme","setUserAttributes","getVisitorId","getDeviceId","registerPlugins","getPlugins","sendPage","sendVisit","trackTimerStart","trackTimerPause","trackTimerResume","trackTimerEnd","removeTimer","clearTrackTimer","updateImpression"],!1),p=["autotrack","dataCollect","dataSourceId","debug","host","hashtag","scheme"],v={autotrack:"无埋点采集",dataCollect:"数据采集",debug:"调试模式"},h=["send","setConfig","collectImp","setPlatformProfile"],I=["screenHeight","screenWidth"],w="function"==typeof Array.from?Array.from:(d||(d=1,l=function(e){return"function"==typeof e},g=function(e){var t=function(e){var t=Number(e);return isNaN(t)?0:0!==t&&isFinite(t)?(t>0?1:-1)*Math.floor(Math.abs(t)):t}(e);return Math.min(Math.max(t,0),9007199254740991)},f=function(e){var t=e.next();return!t.done&&t},c=function(e){var t,n,i,r=this,o=arguments.length>1?arguments[1]:void 0;if(void 0!==o){if(!l(o))throw new TypeError("Array.from: when provided, the second argument must be a function");arguments.length>2&&(t=arguments[2])}var a=function(e,t){if(null!=e&&null!=t){var n=e[t];if(null==n)return;if(!l(n))throw new TypeError(n+" is not a function");return n}}(e,function(e){if(null!=e){if(["string","number","boolean","symbol"].indexOf(typeof e)>-1)return Symbol.iterator;if("undefined"!=typeof Symbol&&"iterator"in Symbol&&Symbol.iterator in e)return Symbol.iterator;if("@@iterator"in e)return"@@iterator"}}(e));if(void 0!==a){n=l(r)?Object(new r):[];var s,u,c=a.call(e);if(null==c)throw new TypeError("Array.from requires an array-like or iterable object");for(i=0;;){if(!(s=f(c)))return n.length=i,n;u=s.value,n[i]=o?o.call(t,u,i):u,i++}}else{var d=Object(e);if(null==e)throw new TypeError("Array.from requires an array-like object - not null or undefined");var m,p=g(d.length);for(n=l(r)?Object(new r(p)):Array(p),i=0;p>i;)m=d[i],n[i]=o?o.call(t,m,i):m,i++;n.length=p}return n}),c),y=function(e){return U(["undefined","null"],Q(e))},S=function(e){return"string"===Q(e)},O=function(e){return"number"===Q(e)},b=function(e){return"NaN"===R(Number(e))},E=function(e){return"object"===Q(e)&&!y(e)},T=function(e){return"regexp"===Q(e)},_=function(e){return U(["function","asyncfunction"],Q(e))},C=function(e){return Array.isArray(e)&&"array"===Q(e)},k=function(e){return"date"===Q(e)},P=function(e){try{return K(e)[0]}catch(e){return}},x=function(e){try{var t=K(e);return t[t.length-1]}catch(e){return}},q=function(e,t){return void 0===t&&(t=1),C(e)&&O(t)?e.slice(t>0?t:1,e.length):e},N=function(e){if(C(e)){for(var t=0,n=[],i=0,r=e;i=0},K=w,R=function(e){return y(e)?"":"".concat(e)},L=function(e,t){return"string"==typeof e?e.split(t):e},j=function(e){if(S(e)){var t=L(e,"");return"".concat(P(t).toLowerCase()).concat(q(t).join(""))}return e},F=function(e,t){return!!S(e)&&e.slice(0,t.length)===t},B=function(e,t){if(S(e)){var n=e.length,i=n;i>n&&(i=n);var r=i;return(i-=t.length)>=0&&e.slice(i,r)===t}return!1},V={}.hasOwnProperty,H=function(e,t){return!y(e)&&V.call(e,t)},G=function(e){return E(e)?Object.keys(e):[]},M=function(e,t){G(e).forEach((function(n){return t(e[n],n)}))},z=function(e,t){var n=G(e);return!(!E(e)||!E(t)||n.length!==G(t).length||U(n.map((function(n,i){return E(e[n])?z(e[n],t[n]):e[n]===t[n]})),!1))},W=function(e,t){if(!E(e))return!1;try{return"string"===Q(t)?delete e[t]:"array"===Q(t)?t.map((function(t){return delete e[t]})):(T(t)&&G(e).forEach((function(n){t.test(n)&&W(e,n)})),!0)}catch(e){return!1}},J=function(e){return C(e)?0===e.length:E(e)?0===G(e).length:!e},Q=function(e){return{}.toString.call(e).slice(8,-1).toLowerCase()},Z=Object.freeze({__proto__:null,isNil:y,isString:S,isNumber:O,isNaN:b,isBoolean:function(e){return"boolean"===Q(e)},isObject:E,isRegExp:T,isFunction:_,isArray:C,isDate:k,fixed:function(e,t){return O(e)?Number(e.toFixed(O(t)?t:2)):S(e)&&"NaN"!==R(Number(e))?Number(Number(e).toFixed(O(t)?t:2)):e},head:P,last:x,drop:q,dropWhile:function(e,t){return C(e)?e.filter((function(e){return!t(e)})):e},compact:N,find:D,findIndex:A,includes:U,arrayFrom:K,toString:R,split:L,lowerFirst:j,upperFirst:function(e){if(S(e)){var t=L(e,"");return"".concat(P(t).toUpperCase()).concat(q(t).join(""))}return e},startsWith:F,endsWith:B,has:H,keys:G,forEach:M,isEqual:z,get:function(e,t,n){var i=e;return E(e)?(t.split(".").forEach((function(e){i=i?i[e]:n})),i):n},unset:W,isEmpty:J,typeOf:Q,formatDate:function(e){if(k(e)){var t=function(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())}return e}}),X=function(e,t){console.log("%c [GrowingIO]:".concat(e),{info:"color: #3B82F6;",error:"color: #EF4444;",warn:"color: #F59E0B;",success:"color: #10B981;"}[t]||"")},Y=function(e){try{return e()}catch(e){return}},$=function(e){var t={};return E(e)&&M(e,(function(e,n){var i,r=R(n).slice(0,100);E(e)?t[r]=$(e):C(e)?(t[r]=e.slice(0,100),"cdp"===(null===(i=window.vds)||void 0===i?void 0:i.gioEnvironment)&&(t[r]=t[r].join("||").slice(0,1e3))):t[r]=y(e)?"":R(e).slice(0,1e3)})),t},ee=function(e,t,i,r){void 0===r&&(r={}),document.addEventListener?e.addEventListener(t,i,n(n({},{capture:!0}),r)):e.attachEvent?e.attachEvent("on"+t,i):e["on"+t]=i},te=function(e,t){return S(e)&&!J(e)&&e.match(/^[a-zA-Z_][0-9a-zA-Z_]{0,100}$/)?t():(X("事件名格式不正确,只能包含数字、字母和下划线,且不能以数字开头,字符总长度不能超过100!","error"),!1)},ne=Object.freeze({__proto__:null,consoleText:X,niceTry:Y,limitObject:$,addListener:ee,flattenObject:function(e){void 0===e&&(e={});var t=n({},e);return G(t).forEach((function(e){E(t[e])?(G(t[e]).forEach((function(n){t["".concat(e,"_").concat(n)]=R(t[e][n])})),W(t,e)):C(t[e])?(t[e].forEach((function(n,i){E(n)?G(n).forEach((function(r){t["".concat(e,"_").concat(i,"_").concat(r)]=R(n[r])})):t["".concat(e,"_").concat(i)]=R(n)})),W(t,e)):y(t[e])||""===t[e]?W(t,e):t[e]=R(t[e])})),$(t)},eventNameValidate:te,getGioFunction:function(){var e,t,n,i,r=window._gio_local_vds||"vds",o=null!==(t=null===(e=window[r])||void 0===e?void 0:e.namespace)&&void 0!==t?t:"gdp";return _(window[o])?window[o]:null!==(i=null!==(n=window.gdp)&&void 0!==n?n:window.gio)&&void 0!==i?i:function(){}}}),ie=function(e){return S(e)&&e.length>0||O(e)&&e>0},re=/^((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})(\.((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})){3}/i,oe=/^(https?:\/\/)|(([a-zA-Z0-9_-])+(\.)?)*(:\d+)?(\/((\.)?(\?)?=?&?[a-zA-Z0-9_-](\?)?)*)*$/i;function ae(e){for(var t=1;arguments.length>t;t++){var n=arguments[t];for(var i in n)e[i]=n[i]}return e}var se,ue,ce=function e(t,n){function i(e,i,r){if("undefined"!=typeof document){"number"==typeof(r=ae({},n,r)).expires&&(r.expires=new Date(Date.now()+864e5*r.expires)),r.expires&&(r.expires=r.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var o="";for(var a in r)r[a]&&(o+="; "+a,!0!==r[a]&&(o+="="+r[a].split(";")[0]));return document.cookie=e+"="+t.write(i,e)+o}}return Object.create({set:i,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var n=document.cookie?document.cookie.split("; "):[],i={},r=0;r+Date.now()?ge(pe(t.value)):void 0},this.setItem=function(e,t,n){var i=null!=n?n:+new Date(9999,12);localStorage.setItem(le(e),JSON.stringify({value:S(t)&&t.length&&B(e,"_gioenc")?me(t):t,expiredAt:i}))},this.removeItem=function(e){return localStorage.removeItem(le(e))},this.hasItem=function(e){return!!localStorage.getItem(le(e))},this.getKeys=function(){return K(Array(localStorage.length)).map((function(e,t){return localStorage.key(t)}))},this.type="localStorage"},ye={},Se=function(){this.getItem=function(e){var t=Y((function(){return JSON.parse(ye[le(e)]||"")}));return E(t)&&t.expiredAt>+Date.now()?ge(pe(t.value)):void 0},this.setItem=function(e,t,n){var i=null!=n?n:+new Date(9999,12);ye[le(e)]=JSON.stringify({value:S(t)&&t.length?me(t):t,expiredAt:i})},this.removeItem=function(e){return W(ye,le(e))},this.hasItem=function(e){return H(ye,le(e))},this.getKeys=function(){return G(ye)},this.type="memory"},Oe=/^(\.ac\.|\.br\.|\.co\.|\.com\.|\.edu\.|\.gov\.|\.org\.|\.net\.)/,be=function(e){var t=[];try{var n=e.split("."),i=x(n);if(n.length>=2&&(isNaN(Number(i))||0>Number(i)||Number(i)>255)){var r=".".concat(n.slice(-2).join("."));Oe.test(r)?se=r:t.push(r);var o=".".concat(n.slice(-3).join("."));Oe.test(o)||U(t,o)||t.push(o);var a=".".concat(n.slice(-4).join("."));Oe.test(a)||U(t,a)||t.push(a)}}catch(e){}return t},Ee=function(e){var t="";return e.every((function(e){return!Te(e)||(t=e,!1)})),t},Te=function(e){try{ce.set("gioCookie","yes",{domain:e});var t=!!ce.get("gioCookie",{domain:e});return ce.remove("gioCookie",{domain:e}),t}catch(e){return!1}},_e=function(e){var t,n,r,o=e.storageType,a=e.cookieDomain,s=e.projectId;if(U(["cookie","localstorage"],o)||(o="cookie"),"cookie"===o&&(n=!!(r=navigator.userAgent.indexOf("Electron")>-1||U(["","localhost","127.0.0.1"],window.location.hostname)||!U(["http:","https:"],window.location.protocol)?"":Ee(i(i([],be(window.location.hostname),!0),[window.location.hostname],!1)))),"cookie"===o&&n){var u=new Ie(r);if(a){var c=be(a),d=Ee(J(c)?[]:i([a],be(a),!0));d&&Te(d)?u.domain=d:X("指定Cookie域无效或无权限,使用默认域!","warn")}t=u}else t=function(){try{var e=window.localStorage,t="__storage_test__";return e.setItem(t,t),e.removeItem(t),!0}catch(e){return!1}}()?new we:new Se;return"cookie"===o&&se&&Te(se)&&function(e,t,n){if(t&&Te(t)){var i=new Ie(t);["".concat(n,"_gdp_session_id"),"gdp_user_id_gioenc","".concat(n,"_gdp_cs1_gioenc"),"".concat(n,"_gdp_user_key_gioenc"),"".concat(n,"_gdp_gio_id_gioenc"),"".concat(n,"_gdp_sequence_ids"),"".concat(n,"_gdp_session_id_sent")].forEach((function(t){var n=i.getItem(t);i.hasItem(t)&&(e.setItem(t,n),i.removeItem(t))})),i=void 0}}(t,se,s),t},Ce="SESSIONID_UPDATE",ke={name:"gioCustomTracking",method:function(e){var t=this;this.growingIO=e,this.getValidResourceItem=function(e){if(e&&E(e)&&e.id&&e.key){var t={id:S(e.id)?e.id:R(e.id),key:S(e.key)?e.key:R(e.key)};return e.attributes&&(t.attributes=e.attributes),t}},this.getDynamicAttributes=function(e){return y(e)||G(e).forEach((function(t){_(e[t])?e[t]=e[t]():E(e[t])?W(e,t):C(e[t])||(e[t]=R(e[t]))})),e},this.buildCustomEvent=function(e,i,r,o){te(e,(function(){var a=t.growingIO.dataStore,s=a.eventContextBuilder,u=a.eventConverter,c=a.currentPage,d=n({eventType:"CUSTOM",eventName:e,pageShowTimestamp:null==c?void 0:c.time,attributes:$(t.getDynamicAttributes(E(i)&&!J(i)?i:void 0)),resourceItem:$(t.getValidResourceItem(r))},s());J(o)||(d=n(n({},d),o)),u(d)}))},this.buildUserAttributesEvent=function(e,i){var r=t.growingIO.dataStore,o=r.eventContextBuilder,a=r.eventConverter,s=n({eventType:"LOGIN_USER_ATTRIBUTES",attributes:$(e)},o());J(i)||(s=n(n({},s),i)),a(s)}}},Pe=["gioPerformance"],xe=function(e){function n(t){var n=e.call(this,t)||this;return n.growingIO=t,n.growingIO.gioSDKFull=!1,n.pluginsContext={plugins:{gioCustomTracking:ke}},n}return t(n,e),n}((function(e){var t,n,i,r,o=this;this.growingIO=e,this.innerPluginInit=function(){var e;Pe.forEach((function(e){var t;return W(null===(t=o.pluginsContext)||void 0===t?void 0:t.plugins,e)})),G(null===(e=o.pluginsContext)||void 0===e?void 0:e.plugins).forEach((function(e){var t,n=null===(t=o.pluginsContext)||void 0===t?void 0:t.plugins[e],i=n.name,r=n.method;D(o.pluginItems,(function(e){return e.name===i}))||o.pluginItems.push({name:j(i||e),method:r||function(e){}})})),J(o.pluginItems)||o.installAll()},this.install=function(e,t,n){var i,r,a=t||D(o.pluginItems,(function(t){return t.name===e}));if((null===(i=o.growingIO)||void 0===i?void 0:i.plugins)[e])return X("重复加载插件 ".concat(e," 或插件重名,已跳过加载!"),"warn"),!1;if(!a)return X("插件加载失败!不存在名为 ".concat(e," 的插件!"),"error"),!1;try{return(null===(r=o.growingIO)||void 0===r?void 0:r.plugins)[e]=new a.method(o.growingIO,n),"cdp"===o.growingIO.gioEnvironment&&t&&X("加载插件 ".concat(e),"info"),!0}catch(e){return X("插件加载异常 ".concat(e),"error"),!1}},this.installAll=function(e){(e||o.pluginItems).forEach((function(t){o.install(t.name,e?t:void 0,e?null==t?void 0:t.options:void 0)&&!D(o.pluginItems,(function(e){return e.name===t.name}))&&o.pluginItems.push({name:j(t.name),method:t.method?t.method:function(){}})}))},this.uninstall=function(e){var t;W(o.pluginItems,e);var n=W(null===(t=o.growingIO)||void 0===t?void 0:t.plugins,e);return n||X("卸载插件 ".concat(e," 失败!"),"error"),n},this.uninstallAll=function(){o.pluginItems.forEach((function(e){return o.uninstall(e.name)}))},this.lifeError=function(e,t){return X("插件执行错误 ".concat(e.name," ").concat(t),"error")},this.onComposeBefore=function(e){o.pluginItems.forEach((function(t){var n,i=null===(n=o.growingIO.plugins[t.name])||void 0===n?void 0:n.onComposeBefore;if(i&&_(i))try{i(e)}catch(e){o.lifeError(t,e)}}))},this.onComposeAfter=function(e){o.pluginItems.forEach((function(t){var n,i=null===(n=o.growingIO.plugins[t.name])||void 0===n?void 0:n.onComposeAfter;if(i&&_(i))try{i(e)}catch(e){o.lifeError(t,e)}}))},this.onSendBefore=function(e){o.pluginItems.forEach((function(t){var n,i=null===(n=o.growingIO.plugins[t.name])||void 0===n?void 0:n.onSendBefore;if(i&&_(i))try{i(e)}catch(e){o.lifeError(t,e)}}))},this.onSendAfter=function(e){o.pluginItems.forEach((function(t){var n,i=null===(n=o.growingIO.plugins[t.name])||void 0===n?void 0:n.onSendAfter;if(i&&_(i))try{i(e)}catch(e){o.lifeError(t,e)}}))},this.pluginsContext={plugins:{}},this.pluginItems=[],null===(t=this.growingIO.emitter)||void 0===t||t.on("onComposeBefore",this.onComposeBefore),null===(n=this.growingIO.emitter)||void 0===n||n.on("onComposeAfter",this.onComposeAfter),null===(i=this.growingIO.emitter)||void 0===i||i.on("onSendBefore",this.onSendBefore),null===(r=this.growingIO.emitter)||void 0===r||r.on("onSendAfter",this.onSendAfter)})),qe=function(){function e(e){this.growingIO=e;var t=this.growingIO.vdsConfig.projectId,n=this.growingIO.storage,i=n.getItem,r=n.setItem,o=n.getKeys,a=n.removeItem;this.getItem=i,this.setItem=r,this.getKeys=o,this.removeItem=a,this.sIdStorageName="".concat(t,"_gdp_session_id"),this.uidStorageName="gdp_user_id_gioenc",this.userIdStorageName="".concat(t,"_gdp_cs1_gioenc"),this.userKeyStorageName="".concat(t,"_gdp_user_key_gioenc"),this.gioIdStorageName="".concat(t,"_gdp_gio_id_gioenc")}return Object.defineProperty(e.prototype,"sessionId",{get:function(){return this.getItem(this.sIdStorageName)||(this.sessionId=de(),this.sessionId)},set:function(e){var t,n=this;e||(e=de());var i=this.getItem(this.sIdStorageName)||this.prevSessionId,r=this.growingIO.vdsConfig.sessionExpires,o=void 0===r?30:r;this.setItem(this.sIdStorageName,e,+Date.now()+60*o*1e3),i!==e&&(this.getKeys().filter((function(e){return/.+_gdp_session_id_.{36}/.test(e)})).forEach((function(e){n.removeItem(e)})),this.setItem(this.growingIO.dataStore.visitStorageName,""),null===(t=this.growingIO.emitter)||void 0===t||t.emit(Ce,{newSessionId:e,oldSessionId:i})),this.prevSessionId=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"uid",{get:function(){return this.getItem(this.uidStorageName)||(this.uid=de(),this.uid)},set:function(e){var t,n=this.getItem(this.uidStorageName)||this.prevUId;this.setItem(this.uidStorageName,e),n!==e&&(null===(t=this.growingIO.emitter)||void 0===t||t.emit("UID_UPDATE",{newUId:e,oldUId:n})),this.prevUId=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"userId",{get:function(){return this.getItem(this.userIdStorageName)||""},set:function(e){var t,n,i=this.getItem(this.userIdStorageName)||this.prevUserId;this.setItem(this.userIdStorageName,e),null===(t=this.growingIO.emitter)||void 0===t||t.emit("SET_USERID",{newUserId:e,oldUserId:i,userKey:this.userKey}),i!==e&&(null===(n=this.growingIO.emitter)||void 0===n||n.emit("USERID_UPDATE",{newUserId:e,oldUserId:i,userKey:this.userKey})),e&&(this.gioId=e),this.prevUserId=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"userKey",{get:function(){return this.getItem(this.userKeyStorageName)||""},set:function(e){var t,n,i=this.getItem(this.userKeyStorageName)||this.prevUserKey;this.setItem(this.userKeyStorageName,e),null===(t=this.growingIO.emitter)||void 0===t||t.emit("SET_USERKEY",{newUserKey:e,oldUserKey:i,userId:this.userId}),i!==e&&(null===(n=this.growingIO.emitter)||void 0===n||n.emit("USERKEY_UPDATE",{newUserKey:e,oldUserKey:i,userId:this.userId})),this.prevUserKey=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"gioId",{get:function(){return this.getItem(this.gioIdStorageName)||""},set:function(e){var t,n=this.getItem(this.gioIdStorageName)||this.prevGioId;this.setItem(this.gioIdStorageName,e),n!==e&&(null===(t=this.growingIO.emitter)||void 0===t||t.emit("GIOID_UPDATE",{newGioId:e,oldGioId:n})),this.prevGioId=e},enumerable:!1,configurable:!0}),e}(),Ne=function(e){var t=this;this.growingIO=e,this.main=function(){var e,i,r=t.growingIO,o=r.sdkVersion,a=r.useEmbeddedInherit,s=r.vdsConfig,u=r.userStore,c=r.dataStore,d=r.trackingId,l=c.currentPage,g=l.path,f=l.query,m={appVersion:s.version,dataSourceId:s.dataSourceId,deviceId:u.uid,domain:a?s.appId:window.location.host,gioId:u.gioId,language:navigator.language,path:g,platform:s.platform,query:f,referralPage:(null===(e=c.lastPageEvent)||void 0===e?void 0:e.referralPage)||"",screenHeight:window.screen.height,screenWidth:window.screen.width,sdkVersion:o,sessionId:u.sessionId,timestamp:+Date.now(),title:null!==(i=Y((function(){return document.title.slice(0,255)})))&&void 0!==i?i:"",userId:u.userId};if(s.enableIdMapping&&(m.userKey=u.userKey),J(s.ignoreFields)||s.ignoreFields.forEach((function(e){W(m,e)})),a&&!J(t.minpExtraParams)){var p=n({},m);M(n(n({},m),t.minpExtraParams),(function(e,n){var i;U(s.embeddedIgnore,n)?(m[n]=p[n],"domain"===n&&(m[n]=window.location.host)):m[n]=null!==(i=t.minpExtraParams[n])&&void 0!==i?i:m[n]}))}return m.trackingId=d,m},this.minpExtraParams={}},De=function(e){var t=this;this.growingIO=e,this.parsePage=function(){var e=t.growingIO.vdsConfig.hashtag,n=location.pathname,i=location.search,r=location.hash,o=r.indexOf("?");t.domain=window.location.host,t.title=document.title.slice(0,255),t.time=+Date.now(),t.path=n,t.query=i,e&&(o>-1?(t.path+=r.slice(0,o),t.query=t.query+"&"+r.slice(o+1)):t.path+=r),t.query&&U(["?","&"],t.query.charAt(0))&&(t.query=t.query.slice(1))},this._getNoHashHref=function(){var e=window.location,t=e.protocol,n=e.host,i=e.pathname,r=e.search;return"".concat(t,"://").concat(n).concat(i).concat(r)},this.getReferralPage=function(){var e,n,i=t.growingIO.dataStore.lastPageEvent;return(null==i?void 0:i.path)===t.path&&(null!==(e=null==i?void 0:i.query)&&void 0!==e?e:"")===(null!==(n=t.query)&&void 0!==n?n:"")?null==i?void 0:i.referralPage:(null==i?void 0:i.path)?t.lastHref:document.referrer},this.pageListener=function(){var e=t.growingIO.vdsConfig.hashtag,n=window.location.href,i=t.lastHref;e||(n=t._getNoHashHref(),i=t.lastNoHashHref),i!==n&&(t.parsePage(),t.buildPageEvent())},this.hookHistory=function(){var e=window.history.pushState,n=window.history.replaceState,i=t;e&&Y((function(){return window.history.pushState=function(){e.apply(window.history,arguments),setTimeout(i.pageListener)}})),n&&Y((function(){return window.history.replaceState=function(){n.apply(window.history,arguments),setTimeout(i.pageListener)}})),ee(window,"popstate",t.pageListener),t.growingIO.vdsConfig.hashtag&&ee(window,"hashchange",t.pageListener)},this.buildPageEvent=function(e){var i=t.growingIO.dataStore;i.lastPageEvent;var r=i.eventContextBuilder,o=i.eventConverter,a=n(n({eventType:"PAGE"},r()),{protocolType:location.protocol.substring(0,location.protocol.length-1),referralPage:t.getReferralPage()});J(e)||(a=n(n({},a),e)),a.timestamp=t.time,o(a),t.lastHref=window.location.href,t.lastNoHashHref=t._getNoHashHref(),t.lastLocation=n({},window.location)},this.title=document.title.slice(0,255),this.lastLocation=n({},window.location)},Ae={referralPage:document.referrer},Ue=function(){function e(e){var t,i,u,c=this;this.growingIO=e,this.ALLOW_SETTING=n(n({},o),"saas"===this.growingIO.gioEnvironment?s:a),this.allowOptKeys=Object.keys(this.ALLOW_SETTING),this.trackTimers={},this.setSequenceIds=function(e,t){var i=c.growingIO.storage.getItem(c.seqStorageIdName)||{};"gsid"===e?i.globalKey=t:i=n(n({},i),t),c.growingIO.storage.setItem(c.seqStorageIdName,i)},this.initOptions=function(e){var t,i,o,a,s,u,d,l=e.projectId,g=e.dataSourceId,f=e.appId;c.initialDataSourceId=g;var m={};c.allowOptKeys.forEach((function(t){var n=c.ALLOW_SETTING[t].type,i=C(n)?!U(n,Q(e[t])):Q(e[t])!==n;"platform"!==t||U(r,e[t])||(i=!0),i?m[t]=c.ALLOW_SETTING[t].default:"ignoreFields"===t?m.ignoreFields=e.ignoreFields.filter((function(e){return U(I,e)})):(m[t]=e[t],U(["dataCollect","autotrack"],t)&&(m[t]||X("已关闭".concat(v[t]),"info")))})),m.sessionExpires=Math.round(m.sessionExpires),(b(m.sessionExpires)||1>m.sessionExpires||m.sessionExpires>360)&&(m.sessionExpires=30),m.storageType=m.storageType.toLowerCase(),m.sendType=m.sendType.toLowerCase(),U(["beacon","xhr","image"],m.sendType)||(m.sendType="beacon"),!b(Number(m.requestTimeout))&&m.requestTimeout>0||(m.requestTimeout=5e3),c.growingIO.vdsConfig=n(n(n({},null!==(t=window.vds)&&void 0!==t?t:{}),m),{projectId:l,dataSourceId:g,appId:f,performance:{monitor:null===(o=null===(i=m.performance)||void 0===i?void 0:i.monitor)||void 0===o||o,exception:null===(s=null===(a=m.performance)||void 0===a?void 0:a.exception)||void 0===s||s,network:null!==(d=null===(u=m.performance)||void 0===u?void 0:u.network)&&void 0!==d&&d}}),window.vds=c.growingIO.vdsConfig,c.seqStorageIdName="".concat(l,"_gdp_sequence_ids"),c.visitStorageName="".concat(l,"_gdp_session_id_sent")},this.setOption=function(e,t){var i,r=c.growingIO,o=r.vdsConfig,a=r.callError,s=r.uploader,u=r.emitter,d=S(e)&&U(p,e),l=d&&typeof t===((null===(i=c.ALLOW_SETTING[e])||void 0===i?void 0:i.type)||"string"),g=n({},o);return d&&l?(o[e]=t,"dataCollect"===e&&g.dataCollect!==t&&(t?(c.sendVisit(!0),c.sendPage()):c.growingIO.clearTrackTimer()),U(["host","scheme"],e)&&(null==s||s.generateHost()),null==u||u.emit("OPTION_CHANGE",{optionName:e,optionValue:t}),window.vds[e]=t,!0):(a("setOption > ".concat(e)),!1)},this.getOption=function(e){var t=c.growingIO,i=t.vdsConfig,r=t.callError;return e&&H(i,R(e))?i[R(e)]:y(e)?n({},i):void r("getOption > ".concat(e))},this.sendVisit=function(e){var t=c.growingIO,n=t.userStore.sessionId,i=t.storage.getItem(c.visitStorageName);!e&&n===i||(c.lastVisitEvent.timestamp=c.currentPage.time-1,c.buildVisitEvent())},this.buildVisitEvent=function(e){var t=c.growingIO,i=t.dataStore,r=i.eventContextBuilder,o=i.eventConverter,a=t.emitter,s=t.storage,u=t.userStore,d=c.lastVisitEvent,l=d.referralPage,g=d.title,f=d.path,m=d.query,p=d.timestamp,v=n(n({eventType:"VISIT"},r()),{referralPage:l||c.currentPage.getReferralPage(),timestamp:p});f&&(v.title=g,v.path=f,v.query=m),J(e)||(v.session=(null==e?void 0:e.session)||v.session,v.trackingId=null==e?void 0:e.trackingId,v=n(n({},v),e));var h=function(e){var t=e.requestData;"VISIT"===t.eventType&&t.trackingId===c.growingIO.trackingId&&(u.sessionId===t.sessionId&&s.setItem(c.visitStorageName,t.sessionId),a.off("onSendAfter",h))};a.on("onSendAfter",h),o(v)},this.sendPage=function(e){e&&c.currentPage.parsePage(),c.currentPage.buildPageEvent()},this.buildErrorEvent=function(e){var t=c.growingIO.dataStore,i=t.eventContextBuilder;(0,t.eventConverter)(n({eventType:"CUSTOM",pageShowTimestamp:c.currentPage.time,eventName:"onError",attributes:e},i()))},this.currentPage=new De(this.growingIO),this.eventContextBuilderInst=new Ne(this.growingIO),this.eventContextBuilder=this.eventContextBuilderInst.main,this.generalProps={},this.lastVisitEvent=Ae,null===(t=this.growingIO.emitter)||void 0===t||t.on("onComposeAfter",(function(e){var t=e.composedEvent;"VISIT"!==t.eventType&&"vst"!==t.t||t.trackingId!==c.growingIO.trackingId||(c.lastVisitEvent=t)})),this.lastPageEvent={},null===(i=this.growingIO.emitter)||void 0===i||i.on("onComposeAfter",(function(e){var t=e.composedEvent;"PAGE"!==t.eventType&&"page"!==t.t||t.trackingId!==c.growingIO.trackingId||(c.lastPageEvent=t)})),null===(u=this.growingIO.emitter)||void 0===u||u.on(Ce,(function(){if(c.growingIO.gioSDKInitialized){c.currentPage.parsePage();var e=c.currentPage,t=e.title,n=e.path,i=e.query,r=e.time,o=e.getReferralPage;c.lastVisitEvent={referralPage:document.referrer||o(),title:t,path:n,query:i,timestamp:r-1},c.sendVisit(!0),c.sendPage(!0)}}))}return Object.defineProperty(e.prototype,"esid",{get:function(){var e=this,t=this.growingIO.storage.getItem(this.seqStorageIdName)||{},i=n({},t);return W(i,"globalKey"),i=E(i)&&!y(i)?i:{},this._esid={},G(i).forEach((function(t){e._esid[t]=b(Number(i[t]))||i[t]>=1e9||1>i[t]?1:i[t]})),this._esid},set:function(e){var t={};G(e).forEach((function(n){t[n]=b(e[n])||e[n]>=1e9||1>e[n]?1:e[n]})),z(this._esid,t)||(this._esid=t,this.setSequenceIds("esid",this._esid))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"gsid",{get:function(){var e=this.growingIO.storage.getItem(this.seqStorageIdName)||{},t=Number(e.globalKey);return this._gsid=b(t)||t>=1e9||1>t?1:t,this._gsid},set:function(e){b(Number(e))||e>=1e9||1>e?this._gsid=1:this._gsid=e,this.setSequenceIds("gsid",this._gsid)},enumerable:!1,configurable:!0}),e}(),Ke=function(e){function i(t){var i=e.call(this,t)||this;return i.growingIO=t,i.eventConverter=function(e){var t,r,o=i.growingIO,a=o.vdsConfig,s=o.dataStore,u=o.uploader;if(a.dataCollect){e.trackingId===i.growingIO.trackingId&&(e.globalSequenceId=s.gsid,e.eventSequenceId=s.esid[e.eventType]||1);var c={};M(e,(function(e,t){var n;if("element"===t){var i=null!==(n=P(e))&&void 0!==n?n:{};M(i,(function(e,t){J(e)&&0!==e||(c[t]=e)}))}else(J(e)||y(e))&&0!==e||(c[t]=e)})),e.trackingId===i.growingIO.trackingId&&(i.growingIO.dataStore.gsid+=1,i.growingIO.dataStore.esid=n(n({},i.growingIO.dataStore.esid),((t={})[c.eventType]=(i.growingIO.dataStore.esid[c.eventType]||1)+1,t))),null===(r=i.growingIO.emitter)||void 0===r||r.emit("onComposeAfter",{composedEvent:n({},c)}),e.trackingId===i.growingIO.trackingId&&u.commitRequest(c)}else"VISIT"===e.eventType&&(i.lastVisitEvent=e)},i}return t(i,e),i}(Ue),Re=function(e){function n(t){var n=e.call(this,t)||this;return n.growingIO=t,n.generateHost=function(){var e=n.growingIO.vdsConfig,t=e.scheme,i=e.host,r=void 0===i?"":i,o=e.projectId;t?B(R(t),"://")||(t="".concat(t,"://")):t="".concat(location.protocol.indexOf("http")>-1?location.protocol.replace(":",""):"https","//"),F(r,"http")&&(r=r.substring(r.indexOf("://")+(B(R(t),"://")?3:0))),n.requestURL="".concat(t).concat(r,"/v3/projects/").concat(o,"/collect")},n.requestURL="",n.generateHost(),n}return t(n,e),n}((function(e){var t=this;this.growingIO=e,this.getSendType=function(){var e=t.growingIO.vdsConfig.sendType;return"beacon"===e?function(){var e,t,n=!!(null===(e=null===window||void 0===window?void 0:window.navigator)||void 0===e?void 0:e.sendBeacon),i=window.navigator.userAgent;if(i.match(/(iPad|iPhone|iPod)/g)){var r=!(t=i.toLowerCase().match(/cpu.*os (.*?) like mac os/i))||2>t.length?0:+t[1].split("_").slice(0,2).join(".");return n&&r>13}return n}()?"beacon":"xhr":e},this.commitRequest=function(e){var i=n({},e);t.requestQueue.push(n(n({},i),{requestType:t.getSendType()})),t.initiateRequest()},this.initiateRequest=function(){var e,r,o;if(i([],t.requestQueue,!0).length>0&&t.requestingNum0?R(n).slice(0,1e3):""),t.userStore.userId=R(e).slice(0,1e3),i&&i!==t.userStore.userId&&(t.userStore.sessionId="")}else t.clearUserId(),t.callError("setUserId")},t.clearUserId=function(){t.userStore.userId="",t.userStore.userKey=""},t.track=function(e,i,r,o){var a,s;((null===(s=null===(a=t.plugins)||void 0===a?void 0:a.gioCustomTracking)||void 0===s?void 0:s.buildCustomEvent)||function(){})(e,n(n({},t.dataStore.generalProps),E(i)&&!J(i)?i:{}),r,o)},t.sendPage=function(e){return t.dataStore.currentPage.buildPageEvent(e)},t.sendVisit=function(e){return t.dataStore.buildVisitEvent(e)},t.trackTimerStart=function(e,n){t.vdsConfig.dataCollect&&te(e,(function(){var i=de();_(n)?(t.dataStore.trackTimers[i]={eventName:e,leng:0,start:+Date.now()},n(i)):X("回调方法不合法,返回timerId失败!")}))},t.trackTimerPause=function(e){if(e&&t.dataStore.trackTimers[e]){var n=t.dataStore.trackTimers[e];n.start&&(n.leng=n.leng+(+Date.now()-n.start)),n.start=0}},t.trackTimerResume=function(e){if(e&&t.dataStore.trackTimers[e]){var n=t.dataStore.trackTimers[e];0===n.start&&(n.start=+Date.now())}},t.trackTimerEnd=function(e,i){if(t.vdsConfig.dataCollect)if(e&&t.dataStore.trackTimers[e]){var r=t.dataStore.trackTimers[e];if(0!==r.start){var o=+Date.now()-r.start;r.leng=o>0?r.leng+o:0}t.track(r.eventName,n(n({},i),{event_duration:r.leng>864e5?0:r.leng/1e3})),t.removeTimer(e)}else X("未查找到对应的计时器,请检查!","error")},t.removeTimer=function(e){e&&t.dataStore.trackTimers[e]&&delete t.dataStore.trackTimers[e]},t.clearTrackTimer=function(){t.dataStore.trackTimers={}},t.dataStore=new Ke(t),t}return t(i,e),i}((function(){var e,t=this;this.trackingId="g0",this.init=function(e){var n,i,r,o,a;X("Gio Web SDK 初始化中...","info");var s=t.dataStore,u=s.initOptions,c=s.currentPage,d=s.sendVisit,l=s.sendPage;u(e),t.storage=_e(t.vdsConfig),t.initCallback(),null===(n=t.emitter)||void 0===n||n.emit("OPTION_INITIALIZED",t),null===(r=null===(i=t.plugins)||void 0===i?void 0:i.gioEventAutoTracking)||void 0===r||r.main(),c.hookHistory(),c.parsePage(),null===(o=t.emitter)||void 0===o||o.emit("SDK_INITIALIZED",t),X("Gio Web SDK 初始化完成!","success"),t.useEmbeddedInherit||(t.dataStore.lastVisitEvent.timestamp=c.time,d()),l(),t.gioSDKInitialized=!0,t.vdsConfig.gioSDKInitialized=!0,window[t.vds]=t.vdsConfig,null===(a=t.emitter)||void 0===a||a.emit("SDK_INITIALIZED_COMPLATE",t)},this.setOption=function(e,n){if(U(p,e)){var i=t.dataStore.setOption(e,n);return i&&v[e]&&X("已".concat(n?"开启":"关闭").concat(v[e]),"info"),i}return X("不存在可修改的配置项:".concat(e,",请检查后重试!"),"warn"),!1},this.getOption=function(e){return t.dataStore.getOption(e)},this.setGeneralProps=function(e){E(e)&&!J(e)?(t.dataStore.generalProps=n(n({},t.dataStore.generalProps),e),G(t.dataStore.generalProps).forEach((function(e){U([void 0,null],t.dataStore.generalProps[e])&&(t.dataStore.generalProps[e]="")}))):t.callError("setGeneralProps")},this.clearGeneralProps=function(e){C(e)&&!J(e)?e.forEach((function(e){W(t.dataStore.generalProps,e)})):t.dataStore.generalProps={}},this.reissuePage=function(){t.dataStore.sendPage()},this.notRecommended=function(){return X("不推荐的方法使用,建议使用 gio('setOption', [optionName], [value])!","info")},this.callError=function(e,t,n){return void 0===t&&(t=!0),void 0===n&&(n="参数不合法"),X("".concat(t?"调用":"设置"," ").concat(e," 失败,").concat(n,"!"),"warn")},this.updateImpression=function(){var e,n,i=null===(n=null===(e=t.plugins)||void 0===e?void 0:e.gioImpressionTracking)||void 0===n?void 0:n.main;i?i("emitter"):X("updateImpression 错误! 请集成半自动埋点浏览插件后重试!","error")},this.gioEnvironment="cdp",this.sdkVersion="3.8.6",this.vds=window.gioCompatibilityVds?"gdp_vds":"vds",this.utils=n(n({},Z),ne),this.emitter={all:e=e||new Map,on:function(t,n){var i=e.get(t);i?i.push(n):e.set(t,[n])},off:function(t,n){var i=e.get(t);i&&(n?i.splice(i.indexOf(n)>>>0,1):e.set(t,[]))},emit:function(t,n){var i=e.get(t);i&&i.slice().map((function(e){e(n)})),(i=e.get("*"))&&i.slice().map((function(e){e(t,n)}))}},this.useEmbeddedInherit=!1,this.useHybridInherit=!1,this.gioSDKInitialized=!1,this.plugins=new xe(this),this.plugins.innerPluginInit()}));!function(){var e,t,i,r,o,a=window.gioCompatibilityVds?"gdp_vds":"vds";if(null===(e=window[a])||void 0===e?void 0:e.gioSDKInstalled)return ue=window.gdp,void X("SDK重复加载,请检查是否重复加载SDK或接入其他平台SDK导致冲突!","warn");window[a]=n(n({},null!==(t=window[a])&&void 0!==t?t:{}),{gioSDKInstalled:!0});var s=new Le;ue=function(){var e,t=arguments[0];if(S(t)&&U(m,t)&&s[t]){var i=q(K(arguments));if("init"===t){var r=function(e){var t;return e.vdsConfig||e.gioSDKInitialized||(null===(t=window.vds)||void 0===t?void 0:t.gioSDKInitialized)?(X("SDK重复初始化,请检查是否重复加载SDK或接入其他平台SDK导致冲突!","warn"),!1):!(U(["","localhost","127.0.0.1"],location.hostname)&&!window._gr_ignore_local_rule&&(X("当前SDK不允许在本地环境初始化!","warn"),1))}(s);if(!r)return;var o=function(e){return!J(N(e))||(X('SDK初始化失败,请使用 gdp("init", "您的GrowingIO项目 accountId", "您项目的 dataSourceId", options); 进行初始化!',"error"),!1)}(i);if(!o)return;var u=function(e){var t=P(e),n=x(e);return ie(R(t).trim())?(E(n)&&n||(n={}),{projectId:t,userOptions:n}):(X("SDK初始化失败,accountId 参数不合法!","error"),!1)}(i);if(!u)return;var c=function(e){var t=e[1],n=e[2],i=x(e);return t&&S(t)?{dataSourceId:t,appId:S(n)?n:"",cdpOptions:i}:(X("SDK初始化失败,dataSourceId 参数不合法!","error"),!1)}(i);if(!c)return;var d=u.projectId,l=c.dataSourceId,g=c.appId,f=c.cdpOptions;s.init(n(n({},f),{projectId:d,dataSourceId:l,appId:g}))}else if("registerPlugins"===t)s.registerPlugins(i[0]);else{if(s.gioSDKInitialized&&s.vdsConfig)return s[t].apply(s,i);s.emitter.emit("UNINITIALIZED_CALL",arguments),X("SDK未初始化!","error")}}else U(h,t)?X("方法 ".concat(R(t)," 已被弃用,请移除!"),"warn"):X("不存在名为 ".concat(R(t)," 的方法调用!"),"error");window[a]=n(n({},window[a]),{_gr_ignore_local_rule:null!==(e=window._gr_ignore_local_rule)&&void 0!==e&&e,gioEnvironment:"cdp",gioSDKVersion:s.sdkVersion,gioSDKFull:s.gioSDKFull,canIUse:function(e){return U(m,e)&&s[e]}})};var u=null===(i=null===window||void 0===window?void 0:window.gdp)||void 0===i?void 0:i.q,c=null===(r=null===window||void 0===window?void 0:window.gdp)||void 0===r?void 0:r.e,d=null===(o=null===window||void 0===window?void 0:window.gdp)||void 0===o?void 0:o.ef;window.gdp=ue,window.gdp.e=c,window.gdp.ef=d,C(u)&&!J(u)&&u.forEach((function(e){ue.apply(null,e)}))}();var je=ue;export{je as default}; +var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)({}).hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};function t(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+n+" is not a constructor or null");function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}var n=function(){return n=Object.assign||function(e){for(var t,n=1,r=arguments.length;r>n;n++)for(var i in t=arguments[n])({}).hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},n.apply(this,arguments)};function r(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;o>i;i++)!r&&i in t||(r||(r=[].slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||[].slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var i=["web","wxwv","minp","alip","baidup","qq","bytedance"],o={autotrack:{type:"boolean",default:!0},compress:{type:"boolean",default:!0},dataCollect:{type:"boolean",default:!0},debug:{type:"boolean",default:!1},hashtag:{type:"boolean",default:!1},touch:{type:"boolean",default:!1},version:{type:"string",default:"1.0.0"},platform:{type:"string",default:"web"},cookieDomain:{type:"string",default:""},sendType:{type:"string",default:"beacon"}},a={enableIdMapping:{type:"boolean",default:!1},gtouchHost:{type:"string",default:""},host:{type:"string",default:"napi.growingio.com"},ignoreFields:{type:"array",default:[]},penetrateHybrid:{type:"boolean",default:!0},scheme:{type:"string",default:location.protocol.indexOf("http")>-1?location.protocol.replace(":",""):"https"},sessionExpires:{type:"number",default:30},performance:{type:"object",default:{monitor:!0,exception:!0}},embeddedIgnore:{type:"array",default:[]},storageType:{type:"string",default:"cookie"},requestTimeout:{type:"number",default:5e3}},s={},u=["clearUserId","getGioInfo","getLocation","getOption","init","setDataCollect","setOption","setUserId","track","setGeneralProps","clearGeneralProps"];r(r([],u,!0),["setEvar","setPage","setUser","setVisitor"],!1);var c,d,l,g,f,m=r(r([],u,!0),["enableDebug","enableHT","setAutotrack","setTrackerHost","setTrackerScheme","setUserAttributes","getVisitorId","getDeviceId","registerPlugins","getPlugins","sendPage","sendVisit","trackTimerStart","trackTimerPause","trackTimerResume","trackTimerEnd","removeTimer","clearTrackTimer","updateImpression"],!1),p=["autotrack","dataCollect","dataSourceId","debug","host","hashtag","scheme"],v={autotrack:"无埋点采集",dataCollect:"数据采集",debug:"调试模式"},h=["send","setConfig","collectImp","setPlatformProfile"],I=["screenHeight","screenWidth"],w="function"==typeof Array.from?Array.from:(d||(d=1,l=function(e){return"function"==typeof e},g=function(e){var t=function(e){var t=Number(e);return isNaN(t)?0:0!==t&&isFinite(t)?(t>0?1:-1)*Math.floor(Math.abs(t)):t}(e);return Math.min(Math.max(t,0),9007199254740991)},f=function(e){var t=e.next();return!t.done&&t},c=function(e){var t,n,r,i=this,o=arguments.length>1?arguments[1]:void 0;if(void 0!==o){if(!l(o))throw new TypeError("Array.from: when provided, the second argument must be a function");arguments.length>2&&(t=arguments[2])}var a=function(e,t){if(null!=e&&null!=t){var n=e[t];if(null==n)return;if(!l(n))throw new TypeError(n+" is not a function");return n}}(e,function(e){if(null!=e){if(["string","number","boolean","symbol"].indexOf(typeof e)>-1)return Symbol.iterator;if("undefined"!=typeof Symbol&&"iterator"in Symbol&&Symbol.iterator in e)return Symbol.iterator;if("@@iterator"in e)return"@@iterator"}}(e));if(void 0!==a){n=l(i)?Object(new i):[];var s,u,c=a.call(e);if(null==c)throw new TypeError("Array.from requires an array-like or iterable object");for(r=0;;){if(!(s=f(c)))return n.length=r,n;u=s.value,n[r]=o?o.call(t,u,r):u,r++}}else{var d=Object(e);if(null==e)throw new TypeError("Array.from requires an array-like object - not null or undefined");var m,p=g(d.length);for(n=l(i)?Object(new i(p)):Array(p),r=0;p>r;)m=d[r],n[r]=o?o.call(t,m,r):m,r++;n.length=p}return n}),c),y=function(e){return U(["undefined","null"],Q(e))},S=function(e){return"string"===Q(e)},O=function(e){return"number"===Q(e)},b=function(e){return"NaN"===R(Number(e))},E=function(e){return"object"===Q(e)&&!y(e)},T=function(e){return"regexp"===Q(e)},_=function(e){return U(["function","asyncfunction"],Q(e))},C=function(e){return Array.isArray(e)&&"array"===Q(e)},k=function(e){return"date"===Q(e)},P=function(e){try{return K(e)[0]}catch(e){return}},x=function(e){try{var t=K(e);return t[t.length-1]}catch(e){return}},q=function(e,t){return void 0===t&&(t=1),C(e)&&O(t)?e.slice(t>0?t:1,e.length):e},N=function(e){if(C(e)){for(var t=0,n=[],r=0,i=e;r=0},K=w,R=function(e){return y(e)?"":"".concat(e)},L=function(e,t){return"string"==typeof e?e.split(t):e},j=function(e){if(S(e)){var t=L(e,"");return"".concat(P(t).toLowerCase()).concat(q(t).join(""))}return e},F=function(e,t){return!!S(e)&&e.slice(0,t.length)===t},B=function(e,t){if(S(e)){var n=e.length,r=n;r>n&&(r=n);var i=r;return(r-=t.length)>=0&&e.slice(r,i)===t}return!1},V={}.hasOwnProperty,H=function(e,t){return!y(e)&&V.call(e,t)},G=function(e){return E(e)?Object.keys(e):[]},M=function(e,t){G(e).forEach((function(n){return t(e[n],n)}))},z=function(e,t){var n=G(e);return!(!E(e)||!E(t)||n.length!==G(t).length||U(n.map((function(n,r){return E(e[n])?z(e[n],t[n]):e[n]===t[n]})),!1))},W=function(e,t){if(!E(e))return!1;try{return"string"===Q(t)?delete e[t]:"array"===Q(t)?t.map((function(t){return delete e[t]})):(T(t)&&G(e).forEach((function(n){t.test(n)&&W(e,n)})),!0)}catch(e){return!1}},J=function(e){return C(e)?0===e.length:E(e)?0===G(e).length:!e},Q=function(e){return{}.toString.call(e).slice(8,-1).toLowerCase()},Z=Object.freeze({__proto__:null,isNil:y,isString:S,isNumber:O,isNaN:b,isBoolean:function(e){return"boolean"===Q(e)},isObject:E,isRegExp:T,isFunction:_,isArray:C,isDate:k,fixed:function(e,t){return O(e)?Number(e.toFixed(O(t)?t:2)):S(e)&&"NaN"!==R(Number(e))?Number(Number(e).toFixed(O(t)?t:2)):e},head:P,last:x,drop:q,dropWhile:function(e,t){return C(e)?e.filter((function(e){return!t(e)})):e},compact:N,find:D,findIndex:A,includes:U,arrayFrom:K,toString:R,split:L,lowerFirst:j,upperFirst:function(e){if(S(e)){var t=L(e,"");return"".concat(P(t).toUpperCase()).concat(q(t).join(""))}return e},startsWith:F,endsWith:B,has:H,keys:G,forEach:M,isEqual:z,get:function(e,t,n){var r=e;return E(e)?(t.split(".").forEach((function(e){r=r?r[e]:n})),r):n},unset:W,isEmpty:J,typeOf:Q,formatDate:function(e){if(k(e)){var t=function(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())}return e}}),X=function(e,t){console.log("%c [GrowingIO]:".concat(e),{info:"color: #3B82F6;",error:"color: #EF4444;",warn:"color: #F59E0B;",success:"color: #10B981;"}[t]||"")},Y=function(e){try{return e()}catch(e){return}},$=function(e){var t={};return E(e)&&M(e,(function(e,n){var r,i=R(n).slice(0,100);E(e)?t[i]=$(e):C(e)?(t[i]=e.slice(0,100),"cdp"===(null===(r=window.vds)||void 0===r?void 0:r.gioEnvironment)&&(t[i]=t[i].join("||").slice(0,1e3))):t[i]=y(e)?"":R(e).slice(0,1e3)})),t},ee=function(e,t,r,i){void 0===i&&(i={}),document.addEventListener?e.addEventListener(t,r,n(n({},{capture:!0}),i)):e.attachEvent?e.attachEvent("on"+t,r):e["on"+t]=r},te=function(e,t){return S(e)&&!J(e)&&e.match(/^[a-zA-Z_][0-9a-zA-Z_]{0,100}$/)?t():(X("事件名格式不正确,只能包含数字、字母和下划线,且不能以数字开头,字符总长度不能超过100!","error"),!1)},ne=Object.freeze({__proto__:null,consoleText:X,niceTry:Y,limitObject:$,addListener:ee,flattenObject:function(e){void 0===e&&(e={});var t=n({},e);return G(t).forEach((function(e){E(t[e])?(G(t[e]).forEach((function(n){t["".concat(e,"_").concat(n)]=R(t[e][n])})),W(t,e)):C(t[e])?(t[e].forEach((function(n,r){E(n)?G(n).forEach((function(i){t["".concat(e,"_").concat(r,"_").concat(i)]=R(n[i])})):t["".concat(e,"_").concat(r)]=R(n)})),W(t,e)):y(t[e])||""===t[e]?W(t,e):t[e]=R(t[e])})),$(t)},eventNameValidate:te,getGioFunction:function(){var e,t,n,r,i=window._gio_local_vds||"vds",o=null!==(t=null===(e=window[i])||void 0===e?void 0:e.namespace)&&void 0!==t?t:"gdp";return _(window[o])?window[o]:null!==(r=null!==(n=window.gdp)&&void 0!==n?n:window.gio)&&void 0!==r?r:function(){}}}),re=function(e){return S(e)&&e.length>0||O(e)&&e>0},ie=/^((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})(\.((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})){3}/i,oe=/^(https?:\/\/)|(([a-zA-Z0-9_-])+(\.)?)*(:\d+)?(\/((\.)?(\?)?=?&?[a-zA-Z0-9_-](\?)?)*)*$/i;function ae(e){for(var t=1;arguments.length>t;t++){var n=arguments[t];for(var r in n)e[r]=n[r]}return e}var se,ue,ce=function e(t,n){function r(e,r,i){if("undefined"!=typeof document){"number"==typeof(i=ae({},n,i)).expires&&(i.expires=new Date(Date.now()+864e5*i.expires)),i.expires&&(i.expires=i.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var o="";for(var a in i)i[a]&&(o+="; "+a,!0!==i[a]&&(o+="="+i[a].split(";")[0]));return document.cookie=e+"="+t.write(r,e)+o}}return Object.create({set:r,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var n=document.cookie?document.cookie.split("; "):[],r={},i=0;i+Date.now()?ge(pe(t.value)):void 0},this.setItem=function(e,t,n){var r=null!=n?n:+new Date(9999,12);localStorage.setItem(le(e),JSON.stringify({value:S(t)&&t.length&&B(e,"_gioenc")?me(t):t,expiredAt:r}))},this.removeItem=function(e){return localStorage.removeItem(le(e))},this.hasItem=function(e){return!!localStorage.getItem(le(e))},this.getKeys=function(){return K(Array(localStorage.length)).map((function(e,t){return localStorage.key(t)}))},this.type="localStorage"},ye={},Se=function(){this.getItem=function(e){var t=Y((function(){return JSON.parse(ye[le(e)]||"")}));return E(t)&&t.expiredAt>+Date.now()?ge(pe(t.value)):void 0},this.setItem=function(e,t,n){var r=null!=n?n:+new Date(9999,12);ye[le(e)]=JSON.stringify({value:S(t)&&t.length?me(t):t,expiredAt:r})},this.removeItem=function(e){return W(ye,le(e))},this.hasItem=function(e){return H(ye,le(e))},this.getKeys=function(){return G(ye)},this.type="memory"},Oe=/^(\.ac\.|\.br\.|\.co\.|\.com\.|\.edu\.|\.gov\.|\.org\.|\.net\.)/,be=function(e){var t=[];try{var n=e.split("."),r=x(n);if(n.length>=2&&(isNaN(Number(r))||0>Number(r)||Number(r)>255)){var i=".".concat(n.slice(-2).join("."));Oe.test(i)?se=i:t.push(i);var o=".".concat(n.slice(-3).join("."));Oe.test(o)||U(t,o)||t.push(o);var a=".".concat(n.slice(-4).join("."));Oe.test(a)||U(t,a)||t.push(a)}}catch(e){}return t},Ee=function(e){var t="";return e.every((function(e){return!Te(e)||(t=e,!1)})),t},Te=function(e){try{ce.set("gioCookie","yes",{domain:e});var t=!!ce.get("gioCookie",{domain:e});return ce.remove("gioCookie",{domain:e}),t}catch(e){return!1}},_e=function(e){var t,n,i,o=e.storageType,a=e.cookieDomain,s=e.projectId;if(U(["cookie","localstorage"],o)||(o="cookie"),"cookie"===o&&(n=!!(i=navigator.userAgent.indexOf("Electron")>-1||U(["","localhost","127.0.0.1"],window.location.hostname)||!U(["http:","https:"],window.location.protocol)?"":Ee(r(r([],be(window.location.hostname),!0),[window.location.hostname],!1)))),"cookie"===o&&n){var u=new Ie(i);if(a){var c=be(a),d=Ee(J(c)?[]:r([a],be(a),!0));d&&Te(d)?u.domain=d:X("指定Cookie域无效或无权限,使用默认域!","warn")}t=u}else t=function(){try{var e=window.localStorage,t="__storage_test__";return e.setItem(t,t),e.removeItem(t),!0}catch(e){return!1}}()?new we:new Se;return"cookie"===o&&se&&Te(se)&&function(e,t,n){if(t&&Te(t)){var r=new Ie(t);["".concat(n,"_gdp_session_id"),"gdp_user_id_gioenc","".concat(n,"_gdp_cs1_gioenc"),"".concat(n,"_gdp_user_key_gioenc"),"".concat(n,"_gdp_gio_id_gioenc"),"".concat(n,"_gdp_sequence_ids"),"".concat(n,"_gdp_session_id_sent")].forEach((function(t){var n=r.getItem(t);r.hasItem(t)&&(e.setItem(t,n),r.removeItem(t))})),r=void 0}}(t,se,s),t},Ce="SESSIONID_UPDATE",ke={name:"gioCustomTracking",method:function(e){var t=this;this.growingIO=e,this.getValidResourceItem=function(e){if(e&&E(e)&&e.id&&e.key){var t={id:S(e.id)?e.id:R(e.id),key:S(e.key)?e.key:R(e.key)};return e.attributes&&(t.attributes=e.attributes),t}},this.getDynamicAttributes=function(e){return y(e)||G(e).forEach((function(t){_(e[t])?e[t]=e[t]():E(e[t])?W(e,t):C(e[t])||(e[t]=R(e[t]))})),e},this.buildCustomEvent=function(e,r,i,o){te(e,(function(){var a=t.growingIO.dataStore,s=a.eventContextBuilder,u=a.eventConverter,c=a.currentPage,d=n({eventType:"CUSTOM",eventName:e,pageShowTimestamp:null==c?void 0:c.time,attributes:$(t.getDynamicAttributes(E(r)&&!J(r)?r:void 0)),resourceItem:$(t.getValidResourceItem(i))},s());J(o)||(d=n(n({},d),o)),u(d)}))},this.buildUserAttributesEvent=function(e,r){var i=t.growingIO.dataStore,o=i.eventContextBuilder,a=i.eventConverter,s=n({eventType:"LOGIN_USER_ATTRIBUTES",attributes:$(e)},o());J(r)||(s=n(n({},s),r)),a(s)}}},Pe=["gioPerformance"],xe=function(e){function n(t){var n=e.call(this,t)||this;return n.growingIO=t,n.growingIO.gioSDKFull=!1,n.pluginsContext={plugins:{gioCustomTracking:ke}},n}return t(n,e),n}((function(e){var t,n,r,i,o=this;this.growingIO=e,this.innerPluginInit=function(){var e;Pe.forEach((function(e){var t;return W(null===(t=o.pluginsContext)||void 0===t?void 0:t.plugins,e)})),G(null===(e=o.pluginsContext)||void 0===e?void 0:e.plugins).forEach((function(e){var t,n=null===(t=o.pluginsContext)||void 0===t?void 0:t.plugins[e],r=n.name,i=n.method;D(o.pluginItems,(function(e){return e.name===r}))||o.pluginItems.push({name:j(r||e),method:i||function(e){}})})),J(o.pluginItems)||o.installAll()},this.install=function(e,t,n){var r,i,a=t||D(o.pluginItems,(function(t){return t.name===e}));if((null===(r=o.growingIO)||void 0===r?void 0:r.plugins)[e])return X("重复加载插件 ".concat(e," 或插件重名,已跳过加载!"),"warn"),!1;if(!a)return X("插件加载失败!不存在名为 ".concat(e," 的插件!"),"error"),!1;try{return(null===(i=o.growingIO)||void 0===i?void 0:i.plugins)[e]=new a.method(o.growingIO,n),"cdp"===o.growingIO.gioEnvironment&&t&&X("加载插件 ".concat(e),"info"),!0}catch(e){return X("插件加载异常 ".concat(e),"error"),!1}},this.installAll=function(e){(e||o.pluginItems).forEach((function(t){o.install(t.name,e?t:void 0,e?null==t?void 0:t.options:void 0)&&!D(o.pluginItems,(function(e){return e.name===t.name}))&&o.pluginItems.push({name:j(t.name),method:t.method?t.method:function(){}})}))},this.uninstall=function(e){var t;W(o.pluginItems,e);var n=W(null===(t=o.growingIO)||void 0===t?void 0:t.plugins,e);return n||X("卸载插件 ".concat(e," 失败!"),"error"),n},this.uninstallAll=function(){o.pluginItems.forEach((function(e){return o.uninstall(e.name)}))},this.lifeError=function(e,t){return X("插件执行错误 ".concat(e.name," ").concat(t),"error")},this.onComposeBefore=function(e){o.pluginItems.forEach((function(t){var n,r=null===(n=o.growingIO.plugins[t.name])||void 0===n?void 0:n.onComposeBefore;if(r&&_(r))try{r(e)}catch(e){o.lifeError(t,e)}}))},this.onComposeAfter=function(e){o.pluginItems.forEach((function(t){var n,r=null===(n=o.growingIO.plugins[t.name])||void 0===n?void 0:n.onComposeAfter;if(r&&_(r))try{r(e)}catch(e){o.lifeError(t,e)}}))},this.onSendBefore=function(e){o.pluginItems.forEach((function(t){var n,r=null===(n=o.growingIO.plugins[t.name])||void 0===n?void 0:n.onSendBefore;if(r&&_(r))try{r(e)}catch(e){o.lifeError(t,e)}}))},this.onSendAfter=function(e){o.pluginItems.forEach((function(t){var n,r=null===(n=o.growingIO.plugins[t.name])||void 0===n?void 0:n.onSendAfter;if(r&&_(r))try{r(e)}catch(e){o.lifeError(t,e)}}))},this.pluginsContext={plugins:{}},this.pluginItems=[],null===(t=this.growingIO.emitter)||void 0===t||t.on("onComposeBefore",this.onComposeBefore),null===(n=this.growingIO.emitter)||void 0===n||n.on("onComposeAfter",this.onComposeAfter),null===(r=this.growingIO.emitter)||void 0===r||r.on("onSendBefore",this.onSendBefore),null===(i=this.growingIO.emitter)||void 0===i||i.on("onSendAfter",this.onSendAfter)})),qe=function(){function e(e){this.growingIO=e;var t=this.growingIO.vdsConfig.projectId,n=this.growingIO.storage,r=n.getItem,i=n.setItem,o=n.getKeys,a=n.removeItem;this.getItem=r,this.setItem=i,this.getKeys=o,this.removeItem=a,this.sIdStorageName="".concat(t,"_gdp_session_id"),this.uidStorageName="gdp_user_id_gioenc",this.userIdStorageName="".concat(t,"_gdp_cs1_gioenc"),this.userKeyStorageName="".concat(t,"_gdp_user_key_gioenc"),this.gioIdStorageName="".concat(t,"_gdp_gio_id_gioenc")}return Object.defineProperty(e.prototype,"sessionId",{get:function(){return this.getItem(this.sIdStorageName)||(this.sessionId=de(),this.sessionId)},set:function(e){var t,n=this;e||(e=de());var r=this.getItem(this.sIdStorageName)||this.prevSessionId,i=this.growingIO.vdsConfig.sessionExpires,o=void 0===i?30:i;this.setItem(this.sIdStorageName,e,+Date.now()+60*o*1e3),r!==e&&(this.getKeys().filter((function(e){return/.+_gdp_session_id_.{36}/.test(e)})).forEach((function(e){n.removeItem(e)})),this.setItem(this.growingIO.dataStore.visitStorageName,""),null===(t=this.growingIO.emitter)||void 0===t||t.emit(Ce,{newSessionId:e,oldSessionId:r})),this.prevSessionId=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"uid",{get:function(){return this.getItem(this.uidStorageName)||(this.uid=de(),this.uid)},set:function(e){var t,n=this.getItem(this.uidStorageName)||this.prevUId;this.setItem(this.uidStorageName,e),n!==e&&(null===(t=this.growingIO.emitter)||void 0===t||t.emit("UID_UPDATE",{newUId:e,oldUId:n})),this.prevUId=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"userId",{get:function(){return this.getItem(this.userIdStorageName)||""},set:function(e){var t,n,r=this.getItem(this.userIdStorageName)||this.prevUserId;this.setItem(this.userIdStorageName,e),null===(t=this.growingIO.emitter)||void 0===t||t.emit("SET_USERID",{newUserId:e,oldUserId:r,userKey:this.userKey}),r!==e&&(null===(n=this.growingIO.emitter)||void 0===n||n.emit("USERID_UPDATE",{newUserId:e,oldUserId:r,userKey:this.userKey})),e&&(this.gioId=e),this.prevUserId=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"userKey",{get:function(){return this.getItem(this.userKeyStorageName)||""},set:function(e){var t,n,r=this.getItem(this.userKeyStorageName)||this.prevUserKey;this.setItem(this.userKeyStorageName,e),null===(t=this.growingIO.emitter)||void 0===t||t.emit("SET_USERKEY",{newUserKey:e,oldUserKey:r,userId:this.userId}),r!==e&&(null===(n=this.growingIO.emitter)||void 0===n||n.emit("USERKEY_UPDATE",{newUserKey:e,oldUserKey:r,userId:this.userId})),this.prevUserKey=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"gioId",{get:function(){return this.getItem(this.gioIdStorageName)||""},set:function(e){var t,n=this.getItem(this.gioIdStorageName)||this.prevGioId;this.setItem(this.gioIdStorageName,e),n!==e&&(null===(t=this.growingIO.emitter)||void 0===t||t.emit("GIOID_UPDATE",{newGioId:e,oldGioId:n})),this.prevGioId=e},enumerable:!1,configurable:!0}),e}(),Ne=function(e){var t=this;this.growingIO=e,this.main=function(){var e,r,i=t.growingIO,o=i.sdkVersion,a=i.useEmbeddedInherit,s=i.vdsConfig,u=i.userStore,c=i.dataStore,d=i.trackingId,l=c.currentPage,g=l.path,f=l.query,m={appVersion:s.version,dataSourceId:s.dataSourceId,deviceId:u.uid,domain:a?s.appId:window.location.host,gioId:u.gioId,language:navigator.language,path:g,platform:s.platform,query:f,referralPage:(null===(e=c.lastPageEvent)||void 0===e?void 0:e.referralPage)||"",screenHeight:window.screen.height,screenWidth:window.screen.width,sdkVersion:o,sessionId:u.sessionId,timestamp:+Date.now(),title:null!==(r=Y((function(){return document.title.slice(0,255)})))&&void 0!==r?r:"",userId:u.userId};if(s.enableIdMapping&&(m.userKey=u.userKey),J(s.ignoreFields)||s.ignoreFields.forEach((function(e){W(m,e)})),a&&!J(t.minpExtraParams)){var p=n({},m);M(n(n({},m),t.minpExtraParams),(function(e,n){var r;U(s.embeddedIgnore,n)?(m[n]=p[n],"domain"===n&&(m[n]=window.location.host)):m[n]=null!==(r=t.minpExtraParams[n])&&void 0!==r?r:m[n]}))}return m.trackingId=d,m},this.minpExtraParams={}},De=function(e){var t=this;this.growingIO=e,this.parsePage=function(){var e=t.growingIO.vdsConfig.hashtag,n=location.pathname,r=location.search,i=location.hash,o=i.indexOf("?");t.domain=window.location.host,t.title=document.title.slice(0,255),t.time=+Date.now(),t.path=n,t.query=r,e&&(o>-1?(t.path+=i.slice(0,o),t.query=t.query+"&"+i.slice(o+1)):t.path+=i),t.query&&U(["?","&"],t.query.charAt(0))&&(t.query=t.query.slice(1))},this._getNoHashHref=function(){var e=window.location,t=e.protocol,n=e.host,r=e.pathname,i=e.search;return"".concat(t,"://").concat(n).concat(r).concat(i)},this.getReferralPage=function(){var e,n,r=t.growingIO.dataStore.lastPageEvent;return(null==r?void 0:r.path)===t.path&&(null!==(e=null==r?void 0:r.query)&&void 0!==e?e:"")===(null!==(n=t.query)&&void 0!==n?n:"")?null==r?void 0:r.referralPage:(null==r?void 0:r.path)?t.lastHref:document.referrer},this.pageListener=function(){var e=t.growingIO.vdsConfig.hashtag,n=window.location.href,r=t.lastHref;e||(n=t._getNoHashHref(),r=t.lastNoHashHref),r!==n&&(t.parsePage(),t.buildPageEvent())},this.hookHistory=function(){var e=window.history.pushState,n=window.history.replaceState,r=t;e&&Y((function(){return window.history.pushState=function(){e.apply(window.history,arguments),setTimeout(r.pageListener)}})),n&&Y((function(){return window.history.replaceState=function(){n.apply(window.history,arguments),setTimeout(r.pageListener)}})),ee(window,"popstate",t.pageListener),t.growingIO.vdsConfig.hashtag&&ee(window,"hashchange",t.pageListener)},this.buildPageEvent=function(e){var r=t.growingIO.dataStore;r.lastPageEvent;var i=r.eventContextBuilder,o=r.eventConverter,a=n(n({eventType:"PAGE"},i()),{protocolType:location.protocol.substring(0,location.protocol.length-1),referralPage:t.getReferralPage()});J(e)||(a=n(n({},a),e)),a.timestamp=t.time,o(a),t.lastHref=window.location.href,t.lastNoHashHref=t._getNoHashHref(),t.lastLocation=n({},window.location)},this.title=document.title.slice(0,255),this.lastLocation=n({},window.location)},Ae={referralPage:document.referrer},Ue=function(){function e(e){var t,r,u,c=this;this.growingIO=e,this.ALLOW_SETTING=n(n({},o),"saas"===this.growingIO.gioEnvironment?s:a),this.allowOptKeys=Object.keys(this.ALLOW_SETTING),this.trackTimers={},this.setSequenceIds=function(e,t){var r=c.growingIO.storage.getItem(c.seqStorageIdName)||{};"gsid"===e?r.globalKey=t:r=n(n({},r),t),c.growingIO.storage.setItem(c.seqStorageIdName,r)},this.initOptions=function(e){var t,r,o,a,s,u,d,l=e.projectId,g=e.dataSourceId,f=e.appId;c.initialDataSourceId=g;var m={};c.allowOptKeys.forEach((function(t){var n=c.ALLOW_SETTING[t].type,r=C(n)?!U(n,Q(e[t])):Q(e[t])!==n;"platform"!==t||U(i,e[t])||(r=!0),r?m[t]=c.ALLOW_SETTING[t].default:"ignoreFields"===t?m.ignoreFields=e.ignoreFields.filter((function(e){return U(I,e)})):(m[t]=e[t],U(["dataCollect","autotrack"],t)&&(m[t]||X("已关闭".concat(v[t]),"info")))})),m.sessionExpires=Math.round(m.sessionExpires),(b(m.sessionExpires)||1>m.sessionExpires||m.sessionExpires>360)&&(m.sessionExpires=30),m.storageType=m.storageType.toLowerCase(),m.sendType=m.sendType.toLowerCase(),U(["beacon","xhr","image"],m.sendType)||(m.sendType="beacon"),!b(Number(m.requestTimeout))&&m.requestTimeout>0||(m.requestTimeout=5e3),c.growingIO.vdsConfig=n(n(n({},null!==(t=window.vds)&&void 0!==t?t:{}),m),{projectId:l,dataSourceId:g,appId:f,performance:{monitor:null===(o=null===(r=m.performance)||void 0===r?void 0:r.monitor)||void 0===o||o,exception:null===(s=null===(a=m.performance)||void 0===a?void 0:a.exception)||void 0===s||s,network:null!==(d=null===(u=m.performance)||void 0===u?void 0:u.network)&&void 0!==d&&d}}),window.vds=c.growingIO.vdsConfig,c.seqStorageIdName="".concat(l,"_gdp_sequence_ids"),c.visitStorageName="".concat(l,"_gdp_session_id_sent")},this.setOption=function(e,t){var r,i=c.growingIO,o=i.vdsConfig,a=i.callError,s=i.uploader,u=i.emitter,d=S(e)&&U(p,e),l=d&&typeof t===((null===(r=c.ALLOW_SETTING[e])||void 0===r?void 0:r.type)||"string"),g=n({},o);return d&&l?(o[e]=t,"dataCollect"===e&&g.dataCollect!==t&&(t?(c.sendVisit(!0),c.sendPage()):c.growingIO.clearTrackTimer()),U(["host","scheme"],e)&&(null==s||s.generateHost()),null==u||u.emit("OPTION_CHANGE",{optionName:e,optionValue:t}),window.vds[e]=t,!0):(a("setOption > ".concat(e)),!1)},this.getOption=function(e){var t=c.growingIO,r=t.vdsConfig,i=t.callError;return e&&H(r,R(e))?r[R(e)]:y(e)?n({},r):void i("getOption > ".concat(e))},this.sendVisit=function(e){var t=c.growingIO,n=t.userStore.sessionId,r=t.storage.getItem(c.visitStorageName);!e&&n===r||(c.lastVisitEvent.timestamp=c.currentPage.time-1,c.buildVisitEvent())},this.buildVisitEvent=function(e){var t=c.growingIO,r=t.dataStore,i=r.eventContextBuilder,o=r.eventConverter,a=t.emitter,s=t.storage,u=t.userStore,d=c.lastVisitEvent,l=d.referralPage,g=d.title,f=d.path,m=d.query,p=d.timestamp,v=n(n({eventType:"VISIT"},i()),{referralPage:l||c.currentPage.getReferralPage(),timestamp:p});f&&(v.title=g,v.path=f,v.query=m),J(e)||(v.session=(null==e?void 0:e.session)||v.session,v.trackingId=null==e?void 0:e.trackingId,v=n(n({},v),e));var h=function(e){var t=e.requestData;"VISIT"===t.eventType&&t.trackingId===c.growingIO.trackingId&&(u.sessionId===t.sessionId&&s.setItem(c.visitStorageName,t.sessionId),a.off("onSendAfter",h))};a.on("onSendAfter",h),o(v)},this.sendPage=function(e){e&&c.currentPage.parsePage(),c.currentPage.buildPageEvent()},this.buildErrorEvent=function(e){var t=c.growingIO.dataStore,r=t.eventContextBuilder;(0,t.eventConverter)(n({eventType:"CUSTOM",pageShowTimestamp:c.currentPage.time,eventName:"onError",attributes:e},r()))},this.currentPage=new De(this.growingIO),this.eventContextBuilderInst=new Ne(this.growingIO),this.eventContextBuilder=this.eventContextBuilderInst.main,this.generalProps={},this.lastVisitEvent=Ae,null===(t=this.growingIO.emitter)||void 0===t||t.on("onComposeAfter",(function(e){var t=e.composedEvent;"VISIT"!==t.eventType&&"vst"!==t.t||t.trackingId!==c.growingIO.trackingId||(c.lastVisitEvent=t)})),this.lastPageEvent={},null===(r=this.growingIO.emitter)||void 0===r||r.on("onComposeAfter",(function(e){var t=e.composedEvent;"PAGE"!==t.eventType&&"page"!==t.t||t.trackingId!==c.growingIO.trackingId||(c.lastPageEvent=t)})),null===(u=this.growingIO.emitter)||void 0===u||u.on(Ce,(function(){if(c.growingIO.gioSDKInitialized){c.currentPage.parsePage();var e=c.currentPage,t=e.title,n=e.path,r=e.query,i=e.time,o=e.getReferralPage;c.lastVisitEvent={referralPage:document.referrer||o(),title:t,path:n,query:r,timestamp:i-1},c.sendVisit(!0),c.sendPage(!0)}}))}return Object.defineProperty(e.prototype,"esid",{get:function(){var e=this,t=this.growingIO.storage.getItem(this.seqStorageIdName)||{},r=n({},t);return W(r,"globalKey"),r=E(r)&&!y(r)?r:{},this._esid={},G(r).forEach((function(t){e._esid[t]=b(Number(r[t]))||r[t]>=1e9||1>r[t]?1:r[t]})),this._esid},set:function(e){var t={};G(e).forEach((function(n){t[n]=b(e[n])||e[n]>=1e9||1>e[n]?1:e[n]})),z(this._esid,t)||(this._esid=t,this.setSequenceIds("esid",this._esid))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"gsid",{get:function(){var e=this.growingIO.storage.getItem(this.seqStorageIdName)||{},t=Number(e.globalKey);return this._gsid=b(t)||t>=1e9||1>t?1:t,this._gsid},set:function(e){b(Number(e))||e>=1e9||1>e?this._gsid=1:this._gsid=e,this.setSequenceIds("gsid",this._gsid)},enumerable:!1,configurable:!0}),e}(),Ke=function(e){function r(t){var r=e.call(this,t)||this;return r.growingIO=t,r.eventConverter=function(e){var t,i,o=r.growingIO,a=o.vdsConfig,s=o.dataStore,u=o.uploader;if(a.dataCollect){e.trackingId===r.growingIO.trackingId&&(e.globalSequenceId=s.gsid,e.eventSequenceId=s.esid[e.eventType]||1);var c={};M(e,(function(e,t){var n;if("element"===t){var r=null!==(n=P(e))&&void 0!==n?n:{};M(r,(function(e,t){J(e)&&0!==e||(c[t]=e)}))}else(J(e)||y(e))&&0!==e||(c[t]=e)})),e.trackingId===r.growingIO.trackingId&&(r.growingIO.dataStore.gsid+=1,r.growingIO.dataStore.esid=n(n({},r.growingIO.dataStore.esid),((t={})[c.eventType]=(r.growingIO.dataStore.esid[c.eventType]||1)+1,t))),null===(i=r.growingIO.emitter)||void 0===i||i.emit("onComposeAfter",{composedEvent:n({},c)}),e.trackingId===r.growingIO.trackingId&&u.commitRequest(c)}else"VISIT"===e.eventType&&(r.lastVisitEvent=e)},r}return t(r,e),r}(Ue),Re=function(e){function n(t){var n=e.call(this,t)||this;return n.growingIO=t,n.generateHost=function(){var e=n.growingIO.vdsConfig,t=e.scheme,r=e.host,i=void 0===r?"":r,o=e.projectId;t?B(R(t),"://")||(t="".concat(t,"://")):t="".concat(location.protocol.indexOf("http")>-1?location.protocol.replace(":",""):"https","//"),F(i,"http")&&(i=i.substring(i.indexOf("://")+(B(R(t),"://")?3:0))),n.requestURL="".concat(t).concat(i,"/v3/projects/").concat(o,"/collect")},n.requestURL="",n.generateHost(),n}return t(n,e),n}((function(e){var t=this;this.growingIO=e,this.getSendType=function(){var e=t.growingIO.vdsConfig.sendType;return"beacon"===e?function(){var e,t,n=!!(null===(e=null===window||void 0===window?void 0:window.navigator)||void 0===e?void 0:e.sendBeacon),r=window.navigator.userAgent;if(r.match(/(iPad|iPhone|iPod)/g)){var i=!(t=r.toLowerCase().match(/cpu.*os (.*?) like mac os/i))||2>t.length?0:+t[1].split("_").slice(0,2).join(".");return n&&i>13}return n}()?"beacon":"xhr":e},this.commitRequest=function(e){var r=n({},e);t.requestQueue.push(n(n({},r),{requestType:t.getSendType()})),t.initiateRequest()},this.initiateRequest=function(){var e,i,o;if(r([],t.requestQueue,!0).length>0&&t.requestingNum0?R(n).slice(0,1e3):""),t.userStore.userId=R(e).slice(0,1e3),r&&r!==t.userStore.userId&&(t.userStore.sessionId="")}else t.clearUserId(),t.callError("setUserId")},t.clearUserId=function(){t.userStore.userId="",t.userStore.userKey=""},t.track=function(e,r,i,o){var a,s;((null===(s=null===(a=t.plugins)||void 0===a?void 0:a.gioCustomTracking)||void 0===s?void 0:s.buildCustomEvent)||function(){})(e,n(n({},t.dataStore.generalProps),E(r)&&!J(r)?r:{}),i,o)},t.sendPage=function(e){return t.dataStore.currentPage.buildPageEvent(e)},t.sendVisit=function(e){return t.dataStore.buildVisitEvent(e)},t.trackTimerStart=function(e,n){t.vdsConfig.dataCollect&&te(e,(function(){var r=de();_(n)?(t.dataStore.trackTimers[r]={eventName:e,leng:0,start:+Date.now()},n(r)):X("回调方法不合法,返回timerId失败!")}))},t.trackTimerPause=function(e){if(e&&t.dataStore.trackTimers[e]){var n=t.dataStore.trackTimers[e];n.start&&(n.leng=n.leng+(+Date.now()-n.start)),n.start=0}},t.trackTimerResume=function(e){if(e&&t.dataStore.trackTimers[e]){var n=t.dataStore.trackTimers[e];0===n.start&&(n.start=+Date.now())}},t.trackTimerEnd=function(e,r){if(t.vdsConfig.dataCollect)if(e&&t.dataStore.trackTimers[e]){var i=t.dataStore.trackTimers[e];if(0!==i.start){var o=+Date.now()-i.start;i.leng=o>0?i.leng+o:0}t.track(i.eventName,n(n({},r),{event_duration:i.leng>864e5?0:i.leng/1e3})),t.removeTimer(e)}else X("未查找到对应的计时器,请检查!","error")},t.removeTimer=function(e){e&&t.dataStore.trackTimers[e]&&delete t.dataStore.trackTimers[e]},t.clearTrackTimer=function(){t.dataStore.trackTimers={}},t.dataStore=new Ke(t),t}return t(r,e),r}((function(){var e,t=this;this.trackingId="g0",this.init=function(e){var n,r,i,o,a;X("Gio Web SDK 初始化中...","info");var s=t.dataStore,u=s.initOptions,c=s.currentPage,d=s.sendVisit,l=s.sendPage;u(e),t.storage=_e(t.vdsConfig),t.initCallback(),null===(n=t.emitter)||void 0===n||n.emit("OPTION_INITIALIZED",t),null===(i=null===(r=t.plugins)||void 0===r?void 0:r.gioEventAutoTracking)||void 0===i||i.main(),c.hookHistory(),c.parsePage(),null===(o=t.emitter)||void 0===o||o.emit("SDK_INITIALIZED",t),X("Gio Web SDK 初始化完成!","success"),t.useEmbeddedInherit||(t.dataStore.lastVisitEvent.timestamp=c.time,d()),l(),t.gioSDKInitialized=!0,t.vdsConfig.gioSDKInitialized=!0,window[t.vds]=t.vdsConfig,null===(a=t.emitter)||void 0===a||a.emit("SDK_INITIALIZED_COMPLATE",t)},this.setOption=function(e,n){if(U(p,e)){var r=t.dataStore.setOption(e,n);return r&&v[e]&&X("已".concat(n?"开启":"关闭").concat(v[e]),"info"),r}return X("不存在可修改的配置项:".concat(e,",请检查后重试!"),"warn"),!1},this.getOption=function(e){return t.dataStore.getOption(e)},this.setGeneralProps=function(e){E(e)&&!J(e)?(t.dataStore.generalProps=n(n({},t.dataStore.generalProps),e),G(t.dataStore.generalProps).forEach((function(e){U([void 0,null],t.dataStore.generalProps[e])&&(t.dataStore.generalProps[e]="")}))):t.callError("setGeneralProps")},this.clearGeneralProps=function(e){C(e)&&!J(e)?e.forEach((function(e){W(t.dataStore.generalProps,e)})):t.dataStore.generalProps={}},this.reissuePage=function(){t.dataStore.sendPage()},this.notRecommended=function(){return X("不推荐的方法使用,建议使用 gio('setOption', [optionName], [value])!","info")},this.callError=function(e,t,n){return void 0===t&&(t=!0),void 0===n&&(n="参数不合法"),X("".concat(t?"调用":"设置"," ").concat(e," 失败,").concat(n,"!"),"warn")},this.updateImpression=function(){var e,n,r=null===(n=null===(e=t.plugins)||void 0===e?void 0:e.gioImpressionTracking)||void 0===n?void 0:n.main;r?r("emitter"):X("updateImpression 错误! 请集成半自动埋点浏览插件后重试!","error")},this.gioEnvironment="cdp",this.sdkVersion="3.8.7",this.vds=window.gioCompatibilityVds?"gdp_vds":"vds",this.utils=n(n({},Z),ne),this.emitter={all:e=e||new Map,on:function(t,n){var r=e.get(t);r?r.push(n):e.set(t,[n])},off:function(t,n){var r=e.get(t);r&&(n?r.splice(r.indexOf(n)>>>0,1):e.set(t,[]))},emit:function(t,n){var r=e.get(t);r&&r.slice().map((function(e){e(n)})),(r=e.get("*"))&&r.slice().map((function(e){e(t,n)}))}},this.useEmbeddedInherit=!1,this.useHybridInherit=!1,this.gioSDKInitialized=!1,this.plugins=new xe(this),this.plugins.innerPluginInit()}));!function(){var e,t,r,i,o,a=window.gioCompatibilityVds?"gdp_vds":"vds";if(null===(e=window[a])||void 0===e?void 0:e.gioSDKInstalled)return ue=window.gdp,void X("SDK重复加载,请检查是否重复加载SDK或接入其他平台SDK导致冲突!","warn");window[a]=n(n({},null!==(t=window[a])&&void 0!==t?t:{}),{gioSDKInstalled:!0});var s=new Le;ue=function(){var e,t=arguments[0];if(S(t)&&U(m,t)&&s[t]){var r=q(K(arguments));if("init"===t){var i=function(e){var t;return e.vdsConfig||e.gioSDKInitialized||(null===(t=window.vds)||void 0===t?void 0:t.gioSDKInitialized)?(X("SDK重复初始化,请检查是否重复加载SDK或接入其他平台SDK导致冲突!","warn"),!1):!(U(["","localhost","127.0.0.1"],location.hostname)&&!window._gr_ignore_local_rule&&(X("当前SDK不允许在本地环境初始化!","warn"),1))}(s);if(!i)return;var o=function(e){return!J(N(e))||(X('SDK初始化失败,请使用 gdp("init", "您的GrowingIO项目 accountId", "您项目的 dataSourceId", options); 进行初始化!',"error"),!1)}(r);if(!o)return;var u=function(e){var t=P(e),n=x(e);return re(R(t).trim())?(E(n)&&n||(n={}),{projectId:t,userOptions:n}):(X("SDK初始化失败,accountId 参数不合法!","error"),!1)}(r);if(!u)return;var c=function(e){var t=e[1],n=e[2],r=x(e);return t&&S(t)?{dataSourceId:t,appId:S(n)?n:"",cdpOptions:r}:(X("SDK初始化失败,dataSourceId 参数不合法!","error"),!1)}(r);if(!c)return;var d=u.projectId,l=c.dataSourceId,g=c.appId,f=c.cdpOptions;s.init(n(n({},f),{projectId:d,dataSourceId:l,appId:g}))}else if("registerPlugins"===t)s.registerPlugins(r[0]);else{if(s.gioSDKInitialized&&s.vdsConfig)return s[t].apply(s,r);s.emitter.emit("UNINITIALIZED_CALL",arguments),X("SDK未初始化!","error")}}else U(h,t)?X("方法 ".concat(R(t)," 已被弃用,请移除!"),"warn"):X("不存在名为 ".concat(R(t)," 的方法调用!"),"error");window[a]=n(n({},window[a]),{_gr_ignore_local_rule:null!==(e=window._gr_ignore_local_rule)&&void 0!==e&&e,gioEnvironment:"cdp",gioSDKVersion:s.sdkVersion,gioSDKFull:s.gioSDKFull,canIUse:function(e){return U(m,e)&&s[e]}})};var u=null===(r=null===window||void 0===window?void 0:window.gdp)||void 0===r?void 0:r.q,c=null===(i=null===window||void 0===window?void 0:window.gdp)||void 0===i?void 0:i.e,d=null===(o=null===window||void 0===window?void 0:window.gdp)||void 0===o?void 0:o.ef;window.gdp=ue,window.gdp.e=c,window.gdp.ef=d,C(u)&&!J(u)&&u.forEach((function(e){ue.apply(null,e)}))}();var je=ue;export{je as default}; diff --git a/gdp-es5.umd.js b/gdp-es5.umd.js index 7a0c2c8..62fe169 100644 --- a/gdp-es5.umd.js +++ b/gdp-es5.umd.js @@ -1 +1 @@ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).gdp=t()}(this,(function(){"use strict";var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)({}).hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};function t(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+n+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}var n=function(){return n=Object.assign||function(e){for(var t,n=1,i=arguments.length;i>n;n++)for(var r in t=arguments[n])({}).hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},n.apply(this,arguments)};function i(e,t,n){if(n||2===arguments.length)for(var i,r=0,o=t.length;o>r;r++)!i&&r in t||(i||(i=[].slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||[].slice.call(t))}var r=["web","wxwv","minp","alip","baidup","qq","bytedance"],o={autotrack:{type:"boolean",default:!0},compress:{type:"boolean",default:!0},dataCollect:{type:"boolean",default:!0},debug:{type:"boolean",default:!1},hashtag:{type:"boolean",default:!1},touch:{type:"boolean",default:!1},version:{type:"string",default:"1.0.0"},platform:{type:"string",default:"web"},cookieDomain:{type:"string",default:""},sendType:{type:"string",default:"beacon"}},a={enableIdMapping:{type:"boolean",default:!1},gtouchHost:{type:"string",default:""},host:{type:"string",default:"napi.growingio.com"},ignoreFields:{type:"array",default:[]},penetrateHybrid:{type:"boolean",default:!0},scheme:{type:"string",default:location.protocol.indexOf("http")>-1?location.protocol.replace(":",""):"https"},sessionExpires:{type:"number",default:30},performance:{type:"object",default:{monitor:!0,exception:!0}},embeddedIgnore:{type:"array",default:[]},storageType:{type:"string",default:"cookie"},requestTimeout:{type:"number",default:5e3}},s={},u=["clearUserId","getGioInfo","getLocation","getOption","init","setDataCollect","setOption","setUserId","track","setGeneralProps","clearGeneralProps"];i(i([],u,!0),["setEvar","setPage","setUser","setVisitor"],!1);var c,d,l,g,f,m=i(i([],u,!0),["enableDebug","enableHT","setAutotrack","setTrackerHost","setTrackerScheme","setUserAttributes","getVisitorId","getDeviceId","registerPlugins","getPlugins","sendPage","sendVisit","trackTimerStart","trackTimerPause","trackTimerResume","trackTimerEnd","removeTimer","clearTrackTimer","updateImpression"],!1),p=["autotrack","dataCollect","dataSourceId","debug","host","hashtag","scheme"],v={autotrack:"无埋点采集",dataCollect:"数据采集",debug:"调试模式"},h=["send","setConfig","collectImp","setPlatformProfile"],I=["screenHeight","screenWidth"],w="function"==typeof Array.from?Array.from:(d||(d=1,l=function(e){return"function"==typeof e},g=function(e){var t=function(e){var t=Number(e);return isNaN(t)?0:0!==t&&isFinite(t)?(t>0?1:-1)*Math.floor(Math.abs(t)):t}(e);return Math.min(Math.max(t,0),9007199254740991)},f=function(e){var t=e.next();return!t.done&&t},c=function(e){var t,n,i,r=this,o=arguments.length>1?arguments[1]:void 0;if(void 0!==o){if(!l(o))throw new TypeError("Array.from: when provided, the second argument must be a function");arguments.length>2&&(t=arguments[2])}var a=function(e,t){if(null!=e&&null!=t){var n=e[t];if(null==n)return;if(!l(n))throw new TypeError(n+" is not a function");return n}}(e,function(e){if(null!=e){if(["string","number","boolean","symbol"].indexOf(typeof e)>-1)return Symbol.iterator;if("undefined"!=typeof Symbol&&"iterator"in Symbol&&Symbol.iterator in e)return Symbol.iterator;if("@@iterator"in e)return"@@iterator"}}(e));if(void 0!==a){n=l(r)?Object(new r):[];var s,u,c=a.call(e);if(null==c)throw new TypeError("Array.from requires an array-like or iterable object");for(i=0;;){if(!(s=f(c)))return n.length=i,n;u=s.value,n[i]=o?o.call(t,u,i):u,i++}}else{var d=Object(e);if(null==e)throw new TypeError("Array.from requires an array-like object - not null or undefined");var m,p=g(d.length);for(n=l(r)?Object(new r(p)):Array(p),i=0;p>i;)m=d[i],n[i]=o?o.call(t,m,i):m,i++;n.length=p}return n}),c),y=function(e){return U(["undefined","null"],Q(e))},S=function(e){return"string"===Q(e)},O=function(e){return"number"===Q(e)},b=function(e){return"NaN"===R(Number(e))},E=function(e){return"object"===Q(e)&&!y(e)},T=function(e){return"regexp"===Q(e)},_=function(e){return U(["function","asyncfunction"],Q(e))},C=function(e){return Array.isArray(e)&&"array"===Q(e)},k=function(e){return"date"===Q(e)},P=function(e){try{return K(e)[0]}catch(e){return}},x=function(e){try{var t=K(e);return t[t.length-1]}catch(e){return}},q=function(e,t){return void 0===t&&(t=1),C(e)&&O(t)?e.slice(t>0?t:1,e.length):e},N=function(e){if(C(e)){for(var t=0,n=[],i=0,r=e;i=0},K=w,R=function(e){return y(e)?"":"".concat(e)},L=function(e,t){return"string"==typeof e?e.split(t):e},j=function(e){if(S(e)){var t=L(e,"");return"".concat(P(t).toLowerCase()).concat(q(t).join(""))}return e},F=function(e,t){return!!S(e)&&e.slice(0,t.length)===t},B=function(e,t){if(S(e)){var n=e.length,i=n;i>n&&(i=n);var r=i;return(i-=t.length)>=0&&e.slice(i,r)===t}return!1},V={}.hasOwnProperty,H=function(e,t){return!y(e)&&V.call(e,t)},G=function(e){return E(e)?Object.keys(e):[]},M=function(e,t){G(e).forEach((function(n){return t(e[n],n)}))},z=function(e,t){var n=G(e);return!(!E(e)||!E(t)||n.length!==G(t).length||U(n.map((function(n,i){return E(e[n])?z(e[n],t[n]):e[n]===t[n]})),!1))},W=function(e,t){if(!E(e))return!1;try{return"string"===Q(t)?delete e[t]:"array"===Q(t)?t.map((function(t){return delete e[t]})):(T(t)&&G(e).forEach((function(n){t.test(n)&&W(e,n)})),!0)}catch(e){return!1}},J=function(e){return C(e)?0===e.length:E(e)?0===G(e).length:!e},Q=function(e){return{}.toString.call(e).slice(8,-1).toLowerCase()},Z=Object.freeze({__proto__:null,isNil:y,isString:S,isNumber:O,isNaN:b,isBoolean:function(e){return"boolean"===Q(e)},isObject:E,isRegExp:T,isFunction:_,isArray:C,isDate:k,fixed:function(e,t){return O(e)?Number(e.toFixed(O(t)?t:2)):S(e)&&"NaN"!==R(Number(e))?Number(Number(e).toFixed(O(t)?t:2)):e},head:P,last:x,drop:q,dropWhile:function(e,t){return C(e)?e.filter((function(e){return!t(e)})):e},compact:N,find:D,findIndex:A,includes:U,arrayFrom:K,toString:R,split:L,lowerFirst:j,upperFirst:function(e){if(S(e)){var t=L(e,"");return"".concat(P(t).toUpperCase()).concat(q(t).join(""))}return e},startsWith:F,endsWith:B,has:H,keys:G,forEach:M,isEqual:z,get:function(e,t,n){var i=e;return E(e)?(t.split(".").forEach((function(e){i=i?i[e]:n})),i):n},unset:W,isEmpty:J,typeOf:Q,formatDate:function(e){if(k(e)){var t=function(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())}return e}}),X=function(e,t){console.log("%c [GrowingIO]:".concat(e),{info:"color: #3B82F6;",error:"color: #EF4444;",warn:"color: #F59E0B;",success:"color: #10B981;"}[t]||"")},Y=function(e){try{return e()}catch(e){return}},$=function(e){var t={};return E(e)&&M(e,(function(e,n){var i,r=R(n).slice(0,100);E(e)?t[r]=$(e):C(e)?(t[r]=e.slice(0,100),"cdp"===(null===(i=window.vds)||void 0===i?void 0:i.gioEnvironment)&&(t[r]=t[r].join("||").slice(0,1e3))):t[r]=y(e)?"":R(e).slice(0,1e3)})),t},ee=function(e,t,i,r){void 0===r&&(r={}),document.addEventListener?e.addEventListener(t,i,n(n({},{capture:!0}),r)):e.attachEvent?e.attachEvent("on"+t,i):e["on"+t]=i},te=function(e,t){return S(e)&&!J(e)&&e.match(/^[a-zA-Z_][0-9a-zA-Z_]{0,100}$/)?t():(X("事件名格式不正确,只能包含数字、字母和下划线,且不能以数字开头,字符总长度不能超过100!","error"),!1)},ne=Object.freeze({__proto__:null,consoleText:X,niceTry:Y,limitObject:$,addListener:ee,flattenObject:function(e){void 0===e&&(e={});var t=n({},e);return G(t).forEach((function(e){E(t[e])?(G(t[e]).forEach((function(n){t["".concat(e,"_").concat(n)]=R(t[e][n])})),W(t,e)):C(t[e])?(t[e].forEach((function(n,i){E(n)?G(n).forEach((function(r){t["".concat(e,"_").concat(i,"_").concat(r)]=R(n[r])})):t["".concat(e,"_").concat(i)]=R(n)})),W(t,e)):y(t[e])||""===t[e]?W(t,e):t[e]=R(t[e])})),$(t)},eventNameValidate:te,getGioFunction:function(){var e,t,n,i,r=window._gio_local_vds||"vds",o=null!==(t=null===(e=window[r])||void 0===e?void 0:e.namespace)&&void 0!==t?t:"gdp";return _(window[o])?window[o]:null!==(i=null!==(n=window.gdp)&&void 0!==n?n:window.gio)&&void 0!==i?i:function(){}}}),ie=function(e){return S(e)&&e.length>0||O(e)&&e>0},re=/^((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})(\.((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})){3}/i,oe=/^(https?:\/\/)|(([a-zA-Z0-9_-])+(\.)?)*(:\d+)?(\/((\.)?(\?)?=?&?[a-zA-Z0-9_-](\?)?)*)*$/i;function ae(e){for(var t=1;arguments.length>t;t++){var n=arguments[t];for(var i in n)e[i]=n[i]}return e}var se,ue,ce=function e(t,n){function i(e,i,r){if("undefined"!=typeof document){"number"==typeof(r=ae({},n,r)).expires&&(r.expires=new Date(Date.now()+864e5*r.expires)),r.expires&&(r.expires=r.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var o="";for(var a in r)r[a]&&(o+="; "+a,!0!==r[a]&&(o+="="+r[a].split(";")[0]));return document.cookie=e+"="+t.write(i,e)+o}}return Object.create({set:i,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var n=document.cookie?document.cookie.split("; "):[],i={},r=0;r+Date.now()?ge(pe(t.value)):void 0},this.setItem=function(e,t,n){var i=null!=n?n:+new Date(9999,12);localStorage.setItem(le(e),JSON.stringify({value:S(t)&&t.length&&B(e,"_gioenc")?me(t):t,expiredAt:i}))},this.removeItem=function(e){return localStorage.removeItem(le(e))},this.hasItem=function(e){return!!localStorage.getItem(le(e))},this.getKeys=function(){return K(Array(localStorage.length)).map((function(e,t){return localStorage.key(t)}))},this.type="localStorage"},ye={},Se=function(){this.getItem=function(e){var t=Y((function(){return JSON.parse(ye[le(e)]||"")}));return E(t)&&t.expiredAt>+Date.now()?ge(pe(t.value)):void 0},this.setItem=function(e,t,n){var i=null!=n?n:+new Date(9999,12);ye[le(e)]=JSON.stringify({value:S(t)&&t.length?me(t):t,expiredAt:i})},this.removeItem=function(e){return W(ye,le(e))},this.hasItem=function(e){return H(ye,le(e))},this.getKeys=function(){return G(ye)},this.type="memory"},Oe=/^(\.ac\.|\.br\.|\.co\.|\.com\.|\.edu\.|\.gov\.|\.org\.|\.net\.)/,be=function(e){var t=[];try{var n=e.split("."),i=x(n);if(n.length>=2&&(isNaN(Number(i))||0>Number(i)||Number(i)>255)){var r=".".concat(n.slice(-2).join("."));Oe.test(r)?se=r:t.push(r);var o=".".concat(n.slice(-3).join("."));Oe.test(o)||U(t,o)||t.push(o);var a=".".concat(n.slice(-4).join("."));Oe.test(a)||U(t,a)||t.push(a)}}catch(e){}return t},Ee=function(e){var t="";return e.every((function(e){return!Te(e)||(t=e,!1)})),t},Te=function(e){try{ce.set("gioCookie","yes",{domain:e});var t=!!ce.get("gioCookie",{domain:e});return ce.remove("gioCookie",{domain:e}),t}catch(e){return!1}},_e=function(e){var t,n,r,o=e.storageType,a=e.cookieDomain,s=e.projectId;if(U(["cookie","localstorage"],o)||(o="cookie"),"cookie"===o&&(n=!!(r=navigator.userAgent.indexOf("Electron")>-1||U(["","localhost","127.0.0.1"],window.location.hostname)||!U(["http:","https:"],window.location.protocol)?"":Ee(i(i([],be(window.location.hostname),!0),[window.location.hostname],!1)))),"cookie"===o&&n){var u=new Ie(r);if(a){var c=be(a),d=Ee(J(c)?[]:i([a],be(a),!0));d&&Te(d)?u.domain=d:X("指定Cookie域无效或无权限,使用默认域!","warn")}t=u}else t=function(){try{var e=window.localStorage,t="__storage_test__";return e.setItem(t,t),e.removeItem(t),!0}catch(e){return!1}}()?new we:new Se;return"cookie"===o&&se&&Te(se)&&function(e,t,n){if(t&&Te(t)){var i=new Ie(t);["".concat(n,"_gdp_session_id"),"gdp_user_id_gioenc","".concat(n,"_gdp_cs1_gioenc"),"".concat(n,"_gdp_user_key_gioenc"),"".concat(n,"_gdp_gio_id_gioenc"),"".concat(n,"_gdp_sequence_ids"),"".concat(n,"_gdp_session_id_sent")].forEach((function(t){var n=i.getItem(t);i.hasItem(t)&&(e.setItem(t,n),i.removeItem(t))})),i=void 0}}(t,se,s),t},Ce="SESSIONID_UPDATE",ke={name:"gioCustomTracking",method:function(e){var t=this;this.growingIO=e,this.getValidResourceItem=function(e){if(e&&E(e)&&e.id&&e.key){var t={id:S(e.id)?e.id:R(e.id),key:S(e.key)?e.key:R(e.key)};return e.attributes&&(t.attributes=e.attributes),t}},this.getDynamicAttributes=function(e){return y(e)||G(e).forEach((function(t){_(e[t])?e[t]=e[t]():E(e[t])?W(e,t):C(e[t])||(e[t]=R(e[t]))})),e},this.buildCustomEvent=function(e,i,r,o){te(e,(function(){var a=t.growingIO.dataStore,s=a.eventContextBuilder,u=a.eventConverter,c=a.currentPage,d=n({eventType:"CUSTOM",eventName:e,pageShowTimestamp:null==c?void 0:c.time,attributes:$(t.getDynamicAttributes(E(i)&&!J(i)?i:void 0)),resourceItem:$(t.getValidResourceItem(r))},s());J(o)||(d=n(n({},d),o)),u(d)}))},this.buildUserAttributesEvent=function(e,i){var r=t.growingIO.dataStore,o=r.eventContextBuilder,a=r.eventConverter,s=n({eventType:"LOGIN_USER_ATTRIBUTES",attributes:$(e)},o());J(i)||(s=n(n({},s),i)),a(s)}}},Pe=["gioPerformance"],xe=function(e){function n(t){var n=e.call(this,t)||this;return n.growingIO=t,n.growingIO.gioSDKFull=!1,n.pluginsContext={plugins:{gioCustomTracking:ke}},n}return t(n,e),n}((function(e){var t,n,i,r,o=this;this.growingIO=e,this.innerPluginInit=function(){var e;Pe.forEach((function(e){var t;return W(null===(t=o.pluginsContext)||void 0===t?void 0:t.plugins,e)})),G(null===(e=o.pluginsContext)||void 0===e?void 0:e.plugins).forEach((function(e){var t,n=null===(t=o.pluginsContext)||void 0===t?void 0:t.plugins[e],i=n.name,r=n.method;D(o.pluginItems,(function(e){return e.name===i}))||o.pluginItems.push({name:j(i||e),method:r||function(e){}})})),J(o.pluginItems)||o.installAll()},this.install=function(e,t,n){var i,r,a=t||D(o.pluginItems,(function(t){return t.name===e}));if((null===(i=o.growingIO)||void 0===i?void 0:i.plugins)[e])return X("重复加载插件 ".concat(e," 或插件重名,已跳过加载!"),"warn"),!1;if(!a)return X("插件加载失败!不存在名为 ".concat(e," 的插件!"),"error"),!1;try{return(null===(r=o.growingIO)||void 0===r?void 0:r.plugins)[e]=new a.method(o.growingIO,n),"cdp"===o.growingIO.gioEnvironment&&t&&X("加载插件 ".concat(e),"info"),!0}catch(e){return X("插件加载异常 ".concat(e),"error"),!1}},this.installAll=function(e){(e||o.pluginItems).forEach((function(t){o.install(t.name,e?t:void 0,e?null==t?void 0:t.options:void 0)&&!D(o.pluginItems,(function(e){return e.name===t.name}))&&o.pluginItems.push({name:j(t.name),method:t.method?t.method:function(){}})}))},this.uninstall=function(e){var t;W(o.pluginItems,e);var n=W(null===(t=o.growingIO)||void 0===t?void 0:t.plugins,e);return n||X("卸载插件 ".concat(e," 失败!"),"error"),n},this.uninstallAll=function(){o.pluginItems.forEach((function(e){return o.uninstall(e.name)}))},this.lifeError=function(e,t){return X("插件执行错误 ".concat(e.name," ").concat(t),"error")},this.onComposeBefore=function(e){o.pluginItems.forEach((function(t){var n,i=null===(n=o.growingIO.plugins[t.name])||void 0===n?void 0:n.onComposeBefore;if(i&&_(i))try{i(e)}catch(e){o.lifeError(t,e)}}))},this.onComposeAfter=function(e){o.pluginItems.forEach((function(t){var n,i=null===(n=o.growingIO.plugins[t.name])||void 0===n?void 0:n.onComposeAfter;if(i&&_(i))try{i(e)}catch(e){o.lifeError(t,e)}}))},this.onSendBefore=function(e){o.pluginItems.forEach((function(t){var n,i=null===(n=o.growingIO.plugins[t.name])||void 0===n?void 0:n.onSendBefore;if(i&&_(i))try{i(e)}catch(e){o.lifeError(t,e)}}))},this.onSendAfter=function(e){o.pluginItems.forEach((function(t){var n,i=null===(n=o.growingIO.plugins[t.name])||void 0===n?void 0:n.onSendAfter;if(i&&_(i))try{i(e)}catch(e){o.lifeError(t,e)}}))},this.pluginsContext={plugins:{}},this.pluginItems=[],null===(t=this.growingIO.emitter)||void 0===t||t.on("onComposeBefore",this.onComposeBefore),null===(n=this.growingIO.emitter)||void 0===n||n.on("onComposeAfter",this.onComposeAfter),null===(i=this.growingIO.emitter)||void 0===i||i.on("onSendBefore",this.onSendBefore),null===(r=this.growingIO.emitter)||void 0===r||r.on("onSendAfter",this.onSendAfter)})),qe=function(){function e(e){this.growingIO=e;var t=this.growingIO.vdsConfig.projectId,n=this.growingIO.storage,i=n.getItem,r=n.setItem,o=n.getKeys,a=n.removeItem;this.getItem=i,this.setItem=r,this.getKeys=o,this.removeItem=a,this.sIdStorageName="".concat(t,"_gdp_session_id"),this.uidStorageName="gdp_user_id_gioenc",this.userIdStorageName="".concat(t,"_gdp_cs1_gioenc"),this.userKeyStorageName="".concat(t,"_gdp_user_key_gioenc"),this.gioIdStorageName="".concat(t,"_gdp_gio_id_gioenc")}return Object.defineProperty(e.prototype,"sessionId",{get:function(){return this.getItem(this.sIdStorageName)||(this.sessionId=de(),this.sessionId)},set:function(e){var t,n=this;e||(e=de());var i=this.getItem(this.sIdStorageName)||this.prevSessionId,r=this.growingIO.vdsConfig.sessionExpires,o=void 0===r?30:r;this.setItem(this.sIdStorageName,e,+Date.now()+60*o*1e3),i!==e&&(this.getKeys().filter((function(e){return/.+_gdp_session_id_.{36}/.test(e)})).forEach((function(e){n.removeItem(e)})),this.setItem(this.growingIO.dataStore.visitStorageName,""),null===(t=this.growingIO.emitter)||void 0===t||t.emit(Ce,{newSessionId:e,oldSessionId:i})),this.prevSessionId=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"uid",{get:function(){return this.getItem(this.uidStorageName)||(this.uid=de(),this.uid)},set:function(e){var t,n=this.getItem(this.uidStorageName)||this.prevUId;this.setItem(this.uidStorageName,e),n!==e&&(null===(t=this.growingIO.emitter)||void 0===t||t.emit("UID_UPDATE",{newUId:e,oldUId:n})),this.prevUId=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"userId",{get:function(){return this.getItem(this.userIdStorageName)||""},set:function(e){var t,n,i=this.getItem(this.userIdStorageName)||this.prevUserId;this.setItem(this.userIdStorageName,e),null===(t=this.growingIO.emitter)||void 0===t||t.emit("SET_USERID",{newUserId:e,oldUserId:i,userKey:this.userKey}),i!==e&&(null===(n=this.growingIO.emitter)||void 0===n||n.emit("USERID_UPDATE",{newUserId:e,oldUserId:i,userKey:this.userKey})),e&&(this.gioId=e),this.prevUserId=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"userKey",{get:function(){return this.getItem(this.userKeyStorageName)||""},set:function(e){var t,n,i=this.getItem(this.userKeyStorageName)||this.prevUserKey;this.setItem(this.userKeyStorageName,e),null===(t=this.growingIO.emitter)||void 0===t||t.emit("SET_USERKEY",{newUserKey:e,oldUserKey:i,userId:this.userId}),i!==e&&(null===(n=this.growingIO.emitter)||void 0===n||n.emit("USERKEY_UPDATE",{newUserKey:e,oldUserKey:i,userId:this.userId})),this.prevUserKey=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"gioId",{get:function(){return this.getItem(this.gioIdStorageName)||""},set:function(e){var t,n=this.getItem(this.gioIdStorageName)||this.prevGioId;this.setItem(this.gioIdStorageName,e),n!==e&&(null===(t=this.growingIO.emitter)||void 0===t||t.emit("GIOID_UPDATE",{newGioId:e,oldGioId:n})),this.prevGioId=e},enumerable:!1,configurable:!0}),e}(),Ne=function(e){var t=this;this.growingIO=e,this.main=function(){var e,i,r=t.growingIO,o=r.sdkVersion,a=r.useEmbeddedInherit,s=r.vdsConfig,u=r.userStore,c=r.dataStore,d=r.trackingId,l=c.currentPage,g=l.path,f=l.query,m={appVersion:s.version,dataSourceId:s.dataSourceId,deviceId:u.uid,domain:a?s.appId:window.location.host,gioId:u.gioId,language:navigator.language,path:g,platform:s.platform,query:f,referralPage:(null===(e=c.lastPageEvent)||void 0===e?void 0:e.referralPage)||"",screenHeight:window.screen.height,screenWidth:window.screen.width,sdkVersion:o,sessionId:u.sessionId,timestamp:+Date.now(),title:null!==(i=Y((function(){return document.title.slice(0,255)})))&&void 0!==i?i:"",userId:u.userId};if(s.enableIdMapping&&(m.userKey=u.userKey),J(s.ignoreFields)||s.ignoreFields.forEach((function(e){W(m,e)})),a&&!J(t.minpExtraParams)){var p=n({},m);M(n(n({},m),t.minpExtraParams),(function(e,n){var i;U(s.embeddedIgnore,n)?(m[n]=p[n],"domain"===n&&(m[n]=window.location.host)):m[n]=null!==(i=t.minpExtraParams[n])&&void 0!==i?i:m[n]}))}return m.trackingId=d,m},this.minpExtraParams={}},De=function(e){var t=this;this.growingIO=e,this.parsePage=function(){var e=t.growingIO.vdsConfig.hashtag,n=location.pathname,i=location.search,r=location.hash,o=r.indexOf("?");t.domain=window.location.host,t.title=document.title.slice(0,255),t.time=+Date.now(),t.path=n,t.query=i,e&&(o>-1?(t.path+=r.slice(0,o),t.query=t.query+"&"+r.slice(o+1)):t.path+=r),t.query&&U(["?","&"],t.query.charAt(0))&&(t.query=t.query.slice(1))},this._getNoHashHref=function(){var e=window.location,t=e.protocol,n=e.host,i=e.pathname,r=e.search;return"".concat(t,"://").concat(n).concat(i).concat(r)},this.getReferralPage=function(){var e,n,i=t.growingIO.dataStore.lastPageEvent;return(null==i?void 0:i.path)===t.path&&(null!==(e=null==i?void 0:i.query)&&void 0!==e?e:"")===(null!==(n=t.query)&&void 0!==n?n:"")?null==i?void 0:i.referralPage:(null==i?void 0:i.path)?t.lastHref:document.referrer},this.pageListener=function(){var e=t.growingIO.vdsConfig.hashtag,n=window.location.href,i=t.lastHref;e||(n=t._getNoHashHref(),i=t.lastNoHashHref),i!==n&&(t.parsePage(),t.buildPageEvent())},this.hookHistory=function(){var e=window.history.pushState,n=window.history.replaceState,i=t;e&&Y((function(){return window.history.pushState=function(){e.apply(window.history,arguments),setTimeout(i.pageListener)}})),n&&Y((function(){return window.history.replaceState=function(){n.apply(window.history,arguments),setTimeout(i.pageListener)}})),ee(window,"popstate",t.pageListener),t.growingIO.vdsConfig.hashtag&&ee(window,"hashchange",t.pageListener)},this.buildPageEvent=function(e){var i=t.growingIO.dataStore;i.lastPageEvent;var r=i.eventContextBuilder,o=i.eventConverter,a=n(n({eventType:"PAGE"},r()),{protocolType:location.protocol.substring(0,location.protocol.length-1),referralPage:t.getReferralPage()});J(e)||(a=n(n({},a),e)),a.timestamp=t.time,o(a),t.lastHref=window.location.href,t.lastNoHashHref=t._getNoHashHref(),t.lastLocation=n({},window.location)},this.title=document.title.slice(0,255),this.lastLocation=n({},window.location)},Ae={referralPage:document.referrer},Ue=function(){function e(e){var t,i,u,c=this;this.growingIO=e,this.ALLOW_SETTING=n(n({},o),"saas"===this.growingIO.gioEnvironment?s:a),this.allowOptKeys=Object.keys(this.ALLOW_SETTING),this.trackTimers={},this.setSequenceIds=function(e,t){var i=c.growingIO.storage.getItem(c.seqStorageIdName)||{};"gsid"===e?i.globalKey=t:i=n(n({},i),t),c.growingIO.storage.setItem(c.seqStorageIdName,i)},this.initOptions=function(e){var t,i,o,a,s,u,d,l=e.projectId,g=e.dataSourceId,f=e.appId;c.initialDataSourceId=g;var m={};c.allowOptKeys.forEach((function(t){var n=c.ALLOW_SETTING[t].type,i=C(n)?!U(n,Q(e[t])):Q(e[t])!==n;"platform"!==t||U(r,e[t])||(i=!0),i?m[t]=c.ALLOW_SETTING[t].default:"ignoreFields"===t?m.ignoreFields=e.ignoreFields.filter((function(e){return U(I,e)})):(m[t]=e[t],U(["dataCollect","autotrack"],t)&&(m[t]||X("已关闭".concat(v[t]),"info")))})),m.sessionExpires=Math.round(m.sessionExpires),(b(m.sessionExpires)||1>m.sessionExpires||m.sessionExpires>360)&&(m.sessionExpires=30),m.storageType=m.storageType.toLowerCase(),m.sendType=m.sendType.toLowerCase(),U(["beacon","xhr","image"],m.sendType)||(m.sendType="beacon"),!b(Number(m.requestTimeout))&&m.requestTimeout>0||(m.requestTimeout=5e3),c.growingIO.vdsConfig=n(n(n({},null!==(t=window.vds)&&void 0!==t?t:{}),m),{projectId:l,dataSourceId:g,appId:f,performance:{monitor:null===(o=null===(i=m.performance)||void 0===i?void 0:i.monitor)||void 0===o||o,exception:null===(s=null===(a=m.performance)||void 0===a?void 0:a.exception)||void 0===s||s,network:null!==(d=null===(u=m.performance)||void 0===u?void 0:u.network)&&void 0!==d&&d}}),window.vds=c.growingIO.vdsConfig,c.seqStorageIdName="".concat(l,"_gdp_sequence_ids"),c.visitStorageName="".concat(l,"_gdp_session_id_sent")},this.setOption=function(e,t){var i,r=c.growingIO,o=r.vdsConfig,a=r.callError,s=r.uploader,u=r.emitter,d=S(e)&&U(p,e),l=d&&typeof t===((null===(i=c.ALLOW_SETTING[e])||void 0===i?void 0:i.type)||"string"),g=n({},o);return d&&l?(o[e]=t,"dataCollect"===e&&g.dataCollect!==t&&(t?(c.sendVisit(!0),c.sendPage()):c.growingIO.clearTrackTimer()),U(["host","scheme"],e)&&(null==s||s.generateHost()),null==u||u.emit("OPTION_CHANGE",{optionName:e,optionValue:t}),window.vds[e]=t,!0):(a("setOption > ".concat(e)),!1)},this.getOption=function(e){var t=c.growingIO,i=t.vdsConfig,r=t.callError;return e&&H(i,R(e))?i[R(e)]:y(e)?n({},i):void r("getOption > ".concat(e))},this.sendVisit=function(e){var t=c.growingIO,n=t.userStore.sessionId,i=t.storage.getItem(c.visitStorageName);!e&&n===i||(c.lastVisitEvent.timestamp=c.currentPage.time-1,c.buildVisitEvent())},this.buildVisitEvent=function(e){var t=c.growingIO,i=t.dataStore,r=i.eventContextBuilder,o=i.eventConverter,a=t.emitter,s=t.storage,u=t.userStore,d=c.lastVisitEvent,l=d.referralPage,g=d.title,f=d.path,m=d.query,p=d.timestamp,v=n(n({eventType:"VISIT"},r()),{referralPage:l||c.currentPage.getReferralPage(),timestamp:p});f&&(v.title=g,v.path=f,v.query=m),J(e)||(v.session=(null==e?void 0:e.session)||v.session,v.trackingId=null==e?void 0:e.trackingId,v=n(n({},v),e));var h=function(e){var t=e.requestData;"VISIT"===t.eventType&&t.trackingId===c.growingIO.trackingId&&(u.sessionId===t.sessionId&&s.setItem(c.visitStorageName,t.sessionId),a.off("onSendAfter",h))};a.on("onSendAfter",h),o(v)},this.sendPage=function(e){e&&c.currentPage.parsePage(),c.currentPage.buildPageEvent()},this.buildErrorEvent=function(e){var t=c.growingIO.dataStore,i=t.eventContextBuilder;(0,t.eventConverter)(n({eventType:"CUSTOM",pageShowTimestamp:c.currentPage.time,eventName:"onError",attributes:e},i()))},this.currentPage=new De(this.growingIO),this.eventContextBuilderInst=new Ne(this.growingIO),this.eventContextBuilder=this.eventContextBuilderInst.main,this.generalProps={},this.lastVisitEvent=Ae,null===(t=this.growingIO.emitter)||void 0===t||t.on("onComposeAfter",(function(e){var t=e.composedEvent;"VISIT"!==t.eventType&&"vst"!==t.t||t.trackingId!==c.growingIO.trackingId||(c.lastVisitEvent=t)})),this.lastPageEvent={},null===(i=this.growingIO.emitter)||void 0===i||i.on("onComposeAfter",(function(e){var t=e.composedEvent;"PAGE"!==t.eventType&&"page"!==t.t||t.trackingId!==c.growingIO.trackingId||(c.lastPageEvent=t)})),null===(u=this.growingIO.emitter)||void 0===u||u.on(Ce,(function(){if(c.growingIO.gioSDKInitialized){c.currentPage.parsePage();var e=c.currentPage,t=e.title,n=e.path,i=e.query,r=e.time,o=e.getReferralPage;c.lastVisitEvent={referralPage:document.referrer||o(),title:t,path:n,query:i,timestamp:r-1},c.sendVisit(!0),c.sendPage(!0)}}))}return Object.defineProperty(e.prototype,"esid",{get:function(){var e=this,t=this.growingIO.storage.getItem(this.seqStorageIdName)||{},i=n({},t);return W(i,"globalKey"),i=E(i)&&!y(i)?i:{},this._esid={},G(i).forEach((function(t){e._esid[t]=b(Number(i[t]))||i[t]>=1e9||1>i[t]?1:i[t]})),this._esid},set:function(e){var t={};G(e).forEach((function(n){t[n]=b(e[n])||e[n]>=1e9||1>e[n]?1:e[n]})),z(this._esid,t)||(this._esid=t,this.setSequenceIds("esid",this._esid))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"gsid",{get:function(){var e=this.growingIO.storage.getItem(this.seqStorageIdName)||{},t=Number(e.globalKey);return this._gsid=b(t)||t>=1e9||1>t?1:t,this._gsid},set:function(e){b(Number(e))||e>=1e9||1>e?this._gsid=1:this._gsid=e,this.setSequenceIds("gsid",this._gsid)},enumerable:!1,configurable:!0}),e}(),Ke=function(e){function i(t){var i=e.call(this,t)||this;return i.growingIO=t,i.eventConverter=function(e){var t,r,o=i.growingIO,a=o.vdsConfig,s=o.dataStore,u=o.uploader;if(a.dataCollect){e.trackingId===i.growingIO.trackingId&&(e.globalSequenceId=s.gsid,e.eventSequenceId=s.esid[e.eventType]||1);var c={};M(e,(function(e,t){var n;if("element"===t){var i=null!==(n=P(e))&&void 0!==n?n:{};M(i,(function(e,t){J(e)&&0!==e||(c[t]=e)}))}else(J(e)||y(e))&&0!==e||(c[t]=e)})),e.trackingId===i.growingIO.trackingId&&(i.growingIO.dataStore.gsid+=1,i.growingIO.dataStore.esid=n(n({},i.growingIO.dataStore.esid),((t={})[c.eventType]=(i.growingIO.dataStore.esid[c.eventType]||1)+1,t))),null===(r=i.growingIO.emitter)||void 0===r||r.emit("onComposeAfter",{composedEvent:n({},c)}),e.trackingId===i.growingIO.trackingId&&u.commitRequest(c)}else"VISIT"===e.eventType&&(i.lastVisitEvent=e)},i}return t(i,e),i}(Ue),Re=function(e){function n(t){var n=e.call(this,t)||this;return n.growingIO=t,n.generateHost=function(){var e=n.growingIO.vdsConfig,t=e.scheme,i=e.host,r=void 0===i?"":i,o=e.projectId;t?B(R(t),"://")||(t="".concat(t,"://")):t="".concat(location.protocol.indexOf("http")>-1?location.protocol.replace(":",""):"https","//"),F(r,"http")&&(r=r.substring(r.indexOf("://")+(B(R(t),"://")?3:0))),n.requestURL="".concat(t).concat(r,"/v3/projects/").concat(o,"/collect")},n.requestURL="",n.generateHost(),n}return t(n,e),n}((function(e){var t=this;this.growingIO=e,this.getSendType=function(){var e=t.growingIO.vdsConfig.sendType;return"beacon"===e?function(){var e,t,n=!!(null===(e=null===window||void 0===window?void 0:window.navigator)||void 0===e?void 0:e.sendBeacon),i=window.navigator.userAgent;if(i.match(/(iPad|iPhone|iPod)/g)){var r=!(t=i.toLowerCase().match(/cpu.*os (.*?) like mac os/i))||2>t.length?0:+t[1].split("_").slice(0,2).join(".");return n&&r>13}return n}()?"beacon":"xhr":e},this.commitRequest=function(e){var i=n({},e);t.requestQueue.push(n(n({},i),{requestType:t.getSendType()})),t.initiateRequest()},this.initiateRequest=function(){var e,r,o;if(i([],t.requestQueue,!0).length>0&&t.requestingNum0?R(n).slice(0,1e3):""),t.userStore.userId=R(e).slice(0,1e3),i&&i!==t.userStore.userId&&(t.userStore.sessionId="")}else t.clearUserId(),t.callError("setUserId")},t.clearUserId=function(){t.userStore.userId="",t.userStore.userKey=""},t.track=function(e,i,r,o){var a,s;((null===(s=null===(a=t.plugins)||void 0===a?void 0:a.gioCustomTracking)||void 0===s?void 0:s.buildCustomEvent)||function(){})(e,n(n({},t.dataStore.generalProps),E(i)&&!J(i)?i:{}),r,o)},t.sendPage=function(e){return t.dataStore.currentPage.buildPageEvent(e)},t.sendVisit=function(e){return t.dataStore.buildVisitEvent(e)},t.trackTimerStart=function(e,n){t.vdsConfig.dataCollect&&te(e,(function(){var i=de();_(n)?(t.dataStore.trackTimers[i]={eventName:e,leng:0,start:+Date.now()},n(i)):X("回调方法不合法,返回timerId失败!")}))},t.trackTimerPause=function(e){if(e&&t.dataStore.trackTimers[e]){var n=t.dataStore.trackTimers[e];n.start&&(n.leng=n.leng+(+Date.now()-n.start)),n.start=0}},t.trackTimerResume=function(e){if(e&&t.dataStore.trackTimers[e]){var n=t.dataStore.trackTimers[e];0===n.start&&(n.start=+Date.now())}},t.trackTimerEnd=function(e,i){if(t.vdsConfig.dataCollect)if(e&&t.dataStore.trackTimers[e]){var r=t.dataStore.trackTimers[e];if(0!==r.start){var o=+Date.now()-r.start;r.leng=o>0?r.leng+o:0}t.track(r.eventName,n(n({},i),{event_duration:r.leng>864e5?0:r.leng/1e3})),t.removeTimer(e)}else X("未查找到对应的计时器,请检查!","error")},t.removeTimer=function(e){e&&t.dataStore.trackTimers[e]&&delete t.dataStore.trackTimers[e]},t.clearTrackTimer=function(){t.dataStore.trackTimers={}},t.dataStore=new Ke(t),t}return t(i,e),i}((function(){var e,t=this;this.trackingId="g0",this.init=function(e){var n,i,r,o,a;X("Gio Web SDK 初始化中...","info");var s=t.dataStore,u=s.initOptions,c=s.currentPage,d=s.sendVisit,l=s.sendPage;u(e),t.storage=_e(t.vdsConfig),t.initCallback(),null===(n=t.emitter)||void 0===n||n.emit("OPTION_INITIALIZED",t),null===(r=null===(i=t.plugins)||void 0===i?void 0:i.gioEventAutoTracking)||void 0===r||r.main(),c.hookHistory(),c.parsePage(),null===(o=t.emitter)||void 0===o||o.emit("SDK_INITIALIZED",t),X("Gio Web SDK 初始化完成!","success"),t.useEmbeddedInherit||(t.dataStore.lastVisitEvent.timestamp=c.time,d()),l(),t.gioSDKInitialized=!0,t.vdsConfig.gioSDKInitialized=!0,window[t.vds]=t.vdsConfig,null===(a=t.emitter)||void 0===a||a.emit("SDK_INITIALIZED_COMPLATE",t)},this.setOption=function(e,n){if(U(p,e)){var i=t.dataStore.setOption(e,n);return i&&v[e]&&X("已".concat(n?"开启":"关闭").concat(v[e]),"info"),i}return X("不存在可修改的配置项:".concat(e,",请检查后重试!"),"warn"),!1},this.getOption=function(e){return t.dataStore.getOption(e)},this.setGeneralProps=function(e){E(e)&&!J(e)?(t.dataStore.generalProps=n(n({},t.dataStore.generalProps),e),G(t.dataStore.generalProps).forEach((function(e){U([void 0,null],t.dataStore.generalProps[e])&&(t.dataStore.generalProps[e]="")}))):t.callError("setGeneralProps")},this.clearGeneralProps=function(e){C(e)&&!J(e)?e.forEach((function(e){W(t.dataStore.generalProps,e)})):t.dataStore.generalProps={}},this.reissuePage=function(){t.dataStore.sendPage()},this.notRecommended=function(){return X("不推荐的方法使用,建议使用 gio('setOption', [optionName], [value])!","info")},this.callError=function(e,t,n){return void 0===t&&(t=!0),void 0===n&&(n="参数不合法"),X("".concat(t?"调用":"设置"," ").concat(e," 失败,").concat(n,"!"),"warn")},this.updateImpression=function(){var e,n,i=null===(n=null===(e=t.plugins)||void 0===e?void 0:e.gioImpressionTracking)||void 0===n?void 0:n.main;i?i("emitter"):X("updateImpression 错误! 请集成半自动埋点浏览插件后重试!","error")},this.gioEnvironment="cdp",this.sdkVersion="3.8.6",this.vds=window.gioCompatibilityVds?"gdp_vds":"vds",this.utils=n(n({},Z),ne),this.emitter={all:e=e||new Map,on:function(t,n){var i=e.get(t);i?i.push(n):e.set(t,[n])},off:function(t,n){var i=e.get(t);i&&(n?i.splice(i.indexOf(n)>>>0,1):e.set(t,[]))},emit:function(t,n){var i=e.get(t);i&&i.slice().map((function(e){e(n)})),(i=e.get("*"))&&i.slice().map((function(e){e(t,n)}))}},this.useEmbeddedInherit=!1,this.useHybridInherit=!1,this.gioSDKInitialized=!1,this.plugins=new xe(this),this.plugins.innerPluginInit()}));return function(){var e,t,i,r,o,a=window.gioCompatibilityVds?"gdp_vds":"vds";if(null===(e=window[a])||void 0===e?void 0:e.gioSDKInstalled)return ue=window.gdp,void X("SDK重复加载,请检查是否重复加载SDK或接入其他平台SDK导致冲突!","warn");window[a]=n(n({},null!==(t=window[a])&&void 0!==t?t:{}),{gioSDKInstalled:!0});var s=new Le;ue=function(){var e,t=arguments[0];if(S(t)&&U(m,t)&&s[t]){var i=q(K(arguments));if("init"===t){var r=function(e){var t;return e.vdsConfig||e.gioSDKInitialized||(null===(t=window.vds)||void 0===t?void 0:t.gioSDKInitialized)?(X("SDK重复初始化,请检查是否重复加载SDK或接入其他平台SDK导致冲突!","warn"),!1):!(U(["","localhost","127.0.0.1"],location.hostname)&&!window._gr_ignore_local_rule&&(X("当前SDK不允许在本地环境初始化!","warn"),1))}(s);if(!r)return;var o=function(e){return!J(N(e))||(X('SDK初始化失败,请使用 gdp("init", "您的GrowingIO项目 accountId", "您项目的 dataSourceId", options); 进行初始化!',"error"),!1)}(i);if(!o)return;var u=function(e){var t=P(e),n=x(e);return ie(R(t).trim())?(E(n)&&n||(n={}),{projectId:t,userOptions:n}):(X("SDK初始化失败,accountId 参数不合法!","error"),!1)}(i);if(!u)return;var c=function(e){var t=e[1],n=e[2],i=x(e);return t&&S(t)?{dataSourceId:t,appId:S(n)?n:"",cdpOptions:i}:(X("SDK初始化失败,dataSourceId 参数不合法!","error"),!1)}(i);if(!c)return;var d=u.projectId,l=c.dataSourceId,g=c.appId,f=c.cdpOptions;s.init(n(n({},f),{projectId:d,dataSourceId:l,appId:g}))}else if("registerPlugins"===t)s.registerPlugins(i[0]);else{if(s.gioSDKInitialized&&s.vdsConfig)return s[t].apply(s,i);s.emitter.emit("UNINITIALIZED_CALL",arguments),X("SDK未初始化!","error")}}else U(h,t)?X("方法 ".concat(R(t)," 已被弃用,请移除!"),"warn"):X("不存在名为 ".concat(R(t)," 的方法调用!"),"error");window[a]=n(n({},window[a]),{_gr_ignore_local_rule:null!==(e=window._gr_ignore_local_rule)&&void 0!==e&&e,gioEnvironment:"cdp",gioSDKVersion:s.sdkVersion,gioSDKFull:s.gioSDKFull,canIUse:function(e){return U(m,e)&&s[e]}})};var u=null===(i=null===window||void 0===window?void 0:window.gdp)||void 0===i?void 0:i.q,c=null===(r=null===window||void 0===window?void 0:window.gdp)||void 0===r?void 0:r.e,d=null===(o=null===window||void 0===window?void 0:window.gdp)||void 0===o?void 0:o.ef;window.gdp=ue,window.gdp.e=c,window.gdp.ef=d,C(u)&&!J(u)&&u.forEach((function(e){ue.apply(null,e)}))}(),ue})); +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).gdp=t()}(this,(function(){"use strict";var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)({}).hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};function t(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+n+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}var n=function(){return n=Object.assign||function(e){for(var t,n=1,i=arguments.length;i>n;n++)for(var r in t=arguments[n])({}).hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},n.apply(this,arguments)};function i(e,t,n){if(n||2===arguments.length)for(var i,r=0,o=t.length;o>r;r++)!i&&r in t||(i||(i=[].slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||[].slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var r=["web","wxwv","minp","alip","baidup","qq","bytedance"],o={autotrack:{type:"boolean",default:!0},compress:{type:"boolean",default:!0},dataCollect:{type:"boolean",default:!0},debug:{type:"boolean",default:!1},hashtag:{type:"boolean",default:!1},touch:{type:"boolean",default:!1},version:{type:"string",default:"1.0.0"},platform:{type:"string",default:"web"},cookieDomain:{type:"string",default:""},sendType:{type:"string",default:"beacon"}},a={enableIdMapping:{type:"boolean",default:!1},gtouchHost:{type:"string",default:""},host:{type:"string",default:"napi.growingio.com"},ignoreFields:{type:"array",default:[]},penetrateHybrid:{type:"boolean",default:!0},scheme:{type:"string",default:location.protocol.indexOf("http")>-1?location.protocol.replace(":",""):"https"},sessionExpires:{type:"number",default:30},performance:{type:"object",default:{monitor:!0,exception:!0}},embeddedIgnore:{type:"array",default:[]},storageType:{type:"string",default:"cookie"},requestTimeout:{type:"number",default:5e3}},s={},u=["clearUserId","getGioInfo","getLocation","getOption","init","setDataCollect","setOption","setUserId","track","setGeneralProps","clearGeneralProps"];i(i([],u,!0),["setEvar","setPage","setUser","setVisitor"],!1);var c,d,l,g,f,p=i(i([],u,!0),["enableDebug","enableHT","setAutotrack","setTrackerHost","setTrackerScheme","setUserAttributes","getVisitorId","getDeviceId","registerPlugins","getPlugins","sendPage","sendVisit","trackTimerStart","trackTimerPause","trackTimerResume","trackTimerEnd","removeTimer","clearTrackTimer","updateImpression"],!1),m=["autotrack","dataCollect","dataSourceId","debug","host","hashtag","scheme"],v={autotrack:"无埋点采集",dataCollect:"数据采集",debug:"调试模式"},h=["send","setConfig","collectImp","setPlatformProfile"],I=["screenHeight","screenWidth"],w="function"==typeof Array.from?Array.from:(d||(d=1,l=function(e){return"function"==typeof e},g=function(e){var t=function(e){var t=Number(e);return isNaN(t)?0:0!==t&&isFinite(t)?(t>0?1:-1)*Math.floor(Math.abs(t)):t}(e);return Math.min(Math.max(t,0),9007199254740991)},f=function(e){var t=e.next();return!t.done&&t},c=function(e){var t,n,i,r=this,o=arguments.length>1?arguments[1]:void 0;if(void 0!==o){if(!l(o))throw new TypeError("Array.from: when provided, the second argument must be a function");arguments.length>2&&(t=arguments[2])}var a=function(e,t){if(null!=e&&null!=t){var n=e[t];if(null==n)return;if(!l(n))throw new TypeError(n+" is not a function");return n}}(e,function(e){if(null!=e){if(["string","number","boolean","symbol"].indexOf(typeof e)>-1)return Symbol.iterator;if("undefined"!=typeof Symbol&&"iterator"in Symbol&&Symbol.iterator in e)return Symbol.iterator;if("@@iterator"in e)return"@@iterator"}}(e));if(void 0!==a){n=l(r)?Object(new r):[];var s,u,c=a.call(e);if(null==c)throw new TypeError("Array.from requires an array-like or iterable object");for(i=0;;){if(!(s=f(c)))return n.length=i,n;u=s.value,n[i]=o?o.call(t,u,i):u,i++}}else{var d=Object(e);if(null==e)throw new TypeError("Array.from requires an array-like object - not null or undefined");var p,m=g(d.length);for(n=l(r)?Object(new r(m)):Array(m),i=0;m>i;)p=d[i],n[i]=o?o.call(t,p,i):p,i++;n.length=m}return n}),c),y=function(e){return U(["undefined","null"],Q(e))},S=function(e){return"string"===Q(e)},O=function(e){return"number"===Q(e)},b=function(e){return"NaN"===R(Number(e))},E=function(e){return"object"===Q(e)&&!y(e)},T=function(e){return"regexp"===Q(e)},_=function(e){return U(["function","asyncfunction"],Q(e))},C=function(e){return Array.isArray(e)&&"array"===Q(e)},k=function(e){return"date"===Q(e)},P=function(e){try{return K(e)[0]}catch(e){return}},x=function(e){try{var t=K(e);return t[t.length-1]}catch(e){return}},q=function(e,t){return void 0===t&&(t=1),C(e)&&O(t)?e.slice(t>0?t:1,e.length):e},N=function(e){if(C(e)){for(var t=0,n=[],i=0,r=e;i=0},K=w,R=function(e){return y(e)?"":"".concat(e)},L=function(e,t){return"string"==typeof e?e.split(t):e},j=function(e){if(S(e)){var t=L(e,"");return"".concat(P(t).toLowerCase()).concat(q(t).join(""))}return e},F=function(e,t){return!!S(e)&&e.slice(0,t.length)===t},B=function(e,t){if(S(e)){var n=e.length,i=n;i>n&&(i=n);var r=i;return(i-=t.length)>=0&&e.slice(i,r)===t}return!1},V={}.hasOwnProperty,H=function(e,t){return!y(e)&&V.call(e,t)},G=function(e){return E(e)?Object.keys(e):[]},M=function(e,t){G(e).forEach((function(n){return t(e[n],n)}))},z=function(e,t){var n=G(e);return!(!E(e)||!E(t)||n.length!==G(t).length||U(n.map((function(n,i){return E(e[n])?z(e[n],t[n]):e[n]===t[n]})),!1))},W=function(e,t){if(!E(e))return!1;try{return"string"===Q(t)?delete e[t]:"array"===Q(t)?t.map((function(t){return delete e[t]})):(T(t)&&G(e).forEach((function(n){t.test(n)&&W(e,n)})),!0)}catch(e){return!1}},J=function(e){return C(e)?0===e.length:E(e)?0===G(e).length:!e},Q=function(e){return{}.toString.call(e).slice(8,-1).toLowerCase()},Z=Object.freeze({__proto__:null,isNil:y,isString:S,isNumber:O,isNaN:b,isBoolean:function(e){return"boolean"===Q(e)},isObject:E,isRegExp:T,isFunction:_,isArray:C,isDate:k,fixed:function(e,t){return O(e)?Number(e.toFixed(O(t)?t:2)):S(e)&&"NaN"!==R(Number(e))?Number(Number(e).toFixed(O(t)?t:2)):e},head:P,last:x,drop:q,dropWhile:function(e,t){return C(e)?e.filter((function(e){return!t(e)})):e},compact:N,find:D,findIndex:A,includes:U,arrayFrom:K,toString:R,split:L,lowerFirst:j,upperFirst:function(e){if(S(e)){var t=L(e,"");return"".concat(P(t).toUpperCase()).concat(q(t).join(""))}return e},startsWith:F,endsWith:B,has:H,keys:G,forEach:M,isEqual:z,get:function(e,t,n){var i=e;return E(e)?(t.split(".").forEach((function(e){i=i?i[e]:n})),i):n},unset:W,isEmpty:J,typeOf:Q,formatDate:function(e){if(k(e)){var t=function(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())}return e}}),X=function(e,t){console.log("%c [GrowingIO]:".concat(e),{info:"color: #3B82F6;",error:"color: #EF4444;",warn:"color: #F59E0B;",success:"color: #10B981;"}[t]||"")},Y=function(e){try{return e()}catch(e){return}},$=function(e){var t={};return E(e)&&M(e,(function(e,n){var i,r=R(n).slice(0,100);E(e)?t[r]=$(e):C(e)?(t[r]=e.slice(0,100),"cdp"===(null===(i=window.vds)||void 0===i?void 0:i.gioEnvironment)&&(t[r]=t[r].join("||").slice(0,1e3))):t[r]=y(e)?"":R(e).slice(0,1e3)})),t},ee=function(e,t,i,r){void 0===r&&(r={}),document.addEventListener?e.addEventListener(t,i,n(n({},{capture:!0}),r)):e.attachEvent?e.attachEvent("on"+t,i):e["on"+t]=i},te=function(e,t){return S(e)&&!J(e)&&e.match(/^[a-zA-Z_][0-9a-zA-Z_]{0,100}$/)?t():(X("事件名格式不正确,只能包含数字、字母和下划线,且不能以数字开头,字符总长度不能超过100!","error"),!1)},ne=Object.freeze({__proto__:null,consoleText:X,niceTry:Y,limitObject:$,addListener:ee,flattenObject:function(e){void 0===e&&(e={});var t=n({},e);return G(t).forEach((function(e){E(t[e])?(G(t[e]).forEach((function(n){t["".concat(e,"_").concat(n)]=R(t[e][n])})),W(t,e)):C(t[e])?(t[e].forEach((function(n,i){E(n)?G(n).forEach((function(r){t["".concat(e,"_").concat(i,"_").concat(r)]=R(n[r])})):t["".concat(e,"_").concat(i)]=R(n)})),W(t,e)):y(t[e])||""===t[e]?W(t,e):t[e]=R(t[e])})),$(t)},eventNameValidate:te,getGioFunction:function(){var e,t,n,i,r=window._gio_local_vds||"vds",o=null!==(t=null===(e=window[r])||void 0===e?void 0:e.namespace)&&void 0!==t?t:"gdp";return _(window[o])?window[o]:null!==(i=null!==(n=window.gdp)&&void 0!==n?n:window.gio)&&void 0!==i?i:function(){}}}),ie=function(e){return S(e)&&e.length>0||O(e)&&e>0},re=/^((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})(\.((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})){3}/i,oe=/^(https?:\/\/)|(([a-zA-Z0-9_-])+(\.)?)*(:\d+)?(\/((\.)?(\?)?=?&?[a-zA-Z0-9_-](\?)?)*)*$/i;function ae(e){for(var t=1;arguments.length>t;t++){var n=arguments[t];for(var i in n)e[i]=n[i]}return e}var se,ue,ce=function e(t,n){function i(e,i,r){if("undefined"!=typeof document){"number"==typeof(r=ae({},n,r)).expires&&(r.expires=new Date(Date.now()+864e5*r.expires)),r.expires&&(r.expires=r.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var o="";for(var a in r)r[a]&&(o+="; "+a,!0!==r[a]&&(o+="="+r[a].split(";")[0]));return document.cookie=e+"="+t.write(i,e)+o}}return Object.create({set:i,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var n=document.cookie?document.cookie.split("; "):[],i={},r=0;r+Date.now()?ge(me(t.value)):void 0},this.setItem=function(e,t,n){var i=null!=n?n:+new Date(9999,12);localStorage.setItem(le(e),JSON.stringify({value:S(t)&&t.length&&B(e,"_gioenc")?pe(t):t,expiredAt:i}))},this.removeItem=function(e){return localStorage.removeItem(le(e))},this.hasItem=function(e){return!!localStorage.getItem(le(e))},this.getKeys=function(){return K(Array(localStorage.length)).map((function(e,t){return localStorage.key(t)}))},this.type="localStorage"},ye={},Se=function(){this.getItem=function(e){var t=Y((function(){return JSON.parse(ye[le(e)]||"")}));return E(t)&&t.expiredAt>+Date.now()?ge(me(t.value)):void 0},this.setItem=function(e,t,n){var i=null!=n?n:+new Date(9999,12);ye[le(e)]=JSON.stringify({value:S(t)&&t.length?pe(t):t,expiredAt:i})},this.removeItem=function(e){return W(ye,le(e))},this.hasItem=function(e){return H(ye,le(e))},this.getKeys=function(){return G(ye)},this.type="memory"},Oe=/^(\.ac\.|\.br\.|\.co\.|\.com\.|\.edu\.|\.gov\.|\.org\.|\.net\.)/,be=function(e){var t=[];try{var n=e.split("."),i=x(n);if(n.length>=2&&(isNaN(Number(i))||0>Number(i)||Number(i)>255)){var r=".".concat(n.slice(-2).join("."));Oe.test(r)?se=r:t.push(r);var o=".".concat(n.slice(-3).join("."));Oe.test(o)||U(t,o)||t.push(o);var a=".".concat(n.slice(-4).join("."));Oe.test(a)||U(t,a)||t.push(a)}}catch(e){}return t},Ee=function(e){var t="";return e.every((function(e){return!Te(e)||(t=e,!1)})),t},Te=function(e){try{ce.set("gioCookie","yes",{domain:e});var t=!!ce.get("gioCookie",{domain:e});return ce.remove("gioCookie",{domain:e}),t}catch(e){return!1}},_e=function(e){var t,n,r,o=e.storageType,a=e.cookieDomain,s=e.projectId;if(U(["cookie","localstorage"],o)||(o="cookie"),"cookie"===o&&(n=!!(r=navigator.userAgent.indexOf("Electron")>-1||U(["","localhost","127.0.0.1"],window.location.hostname)||!U(["http:","https:"],window.location.protocol)?"":Ee(i(i([],be(window.location.hostname),!0),[window.location.hostname],!1)))),"cookie"===o&&n){var u=new Ie(r);if(a){var c=be(a),d=Ee(J(c)?[]:i([a],be(a),!0));d&&Te(d)?u.domain=d:X("指定Cookie域无效或无权限,使用默认域!","warn")}t=u}else t=function(){try{var e=window.localStorage,t="__storage_test__";return e.setItem(t,t),e.removeItem(t),!0}catch(e){return!1}}()?new we:new Se;return"cookie"===o&&se&&Te(se)&&function(e,t,n){if(t&&Te(t)){var i=new Ie(t);["".concat(n,"_gdp_session_id"),"gdp_user_id_gioenc","".concat(n,"_gdp_cs1_gioenc"),"".concat(n,"_gdp_user_key_gioenc"),"".concat(n,"_gdp_gio_id_gioenc"),"".concat(n,"_gdp_sequence_ids"),"".concat(n,"_gdp_session_id_sent")].forEach((function(t){var n=i.getItem(t);i.hasItem(t)&&(e.setItem(t,n),i.removeItem(t))})),i=void 0}}(t,se,s),t},Ce="SESSIONID_UPDATE",ke={name:"gioCustomTracking",method:function(e){var t=this;this.growingIO=e,this.getValidResourceItem=function(e){if(e&&E(e)&&e.id&&e.key){var t={id:S(e.id)?e.id:R(e.id),key:S(e.key)?e.key:R(e.key)};return e.attributes&&(t.attributes=e.attributes),t}},this.getDynamicAttributes=function(e){return y(e)||G(e).forEach((function(t){_(e[t])?e[t]=e[t]():E(e[t])?W(e,t):C(e[t])||(e[t]=R(e[t]))})),e},this.buildCustomEvent=function(e,i,r,o){te(e,(function(){var a=t.growingIO.dataStore,s=a.eventContextBuilder,u=a.eventConverter,c=a.currentPage,d=n({eventType:"CUSTOM",eventName:e,pageShowTimestamp:null==c?void 0:c.time,attributes:$(t.getDynamicAttributes(E(i)&&!J(i)?i:void 0)),resourceItem:$(t.getValidResourceItem(r))},s());J(o)||(d=n(n({},d),o)),u(d)}))},this.buildUserAttributesEvent=function(e,i){var r=t.growingIO.dataStore,o=r.eventContextBuilder,a=r.eventConverter,s=n({eventType:"LOGIN_USER_ATTRIBUTES",attributes:$(e)},o());J(i)||(s=n(n({},s),i)),a(s)}}},Pe=["gioPerformance"],xe=function(e){function n(t){var n=e.call(this,t)||this;return n.growingIO=t,n.growingIO.gioSDKFull=!1,n.pluginsContext={plugins:{gioCustomTracking:ke}},n}return t(n,e),n}((function(e){var t,n,i,r,o=this;this.growingIO=e,this.innerPluginInit=function(){var e;Pe.forEach((function(e){var t;return W(null===(t=o.pluginsContext)||void 0===t?void 0:t.plugins,e)})),G(null===(e=o.pluginsContext)||void 0===e?void 0:e.plugins).forEach((function(e){var t,n=null===(t=o.pluginsContext)||void 0===t?void 0:t.plugins[e],i=n.name,r=n.method;D(o.pluginItems,(function(e){return e.name===i}))||o.pluginItems.push({name:j(i||e),method:r||function(e){}})})),J(o.pluginItems)||o.installAll()},this.install=function(e,t,n){var i,r,a=t||D(o.pluginItems,(function(t){return t.name===e}));if((null===(i=o.growingIO)||void 0===i?void 0:i.plugins)[e])return X("重复加载插件 ".concat(e," 或插件重名,已跳过加载!"),"warn"),!1;if(!a)return X("插件加载失败!不存在名为 ".concat(e," 的插件!"),"error"),!1;try{return(null===(r=o.growingIO)||void 0===r?void 0:r.plugins)[e]=new a.method(o.growingIO,n),"cdp"===o.growingIO.gioEnvironment&&t&&X("加载插件 ".concat(e),"info"),!0}catch(e){return X("插件加载异常 ".concat(e),"error"),!1}},this.installAll=function(e){(e||o.pluginItems).forEach((function(t){o.install(t.name,e?t:void 0,e?null==t?void 0:t.options:void 0)&&!D(o.pluginItems,(function(e){return e.name===t.name}))&&o.pluginItems.push({name:j(t.name),method:t.method?t.method:function(){}})}))},this.uninstall=function(e){var t;W(o.pluginItems,e);var n=W(null===(t=o.growingIO)||void 0===t?void 0:t.plugins,e);return n||X("卸载插件 ".concat(e," 失败!"),"error"),n},this.uninstallAll=function(){o.pluginItems.forEach((function(e){return o.uninstall(e.name)}))},this.lifeError=function(e,t){return X("插件执行错误 ".concat(e.name," ").concat(t),"error")},this.onComposeBefore=function(e){o.pluginItems.forEach((function(t){var n,i=null===(n=o.growingIO.plugins[t.name])||void 0===n?void 0:n.onComposeBefore;if(i&&_(i))try{i(e)}catch(e){o.lifeError(t,e)}}))},this.onComposeAfter=function(e){o.pluginItems.forEach((function(t){var n,i=null===(n=o.growingIO.plugins[t.name])||void 0===n?void 0:n.onComposeAfter;if(i&&_(i))try{i(e)}catch(e){o.lifeError(t,e)}}))},this.onSendBefore=function(e){o.pluginItems.forEach((function(t){var n,i=null===(n=o.growingIO.plugins[t.name])||void 0===n?void 0:n.onSendBefore;if(i&&_(i))try{i(e)}catch(e){o.lifeError(t,e)}}))},this.onSendAfter=function(e){o.pluginItems.forEach((function(t){var n,i=null===(n=o.growingIO.plugins[t.name])||void 0===n?void 0:n.onSendAfter;if(i&&_(i))try{i(e)}catch(e){o.lifeError(t,e)}}))},this.pluginsContext={plugins:{}},this.pluginItems=[],null===(t=this.growingIO.emitter)||void 0===t||t.on("onComposeBefore",this.onComposeBefore),null===(n=this.growingIO.emitter)||void 0===n||n.on("onComposeAfter",this.onComposeAfter),null===(i=this.growingIO.emitter)||void 0===i||i.on("onSendBefore",this.onSendBefore),null===(r=this.growingIO.emitter)||void 0===r||r.on("onSendAfter",this.onSendAfter)})),qe=function(){function e(e){this.growingIO=e;var t=this.growingIO.vdsConfig.projectId,n=this.growingIO.storage,i=n.getItem,r=n.setItem,o=n.getKeys,a=n.removeItem;this.getItem=i,this.setItem=r,this.getKeys=o,this.removeItem=a,this.sIdStorageName="".concat(t,"_gdp_session_id"),this.uidStorageName="gdp_user_id_gioenc",this.userIdStorageName="".concat(t,"_gdp_cs1_gioenc"),this.userKeyStorageName="".concat(t,"_gdp_user_key_gioenc"),this.gioIdStorageName="".concat(t,"_gdp_gio_id_gioenc")}return Object.defineProperty(e.prototype,"sessionId",{get:function(){return this.getItem(this.sIdStorageName)||(this.sessionId=de(),this.sessionId)},set:function(e){var t,n=this;e||(e=de());var i=this.getItem(this.sIdStorageName)||this.prevSessionId,r=this.growingIO.vdsConfig.sessionExpires,o=void 0===r?30:r;this.setItem(this.sIdStorageName,e,+Date.now()+60*o*1e3),i!==e&&(this.getKeys().filter((function(e){return/.+_gdp_session_id_.{36}/.test(e)})).forEach((function(e){n.removeItem(e)})),this.setItem(this.growingIO.dataStore.visitStorageName,""),null===(t=this.growingIO.emitter)||void 0===t||t.emit(Ce,{newSessionId:e,oldSessionId:i})),this.prevSessionId=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"uid",{get:function(){return this.getItem(this.uidStorageName)||(this.uid=de(),this.uid)},set:function(e){var t,n=this.getItem(this.uidStorageName)||this.prevUId;this.setItem(this.uidStorageName,e),n!==e&&(null===(t=this.growingIO.emitter)||void 0===t||t.emit("UID_UPDATE",{newUId:e,oldUId:n})),this.prevUId=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"userId",{get:function(){return this.getItem(this.userIdStorageName)||""},set:function(e){var t,n,i=this.getItem(this.userIdStorageName)||this.prevUserId;this.setItem(this.userIdStorageName,e),null===(t=this.growingIO.emitter)||void 0===t||t.emit("SET_USERID",{newUserId:e,oldUserId:i,userKey:this.userKey}),i!==e&&(null===(n=this.growingIO.emitter)||void 0===n||n.emit("USERID_UPDATE",{newUserId:e,oldUserId:i,userKey:this.userKey})),e&&(this.gioId=e),this.prevUserId=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"userKey",{get:function(){return this.getItem(this.userKeyStorageName)||""},set:function(e){var t,n,i=this.getItem(this.userKeyStorageName)||this.prevUserKey;this.setItem(this.userKeyStorageName,e),null===(t=this.growingIO.emitter)||void 0===t||t.emit("SET_USERKEY",{newUserKey:e,oldUserKey:i,userId:this.userId}),i!==e&&(null===(n=this.growingIO.emitter)||void 0===n||n.emit("USERKEY_UPDATE",{newUserKey:e,oldUserKey:i,userId:this.userId})),this.prevUserKey=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"gioId",{get:function(){return this.getItem(this.gioIdStorageName)||""},set:function(e){var t,n=this.getItem(this.gioIdStorageName)||this.prevGioId;this.setItem(this.gioIdStorageName,e),n!==e&&(null===(t=this.growingIO.emitter)||void 0===t||t.emit("GIOID_UPDATE",{newGioId:e,oldGioId:n})),this.prevGioId=e},enumerable:!1,configurable:!0}),e}(),Ne=function(e){var t=this;this.growingIO=e,this.main=function(){var e,i,r=t.growingIO,o=r.sdkVersion,a=r.useEmbeddedInherit,s=r.vdsConfig,u=r.userStore,c=r.dataStore,d=r.trackingId,l=c.currentPage,g=l.path,f=l.query,p={appVersion:s.version,dataSourceId:s.dataSourceId,deviceId:u.uid,domain:a?s.appId:window.location.host,gioId:u.gioId,language:navigator.language,path:g,platform:s.platform,query:f,referralPage:(null===(e=c.lastPageEvent)||void 0===e?void 0:e.referralPage)||"",screenHeight:window.screen.height,screenWidth:window.screen.width,sdkVersion:o,sessionId:u.sessionId,timestamp:+Date.now(),title:null!==(i=Y((function(){return document.title.slice(0,255)})))&&void 0!==i?i:"",userId:u.userId};if(s.enableIdMapping&&(p.userKey=u.userKey),J(s.ignoreFields)||s.ignoreFields.forEach((function(e){W(p,e)})),a&&!J(t.minpExtraParams)){var m=n({},p);M(n(n({},p),t.minpExtraParams),(function(e,n){var i;U(s.embeddedIgnore,n)?(p[n]=m[n],"domain"===n&&(p[n]=window.location.host)):p[n]=null!==(i=t.minpExtraParams[n])&&void 0!==i?i:p[n]}))}return p.trackingId=d,p},this.minpExtraParams={}},De=function(e){var t=this;this.growingIO=e,this.parsePage=function(){var e=t.growingIO.vdsConfig.hashtag,n=location.pathname,i=location.search,r=location.hash,o=r.indexOf("?");t.domain=window.location.host,t.title=document.title.slice(0,255),t.time=+Date.now(),t.path=n,t.query=i,e&&(o>-1?(t.path+=r.slice(0,o),t.query=t.query+"&"+r.slice(o+1)):t.path+=r),t.query&&U(["?","&"],t.query.charAt(0))&&(t.query=t.query.slice(1))},this._getNoHashHref=function(){var e=window.location,t=e.protocol,n=e.host,i=e.pathname,r=e.search;return"".concat(t,"://").concat(n).concat(i).concat(r)},this.getReferralPage=function(){var e,n,i=t.growingIO.dataStore.lastPageEvent;return(null==i?void 0:i.path)===t.path&&(null!==(e=null==i?void 0:i.query)&&void 0!==e?e:"")===(null!==(n=t.query)&&void 0!==n?n:"")?null==i?void 0:i.referralPage:(null==i?void 0:i.path)?t.lastHref:document.referrer},this.pageListener=function(){var e=t.growingIO.vdsConfig.hashtag,n=window.location.href,i=t.lastHref;e||(n=t._getNoHashHref(),i=t.lastNoHashHref),i!==n&&(t.parsePage(),t.buildPageEvent())},this.hookHistory=function(){var e=window.history.pushState,n=window.history.replaceState,i=t;e&&Y((function(){return window.history.pushState=function(){e.apply(window.history,arguments),setTimeout(i.pageListener)}})),n&&Y((function(){return window.history.replaceState=function(){n.apply(window.history,arguments),setTimeout(i.pageListener)}})),ee(window,"popstate",t.pageListener),t.growingIO.vdsConfig.hashtag&&ee(window,"hashchange",t.pageListener)},this.buildPageEvent=function(e){var i=t.growingIO.dataStore;i.lastPageEvent;var r=i.eventContextBuilder,o=i.eventConverter,a=n(n({eventType:"PAGE"},r()),{protocolType:location.protocol.substring(0,location.protocol.length-1),referralPage:t.getReferralPage()});J(e)||(a=n(n({},a),e)),a.timestamp=t.time,o(a),t.lastHref=window.location.href,t.lastNoHashHref=t._getNoHashHref(),t.lastLocation=n({},window.location)},this.title=document.title.slice(0,255),this.lastLocation=n({},window.location)},Ae={referralPage:document.referrer},Ue=function(){function e(e){var t,i,u,c=this;this.growingIO=e,this.ALLOW_SETTING=n(n({},o),"saas"===this.growingIO.gioEnvironment?s:a),this.allowOptKeys=Object.keys(this.ALLOW_SETTING),this.trackTimers={},this.setSequenceIds=function(e,t){var i=c.growingIO.storage.getItem(c.seqStorageIdName)||{};"gsid"===e?i.globalKey=t:i=n(n({},i),t),c.growingIO.storage.setItem(c.seqStorageIdName,i)},this.initOptions=function(e){var t,i,o,a,s,u,d,l=e.projectId,g=e.dataSourceId,f=e.appId;c.initialDataSourceId=g;var p={};c.allowOptKeys.forEach((function(t){var n=c.ALLOW_SETTING[t].type,i=C(n)?!U(n,Q(e[t])):Q(e[t])!==n;"platform"!==t||U(r,e[t])||(i=!0),i?p[t]=c.ALLOW_SETTING[t].default:"ignoreFields"===t?p.ignoreFields=e.ignoreFields.filter((function(e){return U(I,e)})):(p[t]=e[t],U(["dataCollect","autotrack"],t)&&(p[t]||X("已关闭".concat(v[t]),"info")))})),p.sessionExpires=Math.round(p.sessionExpires),(b(p.sessionExpires)||1>p.sessionExpires||p.sessionExpires>360)&&(p.sessionExpires=30),p.storageType=p.storageType.toLowerCase(),p.sendType=p.sendType.toLowerCase(),U(["beacon","xhr","image"],p.sendType)||(p.sendType="beacon"),!b(Number(p.requestTimeout))&&p.requestTimeout>0||(p.requestTimeout=5e3),c.growingIO.vdsConfig=n(n(n({},null!==(t=window.vds)&&void 0!==t?t:{}),p),{projectId:l,dataSourceId:g,appId:f,performance:{monitor:null===(o=null===(i=p.performance)||void 0===i?void 0:i.monitor)||void 0===o||o,exception:null===(s=null===(a=p.performance)||void 0===a?void 0:a.exception)||void 0===s||s,network:null!==(d=null===(u=p.performance)||void 0===u?void 0:u.network)&&void 0!==d&&d}}),window.vds=c.growingIO.vdsConfig,c.seqStorageIdName="".concat(l,"_gdp_sequence_ids"),c.visitStorageName="".concat(l,"_gdp_session_id_sent")},this.setOption=function(e,t){var i,r=c.growingIO,o=r.vdsConfig,a=r.callError,s=r.uploader,u=r.emitter,d=S(e)&&U(m,e),l=d&&typeof t===((null===(i=c.ALLOW_SETTING[e])||void 0===i?void 0:i.type)||"string"),g=n({},o);return d&&l?(o[e]=t,"dataCollect"===e&&g.dataCollect!==t&&(t?(c.sendVisit(!0),c.sendPage()):c.growingIO.clearTrackTimer()),U(["host","scheme"],e)&&(null==s||s.generateHost()),null==u||u.emit("OPTION_CHANGE",{optionName:e,optionValue:t}),window.vds[e]=t,!0):(a("setOption > ".concat(e)),!1)},this.getOption=function(e){var t=c.growingIO,i=t.vdsConfig,r=t.callError;return e&&H(i,R(e))?i[R(e)]:y(e)?n({},i):void r("getOption > ".concat(e))},this.sendVisit=function(e){var t=c.growingIO,n=t.userStore.sessionId,i=t.storage.getItem(c.visitStorageName);!e&&n===i||(c.lastVisitEvent.timestamp=c.currentPage.time-1,c.buildVisitEvent())},this.buildVisitEvent=function(e){var t=c.growingIO,i=t.dataStore,r=i.eventContextBuilder,o=i.eventConverter,a=t.emitter,s=t.storage,u=t.userStore,d=c.lastVisitEvent,l=d.referralPage,g=d.title,f=d.path,p=d.query,m=d.timestamp,v=n(n({eventType:"VISIT"},r()),{referralPage:l||c.currentPage.getReferralPage(),timestamp:m});f&&(v.title=g,v.path=f,v.query=p),J(e)||(v.session=(null==e?void 0:e.session)||v.session,v.trackingId=null==e?void 0:e.trackingId,v=n(n({},v),e));var h=function(e){var t=e.requestData;"VISIT"===t.eventType&&t.trackingId===c.growingIO.trackingId&&(u.sessionId===t.sessionId&&s.setItem(c.visitStorageName,t.sessionId),a.off("onSendAfter",h))};a.on("onSendAfter",h),o(v)},this.sendPage=function(e){e&&c.currentPage.parsePage(),c.currentPage.buildPageEvent()},this.buildErrorEvent=function(e){var t=c.growingIO.dataStore,i=t.eventContextBuilder;(0,t.eventConverter)(n({eventType:"CUSTOM",pageShowTimestamp:c.currentPage.time,eventName:"onError",attributes:e},i()))},this.currentPage=new De(this.growingIO),this.eventContextBuilderInst=new Ne(this.growingIO),this.eventContextBuilder=this.eventContextBuilderInst.main,this.generalProps={},this.lastVisitEvent=Ae,null===(t=this.growingIO.emitter)||void 0===t||t.on("onComposeAfter",(function(e){var t=e.composedEvent;"VISIT"!==t.eventType&&"vst"!==t.t||t.trackingId!==c.growingIO.trackingId||(c.lastVisitEvent=t)})),this.lastPageEvent={},null===(i=this.growingIO.emitter)||void 0===i||i.on("onComposeAfter",(function(e){var t=e.composedEvent;"PAGE"!==t.eventType&&"page"!==t.t||t.trackingId!==c.growingIO.trackingId||(c.lastPageEvent=t)})),null===(u=this.growingIO.emitter)||void 0===u||u.on(Ce,(function(){if(c.growingIO.gioSDKInitialized){c.currentPage.parsePage();var e=c.currentPage,t=e.title,n=e.path,i=e.query,r=e.time,o=e.getReferralPage;c.lastVisitEvent={referralPage:document.referrer||o(),title:t,path:n,query:i,timestamp:r-1},c.sendVisit(!0),c.sendPage(!0)}}))}return Object.defineProperty(e.prototype,"esid",{get:function(){var e=this,t=this.growingIO.storage.getItem(this.seqStorageIdName)||{},i=n({},t);return W(i,"globalKey"),i=E(i)&&!y(i)?i:{},this._esid={},G(i).forEach((function(t){e._esid[t]=b(Number(i[t]))||i[t]>=1e9||1>i[t]?1:i[t]})),this._esid},set:function(e){var t={};G(e).forEach((function(n){t[n]=b(e[n])||e[n]>=1e9||1>e[n]?1:e[n]})),z(this._esid,t)||(this._esid=t,this.setSequenceIds("esid",this._esid))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"gsid",{get:function(){var e=this.growingIO.storage.getItem(this.seqStorageIdName)||{},t=Number(e.globalKey);return this._gsid=b(t)||t>=1e9||1>t?1:t,this._gsid},set:function(e){b(Number(e))||e>=1e9||1>e?this._gsid=1:this._gsid=e,this.setSequenceIds("gsid",this._gsid)},enumerable:!1,configurable:!0}),e}(),Ke=function(e){function i(t){var i=e.call(this,t)||this;return i.growingIO=t,i.eventConverter=function(e){var t,r,o=i.growingIO,a=o.vdsConfig,s=o.dataStore,u=o.uploader;if(a.dataCollect){e.trackingId===i.growingIO.trackingId&&(e.globalSequenceId=s.gsid,e.eventSequenceId=s.esid[e.eventType]||1);var c={};M(e,(function(e,t){var n;if("element"===t){var i=null!==(n=P(e))&&void 0!==n?n:{};M(i,(function(e,t){J(e)&&0!==e||(c[t]=e)}))}else(J(e)||y(e))&&0!==e||(c[t]=e)})),e.trackingId===i.growingIO.trackingId&&(i.growingIO.dataStore.gsid+=1,i.growingIO.dataStore.esid=n(n({},i.growingIO.dataStore.esid),((t={})[c.eventType]=(i.growingIO.dataStore.esid[c.eventType]||1)+1,t))),null===(r=i.growingIO.emitter)||void 0===r||r.emit("onComposeAfter",{composedEvent:n({},c)}),e.trackingId===i.growingIO.trackingId&&u.commitRequest(c)}else"VISIT"===e.eventType&&(i.lastVisitEvent=e)},i}return t(i,e),i}(Ue),Re=function(e){function n(t){var n=e.call(this,t)||this;return n.growingIO=t,n.generateHost=function(){var e=n.growingIO.vdsConfig,t=e.scheme,i=e.host,r=void 0===i?"":i,o=e.projectId;t?B(R(t),"://")||(t="".concat(t,"://")):t="".concat(location.protocol.indexOf("http")>-1?location.protocol.replace(":",""):"https","//"),F(r,"http")&&(r=r.substring(r.indexOf("://")+(B(R(t),"://")?3:0))),n.requestURL="".concat(t).concat(r,"/v3/projects/").concat(o,"/collect")},n.requestURL="",n.generateHost(),n}return t(n,e),n}((function(e){var t=this;this.growingIO=e,this.getSendType=function(){var e=t.growingIO.vdsConfig.sendType;return"beacon"===e?function(){var e,t,n=!!(null===(e=null===window||void 0===window?void 0:window.navigator)||void 0===e?void 0:e.sendBeacon),i=window.navigator.userAgent;if(i.match(/(iPad|iPhone|iPod)/g)){var r=!(t=i.toLowerCase().match(/cpu.*os (.*?) like mac os/i))||2>t.length?0:+t[1].split("_").slice(0,2).join(".");return n&&r>13}return n}()?"beacon":"xhr":e},this.commitRequest=function(e){var i=n({},e);t.requestQueue.push(n(n({},i),{requestType:t.getSendType()})),t.initiateRequest()},this.initiateRequest=function(){var e,r,o;if(i([],t.requestQueue,!0).length>0&&t.requestingNum0?R(n).slice(0,1e3):""),t.userStore.userId=R(e).slice(0,1e3),i&&i!==t.userStore.userId&&(t.userStore.sessionId="")}else t.clearUserId(),t.callError("setUserId")},t.clearUserId=function(){t.userStore.userId="",t.userStore.userKey=""},t.track=function(e,i,r,o){var a,s;((null===(s=null===(a=t.plugins)||void 0===a?void 0:a.gioCustomTracking)||void 0===s?void 0:s.buildCustomEvent)||function(){})(e,n(n({},t.dataStore.generalProps),E(i)&&!J(i)?i:{}),r,o)},t.sendPage=function(e){return t.dataStore.currentPage.buildPageEvent(e)},t.sendVisit=function(e){return t.dataStore.buildVisitEvent(e)},t.trackTimerStart=function(e,n){t.vdsConfig.dataCollect&&te(e,(function(){var i=de();_(n)?(t.dataStore.trackTimers[i]={eventName:e,leng:0,start:+Date.now()},n(i)):X("回调方法不合法,返回timerId失败!")}))},t.trackTimerPause=function(e){if(e&&t.dataStore.trackTimers[e]){var n=t.dataStore.trackTimers[e];n.start&&(n.leng=n.leng+(+Date.now()-n.start)),n.start=0}},t.trackTimerResume=function(e){if(e&&t.dataStore.trackTimers[e]){var n=t.dataStore.trackTimers[e];0===n.start&&(n.start=+Date.now())}},t.trackTimerEnd=function(e,i){if(t.vdsConfig.dataCollect)if(e&&t.dataStore.trackTimers[e]){var r=t.dataStore.trackTimers[e];if(0!==r.start){var o=+Date.now()-r.start;r.leng=o>0?r.leng+o:0}t.track(r.eventName,n(n({},i),{event_duration:r.leng>864e5?0:r.leng/1e3})),t.removeTimer(e)}else X("未查找到对应的计时器,请检查!","error")},t.removeTimer=function(e){e&&t.dataStore.trackTimers[e]&&delete t.dataStore.trackTimers[e]},t.clearTrackTimer=function(){t.dataStore.trackTimers={}},t.dataStore=new Ke(t),t}return t(i,e),i}((function(){var e,t=this;this.trackingId="g0",this.init=function(e){var n,i,r,o,a;X("Gio Web SDK 初始化中...","info");var s=t.dataStore,u=s.initOptions,c=s.currentPage,d=s.sendVisit,l=s.sendPage;u(e),t.storage=_e(t.vdsConfig),t.initCallback(),null===(n=t.emitter)||void 0===n||n.emit("OPTION_INITIALIZED",t),null===(r=null===(i=t.plugins)||void 0===i?void 0:i.gioEventAutoTracking)||void 0===r||r.main(),c.hookHistory(),c.parsePage(),null===(o=t.emitter)||void 0===o||o.emit("SDK_INITIALIZED",t),X("Gio Web SDK 初始化完成!","success"),t.useEmbeddedInherit||(t.dataStore.lastVisitEvent.timestamp=c.time,d()),l(),t.gioSDKInitialized=!0,t.vdsConfig.gioSDKInitialized=!0,window[t.vds]=t.vdsConfig,null===(a=t.emitter)||void 0===a||a.emit("SDK_INITIALIZED_COMPLATE",t)},this.setOption=function(e,n){if(U(m,e)){var i=t.dataStore.setOption(e,n);return i&&v[e]&&X("已".concat(n?"开启":"关闭").concat(v[e]),"info"),i}return X("不存在可修改的配置项:".concat(e,",请检查后重试!"),"warn"),!1},this.getOption=function(e){return t.dataStore.getOption(e)},this.setGeneralProps=function(e){E(e)&&!J(e)?(t.dataStore.generalProps=n(n({},t.dataStore.generalProps),e),G(t.dataStore.generalProps).forEach((function(e){U([void 0,null],t.dataStore.generalProps[e])&&(t.dataStore.generalProps[e]="")}))):t.callError("setGeneralProps")},this.clearGeneralProps=function(e){C(e)&&!J(e)?e.forEach((function(e){W(t.dataStore.generalProps,e)})):t.dataStore.generalProps={}},this.reissuePage=function(){t.dataStore.sendPage()},this.notRecommended=function(){return X("不推荐的方法使用,建议使用 gio('setOption', [optionName], [value])!","info")},this.callError=function(e,t,n){return void 0===t&&(t=!0),void 0===n&&(n="参数不合法"),X("".concat(t?"调用":"设置"," ").concat(e," 失败,").concat(n,"!"),"warn")},this.updateImpression=function(){var e,n,i=null===(n=null===(e=t.plugins)||void 0===e?void 0:e.gioImpressionTracking)||void 0===n?void 0:n.main;i?i("emitter"):X("updateImpression 错误! 请集成半自动埋点浏览插件后重试!","error")},this.gioEnvironment="cdp",this.sdkVersion="3.8.7",this.vds=window.gioCompatibilityVds?"gdp_vds":"vds",this.utils=n(n({},Z),ne),this.emitter={all:e=e||new Map,on:function(t,n){var i=e.get(t);i?i.push(n):e.set(t,[n])},off:function(t,n){var i=e.get(t);i&&(n?i.splice(i.indexOf(n)>>>0,1):e.set(t,[]))},emit:function(t,n){var i=e.get(t);i&&i.slice().map((function(e){e(n)})),(i=e.get("*"))&&i.slice().map((function(e){e(t,n)}))}},this.useEmbeddedInherit=!1,this.useHybridInherit=!1,this.gioSDKInitialized=!1,this.plugins=new xe(this),this.plugins.innerPluginInit()}));return function(){var e,t,i,r,o,a=window.gioCompatibilityVds?"gdp_vds":"vds";if(null===(e=window[a])||void 0===e?void 0:e.gioSDKInstalled)return ue=window.gdp,void X("SDK重复加载,请检查是否重复加载SDK或接入其他平台SDK导致冲突!","warn");window[a]=n(n({},null!==(t=window[a])&&void 0!==t?t:{}),{gioSDKInstalled:!0});var s=new Le;ue=function(){var e,t=arguments[0];if(S(t)&&U(p,t)&&s[t]){var i=q(K(arguments));if("init"===t){var r=function(e){var t;return e.vdsConfig||e.gioSDKInitialized||(null===(t=window.vds)||void 0===t?void 0:t.gioSDKInitialized)?(X("SDK重复初始化,请检查是否重复加载SDK或接入其他平台SDK导致冲突!","warn"),!1):!(U(["","localhost","127.0.0.1"],location.hostname)&&!window._gr_ignore_local_rule&&(X("当前SDK不允许在本地环境初始化!","warn"),1))}(s);if(!r)return;var o=function(e){return!J(N(e))||(X('SDK初始化失败,请使用 gdp("init", "您的GrowingIO项目 accountId", "您项目的 dataSourceId", options); 进行初始化!',"error"),!1)}(i);if(!o)return;var u=function(e){var t=P(e),n=x(e);return ie(R(t).trim())?(E(n)&&n||(n={}),{projectId:t,userOptions:n}):(X("SDK初始化失败,accountId 参数不合法!","error"),!1)}(i);if(!u)return;var c=function(e){var t=e[1],n=e[2],i=x(e);return t&&S(t)?{dataSourceId:t,appId:S(n)?n:"",cdpOptions:i}:(X("SDK初始化失败,dataSourceId 参数不合法!","error"),!1)}(i);if(!c)return;var d=u.projectId,l=c.dataSourceId,g=c.appId,f=c.cdpOptions;s.init(n(n({},f),{projectId:d,dataSourceId:l,appId:g}))}else if("registerPlugins"===t)s.registerPlugins(i[0]);else{if(s.gioSDKInitialized&&s.vdsConfig)return s[t].apply(s,i);s.emitter.emit("UNINITIALIZED_CALL",arguments),X("SDK未初始化!","error")}}else U(h,t)?X("方法 ".concat(R(t)," 已被弃用,请移除!"),"warn"):X("不存在名为 ".concat(R(t)," 的方法调用!"),"error");window[a]=n(n({},window[a]),{_gr_ignore_local_rule:null!==(e=window._gr_ignore_local_rule)&&void 0!==e&&e,gioEnvironment:"cdp",gioSDKVersion:s.sdkVersion,gioSDKFull:s.gioSDKFull,canIUse:function(e){return U(p,e)&&s[e]}})};var u=null===(i=null===window||void 0===window?void 0:window.gdp)||void 0===i?void 0:i.q,c=null===(r=null===window||void 0===window?void 0:window.gdp)||void 0===r?void 0:r.e,d=null===(o=null===window||void 0===window?void 0:window.gdp)||void 0===o?void 0:o.ef;window.gdp=ue,window.gdp.e=c,window.gdp.ef=d,C(u)&&!J(u)&&u.forEach((function(e){ue.apply(null,e)}))}(),ue})); diff --git a/gdp-full-es5.js b/gdp-full-es5.js index 3b3b101..026b15e 100644 --- a/gdp-full-es5.js +++ b/gdp-full-es5.js @@ -1 +1 @@ -var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)({}).hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};function t(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+n+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}var n=function(){return n=Object.assign||function(e){for(var t,n=1,i=arguments.length;i>n;n++)for(var r in t=arguments[n])({}).hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},n.apply(this,arguments)};function i(e,t,n){if(n||2===arguments.length)for(var i,r=0,o=t.length;o>r;r++)!i&&r in t||(i||(i=[].slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||[].slice.call(t))}var r=["web","wxwv","minp","alip","baidup","qq","bytedance"],o={autotrack:{type:"boolean",default:!0},compress:{type:"boolean",default:!0},dataCollect:{type:"boolean",default:!0},debug:{type:"boolean",default:!1},hashtag:{type:"boolean",default:!1},touch:{type:"boolean",default:!1},version:{type:"string",default:"1.0.0"},platform:{type:"string",default:"web"},cookieDomain:{type:"string",default:""},sendType:{type:"string",default:"beacon"}},a={enableIdMapping:{type:"boolean",default:!1},gtouchHost:{type:"string",default:""},host:{type:"string",default:"napi.growingio.com"},ignoreFields:{type:"array",default:[]},penetrateHybrid:{type:"boolean",default:!0},scheme:{type:"string",default:location.protocol.indexOf("http")>-1?location.protocol.replace(":",""):"https"},sessionExpires:{type:"number",default:30},performance:{type:"object",default:{monitor:!0,exception:!0}},embeddedIgnore:{type:"array",default:[]},storageType:{type:"string",default:"cookie"},requestTimeout:{type:"number",default:5e3}},s={},u=["clearUserId","getGioInfo","getLocation","getOption","init","setDataCollect","setOption","setUserId","track","setGeneralProps","clearGeneralProps"];i(i([],u,!0),["setEvar","setPage","setUser","setVisitor"],!1);var c,d,l,g,f,h=i(i([],u,!0),["enableDebug","enableHT","setAutotrack","setTrackerHost","setTrackerScheme","setUserAttributes","getVisitorId","getDeviceId","registerPlugins","getPlugins","sendPage","sendVisit","trackTimerStart","trackTimerPause","trackTimerResume","trackTimerEnd","removeTimer","clearTrackTimer","updateImpression"],!1),p=["autotrack","dataCollect","dataSourceId","debug","host","hashtag","scheme"],v={autotrack:"无埋点采集",dataCollect:"数据采集",debug:"调试模式"},m=["send","setConfig","collectImp","setPlatformProfile"],I=["screenHeight","screenWidth"],w={click:"VIEW_CLICK",change:"VIEW_CHANGE",submit:"FORM_SUBMIT"},y="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},O="function"==typeof Array.from?Array.from:(d||(d=1,l=function(e){return"function"==typeof e},g=function(e){var t=function(e){var t=Number(e);return isNaN(t)?0:0!==t&&isFinite(t)?(t>0?1:-1)*Math.floor(Math.abs(t)):t}(e);return Math.min(Math.max(t,0),9007199254740991)},f=function(e){var t=e.next();return!t.done&&t},c=function(e){var t,n,i,r=this,o=arguments.length>1?arguments[1]:void 0;if(void 0!==o){if(!l(o))throw new TypeError("Array.from: when provided, the second argument must be a function");arguments.length>2&&(t=arguments[2])}var a=function(e,t){if(null!=e&&null!=t){var n=e[t];if(null==n)return;if(!l(n))throw new TypeError(n+" is not a function");return n}}(e,function(e){if(null!=e){if(["string","number","boolean","symbol"].indexOf(typeof e)>-1)return Symbol.iterator;if("undefined"!=typeof Symbol&&"iterator"in Symbol&&Symbol.iterator in e)return Symbol.iterator;if("@@iterator"in e)return"@@iterator"}}(e));if(void 0!==a){n=l(r)?Object(new r):[];var s,u,c=a.call(e);if(null==c)throw new TypeError("Array.from requires an array-like or iterable object");for(i=0;;){if(!(s=f(c)))return n.length=i,n;u=s.value,n[i]=o?o.call(t,u,i):u,i++}}else{var d=Object(e);if(null==e)throw new TypeError("Array.from requires an array-like object - not null or undefined");var h,p=g(d.length);for(n=l(r)?Object(new r(p)):Array(p),i=0;p>i;)h=d[i],n[i]=o?o.call(t,h,i):h,i++;n.length=p}return n}),c),b=function(e){return q(["undefined","null"],Q(e))},T=function(e){return"string"===Q(e)},_=function(e){return"number"===Q(e)},E=function(e){return"NaN"===j(Number(e))},S=function(e){return"boolean"===Q(e)},N=function(e){return"object"===Q(e)&&!b(e)},C=function(e){return"regexp"===Q(e)},P=function(e){return q(["function","asyncfunction"],Q(e))},x=function(e){return Array.isArray(e)&&"array"===Q(e)},A=function(e){return"date"===Q(e)},D=function(e){try{return H(e)[0]}catch(e){return}},L=function(e){try{var t=H(e);return t[t.length-1]}catch(e){return}},R=function(e,t){return void 0===t&&(t=1),x(e)&&_(t)?e.slice(t>0?t:1,e.length):e},k=function(e){if(x(e)){for(var t=0,n=[],i=0,r=e;i=0},H=O,j=function(e){return b(e)?"":"".concat(e)},B=function(e,t){return"string"==typeof e?e.split(t):e},K=function(e){if(T(e)){var t=B(e,"");return"".concat(D(t).toLowerCase()).concat(R(t).join(""))}return e},W=function(e,t){return!!T(e)&&e.slice(0,t.length)===t},V=function(e,t){if(T(e)){var n=e.length,i=n;i>n&&(i=n);var r=i;return(i-=t.length)>=0&&e.slice(i,r)===t}return!1},M={}.hasOwnProperty,F=function(e,t){return!b(e)&&M.call(e,t)},z=function(e){return N(e)?Object.keys(e):[]},X=function(e,t){z(e).forEach((function(n){return t(e[n],n)}))},J=function(e,t){var n=z(e);return!(!N(e)||!N(t)||n.length!==z(t).length||q(n.map((function(n,i){return N(e[n])?J(e[n],t[n]):e[n]===t[n]})),!1))},Z=function(e,t){if(!N(e))return!1;try{return"string"===Q(t)?delete e[t]:"array"===Q(t)?t.map((function(t){return delete e[t]})):(C(t)&&z(e).forEach((function(n){t.test(n)&&Z(e,n)})),!0)}catch(e){return!1}},Y=function(e){return x(e)?0===e.length:N(e)?0===z(e).length:!e},Q=function(e){return{}.toString.call(e).slice(8,-1).toLowerCase()},$=Object.freeze({__proto__:null,isNil:b,isString:T,isNumber:_,isNaN:E,isBoolean:S,isObject:N,isRegExp:C,isFunction:P,isArray:x,isDate:A,fixed:function(e,t){return _(e)?Number(e.toFixed(_(t)?t:2)):T(e)&&"NaN"!==j(Number(e))?Number(Number(e).toFixed(_(t)?t:2)):e},head:D,last:L,drop:R,dropWhile:function(e,t){return x(e)?e.filter((function(e){return!t(e)})):e},compact:k,find:U,findIndex:G,includes:q,arrayFrom:H,toString:j,split:B,lowerFirst:K,upperFirst:function(e){if(T(e)){var t=B(e,"");return"".concat(D(t).toUpperCase()).concat(R(t).join(""))}return e},startsWith:W,endsWith:V,has:F,keys:z,forEach:X,isEqual:J,get:function(e,t,n){var i=e;return N(e)?(t.split(".").forEach((function(e){i=i?i[e]:n})),i):n},unset:Z,isEmpty:Y,typeOf:Q,formatDate:function(e){if(A(e)){var t=function(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())}return e}}),ee=function(e,t){console.log("%c [GrowingIO]:".concat(e),{info:"color: #3B82F6;",error:"color: #EF4444;",warn:"color: #F59E0B;",success:"color: #10B981;"}[t]||"")},te=function(e){try{return e()}catch(e){return}},ne=function(e){var t={};return N(e)&&X(e,(function(e,n){var i,r=j(n).slice(0,100);N(e)?t[r]=ne(e):x(e)?(t[r]=e.slice(0,100),"cdp"===(null===(i=window.vds)||void 0===i?void 0:i.gioEnvironment)&&(t[r]=t[r].join("||").slice(0,1e3))):t[r]=b(e)?"":j(e).slice(0,1e3)})),t},ie=function(e,t,i,r){void 0===r&&(r={}),document.addEventListener?e.addEventListener(t,i,n(n({},{capture:!0}),r)):e.attachEvent?e.attachEvent("on"+t,i):e["on"+t]=i},re=function(e,t){return T(e)&&!Y(e)&&e.match(/^[a-zA-Z_][0-9a-zA-Z_]{0,100}$/)?t():(ee("事件名格式不正确,只能包含数字、字母和下划线,且不能以数字开头,字符总长度不能超过100!","error"),!1)},oe=Object.freeze({__proto__:null,consoleText:ee,niceTry:te,limitObject:ne,addListener:ie,flattenObject:function(e){void 0===e&&(e={});var t=n({},e);return z(t).forEach((function(e){N(t[e])?(z(t[e]).forEach((function(n){t["".concat(e,"_").concat(n)]=j(t[e][n])})),Z(t,e)):x(t[e])?(t[e].forEach((function(n,i){N(n)?z(n).forEach((function(r){t["".concat(e,"_").concat(i,"_").concat(r)]=j(n[r])})):t["".concat(e,"_").concat(i)]=j(n)})),Z(t,e)):b(t[e])||""===t[e]?Z(t,e):t[e]=j(t[e])})),ne(t)},eventNameValidate:re,getGioFunction:function(){var e,t,n,i,r=window._gio_local_vds||"vds",o=null!==(t=null===(e=window[r])||void 0===e?void 0:e.namespace)&&void 0!==t?t:"gdp";return P(window[o])?window[o]:null!==(i=null!==(n=window.gdp)&&void 0!==n?n:window.gio)&&void 0!==i?i:function(){}}}),ae=function(e){return T(e)&&e.length>0||_(e)&&e>0},se=/^((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})(\.((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})){3}/i,ue=/^(https?:\/\/)|(([a-zA-Z0-9_-])+(\.)?)*(:\d+)?(\/((\.)?(\?)?=?&?[a-zA-Z0-9_-](\?)?)*)*$/i;function ce(e){for(var t=1;arguments.length>t;t++){var n=arguments[t];for(var i in n)e[i]=n[i]}return e}var de,le=function e(t,n){function i(e,i,r){if("undefined"!=typeof document){"number"==typeof(r=ce({},n,r)).expires&&(r.expires=new Date(Date.now()+864e5*r.expires)),r.expires&&(r.expires=r.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var o="";for(var a in r)r[a]&&(o+="; "+a,!0!==r[a]&&(o+="="+r[a].split(";")[0]));return document.cookie=e+"="+t.write(i,e)+o}}return Object.create({set:i,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var n=document.cookie?document.cookie.split("; "):[],i={},r=0;r+Date.now()?he(me(t.value)):void 0},this.setItem=function(e,t,n){var i=null!=n?n:+new Date(9999,12);localStorage.setItem(fe(e),JSON.stringify({value:T(t)&&t.length&&V(e,"_gioenc")?ve(t):t,expiredAt:i}))},this.removeItem=function(e){return localStorage.removeItem(fe(e))},this.hasItem=function(e){return!!localStorage.getItem(fe(e))},this.getKeys=function(){return H(Array(localStorage.length)).map((function(e,t){return localStorage.key(t)}))},this.type="localStorage"},be={},Te=function(){this.getItem=function(e){var t=te((function(){return JSON.parse(be[fe(e)]||"")}));return N(t)&&t.expiredAt>+Date.now()?he(me(t.value)):void 0},this.setItem=function(e,t,n){var i=null!=n?n:+new Date(9999,12);be[fe(e)]=JSON.stringify({value:T(t)&&t.length?ve(t):t,expiredAt:i})},this.removeItem=function(e){return Z(be,fe(e))},this.hasItem=function(e){return F(be,fe(e))},this.getKeys=function(){return z(be)},this.type="memory"},_e=/^(\.ac\.|\.br\.|\.co\.|\.com\.|\.edu\.|\.gov\.|\.org\.|\.net\.)/,Ee=function(e){var t=[];try{var n=e.split("."),i=L(n);if(n.length>=2&&(isNaN(Number(i))||0>Number(i)||Number(i)>255)){var r=".".concat(n.slice(-2).join("."));_e.test(r)?de=r:t.push(r);var o=".".concat(n.slice(-3).join("."));_e.test(o)||q(t,o)||t.push(o);var a=".".concat(n.slice(-4).join("."));_e.test(a)||q(t,a)||t.push(a)}}catch(e){}return t},Se=function(e){var t="";return e.every((function(e){return!Ne(e)||(t=e,!1)})),t},Ne=function(e){try{le.set("gioCookie","yes",{domain:e});var t=!!le.get("gioCookie",{domain:e});return le.remove("gioCookie",{domain:e}),t}catch(e){return!1}},Ce=function(e){var t,n,r,o=e.storageType,a=e.cookieDomain,s=e.projectId;if(q(["cookie","localstorage"],o)||(o="cookie"),"cookie"===o&&(n=!!(r=navigator.userAgent.indexOf("Electron")>-1||q(["","localhost","127.0.0.1"],window.location.hostname)||!q(["http:","https:"],window.location.protocol)?"":Se(i(i([],Ee(window.location.hostname),!0),[window.location.hostname],!1)))),"cookie"===o&&n){var u=new ye(r);if(a){var c=Ee(a),d=Se(Y(c)?[]:i([a],Ee(a),!0));d&&Ne(d)?u.domain=d:ee("指定Cookie域无效或无权限,使用默认域!","warn")}t=u}else t=function(){try{var e=window.localStorage,t="__storage_test__";return e.setItem(t,t),e.removeItem(t),!0}catch(e){return!1}}()?new Oe:new Te;return"cookie"===o&&de&&Ne(de)&&function(e,t,n){if(t&&Ne(t)){var i=new ye(t);["".concat(n,"_gdp_session_id"),"gdp_user_id_gioenc","".concat(n,"_gdp_cs1_gioenc"),"".concat(n,"_gdp_user_key_gioenc"),"".concat(n,"_gdp_gio_id_gioenc"),"".concat(n,"_gdp_sequence_ids"),"".concat(n,"_gdp_session_id_sent")].forEach((function(t){var n=i.getItem(t);i.hasItem(t)&&(e.setItem(t,n),i.removeItem(t))})),i=void 0}}(t,de,s),t},Pe="OPTION_INITIALIZED",xe="SDK_INITIALIZED",Ae="SESSIONID_UPDATE",De="SET_USERID",Le="SET_USERKEY",Re={name:"gioCompress",method:function(e){var t=this;this.growingIO=e,this._compress=function(e,t,n){if(null===e)return"";var i,r,o,a={},s={},u="",c="",d="",l=2,g=3,f=2,h=[],p=0,v=0;for(o=0;od.charCodeAt(0)){for(i=0;f>i;i++)p<<=1,v===t-1?(v=0,h.push(n(p)),p=0):v++;for(r=d.charCodeAt(0),i=0;8>i;i++)p=p<<1|1&r,v===t-1?(v=0,h.push(n(p)),p=0):v++,r>>=1}else{for(r=1,i=0;f>i;i++)p=p<<1|r,v===t-1?(v=0,h.push(n(p)),p=0):v++,r=0;for(r=d.charCodeAt(0),i=0;16>i;i++)p=p<<1|1&r,v===t-1?(v=0,h.push(n(p)),p=0):v++,r>>=1}0==--l&&(l=Math.pow(2,f),f++),delete s[d]}else for(r=a[d],i=0;f>i;i++)p=p<<1|1&r,v===t-1?(v=0,h.push(n(p)),p=0):v++,r>>=1;0==--l&&(l=Math.pow(2,f),f++),a[c]=g++,d=u+""}if(""!==d){if({}.hasOwnProperty.call(s,d)){if(256>d.charCodeAt(0)){for(i=0;f>i;i++)p<<=1,v===t-1?(v=0,h.push(n(p)),p=0):v++;for(r=d.charCodeAt(0),i=0;8>i;i++)p=p<<1|1&r,v===t-1?(v=0,h.push(n(p)),p=0):v++,r>>=1}else{for(r=1,i=0;f>i;i++)p=p<<1|r,v===t-1?(v=0,h.push(n(p)),p=0):v++,r=0;for(r=d.charCodeAt(0),i=0;16>i;i++)p=p<<1|1&r,v===t-1?(v=0,h.push(n(p)),p=0):v++,r>>=1}0==--l&&(l=Math.pow(2,f),f++),delete s[d]}else for(r=a[d],i=0;f>i;i++)p=p<<1|1&r,v===t-1?(v=0,h.push(n(p)),p=0):v++,r>>=1;0==--l&&(l=Math.pow(2,f),f++)}for(r=2,i=0;f>i;i++)p=p<<1|1&r,v===t-1?(v=0,h.push(n(p)),p=0):v++,r>>=1;for(;;){if(p<<=1,v===t-1){h.push(n(p));break}v++}return h.join("")},this.compress=function(e){var n=t;return t._compress(e,16,(function(e){return n.f(e)}))},this.compressToUTF16=function(e){var n=t;return null===e?"":t._compress(e,15,(function(e){return n.f(e+32)}))+" "},this.compressToUint8Array=function(e){for(var n=t.compress(e),i=new Uint8Array(2*n.length),r=0,o=n.length;o>r;r++){var a=n.charCodeAt(r);i[2*r]=a>>>8,i[2*r+1]=a%256}return i},this.compressToEncodedURIComponent=function(e){if(null===e)return"";var n=t;return t._compress(e,6,(function(e){return n.keyStrUriSafe.charAt(e)}))},this.f=String.fromCharCode,this.keyStrUriSafe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$"}},ke={name:"gioCustomTracking",method:function(e){var t=this;this.growingIO=e,this.getValidResourceItem=function(e){if(e&&N(e)&&e.id&&e.key){var t={id:T(e.id)?e.id:j(e.id),key:T(e.key)?e.key:j(e.key)};return e.attributes&&(t.attributes=e.attributes),t}},this.getDynamicAttributes=function(e){return b(e)||z(e).forEach((function(t){P(e[t])?e[t]=e[t]():N(e[t])?Z(e,t):x(e[t])||(e[t]=j(e[t]))})),e},this.buildCustomEvent=function(e,i,r,o){re(e,(function(){var a=t.growingIO.dataStore,s=a.eventContextBuilder,u=a.eventConverter,c=a.currentPage,d=n({eventType:"CUSTOM",eventName:e,pageShowTimestamp:null==c?void 0:c.time,attributes:ne(t.getDynamicAttributes(N(i)&&!Y(i)?i:void 0)),resourceItem:ne(t.getValidResourceItem(r))},s());Y(o)||(d=n(n({},d),o)),u(d)}))},this.buildUserAttributesEvent=function(e,i){var r=t.growingIO.dataStore,o=r.eventContextBuilder,a=r.eventConverter,s=n({eventType:"LOGIN_USER_ATTRIBUTES",attributes:ne(e)},o());Y(i)||(s=n(n({},s),i)),a(s)}}},Ue={},Ge={}.hasOwnProperty;function qe(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(e){return null}}function He(e){try{return encodeURIComponent(e)}catch(e){return null}}Ue.stringify=function(e,t){t=t||"";var n,i,r=[];for(i in"string"!=typeof t&&(t="?"),e)if(Ge.call(e,i)){if((n=e[i])||null!=n&&!isNaN(n)||(n=""),i=He(i),n=He(n),null===i||null===n)continue;r.push(i+"="+n)}return r.length?t+r.join("&"):""},Ue.parse=function(e){for(var t,n=/([^=?#&]+)=?([^&]*)/g,i={};t=n.exec(e);){var r=qe(t[1]),o=qe(t[2]);null===r||null===o||r in i||(i[r]=o)}return i};var je={gioprojectid:"projectId",giodatacollect:"dataCollect",gioappid:"domain",giodatasourceid:"dataSourceId",gios:"sessionId",giou:"uid",giocs1:"userId",gioid:"gioId",giouserkey:"userKey",gioappchannel:"appChannel",giodevicebrand:"deviceBrand",giodevicemodel:"deviceModel",giodevicetype:"deviceType",giolanguage:"language",gionetworkstate:"networkState",giooperatingsystem:"operatingSystem",gioplatform:"platform",gioplatformversion:"platformVersion",gioscreenheight:"screenHeight",gioscreenwidth:"screenWidth"},Be=["giodatasourceid","gioplatform","gioappchannel","giodevicebrand","giodevicemodel","giodevicetype","giolanguage","gionetworkstate","giooperatingsystem","gioplatformversion","gioscreenheight","gioscreenwidth"],Ke=["giocs1","gios","giou","gioid","giouserkey"],We="gio_search_cookie_gioenc",Ve={name:"gioEmbeddedAdapter",method:function(e){var t=this;this.growingIO=e,this.main=function(){var e,n=t.growingIO.vdsConfig,i=n.projectId,r=n.appId,o=t.getGQS(),a=!1;return"none"!==t.qsFrom&&o.gioprojectid===i&&o.gioappid===r&&(Y(o)?t.growingIO.storage.removeItem(We):t.growingIO.storage.setItem(We,Ue.stringify(o)),F(o,"giodatacollect")&&(t.growingIO.vdsConfig.dataCollect=q(["true",!0],o.giodatacollect)),null===(e=t.growingIO.emitter)||void 0===e||e.on("SDK_INITIALIZED",(function(){var e=t.growingIO,n=e.userStore,i=e.vdsConfig.sessionExpires,r=e.dataStore.eventContextBuilderInst;Ke.forEach((function(e){var t;n[je[e]]=null!==(t=o[e])&&void 0!==t?t:""})),window.setInterval((function(){n.sessionId=o.gios}),.8*i*60*1e3),Be.forEach((function(e){F(o,e)&&(r.minpExtraParams[je[e]]=o[e])}))})),t.growingIO.setUserId=function(){},t.growingIO.clearUserId=function(){},F(o,"giodatacollect")&&(t.growingIO.setDataCollect=function(){},t.growingIO.setOption=function(){}),a=!0),t.gioURLRewrite(),a},this.getGQS=function(){var e=t.growingIO.vdsConfig.hashtag,n=t.growingIO.storage.getItem(We),r=window.location.search,o=window.location.hash,a=e?o.substring(o.indexOf("?")+1):"",s=Ue.parse(r),u=Ue.parse(a),c=Ue.parse((n||"").replace("gioenc-","")),d={};if(F(s,"gioprojectid"))d=s,t.qsFrom="search";else if(F(u,"gioprojectid"))d=u,t.qsFrom="hash";else{if(!F(c,"gioprojectid"))return t.qsFrom="none",{};d=c,t.qsFrom="cookie"}var l={},g={},f=i(i(["gioappid","gioprojectid","giodatacollect"],Ke,!0),Be,!0);return z(d).forEach((function(e){var t=e.toLowerCase();q(f,t)?q(["","undefined","null",void 0,null],d[e])||(l[t]=d[e],q(["true","TRUE",!0],d[e])&&(l[t]=!0),q(["false","FALSE",!1],d[e])&&(l[t]=!1)):g[e]=d[e]})),t.gqs=l,t.ngqs=g,l},this.gioURLRewrite=function(){var e=t.growingIO.vdsConfig.hashtag,n=window.location.search,i=window.location.hash,r=!1;if("search"===t.qsFrom&&(n=Ue.stringify(t.ngqs,!0),r=!0),e&&"hash"===t.qsFrom&&(i="".concat(i.split("?")[0]).concat(Ue.stringify(t.ngqs,!0)),r=!0),r){var o="".concat(window.location.pathname).concat(n||"").concat(i||"");window.history.replaceState(null,document.title,o)}},this.gqs={},this.ngqs={},this.qsFrom="search",this.growingIO.emitter.on(Pe,(function(){t.growingIO.useEmbeddedInherit=t.main()}))}},Me={},Fe={};!function(e){var t=y&&y.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var i,r=0,o=t.length;o>r;r++)!i&&r in t||(i||(i=[].slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||[].slice.call(t))};Object.defineProperty(e,"__esModule",{value:!0}),e.GROWING_TITLE_OLD=e.GROWING_TITLE=e.GROWING_GTITLE=e.GROWING_CDP_INDEX=e.GROWING_INDEX_OLD=e.GROWING_INDEX=e.GROWING_CONTAINER=e.GROWING_TRACK=e.GROWING_IGNORE=e.VALID_CLASS_SELECTOR=e.VALID_ID_SELECTOR=e.EXCLUDE_CLASS_RE=e.UNSUPPORTED_TAGS=e.TEXT_NODE=e.UNSUPPORTED_CLICK_TAGS=e.SUPPORTED_ICON_TAGS=e.SUPPORTED_CHANGE_TYPES=e.SUPPORTED_CLICK_INPUT_TYPES=e.SUPPORTED_CONTAINER_TAGS=e.LIST_TAGS=void 0,e.LIST_TAGS=["TR","LI","DL"],e.SUPPORTED_CONTAINER_TAGS=t(["A","BUTTON"],e.LIST_TAGS,!0),e.SUPPORTED_CLICK_INPUT_TYPES=["button","submit","reset"],e.SUPPORTED_CHANGE_TYPES=["radio","checkbox","search"],e.SUPPORTED_ICON_TAGS=["I","EM","svg","IMG"],e.UNSUPPORTED_CLICK_TAGS=["TEXTAREA","HTML","BODY"],e.TEXT_NODE=["I","SPAN","EM","B","STRONG"],e.UNSUPPORTED_TAGS=["tspan","text","g","rect","path","defs","clippath","desc","title","math","use"],e.EXCLUDE_CLASS_RE=/(^| |[^ ]+\-)(clear|clearfix|active|hover|enabled|current|selected|unselected|hidden|display|focus|disabled|undisabled|open|checked|unchecked|undefined|null|ng-|growing-)[^\. ]*/g,e.VALID_ID_SELECTOR=/^[a-zA-Z-\_][a-zA-Z\-\_0-9]+$/,e.VALID_CLASS_SELECTOR=/^([a-zA-Z\-\_0-9]+)$/,e.GROWING_IGNORE="data-growing-ignore",e.GROWING_TRACK="data-growing-track",e.GROWING_CONTAINER="data-growing-container",e.GROWING_INDEX="data-growing-index",e.GROWING_INDEX_OLD="data-growing-idx",e.GROWING_CDP_INDEX="data-index",e.GROWING_GTITLE="data-growing-title",e.GROWING_TITLE="data-title",e.GROWING_TITLE_OLD="growing-title"}(Fe);var ze={},Xe={};Object.defineProperty(Xe,"__esModule",{value:!0}),Xe.lastFindIndex=Xe.findIndex=Xe.arrayEquals=Xe.rmBlank=Xe.normalizePath=Xe.splitNoEmpty=Xe.filterText=void 0,Xe.filterText=function(e,t){if(void 0===t&&(t=!0),e&&(null==(e=e.replace(/[\n \t]+/g," ").trim())?void 0:e.length))return e.slice(0,t?50:void 0)},Xe.splitNoEmpty=function(e,t){return e?e.split(t).filter((function(e){return!!e})):[]},Xe.normalizePath=function(e){var t=e.length;return t>1&&"/"===e.charAt(t-1)?e.slice(0,t-1):e},Xe.rmBlank=function(e){return e?e.replace(/[\n \t]+/g,""):""},Xe.arrayEquals=function(e,t){if(!e||!t)return!1;if(e.length!==t.length)return!1;for(var n=0,i=e.length;i>n;n++)if(e[n]!==t[n])return!1;return!0},Xe.findIndex=function(e,t){if(null==e||"function"!=typeof t)return-1;for(var n=0;n=0;n--){var i=e[n];if(t.call(void 0,i))return n}return-1},function(e){var t=y&&y.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var i,r=0,o=t.length;o>r;r++)!i&&r in t||(i||(i=[].slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||[].slice.call(t))},n=y&&y.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.removeDiffTagOnHeadAndTail=e.computeXpath=e.getMarkIndex=e.getEffectiveNode=e.isIgnore=e.depthInside=e.changeableInput=e.clickableInput=e.onlyContainsTextChildren=e.onlyContainsIconChildren=e.supportIconTag=e.isContainerTag=e.isListTag=e.isParentOfLeaf=e.isLeaf=e.getChildren=e.getDeepChildren=e.findParent=e.isRootNode=e.hasValidAttribute=void 0;var i=Xe,r=Fe,o=n(O);e.hasValidAttribute=function(e,t){return e instanceof Element&&e.hasAttribute(t)&&"false"!==e.getAttribute(t)},e.isRootNode=function(e){return!e||-1!==["BODY","HTML","#document"].indexOf(e.nodeName)},e.findParent=function(t,n){for(var i=t.parentNode;i&&!(0,e.isRootNode)(i);){if(n(i))return i;i=i.parentNode}},e.getDeepChildren=function(n){return(0,o.default)((null==n?void 0:n.childNodes)||[]).reduce((function(n,i){return i instanceof Element?t(t(t([],n,!0),[i],!1),(0,e.getDeepChildren)(i),!0):n}),[])},e.getChildren=function(e){return(0,o.default)((null==e?void 0:e.childNodes)||[]).filter((function(e){return e instanceof Element}))},e.isLeaf=function(t){return!t.hasChildNodes()||"svg"===t.nodeName||0===(0,e.getChildren)(t).length},e.isParentOfLeaf=function(t){return!(!t.hasChildNodes()||"svg"===t.nodeName)&&0===(0,o.default)(t.childNodes).filter((function(t){return!(0,e.isLeaf)(t)})).length},e.isListTag=function(e){return-1!==r.LIST_TAGS.indexOf(e.nodeName)},e.isContainerTag=function(t){return(0,e.hasValidAttribute)(t,r.GROWING_CONTAINER)||-1!==r.SUPPORTED_CONTAINER_TAGS.indexOf(t.nodeName)},e.supportIconTag=function(e){var t=e.nodeName;return-1!==r.SUPPORTED_ICON_TAGS.indexOf(t)},e.onlyContainsIconChildren=function(t){if(t.textContent)return!1;var n=(0,e.getChildren)(t);if(0===n.length)return!1;for(var i=0,r=n;in)return!1;for(var r="svg"===t.tagName?[]:(0,e.getChildren)(t),o=0;o=i},e.isIgnore=function(t){if(!(t instanceof Element)||(0,e.hasValidAttribute)(t,r.GROWING_IGNORE))return!0;for(var n=t.parentNode;n&&!(0,e.isRootNode)(n);){if((0,e.hasValidAttribute)(n,r.GROWING_IGNORE))return!0;n=n.parentNode}return!1},e.getEffectiveNode=function(t){for(var n,i;t&&(i=void 0,!((n=t)instanceof Element&&-1===r.UNSUPPORTED_TAGS.indexOf(null===(i=n.tagName)||void 0===i?void 0:i.toLowerCase())))&&t.parentNode;)t=t.parentNode;var o,a=t.parentNode;return!(0,e.isRootNode)(a)&&((0,e.onlyContainsIconChildren)(a)||"BUTTON"===(o=a).tagName&&(0,e.onlyContainsTextChildren)(o))?a:t},e.getMarkIndex=function(e){if(e instanceof Element){var t=e.getAttribute(r.GROWING_INDEX)||e.getAttribute(r.GROWING_INDEX_OLD)||e.getAttribute(r.GROWING_CDP_INDEX);if(t){if(/^\d{1,10}$/.test(t)&&+t>=0&&2147483647>+t)return+t;window.console.error("[GioNode]:标记的index不符合规范(index必须是大于等于0且小于2147483647的整数字)。",t)}}},e.computeXpath=function(e){for(var t=e.parentPaths(!0),n=Math.min(t.length,+(t.length>=10)+4),i=["","",""],r=0;rr&&(i[1]=o+i[1])}return i},e.removeDiffTagOnHeadAndTail=function(e,t){var n=function(e){return e.nodeName===t.nodeName},r=(0,i.findIndex)(e,n),o=(0,i.lastFindIndex)(e,n);return-1===r||-1===o?[]:e.slice(r,o+1)}}(ze);var Je={},Ze={};Object.defineProperty(Ze,"__esModule",{value:!0});var Ye=Fe,Qe=Xe,$e=ze;function et(e){var t;if(e instanceof Element){var n=e.getAttribute("name");if(n)return[n];if(e.hasAttribute("class")){var i=null===(t=e.getAttribute("class"))||void 0===t?void 0:t.replace(Ye.EXCLUDE_CLASS_RE,"").trim();if(null==i?void 0:i.length)return i.split(/\s+/).filter((function(e){return Ye.VALID_CLASS_SELECTOR.test(e)&&!e.match(/[a-z][A-Z][a-z][A-Z]/)&&!e.match(/[0-9][0-9][0-9][0-9]/)})).sort()}}return[]}var tt=function(){function e(e){var t;this.node=e,this.tagName=this.node.nodeName,this.name=this.tagName.toLowerCase(),this.id=(t=this.node).id&&Ye.VALID_ID_SELECTOR.test(t.id)?t.id:null,this.classList=et(this.node),this.guessListAndIndex()}return e.prototype.guessListAndIndex=function(){var e,t=this;this._tagList=(0,$e.isListTag)(this.node);var n=(0,$e.removeDiffTagOnHeadAndTail)((0,$e.getChildren)(this.node.parentNode),this.node);if(this._tagList&&-1!==(o=n.filter((function(e){return e.tagName===t.tagName})).indexOf(this.node))&&(this._index=o+1),n.length>=3&&(null===(e=this.classList)||void 0===e?void 0:e.length)){for(var i=0,r=0,o=1;o<=n.length;o++){var a=n[o-1];if(a.tagName!==this.tagName){r=0;break}(0,Qe.arrayEquals)(this.classList,et(a))&&(r+=1),this.node===a&&(i=o)}3>r||(this._pseudoList=!0,this._index=this._index||i)}},Object.defineProperty(e.prototype,"path",{get:function(){var e;return this._path||(this._path="/".concat(this.name),this.id&&(this._path+="#".concat(this.id)),(null===(e=this.classList)||void 0===e?void 0:e.length)&&(this._path+=".".concat(this.classList.join(".")))),this._path},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pseudoList",{get:function(){return!!this._pseudoList},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"list",{get:function(){return!!this._tagList||!!this._pseudoList},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"index",{get:function(){var e;return null!==(e=(0,$e.getMarkIndex)(this.node))&&void 0!==e?e:this._index},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"container",{get:function(){return(0,$e.isContainerTag)(this.node)||this.list},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"parent",{get:function(){return this.node.parentNode?new e(this.node.parentNode):null},enumerable:!1,configurable:!0}),e.prototype.parentPaths=function(e){void 0===e&&(e=!1);for(var t=e?[this]:[],n=this.parent;n&&!(0,$e.isRootNode)(n.node);)t.push(n),n=n.parent;return t},e}();Ze.default=tt;var nt={};Object.defineProperty(nt,"__esModule",{value:!0}),nt.getElementHref=nt.getImgHref=nt.getAnchorHref=void 0;var it=Xe;function rt(e){if(e.hasAttribute("href")){var t=e.getAttribute("href");if(t&&0!==t.indexOf("javascript"))return(0,it.normalizePath)(t.slice(0,320))}}function ot(e){if(e.src&&-1===e.src.indexOf("data:image"))return e.src}nt.getAnchorHref=rt,nt.getImgHref=ot,nt.getElementHref=function(e){var t=e;if(t)switch(e.nodeName.toLowerCase()){case"a":return rt(t);case"img":return ot(t)}};var at={},st=y&&y.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(at,"__esModule",{value:!0}),at.getElementContent=at.getFormContent=void 0;var ut=ze,ct=nt,dt=Fe,lt=st(Ze),gt=Xe,ft=st(O),ht=function(e){return e.htmlFor||e.getAttribute("for")},pt=function(e){var t=e.getAttribute(dt.GROWING_GTITLE)||e.getAttribute(dt.GROWING_TITLE)||e.getAttribute(dt.GROWING_TITLE_OLD)||e.getAttribute("title");return null==t?void 0:t.trim()};function vt(e){var t=e.node;return e.list?mt(t):(0,gt.filterText)(t.textContent)||void 0}function mt(e){for(var t=void 0,n=!1,i=0,r=(0,ft.default)(e.childNodes);i-1?n.slice(0,i):n}}(t);case"svg":return function(e){for(var t=0,n=(0,ft.default)(e.childNodes);t0)return n[n.length-1]}}(t);case"label":return vt(a);case"input":return function(e){if((0,ut.clickableInput)(e))return e.value;if("password"!==e.type&&(0,ut.hasValidAttribute)(e,dt.GROWING_TRACK))return e.value;if((0,ut.changeableInput)(e)){var t=(0,ut.findParent)(e,(function(e){return"LABEL"===e.nodeName}));if(!t&&e.id)for(var n=document.body.getElementsByTagName("label"),i=0;i0)return o+" ("+e.checked+")"}return e.value}}(t);case"select":return i=t,(0,ft.default)(i.options).filter((function(e){return e.selected})).map((function(e){return e.label})).join(", ")||i.value;case"form":return It(t)}return(0,ut.isLeaf)(t)?function(e){var t=(0,gt.filterText)(e.textContent);if(t)return t}(t):(0,ut.isParentOfLeaf)(t)&&!(0,ut.onlyContainsIconChildren)(t)?function(e){for(var t="",n=0,i=(0,ft.default)(e.childNodes);nn;n++)for(var r in t=arguments[n])({}).hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},Nt.apply(this,arguments)},Ct=y&&y.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Me,"__esModule",{value:!0});var Pt,xt,At=Fe,Dt=ze,Lt=Ct(Je),Rt=function(){function e(e,t,n){void 0===t&&(t=null),void 0===n&&(n=!0),this.origin=e,this.action=t,this.direct=n,this.target="self"===t?e:(0,Dt.getEffectiveNode)(e),this.ignore=(0,Dt.isIgnore)(this.target),this.vnode=new Lt.default(this.target),this.tagName=this.vnode.tagName}return Object.defineProperty(e.prototype,"content",{get:function(){return this.vnode.content},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"href",{get:function(){return this.vnode.href},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"index",{get:function(){return this.vnode.index},enumerable:!1,configurable:!0}),e.prototype.inferParentIndex=function(){var t=this;return this.parentIndex||(0,Dt.findParent)(this.target,(function(n){var i=new e(n,t.action,!1);i.traceable()&&i.index&&(t.parentIndex=i.index)})),this.parentIndex},Object.defineProperty(e.prototype,"xpath",{get:function(){return this.vnode.xpath},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fullXpath",{get:function(){return this.vnode.fullXpath},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"skeleton",{get:function(){return this.vnode.skeleton},enumerable:!1,configurable:!0}),e.prototype.info=function(e){return void 0===e&&(e=!0),e&&this.inferParentIndex(),{skeleton:this.skeleton,fullXpath:this.fullXpath,xpath:this.xpath,content:this.content,href:this.href,index:this.parentIndex||this.index}},e.prototype.traceable=function(){if(this.ignore)return!1;if(this.direct){if("click"===this.action||"hover"===this.action){if(-1!==At.UNSUPPORTED_CLICK_TAGS.indexOf(this.target.tagName))return!1;if("INPUT"===this.target.tagName&&!(0,Dt.clickableInput)(this.target))return!1;if(!(0,Dt.isContainerTag)(this.target)&&!(0,Dt.depthInside)(this.target,5))return!1}return!0}return this.vnode.container},e.prototype.trackNodes=function(){if(!this.traceable())return[];var e=[this];if("submit"!==this.action)for(var t=this.parentElement;t;){if(t.ignore)return[];t.traceable()&&e.unshift(t),t=t.parentElement}var n=void 0;return e.map((function(e){var t=e.info(!1),i=t.index;return!n&&i&&(n=i),Nt(Nt({},t),{index:n||i})}))},Object.defineProperty(e.prototype,"parentElement",{get:function(){var t=this.target.parentNode;if(t&&t.nodeName&&!(0,Dt.isRootNode)(t))return new e(t,this.action,!1)},enumerable:!1,configurable:!0}),e}(),kt=Me.default=Rt,Ut=function(){function e(e){this.handler=e;var t=navigator.userAgent,n=/chrome/i.exec(t),i=/android/i.exec(t);this.hasTouch="ontouchstart"in window&&!(n&&!i)}return e.prototype.main=function(){for(var e=this.hasTouch?["touchstart"]:["mousedown"],t=this.hasTouch?["touchend","touchcancel"]:["mouseup","mouseleave"],n=this.hasTouch?["touchmove"]:["mousemove"],i=0,r=e;r.length>i;i++)ie(window,r[i],this.touchStartHandler.bind(this));for(var o=0,a=n;a.length>o;o++)ie(window,a[o],this.touchMoveHandler.bind(this));for(var s=0,u=t;u.length>s;s++)ie(window,u[s],this.touchStopHandler.bind(this))},e.prototype.touchStartHandler=function(e){if(1>=e.which){var t=+Date.now();this.safeguard!==t&&(this.touchTimeout&&clearTimeout(this.touchTimeout),this.safeguard=t,this.touchEvent={time:t,target:e.target,x:this._page("x",e),y:this._page("y",e),isTrusted:!0,type:"click"})}},e.prototype.touchMoveHandler=function(e){var t=Math.abs(this._page("x",e)-(this.touchEvent&&this.touchEvent.x)||0),n=Math.abs(this._page("y",e)-(this.touchEvent&&this.touchEvent.y)||0);(t>10||n>10)&&(this.touchEvent=null)},e.prototype.touchStopHandler=function(e){var t=this,n=+Date.now()-(this.touchEvent&&this.touchEvent.time)||0;this.touchEvent&&200>n?this.touchTimeout=setTimeout((function(){t.handler(t.touchEvent),t.touchEvent=null}),200):this.touchEvent&&n>=200&&700>n&&(this.handler(this.touchEvent),this.touchEvent=null)},e.prototype._page=function(e,t){return(this.hasTouch?t.touches[0]:t)["page".concat(e.toUpperCase())]},e}(),Gt={name:"gioEventAutoTracking",method:function(e){var t=this;this.growingIO=e,this.main=function(){ie(document,"submit",t._handleAction),ie(document,"change",t._handleAction),t.growingIO.vdsConfig.touch?new Ut(t._handleAction).main():ie(document,"click",t._handleAction)},this._handleAction=function(e,i){var r=t.growingIO,o=r.vdsConfig,a=r.emitter;if(!o.autotrack)return!1;var s=e.target;if(!s)return!1;var u=new kt(s,e.type,!0).trackNodes();if("click"!==e.type&&(u=Y(L(u))?[]:[L(u)]),Y(u))return!1;null==a||a.emit("onComposeBefore",{event:i,params:null!=e?e:{}}),u.forEach((function(i){var r=i.fullXpath,a=i.index,s=i.content,u=i.href;if(!W(i.fullXpath||"","/div#__vconsole")&&!W(i.fullXpath||"","/div#__giokit")&&(o.debug&&console.log("Action:",e.type,Date.now()),r)){var c=t.growingIO.dataStore,d=c.eventContextBuilder,l=c.eventConverter,g=c.currentPage;l(n(n({eventType:w[e.type],element:[{xpath:r,index:a,textValue:s,hyperlink:u}]},d()),{pageShowTimestamp:g.time}))}}))}}},qt=["VIEW_CLICK","VIEW_CHANGE","FORM_SUBMIT","PAGE","CUSTOM","LOGIN_USER_ATTRIBUTES"],Ht=["LOGIN_USER_ATTRIBUTES"],jt={name:"gioHybridAdapter",method:function(e){var t=this;this.growingIO=e,this.penetrateHybrid=!0,this.onOptionsInit=function(){var e=t.growingIO,n=e.vdsConfig,i=e.emitter;S(n.penetrateHybrid)&&(t.penetrateHybrid=n.penetrateHybrid),t._initHybridBridge()&&(t.onSendBefore=t.sendBeforeListener,t.hybridConfig.projectId===t.growingIO.vdsConfig.projectId&&(t.growingIO.useHybridInherit=!0)),t.growingIO.useHybridInherit&&(null==i||i.on(De,(function(e){var n=e.newUserId,i=e.oldUserId,r=e.userKey;t.penetrateHybrid&&(!n&&i?r?t._clearNativeUserIdAndUserKey():t._clearNativeUserId():r?t._setNativeUserIdAndUserKey(j(n),j(r)):t._setNativeUserId(j(n)))})),null==i||i.on(Le,(function(e){var n=e.newUserKey,i=e.oldUserKey,r=e.userId;t.penetrateHybrid&&(!n&&i?t._clearNativeUserIdAndUserKey():t._setNativeUserIdAndUserKey(j(r),j(n)))})))},this._initHybridBridge=function(){var e,n,i,r=!1;return t.hasHybridBridge=!!window.GrowingWebViewJavascriptBridge,t.hasHybridBridge?((null===(e=null===window||void 0===window?void 0:window.GrowingWebViewJavascriptBridge)||void 0===e?void 0:e.configuration)||(window.GrowingWebViewJavascriptBridge.configuration=JSON.parse(window.GrowingWebViewJavascriptBridge.getConfiguration())),(null===(n=null===window||void 0===window?void 0:window.GrowingWebViewJavascriptBridge)||void 0===n?void 0:n.configuration)&&(t.hybridConfig=null===(i=null===window||void 0===window?void 0:window.GrowingWebViewJavascriptBridge)||void 0===i?void 0:i.configuration),r=!0):Pt.consoleText("gioHybridAdapter:当前不存在 GrowingWebViewJavascriptBridge,Web模式。","info"),r},this.sendBeforeListener=function(e){var i=e.requestData;if(t.hasHybridBridge){var r=t.processAttributes(n({},i));q(qt,r.eventType)&&(q(Ht,r.eventType)?t.penetrateHybrid&&t._dispatchEvent(r):(t.penetrateHybrid||Z(r,["userId","userKey","cs1"]),t._dispatchEvent(r)))}},this.processAttributes=function(e){return X(e,(function(t,n){N(t)||x(t)?X(e[n],(function(t,i){N(t)||x(t)?e[n][i]=JSON.stringify(t):e[n][i]=j(t)})):e[n]=j(t)})),e},this._setNativeUserId=function(e){te((function(){return window.GrowingWebViewJavascriptBridge.setNativeUserId(e)}))},this._clearNativeUserId=function(){te((function(){return window.GrowingWebViewJavascriptBridge.clearNativeUserId()}))},this._setNativeUserIdAndUserKey=function(e,t){te((function(){return window.GrowingWebViewJavascriptBridge.setNativeUserIdAndUserKey(e,t)}))},this._clearNativeUserIdAndUserKey=function(){te((function(){return window.GrowingWebViewJavascriptBridge.clearNativeUserIdAndUserKey()}))},this._dispatchEvent=function(e){te((function(){var t;return null===(t=window.GrowingWebViewJavascriptBridge)||void 0===t?void 0:t.dispatchEvent(JSON.stringify(e))}))};var i=this.growingIO,r=i.emitter,o=i.utils;Pt=o,r.on(Pe,this.onOptionsInit)}},Bt=["i","span","em","b","strong","svg"];!function(e){e[e.OUTER=0]="OUTER",e[e.INNER_COVERED=1]="INNER_COVERED",e[e.INNER_SHOW=2]="INNER_SHOW"}(xt||(xt={}));var Kt,Wt=i(["HR","BR","SCRIPT","NOSCRIPT","STYLE","HEAD","BASE","LINK","META","TITLE","BODY","HTML","TEMPLATE","CODE"],Fe.UNSUPPORTED_CLICK_TAGS,!0),Vt=["SELECT","A","BUTTON","INPUT","IMG","FORM"],Mt=function(e,t,n){return document.elementFromPoint(t,n)===e},Ft=function(){function e(e,t,n){this.node=e,this.parentNodeDesc=t,this.devicesInfo=n,this.proxy=new kt(e),this.tagName=this.node.tagName,this.name=this.tagName.toLowerCase(),this.isIgnore=!!this.node.dataset.growingIgnore,this.isUnSupported=-1!==Wt.indexOf(this.tagName),this.rect=this.computeWindowRect()}return e.prototype.info=function(){var e=this.desc();e.zLevel+=this.devicesInfo.webviewZLevel;var t=this.getDeviceRect(this.rect);return Z(e,"isContainer"),n(n(n({},e),t),{parentXPath:this.parentNodeDesc.isContainer?this.parentNodeDesc.xpath:void 0,href:this.proxy.href,content:this.proxy.content,nodeType:this.nodeType()})},e.prototype.nodeType=function(){return"input"!==this.name||ze.changeableInput(this.node)?this.node.tagName:"INPUT_BTN"},e.prototype.desc=function(){return{index:this.parentNodeDesc.index||this.proxy.index,zLevel:this.zLevel(),xpath:this.proxy.xpath,isContainer:this.isDefinedContainer()}},e.prototype.cssVisible=function(){var e=this.computedStyle();return Number(e.opacity)>0&&"visible"===e.visibility&&"none"!==e.display},e.prototype.viewportStatus=function(){var e=this.rect,t=e.top,n=e.left,i=e.width,r=e.height,o=this.devicesInfo,a=o.winWidth,s=o.winHeight;if(0>=i||0>=r)return xt.OUTER;var u=this.node;return s>t&&a>n&&i>0&&r>0?Mt(u,n+i/2,t+r/2)||Mt(u,n+1,t+1)||Mt(u,n+i-1,t+1)||Mt(u,n+1,t+r-1)||Mt(u,n+i-1,t+r-1)?xt.INNER_SHOW:xt.INNER_COVERED:xt.OUTER},e.prototype.isCircleable=function(){return this.proxy.target===this.proxy.origin&&(!!this.isDefinedContainer()||!("input"===this.name&&this.node instanceof HTMLInputElement&&"password"===this.node.type)&&(-1!==Vt.indexOf(this.name)||(ze.isLeaf(this.node)?!this.isBigBlank():this.hasBackgroundImage()&&ze.depthInside(this.node,4))))},e.prototype.isSimpleContainer=function(){return"select"===this.name||this.isDefaultContainer()&&(function(e,t){if(0===e.children.length)return!1;for(var n=0,i=H(e.children);n0)for(var n=0;ns>>1||o>u>>1)},e.prototype.hasBackgroundImage=function(){var e=this.computedStyle().backgroundImage;return!!e&&"none"!==e&&e.length>0},e.prototype.zLevel=function(){var e=this.computedStyle(),t=e.zIndex;if("auto"!==t)return Number(t||"0")+this.parentNodeDesc.zLevel;switch(e.position){case"relative":return this.parentNodeDesc.zLevel+2;case"sticky":return this.parentNodeDesc.zLevel+3;case"absolute":return this.parentNodeDesc.zLevel+4;case"fixed":return this.parentNodeDesc.zLevel+5;default:return this.parentNodeDesc.zLevel+1}},e.prototype.computeWindowRect=function(){if(this.rect)return this.rect;var e=this.node.getBoundingClientRect(),t=e.top,n=e.bottom,i=e.left,r=e.right-i,o=n-t;return 0>t?o=t+o:t+o>this.devicesInfo.winHeight&&(o=this.devicesInfo.winHeight-t),0>i?r=i+r:i+r>this.devicesInfo.winWidth&&(r=this.devicesInfo.winWidth-i),this.rect={top:t,left:i,width:r,height:o},this.rect},e.prototype.computedStyle=function(){return window.getComputedStyle(this.node)},e.prototype.getDeviceRect=function(e){var t=this.devicesInfo,n=t.scale,i=t.webviewTop,r=t.webviewLeft;return{top:e.top*n+i,left:e.left*n+r,width:e.width*n,height:e.height*n}},e}(),zt=["DOMContentLoaded","onreadystatechange"],Xt=["scroll","resize","load","beforeunload","popstate","hashchange","pagehide","unload"],Jt=function(){function e(e){this.growingIO=e,this.addDomChangeListener()}return e.prototype.getDomTree=function(e,t,n,i,r,o){var a=function(e,t,n,i,r){var o=document.documentElement.clientWidth;return{winWidth:o,winHeight:document.documentElement.clientHeight,scale:n/o,webviewTop:t,webviewLeft:e,webviewWidth:n,webviewHeight:i,webviewZLevel:r}}(e,t,n,i,r),s=this.getElementsByParent(o||document.body,{isContainer:!1,zLevel:0},a),u=this.growingIO.dataStore.currentPage;return{page:{domain:u.domain,path:u.path,query:u.query,title:u.title},elements:s}},e.prototype.getElementsByParent=function(e,t,n){var i=this,r=[];return[].slice.call(e.childNodes,0).filter((function(e){return 1===e.nodeType})).forEach((function(e){var o=new Ft(e,t,n);if(o.cssVisible()&&!o.isIgnore){switch(o.viewportStatus()){case xt.INNER_SHOW:o.isCircleable()&&r.push(o.info());break;case xt.INNER_COVERED:o.isDefaultContainer()&&r.push(o.info())}o.isSimpleContainer()||[].push.apply(r,i.getElementsByParent(e,o.desc(),n))}})),r},e.prototype.addDomChangeListener=function(){var e,t=function(t){return void 0===t&&(t=""),function(){var n;"beforeunload"===t&&e&&e.disconnect(),null===(n=window.GrowingWebViewJavascriptBridge)||void 0===n||n.onDomChanged()}};(e=new MutationObserver(t("mutation"))).observe(document.body,{attributes:!0,characterData:!0,childList:!0,subtree:!0}),zt.forEach((function(e){ie(document,e,t(e))})),Xt.forEach((function(e){ie(window,e,t(e))}))},e}(),Zt={name:"gioHybridCircle",method:function(){function e(t){var n,i=this;this.growingIO=t,null===(n=this.growingIO.emitter)||void 0===n||n.on(xe,(function(){if(window.GrowingWebViewJavascriptBridge){var t=i;window.GrowingWebViewJavascriptBridge.getDomTree=function(){if(arguments.length>=4)return e.bindGetDomTree(t.growingIO),e.domHelper.getDomTree.apply(e.domHelper,arguments)}}}))}return e.bindGetDomTree=function(e){this.domHelper||(this.domHelper=new Jt(e),window.GrowingWebViewJavascriptBridge.getDomTree=this.domHelper.getDomTree.bind(this.domHelper))},e}()},Yt={name:"gioImpressionTracking",method:function(e){var t,n=this;this.growingIO=e,this.documentReady=!1,this.main=function(e){"listener"===e?(n.documentReady=!0,n.growingIO.gioSDKInitialized&&n.initMutationObserver()):"emitter"===e&&n.documentReady&&n.initMutationObserver()},this.initIntersectionObserver=function(){n.intersectionObserver=new IntersectionObserver((function(e){Y(e)||e.map((function(e){var t=e.target,i=t.dataset,r=t.id;if(e.intersectionRatio>0){var o=n.getImpressionProperties(i),a=o.eventId,s=o.properties,u=o.items;if(r){if("once"===i.gioImpType&&F(n.sentImps,r))return;n.sentImps[r]={eventId:a,properties:s,items:u}}a&&n.growingIO.track(a,s,u)}}))}))},this.initMutationObserver=function(){var e;n.mutationObserver&&(null===(e=n.mutationObserver)||void 0===e||e.disconnect());var t=document.querySelectorAll("[data-gio-imp-track]");H(t).map((function(e){var t;null===(t=n.intersectionObserver)||void 0===t||t.observe(e)})),n.mutationObserver=new MutationObserver((function(e){e.map((function(e){var t,i;"attributes"===e.type&&(null===(t=e.target.dataset)||void 0===t?void 0:t.gioImpTrack)&&(null===(i=n.intersectionObserver)||void 0===i||i.observe(e.target))}))})),n.mutationObserver.observe(document.body,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0,attributeFilter:["data-gio-imp-track","data-gio-imp-attrs","data-gio-imp-items",/^data-gio-track-[a-z]+$/i]})},this.getImpressionProperties=function(e){var t={eventId:void 0,properties:{}};if(!(null==e?void 0:e.gioImpTrack))return t;if(t.eventId=e.gioImpTrack,F(e,"gioImpAttrs"))t.properties=te((function(){return N(e.gioImpAttrs)?e.gioImpAttrs:JSON.parse(e.gioImpAttrs)})),t.items=te((function(){return N(e.gioImpItems)?e.gioImpItems:JSON.parse(e.gioImpItems)}));else{var n=/^gioTrack(.+)/;for(var i in e){var r=void 0,o=i.match(n);o&&"track"!==(r=K(o[1]))&&(t.properties[r]=e[i])}}return t.properties=ne(t.properties),t.items=ne(t.items),/^\w+$/.test(t.eventId)&&!Number.isInteger(Number(D(t.eventId.split(""))))||(t.eventId=null,t={}),t},this.sentImps={},window.IntersectionObserver&&window.MutationObserver?(this.initIntersectionObserver(),ie(document,"readystatechange",(function(){q(["interactive","complete"],document.readyState)&&n.main("listener")}),{once:!0}),null===(t=this.growingIO.emitter)||void 0===t||t.on(xe,(function(){return n.main("emitter")})),ie(window,"unload",(function(){var e,t;null===(e=n.intersectionObserver)||void 0===e||e.disconnect(),null===(t=n.mutationObserver)||void 0===t||t.disconnect()}))):ee("当前浏览器不支持半自动埋点,gioImpressionTracking已自动关闭!","warn")}},Qt={name:"gioWebCircle",method:function(e){var t,n=this;this.growingIO=e,this.injectCircle=function(e,t){var n=document.createElement("link"),i=document.createElement("script");n.rel="stylesheet",n.href=e,i.src=t,document.head.appendChild(n),document.head.appendChild(i)},null===(t=this.growingIO.emitter)||void 0===t||t.on(xe,(function(){window.addEventListener("message",(function(e){var t=e.data,i=e.source,r=window.vds;if(t&&i){var o=i.vds,a=t.cssURL,s=t.jsURL;o&&"SDK_INJECT_CIRCLE_SCRIPT"===t.type&&r.projectId===o.projectId&&r.dataSourceId===o.dataSourceId&&n.injectCircle(a,s)}}))}))}},$t=["gioPerformance"],en=function(e){function n(t){var n=e.call(this,t)||this;return n.growingIO=t,n.growingIO.gioSDKFull=!0,n.pluginsContext={plugins:{gioCompress:Re,gioCustomTracking:ke,gioEmbeddedAdapter:Ve,gioEventAutoTracking:Gt,gioHybridAdapter:jt,gioHybridCircle:Zt,gioImpressionTracking:Yt,gioWebCircle:Qt}},n}return t(n,e),n}((function(e){var t,n,i,r,o=this;this.growingIO=e,this.innerPluginInit=function(){var e;$t.forEach((function(e){var t;return Z(null===(t=o.pluginsContext)||void 0===t?void 0:t.plugins,e)})),z(null===(e=o.pluginsContext)||void 0===e?void 0:e.plugins).forEach((function(e){var t,n=null===(t=o.pluginsContext)||void 0===t?void 0:t.plugins[e],i=n.name,r=n.method;U(o.pluginItems,(function(e){return e.name===i}))||o.pluginItems.push({name:K(i||e),method:r||function(e){}})})),Y(o.pluginItems)||o.installAll()},this.install=function(e,t,n){var i,r,a=t||U(o.pluginItems,(function(t){return t.name===e}));if((null===(i=o.growingIO)||void 0===i?void 0:i.plugins)[e])return ee("重复加载插件 ".concat(e," 或插件重名,已跳过加载!"),"warn"),!1;if(!a)return ee("插件加载失败!不存在名为 ".concat(e," 的插件!"),"error"),!1;try{return(null===(r=o.growingIO)||void 0===r?void 0:r.plugins)[e]=new a.method(o.growingIO,n),"cdp"===o.growingIO.gioEnvironment&&t&&ee("加载插件 ".concat(e),"info"),!0}catch(e){return ee("插件加载异常 ".concat(e),"error"),!1}},this.installAll=function(e){(e||o.pluginItems).forEach((function(t){o.install(t.name,e?t:void 0,e?null==t?void 0:t.options:void 0)&&!U(o.pluginItems,(function(e){return e.name===t.name}))&&o.pluginItems.push({name:K(t.name),method:t.method?t.method:function(){}})}))},this.uninstall=function(e){var t;Z(o.pluginItems,e);var n=Z(null===(t=o.growingIO)||void 0===t?void 0:t.plugins,e);return n||ee("卸载插件 ".concat(e," 失败!"),"error"),n},this.uninstallAll=function(){o.pluginItems.forEach((function(e){return o.uninstall(e.name)}))},this.lifeError=function(e,t){return ee("插件执行错误 ".concat(e.name," ").concat(t),"error")},this.onComposeBefore=function(e){o.pluginItems.forEach((function(t){var n,i=null===(n=o.growingIO.plugins[t.name])||void 0===n?void 0:n.onComposeBefore;if(i&&P(i))try{i(e)}catch(e){o.lifeError(t,e)}}))},this.onComposeAfter=function(e){o.pluginItems.forEach((function(t){var n,i=null===(n=o.growingIO.plugins[t.name])||void 0===n?void 0:n.onComposeAfter;if(i&&P(i))try{i(e)}catch(e){o.lifeError(t,e)}}))},this.onSendBefore=function(e){o.pluginItems.forEach((function(t){var n,i=null===(n=o.growingIO.plugins[t.name])||void 0===n?void 0:n.onSendBefore;if(i&&P(i))try{i(e)}catch(e){o.lifeError(t,e)}}))},this.onSendAfter=function(e){o.pluginItems.forEach((function(t){var n,i=null===(n=o.growingIO.plugins[t.name])||void 0===n?void 0:n.onSendAfter;if(i&&P(i))try{i(e)}catch(e){o.lifeError(t,e)}}))},this.pluginsContext={plugins:{}},this.pluginItems=[],null===(t=this.growingIO.emitter)||void 0===t||t.on("onComposeBefore",this.onComposeBefore),null===(n=this.growingIO.emitter)||void 0===n||n.on("onComposeAfter",this.onComposeAfter),null===(i=this.growingIO.emitter)||void 0===i||i.on("onSendBefore",this.onSendBefore),null===(r=this.growingIO.emitter)||void 0===r||r.on("onSendAfter",this.onSendAfter)})),tn=function(){function e(e){this.growingIO=e;var t=this.growingIO.vdsConfig.projectId,n=this.growingIO.storage,i=n.getItem,r=n.setItem,o=n.getKeys,a=n.removeItem;this.getItem=i,this.setItem=r,this.getKeys=o,this.removeItem=a,this.sIdStorageName="".concat(t,"_gdp_session_id"),this.uidStorageName="gdp_user_id_gioenc",this.userIdStorageName="".concat(t,"_gdp_cs1_gioenc"),this.userKeyStorageName="".concat(t,"_gdp_user_key_gioenc"),this.gioIdStorageName="".concat(t,"_gdp_gio_id_gioenc")}return Object.defineProperty(e.prototype,"sessionId",{get:function(){return this.getItem(this.sIdStorageName)||(this.sessionId=ge(),this.sessionId)},set:function(e){var t,n=this;e||(e=ge());var i=this.getItem(this.sIdStorageName)||this.prevSessionId,r=this.growingIO.vdsConfig.sessionExpires,o=void 0===r?30:r;this.setItem(this.sIdStorageName,e,+Date.now()+60*o*1e3),i!==e&&(this.getKeys().filter((function(e){return/.+_gdp_session_id_.{36}/.test(e)})).forEach((function(e){n.removeItem(e)})),this.setItem(this.growingIO.dataStore.visitStorageName,""),null===(t=this.growingIO.emitter)||void 0===t||t.emit(Ae,{newSessionId:e,oldSessionId:i})),this.prevSessionId=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"uid",{get:function(){return this.getItem(this.uidStorageName)||(this.uid=ge(),this.uid)},set:function(e){var t,n=this.getItem(this.uidStorageName)||this.prevUId;this.setItem(this.uidStorageName,e),n!==e&&(null===(t=this.growingIO.emitter)||void 0===t||t.emit("UID_UPDATE",{newUId:e,oldUId:n})),this.prevUId=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"userId",{get:function(){return this.getItem(this.userIdStorageName)||""},set:function(e){var t,n,i=this.getItem(this.userIdStorageName)||this.prevUserId;this.setItem(this.userIdStorageName,e),null===(t=this.growingIO.emitter)||void 0===t||t.emit(De,{newUserId:e,oldUserId:i,userKey:this.userKey}),i!==e&&(null===(n=this.growingIO.emitter)||void 0===n||n.emit("USERID_UPDATE",{newUserId:e,oldUserId:i,userKey:this.userKey})),e&&(this.gioId=e),this.prevUserId=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"userKey",{get:function(){return this.getItem(this.userKeyStorageName)||""},set:function(e){var t,n,i=this.getItem(this.userKeyStorageName)||this.prevUserKey;this.setItem(this.userKeyStorageName,e),null===(t=this.growingIO.emitter)||void 0===t||t.emit(Le,{newUserKey:e,oldUserKey:i,userId:this.userId}),i!==e&&(null===(n=this.growingIO.emitter)||void 0===n||n.emit("USERKEY_UPDATE",{newUserKey:e,oldUserKey:i,userId:this.userId})),this.prevUserKey=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"gioId",{get:function(){return this.getItem(this.gioIdStorageName)||""},set:function(e){var t,n=this.getItem(this.gioIdStorageName)||this.prevGioId;this.setItem(this.gioIdStorageName,e),n!==e&&(null===(t=this.growingIO.emitter)||void 0===t||t.emit("GIOID_UPDATE",{newGioId:e,oldGioId:n})),this.prevGioId=e},enumerable:!1,configurable:!0}),e}(),nn=function(e){var t=this;this.growingIO=e,this.main=function(){var e,i,r=t.growingIO,o=r.sdkVersion,a=r.useEmbeddedInherit,s=r.vdsConfig,u=r.userStore,c=r.dataStore,d=r.trackingId,l=c.currentPage,g=l.path,f=l.query,h={appVersion:s.version,dataSourceId:s.dataSourceId,deviceId:u.uid,domain:a?s.appId:window.location.host,gioId:u.gioId,language:navigator.language,path:g,platform:s.platform,query:f,referralPage:(null===(e=c.lastPageEvent)||void 0===e?void 0:e.referralPage)||"",screenHeight:window.screen.height,screenWidth:window.screen.width,sdkVersion:o,sessionId:u.sessionId,timestamp:+Date.now(),title:null!==(i=te((function(){return document.title.slice(0,255)})))&&void 0!==i?i:"",userId:u.userId};if(s.enableIdMapping&&(h.userKey=u.userKey),Y(s.ignoreFields)||s.ignoreFields.forEach((function(e){Z(h,e)})),a&&!Y(t.minpExtraParams)){var p=n({},h);X(n(n({},h),t.minpExtraParams),(function(e,n){var i;q(s.embeddedIgnore,n)?(h[n]=p[n],"domain"===n&&(h[n]=window.location.host)):h[n]=null!==(i=t.minpExtraParams[n])&&void 0!==i?i:h[n]}))}return h.trackingId=d,h},this.minpExtraParams={}},rn=function(e){var t=this;this.growingIO=e,this.parsePage=function(){var e=t.growingIO.vdsConfig.hashtag,n=location.pathname,i=location.search,r=location.hash,o=r.indexOf("?");t.domain=window.location.host,t.title=document.title.slice(0,255),t.time=+Date.now(),t.path=n,t.query=i,e&&(o>-1?(t.path+=r.slice(0,o),t.query=t.query+"&"+r.slice(o+1)):t.path+=r),t.query&&q(["?","&"],t.query.charAt(0))&&(t.query=t.query.slice(1))},this._getNoHashHref=function(){var e=window.location,t=e.protocol,n=e.host,i=e.pathname,r=e.search;return"".concat(t,"://").concat(n).concat(i).concat(r)},this.getReferralPage=function(){var e,n,i=t.growingIO.dataStore.lastPageEvent;return(null==i?void 0:i.path)===t.path&&(null!==(e=null==i?void 0:i.query)&&void 0!==e?e:"")===(null!==(n=t.query)&&void 0!==n?n:"")?null==i?void 0:i.referralPage:(null==i?void 0:i.path)?t.lastHref:document.referrer},this.pageListener=function(){var e=t.growingIO.vdsConfig.hashtag,n=window.location.href,i=t.lastHref;e||(n=t._getNoHashHref(),i=t.lastNoHashHref),i!==n&&(t.parsePage(),t.buildPageEvent())},this.hookHistory=function(){var e=window.history.pushState,n=window.history.replaceState,i=t;e&&te((function(){return window.history.pushState=function(){e.apply(window.history,arguments),setTimeout(i.pageListener)}})),n&&te((function(){return window.history.replaceState=function(){n.apply(window.history,arguments),setTimeout(i.pageListener)}})),ie(window,"popstate",t.pageListener),t.growingIO.vdsConfig.hashtag&&ie(window,"hashchange",t.pageListener)},this.buildPageEvent=function(e){var i=t.growingIO.dataStore;i.lastPageEvent;var r=i.eventContextBuilder,o=i.eventConverter,a=n(n({eventType:"PAGE"},r()),{protocolType:location.protocol.substring(0,location.protocol.length-1),referralPage:t.getReferralPage()});Y(e)||(a=n(n({},a),e)),a.timestamp=t.time,o(a),t.lastHref=window.location.href,t.lastNoHashHref=t._getNoHashHref(),t.lastLocation=n({},window.location)},this.title=document.title.slice(0,255),this.lastLocation=n({},window.location)},on={referralPage:document.referrer},an=function(){function e(e){var t,i,u,c=this;this.growingIO=e,this.ALLOW_SETTING=n(n({},o),"saas"===this.growingIO.gioEnvironment?s:a),this.allowOptKeys=Object.keys(this.ALLOW_SETTING),this.trackTimers={},this.setSequenceIds=function(e,t){var i=c.growingIO.storage.getItem(c.seqStorageIdName)||{};"gsid"===e?i.globalKey=t:i=n(n({},i),t),c.growingIO.storage.setItem(c.seqStorageIdName,i)},this.initOptions=function(e){var t,i,o,a,s,u,d,l=e.projectId,g=e.dataSourceId,f=e.appId;c.initialDataSourceId=g;var h={};c.allowOptKeys.forEach((function(t){var n=c.ALLOW_SETTING[t].type,i=x(n)?!q(n,Q(e[t])):Q(e[t])!==n;"platform"!==t||q(r,e[t])||(i=!0),i?h[t]=c.ALLOW_SETTING[t].default:"ignoreFields"===t?h.ignoreFields=e.ignoreFields.filter((function(e){return q(I,e)})):(h[t]=e[t],q(["dataCollect","autotrack"],t)&&(h[t]||ee("已关闭".concat(v[t]),"info")))})),h.sessionExpires=Math.round(h.sessionExpires),(E(h.sessionExpires)||1>h.sessionExpires||h.sessionExpires>360)&&(h.sessionExpires=30),h.storageType=h.storageType.toLowerCase(),h.sendType=h.sendType.toLowerCase(),q(["beacon","xhr","image"],h.sendType)||(h.sendType="beacon"),!E(Number(h.requestTimeout))&&h.requestTimeout>0||(h.requestTimeout=5e3),c.growingIO.vdsConfig=n(n(n({},null!==(t=window.vds)&&void 0!==t?t:{}),h),{projectId:l,dataSourceId:g,appId:f,performance:{monitor:null===(o=null===(i=h.performance)||void 0===i?void 0:i.monitor)||void 0===o||o,exception:null===(s=null===(a=h.performance)||void 0===a?void 0:a.exception)||void 0===s||s,network:null!==(d=null===(u=h.performance)||void 0===u?void 0:u.network)&&void 0!==d&&d}}),window.vds=c.growingIO.vdsConfig,c.seqStorageIdName="".concat(l,"_gdp_sequence_ids"),c.visitStorageName="".concat(l,"_gdp_session_id_sent")},this.setOption=function(e,t){var i,r=c.growingIO,o=r.vdsConfig,a=r.callError,s=r.uploader,u=r.emitter,d=T(e)&&q(p,e),l=d&&typeof t===((null===(i=c.ALLOW_SETTING[e])||void 0===i?void 0:i.type)||"string"),g=n({},o);return d&&l?(o[e]=t,"dataCollect"===e&&g.dataCollect!==t&&(t?(c.sendVisit(!0),c.sendPage()):c.growingIO.clearTrackTimer()),q(["host","scheme"],e)&&(null==s||s.generateHost()),null==u||u.emit("OPTION_CHANGE",{optionName:e,optionValue:t}),window.vds[e]=t,!0):(a("setOption > ".concat(e)),!1)},this.getOption=function(e){var t=c.growingIO,i=t.vdsConfig,r=t.callError;return e&&F(i,j(e))?i[j(e)]:b(e)?n({},i):void r("getOption > ".concat(e))},this.sendVisit=function(e){var t=c.growingIO,n=t.userStore.sessionId,i=t.storage.getItem(c.visitStorageName);!e&&n===i||(c.lastVisitEvent.timestamp=c.currentPage.time-1,c.buildVisitEvent())},this.buildVisitEvent=function(e){var t=c.growingIO,i=t.dataStore,r=i.eventContextBuilder,o=i.eventConverter,a=t.emitter,s=t.storage,u=t.userStore,d=c.lastVisitEvent,l=d.referralPage,g=d.title,f=d.path,h=d.query,p=d.timestamp,v=n(n({eventType:"VISIT"},r()),{referralPage:l||c.currentPage.getReferralPage(),timestamp:p});f&&(v.title=g,v.path=f,v.query=h),Y(e)||(v.session=(null==e?void 0:e.session)||v.session,v.trackingId=null==e?void 0:e.trackingId,v=n(n({},v),e));var m=function(e){var t=e.requestData;"VISIT"===t.eventType&&t.trackingId===c.growingIO.trackingId&&(u.sessionId===t.sessionId&&s.setItem(c.visitStorageName,t.sessionId),a.off("onSendAfter",m))};a.on("onSendAfter",m),o(v)},this.sendPage=function(e){e&&c.currentPage.parsePage(),c.currentPage.buildPageEvent()},this.buildErrorEvent=function(e){var t=c.growingIO.dataStore,i=t.eventContextBuilder;(0,t.eventConverter)(n({eventType:"CUSTOM",pageShowTimestamp:c.currentPage.time,eventName:"onError",attributes:e},i()))},this.currentPage=new rn(this.growingIO),this.eventContextBuilderInst=new nn(this.growingIO),this.eventContextBuilder=this.eventContextBuilderInst.main,this.generalProps={},this.lastVisitEvent=on,null===(t=this.growingIO.emitter)||void 0===t||t.on("onComposeAfter",(function(e){var t=e.composedEvent;"VISIT"!==t.eventType&&"vst"!==t.t||t.trackingId!==c.growingIO.trackingId||(c.lastVisitEvent=t)})),this.lastPageEvent={},null===(i=this.growingIO.emitter)||void 0===i||i.on("onComposeAfter",(function(e){var t=e.composedEvent;"PAGE"!==t.eventType&&"page"!==t.t||t.trackingId!==c.growingIO.trackingId||(c.lastPageEvent=t)})),null===(u=this.growingIO.emitter)||void 0===u||u.on(Ae,(function(){if(c.growingIO.gioSDKInitialized){c.currentPage.parsePage();var e=c.currentPage,t=e.title,n=e.path,i=e.query,r=e.time,o=e.getReferralPage;c.lastVisitEvent={referralPage:document.referrer||o(),title:t,path:n,query:i,timestamp:r-1},c.sendVisit(!0),c.sendPage(!0)}}))}return Object.defineProperty(e.prototype,"esid",{get:function(){var e=this,t=this.growingIO.storage.getItem(this.seqStorageIdName)||{},i=n({},t);return Z(i,"globalKey"),i=N(i)&&!b(i)?i:{},this._esid={},z(i).forEach((function(t){e._esid[t]=E(Number(i[t]))||i[t]>=1e9||1>i[t]?1:i[t]})),this._esid},set:function(e){var t={};z(e).forEach((function(n){t[n]=E(e[n])||e[n]>=1e9||1>e[n]?1:e[n]})),J(this._esid,t)||(this._esid=t,this.setSequenceIds("esid",this._esid))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"gsid",{get:function(){var e=this.growingIO.storage.getItem(this.seqStorageIdName)||{},t=Number(e.globalKey);return this._gsid=E(t)||t>=1e9||1>t?1:t,this._gsid},set:function(e){E(Number(e))||e>=1e9||1>e?this._gsid=1:this._gsid=e,this.setSequenceIds("gsid",this._gsid)},enumerable:!1,configurable:!0}),e}(),sn=function(e){function i(t){var i=e.call(this,t)||this;return i.growingIO=t,i.eventConverter=function(e){var t,r,o=i.growingIO,a=o.vdsConfig,s=o.dataStore,u=o.uploader;if(a.dataCollect){e.trackingId===i.growingIO.trackingId&&(e.globalSequenceId=s.gsid,e.eventSequenceId=s.esid[e.eventType]||1);var c={};X(e,(function(e,t){var n;if("element"===t){var i=null!==(n=D(e))&&void 0!==n?n:{};X(i,(function(e,t){Y(e)&&0!==e||(c[t]=e)}))}else(Y(e)||b(e))&&0!==e||(c[t]=e)})),e.trackingId===i.growingIO.trackingId&&(i.growingIO.dataStore.gsid+=1,i.growingIO.dataStore.esid=n(n({},i.growingIO.dataStore.esid),((t={})[c.eventType]=(i.growingIO.dataStore.esid[c.eventType]||1)+1,t))),null===(r=i.growingIO.emitter)||void 0===r||r.emit("onComposeAfter",{composedEvent:n({},c)}),e.trackingId===i.growingIO.trackingId&&u.commitRequest(c)}else"VISIT"===e.eventType&&(i.lastVisitEvent=e)},i}return t(i,e),i}(an),un=function(e){function n(t){var n=e.call(this,t)||this;return n.growingIO=t,n.generateHost=function(){var e=n.growingIO.vdsConfig,t=e.scheme,i=e.host,r=void 0===i?"":i,o=e.projectId;t?V(j(t),"://")||(t="".concat(t,"://")):t="".concat(location.protocol.indexOf("http")>-1?location.protocol.replace(":",""):"https","//"),W(r,"http")&&(r=r.substring(r.indexOf("://")+(V(j(t),"://")?3:0))),n.requestURL="".concat(t).concat(r,"/v3/projects/").concat(o,"/collect")},n.requestURL="",n.generateHost(),n}return t(n,e),n}((function(e){var t=this;this.growingIO=e,this.getSendType=function(){var e=t.growingIO.vdsConfig.sendType;return"beacon"===e?function(){var e,t,n=!!(null===(e=null===window||void 0===window?void 0:window.navigator)||void 0===e?void 0:e.sendBeacon),i=window.navigator.userAgent;if(i.match(/(iPad|iPhone|iPod)/g)){var r=!(t=i.toLowerCase().match(/cpu.*os (.*?) like mac os/i))||2>t.length?0:+t[1].split("_").slice(0,2).join(".");return n&&r>13}return n}()?"beacon":"xhr":e},this.commitRequest=function(e){var i=n({},e);t.requestQueue.push(n(n({},i),{requestType:t.getSendType()})),t.initiateRequest()},this.initiateRequest=function(){var e,r,o;if(i([],t.requestQueue,!0).length>0&&t.requestingNum0?j(n).slice(0,1e3):""),t.userStore.userId=j(e).slice(0,1e3),i&&i!==t.userStore.userId&&(t.userStore.sessionId="")}else t.clearUserId(),t.callError("setUserId")},t.clearUserId=function(){t.userStore.userId="",t.userStore.userKey=""},t.track=function(e,i,r,o){var a,s;((null===(s=null===(a=t.plugins)||void 0===a?void 0:a.gioCustomTracking)||void 0===s?void 0:s.buildCustomEvent)||function(){})(e,n(n({},t.dataStore.generalProps),N(i)&&!Y(i)?i:{}),r,o)},t.sendPage=function(e){return t.dataStore.currentPage.buildPageEvent(e)},t.sendVisit=function(e){return t.dataStore.buildVisitEvent(e)},t.trackTimerStart=function(e,n){t.vdsConfig.dataCollect&&re(e,(function(){var i=ge();P(n)?(t.dataStore.trackTimers[i]={eventName:e,leng:0,start:+Date.now()},n(i)):ee("回调方法不合法,返回timerId失败!")}))},t.trackTimerPause=function(e){if(e&&t.dataStore.trackTimers[e]){var n=t.dataStore.trackTimers[e];n.start&&(n.leng=n.leng+(+Date.now()-n.start)),n.start=0}},t.trackTimerResume=function(e){if(e&&t.dataStore.trackTimers[e]){var n=t.dataStore.trackTimers[e];0===n.start&&(n.start=+Date.now())}},t.trackTimerEnd=function(e,i){if(t.vdsConfig.dataCollect)if(e&&t.dataStore.trackTimers[e]){var r=t.dataStore.trackTimers[e];if(0!==r.start){var o=+Date.now()-r.start;r.leng=o>0?r.leng+o:0}t.track(r.eventName,n(n({},i),{event_duration:r.leng>864e5?0:r.leng/1e3})),t.removeTimer(e)}else ee("未查找到对应的计时器,请检查!","error")},t.removeTimer=function(e){e&&t.dataStore.trackTimers[e]&&delete t.dataStore.trackTimers[e]},t.clearTrackTimer=function(){t.dataStore.trackTimers={}},t.dataStore=new sn(t),t}return t(i,e),i}((function(){var e,t=this;this.trackingId="g0",this.init=function(e){var n,i,r,o,a;ee("Gio Web SDK 初始化中...","info");var s=t.dataStore,u=s.initOptions,c=s.currentPage,d=s.sendVisit,l=s.sendPage;u(e),t.storage=Ce(t.vdsConfig),t.initCallback(),null===(n=t.emitter)||void 0===n||n.emit(Pe,t),null===(r=null===(i=t.plugins)||void 0===i?void 0:i.gioEventAutoTracking)||void 0===r||r.main(),c.hookHistory(),c.parsePage(),null===(o=t.emitter)||void 0===o||o.emit(xe,t),ee("Gio Web SDK 初始化完成!","success"),t.useEmbeddedInherit||(t.dataStore.lastVisitEvent.timestamp=c.time,d()),l(),t.gioSDKInitialized=!0,t.vdsConfig.gioSDKInitialized=!0,window[t.vds]=t.vdsConfig,null===(a=t.emitter)||void 0===a||a.emit("SDK_INITIALIZED_COMPLATE",t)},this.setOption=function(e,n){if(q(p,e)){var i=t.dataStore.setOption(e,n);return i&&v[e]&&ee("已".concat(n?"开启":"关闭").concat(v[e]),"info"),i}return ee("不存在可修改的配置项:".concat(e,",请检查后重试!"),"warn"),!1},this.getOption=function(e){return t.dataStore.getOption(e)},this.setGeneralProps=function(e){N(e)&&!Y(e)?(t.dataStore.generalProps=n(n({},t.dataStore.generalProps),e),z(t.dataStore.generalProps).forEach((function(e){q([void 0,null],t.dataStore.generalProps[e])&&(t.dataStore.generalProps[e]="")}))):t.callError("setGeneralProps")},this.clearGeneralProps=function(e){x(e)&&!Y(e)?e.forEach((function(e){Z(t.dataStore.generalProps,e)})):t.dataStore.generalProps={}},this.reissuePage=function(){t.dataStore.sendPage()},this.notRecommended=function(){return ee("不推荐的方法使用,建议使用 gio('setOption', [optionName], [value])!","info")},this.callError=function(e,t,n){return void 0===t&&(t=!0),void 0===n&&(n="参数不合法"),ee("".concat(t?"调用":"设置"," ").concat(e," 失败,").concat(n,"!"),"warn")},this.updateImpression=function(){var e,n,i=null===(n=null===(e=t.plugins)||void 0===e?void 0:e.gioImpressionTracking)||void 0===n?void 0:n.main;i?i("emitter"):ee("updateImpression 错误! 请集成半自动埋点浏览插件后重试!","error")},this.gioEnvironment="cdp",this.sdkVersion="3.8.6",this.vds=window.gioCompatibilityVds?"gdp_vds":"vds",this.utils=n(n({},$),oe),this.emitter={all:e=e||new Map,on:function(t,n){var i=e.get(t);i?i.push(n):e.set(t,[n])},off:function(t,n){var i=e.get(t);i&&(n?i.splice(i.indexOf(n)>>>0,1):e.set(t,[]))},emit:function(t,n){var i=e.get(t);i&&i.slice().map((function(e){e(n)})),(i=e.get("*"))&&i.slice().map((function(e){e(t,n)}))}},this.useEmbeddedInherit=!1,this.useHybridInherit=!1,this.gioSDKInitialized=!1,this.plugins=new en(this),this.plugins.innerPluginInit()}));!function(){var e,t,i,r,o,a=window.gioCompatibilityVds?"gdp_vds":"vds";if(null===(e=window[a])||void 0===e?void 0:e.gioSDKInstalled)return Kt=window.gdp,void ee("SDK重复加载,请检查是否重复加载SDK或接入其他平台SDK导致冲突!","warn");window[a]=n(n({},null!==(t=window[a])&&void 0!==t?t:{}),{gioSDKInstalled:!0});var s=new cn;Kt=function(){var e,t=arguments[0];if(T(t)&&q(h,t)&&s[t]){var i=R(H(arguments));if("init"===t){var r=function(e){var t;return e.vdsConfig||e.gioSDKInitialized||(null===(t=window.vds)||void 0===t?void 0:t.gioSDKInitialized)?(ee("SDK重复初始化,请检查是否重复加载SDK或接入其他平台SDK导致冲突!","warn"),!1):!(q(["","localhost","127.0.0.1"],location.hostname)&&!window._gr_ignore_local_rule&&(ee("当前SDK不允许在本地环境初始化!","warn"),1))}(s);if(!r)return;var o=function(e){return!Y(k(e))||(ee('SDK初始化失败,请使用 gdp("init", "您的GrowingIO项目 accountId", "您项目的 dataSourceId", options); 进行初始化!',"error"),!1)}(i);if(!o)return;var u=function(e){var t=D(e),n=L(e);return ae(j(t).trim())?(N(n)&&n||(n={}),{projectId:t,userOptions:n}):(ee("SDK初始化失败,accountId 参数不合法!","error"),!1)}(i);if(!u)return;var c=function(e){var t=e[1],n=e[2],i=L(e);return t&&T(t)?{dataSourceId:t,appId:T(n)?n:"",cdpOptions:i}:(ee("SDK初始化失败,dataSourceId 参数不合法!","error"),!1)}(i);if(!c)return;var d=u.projectId,l=c.dataSourceId,g=c.appId,f=c.cdpOptions;s.init(n(n({},f),{projectId:d,dataSourceId:l,appId:g}))}else if("registerPlugins"===t)s.registerPlugins(i[0]);else{if(s.gioSDKInitialized&&s.vdsConfig)return s[t].apply(s,i);s.emitter.emit("UNINITIALIZED_CALL",arguments),ee("SDK未初始化!","error")}}else q(m,t)?ee("方法 ".concat(j(t)," 已被弃用,请移除!"),"warn"):ee("不存在名为 ".concat(j(t)," 的方法调用!"),"error");window[a]=n(n({},window[a]),{_gr_ignore_local_rule:null!==(e=window._gr_ignore_local_rule)&&void 0!==e&&e,gioEnvironment:"cdp",gioSDKVersion:s.sdkVersion,gioSDKFull:s.gioSDKFull,canIUse:function(e){return q(h,e)&&s[e]}})};var u=null===(i=null===window||void 0===window?void 0:window.gdp)||void 0===i?void 0:i.q,c=null===(r=null===window||void 0===window?void 0:window.gdp)||void 0===r?void 0:r.e,d=null===(o=null===window||void 0===window?void 0:window.gdp)||void 0===o?void 0:o.ef;window.gdp=Kt,window.gdp.e=c,window.gdp.ef=d,x(u)&&!Y(u)&&u.forEach((function(e){Kt.apply(null,e)}))}();var dn=Kt;export{dn as default}; +var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)({}).hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};function t(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+n+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}var n=function(){return n=Object.assign||function(e){for(var t,n=1,i=arguments.length;i>n;n++)for(var r in t=arguments[n])({}).hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},n.apply(this,arguments)};function i(e,t,n){if(n||2===arguments.length)for(var i,r=0,o=t.length;o>r;r++)!i&&r in t||(i||(i=[].slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||[].slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var r=["web","wxwv","minp","alip","baidup","qq","bytedance"],o={autotrack:{type:"boolean",default:!0},compress:{type:"boolean",default:!0},dataCollect:{type:"boolean",default:!0},debug:{type:"boolean",default:!1},hashtag:{type:"boolean",default:!1},touch:{type:"boolean",default:!1},version:{type:"string",default:"1.0.0"},platform:{type:"string",default:"web"},cookieDomain:{type:"string",default:""},sendType:{type:"string",default:"beacon"}},a={enableIdMapping:{type:"boolean",default:!1},gtouchHost:{type:"string",default:""},host:{type:"string",default:"napi.growingio.com"},ignoreFields:{type:"array",default:[]},penetrateHybrid:{type:"boolean",default:!0},scheme:{type:"string",default:location.protocol.indexOf("http")>-1?location.protocol.replace(":",""):"https"},sessionExpires:{type:"number",default:30},performance:{type:"object",default:{monitor:!0,exception:!0}},embeddedIgnore:{type:"array",default:[]},storageType:{type:"string",default:"cookie"},requestTimeout:{type:"number",default:5e3}},s={},u=["clearUserId","getGioInfo","getLocation","getOption","init","setDataCollect","setOption","setUserId","track","setGeneralProps","clearGeneralProps"];i(i([],u,!0),["setEvar","setPage","setUser","setVisitor"],!1);var c,d,l,g,f,h=i(i([],u,!0),["enableDebug","enableHT","setAutotrack","setTrackerHost","setTrackerScheme","setUserAttributes","getVisitorId","getDeviceId","registerPlugins","getPlugins","sendPage","sendVisit","trackTimerStart","trackTimerPause","trackTimerResume","trackTimerEnd","removeTimer","clearTrackTimer","updateImpression"],!1),p=["autotrack","dataCollect","dataSourceId","debug","host","hashtag","scheme"],v={autotrack:"无埋点采集",dataCollect:"数据采集",debug:"调试模式"},m=["send","setConfig","collectImp","setPlatformProfile"],I=["screenHeight","screenWidth"],w={click:"VIEW_CLICK",change:"VIEW_CHANGE",submit:"FORM_SUBMIT"},y="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},O="function"==typeof Array.from?Array.from:(d||(d=1,l=function(e){return"function"==typeof e},g=function(e){var t=function(e){var t=Number(e);return isNaN(t)?0:0!==t&&isFinite(t)?(t>0?1:-1)*Math.floor(Math.abs(t)):t}(e);return Math.min(Math.max(t,0),9007199254740991)},f=function(e){var t=e.next();return!t.done&&t},c=function(e){var t,n,i,r=this,o=arguments.length>1?arguments[1]:void 0;if(void 0!==o){if(!l(o))throw new TypeError("Array.from: when provided, the second argument must be a function");arguments.length>2&&(t=arguments[2])}var a=function(e,t){if(null!=e&&null!=t){var n=e[t];if(null==n)return;if(!l(n))throw new TypeError(n+" is not a function");return n}}(e,function(e){if(null!=e){if(["string","number","boolean","symbol"].indexOf(typeof e)>-1)return Symbol.iterator;if("undefined"!=typeof Symbol&&"iterator"in Symbol&&Symbol.iterator in e)return Symbol.iterator;if("@@iterator"in e)return"@@iterator"}}(e));if(void 0!==a){n=l(r)?Object(new r):[];var s,u,c=a.call(e);if(null==c)throw new TypeError("Array.from requires an array-like or iterable object");for(i=0;;){if(!(s=f(c)))return n.length=i,n;u=s.value,n[i]=o?o.call(t,u,i):u,i++}}else{var d=Object(e);if(null==e)throw new TypeError("Array.from requires an array-like object - not null or undefined");var h,p=g(d.length);for(n=l(r)?Object(new r(p)):Array(p),i=0;p>i;)h=d[i],n[i]=o?o.call(t,h,i):h,i++;n.length=p}return n}),c),b=function(e){return q(["undefined","null"],Q(e))},T=function(e){return"string"===Q(e)},_=function(e){return"number"===Q(e)},E=function(e){return"NaN"===j(Number(e))},S=function(e){return"boolean"===Q(e)},N=function(e){return"object"===Q(e)&&!b(e)},C=function(e){return"regexp"===Q(e)},P=function(e){return q(["function","asyncfunction"],Q(e))},x=function(e){return Array.isArray(e)&&"array"===Q(e)},A=function(e){return"date"===Q(e)},D=function(e){try{return H(e)[0]}catch(e){return}},L=function(e){try{var t=H(e);return t[t.length-1]}catch(e){return}},R=function(e,t){return void 0===t&&(t=1),x(e)&&_(t)?e.slice(t>0?t:1,e.length):e},k=function(e){if(x(e)){for(var t=0,n=[],i=0,r=e;i=0},H=O,j=function(e){return b(e)?"":"".concat(e)},B=function(e,t){return"string"==typeof e?e.split(t):e},K=function(e){if(T(e)){var t=B(e,"");return"".concat(D(t).toLowerCase()).concat(R(t).join(""))}return e},W=function(e,t){return!!T(e)&&e.slice(0,t.length)===t},V=function(e,t){if(T(e)){var n=e.length,i=n;i>n&&(i=n);var r=i;return(i-=t.length)>=0&&e.slice(i,r)===t}return!1},M={}.hasOwnProperty,F=function(e,t){return!b(e)&&M.call(e,t)},z=function(e){return N(e)?Object.keys(e):[]},X=function(e,t){z(e).forEach((function(n){return t(e[n],n)}))},J=function(e,t){var n=z(e);return!(!N(e)||!N(t)||n.length!==z(t).length||q(n.map((function(n,i){return N(e[n])?J(e[n],t[n]):e[n]===t[n]})),!1))},Z=function(e,t){if(!N(e))return!1;try{return"string"===Q(t)?delete e[t]:"array"===Q(t)?t.map((function(t){return delete e[t]})):(C(t)&&z(e).forEach((function(n){t.test(n)&&Z(e,n)})),!0)}catch(e){return!1}},Y=function(e){return x(e)?0===e.length:N(e)?0===z(e).length:!e},Q=function(e){return{}.toString.call(e).slice(8,-1).toLowerCase()},$=Object.freeze({__proto__:null,isNil:b,isString:T,isNumber:_,isNaN:E,isBoolean:S,isObject:N,isRegExp:C,isFunction:P,isArray:x,isDate:A,fixed:function(e,t){return _(e)?Number(e.toFixed(_(t)?t:2)):T(e)&&"NaN"!==j(Number(e))?Number(Number(e).toFixed(_(t)?t:2)):e},head:D,last:L,drop:R,dropWhile:function(e,t){return x(e)?e.filter((function(e){return!t(e)})):e},compact:k,find:U,findIndex:G,includes:q,arrayFrom:H,toString:j,split:B,lowerFirst:K,upperFirst:function(e){if(T(e)){var t=B(e,"");return"".concat(D(t).toUpperCase()).concat(R(t).join(""))}return e},startsWith:W,endsWith:V,has:F,keys:z,forEach:X,isEqual:J,get:function(e,t,n){var i=e;return N(e)?(t.split(".").forEach((function(e){i=i?i[e]:n})),i):n},unset:Z,isEmpty:Y,typeOf:Q,formatDate:function(e){if(A(e)){var t=function(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())}return e}}),ee=function(e,t){console.log("%c [GrowingIO]:".concat(e),{info:"color: #3B82F6;",error:"color: #EF4444;",warn:"color: #F59E0B;",success:"color: #10B981;"}[t]||"")},te=function(e){try{return e()}catch(e){return}},ne=function(e){var t={};return N(e)&&X(e,(function(e,n){var i,r=j(n).slice(0,100);N(e)?t[r]=ne(e):x(e)?(t[r]=e.slice(0,100),"cdp"===(null===(i=window.vds)||void 0===i?void 0:i.gioEnvironment)&&(t[r]=t[r].join("||").slice(0,1e3))):t[r]=b(e)?"":j(e).slice(0,1e3)})),t},ie=function(e,t,i,r){void 0===r&&(r={}),document.addEventListener?e.addEventListener(t,i,n(n({},{capture:!0}),r)):e.attachEvent?e.attachEvent("on"+t,i):e["on"+t]=i},re=function(e,t){return T(e)&&!Y(e)&&e.match(/^[a-zA-Z_][0-9a-zA-Z_]{0,100}$/)?t():(ee("事件名格式不正确,只能包含数字、字母和下划线,且不能以数字开头,字符总长度不能超过100!","error"),!1)},oe=Object.freeze({__proto__:null,consoleText:ee,niceTry:te,limitObject:ne,addListener:ie,flattenObject:function(e){void 0===e&&(e={});var t=n({},e);return z(t).forEach((function(e){N(t[e])?(z(t[e]).forEach((function(n){t["".concat(e,"_").concat(n)]=j(t[e][n])})),Z(t,e)):x(t[e])?(t[e].forEach((function(n,i){N(n)?z(n).forEach((function(r){t["".concat(e,"_").concat(i,"_").concat(r)]=j(n[r])})):t["".concat(e,"_").concat(i)]=j(n)})),Z(t,e)):b(t[e])||""===t[e]?Z(t,e):t[e]=j(t[e])})),ne(t)},eventNameValidate:re,getGioFunction:function(){var e,t,n,i,r=window._gio_local_vds||"vds",o=null!==(t=null===(e=window[r])||void 0===e?void 0:e.namespace)&&void 0!==t?t:"gdp";return P(window[o])?window[o]:null!==(i=null!==(n=window.gdp)&&void 0!==n?n:window.gio)&&void 0!==i?i:function(){}}}),ae=function(e){return T(e)&&e.length>0||_(e)&&e>0},se=/^((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})(\.((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})){3}/i,ue=/^(https?:\/\/)|(([a-zA-Z0-9_-])+(\.)?)*(:\d+)?(\/((\.)?(\?)?=?&?[a-zA-Z0-9_-](\?)?)*)*$/i;function ce(e){for(var t=1;arguments.length>t;t++){var n=arguments[t];for(var i in n)e[i]=n[i]}return e}var de,le=function e(t,n){function i(e,i,r){if("undefined"!=typeof document){"number"==typeof(r=ce({},n,r)).expires&&(r.expires=new Date(Date.now()+864e5*r.expires)),r.expires&&(r.expires=r.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var o="";for(var a in r)r[a]&&(o+="; "+a,!0!==r[a]&&(o+="="+r[a].split(";")[0]));return document.cookie=e+"="+t.write(i,e)+o}}return Object.create({set:i,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var n=document.cookie?document.cookie.split("; "):[],i={},r=0;r+Date.now()?he(me(t.value)):void 0},this.setItem=function(e,t,n){var i=null!=n?n:+new Date(9999,12);localStorage.setItem(fe(e),JSON.stringify({value:T(t)&&t.length&&V(e,"_gioenc")?ve(t):t,expiredAt:i}))},this.removeItem=function(e){return localStorage.removeItem(fe(e))},this.hasItem=function(e){return!!localStorage.getItem(fe(e))},this.getKeys=function(){return H(Array(localStorage.length)).map((function(e,t){return localStorage.key(t)}))},this.type="localStorage"},be={},Te=function(){this.getItem=function(e){var t=te((function(){return JSON.parse(be[fe(e)]||"")}));return N(t)&&t.expiredAt>+Date.now()?he(me(t.value)):void 0},this.setItem=function(e,t,n){var i=null!=n?n:+new Date(9999,12);be[fe(e)]=JSON.stringify({value:T(t)&&t.length?ve(t):t,expiredAt:i})},this.removeItem=function(e){return Z(be,fe(e))},this.hasItem=function(e){return F(be,fe(e))},this.getKeys=function(){return z(be)},this.type="memory"},_e=/^(\.ac\.|\.br\.|\.co\.|\.com\.|\.edu\.|\.gov\.|\.org\.|\.net\.)/,Ee=function(e){var t=[];try{var n=e.split("."),i=L(n);if(n.length>=2&&(isNaN(Number(i))||0>Number(i)||Number(i)>255)){var r=".".concat(n.slice(-2).join("."));_e.test(r)?de=r:t.push(r);var o=".".concat(n.slice(-3).join("."));_e.test(o)||q(t,o)||t.push(o);var a=".".concat(n.slice(-4).join("."));_e.test(a)||q(t,a)||t.push(a)}}catch(e){}return t},Se=function(e){var t="";return e.every((function(e){return!Ne(e)||(t=e,!1)})),t},Ne=function(e){try{le.set("gioCookie","yes",{domain:e});var t=!!le.get("gioCookie",{domain:e});return le.remove("gioCookie",{domain:e}),t}catch(e){return!1}},Ce=function(e){var t,n,r,o=e.storageType,a=e.cookieDomain,s=e.projectId;if(q(["cookie","localstorage"],o)||(o="cookie"),"cookie"===o&&(n=!!(r=navigator.userAgent.indexOf("Electron")>-1||q(["","localhost","127.0.0.1"],window.location.hostname)||!q(["http:","https:"],window.location.protocol)?"":Se(i(i([],Ee(window.location.hostname),!0),[window.location.hostname],!1)))),"cookie"===o&&n){var u=new ye(r);if(a){var c=Ee(a),d=Se(Y(c)?[]:i([a],Ee(a),!0));d&&Ne(d)?u.domain=d:ee("指定Cookie域无效或无权限,使用默认域!","warn")}t=u}else t=function(){try{var e=window.localStorage,t="__storage_test__";return e.setItem(t,t),e.removeItem(t),!0}catch(e){return!1}}()?new Oe:new Te;return"cookie"===o&&de&&Ne(de)&&function(e,t,n){if(t&&Ne(t)){var i=new ye(t);["".concat(n,"_gdp_session_id"),"gdp_user_id_gioenc","".concat(n,"_gdp_cs1_gioenc"),"".concat(n,"_gdp_user_key_gioenc"),"".concat(n,"_gdp_gio_id_gioenc"),"".concat(n,"_gdp_sequence_ids"),"".concat(n,"_gdp_session_id_sent")].forEach((function(t){var n=i.getItem(t);i.hasItem(t)&&(e.setItem(t,n),i.removeItem(t))})),i=void 0}}(t,de,s),t},Pe="OPTION_INITIALIZED",xe="SDK_INITIALIZED",Ae="SESSIONID_UPDATE",De="SET_USERID",Le="SET_USERKEY",Re={name:"gioCompress",method:function(e){var t=this;this.growingIO=e,this._compress=function(e,t,n){if(null===e)return"";var i,r,o,a={},s={},u="",c="",d="",l=2,g=3,f=2,h=[],p=0,v=0;for(o=0;od.charCodeAt(0)){for(i=0;f>i;i++)p<<=1,v===t-1?(v=0,h.push(n(p)),p=0):v++;for(r=d.charCodeAt(0),i=0;8>i;i++)p=p<<1|1&r,v===t-1?(v=0,h.push(n(p)),p=0):v++,r>>=1}else{for(r=1,i=0;f>i;i++)p=p<<1|r,v===t-1?(v=0,h.push(n(p)),p=0):v++,r=0;for(r=d.charCodeAt(0),i=0;16>i;i++)p=p<<1|1&r,v===t-1?(v=0,h.push(n(p)),p=0):v++,r>>=1}0==--l&&(l=Math.pow(2,f),f++),delete s[d]}else for(r=a[d],i=0;f>i;i++)p=p<<1|1&r,v===t-1?(v=0,h.push(n(p)),p=0):v++,r>>=1;0==--l&&(l=Math.pow(2,f),f++),a[c]=g++,d=u+""}if(""!==d){if({}.hasOwnProperty.call(s,d)){if(256>d.charCodeAt(0)){for(i=0;f>i;i++)p<<=1,v===t-1?(v=0,h.push(n(p)),p=0):v++;for(r=d.charCodeAt(0),i=0;8>i;i++)p=p<<1|1&r,v===t-1?(v=0,h.push(n(p)),p=0):v++,r>>=1}else{for(r=1,i=0;f>i;i++)p=p<<1|r,v===t-1?(v=0,h.push(n(p)),p=0):v++,r=0;for(r=d.charCodeAt(0),i=0;16>i;i++)p=p<<1|1&r,v===t-1?(v=0,h.push(n(p)),p=0):v++,r>>=1}0==--l&&(l=Math.pow(2,f),f++),delete s[d]}else for(r=a[d],i=0;f>i;i++)p=p<<1|1&r,v===t-1?(v=0,h.push(n(p)),p=0):v++,r>>=1;0==--l&&(l=Math.pow(2,f),f++)}for(r=2,i=0;f>i;i++)p=p<<1|1&r,v===t-1?(v=0,h.push(n(p)),p=0):v++,r>>=1;for(;;){if(p<<=1,v===t-1){h.push(n(p));break}v++}return h.join("")},this.compress=function(e){var n=t;return t._compress(e,16,(function(e){return n.f(e)}))},this.compressToUTF16=function(e){var n=t;return null===e?"":t._compress(e,15,(function(e){return n.f(e+32)}))+" "},this.compressToUint8Array=function(e){for(var n=t.compress(e),i=new Uint8Array(2*n.length),r=0,o=n.length;o>r;r++){var a=n.charCodeAt(r);i[2*r]=a>>>8,i[2*r+1]=a%256}return i},this.compressToEncodedURIComponent=function(e){if(null===e)return"";var n=t;return t._compress(e,6,(function(e){return n.keyStrUriSafe.charAt(e)}))},this.f=String.fromCharCode,this.keyStrUriSafe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$"}},ke={name:"gioCustomTracking",method:function(e){var t=this;this.growingIO=e,this.getValidResourceItem=function(e){if(e&&N(e)&&e.id&&e.key){var t={id:T(e.id)?e.id:j(e.id),key:T(e.key)?e.key:j(e.key)};return e.attributes&&(t.attributes=e.attributes),t}},this.getDynamicAttributes=function(e){return b(e)||z(e).forEach((function(t){P(e[t])?e[t]=e[t]():N(e[t])?Z(e,t):x(e[t])||(e[t]=j(e[t]))})),e},this.buildCustomEvent=function(e,i,r,o){re(e,(function(){var a=t.growingIO.dataStore,s=a.eventContextBuilder,u=a.eventConverter,c=a.currentPage,d=n({eventType:"CUSTOM",eventName:e,pageShowTimestamp:null==c?void 0:c.time,attributes:ne(t.getDynamicAttributes(N(i)&&!Y(i)?i:void 0)),resourceItem:ne(t.getValidResourceItem(r))},s());Y(o)||(d=n(n({},d),o)),u(d)}))},this.buildUserAttributesEvent=function(e,i){var r=t.growingIO.dataStore,o=r.eventContextBuilder,a=r.eventConverter,s=n({eventType:"LOGIN_USER_ATTRIBUTES",attributes:ne(e)},o());Y(i)||(s=n(n({},s),i)),a(s)}}},Ue={},Ge={}.hasOwnProperty;function qe(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(e){return null}}function He(e){try{return encodeURIComponent(e)}catch(e){return null}}Ue.stringify=function(e,t){t=t||"";var n,i,r=[];for(i in"string"!=typeof t&&(t="?"),e)if(Ge.call(e,i)){if((n=e[i])||null!=n&&!isNaN(n)||(n=""),i=He(i),n=He(n),null===i||null===n)continue;r.push(i+"="+n)}return r.length?t+r.join("&"):""},Ue.parse=function(e){for(var t,n=/([^=?#&]+)=?([^&]*)/g,i={};t=n.exec(e);){var r=qe(t[1]),o=qe(t[2]);null===r||null===o||r in i||(i[r]=o)}return i};var je={gioprojectid:"projectId",giodatacollect:"dataCollect",gioappid:"domain",giodatasourceid:"dataSourceId",gios:"sessionId",giou:"uid",giocs1:"userId",gioid:"gioId",giouserkey:"userKey",gioappchannel:"appChannel",giodevicebrand:"deviceBrand",giodevicemodel:"deviceModel",giodevicetype:"deviceType",giolanguage:"language",gionetworkstate:"networkState",giooperatingsystem:"operatingSystem",gioplatform:"platform",gioplatformversion:"platformVersion",gioscreenheight:"screenHeight",gioscreenwidth:"screenWidth"},Be=["giodatasourceid","gioplatform","gioappchannel","giodevicebrand","giodevicemodel","giodevicetype","giolanguage","gionetworkstate","giooperatingsystem","gioplatformversion","gioscreenheight","gioscreenwidth"],Ke=["giocs1","gios","giou","gioid","giouserkey"],We="gio_search_cookie_gioenc",Ve={name:"gioEmbeddedAdapter",method:function(e){var t=this;this.growingIO=e,this.main=function(){var e,n=t.growingIO.vdsConfig,i=n.projectId,r=n.appId,o=t.getGQS(),a=!1;return"none"!==t.qsFrom&&o.gioprojectid===i&&o.gioappid===r&&(Y(o)?t.growingIO.storage.removeItem(We):t.growingIO.storage.setItem(We,Ue.stringify(o)),F(o,"giodatacollect")&&(t.growingIO.vdsConfig.dataCollect=q(["true",!0],o.giodatacollect)),null===(e=t.growingIO.emitter)||void 0===e||e.on("SDK_INITIALIZED",(function(){var e=t.growingIO,n=e.userStore,i=e.vdsConfig.sessionExpires,r=e.dataStore.eventContextBuilderInst;Ke.forEach((function(e){var t;n[je[e]]=null!==(t=o[e])&&void 0!==t?t:""})),window.setInterval((function(){n.sessionId=o.gios}),.8*i*60*1e3),Be.forEach((function(e){F(o,e)&&(r.minpExtraParams[je[e]]=o[e])}))})),t.growingIO.setUserId=function(){},t.growingIO.clearUserId=function(){},F(o,"giodatacollect")&&(t.growingIO.setDataCollect=function(){},t.growingIO.setOption=function(){}),a=!0),t.gioURLRewrite(),a},this.getGQS=function(){var e=t.growingIO.vdsConfig.hashtag,n=t.growingIO.storage.getItem(We),r=window.location.search,o=window.location.hash,a=e?o.substring(o.indexOf("?")+1):"",s=Ue.parse(r),u=Ue.parse(a),c=Ue.parse((n||"").replace("gioenc-","")),d={};if(F(s,"gioprojectid"))d=s,t.qsFrom="search";else if(F(u,"gioprojectid"))d=u,t.qsFrom="hash";else{if(!F(c,"gioprojectid"))return t.qsFrom="none",{};d=c,t.qsFrom="cookie"}var l={},g={},f=i(i(["gioappid","gioprojectid","giodatacollect"],Ke,!0),Be,!0);return z(d).forEach((function(e){var t=e.toLowerCase();q(f,t)?q(["","undefined","null",void 0,null],d[e])||(l[t]=d[e],q(["true","TRUE",!0],d[e])&&(l[t]=!0),q(["false","FALSE",!1],d[e])&&(l[t]=!1)):g[e]=d[e]})),t.gqs=l,t.ngqs=g,l},this.gioURLRewrite=function(){var e=t.growingIO.vdsConfig.hashtag,n=window.location.search,i=window.location.hash,r=!1;if("search"===t.qsFrom&&(n=Ue.stringify(t.ngqs,!0),r=!0),e&&"hash"===t.qsFrom&&(i="".concat(i.split("?")[0]).concat(Ue.stringify(t.ngqs,!0)),r=!0),r){var o="".concat(window.location.pathname).concat(n||"").concat(i||"");window.history.replaceState(null,document.title,o)}},this.gqs={},this.ngqs={},this.qsFrom="search",this.growingIO.emitter.on(Pe,(function(){t.growingIO.useEmbeddedInherit=t.main()}))}},Me={},Fe={};!function(e){var t=y&&y.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var i,r=0,o=t.length;o>r;r++)!i&&r in t||(i||(i=[].slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||[].slice.call(t))};Object.defineProperty(e,"__esModule",{value:!0}),e.GROWING_TITLE_OLD=e.GROWING_TITLE=e.GROWING_GTITLE=e.GROWING_CDP_INDEX=e.GROWING_INDEX_OLD=e.GROWING_INDEX=e.GROWING_CONTAINER=e.GROWING_TRACK=e.GROWING_IGNORE=e.VALID_CLASS_SELECTOR=e.VALID_ID_SELECTOR=e.EXCLUDE_CLASS_RE=e.UNSUPPORTED_TAGS=e.TEXT_NODE=e.UNSUPPORTED_CLICK_TAGS=e.SUPPORTED_ICON_TAGS=e.SUPPORTED_CHANGE_TYPES=e.SUPPORTED_CLICK_INPUT_TYPES=e.SUPPORTED_CONTAINER_TAGS=e.LIST_TAGS=void 0,e.LIST_TAGS=["TR","LI","DL"],e.SUPPORTED_CONTAINER_TAGS=t(["A","BUTTON"],e.LIST_TAGS,!0),e.SUPPORTED_CLICK_INPUT_TYPES=["button","submit","reset"],e.SUPPORTED_CHANGE_TYPES=["radio","checkbox","search"],e.SUPPORTED_ICON_TAGS=["I","EM","svg","IMG"],e.UNSUPPORTED_CLICK_TAGS=["TEXTAREA","HTML","BODY"],e.TEXT_NODE=["I","SPAN","EM","B","STRONG"],e.UNSUPPORTED_TAGS=["tspan","text","g","rect","path","defs","clippath","desc","title","math","use"],e.EXCLUDE_CLASS_RE=/(^| |[^ ]+\-)(clear|clearfix|active|hover|enabled|current|selected|unselected|hidden|display|focus|disabled|undisabled|open|checked|unchecked|undefined|null|ng-|growing-)[^\. ]*/g,e.VALID_ID_SELECTOR=/^[a-zA-Z-\_][a-zA-Z\-\_0-9]+$/,e.VALID_CLASS_SELECTOR=/^([a-zA-Z\-\_0-9]+)$/,e.GROWING_IGNORE="data-growing-ignore",e.GROWING_TRACK="data-growing-track",e.GROWING_CONTAINER="data-growing-container",e.GROWING_INDEX="data-growing-index",e.GROWING_INDEX_OLD="data-growing-idx",e.GROWING_CDP_INDEX="data-index",e.GROWING_GTITLE="data-growing-title",e.GROWING_TITLE="data-title",e.GROWING_TITLE_OLD="growing-title"}(Fe);var ze={},Xe={};Object.defineProperty(Xe,"__esModule",{value:!0}),Xe.lastFindIndex=Xe.findIndex=Xe.arrayEquals=Xe.rmBlank=Xe.normalizePath=Xe.splitNoEmpty=Xe.filterText=void 0,Xe.filterText=function(e,t){if(void 0===t&&(t=!0),e&&(null==(e=e.replace(/[\n \t]+/g," ").trim())?void 0:e.length))return e.slice(0,t?50:void 0)},Xe.splitNoEmpty=function(e,t){return e?e.split(t).filter((function(e){return!!e})):[]},Xe.normalizePath=function(e){var t=e.length;return t>1&&"/"===e.charAt(t-1)?e.slice(0,t-1):e},Xe.rmBlank=function(e){return e?e.replace(/[\n \t]+/g,""):""},Xe.arrayEquals=function(e,t){if(!e||!t)return!1;if(e.length!==t.length)return!1;for(var n=0,i=e.length;i>n;n++)if(e[n]!==t[n])return!1;return!0},Xe.findIndex=function(e,t){if(null==e||"function"!=typeof t)return-1;for(var n=0;n=0;n--){var i=e[n];if(t.call(void 0,i))return n}return-1},function(e){var t=y&&y.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var i,r=0,o=t.length;o>r;r++)!i&&r in t||(i||(i=[].slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||[].slice.call(t))},n=y&&y.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.removeDiffTagOnHeadAndTail=e.computeXpath=e.getMarkIndex=e.getEffectiveNode=e.isIgnore=e.depthInside=e.changeableInput=e.clickableInput=e.onlyContainsTextChildren=e.onlyContainsIconChildren=e.supportIconTag=e.isContainerTag=e.isListTag=e.isParentOfLeaf=e.isLeaf=e.getChildren=e.getDeepChildren=e.findParent=e.isRootNode=e.hasValidAttribute=void 0;var i=Xe,r=Fe,o=n(O);e.hasValidAttribute=function(e,t){return e instanceof Element&&e.hasAttribute(t)&&"false"!==e.getAttribute(t)},e.isRootNode=function(e){return!e||-1!==["BODY","HTML","#document"].indexOf(e.nodeName)},e.findParent=function(t,n){for(var i=t.parentNode;i&&!(0,e.isRootNode)(i);){if(n(i))return i;i=i.parentNode}},e.getDeepChildren=function(n){return(0,o.default)((null==n?void 0:n.childNodes)||[]).reduce((function(n,i){return i instanceof Element?t(t(t([],n,!0),[i],!1),(0,e.getDeepChildren)(i),!0):n}),[])},e.getChildren=function(e){return(0,o.default)((null==e?void 0:e.childNodes)||[]).filter((function(e){return e instanceof Element}))},e.isLeaf=function(t){return!t.hasChildNodes()||"svg"===t.nodeName||0===(0,e.getChildren)(t).length},e.isParentOfLeaf=function(t){return!(!t.hasChildNodes()||"svg"===t.nodeName)&&0===(0,o.default)(t.childNodes).filter((function(t){return!(0,e.isLeaf)(t)})).length},e.isListTag=function(e){return-1!==r.LIST_TAGS.indexOf(e.nodeName)},e.isContainerTag=function(t){return(0,e.hasValidAttribute)(t,r.GROWING_CONTAINER)||-1!==r.SUPPORTED_CONTAINER_TAGS.indexOf(t.nodeName)},e.supportIconTag=function(e){var t=e.nodeName;return-1!==r.SUPPORTED_ICON_TAGS.indexOf(t)},e.onlyContainsIconChildren=function(t){if(t.textContent)return!1;var n=(0,e.getChildren)(t);if(0===n.length)return!1;for(var i=0,r=n;in)return!1;for(var r="svg"===t.tagName?[]:(0,e.getChildren)(t),o=0;o=i},e.isIgnore=function(t){if(!(t instanceof Element)||(0,e.hasValidAttribute)(t,r.GROWING_IGNORE))return!0;for(var n=t.parentNode;n&&!(0,e.isRootNode)(n);){if((0,e.hasValidAttribute)(n,r.GROWING_IGNORE))return!0;n=n.parentNode}return!1},e.getEffectiveNode=function(t){for(var n,i;t&&(i=void 0,!((n=t)instanceof Element&&-1===r.UNSUPPORTED_TAGS.indexOf(null===(i=n.tagName)||void 0===i?void 0:i.toLowerCase())))&&t.parentNode;)t=t.parentNode;var o,a=t.parentNode;return!(0,e.isRootNode)(a)&&((0,e.onlyContainsIconChildren)(a)||"BUTTON"===(o=a).tagName&&(0,e.onlyContainsTextChildren)(o))?a:t},e.getMarkIndex=function(e){if(e instanceof Element){var t=e.getAttribute(r.GROWING_INDEX)||e.getAttribute(r.GROWING_INDEX_OLD)||e.getAttribute(r.GROWING_CDP_INDEX);if(t){if(/^\d{1,10}$/.test(t)&&+t>=0&&2147483647>+t)return+t;window.console.error("[GioNode]:标记的index不符合规范(index必须是大于等于0且小于2147483647的整数字)。",t)}}},e.computeXpath=function(e){for(var t=e.parentPaths(!0),n=Math.min(t.length,+(t.length>=10)+4),i=["","",""],r=0;rr&&(i[1]=o+i[1])}return i},e.removeDiffTagOnHeadAndTail=function(e,t){var n=function(e){return e.nodeName===t.nodeName},r=(0,i.findIndex)(e,n),o=(0,i.lastFindIndex)(e,n);return-1===r||-1===o?[]:e.slice(r,o+1)}}(ze);var Je={},Ze={};Object.defineProperty(Ze,"__esModule",{value:!0});var Ye=Fe,Qe=Xe,$e=ze;function et(e){var t;if(e instanceof Element){var n=e.getAttribute("name");if(n)return[n];if(e.hasAttribute("class")){var i=null===(t=e.getAttribute("class"))||void 0===t?void 0:t.replace(Ye.EXCLUDE_CLASS_RE,"").trim();if(null==i?void 0:i.length)return i.split(/\s+/).filter((function(e){return Ye.VALID_CLASS_SELECTOR.test(e)&&!e.match(/[a-z][A-Z][a-z][A-Z]/)&&!e.match(/[0-9][0-9][0-9][0-9]/)})).sort()}}return[]}var tt=function(){function e(e){var t;this.node=e,this.tagName=this.node.nodeName,this.name=this.tagName.toLowerCase(),this.id=(t=this.node).id&&Ye.VALID_ID_SELECTOR.test(t.id)?t.id:null,this.classList=et(this.node),this.guessListAndIndex()}return e.prototype.guessListAndIndex=function(){var e,t=this;this._tagList=(0,$e.isListTag)(this.node);var n=(0,$e.removeDiffTagOnHeadAndTail)((0,$e.getChildren)(this.node.parentNode),this.node);if(this._tagList&&-1!==(o=n.filter((function(e){return e.tagName===t.tagName})).indexOf(this.node))&&(this._index=o+1),n.length>=3&&(null===(e=this.classList)||void 0===e?void 0:e.length)){for(var i=0,r=0,o=1;o<=n.length;o++){var a=n[o-1];if(a.tagName!==this.tagName){r=0;break}(0,Qe.arrayEquals)(this.classList,et(a))&&(r+=1),this.node===a&&(i=o)}3>r||(this._pseudoList=!0,this._index=this._index||i)}},Object.defineProperty(e.prototype,"path",{get:function(){var e;return this._path||(this._path="/".concat(this.name),this.id&&(this._path+="#".concat(this.id)),(null===(e=this.classList)||void 0===e?void 0:e.length)&&(this._path+=".".concat(this.classList.join(".")))),this._path},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pseudoList",{get:function(){return!!this._pseudoList},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"list",{get:function(){return!!this._tagList||!!this._pseudoList},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"index",{get:function(){var e;return null!==(e=(0,$e.getMarkIndex)(this.node))&&void 0!==e?e:this._index},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"container",{get:function(){return(0,$e.isContainerTag)(this.node)||this.list},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"parent",{get:function(){return this.node.parentNode?new e(this.node.parentNode):null},enumerable:!1,configurable:!0}),e.prototype.parentPaths=function(e){void 0===e&&(e=!1);for(var t=e?[this]:[],n=this.parent;n&&!(0,$e.isRootNode)(n.node);)t.push(n),n=n.parent;return t},e}();Ze.default=tt;var nt={};Object.defineProperty(nt,"__esModule",{value:!0}),nt.getElementHref=nt.getImgHref=nt.getAnchorHref=void 0;var it=Xe;function rt(e){if(e.hasAttribute("href")){var t=e.getAttribute("href");if(t&&0!==t.indexOf("javascript"))return(0,it.normalizePath)(t.slice(0,320))}}function ot(e){if(e.src&&-1===e.src.indexOf("data:image"))return e.src}nt.getAnchorHref=rt,nt.getImgHref=ot,nt.getElementHref=function(e){var t=e;if(t)switch(e.nodeName.toLowerCase()){case"a":return rt(t);case"img":return ot(t)}};var at={},st=y&&y.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(at,"__esModule",{value:!0}),at.getElementContent=at.getFormContent=void 0;var ut=ze,ct=nt,dt=Fe,lt=st(Ze),gt=Xe,ft=st(O),ht=function(e){return e.htmlFor||e.getAttribute("for")},pt=function(e){var t=e.getAttribute(dt.GROWING_GTITLE)||e.getAttribute(dt.GROWING_TITLE)||e.getAttribute(dt.GROWING_TITLE_OLD)||e.getAttribute("title");return null==t?void 0:t.trim()};function vt(e){var t=e.node;return e.list?mt(t):(0,gt.filterText)(t.textContent)||void 0}function mt(e){for(var t=void 0,n=!1,i=0,r=(0,ft.default)(e.childNodes);i-1?n.slice(0,i):n}}(t);case"svg":return function(e){for(var t=0,n=(0,ft.default)(e.childNodes);t0)return n[n.length-1]}}(t);case"label":return vt(a);case"input":return function(e){if((0,ut.clickableInput)(e))return e.value;if("password"!==e.type&&(0,ut.hasValidAttribute)(e,dt.GROWING_TRACK))return e.value;if((0,ut.changeableInput)(e)){var t=(0,ut.findParent)(e,(function(e){return"LABEL"===e.nodeName}));if(!t&&e.id)for(var n=document.body.getElementsByTagName("label"),i=0;i0)return o+" ("+e.checked+")"}return e.value}}(t);case"select":return i=t,(0,ft.default)(i.options).filter((function(e){return e.selected})).map((function(e){return e.label})).join(", ")||i.value;case"form":return It(t)}return(0,ut.isLeaf)(t)?function(e){var t=(0,gt.filterText)(e.textContent);if(t)return t}(t):(0,ut.isParentOfLeaf)(t)&&!(0,ut.onlyContainsIconChildren)(t)?function(e){for(var t="",n=0,i=(0,ft.default)(e.childNodes);nn;n++)for(var r in t=arguments[n])({}).hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},Nt.apply(this,arguments)},Ct=y&&y.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Me,"__esModule",{value:!0});var Pt,xt,At=Fe,Dt=ze,Lt=Ct(Je),Rt=function(){function e(e,t,n){void 0===t&&(t=null),void 0===n&&(n=!0),this.origin=e,this.action=t,this.direct=n,this.target="self"===t?e:(0,Dt.getEffectiveNode)(e),this.ignore=(0,Dt.isIgnore)(this.target),this.vnode=new Lt.default(this.target),this.tagName=this.vnode.tagName}return Object.defineProperty(e.prototype,"content",{get:function(){return this.vnode.content},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"href",{get:function(){return this.vnode.href},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"index",{get:function(){return this.vnode.index},enumerable:!1,configurable:!0}),e.prototype.inferParentIndex=function(){var t=this;return this.parentIndex||(0,Dt.findParent)(this.target,(function(n){var i=new e(n,t.action,!1);i.traceable()&&i.index&&(t.parentIndex=i.index)})),this.parentIndex},Object.defineProperty(e.prototype,"xpath",{get:function(){return this.vnode.xpath},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fullXpath",{get:function(){return this.vnode.fullXpath},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"skeleton",{get:function(){return this.vnode.skeleton},enumerable:!1,configurable:!0}),e.prototype.info=function(e){return void 0===e&&(e=!0),e&&this.inferParentIndex(),{skeleton:this.skeleton,fullXpath:this.fullXpath,xpath:this.xpath,content:this.content,href:this.href,index:this.parentIndex||this.index}},e.prototype.traceable=function(){if(this.ignore)return!1;if(this.direct){if("click"===this.action||"hover"===this.action){if(-1!==At.UNSUPPORTED_CLICK_TAGS.indexOf(this.target.tagName))return!1;if("INPUT"===this.target.tagName&&!(0,Dt.clickableInput)(this.target))return!1;if(!(0,Dt.isContainerTag)(this.target)&&!(0,Dt.depthInside)(this.target,5))return!1}return!0}return this.vnode.container},e.prototype.trackNodes=function(){if(!this.traceable())return[];var e=[this];if("submit"!==this.action)for(var t=this.parentElement;t;){if(t.ignore)return[];t.traceable()&&e.unshift(t),t=t.parentElement}var n=void 0;return e.map((function(e){var t=e.info(!1),i=t.index;return!n&&i&&(n=i),Nt(Nt({},t),{index:n||i})}))},Object.defineProperty(e.prototype,"parentElement",{get:function(){var t=this.target.parentNode;if(t&&t.nodeName&&!(0,Dt.isRootNode)(t))return new e(t,this.action,!1)},enumerable:!1,configurable:!0}),e}(),kt=Me.default=Rt,Ut=function(){function e(e){this.handler=e;var t=navigator.userAgent,n=/chrome/i.exec(t),i=/android/i.exec(t);this.hasTouch="ontouchstart"in window&&!(n&&!i)}return e.prototype.main=function(){for(var e=this.hasTouch?["touchstart"]:["mousedown"],t=this.hasTouch?["touchend","touchcancel"]:["mouseup","mouseleave"],n=this.hasTouch?["touchmove"]:["mousemove"],i=0,r=e;r.length>i;i++)ie(window,r[i],this.touchStartHandler.bind(this));for(var o=0,a=n;a.length>o;o++)ie(window,a[o],this.touchMoveHandler.bind(this));for(var s=0,u=t;u.length>s;s++)ie(window,u[s],this.touchStopHandler.bind(this))},e.prototype.touchStartHandler=function(e){if(1>=e.which){var t=+Date.now();this.safeguard!==t&&(this.touchTimeout&&clearTimeout(this.touchTimeout),this.safeguard=t,this.touchEvent={time:t,target:e.target,x:this._page("x",e),y:this._page("y",e),isTrusted:!0,type:"click"})}},e.prototype.touchMoveHandler=function(e){var t=Math.abs(this._page("x",e)-(this.touchEvent&&this.touchEvent.x)||0),n=Math.abs(this._page("y",e)-(this.touchEvent&&this.touchEvent.y)||0);(t>10||n>10)&&(this.touchEvent=null)},e.prototype.touchStopHandler=function(e){var t=this,n=+Date.now()-(this.touchEvent&&this.touchEvent.time)||0;this.touchEvent&&200>n?this.touchTimeout=setTimeout((function(){t.handler(t.touchEvent),t.touchEvent=null}),200):this.touchEvent&&n>=200&&700>n&&(this.handler(this.touchEvent),this.touchEvent=null)},e.prototype._page=function(e,t){return(this.hasTouch?t.touches[0]:t)["page".concat(e.toUpperCase())]},e}(),Gt={name:"gioEventAutoTracking",method:function(e){var t=this;this.growingIO=e,this.main=function(){ie(document,"submit",t._handleAction),ie(document,"change",t._handleAction),t.growingIO.vdsConfig.touch?new Ut(t._handleAction).main():ie(document,"click",t._handleAction)},this._handleAction=function(e,i){var r=t.growingIO,o=r.vdsConfig,a=r.emitter;if(!o.autotrack)return!1;var s=e.target;if(!s)return!1;var u=new kt(s,e.type,!0).trackNodes();if("click"!==e.type&&(u=Y(L(u))?[]:[L(u)]),Y(u))return!1;null==a||a.emit("onComposeBefore",{event:i,params:null!=e?e:{}}),u.forEach((function(i){var r=i.fullXpath,a=i.index,s=i.content,u=i.href;if(!W(i.fullXpath||"","/div#__vconsole")&&!W(i.fullXpath||"","/div#__giokit")&&(o.debug&&console.log("Action:",e.type,Date.now()),r)){var c=t.growingIO.dataStore,d=c.eventContextBuilder,l=c.eventConverter,g=c.currentPage;l(n(n({eventType:w[e.type],element:[{xpath:r,index:a,textValue:s,hyperlink:u}]},d()),{pageShowTimestamp:g.time}))}}))}}},qt=["VIEW_CLICK","VIEW_CHANGE","FORM_SUBMIT","PAGE","CUSTOM","LOGIN_USER_ATTRIBUTES"],Ht=["LOGIN_USER_ATTRIBUTES"],jt={name:"gioHybridAdapter",method:function(e){var t=this;this.growingIO=e,this.penetrateHybrid=!0,this.onOptionsInit=function(){var e=t.growingIO,n=e.vdsConfig,i=e.emitter;S(n.penetrateHybrid)&&(t.penetrateHybrid=n.penetrateHybrid),t._initHybridBridge()&&(t.onSendBefore=t.sendBeforeListener,t.hybridConfig.projectId===t.growingIO.vdsConfig.projectId&&(t.growingIO.useHybridInherit=!0)),t.growingIO.useHybridInherit&&(null==i||i.on(De,(function(e){var n=e.newUserId,i=e.oldUserId,r=e.userKey;t.penetrateHybrid&&(!n&&i?r?t._clearNativeUserIdAndUserKey():t._clearNativeUserId():r?t._setNativeUserIdAndUserKey(j(n),j(r)):t._setNativeUserId(j(n)))})),null==i||i.on(Le,(function(e){var n=e.newUserKey,i=e.oldUserKey,r=e.userId;t.penetrateHybrid&&(!n&&i?t._clearNativeUserIdAndUserKey():t._setNativeUserIdAndUserKey(j(r),j(n)))})))},this._initHybridBridge=function(){var e,n,i,r=!1;return t.hasHybridBridge=!!window.GrowingWebViewJavascriptBridge,t.hasHybridBridge?((null===(e=null===window||void 0===window?void 0:window.GrowingWebViewJavascriptBridge)||void 0===e?void 0:e.configuration)||(window.GrowingWebViewJavascriptBridge.configuration=JSON.parse(window.GrowingWebViewJavascriptBridge.getConfiguration())),(null===(n=null===window||void 0===window?void 0:window.GrowingWebViewJavascriptBridge)||void 0===n?void 0:n.configuration)&&(t.hybridConfig=null===(i=null===window||void 0===window?void 0:window.GrowingWebViewJavascriptBridge)||void 0===i?void 0:i.configuration),r=!0):Pt.consoleText("gioHybridAdapter:当前不存在 GrowingWebViewJavascriptBridge,Web模式。","info"),r},this.sendBeforeListener=function(e){var i=e.requestData;if(t.hasHybridBridge){var r=t.processAttributes(n({},i));Z(r,"trackingId"),q(qt,r.eventType)&&(q(Ht,r.eventType)?t.penetrateHybrid&&t._dispatchEvent(r):(t.penetrateHybrid||Z(r,["userId","userKey","cs1"]),t._dispatchEvent(r)))}},this.processAttributes=function(e){return X(e,(function(t,n){N(t)||x(t)?X(e[n],(function(t,i){N(t)||x(t)?e[n][i]=JSON.stringify(t):e[n][i]=j(t)})):e[n]=j(t)})),e},this._setNativeUserId=function(e){te((function(){return window.GrowingWebViewJavascriptBridge.setNativeUserId(e)}))},this._clearNativeUserId=function(){te((function(){return window.GrowingWebViewJavascriptBridge.clearNativeUserId()}))},this._setNativeUserIdAndUserKey=function(e,t){te((function(){return window.GrowingWebViewJavascriptBridge.setNativeUserIdAndUserKey(e,t)}))},this._clearNativeUserIdAndUserKey=function(){te((function(){return window.GrowingWebViewJavascriptBridge.clearNativeUserIdAndUserKey()}))},this._dispatchEvent=function(e){te((function(){var t;return null===(t=window.GrowingWebViewJavascriptBridge)||void 0===t?void 0:t.dispatchEvent(JSON.stringify(e))}))};var i=this.growingIO,r=i.emitter,o=i.utils;Pt=o,r.on(Pe,this.onOptionsInit)}},Bt=["i","span","em","b","strong","svg"];!function(e){e[e.OUTER=0]="OUTER",e[e.INNER_COVERED=1]="INNER_COVERED",e[e.INNER_SHOW=2]="INNER_SHOW"}(xt||(xt={}));var Kt,Wt=i(["HR","BR","SCRIPT","NOSCRIPT","STYLE","HEAD","BASE","LINK","META","TITLE","BODY","HTML","TEMPLATE","CODE"],Fe.UNSUPPORTED_CLICK_TAGS,!0),Vt=["SELECT","A","BUTTON","INPUT","IMG","FORM"],Mt=function(e,t,n){return document.elementFromPoint(t,n)===e},Ft=function(){function e(e,t,n){this.node=e,this.parentNodeDesc=t,this.devicesInfo=n,this.proxy=new kt(e),this.tagName=this.node.tagName,this.name=this.tagName.toLowerCase(),this.isIgnore=!!this.node.dataset.growingIgnore,this.isUnSupported=-1!==Wt.indexOf(this.tagName),this.rect=this.computeWindowRect()}return e.prototype.info=function(){var e=this.desc();e.zLevel+=this.devicesInfo.webviewZLevel;var t=this.getDeviceRect(this.rect);return Z(e,"isContainer"),n(n(n({},e),t),{parentXPath:this.parentNodeDesc.isContainer?this.parentNodeDesc.xpath:void 0,href:this.proxy.href,content:this.proxy.content,nodeType:this.nodeType()})},e.prototype.nodeType=function(){return"input"!==this.name||ze.changeableInput(this.node)?this.node.tagName:"INPUT_BTN"},e.prototype.desc=function(){return{index:this.parentNodeDesc.index||this.proxy.index,zLevel:this.zLevel(),xpath:this.proxy.fullXpath,isContainer:this.isDefinedContainer()}},e.prototype.cssVisible=function(){var e=this.computedStyle();return Number(e.opacity)>0&&"visible"===e.visibility&&"none"!==e.display},e.prototype.viewportStatus=function(){var e=this.rect,t=e.top,n=e.left,i=e.width,r=e.height,o=this.devicesInfo,a=o.winWidth,s=o.winHeight;if(0>=i||0>=r)return xt.OUTER;var u=this.node;return s>t&&a>n&&i>0&&r>0?Mt(u,n+i/2,t+r/2)||Mt(u,n+1,t+1)||Mt(u,n+i-1,t+1)||Mt(u,n+1,t+r-1)||Mt(u,n+i-1,t+r-1)?xt.INNER_SHOW:xt.INNER_COVERED:xt.OUTER},e.prototype.isCircleable=function(){return this.proxy.target===this.proxy.origin&&(!!this.isDefinedContainer()||!("input"===this.name&&this.node instanceof HTMLInputElement&&"password"===this.node.type)&&(-1!==Vt.indexOf(this.name)||(ze.isLeaf(this.node)?!this.isBigBlank():this.hasBackgroundImage()&&ze.depthInside(this.node,4))))},e.prototype.isSimpleContainer=function(){return"select"===this.name||this.isDefaultContainer()&&(function(e,t){if(0===e.children.length)return!1;for(var n=0,i=H(e.children);n0)for(var n=0;ns>>1||o>u>>1)},e.prototype.hasBackgroundImage=function(){var e=this.computedStyle().backgroundImage;return!!e&&"none"!==e&&e.length>0},e.prototype.zLevel=function(){var e=this.computedStyle(),t=e.zIndex;if("auto"!==t)return Number(t||"0")+this.parentNodeDesc.zLevel;switch(e.position){case"relative":return this.parentNodeDesc.zLevel+2;case"sticky":return this.parentNodeDesc.zLevel+3;case"absolute":return this.parentNodeDesc.zLevel+4;case"fixed":return this.parentNodeDesc.zLevel+5;default:return this.parentNodeDesc.zLevel+1}},e.prototype.computeWindowRect=function(){if(this.rect)return this.rect;var e=this.node.getBoundingClientRect(),t=e.top,n=e.bottom,i=e.left,r=e.right-i,o=n-t;return 0>t?o=t+o:t+o>this.devicesInfo.winHeight&&(o=this.devicesInfo.winHeight-t),0>i?r=i+r:i+r>this.devicesInfo.winWidth&&(r=this.devicesInfo.winWidth-i),this.rect={top:t,left:i,width:r,height:o},this.rect},e.prototype.computedStyle=function(){return window.getComputedStyle(this.node)},e.prototype.getDeviceRect=function(e){var t=this.devicesInfo,n=t.scale,i=t.webviewTop,r=t.webviewLeft;return{top:e.top*n+i,left:e.left*n+r,width:e.width*n,height:e.height*n}},e}(),zt=["DOMContentLoaded","onreadystatechange"],Xt=["scroll","resize","load","beforeunload","popstate","hashchange","pagehide","unload"],Jt=function(){function e(e){this.growingIO=e,this.addDomChangeListener()}return e.prototype.getDomTree=function(e,t,n,i,r,o){var a=function(e,t,n,i,r){var o=document.documentElement.clientWidth;return{winWidth:o,winHeight:document.documentElement.clientHeight,scale:n/o,webviewTop:t,webviewLeft:e,webviewWidth:n,webviewHeight:i,webviewZLevel:r}}(e,t,n,i,r),s=this.getElementsByParent(o||document.body,{isContainer:!1,zLevel:0},a),u=this.growingIO.dataStore.currentPage;return{page:{domain:u.domain,path:u.path,query:u.query,title:u.title},elements:s}},e.prototype.getElementsByParent=function(e,t,n){var i=this,r=[];return[].slice.call(e.childNodes,0).filter((function(e){return 1===e.nodeType})).forEach((function(e){var o=new Ft(e,t,n);if(o.cssVisible()&&!o.isIgnore){switch(o.viewportStatus()){case xt.INNER_SHOW:o.isCircleable()&&r.push(o.info());break;case xt.INNER_COVERED:o.isDefaultContainer()&&r.push(o.info())}o.isSimpleContainer()||[].push.apply(r,i.getElementsByParent(e,o.desc(),n))}})),r},e.prototype.addDomChangeListener=function(){var e,t=function(t){return void 0===t&&(t=""),function(){var n;"beforeunload"===t&&e&&e.disconnect(),null===(n=window.GrowingWebViewJavascriptBridge)||void 0===n||n.onDomChanged()}};(e=new MutationObserver(t("mutation"))).observe(document.body,{attributes:!0,characterData:!0,childList:!0,subtree:!0}),zt.forEach((function(e){ie(document,e,t(e))})),Xt.forEach((function(e){ie(window,e,t(e))}))},e}(),Zt={name:"gioHybridCircle",method:function(){function e(t){var n,i=this;this.growingIO=t,null===(n=this.growingIO.emitter)||void 0===n||n.on(xe,(function(){if(window.GrowingWebViewJavascriptBridge){var t=i;window.GrowingWebViewJavascriptBridge.getDomTree=function(){if(arguments.length>=4)return e.bindGetDomTree(t.growingIO),e.domHelper.getDomTree.apply(e.domHelper,arguments)}}}))}return e.bindGetDomTree=function(e){this.domHelper||(this.domHelper=new Jt(e),window.GrowingWebViewJavascriptBridge.getDomTree=this.domHelper.getDomTree.bind(this.domHelper))},e}()},Yt={name:"gioImpressionTracking",method:function(e){var t,n=this;this.growingIO=e,this.documentReady=!1,this.main=function(e){"listener"===e?(n.documentReady=!0,n.growingIO.gioSDKInitialized&&n.initMutationObserver()):"emitter"===e&&n.documentReady&&n.initMutationObserver()},this.initIntersectionObserver=function(){n.intersectionObserver=new IntersectionObserver((function(e){Y(e)||e.map((function(e){var t=e.target,i=t.dataset,r=t.id;if(e.intersectionRatio>0){var o=n.getImpressionProperties(i),a=o.eventId,s=o.properties,u=o.items;if(r){if("once"===i.gioImpType&&F(n.sentImps,r))return;n.sentImps[r]={eventId:a,properties:s,items:u}}a&&n.growingIO.track(a,s,u)}}))}))},this.initMutationObserver=function(){var e;n.mutationObserver&&(null===(e=n.mutationObserver)||void 0===e||e.disconnect());var t=document.querySelectorAll("[data-gio-imp-track]");H(t).map((function(e){var t;null===(t=n.intersectionObserver)||void 0===t||t.observe(e)})),n.mutationObserver=new MutationObserver((function(e){e.map((function(e){var t,i;"attributes"===e.type&&(null===(t=e.target.dataset)||void 0===t?void 0:t.gioImpTrack)&&(null===(i=n.intersectionObserver)||void 0===i||i.observe(e.target))}))})),n.mutationObserver.observe(document.body,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0,attributeFilter:["data-gio-imp-track","data-gio-imp-attrs","data-gio-imp-items",/^data-gio-track-[a-z]+$/i]})},this.getImpressionProperties=function(e){var t={eventId:void 0,properties:{}};if(!(null==e?void 0:e.gioImpTrack))return t;if(t.eventId=e.gioImpTrack,F(e,"gioImpAttrs"))t.properties=te((function(){return N(e.gioImpAttrs)?e.gioImpAttrs:JSON.parse(e.gioImpAttrs)})),t.items=te((function(){return N(e.gioImpItems)?e.gioImpItems:JSON.parse(e.gioImpItems)}));else{var n=/^gioTrack(.+)/;for(var i in e){var r=void 0,o=i.match(n);o&&"track"!==(r=K(o[1]))&&(t.properties[r]=e[i])}}return t.properties=ne(t.properties),t.items=ne(t.items),/^\w+$/.test(t.eventId)&&!Number.isInteger(Number(D(t.eventId.split(""))))||(t.eventId=null,t={}),t},this.sentImps={},window.IntersectionObserver&&window.MutationObserver?(this.initIntersectionObserver(),ie(document,"readystatechange",(function(){q(["interactive","complete"],document.readyState)&&n.main("listener")}),{once:!0}),null===(t=this.growingIO.emitter)||void 0===t||t.on(xe,(function(){return n.main("emitter")})),ie(window,"unload",(function(){var e,t;null===(e=n.intersectionObserver)||void 0===e||e.disconnect(),null===(t=n.mutationObserver)||void 0===t||t.disconnect()}))):ee("当前浏览器不支持半自动埋点,gioImpressionTracking已自动关闭!","warn")}},Qt={name:"gioWebCircle",method:function(e){var t,n=this;this.growingIO=e,this.injectCircle=function(e,t){var n=document.createElement("link"),i=document.createElement("script");n.rel="stylesheet",n.href=e,i.src=t,document.head.appendChild(n),document.head.appendChild(i)},null===(t=this.growingIO.emitter)||void 0===t||t.on(xe,(function(){window.addEventListener("message",(function(e){var t=e.data,i=e.source,r=window.vds;if(t&&i){var o=i.vds,a=t.cssURL,s=t.jsURL;o&&"SDK_INJECT_CIRCLE_SCRIPT"===t.type&&r.projectId===o.projectId&&r.dataSourceId===o.dataSourceId&&n.injectCircle(a,s)}}))}))}},$t=["gioPerformance"],en=function(e){function n(t){var n=e.call(this,t)||this;return n.growingIO=t,n.growingIO.gioSDKFull=!0,n.pluginsContext={plugins:{gioCompress:Re,gioCustomTracking:ke,gioEmbeddedAdapter:Ve,gioEventAutoTracking:Gt,gioHybridAdapter:jt,gioHybridCircle:Zt,gioImpressionTracking:Yt,gioWebCircle:Qt}},n}return t(n,e),n}((function(e){var t,n,i,r,o=this;this.growingIO=e,this.innerPluginInit=function(){var e;$t.forEach((function(e){var t;return Z(null===(t=o.pluginsContext)||void 0===t?void 0:t.plugins,e)})),z(null===(e=o.pluginsContext)||void 0===e?void 0:e.plugins).forEach((function(e){var t,n=null===(t=o.pluginsContext)||void 0===t?void 0:t.plugins[e],i=n.name,r=n.method;U(o.pluginItems,(function(e){return e.name===i}))||o.pluginItems.push({name:K(i||e),method:r||function(e){}})})),Y(o.pluginItems)||o.installAll()},this.install=function(e,t,n){var i,r,a=t||U(o.pluginItems,(function(t){return t.name===e}));if((null===(i=o.growingIO)||void 0===i?void 0:i.plugins)[e])return ee("重复加载插件 ".concat(e," 或插件重名,已跳过加载!"),"warn"),!1;if(!a)return ee("插件加载失败!不存在名为 ".concat(e," 的插件!"),"error"),!1;try{return(null===(r=o.growingIO)||void 0===r?void 0:r.plugins)[e]=new a.method(o.growingIO,n),"cdp"===o.growingIO.gioEnvironment&&t&&ee("加载插件 ".concat(e),"info"),!0}catch(e){return ee("插件加载异常 ".concat(e),"error"),!1}},this.installAll=function(e){(e||o.pluginItems).forEach((function(t){o.install(t.name,e?t:void 0,e?null==t?void 0:t.options:void 0)&&!U(o.pluginItems,(function(e){return e.name===t.name}))&&o.pluginItems.push({name:K(t.name),method:t.method?t.method:function(){}})}))},this.uninstall=function(e){var t;Z(o.pluginItems,e);var n=Z(null===(t=o.growingIO)||void 0===t?void 0:t.plugins,e);return n||ee("卸载插件 ".concat(e," 失败!"),"error"),n},this.uninstallAll=function(){o.pluginItems.forEach((function(e){return o.uninstall(e.name)}))},this.lifeError=function(e,t){return ee("插件执行错误 ".concat(e.name," ").concat(t),"error")},this.onComposeBefore=function(e){o.pluginItems.forEach((function(t){var n,i=null===(n=o.growingIO.plugins[t.name])||void 0===n?void 0:n.onComposeBefore;if(i&&P(i))try{i(e)}catch(e){o.lifeError(t,e)}}))},this.onComposeAfter=function(e){o.pluginItems.forEach((function(t){var n,i=null===(n=o.growingIO.plugins[t.name])||void 0===n?void 0:n.onComposeAfter;if(i&&P(i))try{i(e)}catch(e){o.lifeError(t,e)}}))},this.onSendBefore=function(e){o.pluginItems.forEach((function(t){var n,i=null===(n=o.growingIO.plugins[t.name])||void 0===n?void 0:n.onSendBefore;if(i&&P(i))try{i(e)}catch(e){o.lifeError(t,e)}}))},this.onSendAfter=function(e){o.pluginItems.forEach((function(t){var n,i=null===(n=o.growingIO.plugins[t.name])||void 0===n?void 0:n.onSendAfter;if(i&&P(i))try{i(e)}catch(e){o.lifeError(t,e)}}))},this.pluginsContext={plugins:{}},this.pluginItems=[],null===(t=this.growingIO.emitter)||void 0===t||t.on("onComposeBefore",this.onComposeBefore),null===(n=this.growingIO.emitter)||void 0===n||n.on("onComposeAfter",this.onComposeAfter),null===(i=this.growingIO.emitter)||void 0===i||i.on("onSendBefore",this.onSendBefore),null===(r=this.growingIO.emitter)||void 0===r||r.on("onSendAfter",this.onSendAfter)})),tn=function(){function e(e){this.growingIO=e;var t=this.growingIO.vdsConfig.projectId,n=this.growingIO.storage,i=n.getItem,r=n.setItem,o=n.getKeys,a=n.removeItem;this.getItem=i,this.setItem=r,this.getKeys=o,this.removeItem=a,this.sIdStorageName="".concat(t,"_gdp_session_id"),this.uidStorageName="gdp_user_id_gioenc",this.userIdStorageName="".concat(t,"_gdp_cs1_gioenc"),this.userKeyStorageName="".concat(t,"_gdp_user_key_gioenc"),this.gioIdStorageName="".concat(t,"_gdp_gio_id_gioenc")}return Object.defineProperty(e.prototype,"sessionId",{get:function(){return this.getItem(this.sIdStorageName)||(this.sessionId=ge(),this.sessionId)},set:function(e){var t,n=this;e||(e=ge());var i=this.getItem(this.sIdStorageName)||this.prevSessionId,r=this.growingIO.vdsConfig.sessionExpires,o=void 0===r?30:r;this.setItem(this.sIdStorageName,e,+Date.now()+60*o*1e3),i!==e&&(this.getKeys().filter((function(e){return/.+_gdp_session_id_.{36}/.test(e)})).forEach((function(e){n.removeItem(e)})),this.setItem(this.growingIO.dataStore.visitStorageName,""),null===(t=this.growingIO.emitter)||void 0===t||t.emit(Ae,{newSessionId:e,oldSessionId:i})),this.prevSessionId=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"uid",{get:function(){return this.getItem(this.uidStorageName)||(this.uid=ge(),this.uid)},set:function(e){var t,n=this.getItem(this.uidStorageName)||this.prevUId;this.setItem(this.uidStorageName,e),n!==e&&(null===(t=this.growingIO.emitter)||void 0===t||t.emit("UID_UPDATE",{newUId:e,oldUId:n})),this.prevUId=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"userId",{get:function(){return this.getItem(this.userIdStorageName)||""},set:function(e){var t,n,i=this.getItem(this.userIdStorageName)||this.prevUserId;this.setItem(this.userIdStorageName,e),null===(t=this.growingIO.emitter)||void 0===t||t.emit(De,{newUserId:e,oldUserId:i,userKey:this.userKey}),i!==e&&(null===(n=this.growingIO.emitter)||void 0===n||n.emit("USERID_UPDATE",{newUserId:e,oldUserId:i,userKey:this.userKey})),e&&(this.gioId=e),this.prevUserId=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"userKey",{get:function(){return this.getItem(this.userKeyStorageName)||""},set:function(e){var t,n,i=this.getItem(this.userKeyStorageName)||this.prevUserKey;this.setItem(this.userKeyStorageName,e),null===(t=this.growingIO.emitter)||void 0===t||t.emit(Le,{newUserKey:e,oldUserKey:i,userId:this.userId}),i!==e&&(null===(n=this.growingIO.emitter)||void 0===n||n.emit("USERKEY_UPDATE",{newUserKey:e,oldUserKey:i,userId:this.userId})),this.prevUserKey=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"gioId",{get:function(){return this.getItem(this.gioIdStorageName)||""},set:function(e){var t,n=this.getItem(this.gioIdStorageName)||this.prevGioId;this.setItem(this.gioIdStorageName,e),n!==e&&(null===(t=this.growingIO.emitter)||void 0===t||t.emit("GIOID_UPDATE",{newGioId:e,oldGioId:n})),this.prevGioId=e},enumerable:!1,configurable:!0}),e}(),nn=function(e){var t=this;this.growingIO=e,this.main=function(){var e,i,r=t.growingIO,o=r.sdkVersion,a=r.useEmbeddedInherit,s=r.vdsConfig,u=r.userStore,c=r.dataStore,d=r.trackingId,l=c.currentPage,g=l.path,f=l.query,h={appVersion:s.version,dataSourceId:s.dataSourceId,deviceId:u.uid,domain:a?s.appId:window.location.host,gioId:u.gioId,language:navigator.language,path:g,platform:s.platform,query:f,referralPage:(null===(e=c.lastPageEvent)||void 0===e?void 0:e.referralPage)||"",screenHeight:window.screen.height,screenWidth:window.screen.width,sdkVersion:o,sessionId:u.sessionId,timestamp:+Date.now(),title:null!==(i=te((function(){return document.title.slice(0,255)})))&&void 0!==i?i:"",userId:u.userId};if(s.enableIdMapping&&(h.userKey=u.userKey),Y(s.ignoreFields)||s.ignoreFields.forEach((function(e){Z(h,e)})),a&&!Y(t.minpExtraParams)){var p=n({},h);X(n(n({},h),t.minpExtraParams),(function(e,n){var i;q(s.embeddedIgnore,n)?(h[n]=p[n],"domain"===n&&(h[n]=window.location.host)):h[n]=null!==(i=t.minpExtraParams[n])&&void 0!==i?i:h[n]}))}return h.trackingId=d,h},this.minpExtraParams={}},rn=function(e){var t=this;this.growingIO=e,this.parsePage=function(){var e=t.growingIO.vdsConfig.hashtag,n=location.pathname,i=location.search,r=location.hash,o=r.indexOf("?");t.domain=window.location.host,t.title=document.title.slice(0,255),t.time=+Date.now(),t.path=n,t.query=i,e&&(o>-1?(t.path+=r.slice(0,o),t.query=t.query+"&"+r.slice(o+1)):t.path+=r),t.query&&q(["?","&"],t.query.charAt(0))&&(t.query=t.query.slice(1))},this._getNoHashHref=function(){var e=window.location,t=e.protocol,n=e.host,i=e.pathname,r=e.search;return"".concat(t,"://").concat(n).concat(i).concat(r)},this.getReferralPage=function(){var e,n,i=t.growingIO.dataStore.lastPageEvent;return(null==i?void 0:i.path)===t.path&&(null!==(e=null==i?void 0:i.query)&&void 0!==e?e:"")===(null!==(n=t.query)&&void 0!==n?n:"")?null==i?void 0:i.referralPage:(null==i?void 0:i.path)?t.lastHref:document.referrer},this.pageListener=function(){var e=t.growingIO.vdsConfig.hashtag,n=window.location.href,i=t.lastHref;e||(n=t._getNoHashHref(),i=t.lastNoHashHref),i!==n&&(t.parsePage(),t.buildPageEvent())},this.hookHistory=function(){var e=window.history.pushState,n=window.history.replaceState,i=t;e&&te((function(){return window.history.pushState=function(){e.apply(window.history,arguments),setTimeout(i.pageListener)}})),n&&te((function(){return window.history.replaceState=function(){n.apply(window.history,arguments),setTimeout(i.pageListener)}})),ie(window,"popstate",t.pageListener),t.growingIO.vdsConfig.hashtag&&ie(window,"hashchange",t.pageListener)},this.buildPageEvent=function(e){var i=t.growingIO.dataStore;i.lastPageEvent;var r=i.eventContextBuilder,o=i.eventConverter,a=n(n({eventType:"PAGE"},r()),{protocolType:location.protocol.substring(0,location.protocol.length-1),referralPage:t.getReferralPage()});Y(e)||(a=n(n({},a),e)),a.timestamp=t.time,o(a),t.lastHref=window.location.href,t.lastNoHashHref=t._getNoHashHref(),t.lastLocation=n({},window.location)},this.title=document.title.slice(0,255),this.lastLocation=n({},window.location)},on={referralPage:document.referrer},an=function(){function e(e){var t,i,u,c=this;this.growingIO=e,this.ALLOW_SETTING=n(n({},o),"saas"===this.growingIO.gioEnvironment?s:a),this.allowOptKeys=Object.keys(this.ALLOW_SETTING),this.trackTimers={},this.setSequenceIds=function(e,t){var i=c.growingIO.storage.getItem(c.seqStorageIdName)||{};"gsid"===e?i.globalKey=t:i=n(n({},i),t),c.growingIO.storage.setItem(c.seqStorageIdName,i)},this.initOptions=function(e){var t,i,o,a,s,u,d,l=e.projectId,g=e.dataSourceId,f=e.appId;c.initialDataSourceId=g;var h={};c.allowOptKeys.forEach((function(t){var n=c.ALLOW_SETTING[t].type,i=x(n)?!q(n,Q(e[t])):Q(e[t])!==n;"platform"!==t||q(r,e[t])||(i=!0),i?h[t]=c.ALLOW_SETTING[t].default:"ignoreFields"===t?h.ignoreFields=e.ignoreFields.filter((function(e){return q(I,e)})):(h[t]=e[t],q(["dataCollect","autotrack"],t)&&(h[t]||ee("已关闭".concat(v[t]),"info")))})),h.sessionExpires=Math.round(h.sessionExpires),(E(h.sessionExpires)||1>h.sessionExpires||h.sessionExpires>360)&&(h.sessionExpires=30),h.storageType=h.storageType.toLowerCase(),h.sendType=h.sendType.toLowerCase(),q(["beacon","xhr","image"],h.sendType)||(h.sendType="beacon"),!E(Number(h.requestTimeout))&&h.requestTimeout>0||(h.requestTimeout=5e3),c.growingIO.vdsConfig=n(n(n({},null!==(t=window.vds)&&void 0!==t?t:{}),h),{projectId:l,dataSourceId:g,appId:f,performance:{monitor:null===(o=null===(i=h.performance)||void 0===i?void 0:i.monitor)||void 0===o||o,exception:null===(s=null===(a=h.performance)||void 0===a?void 0:a.exception)||void 0===s||s,network:null!==(d=null===(u=h.performance)||void 0===u?void 0:u.network)&&void 0!==d&&d}}),window.vds=c.growingIO.vdsConfig,c.seqStorageIdName="".concat(l,"_gdp_sequence_ids"),c.visitStorageName="".concat(l,"_gdp_session_id_sent")},this.setOption=function(e,t){var i,r=c.growingIO,o=r.vdsConfig,a=r.callError,s=r.uploader,u=r.emitter,d=T(e)&&q(p,e),l=d&&typeof t===((null===(i=c.ALLOW_SETTING[e])||void 0===i?void 0:i.type)||"string"),g=n({},o);return d&&l?(o[e]=t,"dataCollect"===e&&g.dataCollect!==t&&(t?(c.sendVisit(!0),c.sendPage()):c.growingIO.clearTrackTimer()),q(["host","scheme"],e)&&(null==s||s.generateHost()),null==u||u.emit("OPTION_CHANGE",{optionName:e,optionValue:t}),window.vds[e]=t,!0):(a("setOption > ".concat(e)),!1)},this.getOption=function(e){var t=c.growingIO,i=t.vdsConfig,r=t.callError;return e&&F(i,j(e))?i[j(e)]:b(e)?n({},i):void r("getOption > ".concat(e))},this.sendVisit=function(e){var t=c.growingIO,n=t.userStore.sessionId,i=t.storage.getItem(c.visitStorageName);!e&&n===i||(c.lastVisitEvent.timestamp=c.currentPage.time-1,c.buildVisitEvent())},this.buildVisitEvent=function(e){var t=c.growingIO,i=t.dataStore,r=i.eventContextBuilder,o=i.eventConverter,a=t.emitter,s=t.storage,u=t.userStore,d=c.lastVisitEvent,l=d.referralPage,g=d.title,f=d.path,h=d.query,p=d.timestamp,v=n(n({eventType:"VISIT"},r()),{referralPage:l||c.currentPage.getReferralPage(),timestamp:p});f&&(v.title=g,v.path=f,v.query=h),Y(e)||(v.session=(null==e?void 0:e.session)||v.session,v.trackingId=null==e?void 0:e.trackingId,v=n(n({},v),e));var m=function(e){var t=e.requestData;"VISIT"===t.eventType&&t.trackingId===c.growingIO.trackingId&&(u.sessionId===t.sessionId&&s.setItem(c.visitStorageName,t.sessionId),a.off("onSendAfter",m))};a.on("onSendAfter",m),o(v)},this.sendPage=function(e){e&&c.currentPage.parsePage(),c.currentPage.buildPageEvent()},this.buildErrorEvent=function(e){var t=c.growingIO.dataStore,i=t.eventContextBuilder;(0,t.eventConverter)(n({eventType:"CUSTOM",pageShowTimestamp:c.currentPage.time,eventName:"onError",attributes:e},i()))},this.currentPage=new rn(this.growingIO),this.eventContextBuilderInst=new nn(this.growingIO),this.eventContextBuilder=this.eventContextBuilderInst.main,this.generalProps={},this.lastVisitEvent=on,null===(t=this.growingIO.emitter)||void 0===t||t.on("onComposeAfter",(function(e){var t=e.composedEvent;"VISIT"!==t.eventType&&"vst"!==t.t||t.trackingId!==c.growingIO.trackingId||(c.lastVisitEvent=t)})),this.lastPageEvent={},null===(i=this.growingIO.emitter)||void 0===i||i.on("onComposeAfter",(function(e){var t=e.composedEvent;"PAGE"!==t.eventType&&"page"!==t.t||t.trackingId!==c.growingIO.trackingId||(c.lastPageEvent=t)})),null===(u=this.growingIO.emitter)||void 0===u||u.on(Ae,(function(){if(c.growingIO.gioSDKInitialized){c.currentPage.parsePage();var e=c.currentPage,t=e.title,n=e.path,i=e.query,r=e.time,o=e.getReferralPage;c.lastVisitEvent={referralPage:document.referrer||o(),title:t,path:n,query:i,timestamp:r-1},c.sendVisit(!0),c.sendPage(!0)}}))}return Object.defineProperty(e.prototype,"esid",{get:function(){var e=this,t=this.growingIO.storage.getItem(this.seqStorageIdName)||{},i=n({},t);return Z(i,"globalKey"),i=N(i)&&!b(i)?i:{},this._esid={},z(i).forEach((function(t){e._esid[t]=E(Number(i[t]))||i[t]>=1e9||1>i[t]?1:i[t]})),this._esid},set:function(e){var t={};z(e).forEach((function(n){t[n]=E(e[n])||e[n]>=1e9||1>e[n]?1:e[n]})),J(this._esid,t)||(this._esid=t,this.setSequenceIds("esid",this._esid))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"gsid",{get:function(){var e=this.growingIO.storage.getItem(this.seqStorageIdName)||{},t=Number(e.globalKey);return this._gsid=E(t)||t>=1e9||1>t?1:t,this._gsid},set:function(e){E(Number(e))||e>=1e9||1>e?this._gsid=1:this._gsid=e,this.setSequenceIds("gsid",this._gsid)},enumerable:!1,configurable:!0}),e}(),sn=function(e){function i(t){var i=e.call(this,t)||this;return i.growingIO=t,i.eventConverter=function(e){var t,r,o=i.growingIO,a=o.vdsConfig,s=o.dataStore,u=o.uploader;if(a.dataCollect){e.trackingId===i.growingIO.trackingId&&(e.globalSequenceId=s.gsid,e.eventSequenceId=s.esid[e.eventType]||1);var c={};X(e,(function(e,t){var n;if("element"===t){var i=null!==(n=D(e))&&void 0!==n?n:{};X(i,(function(e,t){Y(e)&&0!==e||(c[t]=e)}))}else(Y(e)||b(e))&&0!==e||(c[t]=e)})),e.trackingId===i.growingIO.trackingId&&(i.growingIO.dataStore.gsid+=1,i.growingIO.dataStore.esid=n(n({},i.growingIO.dataStore.esid),((t={})[c.eventType]=(i.growingIO.dataStore.esid[c.eventType]||1)+1,t))),null===(r=i.growingIO.emitter)||void 0===r||r.emit("onComposeAfter",{composedEvent:n({},c)}),e.trackingId===i.growingIO.trackingId&&u.commitRequest(c)}else"VISIT"===e.eventType&&(i.lastVisitEvent=e)},i}return t(i,e),i}(an),un=function(e){function n(t){var n=e.call(this,t)||this;return n.growingIO=t,n.generateHost=function(){var e=n.growingIO.vdsConfig,t=e.scheme,i=e.host,r=void 0===i?"":i,o=e.projectId;t?V(j(t),"://")||(t="".concat(t,"://")):t="".concat(location.protocol.indexOf("http")>-1?location.protocol.replace(":",""):"https","//"),W(r,"http")&&(r=r.substring(r.indexOf("://")+(V(j(t),"://")?3:0))),n.requestURL="".concat(t).concat(r,"/v3/projects/").concat(o,"/collect")},n.requestURL="",n.generateHost(),n}return t(n,e),n}((function(e){var t=this;this.growingIO=e,this.getSendType=function(){var e=t.growingIO.vdsConfig.sendType;return"beacon"===e?function(){var e,t,n=!!(null===(e=null===window||void 0===window?void 0:window.navigator)||void 0===e?void 0:e.sendBeacon),i=window.navigator.userAgent;if(i.match(/(iPad|iPhone|iPod)/g)){var r=!(t=i.toLowerCase().match(/cpu.*os (.*?) like mac os/i))||2>t.length?0:+t[1].split("_").slice(0,2).join(".");return n&&r>13}return n}()?"beacon":"xhr":e},this.commitRequest=function(e){var i=n({},e);t.requestQueue.push(n(n({},i),{requestType:t.getSendType()})),t.initiateRequest()},this.initiateRequest=function(){var e,r,o;if(i([],t.requestQueue,!0).length>0&&t.requestingNum0?j(n).slice(0,1e3):""),t.userStore.userId=j(e).slice(0,1e3),i&&i!==t.userStore.userId&&(t.userStore.sessionId="")}else t.clearUserId(),t.callError("setUserId")},t.clearUserId=function(){t.userStore.userId="",t.userStore.userKey=""},t.track=function(e,i,r,o){var a,s;((null===(s=null===(a=t.plugins)||void 0===a?void 0:a.gioCustomTracking)||void 0===s?void 0:s.buildCustomEvent)||function(){})(e,n(n({},t.dataStore.generalProps),N(i)&&!Y(i)?i:{}),r,o)},t.sendPage=function(e){return t.dataStore.currentPage.buildPageEvent(e)},t.sendVisit=function(e){return t.dataStore.buildVisitEvent(e)},t.trackTimerStart=function(e,n){t.vdsConfig.dataCollect&&re(e,(function(){var i=ge();P(n)?(t.dataStore.trackTimers[i]={eventName:e,leng:0,start:+Date.now()},n(i)):ee("回调方法不合法,返回timerId失败!")}))},t.trackTimerPause=function(e){if(e&&t.dataStore.trackTimers[e]){var n=t.dataStore.trackTimers[e];n.start&&(n.leng=n.leng+(+Date.now()-n.start)),n.start=0}},t.trackTimerResume=function(e){if(e&&t.dataStore.trackTimers[e]){var n=t.dataStore.trackTimers[e];0===n.start&&(n.start=+Date.now())}},t.trackTimerEnd=function(e,i){if(t.vdsConfig.dataCollect)if(e&&t.dataStore.trackTimers[e]){var r=t.dataStore.trackTimers[e];if(0!==r.start){var o=+Date.now()-r.start;r.leng=o>0?r.leng+o:0}t.track(r.eventName,n(n({},i),{event_duration:r.leng>864e5?0:r.leng/1e3})),t.removeTimer(e)}else ee("未查找到对应的计时器,请检查!","error")},t.removeTimer=function(e){e&&t.dataStore.trackTimers[e]&&delete t.dataStore.trackTimers[e]},t.clearTrackTimer=function(){t.dataStore.trackTimers={}},t.dataStore=new sn(t),t}return t(i,e),i}((function(){var e,t=this;this.trackingId="g0",this.init=function(e){var n,i,r,o,a;ee("Gio Web SDK 初始化中...","info");var s=t.dataStore,u=s.initOptions,c=s.currentPage,d=s.sendVisit,l=s.sendPage;u(e),t.storage=Ce(t.vdsConfig),t.initCallback(),null===(n=t.emitter)||void 0===n||n.emit(Pe,t),null===(r=null===(i=t.plugins)||void 0===i?void 0:i.gioEventAutoTracking)||void 0===r||r.main(),c.hookHistory(),c.parsePage(),null===(o=t.emitter)||void 0===o||o.emit(xe,t),ee("Gio Web SDK 初始化完成!","success"),t.useEmbeddedInherit||(t.dataStore.lastVisitEvent.timestamp=c.time,d()),l(),t.gioSDKInitialized=!0,t.vdsConfig.gioSDKInitialized=!0,window[t.vds]=t.vdsConfig,null===(a=t.emitter)||void 0===a||a.emit("SDK_INITIALIZED_COMPLATE",t)},this.setOption=function(e,n){if(q(p,e)){var i=t.dataStore.setOption(e,n);return i&&v[e]&&ee("已".concat(n?"开启":"关闭").concat(v[e]),"info"),i}return ee("不存在可修改的配置项:".concat(e,",请检查后重试!"),"warn"),!1},this.getOption=function(e){return t.dataStore.getOption(e)},this.setGeneralProps=function(e){N(e)&&!Y(e)?(t.dataStore.generalProps=n(n({},t.dataStore.generalProps),e),z(t.dataStore.generalProps).forEach((function(e){q([void 0,null],t.dataStore.generalProps[e])&&(t.dataStore.generalProps[e]="")}))):t.callError("setGeneralProps")},this.clearGeneralProps=function(e){x(e)&&!Y(e)?e.forEach((function(e){Z(t.dataStore.generalProps,e)})):t.dataStore.generalProps={}},this.reissuePage=function(){t.dataStore.sendPage()},this.notRecommended=function(){return ee("不推荐的方法使用,建议使用 gio('setOption', [optionName], [value])!","info")},this.callError=function(e,t,n){return void 0===t&&(t=!0),void 0===n&&(n="参数不合法"),ee("".concat(t?"调用":"设置"," ").concat(e," 失败,").concat(n,"!"),"warn")},this.updateImpression=function(){var e,n,i=null===(n=null===(e=t.plugins)||void 0===e?void 0:e.gioImpressionTracking)||void 0===n?void 0:n.main;i?i("emitter"):ee("updateImpression 错误! 请集成半自动埋点浏览插件后重试!","error")},this.gioEnvironment="cdp",this.sdkVersion="3.8.7",this.vds=window.gioCompatibilityVds?"gdp_vds":"vds",this.utils=n(n({},$),oe),this.emitter={all:e=e||new Map,on:function(t,n){var i=e.get(t);i?i.push(n):e.set(t,[n])},off:function(t,n){var i=e.get(t);i&&(n?i.splice(i.indexOf(n)>>>0,1):e.set(t,[]))},emit:function(t,n){var i=e.get(t);i&&i.slice().map((function(e){e(n)})),(i=e.get("*"))&&i.slice().map((function(e){e(t,n)}))}},this.useEmbeddedInherit=!1,this.useHybridInherit=!1,this.gioSDKInitialized=!1,this.plugins=new en(this),this.plugins.innerPluginInit()}));!function(){var e,t,i,r,o,a=window.gioCompatibilityVds?"gdp_vds":"vds";if(null===(e=window[a])||void 0===e?void 0:e.gioSDKInstalled)return Kt=window.gdp,void ee("SDK重复加载,请检查是否重复加载SDK或接入其他平台SDK导致冲突!","warn");window[a]=n(n({},null!==(t=window[a])&&void 0!==t?t:{}),{gioSDKInstalled:!0});var s=new cn;Kt=function(){var e,t=arguments[0];if(T(t)&&q(h,t)&&s[t]){var i=R(H(arguments));if("init"===t){var r=function(e){var t;return e.vdsConfig||e.gioSDKInitialized||(null===(t=window.vds)||void 0===t?void 0:t.gioSDKInitialized)?(ee("SDK重复初始化,请检查是否重复加载SDK或接入其他平台SDK导致冲突!","warn"),!1):!(q(["","localhost","127.0.0.1"],location.hostname)&&!window._gr_ignore_local_rule&&(ee("当前SDK不允许在本地环境初始化!","warn"),1))}(s);if(!r)return;var o=function(e){return!Y(k(e))||(ee('SDK初始化失败,请使用 gdp("init", "您的GrowingIO项目 accountId", "您项目的 dataSourceId", options); 进行初始化!',"error"),!1)}(i);if(!o)return;var u=function(e){var t=D(e),n=L(e);return ae(j(t).trim())?(N(n)&&n||(n={}),{projectId:t,userOptions:n}):(ee("SDK初始化失败,accountId 参数不合法!","error"),!1)}(i);if(!u)return;var c=function(e){var t=e[1],n=e[2],i=L(e);return t&&T(t)?{dataSourceId:t,appId:T(n)?n:"",cdpOptions:i}:(ee("SDK初始化失败,dataSourceId 参数不合法!","error"),!1)}(i);if(!c)return;var d=u.projectId,l=c.dataSourceId,g=c.appId,f=c.cdpOptions;s.init(n(n({},f),{projectId:d,dataSourceId:l,appId:g}))}else if("registerPlugins"===t)s.registerPlugins(i[0]);else{if(s.gioSDKInitialized&&s.vdsConfig)return s[t].apply(s,i);s.emitter.emit("UNINITIALIZED_CALL",arguments),ee("SDK未初始化!","error")}}else q(m,t)?ee("方法 ".concat(j(t)," 已被弃用,请移除!"),"warn"):ee("不存在名为 ".concat(j(t)," 的方法调用!"),"error");window[a]=n(n({},window[a]),{_gr_ignore_local_rule:null!==(e=window._gr_ignore_local_rule)&&void 0!==e&&e,gioEnvironment:"cdp",gioSDKVersion:s.sdkVersion,gioSDKFull:s.gioSDKFull,canIUse:function(e){return q(h,e)&&s[e]}})};var u=null===(i=null===window||void 0===window?void 0:window.gdp)||void 0===i?void 0:i.q,c=null===(r=null===window||void 0===window?void 0:window.gdp)||void 0===r?void 0:r.e,d=null===(o=null===window||void 0===window?void 0:window.gdp)||void 0===o?void 0:o.ef;window.gdp=Kt,window.gdp.e=c,window.gdp.ef=d,x(u)&&!Y(u)&&u.forEach((function(e){Kt.apply(null,e)}))}();var dn=Kt;export{dn as default}; diff --git a/gdp-full-es5.umd.js b/gdp-full-es5.umd.js index bd3d8eb..f5913b9 100644 --- a/gdp-full-es5.umd.js +++ b/gdp-full-es5.umd.js @@ -1 +1 @@ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).gdp=t()}(this,(function(){"use strict";var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)({}).hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};function t(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+n+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}var n=function(){return n=Object.assign||function(e){for(var t,n=1,i=arguments.length;i>n;n++)for(var r in t=arguments[n])({}).hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},n.apply(this,arguments)};function i(e,t,n){if(n||2===arguments.length)for(var i,r=0,o=t.length;o>r;r++)!i&&r in t||(i||(i=[].slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||[].slice.call(t))}var r=["web","wxwv","minp","alip","baidup","qq","bytedance"],o={autotrack:{type:"boolean",default:!0},compress:{type:"boolean",default:!0},dataCollect:{type:"boolean",default:!0},debug:{type:"boolean",default:!1},hashtag:{type:"boolean",default:!1},touch:{type:"boolean",default:!1},version:{type:"string",default:"1.0.0"},platform:{type:"string",default:"web"},cookieDomain:{type:"string",default:""},sendType:{type:"string",default:"beacon"}},a={enableIdMapping:{type:"boolean",default:!1},gtouchHost:{type:"string",default:""},host:{type:"string",default:"napi.growingio.com"},ignoreFields:{type:"array",default:[]},penetrateHybrid:{type:"boolean",default:!0},scheme:{type:"string",default:location.protocol.indexOf("http")>-1?location.protocol.replace(":",""):"https"},sessionExpires:{type:"number",default:30},performance:{type:"object",default:{monitor:!0,exception:!0}},embeddedIgnore:{type:"array",default:[]},storageType:{type:"string",default:"cookie"},requestTimeout:{type:"number",default:5e3}},s={},u=["clearUserId","getGioInfo","getLocation","getOption","init","setDataCollect","setOption","setUserId","track","setGeneralProps","clearGeneralProps"];i(i([],u,!0),["setEvar","setPage","setUser","setVisitor"],!1);var c,d,l,g,f,h=i(i([],u,!0),["enableDebug","enableHT","setAutotrack","setTrackerHost","setTrackerScheme","setUserAttributes","getVisitorId","getDeviceId","registerPlugins","getPlugins","sendPage","sendVisit","trackTimerStart","trackTimerPause","trackTimerResume","trackTimerEnd","removeTimer","clearTrackTimer","updateImpression"],!1),p=["autotrack","dataCollect","dataSourceId","debug","host","hashtag","scheme"],v={autotrack:"无埋点采集",dataCollect:"数据采集",debug:"调试模式"},m=["send","setConfig","collectImp","setPlatformProfile"],I=["screenHeight","screenWidth"],w={click:"VIEW_CLICK",change:"VIEW_CHANGE",submit:"FORM_SUBMIT"},y="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},O="function"==typeof Array.from?Array.from:(d||(d=1,l=function(e){return"function"==typeof e},g=function(e){var t=function(e){var t=Number(e);return isNaN(t)?0:0!==t&&isFinite(t)?(t>0?1:-1)*Math.floor(Math.abs(t)):t}(e);return Math.min(Math.max(t,0),9007199254740991)},f=function(e){var t=e.next();return!t.done&&t},c=function(e){var t,n,i,r=this,o=arguments.length>1?arguments[1]:void 0;if(void 0!==o){if(!l(o))throw new TypeError("Array.from: when provided, the second argument must be a function");arguments.length>2&&(t=arguments[2])}var a=function(e,t){if(null!=e&&null!=t){var n=e[t];if(null==n)return;if(!l(n))throw new TypeError(n+" is not a function");return n}}(e,function(e){if(null!=e){if(["string","number","boolean","symbol"].indexOf(typeof e)>-1)return Symbol.iterator;if("undefined"!=typeof Symbol&&"iterator"in Symbol&&Symbol.iterator in e)return Symbol.iterator;if("@@iterator"in e)return"@@iterator"}}(e));if(void 0!==a){n=l(r)?Object(new r):[];var s,u,c=a.call(e);if(null==c)throw new TypeError("Array.from requires an array-like or iterable object");for(i=0;;){if(!(s=f(c)))return n.length=i,n;u=s.value,n[i]=o?o.call(t,u,i):u,i++}}else{var d=Object(e);if(null==e)throw new TypeError("Array.from requires an array-like object - not null or undefined");var h,p=g(d.length);for(n=l(r)?Object(new r(p)):Array(p),i=0;p>i;)h=d[i],n[i]=o?o.call(t,h,i):h,i++;n.length=p}return n}),c),b=function(e){return q(["undefined","null"],Q(e))},T=function(e){return"string"===Q(e)},_=function(e){return"number"===Q(e)},E=function(e){return"NaN"===j(Number(e))},S=function(e){return"boolean"===Q(e)},N=function(e){return"object"===Q(e)&&!b(e)},C=function(e){return"regexp"===Q(e)},x=function(e){return q(["function","asyncfunction"],Q(e))},P=function(e){return Array.isArray(e)&&"array"===Q(e)},A=function(e){return"date"===Q(e)},D=function(e){try{return H(e)[0]}catch(e){return}},L=function(e){try{var t=H(e);return t[t.length-1]}catch(e){return}},R=function(e,t){return void 0===t&&(t=1),P(e)&&_(t)?e.slice(t>0?t:1,e.length):e},k=function(e){if(P(e)){for(var t=0,n=[],i=0,r=e;i=0},H=O,j=function(e){return b(e)?"":"".concat(e)},B=function(e,t){return"string"==typeof e?e.split(t):e},K=function(e){if(T(e)){var t=B(e,"");return"".concat(D(t).toLowerCase()).concat(R(t).join(""))}return e},W=function(e,t){return!!T(e)&&e.slice(0,t.length)===t},V=function(e,t){if(T(e)){var n=e.length,i=n;i>n&&(i=n);var r=i;return(i-=t.length)>=0&&e.slice(i,r)===t}return!1},M={}.hasOwnProperty,F=function(e,t){return!b(e)&&M.call(e,t)},z=function(e){return N(e)?Object.keys(e):[]},X=function(e,t){z(e).forEach((function(n){return t(e[n],n)}))},J=function(e,t){var n=z(e);return!(!N(e)||!N(t)||n.length!==z(t).length||q(n.map((function(n,i){return N(e[n])?J(e[n],t[n]):e[n]===t[n]})),!1))},Z=function(e,t){if(!N(e))return!1;try{return"string"===Q(t)?delete e[t]:"array"===Q(t)?t.map((function(t){return delete e[t]})):(C(t)&&z(e).forEach((function(n){t.test(n)&&Z(e,n)})),!0)}catch(e){return!1}},Y=function(e){return P(e)?0===e.length:N(e)?0===z(e).length:!e},Q=function(e){return{}.toString.call(e).slice(8,-1).toLowerCase()},$=Object.freeze({__proto__:null,isNil:b,isString:T,isNumber:_,isNaN:E,isBoolean:S,isObject:N,isRegExp:C,isFunction:x,isArray:P,isDate:A,fixed:function(e,t){return _(e)?Number(e.toFixed(_(t)?t:2)):T(e)&&"NaN"!==j(Number(e))?Number(Number(e).toFixed(_(t)?t:2)):e},head:D,last:L,drop:R,dropWhile:function(e,t){return P(e)?e.filter((function(e){return!t(e)})):e},compact:k,find:U,findIndex:G,includes:q,arrayFrom:H,toString:j,split:B,lowerFirst:K,upperFirst:function(e){if(T(e)){var t=B(e,"");return"".concat(D(t).toUpperCase()).concat(R(t).join(""))}return e},startsWith:W,endsWith:V,has:F,keys:z,forEach:X,isEqual:J,get:function(e,t,n){var i=e;return N(e)?(t.split(".").forEach((function(e){i=i?i[e]:n})),i):n},unset:Z,isEmpty:Y,typeOf:Q,formatDate:function(e){if(A(e)){var t=function(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())}return e}}),ee=function(e,t){console.log("%c [GrowingIO]:".concat(e),{info:"color: #3B82F6;",error:"color: #EF4444;",warn:"color: #F59E0B;",success:"color: #10B981;"}[t]||"")},te=function(e){try{return e()}catch(e){return}},ne=function(e){var t={};return N(e)&&X(e,(function(e,n){var i,r=j(n).slice(0,100);N(e)?t[r]=ne(e):P(e)?(t[r]=e.slice(0,100),"cdp"===(null===(i=window.vds)||void 0===i?void 0:i.gioEnvironment)&&(t[r]=t[r].join("||").slice(0,1e3))):t[r]=b(e)?"":j(e).slice(0,1e3)})),t},ie=function(e,t,i,r){void 0===r&&(r={}),document.addEventListener?e.addEventListener(t,i,n(n({},{capture:!0}),r)):e.attachEvent?e.attachEvent("on"+t,i):e["on"+t]=i},re=function(e,t){return T(e)&&!Y(e)&&e.match(/^[a-zA-Z_][0-9a-zA-Z_]{0,100}$/)?t():(ee("事件名格式不正确,只能包含数字、字母和下划线,且不能以数字开头,字符总长度不能超过100!","error"),!1)},oe=Object.freeze({__proto__:null,consoleText:ee,niceTry:te,limitObject:ne,addListener:ie,flattenObject:function(e){void 0===e&&(e={});var t=n({},e);return z(t).forEach((function(e){N(t[e])?(z(t[e]).forEach((function(n){t["".concat(e,"_").concat(n)]=j(t[e][n])})),Z(t,e)):P(t[e])?(t[e].forEach((function(n,i){N(n)?z(n).forEach((function(r){t["".concat(e,"_").concat(i,"_").concat(r)]=j(n[r])})):t["".concat(e,"_").concat(i)]=j(n)})),Z(t,e)):b(t[e])||""===t[e]?Z(t,e):t[e]=j(t[e])})),ne(t)},eventNameValidate:re,getGioFunction:function(){var e,t,n,i,r=window._gio_local_vds||"vds",o=null!==(t=null===(e=window[r])||void 0===e?void 0:e.namespace)&&void 0!==t?t:"gdp";return x(window[o])?window[o]:null!==(i=null!==(n=window.gdp)&&void 0!==n?n:window.gio)&&void 0!==i?i:function(){}}}),ae=function(e){return T(e)&&e.length>0||_(e)&&e>0},se=/^((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})(\.((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})){3}/i,ue=/^(https?:\/\/)|(([a-zA-Z0-9_-])+(\.)?)*(:\d+)?(\/((\.)?(\?)?=?&?[a-zA-Z0-9_-](\?)?)*)*$/i;function ce(e){for(var t=1;arguments.length>t;t++){var n=arguments[t];for(var i in n)e[i]=n[i]}return e}var de,le=function e(t,n){function i(e,i,r){if("undefined"!=typeof document){"number"==typeof(r=ce({},n,r)).expires&&(r.expires=new Date(Date.now()+864e5*r.expires)),r.expires&&(r.expires=r.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var o="";for(var a in r)r[a]&&(o+="; "+a,!0!==r[a]&&(o+="="+r[a].split(";")[0]));return document.cookie=e+"="+t.write(i,e)+o}}return Object.create({set:i,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var n=document.cookie?document.cookie.split("; "):[],i={},r=0;r+Date.now()?he(me(t.value)):void 0},this.setItem=function(e,t,n){var i=null!=n?n:+new Date(9999,12);localStorage.setItem(fe(e),JSON.stringify({value:T(t)&&t.length&&V(e,"_gioenc")?ve(t):t,expiredAt:i}))},this.removeItem=function(e){return localStorage.removeItem(fe(e))},this.hasItem=function(e){return!!localStorage.getItem(fe(e))},this.getKeys=function(){return H(Array(localStorage.length)).map((function(e,t){return localStorage.key(t)}))},this.type="localStorage"},be={},Te=function(){this.getItem=function(e){var t=te((function(){return JSON.parse(be[fe(e)]||"")}));return N(t)&&t.expiredAt>+Date.now()?he(me(t.value)):void 0},this.setItem=function(e,t,n){var i=null!=n?n:+new Date(9999,12);be[fe(e)]=JSON.stringify({value:T(t)&&t.length?ve(t):t,expiredAt:i})},this.removeItem=function(e){return Z(be,fe(e))},this.hasItem=function(e){return F(be,fe(e))},this.getKeys=function(){return z(be)},this.type="memory"},_e=/^(\.ac\.|\.br\.|\.co\.|\.com\.|\.edu\.|\.gov\.|\.org\.|\.net\.)/,Ee=function(e){var t=[];try{var n=e.split("."),i=L(n);if(n.length>=2&&(isNaN(Number(i))||0>Number(i)||Number(i)>255)){var r=".".concat(n.slice(-2).join("."));_e.test(r)?de=r:t.push(r);var o=".".concat(n.slice(-3).join("."));_e.test(o)||q(t,o)||t.push(o);var a=".".concat(n.slice(-4).join("."));_e.test(a)||q(t,a)||t.push(a)}}catch(e){}return t},Se=function(e){var t="";return e.every((function(e){return!Ne(e)||(t=e,!1)})),t},Ne=function(e){try{le.set("gioCookie","yes",{domain:e});var t=!!le.get("gioCookie",{domain:e});return le.remove("gioCookie",{domain:e}),t}catch(e){return!1}},Ce=function(e){var t,n,r,o=e.storageType,a=e.cookieDomain,s=e.projectId;if(q(["cookie","localstorage"],o)||(o="cookie"),"cookie"===o&&(n=!!(r=navigator.userAgent.indexOf("Electron")>-1||q(["","localhost","127.0.0.1"],window.location.hostname)||!q(["http:","https:"],window.location.protocol)?"":Se(i(i([],Ee(window.location.hostname),!0),[window.location.hostname],!1)))),"cookie"===o&&n){var u=new ye(r);if(a){var c=Ee(a),d=Se(Y(c)?[]:i([a],Ee(a),!0));d&&Ne(d)?u.domain=d:ee("指定Cookie域无效或无权限,使用默认域!","warn")}t=u}else t=function(){try{var e=window.localStorage,t="__storage_test__";return e.setItem(t,t),e.removeItem(t),!0}catch(e){return!1}}()?new Oe:new Te;return"cookie"===o&&de&&Ne(de)&&function(e,t,n){if(t&&Ne(t)){var i=new ye(t);["".concat(n,"_gdp_session_id"),"gdp_user_id_gioenc","".concat(n,"_gdp_cs1_gioenc"),"".concat(n,"_gdp_user_key_gioenc"),"".concat(n,"_gdp_gio_id_gioenc"),"".concat(n,"_gdp_sequence_ids"),"".concat(n,"_gdp_session_id_sent")].forEach((function(t){var n=i.getItem(t);i.hasItem(t)&&(e.setItem(t,n),i.removeItem(t))})),i=void 0}}(t,de,s),t},xe="OPTION_INITIALIZED",Pe="SDK_INITIALIZED",Ae="SESSIONID_UPDATE",De="SET_USERID",Le="SET_USERKEY",Re={name:"gioCompress",method:function(e){var t=this;this.growingIO=e,this._compress=function(e,t,n){if(null===e)return"";var i,r,o,a={},s={},u="",c="",d="",l=2,g=3,f=2,h=[],p=0,v=0;for(o=0;od.charCodeAt(0)){for(i=0;f>i;i++)p<<=1,v===t-1?(v=0,h.push(n(p)),p=0):v++;for(r=d.charCodeAt(0),i=0;8>i;i++)p=p<<1|1&r,v===t-1?(v=0,h.push(n(p)),p=0):v++,r>>=1}else{for(r=1,i=0;f>i;i++)p=p<<1|r,v===t-1?(v=0,h.push(n(p)),p=0):v++,r=0;for(r=d.charCodeAt(0),i=0;16>i;i++)p=p<<1|1&r,v===t-1?(v=0,h.push(n(p)),p=0):v++,r>>=1}0==--l&&(l=Math.pow(2,f),f++),delete s[d]}else for(r=a[d],i=0;f>i;i++)p=p<<1|1&r,v===t-1?(v=0,h.push(n(p)),p=0):v++,r>>=1;0==--l&&(l=Math.pow(2,f),f++),a[c]=g++,d=u+""}if(""!==d){if({}.hasOwnProperty.call(s,d)){if(256>d.charCodeAt(0)){for(i=0;f>i;i++)p<<=1,v===t-1?(v=0,h.push(n(p)),p=0):v++;for(r=d.charCodeAt(0),i=0;8>i;i++)p=p<<1|1&r,v===t-1?(v=0,h.push(n(p)),p=0):v++,r>>=1}else{for(r=1,i=0;f>i;i++)p=p<<1|r,v===t-1?(v=0,h.push(n(p)),p=0):v++,r=0;for(r=d.charCodeAt(0),i=0;16>i;i++)p=p<<1|1&r,v===t-1?(v=0,h.push(n(p)),p=0):v++,r>>=1}0==--l&&(l=Math.pow(2,f),f++),delete s[d]}else for(r=a[d],i=0;f>i;i++)p=p<<1|1&r,v===t-1?(v=0,h.push(n(p)),p=0):v++,r>>=1;0==--l&&(l=Math.pow(2,f),f++)}for(r=2,i=0;f>i;i++)p=p<<1|1&r,v===t-1?(v=0,h.push(n(p)),p=0):v++,r>>=1;for(;;){if(p<<=1,v===t-1){h.push(n(p));break}v++}return h.join("")},this.compress=function(e){var n=t;return t._compress(e,16,(function(e){return n.f(e)}))},this.compressToUTF16=function(e){var n=t;return null===e?"":t._compress(e,15,(function(e){return n.f(e+32)}))+" "},this.compressToUint8Array=function(e){for(var n=t.compress(e),i=new Uint8Array(2*n.length),r=0,o=n.length;o>r;r++){var a=n.charCodeAt(r);i[2*r]=a>>>8,i[2*r+1]=a%256}return i},this.compressToEncodedURIComponent=function(e){if(null===e)return"";var n=t;return t._compress(e,6,(function(e){return n.keyStrUriSafe.charAt(e)}))},this.f=String.fromCharCode,this.keyStrUriSafe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$"}},ke={name:"gioCustomTracking",method:function(e){var t=this;this.growingIO=e,this.getValidResourceItem=function(e){if(e&&N(e)&&e.id&&e.key){var t={id:T(e.id)?e.id:j(e.id),key:T(e.key)?e.key:j(e.key)};return e.attributes&&(t.attributes=e.attributes),t}},this.getDynamicAttributes=function(e){return b(e)||z(e).forEach((function(t){x(e[t])?e[t]=e[t]():N(e[t])?Z(e,t):P(e[t])||(e[t]=j(e[t]))})),e},this.buildCustomEvent=function(e,i,r,o){re(e,(function(){var a=t.growingIO.dataStore,s=a.eventContextBuilder,u=a.eventConverter,c=a.currentPage,d=n({eventType:"CUSTOM",eventName:e,pageShowTimestamp:null==c?void 0:c.time,attributes:ne(t.getDynamicAttributes(N(i)&&!Y(i)?i:void 0)),resourceItem:ne(t.getValidResourceItem(r))},s());Y(o)||(d=n(n({},d),o)),u(d)}))},this.buildUserAttributesEvent=function(e,i){var r=t.growingIO.dataStore,o=r.eventContextBuilder,a=r.eventConverter,s=n({eventType:"LOGIN_USER_ATTRIBUTES",attributes:ne(e)},o());Y(i)||(s=n(n({},s),i)),a(s)}}},Ue={},Ge={}.hasOwnProperty;function qe(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(e){return null}}function He(e){try{return encodeURIComponent(e)}catch(e){return null}}Ue.stringify=function(e,t){t=t||"";var n,i,r=[];for(i in"string"!=typeof t&&(t="?"),e)if(Ge.call(e,i)){if((n=e[i])||null!=n&&!isNaN(n)||(n=""),i=He(i),n=He(n),null===i||null===n)continue;r.push(i+"="+n)}return r.length?t+r.join("&"):""},Ue.parse=function(e){for(var t,n=/([^=?#&]+)=?([^&]*)/g,i={};t=n.exec(e);){var r=qe(t[1]),o=qe(t[2]);null===r||null===o||r in i||(i[r]=o)}return i};var je={gioprojectid:"projectId",giodatacollect:"dataCollect",gioappid:"domain",giodatasourceid:"dataSourceId",gios:"sessionId",giou:"uid",giocs1:"userId",gioid:"gioId",giouserkey:"userKey",gioappchannel:"appChannel",giodevicebrand:"deviceBrand",giodevicemodel:"deviceModel",giodevicetype:"deviceType",giolanguage:"language",gionetworkstate:"networkState",giooperatingsystem:"operatingSystem",gioplatform:"platform",gioplatformversion:"platformVersion",gioscreenheight:"screenHeight",gioscreenwidth:"screenWidth"},Be=["giodatasourceid","gioplatform","gioappchannel","giodevicebrand","giodevicemodel","giodevicetype","giolanguage","gionetworkstate","giooperatingsystem","gioplatformversion","gioscreenheight","gioscreenwidth"],Ke=["giocs1","gios","giou","gioid","giouserkey"],We="gio_search_cookie_gioenc",Ve={name:"gioEmbeddedAdapter",method:function(e){var t=this;this.growingIO=e,this.main=function(){var e,n=t.growingIO.vdsConfig,i=n.projectId,r=n.appId,o=t.getGQS(),a=!1;return"none"!==t.qsFrom&&o.gioprojectid===i&&o.gioappid===r&&(Y(o)?t.growingIO.storage.removeItem(We):t.growingIO.storage.setItem(We,Ue.stringify(o)),F(o,"giodatacollect")&&(t.growingIO.vdsConfig.dataCollect=q(["true",!0],o.giodatacollect)),null===(e=t.growingIO.emitter)||void 0===e||e.on("SDK_INITIALIZED",(function(){var e=t.growingIO,n=e.userStore,i=e.vdsConfig.sessionExpires,r=e.dataStore.eventContextBuilderInst;Ke.forEach((function(e){var t;n[je[e]]=null!==(t=o[e])&&void 0!==t?t:""})),window.setInterval((function(){n.sessionId=o.gios}),.8*i*60*1e3),Be.forEach((function(e){F(o,e)&&(r.minpExtraParams[je[e]]=o[e])}))})),t.growingIO.setUserId=function(){},t.growingIO.clearUserId=function(){},F(o,"giodatacollect")&&(t.growingIO.setDataCollect=function(){},t.growingIO.setOption=function(){}),a=!0),t.gioURLRewrite(),a},this.getGQS=function(){var e=t.growingIO.vdsConfig.hashtag,n=t.growingIO.storage.getItem(We),r=window.location.search,o=window.location.hash,a=e?o.substring(o.indexOf("?")+1):"",s=Ue.parse(r),u=Ue.parse(a),c=Ue.parse((n||"").replace("gioenc-","")),d={};if(F(s,"gioprojectid"))d=s,t.qsFrom="search";else if(F(u,"gioprojectid"))d=u,t.qsFrom="hash";else{if(!F(c,"gioprojectid"))return t.qsFrom="none",{};d=c,t.qsFrom="cookie"}var l={},g={},f=i(i(["gioappid","gioprojectid","giodatacollect"],Ke,!0),Be,!0);return z(d).forEach((function(e){var t=e.toLowerCase();q(f,t)?q(["","undefined","null",void 0,null],d[e])||(l[t]=d[e],q(["true","TRUE",!0],d[e])&&(l[t]=!0),q(["false","FALSE",!1],d[e])&&(l[t]=!1)):g[e]=d[e]})),t.gqs=l,t.ngqs=g,l},this.gioURLRewrite=function(){var e=t.growingIO.vdsConfig.hashtag,n=window.location.search,i=window.location.hash,r=!1;if("search"===t.qsFrom&&(n=Ue.stringify(t.ngqs,!0),r=!0),e&&"hash"===t.qsFrom&&(i="".concat(i.split("?")[0]).concat(Ue.stringify(t.ngqs,!0)),r=!0),r){var o="".concat(window.location.pathname).concat(n||"").concat(i||"");window.history.replaceState(null,document.title,o)}},this.gqs={},this.ngqs={},this.qsFrom="search",this.growingIO.emitter.on(xe,(function(){t.growingIO.useEmbeddedInherit=t.main()}))}},Me={},Fe={};!function(e){var t=y&&y.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var i,r=0,o=t.length;o>r;r++)!i&&r in t||(i||(i=[].slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||[].slice.call(t))};Object.defineProperty(e,"__esModule",{value:!0}),e.GROWING_TITLE_OLD=e.GROWING_TITLE=e.GROWING_GTITLE=e.GROWING_CDP_INDEX=e.GROWING_INDEX_OLD=e.GROWING_INDEX=e.GROWING_CONTAINER=e.GROWING_TRACK=e.GROWING_IGNORE=e.VALID_CLASS_SELECTOR=e.VALID_ID_SELECTOR=e.EXCLUDE_CLASS_RE=e.UNSUPPORTED_TAGS=e.TEXT_NODE=e.UNSUPPORTED_CLICK_TAGS=e.SUPPORTED_ICON_TAGS=e.SUPPORTED_CHANGE_TYPES=e.SUPPORTED_CLICK_INPUT_TYPES=e.SUPPORTED_CONTAINER_TAGS=e.LIST_TAGS=void 0,e.LIST_TAGS=["TR","LI","DL"],e.SUPPORTED_CONTAINER_TAGS=t(["A","BUTTON"],e.LIST_TAGS,!0),e.SUPPORTED_CLICK_INPUT_TYPES=["button","submit","reset"],e.SUPPORTED_CHANGE_TYPES=["radio","checkbox","search"],e.SUPPORTED_ICON_TAGS=["I","EM","svg","IMG"],e.UNSUPPORTED_CLICK_TAGS=["TEXTAREA","HTML","BODY"],e.TEXT_NODE=["I","SPAN","EM","B","STRONG"],e.UNSUPPORTED_TAGS=["tspan","text","g","rect","path","defs","clippath","desc","title","math","use"],e.EXCLUDE_CLASS_RE=/(^| |[^ ]+\-)(clear|clearfix|active|hover|enabled|current|selected|unselected|hidden|display|focus|disabled|undisabled|open|checked|unchecked|undefined|null|ng-|growing-)[^\. ]*/g,e.VALID_ID_SELECTOR=/^[a-zA-Z-\_][a-zA-Z\-\_0-9]+$/,e.VALID_CLASS_SELECTOR=/^([a-zA-Z\-\_0-9]+)$/,e.GROWING_IGNORE="data-growing-ignore",e.GROWING_TRACK="data-growing-track",e.GROWING_CONTAINER="data-growing-container",e.GROWING_INDEX="data-growing-index",e.GROWING_INDEX_OLD="data-growing-idx",e.GROWING_CDP_INDEX="data-index",e.GROWING_GTITLE="data-growing-title",e.GROWING_TITLE="data-title",e.GROWING_TITLE_OLD="growing-title"}(Fe);var ze={},Xe={};Object.defineProperty(Xe,"__esModule",{value:!0}),Xe.lastFindIndex=Xe.findIndex=Xe.arrayEquals=Xe.rmBlank=Xe.normalizePath=Xe.splitNoEmpty=Xe.filterText=void 0,Xe.filterText=function(e,t){if(void 0===t&&(t=!0),e&&(null==(e=e.replace(/[\n \t]+/g," ").trim())?void 0:e.length))return e.slice(0,t?50:void 0)},Xe.splitNoEmpty=function(e,t){return e?e.split(t).filter((function(e){return!!e})):[]},Xe.normalizePath=function(e){var t=e.length;return t>1&&"/"===e.charAt(t-1)?e.slice(0,t-1):e},Xe.rmBlank=function(e){return e?e.replace(/[\n \t]+/g,""):""},Xe.arrayEquals=function(e,t){if(!e||!t)return!1;if(e.length!==t.length)return!1;for(var n=0,i=e.length;i>n;n++)if(e[n]!==t[n])return!1;return!0},Xe.findIndex=function(e,t){if(null==e||"function"!=typeof t)return-1;for(var n=0;n=0;n--){var i=e[n];if(t.call(void 0,i))return n}return-1},function(e){var t=y&&y.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var i,r=0,o=t.length;o>r;r++)!i&&r in t||(i||(i=[].slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||[].slice.call(t))},n=y&&y.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.removeDiffTagOnHeadAndTail=e.computeXpath=e.getMarkIndex=e.getEffectiveNode=e.isIgnore=e.depthInside=e.changeableInput=e.clickableInput=e.onlyContainsTextChildren=e.onlyContainsIconChildren=e.supportIconTag=e.isContainerTag=e.isListTag=e.isParentOfLeaf=e.isLeaf=e.getChildren=e.getDeepChildren=e.findParent=e.isRootNode=e.hasValidAttribute=void 0;var i=Xe,r=Fe,o=n(O);e.hasValidAttribute=function(e,t){return e instanceof Element&&e.hasAttribute(t)&&"false"!==e.getAttribute(t)},e.isRootNode=function(e){return!e||-1!==["BODY","HTML","#document"].indexOf(e.nodeName)},e.findParent=function(t,n){for(var i=t.parentNode;i&&!(0,e.isRootNode)(i);){if(n(i))return i;i=i.parentNode}},e.getDeepChildren=function(n){return(0,o.default)((null==n?void 0:n.childNodes)||[]).reduce((function(n,i){return i instanceof Element?t(t(t([],n,!0),[i],!1),(0,e.getDeepChildren)(i),!0):n}),[])},e.getChildren=function(e){return(0,o.default)((null==e?void 0:e.childNodes)||[]).filter((function(e){return e instanceof Element}))},e.isLeaf=function(t){return!t.hasChildNodes()||"svg"===t.nodeName||0===(0,e.getChildren)(t).length},e.isParentOfLeaf=function(t){return!(!t.hasChildNodes()||"svg"===t.nodeName)&&0===(0,o.default)(t.childNodes).filter((function(t){return!(0,e.isLeaf)(t)})).length},e.isListTag=function(e){return-1!==r.LIST_TAGS.indexOf(e.nodeName)},e.isContainerTag=function(t){return(0,e.hasValidAttribute)(t,r.GROWING_CONTAINER)||-1!==r.SUPPORTED_CONTAINER_TAGS.indexOf(t.nodeName)},e.supportIconTag=function(e){var t=e.nodeName;return-1!==r.SUPPORTED_ICON_TAGS.indexOf(t)},e.onlyContainsIconChildren=function(t){if(t.textContent)return!1;var n=(0,e.getChildren)(t);if(0===n.length)return!1;for(var i=0,r=n;in)return!1;for(var r="svg"===t.tagName?[]:(0,e.getChildren)(t),o=0;o=i},e.isIgnore=function(t){if(!(t instanceof Element)||(0,e.hasValidAttribute)(t,r.GROWING_IGNORE))return!0;for(var n=t.parentNode;n&&!(0,e.isRootNode)(n);){if((0,e.hasValidAttribute)(n,r.GROWING_IGNORE))return!0;n=n.parentNode}return!1},e.getEffectiveNode=function(t){for(var n,i;t&&(i=void 0,!((n=t)instanceof Element&&-1===r.UNSUPPORTED_TAGS.indexOf(null===(i=n.tagName)||void 0===i?void 0:i.toLowerCase())))&&t.parentNode;)t=t.parentNode;var o,a=t.parentNode;return!(0,e.isRootNode)(a)&&((0,e.onlyContainsIconChildren)(a)||"BUTTON"===(o=a).tagName&&(0,e.onlyContainsTextChildren)(o))?a:t},e.getMarkIndex=function(e){if(e instanceof Element){var t=e.getAttribute(r.GROWING_INDEX)||e.getAttribute(r.GROWING_INDEX_OLD)||e.getAttribute(r.GROWING_CDP_INDEX);if(t){if(/^\d{1,10}$/.test(t)&&+t>=0&&2147483647>+t)return+t;window.console.error("[GioNode]:标记的index不符合规范(index必须是大于等于0且小于2147483647的整数字)。",t)}}},e.computeXpath=function(e){for(var t=e.parentPaths(!0),n=Math.min(t.length,+(t.length>=10)+4),i=["","",""],r=0;rr&&(i[1]=o+i[1])}return i},e.removeDiffTagOnHeadAndTail=function(e,t){var n=function(e){return e.nodeName===t.nodeName},r=(0,i.findIndex)(e,n),o=(0,i.lastFindIndex)(e,n);return-1===r||-1===o?[]:e.slice(r,o+1)}}(ze);var Je={},Ze={};Object.defineProperty(Ze,"__esModule",{value:!0});var Ye=Fe,Qe=Xe,$e=ze;function et(e){var t;if(e instanceof Element){var n=e.getAttribute("name");if(n)return[n];if(e.hasAttribute("class")){var i=null===(t=e.getAttribute("class"))||void 0===t?void 0:t.replace(Ye.EXCLUDE_CLASS_RE,"").trim();if(null==i?void 0:i.length)return i.split(/\s+/).filter((function(e){return Ye.VALID_CLASS_SELECTOR.test(e)&&!e.match(/[a-z][A-Z][a-z][A-Z]/)&&!e.match(/[0-9][0-9][0-9][0-9]/)})).sort()}}return[]}var tt=function(){function e(e){var t;this.node=e,this.tagName=this.node.nodeName,this.name=this.tagName.toLowerCase(),this.id=(t=this.node).id&&Ye.VALID_ID_SELECTOR.test(t.id)?t.id:null,this.classList=et(this.node),this.guessListAndIndex()}return e.prototype.guessListAndIndex=function(){var e,t=this;this._tagList=(0,$e.isListTag)(this.node);var n=(0,$e.removeDiffTagOnHeadAndTail)((0,$e.getChildren)(this.node.parentNode),this.node);if(this._tagList&&-1!==(o=n.filter((function(e){return e.tagName===t.tagName})).indexOf(this.node))&&(this._index=o+1),n.length>=3&&(null===(e=this.classList)||void 0===e?void 0:e.length)){for(var i=0,r=0,o=1;o<=n.length;o++){var a=n[o-1];if(a.tagName!==this.tagName){r=0;break}(0,Qe.arrayEquals)(this.classList,et(a))&&(r+=1),this.node===a&&(i=o)}3>r||(this._pseudoList=!0,this._index=this._index||i)}},Object.defineProperty(e.prototype,"path",{get:function(){var e;return this._path||(this._path="/".concat(this.name),this.id&&(this._path+="#".concat(this.id)),(null===(e=this.classList)||void 0===e?void 0:e.length)&&(this._path+=".".concat(this.classList.join(".")))),this._path},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pseudoList",{get:function(){return!!this._pseudoList},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"list",{get:function(){return!!this._tagList||!!this._pseudoList},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"index",{get:function(){var e;return null!==(e=(0,$e.getMarkIndex)(this.node))&&void 0!==e?e:this._index},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"container",{get:function(){return(0,$e.isContainerTag)(this.node)||this.list},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"parent",{get:function(){return this.node.parentNode?new e(this.node.parentNode):null},enumerable:!1,configurable:!0}),e.prototype.parentPaths=function(e){void 0===e&&(e=!1);for(var t=e?[this]:[],n=this.parent;n&&!(0,$e.isRootNode)(n.node);)t.push(n),n=n.parent;return t},e}();Ze.default=tt;var nt={};Object.defineProperty(nt,"__esModule",{value:!0}),nt.getElementHref=nt.getImgHref=nt.getAnchorHref=void 0;var it=Xe;function rt(e){if(e.hasAttribute("href")){var t=e.getAttribute("href");if(t&&0!==t.indexOf("javascript"))return(0,it.normalizePath)(t.slice(0,320))}}function ot(e){if(e.src&&-1===e.src.indexOf("data:image"))return e.src}nt.getAnchorHref=rt,nt.getImgHref=ot,nt.getElementHref=function(e){var t=e;if(t)switch(e.nodeName.toLowerCase()){case"a":return rt(t);case"img":return ot(t)}};var at={},st=y&&y.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(at,"__esModule",{value:!0}),at.getElementContent=at.getFormContent=void 0;var ut=ze,ct=nt,dt=Fe,lt=st(Ze),gt=Xe,ft=st(O),ht=function(e){return e.htmlFor||e.getAttribute("for")},pt=function(e){var t=e.getAttribute(dt.GROWING_GTITLE)||e.getAttribute(dt.GROWING_TITLE)||e.getAttribute(dt.GROWING_TITLE_OLD)||e.getAttribute("title");return null==t?void 0:t.trim()};function vt(e){var t=e.node;return e.list?mt(t):(0,gt.filterText)(t.textContent)||void 0}function mt(e){for(var t=void 0,n=!1,i=0,r=(0,ft.default)(e.childNodes);i-1?n.slice(0,i):n}}(t);case"svg":return function(e){for(var t=0,n=(0,ft.default)(e.childNodes);t0)return n[n.length-1]}}(t);case"label":return vt(a);case"input":return function(e){if((0,ut.clickableInput)(e))return e.value;if("password"!==e.type&&(0,ut.hasValidAttribute)(e,dt.GROWING_TRACK))return e.value;if((0,ut.changeableInput)(e)){var t=(0,ut.findParent)(e,(function(e){return"LABEL"===e.nodeName}));if(!t&&e.id)for(var n=document.body.getElementsByTagName("label"),i=0;i0)return o+" ("+e.checked+")"}return e.value}}(t);case"select":return i=t,(0,ft.default)(i.options).filter((function(e){return e.selected})).map((function(e){return e.label})).join(", ")||i.value;case"form":return It(t)}return(0,ut.isLeaf)(t)?function(e){var t=(0,gt.filterText)(e.textContent);if(t)return t}(t):(0,ut.isParentOfLeaf)(t)&&!(0,ut.onlyContainsIconChildren)(t)?function(e){for(var t="",n=0,i=(0,ft.default)(e.childNodes);nn;n++)for(var r in t=arguments[n])({}).hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},Nt.apply(this,arguments)},Ct=y&&y.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Me,"__esModule",{value:!0});var xt,Pt,At=Fe,Dt=ze,Lt=Ct(Je),Rt=function(){function e(e,t,n){void 0===t&&(t=null),void 0===n&&(n=!0),this.origin=e,this.action=t,this.direct=n,this.target="self"===t?e:(0,Dt.getEffectiveNode)(e),this.ignore=(0,Dt.isIgnore)(this.target),this.vnode=new Lt.default(this.target),this.tagName=this.vnode.tagName}return Object.defineProperty(e.prototype,"content",{get:function(){return this.vnode.content},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"href",{get:function(){return this.vnode.href},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"index",{get:function(){return this.vnode.index},enumerable:!1,configurable:!0}),e.prototype.inferParentIndex=function(){var t=this;return this.parentIndex||(0,Dt.findParent)(this.target,(function(n){var i=new e(n,t.action,!1);i.traceable()&&i.index&&(t.parentIndex=i.index)})),this.parentIndex},Object.defineProperty(e.prototype,"xpath",{get:function(){return this.vnode.xpath},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fullXpath",{get:function(){return this.vnode.fullXpath},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"skeleton",{get:function(){return this.vnode.skeleton},enumerable:!1,configurable:!0}),e.prototype.info=function(e){return void 0===e&&(e=!0),e&&this.inferParentIndex(),{skeleton:this.skeleton,fullXpath:this.fullXpath,xpath:this.xpath,content:this.content,href:this.href,index:this.parentIndex||this.index}},e.prototype.traceable=function(){if(this.ignore)return!1;if(this.direct){if("click"===this.action||"hover"===this.action){if(-1!==At.UNSUPPORTED_CLICK_TAGS.indexOf(this.target.tagName))return!1;if("INPUT"===this.target.tagName&&!(0,Dt.clickableInput)(this.target))return!1;if(!(0,Dt.isContainerTag)(this.target)&&!(0,Dt.depthInside)(this.target,5))return!1}return!0}return this.vnode.container},e.prototype.trackNodes=function(){if(!this.traceable())return[];var e=[this];if("submit"!==this.action)for(var t=this.parentElement;t;){if(t.ignore)return[];t.traceable()&&e.unshift(t),t=t.parentElement}var n=void 0;return e.map((function(e){var t=e.info(!1),i=t.index;return!n&&i&&(n=i),Nt(Nt({},t),{index:n||i})}))},Object.defineProperty(e.prototype,"parentElement",{get:function(){var t=this.target.parentNode;if(t&&t.nodeName&&!(0,Dt.isRootNode)(t))return new e(t,this.action,!1)},enumerable:!1,configurable:!0}),e}(),kt=Me.default=Rt,Ut=function(){function e(e){this.handler=e;var t=navigator.userAgent,n=/chrome/i.exec(t),i=/android/i.exec(t);this.hasTouch="ontouchstart"in window&&!(n&&!i)}return e.prototype.main=function(){for(var e=this.hasTouch?["touchstart"]:["mousedown"],t=this.hasTouch?["touchend","touchcancel"]:["mouseup","mouseleave"],n=this.hasTouch?["touchmove"]:["mousemove"],i=0,r=e;r.length>i;i++)ie(window,r[i],this.touchStartHandler.bind(this));for(var o=0,a=n;a.length>o;o++)ie(window,a[o],this.touchMoveHandler.bind(this));for(var s=0,u=t;u.length>s;s++)ie(window,u[s],this.touchStopHandler.bind(this))},e.prototype.touchStartHandler=function(e){if(1>=e.which){var t=+Date.now();this.safeguard!==t&&(this.touchTimeout&&clearTimeout(this.touchTimeout),this.safeguard=t,this.touchEvent={time:t,target:e.target,x:this._page("x",e),y:this._page("y",e),isTrusted:!0,type:"click"})}},e.prototype.touchMoveHandler=function(e){var t=Math.abs(this._page("x",e)-(this.touchEvent&&this.touchEvent.x)||0),n=Math.abs(this._page("y",e)-(this.touchEvent&&this.touchEvent.y)||0);(t>10||n>10)&&(this.touchEvent=null)},e.prototype.touchStopHandler=function(e){var t=this,n=+Date.now()-(this.touchEvent&&this.touchEvent.time)||0;this.touchEvent&&200>n?this.touchTimeout=setTimeout((function(){t.handler(t.touchEvent),t.touchEvent=null}),200):this.touchEvent&&n>=200&&700>n&&(this.handler(this.touchEvent),this.touchEvent=null)},e.prototype._page=function(e,t){return(this.hasTouch?t.touches[0]:t)["page".concat(e.toUpperCase())]},e}(),Gt={name:"gioEventAutoTracking",method:function(e){var t=this;this.growingIO=e,this.main=function(){ie(document,"submit",t._handleAction),ie(document,"change",t._handleAction),t.growingIO.vdsConfig.touch?new Ut(t._handleAction).main():ie(document,"click",t._handleAction)},this._handleAction=function(e,i){var r=t.growingIO,o=r.vdsConfig,a=r.emitter;if(!o.autotrack)return!1;var s=e.target;if(!s)return!1;var u=new kt(s,e.type,!0).trackNodes();if("click"!==e.type&&(u=Y(L(u))?[]:[L(u)]),Y(u))return!1;null==a||a.emit("onComposeBefore",{event:i,params:null!=e?e:{}}),u.forEach((function(i){var r=i.fullXpath,a=i.index,s=i.content,u=i.href;if(!W(i.fullXpath||"","/div#__vconsole")&&!W(i.fullXpath||"","/div#__giokit")&&(o.debug&&console.log("Action:",e.type,Date.now()),r)){var c=t.growingIO.dataStore,d=c.eventContextBuilder,l=c.eventConverter,g=c.currentPage;l(n(n({eventType:w[e.type],element:[{xpath:r,index:a,textValue:s,hyperlink:u}]},d()),{pageShowTimestamp:g.time}))}}))}}},qt=["VIEW_CLICK","VIEW_CHANGE","FORM_SUBMIT","PAGE","CUSTOM","LOGIN_USER_ATTRIBUTES"],Ht=["LOGIN_USER_ATTRIBUTES"],jt={name:"gioHybridAdapter",method:function(e){var t=this;this.growingIO=e,this.penetrateHybrid=!0,this.onOptionsInit=function(){var e=t.growingIO,n=e.vdsConfig,i=e.emitter;S(n.penetrateHybrid)&&(t.penetrateHybrid=n.penetrateHybrid),t._initHybridBridge()&&(t.onSendBefore=t.sendBeforeListener,t.hybridConfig.projectId===t.growingIO.vdsConfig.projectId&&(t.growingIO.useHybridInherit=!0)),t.growingIO.useHybridInherit&&(null==i||i.on(De,(function(e){var n=e.newUserId,i=e.oldUserId,r=e.userKey;t.penetrateHybrid&&(!n&&i?r?t._clearNativeUserIdAndUserKey():t._clearNativeUserId():r?t._setNativeUserIdAndUserKey(j(n),j(r)):t._setNativeUserId(j(n)))})),null==i||i.on(Le,(function(e){var n=e.newUserKey,i=e.oldUserKey,r=e.userId;t.penetrateHybrid&&(!n&&i?t._clearNativeUserIdAndUserKey():t._setNativeUserIdAndUserKey(j(r),j(n)))})))},this._initHybridBridge=function(){var e,n,i,r=!1;return t.hasHybridBridge=!!window.GrowingWebViewJavascriptBridge,t.hasHybridBridge?((null===(e=null===window||void 0===window?void 0:window.GrowingWebViewJavascriptBridge)||void 0===e?void 0:e.configuration)||(window.GrowingWebViewJavascriptBridge.configuration=JSON.parse(window.GrowingWebViewJavascriptBridge.getConfiguration())),(null===(n=null===window||void 0===window?void 0:window.GrowingWebViewJavascriptBridge)||void 0===n?void 0:n.configuration)&&(t.hybridConfig=null===(i=null===window||void 0===window?void 0:window.GrowingWebViewJavascriptBridge)||void 0===i?void 0:i.configuration),r=!0):xt.consoleText("gioHybridAdapter:当前不存在 GrowingWebViewJavascriptBridge,Web模式。","info"),r},this.sendBeforeListener=function(e){var i=e.requestData;if(t.hasHybridBridge){var r=t.processAttributes(n({},i));q(qt,r.eventType)&&(q(Ht,r.eventType)?t.penetrateHybrid&&t._dispatchEvent(r):(t.penetrateHybrid||Z(r,["userId","userKey","cs1"]),t._dispatchEvent(r)))}},this.processAttributes=function(e){return X(e,(function(t,n){N(t)||P(t)?X(e[n],(function(t,i){N(t)||P(t)?e[n][i]=JSON.stringify(t):e[n][i]=j(t)})):e[n]=j(t)})),e},this._setNativeUserId=function(e){te((function(){return window.GrowingWebViewJavascriptBridge.setNativeUserId(e)}))},this._clearNativeUserId=function(){te((function(){return window.GrowingWebViewJavascriptBridge.clearNativeUserId()}))},this._setNativeUserIdAndUserKey=function(e,t){te((function(){return window.GrowingWebViewJavascriptBridge.setNativeUserIdAndUserKey(e,t)}))},this._clearNativeUserIdAndUserKey=function(){te((function(){return window.GrowingWebViewJavascriptBridge.clearNativeUserIdAndUserKey()}))},this._dispatchEvent=function(e){te((function(){var t;return null===(t=window.GrowingWebViewJavascriptBridge)||void 0===t?void 0:t.dispatchEvent(JSON.stringify(e))}))};var i=this.growingIO,r=i.emitter,o=i.utils;xt=o,r.on(xe,this.onOptionsInit)}},Bt=["i","span","em","b","strong","svg"];!function(e){e[e.OUTER=0]="OUTER",e[e.INNER_COVERED=1]="INNER_COVERED",e[e.INNER_SHOW=2]="INNER_SHOW"}(Pt||(Pt={}));var Kt,Wt=i(["HR","BR","SCRIPT","NOSCRIPT","STYLE","HEAD","BASE","LINK","META","TITLE","BODY","HTML","TEMPLATE","CODE"],Fe.UNSUPPORTED_CLICK_TAGS,!0),Vt=["SELECT","A","BUTTON","INPUT","IMG","FORM"],Mt=function(e,t,n){return document.elementFromPoint(t,n)===e},Ft=function(){function e(e,t,n){this.node=e,this.parentNodeDesc=t,this.devicesInfo=n,this.proxy=new kt(e),this.tagName=this.node.tagName,this.name=this.tagName.toLowerCase(),this.isIgnore=!!this.node.dataset.growingIgnore,this.isUnSupported=-1!==Wt.indexOf(this.tagName),this.rect=this.computeWindowRect()}return e.prototype.info=function(){var e=this.desc();e.zLevel+=this.devicesInfo.webviewZLevel;var t=this.getDeviceRect(this.rect);return Z(e,"isContainer"),n(n(n({},e),t),{parentXPath:this.parentNodeDesc.isContainer?this.parentNodeDesc.xpath:void 0,href:this.proxy.href,content:this.proxy.content,nodeType:this.nodeType()})},e.prototype.nodeType=function(){return"input"!==this.name||ze.changeableInput(this.node)?this.node.tagName:"INPUT_BTN"},e.prototype.desc=function(){return{index:this.parentNodeDesc.index||this.proxy.index,zLevel:this.zLevel(),xpath:this.proxy.xpath,isContainer:this.isDefinedContainer()}},e.prototype.cssVisible=function(){var e=this.computedStyle();return Number(e.opacity)>0&&"visible"===e.visibility&&"none"!==e.display},e.prototype.viewportStatus=function(){var e=this.rect,t=e.top,n=e.left,i=e.width,r=e.height,o=this.devicesInfo,a=o.winWidth,s=o.winHeight;if(0>=i||0>=r)return Pt.OUTER;var u=this.node;return s>t&&a>n&&i>0&&r>0?Mt(u,n+i/2,t+r/2)||Mt(u,n+1,t+1)||Mt(u,n+i-1,t+1)||Mt(u,n+1,t+r-1)||Mt(u,n+i-1,t+r-1)?Pt.INNER_SHOW:Pt.INNER_COVERED:Pt.OUTER},e.prototype.isCircleable=function(){return this.proxy.target===this.proxy.origin&&(!!this.isDefinedContainer()||!("input"===this.name&&this.node instanceof HTMLInputElement&&"password"===this.node.type)&&(-1!==Vt.indexOf(this.name)||(ze.isLeaf(this.node)?!this.isBigBlank():this.hasBackgroundImage()&&ze.depthInside(this.node,4))))},e.prototype.isSimpleContainer=function(){return"select"===this.name||this.isDefaultContainer()&&(function(e,t){if(0===e.children.length)return!1;for(var n=0,i=H(e.children);n0)for(var n=0;ns>>1||o>u>>1)},e.prototype.hasBackgroundImage=function(){var e=this.computedStyle().backgroundImage;return!!e&&"none"!==e&&e.length>0},e.prototype.zLevel=function(){var e=this.computedStyle(),t=e.zIndex;if("auto"!==t)return Number(t||"0")+this.parentNodeDesc.zLevel;switch(e.position){case"relative":return this.parentNodeDesc.zLevel+2;case"sticky":return this.parentNodeDesc.zLevel+3;case"absolute":return this.parentNodeDesc.zLevel+4;case"fixed":return this.parentNodeDesc.zLevel+5;default:return this.parentNodeDesc.zLevel+1}},e.prototype.computeWindowRect=function(){if(this.rect)return this.rect;var e=this.node.getBoundingClientRect(),t=e.top,n=e.bottom,i=e.left,r=e.right-i,o=n-t;return 0>t?o=t+o:t+o>this.devicesInfo.winHeight&&(o=this.devicesInfo.winHeight-t),0>i?r=i+r:i+r>this.devicesInfo.winWidth&&(r=this.devicesInfo.winWidth-i),this.rect={top:t,left:i,width:r,height:o},this.rect},e.prototype.computedStyle=function(){return window.getComputedStyle(this.node)},e.prototype.getDeviceRect=function(e){var t=this.devicesInfo,n=t.scale,i=t.webviewTop,r=t.webviewLeft;return{top:e.top*n+i,left:e.left*n+r,width:e.width*n,height:e.height*n}},e}(),zt=["DOMContentLoaded","onreadystatechange"],Xt=["scroll","resize","load","beforeunload","popstate","hashchange","pagehide","unload"],Jt=function(){function e(e){this.growingIO=e,this.addDomChangeListener()}return e.prototype.getDomTree=function(e,t,n,i,r,o){var a=function(e,t,n,i,r){var o=document.documentElement.clientWidth;return{winWidth:o,winHeight:document.documentElement.clientHeight,scale:n/o,webviewTop:t,webviewLeft:e,webviewWidth:n,webviewHeight:i,webviewZLevel:r}}(e,t,n,i,r),s=this.getElementsByParent(o||document.body,{isContainer:!1,zLevel:0},a),u=this.growingIO.dataStore.currentPage;return{page:{domain:u.domain,path:u.path,query:u.query,title:u.title},elements:s}},e.prototype.getElementsByParent=function(e,t,n){var i=this,r=[];return[].slice.call(e.childNodes,0).filter((function(e){return 1===e.nodeType})).forEach((function(e){var o=new Ft(e,t,n);if(o.cssVisible()&&!o.isIgnore){switch(o.viewportStatus()){case Pt.INNER_SHOW:o.isCircleable()&&r.push(o.info());break;case Pt.INNER_COVERED:o.isDefaultContainer()&&r.push(o.info())}o.isSimpleContainer()||[].push.apply(r,i.getElementsByParent(e,o.desc(),n))}})),r},e.prototype.addDomChangeListener=function(){var e,t=function(t){return void 0===t&&(t=""),function(){var n;"beforeunload"===t&&e&&e.disconnect(),null===(n=window.GrowingWebViewJavascriptBridge)||void 0===n||n.onDomChanged()}};(e=new MutationObserver(t("mutation"))).observe(document.body,{attributes:!0,characterData:!0,childList:!0,subtree:!0}),zt.forEach((function(e){ie(document,e,t(e))})),Xt.forEach((function(e){ie(window,e,t(e))}))},e}(),Zt=function(){function e(t){var n,i=this;this.growingIO=t,null===(n=this.growingIO.emitter)||void 0===n||n.on(Pe,(function(){if(window.GrowingWebViewJavascriptBridge){var t=i;window.GrowingWebViewJavascriptBridge.getDomTree=function(){if(arguments.length>=4)return e.bindGetDomTree(t.growingIO),e.domHelper.getDomTree.apply(e.domHelper,arguments)}}}))}return e.bindGetDomTree=function(e){this.domHelper||(this.domHelper=new Jt(e),window.GrowingWebViewJavascriptBridge.getDomTree=this.domHelper.getDomTree.bind(this.domHelper))},e}(),Yt={name:"gioHybridCircle",method:Zt},Qt={name:"gioImpressionTracking",method:function(e){var t,n=this;this.growingIO=e,this.documentReady=!1,this.main=function(e){"listener"===e?(n.documentReady=!0,n.growingIO.gioSDKInitialized&&n.initMutationObserver()):"emitter"===e&&n.documentReady&&n.initMutationObserver()},this.initIntersectionObserver=function(){n.intersectionObserver=new IntersectionObserver((function(e){Y(e)||e.map((function(e){var t=e.target,i=t.dataset,r=t.id;if(e.intersectionRatio>0){var o=n.getImpressionProperties(i),a=o.eventId,s=o.properties,u=o.items;if(r){if("once"===i.gioImpType&&F(n.sentImps,r))return;n.sentImps[r]={eventId:a,properties:s,items:u}}a&&n.growingIO.track(a,s,u)}}))}))},this.initMutationObserver=function(){var e;n.mutationObserver&&(null===(e=n.mutationObserver)||void 0===e||e.disconnect());var t=document.querySelectorAll("[data-gio-imp-track]");H(t).map((function(e){var t;null===(t=n.intersectionObserver)||void 0===t||t.observe(e)})),n.mutationObserver=new MutationObserver((function(e){e.map((function(e){var t,i;"attributes"===e.type&&(null===(t=e.target.dataset)||void 0===t?void 0:t.gioImpTrack)&&(null===(i=n.intersectionObserver)||void 0===i||i.observe(e.target))}))})),n.mutationObserver.observe(document.body,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0,attributeFilter:["data-gio-imp-track","data-gio-imp-attrs","data-gio-imp-items",/^data-gio-track-[a-z]+$/i]})},this.getImpressionProperties=function(e){var t={eventId:void 0,properties:{}};if(!(null==e?void 0:e.gioImpTrack))return t;if(t.eventId=e.gioImpTrack,F(e,"gioImpAttrs"))t.properties=te((function(){return N(e.gioImpAttrs)?e.gioImpAttrs:JSON.parse(e.gioImpAttrs)})),t.items=te((function(){return N(e.gioImpItems)?e.gioImpItems:JSON.parse(e.gioImpItems)}));else{var n=/^gioTrack(.+)/;for(var i in e){var r=void 0,o=i.match(n);o&&"track"!==(r=K(o[1]))&&(t.properties[r]=e[i])}}return t.properties=ne(t.properties),t.items=ne(t.items),/^\w+$/.test(t.eventId)&&!Number.isInteger(Number(D(t.eventId.split(""))))||(t.eventId=null,t={}),t},this.sentImps={},window.IntersectionObserver&&window.MutationObserver?(this.initIntersectionObserver(),ie(document,"readystatechange",(function(){q(["interactive","complete"],document.readyState)&&n.main("listener")}),{once:!0}),null===(t=this.growingIO.emitter)||void 0===t||t.on(Pe,(function(){return n.main("emitter")})),ie(window,"unload",(function(){var e,t;null===(e=n.intersectionObserver)||void 0===e||e.disconnect(),null===(t=n.mutationObserver)||void 0===t||t.disconnect()}))):ee("当前浏览器不支持半自动埋点,gioImpressionTracking已自动关闭!","warn")}},$t={name:"gioWebCircle",method:function(e){var t,n=this;this.growingIO=e,this.injectCircle=function(e,t){var n=document.createElement("link"),i=document.createElement("script");n.rel="stylesheet",n.href=e,i.src=t,document.head.appendChild(n),document.head.appendChild(i)},null===(t=this.growingIO.emitter)||void 0===t||t.on(Pe,(function(){window.addEventListener("message",(function(e){var t=e.data,i=e.source,r=window.vds;if(t&&i){var o=i.vds,a=t.cssURL,s=t.jsURL;o&&"SDK_INJECT_CIRCLE_SCRIPT"===t.type&&r.projectId===o.projectId&&r.dataSourceId===o.dataSourceId&&n.injectCircle(a,s)}}))}))}},en=["gioPerformance"],tn=function(e){function n(t){var n=e.call(this,t)||this;return n.growingIO=t,n.growingIO.gioSDKFull=!0,n.pluginsContext={plugins:{gioCompress:Re,gioCustomTracking:ke,gioEmbeddedAdapter:Ve,gioEventAutoTracking:Gt,gioHybridAdapter:jt,gioHybridCircle:Yt,gioImpressionTracking:Qt,gioWebCircle:$t}},n}return t(n,e),n}((function(e){var t,n,i,r,o=this;this.growingIO=e,this.innerPluginInit=function(){var e;en.forEach((function(e){var t;return Z(null===(t=o.pluginsContext)||void 0===t?void 0:t.plugins,e)})),z(null===(e=o.pluginsContext)||void 0===e?void 0:e.plugins).forEach((function(e){var t,n=null===(t=o.pluginsContext)||void 0===t?void 0:t.plugins[e],i=n.name,r=n.method;U(o.pluginItems,(function(e){return e.name===i}))||o.pluginItems.push({name:K(i||e),method:r||function(e){}})})),Y(o.pluginItems)||o.installAll()},this.install=function(e,t,n){var i,r,a=t||U(o.pluginItems,(function(t){return t.name===e}));if((null===(i=o.growingIO)||void 0===i?void 0:i.plugins)[e])return ee("重复加载插件 ".concat(e," 或插件重名,已跳过加载!"),"warn"),!1;if(!a)return ee("插件加载失败!不存在名为 ".concat(e," 的插件!"),"error"),!1;try{return(null===(r=o.growingIO)||void 0===r?void 0:r.plugins)[e]=new a.method(o.growingIO,n),"cdp"===o.growingIO.gioEnvironment&&t&&ee("加载插件 ".concat(e),"info"),!0}catch(e){return ee("插件加载异常 ".concat(e),"error"),!1}},this.installAll=function(e){(e||o.pluginItems).forEach((function(t){o.install(t.name,e?t:void 0,e?null==t?void 0:t.options:void 0)&&!U(o.pluginItems,(function(e){return e.name===t.name}))&&o.pluginItems.push({name:K(t.name),method:t.method?t.method:function(){}})}))},this.uninstall=function(e){var t;Z(o.pluginItems,e);var n=Z(null===(t=o.growingIO)||void 0===t?void 0:t.plugins,e);return n||ee("卸载插件 ".concat(e," 失败!"),"error"),n},this.uninstallAll=function(){o.pluginItems.forEach((function(e){return o.uninstall(e.name)}))},this.lifeError=function(e,t){return ee("插件执行错误 ".concat(e.name," ").concat(t),"error")},this.onComposeBefore=function(e){o.pluginItems.forEach((function(t){var n,i=null===(n=o.growingIO.plugins[t.name])||void 0===n?void 0:n.onComposeBefore;if(i&&x(i))try{i(e)}catch(e){o.lifeError(t,e)}}))},this.onComposeAfter=function(e){o.pluginItems.forEach((function(t){var n,i=null===(n=o.growingIO.plugins[t.name])||void 0===n?void 0:n.onComposeAfter;if(i&&x(i))try{i(e)}catch(e){o.lifeError(t,e)}}))},this.onSendBefore=function(e){o.pluginItems.forEach((function(t){var n,i=null===(n=o.growingIO.plugins[t.name])||void 0===n?void 0:n.onSendBefore;if(i&&x(i))try{i(e)}catch(e){o.lifeError(t,e)}}))},this.onSendAfter=function(e){o.pluginItems.forEach((function(t){var n,i=null===(n=o.growingIO.plugins[t.name])||void 0===n?void 0:n.onSendAfter;if(i&&x(i))try{i(e)}catch(e){o.lifeError(t,e)}}))},this.pluginsContext={plugins:{}},this.pluginItems=[],null===(t=this.growingIO.emitter)||void 0===t||t.on("onComposeBefore",this.onComposeBefore),null===(n=this.growingIO.emitter)||void 0===n||n.on("onComposeAfter",this.onComposeAfter),null===(i=this.growingIO.emitter)||void 0===i||i.on("onSendBefore",this.onSendBefore),null===(r=this.growingIO.emitter)||void 0===r||r.on("onSendAfter",this.onSendAfter)})),nn=function(){function e(e){this.growingIO=e;var t=this.growingIO.vdsConfig.projectId,n=this.growingIO.storage,i=n.getItem,r=n.setItem,o=n.getKeys,a=n.removeItem;this.getItem=i,this.setItem=r,this.getKeys=o,this.removeItem=a,this.sIdStorageName="".concat(t,"_gdp_session_id"),this.uidStorageName="gdp_user_id_gioenc",this.userIdStorageName="".concat(t,"_gdp_cs1_gioenc"),this.userKeyStorageName="".concat(t,"_gdp_user_key_gioenc"),this.gioIdStorageName="".concat(t,"_gdp_gio_id_gioenc")}return Object.defineProperty(e.prototype,"sessionId",{get:function(){return this.getItem(this.sIdStorageName)||(this.sessionId=ge(),this.sessionId)},set:function(e){var t,n=this;e||(e=ge());var i=this.getItem(this.sIdStorageName)||this.prevSessionId,r=this.growingIO.vdsConfig.sessionExpires,o=void 0===r?30:r;this.setItem(this.sIdStorageName,e,+Date.now()+60*o*1e3),i!==e&&(this.getKeys().filter((function(e){return/.+_gdp_session_id_.{36}/.test(e)})).forEach((function(e){n.removeItem(e)})),this.setItem(this.growingIO.dataStore.visitStorageName,""),null===(t=this.growingIO.emitter)||void 0===t||t.emit(Ae,{newSessionId:e,oldSessionId:i})),this.prevSessionId=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"uid",{get:function(){return this.getItem(this.uidStorageName)||(this.uid=ge(),this.uid)},set:function(e){var t,n=this.getItem(this.uidStorageName)||this.prevUId;this.setItem(this.uidStorageName,e),n!==e&&(null===(t=this.growingIO.emitter)||void 0===t||t.emit("UID_UPDATE",{newUId:e,oldUId:n})),this.prevUId=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"userId",{get:function(){return this.getItem(this.userIdStorageName)||""},set:function(e){var t,n,i=this.getItem(this.userIdStorageName)||this.prevUserId;this.setItem(this.userIdStorageName,e),null===(t=this.growingIO.emitter)||void 0===t||t.emit(De,{newUserId:e,oldUserId:i,userKey:this.userKey}),i!==e&&(null===(n=this.growingIO.emitter)||void 0===n||n.emit("USERID_UPDATE",{newUserId:e,oldUserId:i,userKey:this.userKey})),e&&(this.gioId=e),this.prevUserId=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"userKey",{get:function(){return this.getItem(this.userKeyStorageName)||""},set:function(e){var t,n,i=this.getItem(this.userKeyStorageName)||this.prevUserKey;this.setItem(this.userKeyStorageName,e),null===(t=this.growingIO.emitter)||void 0===t||t.emit(Le,{newUserKey:e,oldUserKey:i,userId:this.userId}),i!==e&&(null===(n=this.growingIO.emitter)||void 0===n||n.emit("USERKEY_UPDATE",{newUserKey:e,oldUserKey:i,userId:this.userId})),this.prevUserKey=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"gioId",{get:function(){return this.getItem(this.gioIdStorageName)||""},set:function(e){var t,n=this.getItem(this.gioIdStorageName)||this.prevGioId;this.setItem(this.gioIdStorageName,e),n!==e&&(null===(t=this.growingIO.emitter)||void 0===t||t.emit("GIOID_UPDATE",{newGioId:e,oldGioId:n})),this.prevGioId=e},enumerable:!1,configurable:!0}),e}(),rn=function(e){var t=this;this.growingIO=e,this.main=function(){var e,i,r=t.growingIO,o=r.sdkVersion,a=r.useEmbeddedInherit,s=r.vdsConfig,u=r.userStore,c=r.dataStore,d=r.trackingId,l=c.currentPage,g=l.path,f=l.query,h={appVersion:s.version,dataSourceId:s.dataSourceId,deviceId:u.uid,domain:a?s.appId:window.location.host,gioId:u.gioId,language:navigator.language,path:g,platform:s.platform,query:f,referralPage:(null===(e=c.lastPageEvent)||void 0===e?void 0:e.referralPage)||"",screenHeight:window.screen.height,screenWidth:window.screen.width,sdkVersion:o,sessionId:u.sessionId,timestamp:+Date.now(),title:null!==(i=te((function(){return document.title.slice(0,255)})))&&void 0!==i?i:"",userId:u.userId};if(s.enableIdMapping&&(h.userKey=u.userKey),Y(s.ignoreFields)||s.ignoreFields.forEach((function(e){Z(h,e)})),a&&!Y(t.minpExtraParams)){var p=n({},h);X(n(n({},h),t.minpExtraParams),(function(e,n){var i;q(s.embeddedIgnore,n)?(h[n]=p[n],"domain"===n&&(h[n]=window.location.host)):h[n]=null!==(i=t.minpExtraParams[n])&&void 0!==i?i:h[n]}))}return h.trackingId=d,h},this.minpExtraParams={}},on=function(e){var t=this;this.growingIO=e,this.parsePage=function(){var e=t.growingIO.vdsConfig.hashtag,n=location.pathname,i=location.search,r=location.hash,o=r.indexOf("?");t.domain=window.location.host,t.title=document.title.slice(0,255),t.time=+Date.now(),t.path=n,t.query=i,e&&(o>-1?(t.path+=r.slice(0,o),t.query=t.query+"&"+r.slice(o+1)):t.path+=r),t.query&&q(["?","&"],t.query.charAt(0))&&(t.query=t.query.slice(1))},this._getNoHashHref=function(){var e=window.location,t=e.protocol,n=e.host,i=e.pathname,r=e.search;return"".concat(t,"://").concat(n).concat(i).concat(r)},this.getReferralPage=function(){var e,n,i=t.growingIO.dataStore.lastPageEvent;return(null==i?void 0:i.path)===t.path&&(null!==(e=null==i?void 0:i.query)&&void 0!==e?e:"")===(null!==(n=t.query)&&void 0!==n?n:"")?null==i?void 0:i.referralPage:(null==i?void 0:i.path)?t.lastHref:document.referrer},this.pageListener=function(){var e=t.growingIO.vdsConfig.hashtag,n=window.location.href,i=t.lastHref;e||(n=t._getNoHashHref(),i=t.lastNoHashHref),i!==n&&(t.parsePage(),t.buildPageEvent())},this.hookHistory=function(){var e=window.history.pushState,n=window.history.replaceState,i=t;e&&te((function(){return window.history.pushState=function(){e.apply(window.history,arguments),setTimeout(i.pageListener)}})),n&&te((function(){return window.history.replaceState=function(){n.apply(window.history,arguments),setTimeout(i.pageListener)}})),ie(window,"popstate",t.pageListener),t.growingIO.vdsConfig.hashtag&&ie(window,"hashchange",t.pageListener)},this.buildPageEvent=function(e){var i=t.growingIO.dataStore;i.lastPageEvent;var r=i.eventContextBuilder,o=i.eventConverter,a=n(n({eventType:"PAGE"},r()),{protocolType:location.protocol.substring(0,location.protocol.length-1),referralPage:t.getReferralPage()});Y(e)||(a=n(n({},a),e)),a.timestamp=t.time,o(a),t.lastHref=window.location.href,t.lastNoHashHref=t._getNoHashHref(),t.lastLocation=n({},window.location)},this.title=document.title.slice(0,255),this.lastLocation=n({},window.location)},an={referralPage:document.referrer},sn=function(){function e(e){var t,i,u,c=this;this.growingIO=e,this.ALLOW_SETTING=n(n({},o),"saas"===this.growingIO.gioEnvironment?s:a),this.allowOptKeys=Object.keys(this.ALLOW_SETTING),this.trackTimers={},this.setSequenceIds=function(e,t){var i=c.growingIO.storage.getItem(c.seqStorageIdName)||{};"gsid"===e?i.globalKey=t:i=n(n({},i),t),c.growingIO.storage.setItem(c.seqStorageIdName,i)},this.initOptions=function(e){var t,i,o,a,s,u,d,l=e.projectId,g=e.dataSourceId,f=e.appId;c.initialDataSourceId=g;var h={};c.allowOptKeys.forEach((function(t){var n=c.ALLOW_SETTING[t].type,i=P(n)?!q(n,Q(e[t])):Q(e[t])!==n;"platform"!==t||q(r,e[t])||(i=!0),i?h[t]=c.ALLOW_SETTING[t].default:"ignoreFields"===t?h.ignoreFields=e.ignoreFields.filter((function(e){return q(I,e)})):(h[t]=e[t],q(["dataCollect","autotrack"],t)&&(h[t]||ee("已关闭".concat(v[t]),"info")))})),h.sessionExpires=Math.round(h.sessionExpires),(E(h.sessionExpires)||1>h.sessionExpires||h.sessionExpires>360)&&(h.sessionExpires=30),h.storageType=h.storageType.toLowerCase(),h.sendType=h.sendType.toLowerCase(),q(["beacon","xhr","image"],h.sendType)||(h.sendType="beacon"),!E(Number(h.requestTimeout))&&h.requestTimeout>0||(h.requestTimeout=5e3),c.growingIO.vdsConfig=n(n(n({},null!==(t=window.vds)&&void 0!==t?t:{}),h),{projectId:l,dataSourceId:g,appId:f,performance:{monitor:null===(o=null===(i=h.performance)||void 0===i?void 0:i.monitor)||void 0===o||o,exception:null===(s=null===(a=h.performance)||void 0===a?void 0:a.exception)||void 0===s||s,network:null!==(d=null===(u=h.performance)||void 0===u?void 0:u.network)&&void 0!==d&&d}}),window.vds=c.growingIO.vdsConfig,c.seqStorageIdName="".concat(l,"_gdp_sequence_ids"),c.visitStorageName="".concat(l,"_gdp_session_id_sent")},this.setOption=function(e,t){var i,r=c.growingIO,o=r.vdsConfig,a=r.callError,s=r.uploader,u=r.emitter,d=T(e)&&q(p,e),l=d&&typeof t===((null===(i=c.ALLOW_SETTING[e])||void 0===i?void 0:i.type)||"string"),g=n({},o);return d&&l?(o[e]=t,"dataCollect"===e&&g.dataCollect!==t&&(t?(c.sendVisit(!0),c.sendPage()):c.growingIO.clearTrackTimer()),q(["host","scheme"],e)&&(null==s||s.generateHost()),null==u||u.emit("OPTION_CHANGE",{optionName:e,optionValue:t}),window.vds[e]=t,!0):(a("setOption > ".concat(e)),!1)},this.getOption=function(e){var t=c.growingIO,i=t.vdsConfig,r=t.callError;return e&&F(i,j(e))?i[j(e)]:b(e)?n({},i):void r("getOption > ".concat(e))},this.sendVisit=function(e){var t=c.growingIO,n=t.userStore.sessionId,i=t.storage.getItem(c.visitStorageName);!e&&n===i||(c.lastVisitEvent.timestamp=c.currentPage.time-1,c.buildVisitEvent())},this.buildVisitEvent=function(e){var t=c.growingIO,i=t.dataStore,r=i.eventContextBuilder,o=i.eventConverter,a=t.emitter,s=t.storage,u=t.userStore,d=c.lastVisitEvent,l=d.referralPage,g=d.title,f=d.path,h=d.query,p=d.timestamp,v=n(n({eventType:"VISIT"},r()),{referralPage:l||c.currentPage.getReferralPage(),timestamp:p});f&&(v.title=g,v.path=f,v.query=h),Y(e)||(v.session=(null==e?void 0:e.session)||v.session,v.trackingId=null==e?void 0:e.trackingId,v=n(n({},v),e));var m=function(e){var t=e.requestData;"VISIT"===t.eventType&&t.trackingId===c.growingIO.trackingId&&(u.sessionId===t.sessionId&&s.setItem(c.visitStorageName,t.sessionId),a.off("onSendAfter",m))};a.on("onSendAfter",m),o(v)},this.sendPage=function(e){e&&c.currentPage.parsePage(),c.currentPage.buildPageEvent()},this.buildErrorEvent=function(e){var t=c.growingIO.dataStore,i=t.eventContextBuilder;(0,t.eventConverter)(n({eventType:"CUSTOM",pageShowTimestamp:c.currentPage.time,eventName:"onError",attributes:e},i()))},this.currentPage=new on(this.growingIO),this.eventContextBuilderInst=new rn(this.growingIO),this.eventContextBuilder=this.eventContextBuilderInst.main,this.generalProps={},this.lastVisitEvent=an,null===(t=this.growingIO.emitter)||void 0===t||t.on("onComposeAfter",(function(e){var t=e.composedEvent;"VISIT"!==t.eventType&&"vst"!==t.t||t.trackingId!==c.growingIO.trackingId||(c.lastVisitEvent=t)})),this.lastPageEvent={},null===(i=this.growingIO.emitter)||void 0===i||i.on("onComposeAfter",(function(e){var t=e.composedEvent;"PAGE"!==t.eventType&&"page"!==t.t||t.trackingId!==c.growingIO.trackingId||(c.lastPageEvent=t)})),null===(u=this.growingIO.emitter)||void 0===u||u.on(Ae,(function(){if(c.growingIO.gioSDKInitialized){c.currentPage.parsePage();var e=c.currentPage,t=e.title,n=e.path,i=e.query,r=e.time,o=e.getReferralPage;c.lastVisitEvent={referralPage:document.referrer||o(),title:t,path:n,query:i,timestamp:r-1},c.sendVisit(!0),c.sendPage(!0)}}))}return Object.defineProperty(e.prototype,"esid",{get:function(){var e=this,t=this.growingIO.storage.getItem(this.seqStorageIdName)||{},i=n({},t);return Z(i,"globalKey"),i=N(i)&&!b(i)?i:{},this._esid={},z(i).forEach((function(t){e._esid[t]=E(Number(i[t]))||i[t]>=1e9||1>i[t]?1:i[t]})),this._esid},set:function(e){var t={};z(e).forEach((function(n){t[n]=E(e[n])||e[n]>=1e9||1>e[n]?1:e[n]})),J(this._esid,t)||(this._esid=t,this.setSequenceIds("esid",this._esid))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"gsid",{get:function(){var e=this.growingIO.storage.getItem(this.seqStorageIdName)||{},t=Number(e.globalKey);return this._gsid=E(t)||t>=1e9||1>t?1:t,this._gsid},set:function(e){E(Number(e))||e>=1e9||1>e?this._gsid=1:this._gsid=e,this.setSequenceIds("gsid",this._gsid)},enumerable:!1,configurable:!0}),e}(),un=function(e){function i(t){var i=e.call(this,t)||this;return i.growingIO=t,i.eventConverter=function(e){var t,r,o=i.growingIO,a=o.vdsConfig,s=o.dataStore,u=o.uploader;if(a.dataCollect){e.trackingId===i.growingIO.trackingId&&(e.globalSequenceId=s.gsid,e.eventSequenceId=s.esid[e.eventType]||1);var c={};X(e,(function(e,t){var n;if("element"===t){var i=null!==(n=D(e))&&void 0!==n?n:{};X(i,(function(e,t){Y(e)&&0!==e||(c[t]=e)}))}else(Y(e)||b(e))&&0!==e||(c[t]=e)})),e.trackingId===i.growingIO.trackingId&&(i.growingIO.dataStore.gsid+=1,i.growingIO.dataStore.esid=n(n({},i.growingIO.dataStore.esid),((t={})[c.eventType]=(i.growingIO.dataStore.esid[c.eventType]||1)+1,t))),null===(r=i.growingIO.emitter)||void 0===r||r.emit("onComposeAfter",{composedEvent:n({},c)}),e.trackingId===i.growingIO.trackingId&&u.commitRequest(c)}else"VISIT"===e.eventType&&(i.lastVisitEvent=e)},i}return t(i,e),i}(sn),cn=function(e){function n(t){var n=e.call(this,t)||this;return n.growingIO=t,n.generateHost=function(){var e=n.growingIO.vdsConfig,t=e.scheme,i=e.host,r=void 0===i?"":i,o=e.projectId;t?V(j(t),"://")||(t="".concat(t,"://")):t="".concat(location.protocol.indexOf("http")>-1?location.protocol.replace(":",""):"https","//"),W(r,"http")&&(r=r.substring(r.indexOf("://")+(V(j(t),"://")?3:0))),n.requestURL="".concat(t).concat(r,"/v3/projects/").concat(o,"/collect")},n.requestURL="",n.generateHost(),n}return t(n,e),n}((function(e){var t=this;this.growingIO=e,this.getSendType=function(){var e=t.growingIO.vdsConfig.sendType;return"beacon"===e?function(){var e,t,n=!!(null===(e=null===window||void 0===window?void 0:window.navigator)||void 0===e?void 0:e.sendBeacon),i=window.navigator.userAgent;if(i.match(/(iPad|iPhone|iPod)/g)){var r=!(t=i.toLowerCase().match(/cpu.*os (.*?) like mac os/i))||2>t.length?0:+t[1].split("_").slice(0,2).join(".");return n&&r>13}return n}()?"beacon":"xhr":e},this.commitRequest=function(e){var i=n({},e);t.requestQueue.push(n(n({},i),{requestType:t.getSendType()})),t.initiateRequest()},this.initiateRequest=function(){var e,r,o;if(i([],t.requestQueue,!0).length>0&&t.requestingNum0?j(n).slice(0,1e3):""),t.userStore.userId=j(e).slice(0,1e3),i&&i!==t.userStore.userId&&(t.userStore.sessionId="")}else t.clearUserId(),t.callError("setUserId")},t.clearUserId=function(){t.userStore.userId="",t.userStore.userKey=""},t.track=function(e,i,r,o){var a,s;((null===(s=null===(a=t.plugins)||void 0===a?void 0:a.gioCustomTracking)||void 0===s?void 0:s.buildCustomEvent)||function(){})(e,n(n({},t.dataStore.generalProps),N(i)&&!Y(i)?i:{}),r,o)},t.sendPage=function(e){return t.dataStore.currentPage.buildPageEvent(e)},t.sendVisit=function(e){return t.dataStore.buildVisitEvent(e)},t.trackTimerStart=function(e,n){t.vdsConfig.dataCollect&&re(e,(function(){var i=ge();x(n)?(t.dataStore.trackTimers[i]={eventName:e,leng:0,start:+Date.now()},n(i)):ee("回调方法不合法,返回timerId失败!")}))},t.trackTimerPause=function(e){if(e&&t.dataStore.trackTimers[e]){var n=t.dataStore.trackTimers[e];n.start&&(n.leng=n.leng+(+Date.now()-n.start)),n.start=0}},t.trackTimerResume=function(e){if(e&&t.dataStore.trackTimers[e]){var n=t.dataStore.trackTimers[e];0===n.start&&(n.start=+Date.now())}},t.trackTimerEnd=function(e,i){if(t.vdsConfig.dataCollect)if(e&&t.dataStore.trackTimers[e]){var r=t.dataStore.trackTimers[e];if(0!==r.start){var o=+Date.now()-r.start;r.leng=o>0?r.leng+o:0}t.track(r.eventName,n(n({},i),{event_duration:r.leng>864e5?0:r.leng/1e3})),t.removeTimer(e)}else ee("未查找到对应的计时器,请检查!","error")},t.removeTimer=function(e){e&&t.dataStore.trackTimers[e]&&delete t.dataStore.trackTimers[e]},t.clearTrackTimer=function(){t.dataStore.trackTimers={}},t.dataStore=new un(t),t}return t(i,e),i}((function(){var e,t=this;this.trackingId="g0",this.init=function(e){var n,i,r,o,a;ee("Gio Web SDK 初始化中...","info");var s=t.dataStore,u=s.initOptions,c=s.currentPage,d=s.sendVisit,l=s.sendPage;u(e),t.storage=Ce(t.vdsConfig),t.initCallback(),null===(n=t.emitter)||void 0===n||n.emit(xe,t),null===(r=null===(i=t.plugins)||void 0===i?void 0:i.gioEventAutoTracking)||void 0===r||r.main(),c.hookHistory(),c.parsePage(),null===(o=t.emitter)||void 0===o||o.emit(Pe,t),ee("Gio Web SDK 初始化完成!","success"),t.useEmbeddedInherit||(t.dataStore.lastVisitEvent.timestamp=c.time,d()),l(),t.gioSDKInitialized=!0,t.vdsConfig.gioSDKInitialized=!0,window[t.vds]=t.vdsConfig,null===(a=t.emitter)||void 0===a||a.emit("SDK_INITIALIZED_COMPLATE",t)},this.setOption=function(e,n){if(q(p,e)){var i=t.dataStore.setOption(e,n);return i&&v[e]&&ee("已".concat(n?"开启":"关闭").concat(v[e]),"info"),i}return ee("不存在可修改的配置项:".concat(e,",请检查后重试!"),"warn"),!1},this.getOption=function(e){return t.dataStore.getOption(e)},this.setGeneralProps=function(e){N(e)&&!Y(e)?(t.dataStore.generalProps=n(n({},t.dataStore.generalProps),e),z(t.dataStore.generalProps).forEach((function(e){q([void 0,null],t.dataStore.generalProps[e])&&(t.dataStore.generalProps[e]="")}))):t.callError("setGeneralProps")},this.clearGeneralProps=function(e){P(e)&&!Y(e)?e.forEach((function(e){Z(t.dataStore.generalProps,e)})):t.dataStore.generalProps={}},this.reissuePage=function(){t.dataStore.sendPage()},this.notRecommended=function(){return ee("不推荐的方法使用,建议使用 gio('setOption', [optionName], [value])!","info")},this.callError=function(e,t,n){return void 0===t&&(t=!0),void 0===n&&(n="参数不合法"),ee("".concat(t?"调用":"设置"," ").concat(e," 失败,").concat(n,"!"),"warn")},this.updateImpression=function(){var e,n,i=null===(n=null===(e=t.plugins)||void 0===e?void 0:e.gioImpressionTracking)||void 0===n?void 0:n.main;i?i("emitter"):ee("updateImpression 错误! 请集成半自动埋点浏览插件后重试!","error")},this.gioEnvironment="cdp",this.sdkVersion="3.8.6",this.vds=window.gioCompatibilityVds?"gdp_vds":"vds",this.utils=n(n({},$),oe),this.emitter={all:e=e||new Map,on:function(t,n){var i=e.get(t);i?i.push(n):e.set(t,[n])},off:function(t,n){var i=e.get(t);i&&(n?i.splice(i.indexOf(n)>>>0,1):e.set(t,[]))},emit:function(t,n){var i=e.get(t);i&&i.slice().map((function(e){e(n)})),(i=e.get("*"))&&i.slice().map((function(e){e(t,n)}))}},this.useEmbeddedInherit=!1,this.useHybridInherit=!1,this.gioSDKInitialized=!1,this.plugins=new tn(this),this.plugins.innerPluginInit()}));return function(){var e,t,i,r,o,a=window.gioCompatibilityVds?"gdp_vds":"vds";if(null===(e=window[a])||void 0===e?void 0:e.gioSDKInstalled)return Kt=window.gdp,void ee("SDK重复加载,请检查是否重复加载SDK或接入其他平台SDK导致冲突!","warn");window[a]=n(n({},null!==(t=window[a])&&void 0!==t?t:{}),{gioSDKInstalled:!0});var s=new dn;Kt=function(){var e,t=arguments[0];if(T(t)&&q(h,t)&&s[t]){var i=R(H(arguments));if("init"===t){var r=function(e){var t;return e.vdsConfig||e.gioSDKInitialized||(null===(t=window.vds)||void 0===t?void 0:t.gioSDKInitialized)?(ee("SDK重复初始化,请检查是否重复加载SDK或接入其他平台SDK导致冲突!","warn"),!1):!(q(["","localhost","127.0.0.1"],location.hostname)&&!window._gr_ignore_local_rule&&(ee("当前SDK不允许在本地环境初始化!","warn"),1))}(s);if(!r)return;var o=function(e){return!Y(k(e))||(ee('SDK初始化失败,请使用 gdp("init", "您的GrowingIO项目 accountId", "您项目的 dataSourceId", options); 进行初始化!',"error"),!1)}(i);if(!o)return;var u=function(e){var t=D(e),n=L(e);return ae(j(t).trim())?(N(n)&&n||(n={}),{projectId:t,userOptions:n}):(ee("SDK初始化失败,accountId 参数不合法!","error"),!1)}(i);if(!u)return;var c=function(e){var t=e[1],n=e[2],i=L(e);return t&&T(t)?{dataSourceId:t,appId:T(n)?n:"",cdpOptions:i}:(ee("SDK初始化失败,dataSourceId 参数不合法!","error"),!1)}(i);if(!c)return;var d=u.projectId,l=c.dataSourceId,g=c.appId,f=c.cdpOptions;s.init(n(n({},f),{projectId:d,dataSourceId:l,appId:g}))}else if("registerPlugins"===t)s.registerPlugins(i[0]);else{if(s.gioSDKInitialized&&s.vdsConfig)return s[t].apply(s,i);s.emitter.emit("UNINITIALIZED_CALL",arguments),ee("SDK未初始化!","error")}}else q(m,t)?ee("方法 ".concat(j(t)," 已被弃用,请移除!"),"warn"):ee("不存在名为 ".concat(j(t)," 的方法调用!"),"error");window[a]=n(n({},window[a]),{_gr_ignore_local_rule:null!==(e=window._gr_ignore_local_rule)&&void 0!==e&&e,gioEnvironment:"cdp",gioSDKVersion:s.sdkVersion,gioSDKFull:s.gioSDKFull,canIUse:function(e){return q(h,e)&&s[e]}})};var u=null===(i=null===window||void 0===window?void 0:window.gdp)||void 0===i?void 0:i.q,c=null===(r=null===window||void 0===window?void 0:window.gdp)||void 0===r?void 0:r.e,d=null===(o=null===window||void 0===window?void 0:window.gdp)||void 0===o?void 0:o.ef;window.gdp=Kt,window.gdp.e=c,window.gdp.ef=d,P(u)&&!Y(u)&&u.forEach((function(e){Kt.apply(null,e)}))}(),Kt})); +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).gdp=t()}(this,(function(){"use strict";var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)({}).hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};function t(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+n+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}var n=function(){return n=Object.assign||function(e){for(var t,n=1,i=arguments.length;i>n;n++)for(var r in t=arguments[n])({}).hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},n.apply(this,arguments)};function i(e,t,n){if(n||2===arguments.length)for(var i,r=0,o=t.length;o>r;r++)!i&&r in t||(i||(i=[].slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||[].slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var r=["web","wxwv","minp","alip","baidup","qq","bytedance"],o={autotrack:{type:"boolean",default:!0},compress:{type:"boolean",default:!0},dataCollect:{type:"boolean",default:!0},debug:{type:"boolean",default:!1},hashtag:{type:"boolean",default:!1},touch:{type:"boolean",default:!1},version:{type:"string",default:"1.0.0"},platform:{type:"string",default:"web"},cookieDomain:{type:"string",default:""},sendType:{type:"string",default:"beacon"}},a={enableIdMapping:{type:"boolean",default:!1},gtouchHost:{type:"string",default:""},host:{type:"string",default:"napi.growingio.com"},ignoreFields:{type:"array",default:[]},penetrateHybrid:{type:"boolean",default:!0},scheme:{type:"string",default:location.protocol.indexOf("http")>-1?location.protocol.replace(":",""):"https"},sessionExpires:{type:"number",default:30},performance:{type:"object",default:{monitor:!0,exception:!0}},embeddedIgnore:{type:"array",default:[]},storageType:{type:"string",default:"cookie"},requestTimeout:{type:"number",default:5e3}},s={},u=["clearUserId","getGioInfo","getLocation","getOption","init","setDataCollect","setOption","setUserId","track","setGeneralProps","clearGeneralProps"];i(i([],u,!0),["setEvar","setPage","setUser","setVisitor"],!1);var c,d,l,g,f,h=i(i([],u,!0),["enableDebug","enableHT","setAutotrack","setTrackerHost","setTrackerScheme","setUserAttributes","getVisitorId","getDeviceId","registerPlugins","getPlugins","sendPage","sendVisit","trackTimerStart","trackTimerPause","trackTimerResume","trackTimerEnd","removeTimer","clearTrackTimer","updateImpression"],!1),p=["autotrack","dataCollect","dataSourceId","debug","host","hashtag","scheme"],v={autotrack:"无埋点采集",dataCollect:"数据采集",debug:"调试模式"},m=["send","setConfig","collectImp","setPlatformProfile"],I=["screenHeight","screenWidth"],w={click:"VIEW_CLICK",change:"VIEW_CHANGE",submit:"FORM_SUBMIT"},y="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},O="function"==typeof Array.from?Array.from:(d||(d=1,l=function(e){return"function"==typeof e},g=function(e){var t=function(e){var t=Number(e);return isNaN(t)?0:0!==t&&isFinite(t)?(t>0?1:-1)*Math.floor(Math.abs(t)):t}(e);return Math.min(Math.max(t,0),9007199254740991)},f=function(e){var t=e.next();return!t.done&&t},c=function(e){var t,n,i,r=this,o=arguments.length>1?arguments[1]:void 0;if(void 0!==o){if(!l(o))throw new TypeError("Array.from: when provided, the second argument must be a function");arguments.length>2&&(t=arguments[2])}var a=function(e,t){if(null!=e&&null!=t){var n=e[t];if(null==n)return;if(!l(n))throw new TypeError(n+" is not a function");return n}}(e,function(e){if(null!=e){if(["string","number","boolean","symbol"].indexOf(typeof e)>-1)return Symbol.iterator;if("undefined"!=typeof Symbol&&"iterator"in Symbol&&Symbol.iterator in e)return Symbol.iterator;if("@@iterator"in e)return"@@iterator"}}(e));if(void 0!==a){n=l(r)?Object(new r):[];var s,u,c=a.call(e);if(null==c)throw new TypeError("Array.from requires an array-like or iterable object");for(i=0;;){if(!(s=f(c)))return n.length=i,n;u=s.value,n[i]=o?o.call(t,u,i):u,i++}}else{var d=Object(e);if(null==e)throw new TypeError("Array.from requires an array-like object - not null or undefined");var h,p=g(d.length);for(n=l(r)?Object(new r(p)):Array(p),i=0;p>i;)h=d[i],n[i]=o?o.call(t,h,i):h,i++;n.length=p}return n}),c),b=function(e){return q(["undefined","null"],Q(e))},T=function(e){return"string"===Q(e)},_=function(e){return"number"===Q(e)},E=function(e){return"NaN"===j(Number(e))},S=function(e){return"boolean"===Q(e)},N=function(e){return"object"===Q(e)&&!b(e)},C=function(e){return"regexp"===Q(e)},P=function(e){return q(["function","asyncfunction"],Q(e))},x=function(e){return Array.isArray(e)&&"array"===Q(e)},A=function(e){return"date"===Q(e)},D=function(e){try{return H(e)[0]}catch(e){return}},L=function(e){try{var t=H(e);return t[t.length-1]}catch(e){return}},R=function(e,t){return void 0===t&&(t=1),x(e)&&_(t)?e.slice(t>0?t:1,e.length):e},k=function(e){if(x(e)){for(var t=0,n=[],i=0,r=e;i=0},H=O,j=function(e){return b(e)?"":"".concat(e)},B=function(e,t){return"string"==typeof e?e.split(t):e},K=function(e){if(T(e)){var t=B(e,"");return"".concat(D(t).toLowerCase()).concat(R(t).join(""))}return e},W=function(e,t){return!!T(e)&&e.slice(0,t.length)===t},V=function(e,t){if(T(e)){var n=e.length,i=n;i>n&&(i=n);var r=i;return(i-=t.length)>=0&&e.slice(i,r)===t}return!1},M={}.hasOwnProperty,F=function(e,t){return!b(e)&&M.call(e,t)},z=function(e){return N(e)?Object.keys(e):[]},X=function(e,t){z(e).forEach((function(n){return t(e[n],n)}))},J=function(e,t){var n=z(e);return!(!N(e)||!N(t)||n.length!==z(t).length||q(n.map((function(n,i){return N(e[n])?J(e[n],t[n]):e[n]===t[n]})),!1))},Z=function(e,t){if(!N(e))return!1;try{return"string"===Q(t)?delete e[t]:"array"===Q(t)?t.map((function(t){return delete e[t]})):(C(t)&&z(e).forEach((function(n){t.test(n)&&Z(e,n)})),!0)}catch(e){return!1}},Y=function(e){return x(e)?0===e.length:N(e)?0===z(e).length:!e},Q=function(e){return{}.toString.call(e).slice(8,-1).toLowerCase()},$=Object.freeze({__proto__:null,isNil:b,isString:T,isNumber:_,isNaN:E,isBoolean:S,isObject:N,isRegExp:C,isFunction:P,isArray:x,isDate:A,fixed:function(e,t){return _(e)?Number(e.toFixed(_(t)?t:2)):T(e)&&"NaN"!==j(Number(e))?Number(Number(e).toFixed(_(t)?t:2)):e},head:D,last:L,drop:R,dropWhile:function(e,t){return x(e)?e.filter((function(e){return!t(e)})):e},compact:k,find:U,findIndex:G,includes:q,arrayFrom:H,toString:j,split:B,lowerFirst:K,upperFirst:function(e){if(T(e)){var t=B(e,"");return"".concat(D(t).toUpperCase()).concat(R(t).join(""))}return e},startsWith:W,endsWith:V,has:F,keys:z,forEach:X,isEqual:J,get:function(e,t,n){var i=e;return N(e)?(t.split(".").forEach((function(e){i=i?i[e]:n})),i):n},unset:Z,isEmpty:Y,typeOf:Q,formatDate:function(e){if(A(e)){var t=function(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())}return e}}),ee=function(e,t){console.log("%c [GrowingIO]:".concat(e),{info:"color: #3B82F6;",error:"color: #EF4444;",warn:"color: #F59E0B;",success:"color: #10B981;"}[t]||"")},te=function(e){try{return e()}catch(e){return}},ne=function(e){var t={};return N(e)&&X(e,(function(e,n){var i,r=j(n).slice(0,100);N(e)?t[r]=ne(e):x(e)?(t[r]=e.slice(0,100),"cdp"===(null===(i=window.vds)||void 0===i?void 0:i.gioEnvironment)&&(t[r]=t[r].join("||").slice(0,1e3))):t[r]=b(e)?"":j(e).slice(0,1e3)})),t},ie=function(e,t,i,r){void 0===r&&(r={}),document.addEventListener?e.addEventListener(t,i,n(n({},{capture:!0}),r)):e.attachEvent?e.attachEvent("on"+t,i):e["on"+t]=i},re=function(e,t){return T(e)&&!Y(e)&&e.match(/^[a-zA-Z_][0-9a-zA-Z_]{0,100}$/)?t():(ee("事件名格式不正确,只能包含数字、字母和下划线,且不能以数字开头,字符总长度不能超过100!","error"),!1)},oe=Object.freeze({__proto__:null,consoleText:ee,niceTry:te,limitObject:ne,addListener:ie,flattenObject:function(e){void 0===e&&(e={});var t=n({},e);return z(t).forEach((function(e){N(t[e])?(z(t[e]).forEach((function(n){t["".concat(e,"_").concat(n)]=j(t[e][n])})),Z(t,e)):x(t[e])?(t[e].forEach((function(n,i){N(n)?z(n).forEach((function(r){t["".concat(e,"_").concat(i,"_").concat(r)]=j(n[r])})):t["".concat(e,"_").concat(i)]=j(n)})),Z(t,e)):b(t[e])||""===t[e]?Z(t,e):t[e]=j(t[e])})),ne(t)},eventNameValidate:re,getGioFunction:function(){var e,t,n,i,r=window._gio_local_vds||"vds",o=null!==(t=null===(e=window[r])||void 0===e?void 0:e.namespace)&&void 0!==t?t:"gdp";return P(window[o])?window[o]:null!==(i=null!==(n=window.gdp)&&void 0!==n?n:window.gio)&&void 0!==i?i:function(){}}}),ae=function(e){return T(e)&&e.length>0||_(e)&&e>0},se=/^((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})(\.((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})){3}/i,ue=/^(https?:\/\/)|(([a-zA-Z0-9_-])+(\.)?)*(:\d+)?(\/((\.)?(\?)?=?&?[a-zA-Z0-9_-](\?)?)*)*$/i;function ce(e){for(var t=1;arguments.length>t;t++){var n=arguments[t];for(var i in n)e[i]=n[i]}return e}var de,le=function e(t,n){function i(e,i,r){if("undefined"!=typeof document){"number"==typeof(r=ce({},n,r)).expires&&(r.expires=new Date(Date.now()+864e5*r.expires)),r.expires&&(r.expires=r.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var o="";for(var a in r)r[a]&&(o+="; "+a,!0!==r[a]&&(o+="="+r[a].split(";")[0]));return document.cookie=e+"="+t.write(i,e)+o}}return Object.create({set:i,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var n=document.cookie?document.cookie.split("; "):[],i={},r=0;r+Date.now()?he(me(t.value)):void 0},this.setItem=function(e,t,n){var i=null!=n?n:+new Date(9999,12);localStorage.setItem(fe(e),JSON.stringify({value:T(t)&&t.length&&V(e,"_gioenc")?ve(t):t,expiredAt:i}))},this.removeItem=function(e){return localStorage.removeItem(fe(e))},this.hasItem=function(e){return!!localStorage.getItem(fe(e))},this.getKeys=function(){return H(Array(localStorage.length)).map((function(e,t){return localStorage.key(t)}))},this.type="localStorage"},be={},Te=function(){this.getItem=function(e){var t=te((function(){return JSON.parse(be[fe(e)]||"")}));return N(t)&&t.expiredAt>+Date.now()?he(me(t.value)):void 0},this.setItem=function(e,t,n){var i=null!=n?n:+new Date(9999,12);be[fe(e)]=JSON.stringify({value:T(t)&&t.length?ve(t):t,expiredAt:i})},this.removeItem=function(e){return Z(be,fe(e))},this.hasItem=function(e){return F(be,fe(e))},this.getKeys=function(){return z(be)},this.type="memory"},_e=/^(\.ac\.|\.br\.|\.co\.|\.com\.|\.edu\.|\.gov\.|\.org\.|\.net\.)/,Ee=function(e){var t=[];try{var n=e.split("."),i=L(n);if(n.length>=2&&(isNaN(Number(i))||0>Number(i)||Number(i)>255)){var r=".".concat(n.slice(-2).join("."));_e.test(r)?de=r:t.push(r);var o=".".concat(n.slice(-3).join("."));_e.test(o)||q(t,o)||t.push(o);var a=".".concat(n.slice(-4).join("."));_e.test(a)||q(t,a)||t.push(a)}}catch(e){}return t},Se=function(e){var t="";return e.every((function(e){return!Ne(e)||(t=e,!1)})),t},Ne=function(e){try{le.set("gioCookie","yes",{domain:e});var t=!!le.get("gioCookie",{domain:e});return le.remove("gioCookie",{domain:e}),t}catch(e){return!1}},Ce=function(e){var t,n,r,o=e.storageType,a=e.cookieDomain,s=e.projectId;if(q(["cookie","localstorage"],o)||(o="cookie"),"cookie"===o&&(n=!!(r=navigator.userAgent.indexOf("Electron")>-1||q(["","localhost","127.0.0.1"],window.location.hostname)||!q(["http:","https:"],window.location.protocol)?"":Se(i(i([],Ee(window.location.hostname),!0),[window.location.hostname],!1)))),"cookie"===o&&n){var u=new ye(r);if(a){var c=Ee(a),d=Se(Y(c)?[]:i([a],Ee(a),!0));d&&Ne(d)?u.domain=d:ee("指定Cookie域无效或无权限,使用默认域!","warn")}t=u}else t=function(){try{var e=window.localStorage,t="__storage_test__";return e.setItem(t,t),e.removeItem(t),!0}catch(e){return!1}}()?new Oe:new Te;return"cookie"===o&&de&&Ne(de)&&function(e,t,n){if(t&&Ne(t)){var i=new ye(t);["".concat(n,"_gdp_session_id"),"gdp_user_id_gioenc","".concat(n,"_gdp_cs1_gioenc"),"".concat(n,"_gdp_user_key_gioenc"),"".concat(n,"_gdp_gio_id_gioenc"),"".concat(n,"_gdp_sequence_ids"),"".concat(n,"_gdp_session_id_sent")].forEach((function(t){var n=i.getItem(t);i.hasItem(t)&&(e.setItem(t,n),i.removeItem(t))})),i=void 0}}(t,de,s),t},Pe="OPTION_INITIALIZED",xe="SDK_INITIALIZED",Ae="SESSIONID_UPDATE",De="SET_USERID",Le="SET_USERKEY",Re={name:"gioCompress",method:function(e){var t=this;this.growingIO=e,this._compress=function(e,t,n){if(null===e)return"";var i,r,o,a={},s={},u="",c="",d="",l=2,g=3,f=2,h=[],p=0,v=0;for(o=0;od.charCodeAt(0)){for(i=0;f>i;i++)p<<=1,v===t-1?(v=0,h.push(n(p)),p=0):v++;for(r=d.charCodeAt(0),i=0;8>i;i++)p=p<<1|1&r,v===t-1?(v=0,h.push(n(p)),p=0):v++,r>>=1}else{for(r=1,i=0;f>i;i++)p=p<<1|r,v===t-1?(v=0,h.push(n(p)),p=0):v++,r=0;for(r=d.charCodeAt(0),i=0;16>i;i++)p=p<<1|1&r,v===t-1?(v=0,h.push(n(p)),p=0):v++,r>>=1}0==--l&&(l=Math.pow(2,f),f++),delete s[d]}else for(r=a[d],i=0;f>i;i++)p=p<<1|1&r,v===t-1?(v=0,h.push(n(p)),p=0):v++,r>>=1;0==--l&&(l=Math.pow(2,f),f++),a[c]=g++,d=u+""}if(""!==d){if({}.hasOwnProperty.call(s,d)){if(256>d.charCodeAt(0)){for(i=0;f>i;i++)p<<=1,v===t-1?(v=0,h.push(n(p)),p=0):v++;for(r=d.charCodeAt(0),i=0;8>i;i++)p=p<<1|1&r,v===t-1?(v=0,h.push(n(p)),p=0):v++,r>>=1}else{for(r=1,i=0;f>i;i++)p=p<<1|r,v===t-1?(v=0,h.push(n(p)),p=0):v++,r=0;for(r=d.charCodeAt(0),i=0;16>i;i++)p=p<<1|1&r,v===t-1?(v=0,h.push(n(p)),p=0):v++,r>>=1}0==--l&&(l=Math.pow(2,f),f++),delete s[d]}else for(r=a[d],i=0;f>i;i++)p=p<<1|1&r,v===t-1?(v=0,h.push(n(p)),p=0):v++,r>>=1;0==--l&&(l=Math.pow(2,f),f++)}for(r=2,i=0;f>i;i++)p=p<<1|1&r,v===t-1?(v=0,h.push(n(p)),p=0):v++,r>>=1;for(;;){if(p<<=1,v===t-1){h.push(n(p));break}v++}return h.join("")},this.compress=function(e){var n=t;return t._compress(e,16,(function(e){return n.f(e)}))},this.compressToUTF16=function(e){var n=t;return null===e?"":t._compress(e,15,(function(e){return n.f(e+32)}))+" "},this.compressToUint8Array=function(e){for(var n=t.compress(e),i=new Uint8Array(2*n.length),r=0,o=n.length;o>r;r++){var a=n.charCodeAt(r);i[2*r]=a>>>8,i[2*r+1]=a%256}return i},this.compressToEncodedURIComponent=function(e){if(null===e)return"";var n=t;return t._compress(e,6,(function(e){return n.keyStrUriSafe.charAt(e)}))},this.f=String.fromCharCode,this.keyStrUriSafe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$"}},ke={name:"gioCustomTracking",method:function(e){var t=this;this.growingIO=e,this.getValidResourceItem=function(e){if(e&&N(e)&&e.id&&e.key){var t={id:T(e.id)?e.id:j(e.id),key:T(e.key)?e.key:j(e.key)};return e.attributes&&(t.attributes=e.attributes),t}},this.getDynamicAttributes=function(e){return b(e)||z(e).forEach((function(t){P(e[t])?e[t]=e[t]():N(e[t])?Z(e,t):x(e[t])||(e[t]=j(e[t]))})),e},this.buildCustomEvent=function(e,i,r,o){re(e,(function(){var a=t.growingIO.dataStore,s=a.eventContextBuilder,u=a.eventConverter,c=a.currentPage,d=n({eventType:"CUSTOM",eventName:e,pageShowTimestamp:null==c?void 0:c.time,attributes:ne(t.getDynamicAttributes(N(i)&&!Y(i)?i:void 0)),resourceItem:ne(t.getValidResourceItem(r))},s());Y(o)||(d=n(n({},d),o)),u(d)}))},this.buildUserAttributesEvent=function(e,i){var r=t.growingIO.dataStore,o=r.eventContextBuilder,a=r.eventConverter,s=n({eventType:"LOGIN_USER_ATTRIBUTES",attributes:ne(e)},o());Y(i)||(s=n(n({},s),i)),a(s)}}},Ue={},Ge={}.hasOwnProperty;function qe(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(e){return null}}function He(e){try{return encodeURIComponent(e)}catch(e){return null}}Ue.stringify=function(e,t){t=t||"";var n,i,r=[];for(i in"string"!=typeof t&&(t="?"),e)if(Ge.call(e,i)){if((n=e[i])||null!=n&&!isNaN(n)||(n=""),i=He(i),n=He(n),null===i||null===n)continue;r.push(i+"="+n)}return r.length?t+r.join("&"):""},Ue.parse=function(e){for(var t,n=/([^=?#&]+)=?([^&]*)/g,i={};t=n.exec(e);){var r=qe(t[1]),o=qe(t[2]);null===r||null===o||r in i||(i[r]=o)}return i};var je={gioprojectid:"projectId",giodatacollect:"dataCollect",gioappid:"domain",giodatasourceid:"dataSourceId",gios:"sessionId",giou:"uid",giocs1:"userId",gioid:"gioId",giouserkey:"userKey",gioappchannel:"appChannel",giodevicebrand:"deviceBrand",giodevicemodel:"deviceModel",giodevicetype:"deviceType",giolanguage:"language",gionetworkstate:"networkState",giooperatingsystem:"operatingSystem",gioplatform:"platform",gioplatformversion:"platformVersion",gioscreenheight:"screenHeight",gioscreenwidth:"screenWidth"},Be=["giodatasourceid","gioplatform","gioappchannel","giodevicebrand","giodevicemodel","giodevicetype","giolanguage","gionetworkstate","giooperatingsystem","gioplatformversion","gioscreenheight","gioscreenwidth"],Ke=["giocs1","gios","giou","gioid","giouserkey"],We="gio_search_cookie_gioenc",Ve={name:"gioEmbeddedAdapter",method:function(e){var t=this;this.growingIO=e,this.main=function(){var e,n=t.growingIO.vdsConfig,i=n.projectId,r=n.appId,o=t.getGQS(),a=!1;return"none"!==t.qsFrom&&o.gioprojectid===i&&o.gioappid===r&&(Y(o)?t.growingIO.storage.removeItem(We):t.growingIO.storage.setItem(We,Ue.stringify(o)),F(o,"giodatacollect")&&(t.growingIO.vdsConfig.dataCollect=q(["true",!0],o.giodatacollect)),null===(e=t.growingIO.emitter)||void 0===e||e.on("SDK_INITIALIZED",(function(){var e=t.growingIO,n=e.userStore,i=e.vdsConfig.sessionExpires,r=e.dataStore.eventContextBuilderInst;Ke.forEach((function(e){var t;n[je[e]]=null!==(t=o[e])&&void 0!==t?t:""})),window.setInterval((function(){n.sessionId=o.gios}),.8*i*60*1e3),Be.forEach((function(e){F(o,e)&&(r.minpExtraParams[je[e]]=o[e])}))})),t.growingIO.setUserId=function(){},t.growingIO.clearUserId=function(){},F(o,"giodatacollect")&&(t.growingIO.setDataCollect=function(){},t.growingIO.setOption=function(){}),a=!0),t.gioURLRewrite(),a},this.getGQS=function(){var e=t.growingIO.vdsConfig.hashtag,n=t.growingIO.storage.getItem(We),r=window.location.search,o=window.location.hash,a=e?o.substring(o.indexOf("?")+1):"",s=Ue.parse(r),u=Ue.parse(a),c=Ue.parse((n||"").replace("gioenc-","")),d={};if(F(s,"gioprojectid"))d=s,t.qsFrom="search";else if(F(u,"gioprojectid"))d=u,t.qsFrom="hash";else{if(!F(c,"gioprojectid"))return t.qsFrom="none",{};d=c,t.qsFrom="cookie"}var l={},g={},f=i(i(["gioappid","gioprojectid","giodatacollect"],Ke,!0),Be,!0);return z(d).forEach((function(e){var t=e.toLowerCase();q(f,t)?q(["","undefined","null",void 0,null],d[e])||(l[t]=d[e],q(["true","TRUE",!0],d[e])&&(l[t]=!0),q(["false","FALSE",!1],d[e])&&(l[t]=!1)):g[e]=d[e]})),t.gqs=l,t.ngqs=g,l},this.gioURLRewrite=function(){var e=t.growingIO.vdsConfig.hashtag,n=window.location.search,i=window.location.hash,r=!1;if("search"===t.qsFrom&&(n=Ue.stringify(t.ngqs,!0),r=!0),e&&"hash"===t.qsFrom&&(i="".concat(i.split("?")[0]).concat(Ue.stringify(t.ngqs,!0)),r=!0),r){var o="".concat(window.location.pathname).concat(n||"").concat(i||"");window.history.replaceState(null,document.title,o)}},this.gqs={},this.ngqs={},this.qsFrom="search",this.growingIO.emitter.on(Pe,(function(){t.growingIO.useEmbeddedInherit=t.main()}))}},Me={},Fe={};!function(e){var t=y&&y.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var i,r=0,o=t.length;o>r;r++)!i&&r in t||(i||(i=[].slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||[].slice.call(t))};Object.defineProperty(e,"__esModule",{value:!0}),e.GROWING_TITLE_OLD=e.GROWING_TITLE=e.GROWING_GTITLE=e.GROWING_CDP_INDEX=e.GROWING_INDEX_OLD=e.GROWING_INDEX=e.GROWING_CONTAINER=e.GROWING_TRACK=e.GROWING_IGNORE=e.VALID_CLASS_SELECTOR=e.VALID_ID_SELECTOR=e.EXCLUDE_CLASS_RE=e.UNSUPPORTED_TAGS=e.TEXT_NODE=e.UNSUPPORTED_CLICK_TAGS=e.SUPPORTED_ICON_TAGS=e.SUPPORTED_CHANGE_TYPES=e.SUPPORTED_CLICK_INPUT_TYPES=e.SUPPORTED_CONTAINER_TAGS=e.LIST_TAGS=void 0,e.LIST_TAGS=["TR","LI","DL"],e.SUPPORTED_CONTAINER_TAGS=t(["A","BUTTON"],e.LIST_TAGS,!0),e.SUPPORTED_CLICK_INPUT_TYPES=["button","submit","reset"],e.SUPPORTED_CHANGE_TYPES=["radio","checkbox","search"],e.SUPPORTED_ICON_TAGS=["I","EM","svg","IMG"],e.UNSUPPORTED_CLICK_TAGS=["TEXTAREA","HTML","BODY"],e.TEXT_NODE=["I","SPAN","EM","B","STRONG"],e.UNSUPPORTED_TAGS=["tspan","text","g","rect","path","defs","clippath","desc","title","math","use"],e.EXCLUDE_CLASS_RE=/(^| |[^ ]+\-)(clear|clearfix|active|hover|enabled|current|selected|unselected|hidden|display|focus|disabled|undisabled|open|checked|unchecked|undefined|null|ng-|growing-)[^\. ]*/g,e.VALID_ID_SELECTOR=/^[a-zA-Z-\_][a-zA-Z\-\_0-9]+$/,e.VALID_CLASS_SELECTOR=/^([a-zA-Z\-\_0-9]+)$/,e.GROWING_IGNORE="data-growing-ignore",e.GROWING_TRACK="data-growing-track",e.GROWING_CONTAINER="data-growing-container",e.GROWING_INDEX="data-growing-index",e.GROWING_INDEX_OLD="data-growing-idx",e.GROWING_CDP_INDEX="data-index",e.GROWING_GTITLE="data-growing-title",e.GROWING_TITLE="data-title",e.GROWING_TITLE_OLD="growing-title"}(Fe);var ze={},Xe={};Object.defineProperty(Xe,"__esModule",{value:!0}),Xe.lastFindIndex=Xe.findIndex=Xe.arrayEquals=Xe.rmBlank=Xe.normalizePath=Xe.splitNoEmpty=Xe.filterText=void 0,Xe.filterText=function(e,t){if(void 0===t&&(t=!0),e&&(null==(e=e.replace(/[\n \t]+/g," ").trim())?void 0:e.length))return e.slice(0,t?50:void 0)},Xe.splitNoEmpty=function(e,t){return e?e.split(t).filter((function(e){return!!e})):[]},Xe.normalizePath=function(e){var t=e.length;return t>1&&"/"===e.charAt(t-1)?e.slice(0,t-1):e},Xe.rmBlank=function(e){return e?e.replace(/[\n \t]+/g,""):""},Xe.arrayEquals=function(e,t){if(!e||!t)return!1;if(e.length!==t.length)return!1;for(var n=0,i=e.length;i>n;n++)if(e[n]!==t[n])return!1;return!0},Xe.findIndex=function(e,t){if(null==e||"function"!=typeof t)return-1;for(var n=0;n=0;n--){var i=e[n];if(t.call(void 0,i))return n}return-1},function(e){var t=y&&y.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var i,r=0,o=t.length;o>r;r++)!i&&r in t||(i||(i=[].slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||[].slice.call(t))},n=y&&y.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.removeDiffTagOnHeadAndTail=e.computeXpath=e.getMarkIndex=e.getEffectiveNode=e.isIgnore=e.depthInside=e.changeableInput=e.clickableInput=e.onlyContainsTextChildren=e.onlyContainsIconChildren=e.supportIconTag=e.isContainerTag=e.isListTag=e.isParentOfLeaf=e.isLeaf=e.getChildren=e.getDeepChildren=e.findParent=e.isRootNode=e.hasValidAttribute=void 0;var i=Xe,r=Fe,o=n(O);e.hasValidAttribute=function(e,t){return e instanceof Element&&e.hasAttribute(t)&&"false"!==e.getAttribute(t)},e.isRootNode=function(e){return!e||-1!==["BODY","HTML","#document"].indexOf(e.nodeName)},e.findParent=function(t,n){for(var i=t.parentNode;i&&!(0,e.isRootNode)(i);){if(n(i))return i;i=i.parentNode}},e.getDeepChildren=function(n){return(0,o.default)((null==n?void 0:n.childNodes)||[]).reduce((function(n,i){return i instanceof Element?t(t(t([],n,!0),[i],!1),(0,e.getDeepChildren)(i),!0):n}),[])},e.getChildren=function(e){return(0,o.default)((null==e?void 0:e.childNodes)||[]).filter((function(e){return e instanceof Element}))},e.isLeaf=function(t){return!t.hasChildNodes()||"svg"===t.nodeName||0===(0,e.getChildren)(t).length},e.isParentOfLeaf=function(t){return!(!t.hasChildNodes()||"svg"===t.nodeName)&&0===(0,o.default)(t.childNodes).filter((function(t){return!(0,e.isLeaf)(t)})).length},e.isListTag=function(e){return-1!==r.LIST_TAGS.indexOf(e.nodeName)},e.isContainerTag=function(t){return(0,e.hasValidAttribute)(t,r.GROWING_CONTAINER)||-1!==r.SUPPORTED_CONTAINER_TAGS.indexOf(t.nodeName)},e.supportIconTag=function(e){var t=e.nodeName;return-1!==r.SUPPORTED_ICON_TAGS.indexOf(t)},e.onlyContainsIconChildren=function(t){if(t.textContent)return!1;var n=(0,e.getChildren)(t);if(0===n.length)return!1;for(var i=0,r=n;in)return!1;for(var r="svg"===t.tagName?[]:(0,e.getChildren)(t),o=0;o=i},e.isIgnore=function(t){if(!(t instanceof Element)||(0,e.hasValidAttribute)(t,r.GROWING_IGNORE))return!0;for(var n=t.parentNode;n&&!(0,e.isRootNode)(n);){if((0,e.hasValidAttribute)(n,r.GROWING_IGNORE))return!0;n=n.parentNode}return!1},e.getEffectiveNode=function(t){for(var n,i;t&&(i=void 0,!((n=t)instanceof Element&&-1===r.UNSUPPORTED_TAGS.indexOf(null===(i=n.tagName)||void 0===i?void 0:i.toLowerCase())))&&t.parentNode;)t=t.parentNode;var o,a=t.parentNode;return!(0,e.isRootNode)(a)&&((0,e.onlyContainsIconChildren)(a)||"BUTTON"===(o=a).tagName&&(0,e.onlyContainsTextChildren)(o))?a:t},e.getMarkIndex=function(e){if(e instanceof Element){var t=e.getAttribute(r.GROWING_INDEX)||e.getAttribute(r.GROWING_INDEX_OLD)||e.getAttribute(r.GROWING_CDP_INDEX);if(t){if(/^\d{1,10}$/.test(t)&&+t>=0&&2147483647>+t)return+t;window.console.error("[GioNode]:标记的index不符合规范(index必须是大于等于0且小于2147483647的整数字)。",t)}}},e.computeXpath=function(e){for(var t=e.parentPaths(!0),n=Math.min(t.length,+(t.length>=10)+4),i=["","",""],r=0;rr&&(i[1]=o+i[1])}return i},e.removeDiffTagOnHeadAndTail=function(e,t){var n=function(e){return e.nodeName===t.nodeName},r=(0,i.findIndex)(e,n),o=(0,i.lastFindIndex)(e,n);return-1===r||-1===o?[]:e.slice(r,o+1)}}(ze);var Je={},Ze={};Object.defineProperty(Ze,"__esModule",{value:!0});var Ye=Fe,Qe=Xe,$e=ze;function et(e){var t;if(e instanceof Element){var n=e.getAttribute("name");if(n)return[n];if(e.hasAttribute("class")){var i=null===(t=e.getAttribute("class"))||void 0===t?void 0:t.replace(Ye.EXCLUDE_CLASS_RE,"").trim();if(null==i?void 0:i.length)return i.split(/\s+/).filter((function(e){return Ye.VALID_CLASS_SELECTOR.test(e)&&!e.match(/[a-z][A-Z][a-z][A-Z]/)&&!e.match(/[0-9][0-9][0-9][0-9]/)})).sort()}}return[]}var tt=function(){function e(e){var t;this.node=e,this.tagName=this.node.nodeName,this.name=this.tagName.toLowerCase(),this.id=(t=this.node).id&&Ye.VALID_ID_SELECTOR.test(t.id)?t.id:null,this.classList=et(this.node),this.guessListAndIndex()}return e.prototype.guessListAndIndex=function(){var e,t=this;this._tagList=(0,$e.isListTag)(this.node);var n=(0,$e.removeDiffTagOnHeadAndTail)((0,$e.getChildren)(this.node.parentNode),this.node);if(this._tagList&&-1!==(o=n.filter((function(e){return e.tagName===t.tagName})).indexOf(this.node))&&(this._index=o+1),n.length>=3&&(null===(e=this.classList)||void 0===e?void 0:e.length)){for(var i=0,r=0,o=1;o<=n.length;o++){var a=n[o-1];if(a.tagName!==this.tagName){r=0;break}(0,Qe.arrayEquals)(this.classList,et(a))&&(r+=1),this.node===a&&(i=o)}3>r||(this._pseudoList=!0,this._index=this._index||i)}},Object.defineProperty(e.prototype,"path",{get:function(){var e;return this._path||(this._path="/".concat(this.name),this.id&&(this._path+="#".concat(this.id)),(null===(e=this.classList)||void 0===e?void 0:e.length)&&(this._path+=".".concat(this.classList.join(".")))),this._path},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pseudoList",{get:function(){return!!this._pseudoList},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"list",{get:function(){return!!this._tagList||!!this._pseudoList},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"index",{get:function(){var e;return null!==(e=(0,$e.getMarkIndex)(this.node))&&void 0!==e?e:this._index},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"container",{get:function(){return(0,$e.isContainerTag)(this.node)||this.list},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"parent",{get:function(){return this.node.parentNode?new e(this.node.parentNode):null},enumerable:!1,configurable:!0}),e.prototype.parentPaths=function(e){void 0===e&&(e=!1);for(var t=e?[this]:[],n=this.parent;n&&!(0,$e.isRootNode)(n.node);)t.push(n),n=n.parent;return t},e}();Ze.default=tt;var nt={};Object.defineProperty(nt,"__esModule",{value:!0}),nt.getElementHref=nt.getImgHref=nt.getAnchorHref=void 0;var it=Xe;function rt(e){if(e.hasAttribute("href")){var t=e.getAttribute("href");if(t&&0!==t.indexOf("javascript"))return(0,it.normalizePath)(t.slice(0,320))}}function ot(e){if(e.src&&-1===e.src.indexOf("data:image"))return e.src}nt.getAnchorHref=rt,nt.getImgHref=ot,nt.getElementHref=function(e){var t=e;if(t)switch(e.nodeName.toLowerCase()){case"a":return rt(t);case"img":return ot(t)}};var at={},st=y&&y.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(at,"__esModule",{value:!0}),at.getElementContent=at.getFormContent=void 0;var ut=ze,ct=nt,dt=Fe,lt=st(Ze),gt=Xe,ft=st(O),ht=function(e){return e.htmlFor||e.getAttribute("for")},pt=function(e){var t=e.getAttribute(dt.GROWING_GTITLE)||e.getAttribute(dt.GROWING_TITLE)||e.getAttribute(dt.GROWING_TITLE_OLD)||e.getAttribute("title");return null==t?void 0:t.trim()};function vt(e){var t=e.node;return e.list?mt(t):(0,gt.filterText)(t.textContent)||void 0}function mt(e){for(var t=void 0,n=!1,i=0,r=(0,ft.default)(e.childNodes);i-1?n.slice(0,i):n}}(t);case"svg":return function(e){for(var t=0,n=(0,ft.default)(e.childNodes);t0)return n[n.length-1]}}(t);case"label":return vt(a);case"input":return function(e){if((0,ut.clickableInput)(e))return e.value;if("password"!==e.type&&(0,ut.hasValidAttribute)(e,dt.GROWING_TRACK))return e.value;if((0,ut.changeableInput)(e)){var t=(0,ut.findParent)(e,(function(e){return"LABEL"===e.nodeName}));if(!t&&e.id)for(var n=document.body.getElementsByTagName("label"),i=0;i0)return o+" ("+e.checked+")"}return e.value}}(t);case"select":return i=t,(0,ft.default)(i.options).filter((function(e){return e.selected})).map((function(e){return e.label})).join(", ")||i.value;case"form":return It(t)}return(0,ut.isLeaf)(t)?function(e){var t=(0,gt.filterText)(e.textContent);if(t)return t}(t):(0,ut.isParentOfLeaf)(t)&&!(0,ut.onlyContainsIconChildren)(t)?function(e){for(var t="",n=0,i=(0,ft.default)(e.childNodes);nn;n++)for(var r in t=arguments[n])({}).hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},Nt.apply(this,arguments)},Ct=y&&y.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Me,"__esModule",{value:!0});var Pt,xt,At=Fe,Dt=ze,Lt=Ct(Je),Rt=function(){function e(e,t,n){void 0===t&&(t=null),void 0===n&&(n=!0),this.origin=e,this.action=t,this.direct=n,this.target="self"===t?e:(0,Dt.getEffectiveNode)(e),this.ignore=(0,Dt.isIgnore)(this.target),this.vnode=new Lt.default(this.target),this.tagName=this.vnode.tagName}return Object.defineProperty(e.prototype,"content",{get:function(){return this.vnode.content},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"href",{get:function(){return this.vnode.href},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"index",{get:function(){return this.vnode.index},enumerable:!1,configurable:!0}),e.prototype.inferParentIndex=function(){var t=this;return this.parentIndex||(0,Dt.findParent)(this.target,(function(n){var i=new e(n,t.action,!1);i.traceable()&&i.index&&(t.parentIndex=i.index)})),this.parentIndex},Object.defineProperty(e.prototype,"xpath",{get:function(){return this.vnode.xpath},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fullXpath",{get:function(){return this.vnode.fullXpath},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"skeleton",{get:function(){return this.vnode.skeleton},enumerable:!1,configurable:!0}),e.prototype.info=function(e){return void 0===e&&(e=!0),e&&this.inferParentIndex(),{skeleton:this.skeleton,fullXpath:this.fullXpath,xpath:this.xpath,content:this.content,href:this.href,index:this.parentIndex||this.index}},e.prototype.traceable=function(){if(this.ignore)return!1;if(this.direct){if("click"===this.action||"hover"===this.action){if(-1!==At.UNSUPPORTED_CLICK_TAGS.indexOf(this.target.tagName))return!1;if("INPUT"===this.target.tagName&&!(0,Dt.clickableInput)(this.target))return!1;if(!(0,Dt.isContainerTag)(this.target)&&!(0,Dt.depthInside)(this.target,5))return!1}return!0}return this.vnode.container},e.prototype.trackNodes=function(){if(!this.traceable())return[];var e=[this];if("submit"!==this.action)for(var t=this.parentElement;t;){if(t.ignore)return[];t.traceable()&&e.unshift(t),t=t.parentElement}var n=void 0;return e.map((function(e){var t=e.info(!1),i=t.index;return!n&&i&&(n=i),Nt(Nt({},t),{index:n||i})}))},Object.defineProperty(e.prototype,"parentElement",{get:function(){var t=this.target.parentNode;if(t&&t.nodeName&&!(0,Dt.isRootNode)(t))return new e(t,this.action,!1)},enumerable:!1,configurable:!0}),e}(),kt=Me.default=Rt,Ut=function(){function e(e){this.handler=e;var t=navigator.userAgent,n=/chrome/i.exec(t),i=/android/i.exec(t);this.hasTouch="ontouchstart"in window&&!(n&&!i)}return e.prototype.main=function(){for(var e=this.hasTouch?["touchstart"]:["mousedown"],t=this.hasTouch?["touchend","touchcancel"]:["mouseup","mouseleave"],n=this.hasTouch?["touchmove"]:["mousemove"],i=0,r=e;r.length>i;i++)ie(window,r[i],this.touchStartHandler.bind(this));for(var o=0,a=n;a.length>o;o++)ie(window,a[o],this.touchMoveHandler.bind(this));for(var s=0,u=t;u.length>s;s++)ie(window,u[s],this.touchStopHandler.bind(this))},e.prototype.touchStartHandler=function(e){if(1>=e.which){var t=+Date.now();this.safeguard!==t&&(this.touchTimeout&&clearTimeout(this.touchTimeout),this.safeguard=t,this.touchEvent={time:t,target:e.target,x:this._page("x",e),y:this._page("y",e),isTrusted:!0,type:"click"})}},e.prototype.touchMoveHandler=function(e){var t=Math.abs(this._page("x",e)-(this.touchEvent&&this.touchEvent.x)||0),n=Math.abs(this._page("y",e)-(this.touchEvent&&this.touchEvent.y)||0);(t>10||n>10)&&(this.touchEvent=null)},e.prototype.touchStopHandler=function(e){var t=this,n=+Date.now()-(this.touchEvent&&this.touchEvent.time)||0;this.touchEvent&&200>n?this.touchTimeout=setTimeout((function(){t.handler(t.touchEvent),t.touchEvent=null}),200):this.touchEvent&&n>=200&&700>n&&(this.handler(this.touchEvent),this.touchEvent=null)},e.prototype._page=function(e,t){return(this.hasTouch?t.touches[0]:t)["page".concat(e.toUpperCase())]},e}(),Gt={name:"gioEventAutoTracking",method:function(e){var t=this;this.growingIO=e,this.main=function(){ie(document,"submit",t._handleAction),ie(document,"change",t._handleAction),t.growingIO.vdsConfig.touch?new Ut(t._handleAction).main():ie(document,"click",t._handleAction)},this._handleAction=function(e,i){var r=t.growingIO,o=r.vdsConfig,a=r.emitter;if(!o.autotrack)return!1;var s=e.target;if(!s)return!1;var u=new kt(s,e.type,!0).trackNodes();if("click"!==e.type&&(u=Y(L(u))?[]:[L(u)]),Y(u))return!1;null==a||a.emit("onComposeBefore",{event:i,params:null!=e?e:{}}),u.forEach((function(i){var r=i.fullXpath,a=i.index,s=i.content,u=i.href;if(!W(i.fullXpath||"","/div#__vconsole")&&!W(i.fullXpath||"","/div#__giokit")&&(o.debug&&console.log("Action:",e.type,Date.now()),r)){var c=t.growingIO.dataStore,d=c.eventContextBuilder,l=c.eventConverter,g=c.currentPage;l(n(n({eventType:w[e.type],element:[{xpath:r,index:a,textValue:s,hyperlink:u}]},d()),{pageShowTimestamp:g.time}))}}))}}},qt=["VIEW_CLICK","VIEW_CHANGE","FORM_SUBMIT","PAGE","CUSTOM","LOGIN_USER_ATTRIBUTES"],Ht=["LOGIN_USER_ATTRIBUTES"],jt={name:"gioHybridAdapter",method:function(e){var t=this;this.growingIO=e,this.penetrateHybrid=!0,this.onOptionsInit=function(){var e=t.growingIO,n=e.vdsConfig,i=e.emitter;S(n.penetrateHybrid)&&(t.penetrateHybrid=n.penetrateHybrid),t._initHybridBridge()&&(t.onSendBefore=t.sendBeforeListener,t.hybridConfig.projectId===t.growingIO.vdsConfig.projectId&&(t.growingIO.useHybridInherit=!0)),t.growingIO.useHybridInherit&&(null==i||i.on(De,(function(e){var n=e.newUserId,i=e.oldUserId,r=e.userKey;t.penetrateHybrid&&(!n&&i?r?t._clearNativeUserIdAndUserKey():t._clearNativeUserId():r?t._setNativeUserIdAndUserKey(j(n),j(r)):t._setNativeUserId(j(n)))})),null==i||i.on(Le,(function(e){var n=e.newUserKey,i=e.oldUserKey,r=e.userId;t.penetrateHybrid&&(!n&&i?t._clearNativeUserIdAndUserKey():t._setNativeUserIdAndUserKey(j(r),j(n)))})))},this._initHybridBridge=function(){var e,n,i,r=!1;return t.hasHybridBridge=!!window.GrowingWebViewJavascriptBridge,t.hasHybridBridge?((null===(e=null===window||void 0===window?void 0:window.GrowingWebViewJavascriptBridge)||void 0===e?void 0:e.configuration)||(window.GrowingWebViewJavascriptBridge.configuration=JSON.parse(window.GrowingWebViewJavascriptBridge.getConfiguration())),(null===(n=null===window||void 0===window?void 0:window.GrowingWebViewJavascriptBridge)||void 0===n?void 0:n.configuration)&&(t.hybridConfig=null===(i=null===window||void 0===window?void 0:window.GrowingWebViewJavascriptBridge)||void 0===i?void 0:i.configuration),r=!0):Pt.consoleText("gioHybridAdapter:当前不存在 GrowingWebViewJavascriptBridge,Web模式。","info"),r},this.sendBeforeListener=function(e){var i=e.requestData;if(t.hasHybridBridge){var r=t.processAttributes(n({},i));Z(r,"trackingId"),q(qt,r.eventType)&&(q(Ht,r.eventType)?t.penetrateHybrid&&t._dispatchEvent(r):(t.penetrateHybrid||Z(r,["userId","userKey","cs1"]),t._dispatchEvent(r)))}},this.processAttributes=function(e){return X(e,(function(t,n){N(t)||x(t)?X(e[n],(function(t,i){N(t)||x(t)?e[n][i]=JSON.stringify(t):e[n][i]=j(t)})):e[n]=j(t)})),e},this._setNativeUserId=function(e){te((function(){return window.GrowingWebViewJavascriptBridge.setNativeUserId(e)}))},this._clearNativeUserId=function(){te((function(){return window.GrowingWebViewJavascriptBridge.clearNativeUserId()}))},this._setNativeUserIdAndUserKey=function(e,t){te((function(){return window.GrowingWebViewJavascriptBridge.setNativeUserIdAndUserKey(e,t)}))},this._clearNativeUserIdAndUserKey=function(){te((function(){return window.GrowingWebViewJavascriptBridge.clearNativeUserIdAndUserKey()}))},this._dispatchEvent=function(e){te((function(){var t;return null===(t=window.GrowingWebViewJavascriptBridge)||void 0===t?void 0:t.dispatchEvent(JSON.stringify(e))}))};var i=this.growingIO,r=i.emitter,o=i.utils;Pt=o,r.on(Pe,this.onOptionsInit)}},Bt=["i","span","em","b","strong","svg"];!function(e){e[e.OUTER=0]="OUTER",e[e.INNER_COVERED=1]="INNER_COVERED",e[e.INNER_SHOW=2]="INNER_SHOW"}(xt||(xt={}));var Kt,Wt=i(["HR","BR","SCRIPT","NOSCRIPT","STYLE","HEAD","BASE","LINK","META","TITLE","BODY","HTML","TEMPLATE","CODE"],Fe.UNSUPPORTED_CLICK_TAGS,!0),Vt=["SELECT","A","BUTTON","INPUT","IMG","FORM"],Mt=function(e,t,n){return document.elementFromPoint(t,n)===e},Ft=function(){function e(e,t,n){this.node=e,this.parentNodeDesc=t,this.devicesInfo=n,this.proxy=new kt(e),this.tagName=this.node.tagName,this.name=this.tagName.toLowerCase(),this.isIgnore=!!this.node.dataset.growingIgnore,this.isUnSupported=-1!==Wt.indexOf(this.tagName),this.rect=this.computeWindowRect()}return e.prototype.info=function(){var e=this.desc();e.zLevel+=this.devicesInfo.webviewZLevel;var t=this.getDeviceRect(this.rect);return Z(e,"isContainer"),n(n(n({},e),t),{parentXPath:this.parentNodeDesc.isContainer?this.parentNodeDesc.xpath:void 0,href:this.proxy.href,content:this.proxy.content,nodeType:this.nodeType()})},e.prototype.nodeType=function(){return"input"!==this.name||ze.changeableInput(this.node)?this.node.tagName:"INPUT_BTN"},e.prototype.desc=function(){return{index:this.parentNodeDesc.index||this.proxy.index,zLevel:this.zLevel(),xpath:this.proxy.fullXpath,isContainer:this.isDefinedContainer()}},e.prototype.cssVisible=function(){var e=this.computedStyle();return Number(e.opacity)>0&&"visible"===e.visibility&&"none"!==e.display},e.prototype.viewportStatus=function(){var e=this.rect,t=e.top,n=e.left,i=e.width,r=e.height,o=this.devicesInfo,a=o.winWidth,s=o.winHeight;if(0>=i||0>=r)return xt.OUTER;var u=this.node;return s>t&&a>n&&i>0&&r>0?Mt(u,n+i/2,t+r/2)||Mt(u,n+1,t+1)||Mt(u,n+i-1,t+1)||Mt(u,n+1,t+r-1)||Mt(u,n+i-1,t+r-1)?xt.INNER_SHOW:xt.INNER_COVERED:xt.OUTER},e.prototype.isCircleable=function(){return this.proxy.target===this.proxy.origin&&(!!this.isDefinedContainer()||!("input"===this.name&&this.node instanceof HTMLInputElement&&"password"===this.node.type)&&(-1!==Vt.indexOf(this.name)||(ze.isLeaf(this.node)?!this.isBigBlank():this.hasBackgroundImage()&&ze.depthInside(this.node,4))))},e.prototype.isSimpleContainer=function(){return"select"===this.name||this.isDefaultContainer()&&(function(e,t){if(0===e.children.length)return!1;for(var n=0,i=H(e.children);n0)for(var n=0;ns>>1||o>u>>1)},e.prototype.hasBackgroundImage=function(){var e=this.computedStyle().backgroundImage;return!!e&&"none"!==e&&e.length>0},e.prototype.zLevel=function(){var e=this.computedStyle(),t=e.zIndex;if("auto"!==t)return Number(t||"0")+this.parentNodeDesc.zLevel;switch(e.position){case"relative":return this.parentNodeDesc.zLevel+2;case"sticky":return this.parentNodeDesc.zLevel+3;case"absolute":return this.parentNodeDesc.zLevel+4;case"fixed":return this.parentNodeDesc.zLevel+5;default:return this.parentNodeDesc.zLevel+1}},e.prototype.computeWindowRect=function(){if(this.rect)return this.rect;var e=this.node.getBoundingClientRect(),t=e.top,n=e.bottom,i=e.left,r=e.right-i,o=n-t;return 0>t?o=t+o:t+o>this.devicesInfo.winHeight&&(o=this.devicesInfo.winHeight-t),0>i?r=i+r:i+r>this.devicesInfo.winWidth&&(r=this.devicesInfo.winWidth-i),this.rect={top:t,left:i,width:r,height:o},this.rect},e.prototype.computedStyle=function(){return window.getComputedStyle(this.node)},e.prototype.getDeviceRect=function(e){var t=this.devicesInfo,n=t.scale,i=t.webviewTop,r=t.webviewLeft;return{top:e.top*n+i,left:e.left*n+r,width:e.width*n,height:e.height*n}},e}(),zt=["DOMContentLoaded","onreadystatechange"],Xt=["scroll","resize","load","beforeunload","popstate","hashchange","pagehide","unload"],Jt=function(){function e(e){this.growingIO=e,this.addDomChangeListener()}return e.prototype.getDomTree=function(e,t,n,i,r,o){var a=function(e,t,n,i,r){var o=document.documentElement.clientWidth;return{winWidth:o,winHeight:document.documentElement.clientHeight,scale:n/o,webviewTop:t,webviewLeft:e,webviewWidth:n,webviewHeight:i,webviewZLevel:r}}(e,t,n,i,r),s=this.getElementsByParent(o||document.body,{isContainer:!1,zLevel:0},a),u=this.growingIO.dataStore.currentPage;return{page:{domain:u.domain,path:u.path,query:u.query,title:u.title},elements:s}},e.prototype.getElementsByParent=function(e,t,n){var i=this,r=[];return[].slice.call(e.childNodes,0).filter((function(e){return 1===e.nodeType})).forEach((function(e){var o=new Ft(e,t,n);if(o.cssVisible()&&!o.isIgnore){switch(o.viewportStatus()){case xt.INNER_SHOW:o.isCircleable()&&r.push(o.info());break;case xt.INNER_COVERED:o.isDefaultContainer()&&r.push(o.info())}o.isSimpleContainer()||[].push.apply(r,i.getElementsByParent(e,o.desc(),n))}})),r},e.prototype.addDomChangeListener=function(){var e,t=function(t){return void 0===t&&(t=""),function(){var n;"beforeunload"===t&&e&&e.disconnect(),null===(n=window.GrowingWebViewJavascriptBridge)||void 0===n||n.onDomChanged()}};(e=new MutationObserver(t("mutation"))).observe(document.body,{attributes:!0,characterData:!0,childList:!0,subtree:!0}),zt.forEach((function(e){ie(document,e,t(e))})),Xt.forEach((function(e){ie(window,e,t(e))}))},e}(),Zt=function(){function e(t){var n,i=this;this.growingIO=t,null===(n=this.growingIO.emitter)||void 0===n||n.on(xe,(function(){if(window.GrowingWebViewJavascriptBridge){var t=i;window.GrowingWebViewJavascriptBridge.getDomTree=function(){if(arguments.length>=4)return e.bindGetDomTree(t.growingIO),e.domHelper.getDomTree.apply(e.domHelper,arguments)}}}))}return e.bindGetDomTree=function(e){this.domHelper||(this.domHelper=new Jt(e),window.GrowingWebViewJavascriptBridge.getDomTree=this.domHelper.getDomTree.bind(this.domHelper))},e}(),Yt={name:"gioHybridCircle",method:Zt},Qt={name:"gioImpressionTracking",method:function(e){var t,n=this;this.growingIO=e,this.documentReady=!1,this.main=function(e){"listener"===e?(n.documentReady=!0,n.growingIO.gioSDKInitialized&&n.initMutationObserver()):"emitter"===e&&n.documentReady&&n.initMutationObserver()},this.initIntersectionObserver=function(){n.intersectionObserver=new IntersectionObserver((function(e){Y(e)||e.map((function(e){var t=e.target,i=t.dataset,r=t.id;if(e.intersectionRatio>0){var o=n.getImpressionProperties(i),a=o.eventId,s=o.properties,u=o.items;if(r){if("once"===i.gioImpType&&F(n.sentImps,r))return;n.sentImps[r]={eventId:a,properties:s,items:u}}a&&n.growingIO.track(a,s,u)}}))}))},this.initMutationObserver=function(){var e;n.mutationObserver&&(null===(e=n.mutationObserver)||void 0===e||e.disconnect());var t=document.querySelectorAll("[data-gio-imp-track]");H(t).map((function(e){var t;null===(t=n.intersectionObserver)||void 0===t||t.observe(e)})),n.mutationObserver=new MutationObserver((function(e){e.map((function(e){var t,i;"attributes"===e.type&&(null===(t=e.target.dataset)||void 0===t?void 0:t.gioImpTrack)&&(null===(i=n.intersectionObserver)||void 0===i||i.observe(e.target))}))})),n.mutationObserver.observe(document.body,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0,attributeFilter:["data-gio-imp-track","data-gio-imp-attrs","data-gio-imp-items",/^data-gio-track-[a-z]+$/i]})},this.getImpressionProperties=function(e){var t={eventId:void 0,properties:{}};if(!(null==e?void 0:e.gioImpTrack))return t;if(t.eventId=e.gioImpTrack,F(e,"gioImpAttrs"))t.properties=te((function(){return N(e.gioImpAttrs)?e.gioImpAttrs:JSON.parse(e.gioImpAttrs)})),t.items=te((function(){return N(e.gioImpItems)?e.gioImpItems:JSON.parse(e.gioImpItems)}));else{var n=/^gioTrack(.+)/;for(var i in e){var r=void 0,o=i.match(n);o&&"track"!==(r=K(o[1]))&&(t.properties[r]=e[i])}}return t.properties=ne(t.properties),t.items=ne(t.items),/^\w+$/.test(t.eventId)&&!Number.isInteger(Number(D(t.eventId.split(""))))||(t.eventId=null,t={}),t},this.sentImps={},window.IntersectionObserver&&window.MutationObserver?(this.initIntersectionObserver(),ie(document,"readystatechange",(function(){q(["interactive","complete"],document.readyState)&&n.main("listener")}),{once:!0}),null===(t=this.growingIO.emitter)||void 0===t||t.on(xe,(function(){return n.main("emitter")})),ie(window,"unload",(function(){var e,t;null===(e=n.intersectionObserver)||void 0===e||e.disconnect(),null===(t=n.mutationObserver)||void 0===t||t.disconnect()}))):ee("当前浏览器不支持半自动埋点,gioImpressionTracking已自动关闭!","warn")}},$t={name:"gioWebCircle",method:function(e){var t,n=this;this.growingIO=e,this.injectCircle=function(e,t){var n=document.createElement("link"),i=document.createElement("script");n.rel="stylesheet",n.href=e,i.src=t,document.head.appendChild(n),document.head.appendChild(i)},null===(t=this.growingIO.emitter)||void 0===t||t.on(xe,(function(){window.addEventListener("message",(function(e){var t=e.data,i=e.source,r=window.vds;if(t&&i){var o=i.vds,a=t.cssURL,s=t.jsURL;o&&"SDK_INJECT_CIRCLE_SCRIPT"===t.type&&r.projectId===o.projectId&&r.dataSourceId===o.dataSourceId&&n.injectCircle(a,s)}}))}))}},en=["gioPerformance"],tn=function(e){function n(t){var n=e.call(this,t)||this;return n.growingIO=t,n.growingIO.gioSDKFull=!0,n.pluginsContext={plugins:{gioCompress:Re,gioCustomTracking:ke,gioEmbeddedAdapter:Ve,gioEventAutoTracking:Gt,gioHybridAdapter:jt,gioHybridCircle:Yt,gioImpressionTracking:Qt,gioWebCircle:$t}},n}return t(n,e),n}((function(e){var t,n,i,r,o=this;this.growingIO=e,this.innerPluginInit=function(){var e;en.forEach((function(e){var t;return Z(null===(t=o.pluginsContext)||void 0===t?void 0:t.plugins,e)})),z(null===(e=o.pluginsContext)||void 0===e?void 0:e.plugins).forEach((function(e){var t,n=null===(t=o.pluginsContext)||void 0===t?void 0:t.plugins[e],i=n.name,r=n.method;U(o.pluginItems,(function(e){return e.name===i}))||o.pluginItems.push({name:K(i||e),method:r||function(e){}})})),Y(o.pluginItems)||o.installAll()},this.install=function(e,t,n){var i,r,a=t||U(o.pluginItems,(function(t){return t.name===e}));if((null===(i=o.growingIO)||void 0===i?void 0:i.plugins)[e])return ee("重复加载插件 ".concat(e," 或插件重名,已跳过加载!"),"warn"),!1;if(!a)return ee("插件加载失败!不存在名为 ".concat(e," 的插件!"),"error"),!1;try{return(null===(r=o.growingIO)||void 0===r?void 0:r.plugins)[e]=new a.method(o.growingIO,n),"cdp"===o.growingIO.gioEnvironment&&t&&ee("加载插件 ".concat(e),"info"),!0}catch(e){return ee("插件加载异常 ".concat(e),"error"),!1}},this.installAll=function(e){(e||o.pluginItems).forEach((function(t){o.install(t.name,e?t:void 0,e?null==t?void 0:t.options:void 0)&&!U(o.pluginItems,(function(e){return e.name===t.name}))&&o.pluginItems.push({name:K(t.name),method:t.method?t.method:function(){}})}))},this.uninstall=function(e){var t;Z(o.pluginItems,e);var n=Z(null===(t=o.growingIO)||void 0===t?void 0:t.plugins,e);return n||ee("卸载插件 ".concat(e," 失败!"),"error"),n},this.uninstallAll=function(){o.pluginItems.forEach((function(e){return o.uninstall(e.name)}))},this.lifeError=function(e,t){return ee("插件执行错误 ".concat(e.name," ").concat(t),"error")},this.onComposeBefore=function(e){o.pluginItems.forEach((function(t){var n,i=null===(n=o.growingIO.plugins[t.name])||void 0===n?void 0:n.onComposeBefore;if(i&&P(i))try{i(e)}catch(e){o.lifeError(t,e)}}))},this.onComposeAfter=function(e){o.pluginItems.forEach((function(t){var n,i=null===(n=o.growingIO.plugins[t.name])||void 0===n?void 0:n.onComposeAfter;if(i&&P(i))try{i(e)}catch(e){o.lifeError(t,e)}}))},this.onSendBefore=function(e){o.pluginItems.forEach((function(t){var n,i=null===(n=o.growingIO.plugins[t.name])||void 0===n?void 0:n.onSendBefore;if(i&&P(i))try{i(e)}catch(e){o.lifeError(t,e)}}))},this.onSendAfter=function(e){o.pluginItems.forEach((function(t){var n,i=null===(n=o.growingIO.plugins[t.name])||void 0===n?void 0:n.onSendAfter;if(i&&P(i))try{i(e)}catch(e){o.lifeError(t,e)}}))},this.pluginsContext={plugins:{}},this.pluginItems=[],null===(t=this.growingIO.emitter)||void 0===t||t.on("onComposeBefore",this.onComposeBefore),null===(n=this.growingIO.emitter)||void 0===n||n.on("onComposeAfter",this.onComposeAfter),null===(i=this.growingIO.emitter)||void 0===i||i.on("onSendBefore",this.onSendBefore),null===(r=this.growingIO.emitter)||void 0===r||r.on("onSendAfter",this.onSendAfter)})),nn=function(){function e(e){this.growingIO=e;var t=this.growingIO.vdsConfig.projectId,n=this.growingIO.storage,i=n.getItem,r=n.setItem,o=n.getKeys,a=n.removeItem;this.getItem=i,this.setItem=r,this.getKeys=o,this.removeItem=a,this.sIdStorageName="".concat(t,"_gdp_session_id"),this.uidStorageName="gdp_user_id_gioenc",this.userIdStorageName="".concat(t,"_gdp_cs1_gioenc"),this.userKeyStorageName="".concat(t,"_gdp_user_key_gioenc"),this.gioIdStorageName="".concat(t,"_gdp_gio_id_gioenc")}return Object.defineProperty(e.prototype,"sessionId",{get:function(){return this.getItem(this.sIdStorageName)||(this.sessionId=ge(),this.sessionId)},set:function(e){var t,n=this;e||(e=ge());var i=this.getItem(this.sIdStorageName)||this.prevSessionId,r=this.growingIO.vdsConfig.sessionExpires,o=void 0===r?30:r;this.setItem(this.sIdStorageName,e,+Date.now()+60*o*1e3),i!==e&&(this.getKeys().filter((function(e){return/.+_gdp_session_id_.{36}/.test(e)})).forEach((function(e){n.removeItem(e)})),this.setItem(this.growingIO.dataStore.visitStorageName,""),null===(t=this.growingIO.emitter)||void 0===t||t.emit(Ae,{newSessionId:e,oldSessionId:i})),this.prevSessionId=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"uid",{get:function(){return this.getItem(this.uidStorageName)||(this.uid=ge(),this.uid)},set:function(e){var t,n=this.getItem(this.uidStorageName)||this.prevUId;this.setItem(this.uidStorageName,e),n!==e&&(null===(t=this.growingIO.emitter)||void 0===t||t.emit("UID_UPDATE",{newUId:e,oldUId:n})),this.prevUId=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"userId",{get:function(){return this.getItem(this.userIdStorageName)||""},set:function(e){var t,n,i=this.getItem(this.userIdStorageName)||this.prevUserId;this.setItem(this.userIdStorageName,e),null===(t=this.growingIO.emitter)||void 0===t||t.emit(De,{newUserId:e,oldUserId:i,userKey:this.userKey}),i!==e&&(null===(n=this.growingIO.emitter)||void 0===n||n.emit("USERID_UPDATE",{newUserId:e,oldUserId:i,userKey:this.userKey})),e&&(this.gioId=e),this.prevUserId=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"userKey",{get:function(){return this.getItem(this.userKeyStorageName)||""},set:function(e){var t,n,i=this.getItem(this.userKeyStorageName)||this.prevUserKey;this.setItem(this.userKeyStorageName,e),null===(t=this.growingIO.emitter)||void 0===t||t.emit(Le,{newUserKey:e,oldUserKey:i,userId:this.userId}),i!==e&&(null===(n=this.growingIO.emitter)||void 0===n||n.emit("USERKEY_UPDATE",{newUserKey:e,oldUserKey:i,userId:this.userId})),this.prevUserKey=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"gioId",{get:function(){return this.getItem(this.gioIdStorageName)||""},set:function(e){var t,n=this.getItem(this.gioIdStorageName)||this.prevGioId;this.setItem(this.gioIdStorageName,e),n!==e&&(null===(t=this.growingIO.emitter)||void 0===t||t.emit("GIOID_UPDATE",{newGioId:e,oldGioId:n})),this.prevGioId=e},enumerable:!1,configurable:!0}),e}(),rn=function(e){var t=this;this.growingIO=e,this.main=function(){var e,i,r=t.growingIO,o=r.sdkVersion,a=r.useEmbeddedInherit,s=r.vdsConfig,u=r.userStore,c=r.dataStore,d=r.trackingId,l=c.currentPage,g=l.path,f=l.query,h={appVersion:s.version,dataSourceId:s.dataSourceId,deviceId:u.uid,domain:a?s.appId:window.location.host,gioId:u.gioId,language:navigator.language,path:g,platform:s.platform,query:f,referralPage:(null===(e=c.lastPageEvent)||void 0===e?void 0:e.referralPage)||"",screenHeight:window.screen.height,screenWidth:window.screen.width,sdkVersion:o,sessionId:u.sessionId,timestamp:+Date.now(),title:null!==(i=te((function(){return document.title.slice(0,255)})))&&void 0!==i?i:"",userId:u.userId};if(s.enableIdMapping&&(h.userKey=u.userKey),Y(s.ignoreFields)||s.ignoreFields.forEach((function(e){Z(h,e)})),a&&!Y(t.minpExtraParams)){var p=n({},h);X(n(n({},h),t.minpExtraParams),(function(e,n){var i;q(s.embeddedIgnore,n)?(h[n]=p[n],"domain"===n&&(h[n]=window.location.host)):h[n]=null!==(i=t.minpExtraParams[n])&&void 0!==i?i:h[n]}))}return h.trackingId=d,h},this.minpExtraParams={}},on=function(e){var t=this;this.growingIO=e,this.parsePage=function(){var e=t.growingIO.vdsConfig.hashtag,n=location.pathname,i=location.search,r=location.hash,o=r.indexOf("?");t.domain=window.location.host,t.title=document.title.slice(0,255),t.time=+Date.now(),t.path=n,t.query=i,e&&(o>-1?(t.path+=r.slice(0,o),t.query=t.query+"&"+r.slice(o+1)):t.path+=r),t.query&&q(["?","&"],t.query.charAt(0))&&(t.query=t.query.slice(1))},this._getNoHashHref=function(){var e=window.location,t=e.protocol,n=e.host,i=e.pathname,r=e.search;return"".concat(t,"://").concat(n).concat(i).concat(r)},this.getReferralPage=function(){var e,n,i=t.growingIO.dataStore.lastPageEvent;return(null==i?void 0:i.path)===t.path&&(null!==(e=null==i?void 0:i.query)&&void 0!==e?e:"")===(null!==(n=t.query)&&void 0!==n?n:"")?null==i?void 0:i.referralPage:(null==i?void 0:i.path)?t.lastHref:document.referrer},this.pageListener=function(){var e=t.growingIO.vdsConfig.hashtag,n=window.location.href,i=t.lastHref;e||(n=t._getNoHashHref(),i=t.lastNoHashHref),i!==n&&(t.parsePage(),t.buildPageEvent())},this.hookHistory=function(){var e=window.history.pushState,n=window.history.replaceState,i=t;e&&te((function(){return window.history.pushState=function(){e.apply(window.history,arguments),setTimeout(i.pageListener)}})),n&&te((function(){return window.history.replaceState=function(){n.apply(window.history,arguments),setTimeout(i.pageListener)}})),ie(window,"popstate",t.pageListener),t.growingIO.vdsConfig.hashtag&&ie(window,"hashchange",t.pageListener)},this.buildPageEvent=function(e){var i=t.growingIO.dataStore;i.lastPageEvent;var r=i.eventContextBuilder,o=i.eventConverter,a=n(n({eventType:"PAGE"},r()),{protocolType:location.protocol.substring(0,location.protocol.length-1),referralPage:t.getReferralPage()});Y(e)||(a=n(n({},a),e)),a.timestamp=t.time,o(a),t.lastHref=window.location.href,t.lastNoHashHref=t._getNoHashHref(),t.lastLocation=n({},window.location)},this.title=document.title.slice(0,255),this.lastLocation=n({},window.location)},an={referralPage:document.referrer},sn=function(){function e(e){var t,i,u,c=this;this.growingIO=e,this.ALLOW_SETTING=n(n({},o),"saas"===this.growingIO.gioEnvironment?s:a),this.allowOptKeys=Object.keys(this.ALLOW_SETTING),this.trackTimers={},this.setSequenceIds=function(e,t){var i=c.growingIO.storage.getItem(c.seqStorageIdName)||{};"gsid"===e?i.globalKey=t:i=n(n({},i),t),c.growingIO.storage.setItem(c.seqStorageIdName,i)},this.initOptions=function(e){var t,i,o,a,s,u,d,l=e.projectId,g=e.dataSourceId,f=e.appId;c.initialDataSourceId=g;var h={};c.allowOptKeys.forEach((function(t){var n=c.ALLOW_SETTING[t].type,i=x(n)?!q(n,Q(e[t])):Q(e[t])!==n;"platform"!==t||q(r,e[t])||(i=!0),i?h[t]=c.ALLOW_SETTING[t].default:"ignoreFields"===t?h.ignoreFields=e.ignoreFields.filter((function(e){return q(I,e)})):(h[t]=e[t],q(["dataCollect","autotrack"],t)&&(h[t]||ee("已关闭".concat(v[t]),"info")))})),h.sessionExpires=Math.round(h.sessionExpires),(E(h.sessionExpires)||1>h.sessionExpires||h.sessionExpires>360)&&(h.sessionExpires=30),h.storageType=h.storageType.toLowerCase(),h.sendType=h.sendType.toLowerCase(),q(["beacon","xhr","image"],h.sendType)||(h.sendType="beacon"),!E(Number(h.requestTimeout))&&h.requestTimeout>0||(h.requestTimeout=5e3),c.growingIO.vdsConfig=n(n(n({},null!==(t=window.vds)&&void 0!==t?t:{}),h),{projectId:l,dataSourceId:g,appId:f,performance:{monitor:null===(o=null===(i=h.performance)||void 0===i?void 0:i.monitor)||void 0===o||o,exception:null===(s=null===(a=h.performance)||void 0===a?void 0:a.exception)||void 0===s||s,network:null!==(d=null===(u=h.performance)||void 0===u?void 0:u.network)&&void 0!==d&&d}}),window.vds=c.growingIO.vdsConfig,c.seqStorageIdName="".concat(l,"_gdp_sequence_ids"),c.visitStorageName="".concat(l,"_gdp_session_id_sent")},this.setOption=function(e,t){var i,r=c.growingIO,o=r.vdsConfig,a=r.callError,s=r.uploader,u=r.emitter,d=T(e)&&q(p,e),l=d&&typeof t===((null===(i=c.ALLOW_SETTING[e])||void 0===i?void 0:i.type)||"string"),g=n({},o);return d&&l?(o[e]=t,"dataCollect"===e&&g.dataCollect!==t&&(t?(c.sendVisit(!0),c.sendPage()):c.growingIO.clearTrackTimer()),q(["host","scheme"],e)&&(null==s||s.generateHost()),null==u||u.emit("OPTION_CHANGE",{optionName:e,optionValue:t}),window.vds[e]=t,!0):(a("setOption > ".concat(e)),!1)},this.getOption=function(e){var t=c.growingIO,i=t.vdsConfig,r=t.callError;return e&&F(i,j(e))?i[j(e)]:b(e)?n({},i):void r("getOption > ".concat(e))},this.sendVisit=function(e){var t=c.growingIO,n=t.userStore.sessionId,i=t.storage.getItem(c.visitStorageName);!e&&n===i||(c.lastVisitEvent.timestamp=c.currentPage.time-1,c.buildVisitEvent())},this.buildVisitEvent=function(e){var t=c.growingIO,i=t.dataStore,r=i.eventContextBuilder,o=i.eventConverter,a=t.emitter,s=t.storage,u=t.userStore,d=c.lastVisitEvent,l=d.referralPage,g=d.title,f=d.path,h=d.query,p=d.timestamp,v=n(n({eventType:"VISIT"},r()),{referralPage:l||c.currentPage.getReferralPage(),timestamp:p});f&&(v.title=g,v.path=f,v.query=h),Y(e)||(v.session=(null==e?void 0:e.session)||v.session,v.trackingId=null==e?void 0:e.trackingId,v=n(n({},v),e));var m=function(e){var t=e.requestData;"VISIT"===t.eventType&&t.trackingId===c.growingIO.trackingId&&(u.sessionId===t.sessionId&&s.setItem(c.visitStorageName,t.sessionId),a.off("onSendAfter",m))};a.on("onSendAfter",m),o(v)},this.sendPage=function(e){e&&c.currentPage.parsePage(),c.currentPage.buildPageEvent()},this.buildErrorEvent=function(e){var t=c.growingIO.dataStore,i=t.eventContextBuilder;(0,t.eventConverter)(n({eventType:"CUSTOM",pageShowTimestamp:c.currentPage.time,eventName:"onError",attributes:e},i()))},this.currentPage=new on(this.growingIO),this.eventContextBuilderInst=new rn(this.growingIO),this.eventContextBuilder=this.eventContextBuilderInst.main,this.generalProps={},this.lastVisitEvent=an,null===(t=this.growingIO.emitter)||void 0===t||t.on("onComposeAfter",(function(e){var t=e.composedEvent;"VISIT"!==t.eventType&&"vst"!==t.t||t.trackingId!==c.growingIO.trackingId||(c.lastVisitEvent=t)})),this.lastPageEvent={},null===(i=this.growingIO.emitter)||void 0===i||i.on("onComposeAfter",(function(e){var t=e.composedEvent;"PAGE"!==t.eventType&&"page"!==t.t||t.trackingId!==c.growingIO.trackingId||(c.lastPageEvent=t)})),null===(u=this.growingIO.emitter)||void 0===u||u.on(Ae,(function(){if(c.growingIO.gioSDKInitialized){c.currentPage.parsePage();var e=c.currentPage,t=e.title,n=e.path,i=e.query,r=e.time,o=e.getReferralPage;c.lastVisitEvent={referralPage:document.referrer||o(),title:t,path:n,query:i,timestamp:r-1},c.sendVisit(!0),c.sendPage(!0)}}))}return Object.defineProperty(e.prototype,"esid",{get:function(){var e=this,t=this.growingIO.storage.getItem(this.seqStorageIdName)||{},i=n({},t);return Z(i,"globalKey"),i=N(i)&&!b(i)?i:{},this._esid={},z(i).forEach((function(t){e._esid[t]=E(Number(i[t]))||i[t]>=1e9||1>i[t]?1:i[t]})),this._esid},set:function(e){var t={};z(e).forEach((function(n){t[n]=E(e[n])||e[n]>=1e9||1>e[n]?1:e[n]})),J(this._esid,t)||(this._esid=t,this.setSequenceIds("esid",this._esid))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"gsid",{get:function(){var e=this.growingIO.storage.getItem(this.seqStorageIdName)||{},t=Number(e.globalKey);return this._gsid=E(t)||t>=1e9||1>t?1:t,this._gsid},set:function(e){E(Number(e))||e>=1e9||1>e?this._gsid=1:this._gsid=e,this.setSequenceIds("gsid",this._gsid)},enumerable:!1,configurable:!0}),e}(),un=function(e){function i(t){var i=e.call(this,t)||this;return i.growingIO=t,i.eventConverter=function(e){var t,r,o=i.growingIO,a=o.vdsConfig,s=o.dataStore,u=o.uploader;if(a.dataCollect){e.trackingId===i.growingIO.trackingId&&(e.globalSequenceId=s.gsid,e.eventSequenceId=s.esid[e.eventType]||1);var c={};X(e,(function(e,t){var n;if("element"===t){var i=null!==(n=D(e))&&void 0!==n?n:{};X(i,(function(e,t){Y(e)&&0!==e||(c[t]=e)}))}else(Y(e)||b(e))&&0!==e||(c[t]=e)})),e.trackingId===i.growingIO.trackingId&&(i.growingIO.dataStore.gsid+=1,i.growingIO.dataStore.esid=n(n({},i.growingIO.dataStore.esid),((t={})[c.eventType]=(i.growingIO.dataStore.esid[c.eventType]||1)+1,t))),null===(r=i.growingIO.emitter)||void 0===r||r.emit("onComposeAfter",{composedEvent:n({},c)}),e.trackingId===i.growingIO.trackingId&&u.commitRequest(c)}else"VISIT"===e.eventType&&(i.lastVisitEvent=e)},i}return t(i,e),i}(sn),cn=function(e){function n(t){var n=e.call(this,t)||this;return n.growingIO=t,n.generateHost=function(){var e=n.growingIO.vdsConfig,t=e.scheme,i=e.host,r=void 0===i?"":i,o=e.projectId;t?V(j(t),"://")||(t="".concat(t,"://")):t="".concat(location.protocol.indexOf("http")>-1?location.protocol.replace(":",""):"https","//"),W(r,"http")&&(r=r.substring(r.indexOf("://")+(V(j(t),"://")?3:0))),n.requestURL="".concat(t).concat(r,"/v3/projects/").concat(o,"/collect")},n.requestURL="",n.generateHost(),n}return t(n,e),n}((function(e){var t=this;this.growingIO=e,this.getSendType=function(){var e=t.growingIO.vdsConfig.sendType;return"beacon"===e?function(){var e,t,n=!!(null===(e=null===window||void 0===window?void 0:window.navigator)||void 0===e?void 0:e.sendBeacon),i=window.navigator.userAgent;if(i.match(/(iPad|iPhone|iPod)/g)){var r=!(t=i.toLowerCase().match(/cpu.*os (.*?) like mac os/i))||2>t.length?0:+t[1].split("_").slice(0,2).join(".");return n&&r>13}return n}()?"beacon":"xhr":e},this.commitRequest=function(e){var i=n({},e);t.requestQueue.push(n(n({},i),{requestType:t.getSendType()})),t.initiateRequest()},this.initiateRequest=function(){var e,r,o;if(i([],t.requestQueue,!0).length>0&&t.requestingNum0?j(n).slice(0,1e3):""),t.userStore.userId=j(e).slice(0,1e3),i&&i!==t.userStore.userId&&(t.userStore.sessionId="")}else t.clearUserId(),t.callError("setUserId")},t.clearUserId=function(){t.userStore.userId="",t.userStore.userKey=""},t.track=function(e,i,r,o){var a,s;((null===(s=null===(a=t.plugins)||void 0===a?void 0:a.gioCustomTracking)||void 0===s?void 0:s.buildCustomEvent)||function(){})(e,n(n({},t.dataStore.generalProps),N(i)&&!Y(i)?i:{}),r,o)},t.sendPage=function(e){return t.dataStore.currentPage.buildPageEvent(e)},t.sendVisit=function(e){return t.dataStore.buildVisitEvent(e)},t.trackTimerStart=function(e,n){t.vdsConfig.dataCollect&&re(e,(function(){var i=ge();P(n)?(t.dataStore.trackTimers[i]={eventName:e,leng:0,start:+Date.now()},n(i)):ee("回调方法不合法,返回timerId失败!")}))},t.trackTimerPause=function(e){if(e&&t.dataStore.trackTimers[e]){var n=t.dataStore.trackTimers[e];n.start&&(n.leng=n.leng+(+Date.now()-n.start)),n.start=0}},t.trackTimerResume=function(e){if(e&&t.dataStore.trackTimers[e]){var n=t.dataStore.trackTimers[e];0===n.start&&(n.start=+Date.now())}},t.trackTimerEnd=function(e,i){if(t.vdsConfig.dataCollect)if(e&&t.dataStore.trackTimers[e]){var r=t.dataStore.trackTimers[e];if(0!==r.start){var o=+Date.now()-r.start;r.leng=o>0?r.leng+o:0}t.track(r.eventName,n(n({},i),{event_duration:r.leng>864e5?0:r.leng/1e3})),t.removeTimer(e)}else ee("未查找到对应的计时器,请检查!","error")},t.removeTimer=function(e){e&&t.dataStore.trackTimers[e]&&delete t.dataStore.trackTimers[e]},t.clearTrackTimer=function(){t.dataStore.trackTimers={}},t.dataStore=new un(t),t}return t(i,e),i}((function(){var e,t=this;this.trackingId="g0",this.init=function(e){var n,i,r,o,a;ee("Gio Web SDK 初始化中...","info");var s=t.dataStore,u=s.initOptions,c=s.currentPage,d=s.sendVisit,l=s.sendPage;u(e),t.storage=Ce(t.vdsConfig),t.initCallback(),null===(n=t.emitter)||void 0===n||n.emit(Pe,t),null===(r=null===(i=t.plugins)||void 0===i?void 0:i.gioEventAutoTracking)||void 0===r||r.main(),c.hookHistory(),c.parsePage(),null===(o=t.emitter)||void 0===o||o.emit(xe,t),ee("Gio Web SDK 初始化完成!","success"),t.useEmbeddedInherit||(t.dataStore.lastVisitEvent.timestamp=c.time,d()),l(),t.gioSDKInitialized=!0,t.vdsConfig.gioSDKInitialized=!0,window[t.vds]=t.vdsConfig,null===(a=t.emitter)||void 0===a||a.emit("SDK_INITIALIZED_COMPLATE",t)},this.setOption=function(e,n){if(q(p,e)){var i=t.dataStore.setOption(e,n);return i&&v[e]&&ee("已".concat(n?"开启":"关闭").concat(v[e]),"info"),i}return ee("不存在可修改的配置项:".concat(e,",请检查后重试!"),"warn"),!1},this.getOption=function(e){return t.dataStore.getOption(e)},this.setGeneralProps=function(e){N(e)&&!Y(e)?(t.dataStore.generalProps=n(n({},t.dataStore.generalProps),e),z(t.dataStore.generalProps).forEach((function(e){q([void 0,null],t.dataStore.generalProps[e])&&(t.dataStore.generalProps[e]="")}))):t.callError("setGeneralProps")},this.clearGeneralProps=function(e){x(e)&&!Y(e)?e.forEach((function(e){Z(t.dataStore.generalProps,e)})):t.dataStore.generalProps={}},this.reissuePage=function(){t.dataStore.sendPage()},this.notRecommended=function(){return ee("不推荐的方法使用,建议使用 gio('setOption', [optionName], [value])!","info")},this.callError=function(e,t,n){return void 0===t&&(t=!0),void 0===n&&(n="参数不合法"),ee("".concat(t?"调用":"设置"," ").concat(e," 失败,").concat(n,"!"),"warn")},this.updateImpression=function(){var e,n,i=null===(n=null===(e=t.plugins)||void 0===e?void 0:e.gioImpressionTracking)||void 0===n?void 0:n.main;i?i("emitter"):ee("updateImpression 错误! 请集成半自动埋点浏览插件后重试!","error")},this.gioEnvironment="cdp",this.sdkVersion="3.8.7",this.vds=window.gioCompatibilityVds?"gdp_vds":"vds",this.utils=n(n({},$),oe),this.emitter={all:e=e||new Map,on:function(t,n){var i=e.get(t);i?i.push(n):e.set(t,[n])},off:function(t,n){var i=e.get(t);i&&(n?i.splice(i.indexOf(n)>>>0,1):e.set(t,[]))},emit:function(t,n){var i=e.get(t);i&&i.slice().map((function(e){e(n)})),(i=e.get("*"))&&i.slice().map((function(e){e(t,n)}))}},this.useEmbeddedInherit=!1,this.useHybridInherit=!1,this.gioSDKInitialized=!1,this.plugins=new tn(this),this.plugins.innerPluginInit()}));return function(){var e,t,i,r,o,a=window.gioCompatibilityVds?"gdp_vds":"vds";if(null===(e=window[a])||void 0===e?void 0:e.gioSDKInstalled)return Kt=window.gdp,void ee("SDK重复加载,请检查是否重复加载SDK或接入其他平台SDK导致冲突!","warn");window[a]=n(n({},null!==(t=window[a])&&void 0!==t?t:{}),{gioSDKInstalled:!0});var s=new dn;Kt=function(){var e,t=arguments[0];if(T(t)&&q(h,t)&&s[t]){var i=R(H(arguments));if("init"===t){var r=function(e){var t;return e.vdsConfig||e.gioSDKInitialized||(null===(t=window.vds)||void 0===t?void 0:t.gioSDKInitialized)?(ee("SDK重复初始化,请检查是否重复加载SDK或接入其他平台SDK导致冲突!","warn"),!1):!(q(["","localhost","127.0.0.1"],location.hostname)&&!window._gr_ignore_local_rule&&(ee("当前SDK不允许在本地环境初始化!","warn"),1))}(s);if(!r)return;var o=function(e){return!Y(k(e))||(ee('SDK初始化失败,请使用 gdp("init", "您的GrowingIO项目 accountId", "您项目的 dataSourceId", options); 进行初始化!',"error"),!1)}(i);if(!o)return;var u=function(e){var t=D(e),n=L(e);return ae(j(t).trim())?(N(n)&&n||(n={}),{projectId:t,userOptions:n}):(ee("SDK初始化失败,accountId 参数不合法!","error"),!1)}(i);if(!u)return;var c=function(e){var t=e[1],n=e[2],i=L(e);return t&&T(t)?{dataSourceId:t,appId:T(n)?n:"",cdpOptions:i}:(ee("SDK初始化失败,dataSourceId 参数不合法!","error"),!1)}(i);if(!c)return;var d=u.projectId,l=c.dataSourceId,g=c.appId,f=c.cdpOptions;s.init(n(n({},f),{projectId:d,dataSourceId:l,appId:g}))}else if("registerPlugins"===t)s.registerPlugins(i[0]);else{if(s.gioSDKInitialized&&s.vdsConfig)return s[t].apply(s,i);s.emitter.emit("UNINITIALIZED_CALL",arguments),ee("SDK未初始化!","error")}}else q(m,t)?ee("方法 ".concat(j(t)," 已被弃用,请移除!"),"warn"):ee("不存在名为 ".concat(j(t)," 的方法调用!"),"error");window[a]=n(n({},window[a]),{_gr_ignore_local_rule:null!==(e=window._gr_ignore_local_rule)&&void 0!==e&&e,gioEnvironment:"cdp",gioSDKVersion:s.sdkVersion,gioSDKFull:s.gioSDKFull,canIUse:function(e){return q(h,e)&&s[e]}})};var u=null===(i=null===window||void 0===window?void 0:window.gdp)||void 0===i?void 0:i.q,c=null===(r=null===window||void 0===window?void 0:window.gdp)||void 0===r?void 0:r.e,d=null===(o=null===window||void 0===window?void 0:window.gdp)||void 0===o?void 0:o.ef;window.gdp=Kt,window.gdp.e=c,window.gdp.ef=d,x(u)&&!Y(u)&&u.forEach((function(e){Kt.apply(null,e)}))}(),Kt})); diff --git a/gdp-full.js b/gdp-full.js index a0596bb..3636395 100644 --- a/gdp-full.js +++ b/gdp-full.js @@ -1 +1 @@ -const e=["web","wxwv","minp","alip","baidup","qq","bytedance"],t={autotrack:{type:"boolean",default:!0},compress:{type:"boolean",default:!0},dataCollect:{type:"boolean",default:!0},debug:{type:"boolean",default:!1},hashtag:{type:"boolean",default:!1},touch:{type:"boolean",default:!1},version:{type:"string",default:"1.0.0"},platform:{type:"string",default:"web"},cookieDomain:{type:"string",default:""},sendType:{type:"string",default:"beacon"}},i={enableIdMapping:{type:"boolean",default:!1},gtouchHost:{type:"string",default:""},host:{type:"string",default:"napi.growingio.com"},ignoreFields:{type:"array",default:[]},penetrateHybrid:{type:"boolean",default:!0},scheme:{type:"string",default:location.protocol.indexOf("http")>-1?location.protocol.replace(":",""):"https"},sessionExpires:{type:"number",default:30},performance:{type:"object",default:{monitor:!0,exception:!0}},embeddedIgnore:{type:"array",default:[]},storageType:{type:"string",default:"cookie"},requestTimeout:{type:"number",default:5e3}},n={},r=["clearUserId","getGioInfo","getLocation","getOption","init","setDataCollect","setOption","setUserId","track","setGeneralProps","clearGeneralProps","enableDebug","enableHT","setAutotrack","setTrackerHost","setTrackerScheme","setUserAttributes","getVisitorId","getDeviceId","registerPlugins","getPlugins","sendPage","sendVisit","trackTimerStart","trackTimerPause","trackTimerResume","trackTimerEnd","removeTimer","clearTrackTimer","updateImpression"],s=["autotrack","dataCollect","dataSourceId","debug","host","hashtag","scheme"],o={autotrack:"无埋点采集",dataCollect:"数据采集",debug:"调试模式"},a=["send","setConfig","collectImp","setPlatformProfile"],d=["screenHeight","screenWidth"],c={click:"VIEW_CLICK",change:"VIEW_CHANGE",submit:"FORM_SUBMIT"};var l,h,u,g,p,f="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},m="function"==typeof Array.from?Array.from:(h||(h=1,u=function(e){return"function"==typeof e},g=function(e){var t=function(e){var t=Number(e);return isNaN(t)?0:0!==t&&isFinite(t)?(t>0?1:-1)*Math.floor(Math.abs(t)):t}(e);return Math.min(Math.max(t,0),9007199254740991)},p=function(e){var t=e.next();return!t.done&&t},l=function(e){var t,i,n,r=this,s=arguments.length>1?arguments[1]:void 0;if(void 0!==s){if(!u(s))throw new TypeError("Array.from: when provided, the second argument must be a function");arguments.length>2&&(t=arguments[2])}var o=function(e,t){if(null!=e&&null!=t){var i=e[t];if(null==i)return;if(!u(i))throw new TypeError(i+" is not a function");return i}}(e,function(e){if(null!=e){if(["string","number","boolean","symbol"].indexOf(typeof e)>-1)return Symbol.iterator;if("undefined"!=typeof Symbol&&"iterator"in Symbol&&Symbol.iterator in e)return Symbol.iterator;if("@@iterator"in e)return"@@iterator"}}(e));if(void 0!==o){i=u(r)?Object(new r):[];var a,d,c=o.call(e);if(null==c)throw new TypeError("Array.from requires an array-like or iterable object");for(n=0;;){if(!(a=p(c)))return i.length=n,i;d=a.value,i[n]=s?s.call(t,d,n):d,n++}}else{var l=Object(e);if(null==e)throw new TypeError("Array.from requires an array-like object - not null or undefined");var h,f=g(l.length);for(i=u(r)?Object(new r(f)):Array(f),n=0;f>n;)h=l[n],i[n]=s?s.call(t,h,n):h,n++;i.length=f}return i}),l);const v=e=>L(["undefined","null"],$(e)),I=e=>"string"===$(e),w=e=>"number"===$(e),O=e=>"NaN"===k(Number(e)),b=e=>"boolean"===$(e),y=e=>"object"===$(e)&&!v(e),T=e=>"regexp"===$(e),E=e=>L(["function","asyncfunction"],$(e)),_=e=>Array.isArray(e)&&"array"===$(e),S=e=>"date"===$(e),N=e=>{try{return R(e)[0]}catch(e){return}},C=e=>{try{const t=R(e);return t[t.length-1]}catch(e){return}},x=(e,t=1)=>_(e)&&w(t)?e.slice(t>0?t:1,e.length):e,A=e=>{if(_(e)){let t=0;const i=[];for(const n of e)n&&!F(n)&&(i[t++]=n);return i}return e},P=(e,t)=>e[D(e,t)],D=(e,t)=>{let i=-1;return _(e)&&e.every(((e,n)=>!t(e)||(i=n,!1))),i},L=(e,t)=>("array"===$(e)||"string"===$(e))&&e.indexOf(t)>=0,R=m,k=e=>v(e)?"":""+e,U=(e,t)=>"string"==typeof e?e.split(t):e,j=e=>{if(I(e)){const t=U(e,"");return`${N(t).toLowerCase()}${x(t).join("")}`}return e},G=(e,t)=>!!I(e)&&e.slice(0,t.length)===t,q=(e,t)=>{if(I(e)){const{length:i}=e;let n=i;n>i&&(n=i);const r=n;return n-=t.length,n>=0&&e.slice(n,r)===t}return!1},H={}.hasOwnProperty,B=(e,t)=>!v(e)&&H.call(e,t),K=e=>y(e)?Object.keys(e):[],W=(e,t)=>{K(e).forEach((i=>t(e[i],i)))},V=(e,t)=>{const i=K(e);return!(!y(e)||!y(t)||i.length!==K(t).length||L(i.map(((i,n)=>y(e[i])?V(e[i],t[i]):e[i]===t[i])),!1))},M=(e,t)=>{if(!y(e))return!1;try{return"string"===$(t)?delete e[t]:"array"===$(t)?t.map((t=>delete e[t])):(T(t)&&K(e).forEach((i=>{t.test(i)&&M(e,i)})),!0)}catch(e){return!1}},F=e=>_(e)?0===e.length:y(e)?0===K(e).length:!e,$=e=>({}.toString.call(e).slice(8,-1).toLowerCase());var z=Object.freeze({__proto__:null,isNil:v,isString:I,isNumber:w,isNaN:O,isBoolean:b,isObject:y,isRegExp:T,isFunction:E,isArray:_,isDate:S,fixed:(e,t)=>w(e)?Number(e.toFixed(w(t)?t:2)):I(e)&&"NaN"!==k(Number(e))?Number(Number(e).toFixed(w(t)?t:2)):e,head:N,last:C,drop:x,dropWhile:(e,t)=>_(e)?e.filter((e=>!t(e))):e,compact:A,find:P,findIndex:D,includes:L,arrayFrom:R,toString:k,split:U,lowerFirst:j,upperFirst:e=>{if(I(e)){const t=U(e,"");return`${N(t).toUpperCase()}${x(t).join("")}`}return e},startsWith:G,endsWith:q,has:B,keys:K,forEach:W,isEqual:V,get:(e,t,i)=>{let n=e;return y(e)?(t.split(".").forEach((e=>{n=n?n[e]:i})),n):i},unset:M,isEmpty:F,typeOf:$,formatDate:e=>{if(S(e)){const t=e=>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())}return e}});const X=(e,t)=>{console.log("%c [GrowingIO]:"+e,{info:"color: #3B82F6;",error:"color: #EF4444;",warn:"color: #F59E0B;",success:"color: #10B981;"}[t]||"")},J=e=>{try{return e()}catch(e){return}},Z=e=>{const t={};return y(e)&&W(e,((e,i)=>{var n;const r=k(i).slice(0,100);y(e)?t[r]=Z(e):_(e)?(t[r]=e.slice(0,100),"cdp"===(null===(n=window.vds)||void 0===n?void 0:n.gioEnvironment)&&(t[r]=t[r].join("||").slice(0,1e3))):t[r]=v(e)?"":k(e).slice(0,1e3)})),t},Y=(e,t,i,n={})=>{document.addEventListener?e.addEventListener(t,i,Object.assign(Object.assign({},{capture:!0}),n)):e.attachEvent?e.attachEvent("on"+t,i):e["on"+t]=i},Q=(e,t)=>I(e)&&!F(e)&&e.match(/^[a-zA-Z_][0-9a-zA-Z_]{0,100}$/)?t():(X("事件名格式不正确,只能包含数字、字母和下划线,且不能以数字开头,字符总长度不能超过100!","error"),!1);var ee=Object.freeze({__proto__:null,consoleText:X,niceTry:J,limitObject:Z,addListener:Y,flattenObject:(e={})=>{const t=Object.assign({},e);return K(t).forEach((e=>{y(t[e])?(K(t[e]).forEach((i=>{t[`${e}_${i}`]=k(t[e][i])})),M(t,e)):_(t[e])?(t[e].forEach(((i,n)=>{y(i)?K(i).forEach((r=>{t[`${e}_${n}_${r}`]=k(i[r])})):t[`${e}_${n}`]=k(i)})),M(t,e)):v(t[e])||""===t[e]?M(t,e):t[e]=k(t[e])})),Z(t)},eventNameValidate:Q,getGioFunction:()=>{var e,t,i,n;const r=window._gio_local_vds||"vds",s=null!==(t=null===(e=window[r])||void 0===e?void 0:e.namespace)&&void 0!==t?t:"gdp";return E(window[s])?window[s]:null!==(n=null!==(i=window.gdp)&&void 0!==i?i:window.gio)&&void 0!==n?n:function(){}}});const te=e=>I(e)&&e.length>0||w(e)&&e>0,ie=/^((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})(\.((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})){3}/i,ne=/^(https?:\/\/)|(([a-zA-Z0-9_-])+(\.)?)*(:\d+)?(\/((\.)?(\?)?=?&?[a-zA-Z0-9_-](\?)?)*)*$/i;function re(e){for(var t=1;arguments.length>t;t++){var i=arguments[t];for(var n in i)e[n]=i[n]}return e}var se=function e(t,i){function n(e,n,r){if("undefined"!=typeof document){"number"==typeof(r=re({},i,r)).expires&&(r.expires=new Date(Date.now()+864e5*r.expires)),r.expires&&(r.expires=r.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var s="";for(var o in r)r[o]&&(s+="; "+o,!0!==r[o]&&(s+="="+r[o].split(";")[0]));return document.cookie=e+"="+t.write(n,e)+s}}return Object.create({set:n,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var i=document.cookie?document.cookie.split("; "):[],n={},r=0;r"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)})),ae=e=>q(e,"_gioenc")?e.slice(0,-7):e,de=e=>O(Number(e))&&J((()=>JSON.parse(e)))||e,ce={A:1,a:1,Z:1,z:1,"@":1,"{":1},le=e=>v(e)?e:J((()=>"gioenc-"+ue(e)))||e,he=e=>I(e)&&G(e,"gioenc-")&&J((()=>ue(e.replace("gioenc-",""))))||e,ue=e=>(e=e||"").split("").map((e=>ce[e]?e:ge(e))).join(""),ge=e=>{if(/[0-9]/.test(e))return 1^+e;{let t=e.charCodeAt(0);return String.fromCharCode(1^t)}};class pe{constructor(e){this.domain=e,this.getItem=e=>de(he(se.get(ae(e),{domain:this.domain,path:"/"}))),this.setItem=(e,t,i)=>{let n;n=I(t)?t.length?q(e,"_gioenc")?le(t):t:"":JSON.stringify(t),se.set(ae(e),n,{expires:i?new Date(i):3650,domain:this.domain,path:"/"})},this.removeItem=e=>{se.remove(ae(e),{domain:this.domain,path:"/"})},this.hasItem=e=>L(K(se.get()),ae(e)),this.getKeys=()=>K(se.get()),this.type="Cookie"}}class fe{constructor(){this.getItem=e=>{const t=J((()=>JSON.parse(localStorage.getItem(ae(e))||"")))||{};return y(t)&&t.expiredAt>+Date.now()?de(he(t.value)):void 0},this.setItem=(e,t,i)=>{const n=null!=i?i:+new Date(9999,12);localStorage.setItem(ae(e),JSON.stringify({value:I(t)&&t.length&&q(e,"_gioenc")?le(t):t,expiredAt:n}))},this.removeItem=e=>localStorage.removeItem(ae(e)),this.hasItem=e=>!!localStorage.getItem(ae(e)),this.getKeys=()=>R(Array(localStorage.length)).map(((e,t)=>localStorage.key(t))),this.type="localStorage"}}const me={};class ve{constructor(){this.getItem=e=>{const t=J((()=>JSON.parse(me[ae(e)]||"")));return y(t)&&t.expiredAt>+Date.now()?de(he(t.value)):void 0},this.setItem=(e,t,i)=>{const n=null!=i?i:+new Date(9999,12);me[ae(e)]=JSON.stringify({value:I(t)&&t.length?le(t):t,expiredAt:n})},this.removeItem=e=>M(me,ae(e)),this.hasItem=e=>B(me,ae(e)),this.getKeys=()=>K(me),this.type="memory"}}let Ie;const we=/^(\.ac\.|\.br\.|\.co\.|\.com\.|\.edu\.|\.gov\.|\.org\.|\.net\.)/,Oe=e=>{const t=[];try{const i=e.split("."),n=C(i);if(i.length>=2&&(isNaN(Number(n))||0>Number(n)||Number(n)>255)){const e="."+i.slice(-2).join(".");we.test(e)?Ie=e:t.push(e);const n="."+i.slice(-3).join(".");we.test(n)||L(t,n)||t.push(n);const r="."+i.slice(-4).join(".");we.test(r)||L(t,r)||t.push(r)}}catch(e){}return t},be=e=>{let t="";return e.every((e=>!ye(e)||(t=e,!1))),t},ye=e=>{try{se.set("gioCookie","yes",{domain:e});const t=!!se.get("gioCookie",{domain:e});return se.remove("gioCookie",{domain:e}),t}catch(e){return!1}},Te=e=>{let t,i,n,{storageType:r,cookieDomain:s,projectId:o}=e;if(L(["cookie","localstorage"],r)||(r="cookie"),"cookie"===r&&(n=navigator.userAgent.indexOf("Electron")>-1||L(["","localhost","127.0.0.1"],window.location.hostname)||!L(["http:","https:"],window.location.protocol)?"":be([...Oe(window.location.hostname),window.location.hostname]),i=!!n),"cookie"===r&&i){const e=new pe(n);if(s){let t=Oe(s);const i=be(F(t)?[]:[s,...Oe(s)]);i&&ye(i)?e.domain=i:X("指定Cookie域无效或无权限,使用默认域!","warn")}t=e}else t=(()=>{try{const e=window.localStorage,t="__storage_test__";return e.setItem(t,t),e.removeItem(t),!0}catch(e){return!1}})()?new fe:new ve;return"cookie"===r&&Ie&&ye(Ie)&&((e,t,i)=>{if(t&&ye(t)){let n=new pe(t);[i+"_gdp_session_id","gdp_user_id_gioenc",i+"_gdp_cs1_gioenc",i+"_gdp_user_key_gioenc",i+"_gdp_gio_id_gioenc",i+"_gdp_sequence_ids",i+"_gdp_session_id_sent"].forEach((t=>{const i=n.getItem(t);n.hasItem(t)&&(e.setItem(t,i),n.removeItem(t))})),n=void 0}})(t,Ie,o),t};var Ee="OPTION_INITIALIZED",_e="SDK_INITIALIZED",Se="SESSIONID_UPDATE",Ne="SET_USERID",Ce="SET_USERKEY",xe={name:"gioCompress",method:class{constructor(e){this.growingIO=e,this._compress=(e,t,i)=>{if(null===e)return"";let n,r,s,o={},a={},d="",c="",l="",h=2,u=3,g=2,p=[],f=0,m=0;for(s=0;sl.charCodeAt(0)){for(n=0;g>n;n++)f<<=1,m===t-1?(m=0,p.push(i(f)),f=0):m++;for(r=l.charCodeAt(0),n=0;8>n;n++)f=f<<1|1&r,m===t-1?(m=0,p.push(i(f)),f=0):m++,r>>=1}else{for(r=1,n=0;g>n;n++)f=f<<1|r,m===t-1?(m=0,p.push(i(f)),f=0):m++,r=0;for(r=l.charCodeAt(0),n=0;16>n;n++)f=f<<1|1&r,m===t-1?(m=0,p.push(i(f)),f=0):m++,r>>=1}h--,0===h&&(h=Math.pow(2,g),g++),delete a[l]}else for(r=o[l],n=0;g>n;n++)f=f<<1|1&r,m===t-1?(m=0,p.push(i(f)),f=0):m++,r>>=1;h--,0===h&&(h=Math.pow(2,g),g++),o[c]=u++,l=d+""}if(""!==l){if({}.hasOwnProperty.call(a,l)){if(256>l.charCodeAt(0)){for(n=0;g>n;n++)f<<=1,m===t-1?(m=0,p.push(i(f)),f=0):m++;for(r=l.charCodeAt(0),n=0;8>n;n++)f=f<<1|1&r,m===t-1?(m=0,p.push(i(f)),f=0):m++,r>>=1}else{for(r=1,n=0;g>n;n++)f=f<<1|r,m===t-1?(m=0,p.push(i(f)),f=0):m++,r=0;for(r=l.charCodeAt(0),n=0;16>n;n++)f=f<<1|1&r,m===t-1?(m=0,p.push(i(f)),f=0):m++,r>>=1}h--,0===h&&(h=Math.pow(2,g),g++),delete a[l]}else for(r=o[l],n=0;g>n;n++)f=f<<1|1&r,m===t-1?(m=0,p.push(i(f)),f=0):m++,r>>=1;h--,0===h&&(h=Math.pow(2,g),g++)}for(r=2,n=0;g>n;n++)f=f<<1|1&r,m===t-1?(m=0,p.push(i(f)),f=0):m++,r>>=1;for(;;){if(f<<=1,m===t-1){p.push(i(f));break}m++}return p.join("")},this.compress=e=>{const t=this;return this._compress(e,16,(function(e){return t.f(e)}))},this.compressToUTF16=e=>{const t=this;return null===e?"":this._compress(e,15,(function(e){return t.f(e+32)}))+" "},this.compressToUint8Array=e=>{const t=this.compress(e),i=new Uint8Array(2*t.length);for(let e=0,n=t.length;n>e;e++){const n=t.charCodeAt(e);i[2*e]=n>>>8,i[2*e+1]=n%256}return i},this.compressToEncodedURIComponent=e=>{if(null===e)return"";const t=this;return this._compress(e,6,(function(e){return t.keyStrUriSafe.charAt(e)}))},this.f=String.fromCharCode,this.keyStrUriSafe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$"}}},Ae={name:"gioCustomTracking",method:class{constructor(e){this.growingIO=e,this.getValidResourceItem=e=>{if(e&&y(e)&&e.id&&e.key){const t={id:I(e.id)?e.id:k(e.id),key:I(e.key)?e.key:k(e.key)};return e.attributes&&(t.attributes=e.attributes),t}},this.getDynamicAttributes=e=>(v(e)||K(e).forEach((t=>{E(e[t])?e[t]=e[t]():y(e[t])?M(e,t):_(e[t])||(e[t]=k(e[t]))})),e),this.buildCustomEvent=(e,t,i,n)=>{Q(e,(()=>{const{dataStore:{eventContextBuilder:r,eventConverter:s,currentPage:o}}=this.growingIO;let a=Object.assign({eventType:"CUSTOM",eventName:e,pageShowTimestamp:null==o?void 0:o.time,attributes:Z(this.getDynamicAttributes(y(t)&&!F(t)?t:void 0)),resourceItem:Z(this.getValidResourceItem(i))},r());F(n)||(a=Object.assign(Object.assign({},a),n)),s(a)}))},this.buildUserAttributesEvent=(e,t)=>{const{dataStore:{eventContextBuilder:i,eventConverter:n}}=this.growingIO;let r=Object.assign({eventType:"LOGIN_USER_ATTRIBUTES",attributes:Z(e)},i());F(t)||(r=Object.assign(Object.assign({},r),t)),n(r)}}}},Pe={},De={}.hasOwnProperty;function Le(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(e){return null}}function Re(e){try{return encodeURIComponent(e)}catch(e){return null}}Pe.stringify=function(e,t){t=t||"";var i,n,r=[];for(n in"string"!=typeof t&&(t="?"),e)if(De.call(e,n)){if((i=e[n])||null!=i&&!isNaN(i)||(i=""),n=Re(n),i=Re(i),null===n||null===i)continue;r.push(n+"="+i)}return r.length?t+r.join("&"):""},Pe.parse=function(e){for(var t,i=/([^=?#&]+)=?([^&]*)/g,n={};t=i.exec(e);){var r=Le(t[1]),s=Le(t[2]);null===r||null===s||r in n||(n[r]=s)}return n};const ke={gioprojectid:"projectId",giodatacollect:"dataCollect",gioappid:"domain",giodatasourceid:"dataSourceId",gios:"sessionId",giou:"uid",giocs1:"userId",gioid:"gioId",giouserkey:"userKey",gioappchannel:"appChannel",giodevicebrand:"deviceBrand",giodevicemodel:"deviceModel",giodevicetype:"deviceType",giolanguage:"language",gionetworkstate:"networkState",giooperatingsystem:"operatingSystem",gioplatform:"platform",gioplatformversion:"platformVersion",gioscreenheight:"screenHeight",gioscreenwidth:"screenWidth"},Ue=["giodatasourceid","gioplatform","gioappchannel","giodevicebrand","giodevicemodel","giodevicetype","giolanguage","gionetworkstate","giooperatingsystem","gioplatformversion","gioscreenheight","gioscreenwidth"],je=["giocs1","gios","giou","gioid","giouserkey"],Ge="gio_search_cookie_gioenc";var qe,He,Be={name:"gioEmbeddedAdapter",method:class{constructor(e){this.growingIO=e,this.main=()=>{var e;const{projectId:t,appId:i}=this.growingIO.vdsConfig,n=this.getGQS();let r=!1;return"none"!==this.qsFrom&&n.gioprojectid===t&&n.gioappid===i&&(F(n)?this.growingIO.storage.removeItem(Ge):this.growingIO.storage.setItem(Ge,Pe.stringify(n)),B(n,"giodatacollect")&&(this.growingIO.vdsConfig.dataCollect=L(["true",!0],n.giodatacollect)),null===(e=this.growingIO.emitter)||void 0===e||e.on("SDK_INITIALIZED",(()=>{const{userStore:e,vdsConfig:{sessionExpires:t},dataStore:{eventContextBuilderInst:i}}=this.growingIO;je.forEach((t=>{var i;e[ke[t]]=null!==(i=n[t])&&void 0!==i?i:""})),window.setInterval((()=>{e.sessionId=n.gios}),.8*t*60*1e3),Ue.forEach((e=>{B(n,e)&&(i.minpExtraParams[ke[e]]=n[e])}))})),this.growingIO.setUserId=()=>{},this.growingIO.clearUserId=()=>{},B(n,"giodatacollect")&&(this.growingIO.setDataCollect=()=>{},this.growingIO.setOption=()=>{}),r=!0),this.gioURLRewrite(),r},this.getGQS=()=>{const{hashtag:e}=this.growingIO.vdsConfig,t=this.growingIO.storage.getItem(Ge),i=window.location.search,n=window.location.hash,r=e?n.substring(n.indexOf("?")+1):"",s=Pe.parse(i),o=Pe.parse(r),a=Pe.parse((t||"").replace("gioenc-",""));let d={};if(B(s,"gioprojectid"))d=s,this.qsFrom="search";else if(B(o,"gioprojectid"))d=o,this.qsFrom="hash";else{if(!B(a,"gioprojectid"))return this.qsFrom="none",{};d=a,this.qsFrom="cookie"}const c={},l={},h=["gioappid","gioprojectid","giodatacollect",...je,...Ue];return K(d).forEach((e=>{const t=e.toLowerCase();L(h,t)?L(["","undefined","null",void 0,null],d[e])||(c[t]=d[e],L(["true","TRUE",!0],d[e])&&(c[t]=!0),L(["false","FALSE",!1],d[e])&&(c[t]=!1)):l[e]=d[e]})),this.gqs=c,this.ngqs=l,c},this.gioURLRewrite=()=>{const{hashtag:e}=this.growingIO.vdsConfig;let t=window.location.search,i=window.location.hash,n=!1;if("search"===this.qsFrom&&(t=Pe.stringify(this.ngqs,!0),n=!0),e&&"hash"===this.qsFrom&&(i=`${i.split("?")[0]}${Pe.stringify(this.ngqs,!0)}`,n=!0),n){const e=`${window.location.pathname}${t||""}${i||""}`;window.history.replaceState(null,document.title,e)}},this.gqs={},this.ngqs={},this.qsFrom="search",this.growingIO.emitter.on(Ee,(()=>{this.growingIO.useEmbeddedInherit=this.main()}))}}},Ke={},We={};qe=We,He=f&&f.__spreadArray||function(e,t,i){if(i||2===arguments.length)for(var n,r=0,s=t.length;s>r;r++)!n&&r in t||(n||(n=[].slice.call(t,0,r)),n[r]=t[r]);return e.concat(n||[].slice.call(t))},Object.defineProperty(qe,"__esModule",{value:!0}),qe.GROWING_TITLE_OLD=qe.GROWING_TITLE=qe.GROWING_GTITLE=qe.GROWING_CDP_INDEX=qe.GROWING_INDEX_OLD=qe.GROWING_INDEX=qe.GROWING_CONTAINER=qe.GROWING_TRACK=qe.GROWING_IGNORE=qe.VALID_CLASS_SELECTOR=qe.VALID_ID_SELECTOR=qe.EXCLUDE_CLASS_RE=qe.UNSUPPORTED_TAGS=qe.TEXT_NODE=qe.UNSUPPORTED_CLICK_TAGS=qe.SUPPORTED_ICON_TAGS=qe.SUPPORTED_CHANGE_TYPES=qe.SUPPORTED_CLICK_INPUT_TYPES=qe.SUPPORTED_CONTAINER_TAGS=qe.LIST_TAGS=void 0,qe.LIST_TAGS=["TR","LI","DL"],qe.SUPPORTED_CONTAINER_TAGS=He(["A","BUTTON"],qe.LIST_TAGS,!0),qe.SUPPORTED_CLICK_INPUT_TYPES=["button","submit","reset"],qe.SUPPORTED_CHANGE_TYPES=["radio","checkbox","search"],qe.SUPPORTED_ICON_TAGS=["I","EM","svg","IMG"],qe.UNSUPPORTED_CLICK_TAGS=["TEXTAREA","HTML","BODY"],qe.TEXT_NODE=["I","SPAN","EM","B","STRONG"],qe.UNSUPPORTED_TAGS=["tspan","text","g","rect","path","defs","clippath","desc","title","math","use"],qe.EXCLUDE_CLASS_RE=/(^| |[^ ]+\-)(clear|clearfix|active|hover|enabled|current|selected|unselected|hidden|display|focus|disabled|undisabled|open|checked|unchecked|undefined|null|ng-|growing-)[^\. ]*/g,qe.VALID_ID_SELECTOR=/^[a-zA-Z-\_][a-zA-Z\-\_0-9]+$/,qe.VALID_CLASS_SELECTOR=/^([a-zA-Z\-\_0-9]+)$/,qe.GROWING_IGNORE="data-growing-ignore",qe.GROWING_TRACK="data-growing-track",qe.GROWING_CONTAINER="data-growing-container",qe.GROWING_INDEX="data-growing-index",qe.GROWING_INDEX_OLD="data-growing-idx",qe.GROWING_CDP_INDEX="data-index",qe.GROWING_GTITLE="data-growing-title",qe.GROWING_TITLE="data-title",qe.GROWING_TITLE_OLD="growing-title";var Ve={},Me={};Object.defineProperty(Me,"__esModule",{value:!0}),Me.lastFindIndex=Me.findIndex=Me.arrayEquals=Me.rmBlank=Me.normalizePath=Me.splitNoEmpty=Me.filterText=void 0,Me.filterText=function(e,t){if(void 0===t&&(t=!0),e&&(null==(e=e.replace(/[\n \t]+/g," ").trim())?void 0:e.length))return e.slice(0,t?50:void 0)},Me.splitNoEmpty=function(e,t){return e?e.split(t).filter((function(e){return!!e})):[]},Me.normalizePath=function(e){var t=e.length;return t>1&&"/"===e.charAt(t-1)?e.slice(0,t-1):e},Me.rmBlank=function(e){return e?e.replace(/[\n \t]+/g,""):""},Me.arrayEquals=function(e,t){if(!e||!t)return!1;if(e.length!==t.length)return!1;for(var i=0,n=e.length;n>i;i++)if(e[i]!==t[i])return!1;return!0},Me.findIndex=function(e,t){if(null==e||"function"!=typeof t)return-1;for(var i=0;i=0;i--){var n=e[i];if(t.call(void 0,n))return i}return-1},function(e){var t=f&&f.__spreadArray||function(e,t,i){if(i||2===arguments.length)for(var n,r=0,s=t.length;s>r;r++)!n&&r in t||(n||(n=[].slice.call(t,0,r)),n[r]=t[r]);return e.concat(n||[].slice.call(t))},i=f&&f.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.removeDiffTagOnHeadAndTail=e.computeXpath=e.getMarkIndex=e.getEffectiveNode=e.isIgnore=e.depthInside=e.changeableInput=e.clickableInput=e.onlyContainsTextChildren=e.onlyContainsIconChildren=e.supportIconTag=e.isContainerTag=e.isListTag=e.isParentOfLeaf=e.isLeaf=e.getChildren=e.getDeepChildren=e.findParent=e.isRootNode=e.hasValidAttribute=void 0;var n=Me,r=We,s=i(m);e.hasValidAttribute=function(e,t){return e instanceof Element&&e.hasAttribute(t)&&"false"!==e.getAttribute(t)},e.isRootNode=function(e){return!e||-1!==["BODY","HTML","#document"].indexOf(e.nodeName)},e.findParent=function(t,i){for(var n=t.parentNode;n&&!(0,e.isRootNode)(n);){if(i(n))return n;n=n.parentNode}},e.getDeepChildren=function(i){return(0,s.default)((null==i?void 0:i.childNodes)||[]).reduce((function(i,n){return n instanceof Element?t(t(t([],i,!0),[n],!1),(0,e.getDeepChildren)(n),!0):i}),[])},e.getChildren=function(e){return(0,s.default)((null==e?void 0:e.childNodes)||[]).filter((function(e){return e instanceof Element}))},e.isLeaf=function(t){return!t.hasChildNodes()||"svg"===t.nodeName||0===(0,e.getChildren)(t).length},e.isParentOfLeaf=function(t){return!(!t.hasChildNodes()||"svg"===t.nodeName)&&0===(0,s.default)(t.childNodes).filter((function(t){return!(0,e.isLeaf)(t)})).length},e.isListTag=function(e){return-1!==r.LIST_TAGS.indexOf(e.nodeName)},e.isContainerTag=function(t){return(0,e.hasValidAttribute)(t,r.GROWING_CONTAINER)||-1!==r.SUPPORTED_CONTAINER_TAGS.indexOf(t.nodeName)},e.supportIconTag=function(e){var t=e.nodeName;return-1!==r.SUPPORTED_ICON_TAGS.indexOf(t)},e.onlyContainsIconChildren=function(t){if(t.textContent)return!1;var i=(0,e.getChildren)(t);if(0===i.length)return!1;for(var n=0,r=i;ni)return!1;for(var r="svg"===t.tagName?[]:(0,e.getChildren)(t),s=0;s=n},e.isIgnore=function(t){if(!(t instanceof Element)||(0,e.hasValidAttribute)(t,r.GROWING_IGNORE))return!0;for(var i=t.parentNode;i&&!(0,e.isRootNode)(i);){if((0,e.hasValidAttribute)(i,r.GROWING_IGNORE))return!0;i=i.parentNode}return!1},e.getEffectiveNode=function(t){for(var i,n;t&&(n=void 0,!((i=t)instanceof Element&&-1===r.UNSUPPORTED_TAGS.indexOf(null===(n=i.tagName)||void 0===n?void 0:n.toLowerCase())))&&t.parentNode;)t=t.parentNode;var s,o=t.parentNode;return!(0,e.isRootNode)(o)&&((0,e.onlyContainsIconChildren)(o)||"BUTTON"===(s=o).tagName&&(0,e.onlyContainsTextChildren)(s))?o:t},e.getMarkIndex=function(e){if(e instanceof Element){var t=e.getAttribute(r.GROWING_INDEX)||e.getAttribute(r.GROWING_INDEX_OLD)||e.getAttribute(r.GROWING_CDP_INDEX);if(t){if(/^\d{1,10}$/.test(t)&&+t>=0&&2147483647>+t)return+t;window.console.error("[GioNode]:标记的index不符合规范(index必须是大于等于0且小于2147483647的整数字)。",t)}}},e.computeXpath=function(e){for(var t=e.parentPaths(!0),i=Math.min(t.length,+(t.length>=10)+4),n=["","",""],r=0;rr&&(n[1]=s+n[1])}return n},e.removeDiffTagOnHeadAndTail=function(e,t){var i=function(e){return e.nodeName===t.nodeName},r=(0,n.findIndex)(e,i),s=(0,n.lastFindIndex)(e,i);return-1===r||-1===s?[]:e.slice(r,s+1)}}(Ve);var Fe={},$e={};Object.defineProperty($e,"__esModule",{value:!0});var ze=We,Xe=Me,Je=Ve;function Ze(e){var t;if(e instanceof Element){var i=e.getAttribute("name");if(i)return[i];if(e.hasAttribute("class")){var n=null===(t=e.getAttribute("class"))||void 0===t?void 0:t.replace(ze.EXCLUDE_CLASS_RE,"").trim();if(null==n?void 0:n.length)return n.split(/\s+/).filter((function(e){return ze.VALID_CLASS_SELECTOR.test(e)&&!e.match(/[a-z][A-Z][a-z][A-Z]/)&&!e.match(/[0-9][0-9][0-9][0-9]/)})).sort()}}return[]}var Ye=function(){function e(e){var t;this.node=e,this.tagName=this.node.nodeName,this.name=this.tagName.toLowerCase(),this.id=(t=this.node).id&&ze.VALID_ID_SELECTOR.test(t.id)?t.id:null,this.classList=Ze(this.node),this.guessListAndIndex()}return e.prototype.guessListAndIndex=function(){var e,t=this;this._tagList=(0,Je.isListTag)(this.node);var i=(0,Je.removeDiffTagOnHeadAndTail)((0,Je.getChildren)(this.node.parentNode),this.node);if(this._tagList&&-1!==(s=i.filter((function(e){return e.tagName===t.tagName})).indexOf(this.node))&&(this._index=s+1),i.length>=3&&(null===(e=this.classList)||void 0===e?void 0:e.length)){for(var n=0,r=0,s=1;s<=i.length;s++){var o=i[s-1];if(o.tagName!==this.tagName){r=0;break}(0,Xe.arrayEquals)(this.classList,Ze(o))&&(r+=1),this.node===o&&(n=s)}3>r||(this._pseudoList=!0,this._index=this._index||n)}},Object.defineProperty(e.prototype,"path",{get:function(){var e;return this._path||(this._path="/".concat(this.name),this.id&&(this._path+="#".concat(this.id)),(null===(e=this.classList)||void 0===e?void 0:e.length)&&(this._path+=".".concat(this.classList.join(".")))),this._path},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pseudoList",{get:function(){return!!this._pseudoList},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"list",{get:function(){return!!this._tagList||!!this._pseudoList},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"index",{get:function(){var e;return null!==(e=(0,Je.getMarkIndex)(this.node))&&void 0!==e?e:this._index},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"container",{get:function(){return(0,Je.isContainerTag)(this.node)||this.list},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"parent",{get:function(){return this.node.parentNode?new e(this.node.parentNode):null},enumerable:!1,configurable:!0}),e.prototype.parentPaths=function(e){void 0===e&&(e=!1);for(var t=e?[this]:[],i=this.parent;i&&!(0,Je.isRootNode)(i.node);)t.push(i),i=i.parent;return t},e}();$e.default=Ye;var Qe={};Object.defineProperty(Qe,"__esModule",{value:!0}),Qe.getElementHref=Qe.getImgHref=Qe.getAnchorHref=void 0;var et=Me;function tt(e){if(e.hasAttribute("href")){var t=e.getAttribute("href");if(t&&0!==t.indexOf("javascript"))return(0,et.normalizePath)(t.slice(0,320))}}function it(e){if(e.src&&-1===e.src.indexOf("data:image"))return e.src}Qe.getAnchorHref=tt,Qe.getImgHref=it,Qe.getElementHref=function(e){var t=e;if(t)switch(e.nodeName.toLowerCase()){case"a":return tt(t);case"img":return it(t)}};var nt={},rt=f&&f.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(nt,"__esModule",{value:!0}),nt.getElementContent=nt.getFormContent=void 0;var st=Ve,ot=Qe,at=We,dt=rt($e),ct=Me,lt=rt(m),ht=function(e){return e.htmlFor||e.getAttribute("for")},ut=function(e){var t=e.getAttribute(at.GROWING_GTITLE)||e.getAttribute(at.GROWING_TITLE)||e.getAttribute(at.GROWING_TITLE_OLD)||e.getAttribute("title");return null==t?void 0:t.trim()};function gt(e){var t=e.node;return e.list?pt(t):(0,ct.filterText)(t.textContent)||void 0}function pt(e){for(var t=void 0,i=!1,n=0,r=(0,lt.default)(e.childNodes);n-1?i.slice(0,n):i}}(t);case"svg":return function(e){for(var t=0,i=(0,lt.default)(e.childNodes);t0)return i[i.length-1]}}(t);case"label":return gt(o);case"input":return function(e){if((0,st.clickableInput)(e))return e.value;if("password"!==e.type&&(0,st.hasValidAttribute)(e,at.GROWING_TRACK))return e.value;if((0,st.changeableInput)(e)){var t=(0,st.findParent)(e,(function(e){return"LABEL"===e.nodeName}));if(!t&&e.id)for(var i=document.body.getElementsByTagName("label"),n=0;n0)return s+" ("+e.checked+")"}return e.value}}(t);case"select":return n=t,(0,lt.default)(n.options).filter((function(e){return e.selected})).map((function(e){return e.label})).join(", ")||n.value;case"form":return ft(t)}return(0,st.isLeaf)(t)?function(e){var t=(0,ct.filterText)(e.textContent);if(t)return t}(t):(0,st.isParentOfLeaf)(t)&&!(0,st.onlyContainsIconChildren)(t)?function(e){for(var t="",i=0,n=(0,lt.default)(e.childNodes);ii;i++)for(var r in t=arguments[i])({}).hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},_t.apply(this,arguments)},St=f&&f.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ke,"__esModule",{value:!0});var Nt=We,Ct=Ve,xt=St(Fe),At=function(){function e(e,t,i){void 0===t&&(t=null),void 0===i&&(i=!0),this.origin=e,this.action=t,this.direct=i,this.target="self"===t?e:(0,Ct.getEffectiveNode)(e),this.ignore=(0,Ct.isIgnore)(this.target),this.vnode=new xt.default(this.target),this.tagName=this.vnode.tagName}return Object.defineProperty(e.prototype,"content",{get:function(){return this.vnode.content},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"href",{get:function(){return this.vnode.href},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"index",{get:function(){return this.vnode.index},enumerable:!1,configurable:!0}),e.prototype.inferParentIndex=function(){var t=this;return this.parentIndex||(0,Ct.findParent)(this.target,(function(i){var n=new e(i,t.action,!1);n.traceable()&&n.index&&(t.parentIndex=n.index)})),this.parentIndex},Object.defineProperty(e.prototype,"xpath",{get:function(){return this.vnode.xpath},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fullXpath",{get:function(){return this.vnode.fullXpath},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"skeleton",{get:function(){return this.vnode.skeleton},enumerable:!1,configurable:!0}),e.prototype.info=function(e){return void 0===e&&(e=!0),e&&this.inferParentIndex(),{skeleton:this.skeleton,fullXpath:this.fullXpath,xpath:this.xpath,content:this.content,href:this.href,index:this.parentIndex||this.index}},e.prototype.traceable=function(){if(this.ignore)return!1;if(this.direct){if("click"===this.action||"hover"===this.action){if(-1!==Nt.UNSUPPORTED_CLICK_TAGS.indexOf(this.target.tagName))return!1;if("INPUT"===this.target.tagName&&!(0,Ct.clickableInput)(this.target))return!1;if(!(0,Ct.isContainerTag)(this.target)&&!(0,Ct.depthInside)(this.target,5))return!1}return!0}return this.vnode.container},e.prototype.trackNodes=function(){if(!this.traceable())return[];var e=[this];if("submit"!==this.action)for(var t=this.parentElement;t;){if(t.ignore)return[];t.traceable()&&e.unshift(t),t=t.parentElement}var i=void 0;return e.map((function(e){var t=e.info(!1),n=t.index;return!i&&n&&(i=n),_t(_t({},t),{index:i||n})}))},Object.defineProperty(e.prototype,"parentElement",{get:function(){var t=this.target.parentNode;if(t&&t.nodeName&&!(0,Ct.isRootNode)(t))return new e(t,this.action,!1)},enumerable:!1,configurable:!0}),e}(),Pt=Ke.default=At;class Dt{constructor(e){this.handler=e;const t=navigator.userAgent,i=/chrome/i.exec(t),n=/android/i.exec(t);this.hasTouch="ontouchstart"in window&&!(i&&!n)}main(){const e=this.hasTouch?["touchstart"]:["mousedown"],t=this.hasTouch?["touchend","touchcancel"]:["mouseup","mouseleave"],i=this.hasTouch?["touchmove"]:["mousemove"];for(const t of e)Y(window,t,this.touchStartHandler.bind(this));for(const e of i)Y(window,e,this.touchMoveHandler.bind(this));for(const e of t)Y(window,e,this.touchStopHandler.bind(this))}touchStartHandler(e){if(e.which>1)return;const t=+Date.now();this.safeguard!==t&&(this.touchTimeout&&clearTimeout(this.touchTimeout),this.safeguard=t,this.touchEvent={time:t,target:e.target,x:this._page("x",e),y:this._page("y",e),isTrusted:!0,type:"click"})}touchMoveHandler(e){const t=Math.abs(this._page("x",e)-(this.touchEvent&&this.touchEvent.x)||0),i=Math.abs(this._page("y",e)-(this.touchEvent&&this.touchEvent.y)||0);(t>10||i>10)&&(this.touchEvent=null)}touchStopHandler(e){const t=+Date.now()-(this.touchEvent&&this.touchEvent.time)||0;this.touchEvent&&200>t?this.touchTimeout=setTimeout((()=>{this.handler(this.touchEvent),this.touchEvent=null}),200):this.touchEvent&&t>=200&&700>t&&(this.handler(this.touchEvent),this.touchEvent=null)}_page(e,t){return(this.hasTouch?t.touches[0]:t)["page"+e.toUpperCase()]}}var Lt={name:"gioEventAutoTracking",method:class{constructor(e){this.growingIO=e,this.main=()=>{Y(document,"submit",this._handleAction),Y(document,"change",this._handleAction);const{vdsConfig:e}=this.growingIO;e.touch?new Dt(this._handleAction).main():Y(document,"click",this._handleAction)},this._handleAction=(e,t)=>{const{vdsConfig:i,emitter:n}=this.growingIO;if(!i.autotrack)return!1;const r=e.target;if(!r)return!1;let s=new Pt(r,e.type,!0).trackNodes();if("click"!==e.type&&(s=F(C(s))?[]:[C(s)]),F(s))return!1;null==n||n.emit("onComposeBefore",{event:t,params:null!=e?e:{}}),s.forEach((t=>{const{fullXpath:n,index:r,content:s,href:o}=t;if(!G(t.fullXpath||"","/div#__vconsole")&&!G(t.fullXpath||"","/div#__giokit")&&(i.debug&&console.log("Action:",e.type,Date.now()),n)){const{dataStore:{eventContextBuilder:t,eventConverter:i,currentPage:a}}=this.growingIO;i(Object.assign(Object.assign({eventType:c[e.type],element:[{xpath:n,index:r,textValue:s,hyperlink:o}]},t()),{pageShowTimestamp:a.time}))}}))}}}};let Rt;const kt=["VIEW_CLICK","VIEW_CHANGE","FORM_SUBMIT","PAGE","CUSTOM","LOGIN_USER_ATTRIBUTES"],Ut=["LOGIN_USER_ATTRIBUTES"];var jt={name:"gioHybridAdapter",method:class{constructor(e){this.growingIO=e,this.penetrateHybrid=!0,this.onOptionsInit=()=>{const{vdsConfig:e,emitter:t}=this.growingIO;b(e.penetrateHybrid)&&(this.penetrateHybrid=e.penetrateHybrid),this._initHybridBridge()&&(this.onSendBefore=this.sendBeforeListener,this.hybridConfig.projectId===this.growingIO.vdsConfig.projectId&&(this.growingIO.useHybridInherit=!0)),this.growingIO.useHybridInherit&&(null==t||t.on(Ne,(({newUserId:e,oldUserId:t,userKey:i})=>{this.penetrateHybrid&&(!e&&t?i?this._clearNativeUserIdAndUserKey():this._clearNativeUserId():i?this._setNativeUserIdAndUserKey(k(e),k(i)):this._setNativeUserId(k(e)))})),null==t||t.on(Ce,(({newUserKey:e,oldUserKey:t,userId:i})=>{this.penetrateHybrid&&(!e&&t?this._clearNativeUserIdAndUserKey():this._setNativeUserIdAndUserKey(k(i),k(e)))})))},this._initHybridBridge=()=>{var e,t,i;let n=!1;return this.hasHybridBridge=!!window.GrowingWebViewJavascriptBridge,this.hasHybridBridge?((null===(e=null===window||void 0===window?void 0:window.GrowingWebViewJavascriptBridge)||void 0===e?void 0:e.configuration)||(window.GrowingWebViewJavascriptBridge.configuration=JSON.parse(window.GrowingWebViewJavascriptBridge.getConfiguration())),(null===(t=null===window||void 0===window?void 0:window.GrowingWebViewJavascriptBridge)||void 0===t?void 0:t.configuration)&&(this.hybridConfig=null===(i=null===window||void 0===window?void 0:window.GrowingWebViewJavascriptBridge)||void 0===i?void 0:i.configuration),n=!0):Rt.consoleText("gioHybridAdapter:当前不存在 GrowingWebViewJavascriptBridge,Web模式。","info"),n},this.sendBeforeListener=({requestData:e})=>{if(this.hasHybridBridge){const t=this.processAttributes(Object.assign({},e));L(kt,t.eventType)&&(L(Ut,t.eventType)?this.penetrateHybrid&&this._dispatchEvent(t):(this.penetrateHybrid||M(t,["userId","userKey","cs1"]),this._dispatchEvent(t)))}},this.processAttributes=e=>(W(e,((t,i)=>{y(t)||_(t)?W(e[i],((t,n)=>{y(t)||_(t)?e[i][n]=JSON.stringify(t):e[i][n]=k(t)})):e[i]=k(t)})),e),this._setNativeUserId=e=>{J((()=>window.GrowingWebViewJavascriptBridge.setNativeUserId(e)))},this._clearNativeUserId=()=>{J((()=>window.GrowingWebViewJavascriptBridge.clearNativeUserId()))},this._setNativeUserIdAndUserKey=(e,t)=>{J((()=>window.GrowingWebViewJavascriptBridge.setNativeUserIdAndUserKey(e,t)))},this._clearNativeUserIdAndUserKey=()=>{J((()=>window.GrowingWebViewJavascriptBridge.clearNativeUserIdAndUserKey()))},this._dispatchEvent=e=>{J((()=>{var t;return null===(t=window.GrowingWebViewJavascriptBridge)||void 0===t?void 0:t.dispatchEvent(JSON.stringify(e))}))};const{emitter:t,utils:i}=this.growingIO;Rt=i,t.on(Ee,this.onOptionsInit)}}};const Gt=["i","span","em","b","strong","svg"];var qt;!function(e){e[e.OUTER=0]="OUTER",e[e.INNER_COVERED=1]="INNER_COVERED",e[e.INNER_SHOW=2]="INNER_SHOW"}(qt||(qt={}));const Ht=["HR","BR","SCRIPT","NOSCRIPT","STYLE","HEAD","BASE","LINK","META","TITLE","BODY","HTML","TEMPLATE","CODE",...We.UNSUPPORTED_CLICK_TAGS],Bt=["SELECT","A","BUTTON","INPUT","IMG","FORM"],Kt=(e,t,i)=>document.elementFromPoint(t,i)===e;class Wt{constructor(e,t,i){this.node=e,this.parentNodeDesc=t,this.devicesInfo=i,this.proxy=new Pt(e),this.tagName=this.node.tagName,this.name=this.tagName.toLowerCase(),this.isIgnore=!!this.node.dataset.growingIgnore,this.isUnSupported=-1!==Ht.indexOf(this.tagName),this.rect=this.computeWindowRect()}info(){const e=this.desc();e.zLevel+=this.devicesInfo.webviewZLevel;const t=this.getDeviceRect(this.rect);return M(e,"isContainer"),Object.assign(Object.assign(Object.assign({},e),t),{parentXPath:this.parentNodeDesc.isContainer?this.parentNodeDesc.xpath:void 0,href:this.proxy.href,content:this.proxy.content,nodeType:this.nodeType()})}nodeType(){return"input"!==this.name||Ve.changeableInput(this.node)?this.node.tagName:"INPUT_BTN"}desc(){return{index:this.parentNodeDesc.index||this.proxy.index,zLevel:this.zLevel(),xpath:this.proxy.xpath,isContainer:this.isDefinedContainer()}}cssVisible(){const e=this.computedStyle();return Number(e.opacity)>0&&"visible"===e.visibility&&"none"!==e.display}viewportStatus(){const{top:e,left:t,width:i,height:n}=this.rect,{winWidth:r,winHeight:s}=this.devicesInfo;if(0>=i||0>=n)return qt.OUTER;const o=this.node;return s>e&&r>t&&i>0&&n>0?Kt(o,t+i/2,e+n/2)||Kt(o,t+1,e+1)||Kt(o,t+i-1,e+1)||Kt(o,t+1,e+n-1)||Kt(o,t+i-1,e+n-1)?qt.INNER_SHOW:qt.INNER_COVERED:qt.OUTER}isCircleable(){return this.proxy.target===this.proxy.origin&&(!!this.isDefinedContainer()||!("input"===this.name&&this.node instanceof HTMLInputElement&&"password"===this.node.type)&&(-1!==Bt.indexOf(this.name)||(Ve.isLeaf(this.node)?!this.isBigBlank():this.hasBackgroundImage()&&Ve.depthInside(this.node,4))))}isSimpleContainer(){return"select"===this.name||this.isDefaultContainer()&&(function(e,t){if(0===e.children.length)return!1;for(const i of R(e.children))if(-1===t.indexOf(i.tagName.toLowerCase()))return!1;return!0}(this.node,Gt)||!this.node.childElementCount)}isDefinedContainer(){var e;return v(this.isContainer)?this.isDefaultContainer()||this.isMarkContainer()||Ve.isParentOfLeaf(this.node)&&(!!(null===(e=this.node.innerText)||void 0===e?void 0:e.trim().length)||function(e){const t=e.attributes;if(t.length>0)for(let e=0;es>>1||r>o>>1)}hasBackgroundImage(){const e=this.computedStyle().backgroundImage;return!!e&&"none"!==e&&e.length>0}zLevel(){const e=this.computedStyle(),t=e.zIndex;if("auto"!==t)return Number(t||"0")+this.parentNodeDesc.zLevel;switch(e.position){case"relative":return this.parentNodeDesc.zLevel+2;case"sticky":return this.parentNodeDesc.zLevel+3;case"absolute":return this.parentNodeDesc.zLevel+4;case"fixed":return this.parentNodeDesc.zLevel+5;default:return this.parentNodeDesc.zLevel+1}}computeWindowRect(){if(this.rect)return this.rect;const e=this.node.getBoundingClientRect(),t=e.top,i=e.bottom,n=e.left;let r=e.right-n,s=i-t;return 0>t?s=t+s:t+s>this.devicesInfo.winHeight&&(s=this.devicesInfo.winHeight-t),0>n?r=n+r:n+r>this.devicesInfo.winWidth&&(r=this.devicesInfo.winWidth-n),this.rect={top:t,left:n,width:r,height:s},this.rect}computedStyle(){return window.getComputedStyle(this.node)}getDeviceRect(e){const{scale:t,webviewTop:i,webviewLeft:n}=this.devicesInfo;return{top:e.top*t+i,left:e.left*t+n,width:e.width*t,height:e.height*t}}}const Vt=["DOMContentLoaded","onreadystatechange"],Mt=["scroll","resize","load","beforeunload","popstate","hashchange","pagehide","unload"];class Ft{constructor(e){this.growingIO=e,this.addDomChangeListener()}getDomTree(e,t,i,n,r,s){const o=function(e,t,i,n,r){const s=document.documentElement.clientWidth;return{winWidth:s,winHeight:document.documentElement.clientHeight,scale:i/s,webviewTop:t,webviewLeft:e,webviewWidth:i,webviewHeight:n,webviewZLevel:r}}(e,t,i,n,r),a=this.getElementsByParent(s||document.body,{isContainer:!1,zLevel:0},o),{domain:d,path:c,query:l,title:h}=this.growingIO.dataStore.currentPage;return{page:{domain:d,path:c,query:l,title:h},elements:a}}getElementsByParent(e,t,i){const n=[];return[].slice.call(e.childNodes,0).filter((e=>1===e.nodeType)).forEach((e=>{const r=new Wt(e,t,i);if(r.cssVisible()&&!r.isIgnore){switch(r.viewportStatus()){case qt.INNER_SHOW:r.isCircleable()&&n.push(r.info());break;case qt.INNER_COVERED:r.isDefaultContainer()&&n.push(r.info())}r.isSimpleContainer()||[].push.apply(n,this.getElementsByParent(e,r.desc(),i))}})),n}addDomChangeListener(){let e;const t=(t="")=>()=>{var i;"beforeunload"===t&&e&&e.disconnect(),null===(i=window.GrowingWebViewJavascriptBridge)||void 0===i||i.onDomChanged()};e=new MutationObserver(t("mutation")),e.observe(document.body,{attributes:!0,characterData:!0,childList:!0,subtree:!0}),Vt.forEach((e=>{Y(document,e,t(e))})),Mt.forEach((e=>{Y(window,e,t(e))}))}}class $t{constructor(e){var t;this.growingIO=e,null===(t=this.growingIO.emitter)||void 0===t||t.on(_e,(()=>{if(window.GrowingWebViewJavascriptBridge){const e=this;window.GrowingWebViewJavascriptBridge.getDomTree=function(){if(arguments.length>=4)return $t.bindGetDomTree(e.growingIO),$t.domHelper.getDomTree.apply($t.domHelper,arguments)}}}))}static bindGetDomTree(e){this.domHelper||(this.domHelper=new Ft(e),window.GrowingWebViewJavascriptBridge.getDomTree=this.domHelper.getDomTree.bind(this.domHelper))}}var zt={name:"gioHybridCircle",method:$t},Xt={name:"gioImpressionTracking",method:class{constructor(e){var t;this.growingIO=e,this.documentReady=!1,this.main=e=>{"listener"===e?(this.documentReady=!0,this.growingIO.gioSDKInitialized&&this.initMutationObserver()):"emitter"===e&&this.documentReady&&this.initMutationObserver()},this.initIntersectionObserver=()=>{this.intersectionObserver=new IntersectionObserver((e=>{F(e)||e.map((e=>{const{dataset:t,id:i}=e.target;if(e.intersectionRatio>0){const{eventId:e,properties:n,items:r}=this.getImpressionProperties(t);if(i){if("once"===t.gioImpType&&B(this.sentImps,i))return;this.sentImps[i]={eventId:e,properties:n,items:r}}e&&this.growingIO.track(e,n,r)}}))}))},this.initMutationObserver=()=>{var e;this.mutationObserver&&(null===(e=this.mutationObserver)||void 0===e||e.disconnect());const t=document.querySelectorAll("[data-gio-imp-track]");R(t).map((e=>{var t;null===(t=this.intersectionObserver)||void 0===t||t.observe(e)})),this.mutationObserver=new MutationObserver((e=>{e.map((e=>{var t,i;"attributes"===e.type&&(null===(t=e.target.dataset)||void 0===t?void 0:t.gioImpTrack)&&(null===(i=this.intersectionObserver)||void 0===i||i.observe(e.target))}))})),this.mutationObserver.observe(document.body,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0,attributeFilter:["data-gio-imp-track","data-gio-imp-attrs","data-gio-imp-items",/^data-gio-track-[a-z]+$/i]})},this.getImpressionProperties=e=>{let t={eventId:void 0,properties:{}};if(!(null==e?void 0:e.gioImpTrack))return t;if(t.eventId=e.gioImpTrack,B(e,"gioImpAttrs"))t.properties=J((()=>y(e.gioImpAttrs)?e.gioImpAttrs:JSON.parse(e.gioImpAttrs))),t.items=J((()=>y(e.gioImpItems)?e.gioImpItems:JSON.parse(e.gioImpItems)));else{const i=/^gioTrack(.+)/;for(const n in e){let r;const s=n.match(i);s&&(r=j(s[1]),"track"!==r&&(t.properties[r]=e[n]))}}return t.properties=Z(t.properties),t.items=Z(t.items),/^\w+$/.test(t.eventId)&&!Number.isInteger(Number(N(t.eventId.split(""))))||(t.eventId=null,t={}),t},this.sentImps={},window.IntersectionObserver&&window.MutationObserver?(this.initIntersectionObserver(),Y(document,"readystatechange",(()=>{L(["interactive","complete"],document.readyState)&&this.main("listener")}),{once:!0}),null===(t=this.growingIO.emitter)||void 0===t||t.on(_e,(()=>this.main("emitter"))),Y(window,"unload",(()=>{var e,t;null===(e=this.intersectionObserver)||void 0===e||e.disconnect(),null===(t=this.mutationObserver)||void 0===t||t.disconnect()}))):X("当前浏览器不支持半自动埋点,gioImpressionTracking已自动关闭!","warn")}}},Jt={name:"gioWebCircle",method:class{constructor(e){var t;this.growingIO=e,this.injectCircle=(e,t)=>{const i=document.createElement("link"),n=document.createElement("script");i.rel="stylesheet",i.href=e,n.src=t,document.head.appendChild(i),document.head.appendChild(n)},null===(t=this.growingIO.emitter)||void 0===t||t.on(_e,(()=>{window.addEventListener("message",(e=>{const{data:t,source:i}=e,n=window.vds;if(t&&i){const e=i.vds,r=t.cssURL,s=t.jsURL;e&&"SDK_INJECT_CIRCLE_SCRIPT"===t.type&&n.projectId===e.projectId&&n.dataSourceId===e.dataSourceId&&this.injectCircle(r,s)}}))}))}}};const Zt=["gioPerformance"];class Yt{constructor(e){var t,i,n,r;this.growingIO=e,this.innerPluginInit=()=>{var e;Zt.forEach((e=>{var t;return M(null===(t=this.pluginsContext)||void 0===t?void 0:t.plugins,e)})),K(null===(e=this.pluginsContext)||void 0===e?void 0:e.plugins).forEach((e=>{var t;const{name:i,method:n}=null===(t=this.pluginsContext)||void 0===t?void 0:t.plugins[e];P(this.pluginItems,(e=>e.name===i))||this.pluginItems.push({name:j(i||e),method:n||(e=>{})})})),F(this.pluginItems)||this.installAll()},this.install=(e,t,i)=>{var n,r;const s=t||P(this.pluginItems,(t=>t.name===e));if((null===(n=this.growingIO)||void 0===n?void 0:n.plugins)[e])return X(`重复加载插件 ${e} 或插件重名,已跳过加载!`,"warn"),!1;if(!s)return X(`插件加载失败!不存在名为 ${e} 的插件!`,"error"),!1;try{return(null===(r=this.growingIO)||void 0===r?void 0:r.plugins)[e]=new s.method(this.growingIO,i),"cdp"===this.growingIO.gioEnvironment&&t&&X("加载插件 "+e,"info"),!0}catch(e){return X("插件加载异常 "+e,"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:j(t.name),method:t.method?t.method:()=>{}})}))},this.uninstall=e=>{var t;M(this.pluginItems,e);const i=M(null===(t=this.growingIO)||void 0===t?void 0:t.plugins,e);return i||X(`卸载插件 ${e} 失败!`,"error"),i},this.uninstallAll=()=>{this.pluginItems.forEach((e=>this.uninstall(e.name)))},this.lifeError=(e,t)=>X(`插件执行错误 ${e.name} ${t}`,"error"),this.onComposeBefore=e=>{this.pluginItems.forEach((t=>{var i;const n=null===(i=this.growingIO.plugins[t.name])||void 0===i?void 0:i.onComposeBefore;if(n&&E(n))try{n(e)}catch(e){this.lifeError(t,e)}}))},this.onComposeAfter=e=>{this.pluginItems.forEach((t=>{var i;const n=null===(i=this.growingIO.plugins[t.name])||void 0===i?void 0:i.onComposeAfter;if(n&&E(n))try{n(e)}catch(e){this.lifeError(t,e)}}))},this.onSendBefore=e=>{this.pluginItems.forEach((t=>{var i;const n=null===(i=this.growingIO.plugins[t.name])||void 0===i?void 0:i.onSendBefore;if(n&&E(n))try{n(e)}catch(e){this.lifeError(t,e)}}))},this.onSendAfter=e=>{this.pluginItems.forEach((t=>{var i;const n=null===(i=this.growingIO.plugins[t.name])||void 0===i?void 0:i.onSendAfter;if(n&&E(n))try{n(e)}catch(e){this.lifeError(t,e)}}))},this.pluginsContext={plugins:{}},this.pluginItems=[],null===(t=this.growingIO.emitter)||void 0===t||t.on("onComposeBefore",this.onComposeBefore),null===(i=this.growingIO.emitter)||void 0===i||i.on("onComposeAfter",this.onComposeAfter),null===(n=this.growingIO.emitter)||void 0===n||n.on("onSendBefore",this.onSendBefore),null===(r=this.growingIO.emitter)||void 0===r||r.on("onSendAfter",this.onSendAfter)}}class Qt extends Yt{constructor(e){super(e),this.growingIO=e,this.growingIO.gioSDKFull=!0,this.pluginsContext={plugins:{gioCompress:xe,gioCustomTracking:Ae,gioEmbeddedAdapter:Be,gioEventAutoTracking:Lt,gioHybridAdapter:jt,gioHybridCircle:zt,gioImpressionTracking:Xt,gioWebCircle:Jt}}}}class ei{constructor(){var e;this.trackingId="g0",this.init=e=>{var t,i,n,r,s;X("Gio Web SDK 初始化中...","info");const{initOptions:o,currentPage:a,sendVisit:d,sendPage:c}=this.dataStore;o(e),this.storage=Te(this.vdsConfig),this.initCallback(),null===(t=this.emitter)||void 0===t||t.emit(Ee,this),null===(n=null===(i=this.plugins)||void 0===i?void 0:i.gioEventAutoTracking)||void 0===n||n.main(),a.hookHistory(),a.parsePage(),null===(r=this.emitter)||void 0===r||r.emit(_e,this),X("Gio Web SDK 初始化完成!","success"),this.useEmbeddedInherit||(this.dataStore.lastVisitEvent.timestamp=a.time,d()),c(),this.gioSDKInitialized=!0,this.vdsConfig.gioSDKInitialized=!0,window[this.vds]=this.vdsConfig,null===(s=this.emitter)||void 0===s||s.emit("SDK_INITIALIZED_COMPLATE",this)},this.setOption=(e,t)=>{if(L(s,e)){const i=this.dataStore.setOption(e,t);return i&&o[e]&&X(`已${t?"开启":"关闭"}${o[e]}`,"info"),i}return X(`不存在可修改的配置项:${e},请检查后重试!`,"warn"),!1},this.getOption=e=>this.dataStore.getOption(e),this.setGeneralProps=e=>{y(e)&&!F(e)?(this.dataStore.generalProps=Object.assign(Object.assign({},this.dataStore.generalProps),e),K(this.dataStore.generalProps).forEach((e=>{L([void 0,null],this.dataStore.generalProps[e])&&(this.dataStore.generalProps[e]="")}))):this.callError("setGeneralProps")},this.clearGeneralProps=e=>{_(e)&&!F(e)?e.forEach((e=>{M(this.dataStore.generalProps,e)})):this.dataStore.generalProps={}},this.reissuePage=()=>{this.dataStore.sendPage()},this.notRecommended=()=>X("不推荐的方法使用,建议使用 gio('setOption', [optionName], [value])!","info"),this.callError=(e,t=!0,i="参数不合法")=>X(`${t?"调用":"设置"} ${e} 失败,${i}!`,"warn"),this.updateImpression=()=>{var e,t;const i=null===(t=null===(e=this.plugins)||void 0===e?void 0:e.gioImpressionTracking)||void 0===t?void 0:t.main;i?i("emitter"):X("updateImpression 错误! 请集成半自动埋点浏览插件后重试!","error")},this.gioEnvironment="cdp",this.sdkVersion="3.8.6",this.vds=window.gioCompatibilityVds?"gdp_vds":"vds",this.utils=Object.assign(Object.assign({},z),ee),this.emitter={all:e=e||new Map,on:function(t,i){var n=e.get(t);n?n.push(i):e.set(t,[i])},off:function(t,i){var n=e.get(t);n&&(i?n.splice(n.indexOf(i)>>>0,1):e.set(t,[]))},emit:function(t,i){var n=e.get(t);n&&n.slice().map((function(e){e(i)})),(n=e.get("*"))&&n.slice().map((function(e){e(t,i)}))}},this.useEmbeddedInherit=!1,this.useHybridInherit=!1,this.gioSDKInitialized=!1,this.plugins=new Qt(this),this.plugins.innerPluginInit()}}class ti{constructor(e){this.growingIO=e;const{projectId:t}=this.growingIO.vdsConfig,{getItem:i,setItem:n,getKeys:r,removeItem:s}=this.growingIO.storage;this.getItem=i,this.setItem=n,this.getKeys=r,this.removeItem=s,this.sIdStorageName=t+"_gdp_session_id",this.uidStorageName="gdp_user_id_gioenc",this.userIdStorageName=t+"_gdp_cs1_gioenc",this.userKeyStorageName=t+"_gdp_user_key_gioenc",this.gioIdStorageName=t+"_gdp_gio_id_gioenc"}get sessionId(){return this.getItem(this.sIdStorageName)||(this.sessionId=oe(),this.sessionId)}set sessionId(e){var t;e||(e=oe());const i=this.getItem(this.sIdStorageName)||this.prevSessionId,{sessionExpires:n=30}=this.growingIO.vdsConfig;this.setItem(this.sIdStorageName,e,+Date.now()+60*n*1e3),i!==e&&(this.getKeys().filter((e=>/.+_gdp_session_id_.{36}/.test(e))).forEach((e=>{this.removeItem(e)})),this.setItem(this.growingIO.dataStore.visitStorageName,""),null===(t=this.growingIO.emitter)||void 0===t||t.emit(Se,{newSessionId:e,oldSessionId:i})),this.prevSessionId=e}get uid(){return this.getItem(this.uidStorageName)||(this.uid=oe(),this.uid)}set uid(e){var t;const i=this.getItem(this.uidStorageName)||this.prevUId;this.setItem(this.uidStorageName,e),i!==e&&(null===(t=this.growingIO.emitter)||void 0===t||t.emit("UID_UPDATE",{newUId:e,oldUId:i})),this.prevUId=e}get userId(){return this.getItem(this.userIdStorageName)||""}set userId(e){var t,i;const n=this.getItem(this.userIdStorageName)||this.prevUserId;this.setItem(this.userIdStorageName,e),null===(t=this.growingIO.emitter)||void 0===t||t.emit(Ne,{newUserId:e,oldUserId:n,userKey:this.userKey}),n!==e&&(null===(i=this.growingIO.emitter)||void 0===i||i.emit("USERID_UPDATE",{newUserId:e,oldUserId:n,userKey:this.userKey})),e&&(this.gioId=e),this.prevUserId=e}get userKey(){return this.getItem(this.userKeyStorageName)||""}set userKey(e){var t,i;const n=this.getItem(this.userKeyStorageName)||this.prevUserKey;this.setItem(this.userKeyStorageName,e),null===(t=this.growingIO.emitter)||void 0===t||t.emit(Ce,{newUserKey:e,oldUserKey:n,userId:this.userId}),n!==e&&(null===(i=this.growingIO.emitter)||void 0===i||i.emit("USERKEY_UPDATE",{newUserKey:e,oldUserKey:n,userId:this.userId})),this.prevUserKey=e}get gioId(){return this.getItem(this.gioIdStorageName)||""}set gioId(e){var t;const i=this.getItem(this.gioIdStorageName)||this.prevGioId;this.setItem(this.gioIdStorageName,e),i!==e&&(null===(t=this.growingIO.emitter)||void 0===t||t.emit("GIOID_UPDATE",{newGioId:e,oldGioId:i})),this.prevGioId=e}}class ii{constructor(e){this.growingIO=e,this.main=()=>{var e,t;const{sdkVersion:i,useEmbeddedInherit:n,vdsConfig:r,userStore:s,dataStore:o,trackingId:a}=this.growingIO,{path:d,query:c}=o.currentPage;let l={appVersion:r.version,dataSourceId:r.dataSourceId,deviceId:s.uid,domain:n?r.appId:window.location.host,gioId:s.gioId,language:navigator.language,path:d,platform:r.platform,query:c,referralPage:(null===(e=o.lastPageEvent)||void 0===e?void 0:e.referralPage)||"",screenHeight:window.screen.height,screenWidth:window.screen.width,sdkVersion:i,sessionId:s.sessionId,timestamp:+Date.now(),title:null!==(t=J((()=>document.title.slice(0,255))))&&void 0!==t?t:"",userId:s.userId};if(r.enableIdMapping&&(l.userKey=s.userKey),F(r.ignoreFields)||r.ignoreFields.forEach((e=>{M(l,e)})),n&&!F(this.minpExtraParams)){const e=Object.assign({},l);W(Object.assign(Object.assign({},l),this.minpExtraParams),((t,i)=>{var n;L(r.embeddedIgnore,i)?(l[i]=e[i],"domain"===i&&(l[i]=window.location.host)):l[i]=null!==(n=this.minpExtraParams[i])&&void 0!==n?n:l[i]}))}return l.trackingId=a,l},this.minpExtraParams={}}}class ni{constructor(e){this.growingIO=e,this.parsePage=()=>{const{hashtag:e}=this.growingIO.vdsConfig,t=location.pathname,i=location.search,n=location.hash,r=n.indexOf("?");this.domain=window.location.host,this.title=document.title.slice(0,255),this.time=+Date.now(),this.path=t,this.query=i,e&&(r>-1?(this.path+=n.slice(0,r),this.query=this.query+"&"+n.slice(r+1)):this.path+=n),this.query&&L(["?","&"],this.query.charAt(0))&&(this.query=this.query.slice(1))},this._getNoHashHref=()=>{const{protocol:e,host:t,pathname:i,search:n}=window.location;return`${e}://${t}${i}${n}`},this.getReferralPage=()=>{var e,t;const{dataStore:{lastPageEvent:i}}=this.growingIO;return(null==i?void 0:i.path)===this.path&&(null!==(e=null==i?void 0:i.query)&&void 0!==e?e:"")===(null!==(t=this.query)&&void 0!==t?t:"")?null==i?void 0:i.referralPage:(null==i?void 0:i.path)?this.lastHref:document.referrer},this.pageListener=()=>{const{hashtag:e}=this.growingIO.vdsConfig;let t=window.location.href,i=this.lastHref;e||(t=this._getNoHashHref(),i=this.lastNoHashHref),i!==t&&(this.parsePage(),this.buildPageEvent())},this.hookHistory=()=>{const e=window.history.pushState,t=window.history.replaceState,i=this;e&&J((()=>window.history.pushState=function(){e.apply(window.history,arguments),setTimeout(i.pageListener)})),t&&J((()=>window.history.replaceState=function(){t.apply(window.history,arguments),setTimeout(i.pageListener)})),Y(window,"popstate",this.pageListener);const{hashtag:n}=this.growingIO.vdsConfig;n&&Y(window,"hashchange",this.pageListener)},this.buildPageEvent=e=>{const{dataStore:{lastPageEvent:t,eventContextBuilder:i,eventConverter:n}}=this.growingIO;let r=Object.assign(Object.assign({eventType:"PAGE"},i()),{protocolType:location.protocol.substring(0,location.protocol.length-1),referralPage:this.getReferralPage()});F(e)||(r=Object.assign(Object.assign({},r),e)),r.timestamp=this.time,n(r),this.lastHref=window.location.href,this.lastNoHashHref=this._getNoHashHref(),this.lastLocation=Object.assign({},window.location)},this.title=document.title.slice(0,255),this.lastLocation=Object.assign({},window.location)}}const ri={referralPage:document.referrer};class si{constructor(r){var a,c,l;this.growingIO=r,this.ALLOW_SETTING=Object.assign(Object.assign({},t),"saas"===this.growingIO.gioEnvironment?n:i),this.allowOptKeys=Object.keys(this.ALLOW_SETTING),this.trackTimers={},this.setSequenceIds=(e,t)=>{let i=this.growingIO.storage.getItem(this.seqStorageIdName)||{};"gsid"===e?i.globalKey=t:i=Object.assign(Object.assign({},i),t),this.growingIO.storage.setItem(this.seqStorageIdName,i)},this.initOptions=t=>{var i,n,r,s,a,c,l;const{projectId:h,dataSourceId:u,appId:g}=t;this.initialDataSourceId=u;const p={};this.allowOptKeys.forEach((i=>{const n=this.ALLOW_SETTING[i].type;let r=_(n)?!L(n,$(t[i])):$(t[i])!==n;"platform"!==i||L(e,t[i])||(r=!0),r?p[i]=this.ALLOW_SETTING[i].default:"ignoreFields"===i?p.ignoreFields=t.ignoreFields.filter((e=>L(d,e))):(p[i]=t[i],L(["dataCollect","autotrack"],i)&&(p[i]||X("已关闭"+o[i],"info")))})),p.sessionExpires=Math.round(p.sessionExpires),(O(p.sessionExpires)||1>p.sessionExpires||p.sessionExpires>360)&&(p.sessionExpires=30),p.storageType=p.storageType.toLowerCase(),p.sendType=p.sendType.toLowerCase(),L(["beacon","xhr","image"],p.sendType)||(p.sendType="beacon"),!O(Number(p.requestTimeout))&&p.requestTimeout>0||(p.requestTimeout=5e3),this.growingIO.vdsConfig=Object.assign(Object.assign(Object.assign({},null!==(i=window.vds)&&void 0!==i?i:{}),p),{projectId:h,dataSourceId:u,appId:g,performance:{monitor:null===(r=null===(n=p.performance)||void 0===n?void 0:n.monitor)||void 0===r||r,exception:null===(a=null===(s=p.performance)||void 0===s?void 0:s.exception)||void 0===a||a,network:null!==(l=null===(c=p.performance)||void 0===c?void 0:c.network)&&void 0!==l&&l}}),window.vds=this.growingIO.vdsConfig,this.seqStorageIdName=h+"_gdp_sequence_ids",this.visitStorageName=h+"_gdp_session_id_sent"},this.setOption=(e,t)=>{var i;const{vdsConfig:n,callError:r,uploader:o,emitter:a}=this.growingIO,d=I(e)&&L(s,e),c=d&&typeof t===((null===(i=this.ALLOW_SETTING[e])||void 0===i?void 0:i.type)||"string"),l=Object.assign({},n);return d&&c?(n[e]=t,"dataCollect"===e&&l.dataCollect!==t&&(t?(this.sendVisit(!0),this.sendPage()):this.growingIO.clearTrackTimer()),L(["host","scheme"],e)&&(null==o||o.generateHost()),null==a||a.emit("OPTION_CHANGE",{optionName:e,optionValue:t}),window.vds[e]=t,!0):(r("setOption > "+e),!1)},this.getOption=e=>{const{vdsConfig:t,callError:i}=this.growingIO;return e&&B(t,k(e))?t[k(e)]:v(e)?Object.assign({},t):void i("getOption > "+e)},this.sendVisit=e=>{const{userStore:{sessionId:t},storage:i}=this.growingIO,n=i.getItem(this.visitStorageName);!e&&t===n||(this.lastVisitEvent.timestamp=this.currentPage.time-1,this.buildVisitEvent())},this.buildVisitEvent=e=>{const{dataStore:{eventContextBuilder:t,eventConverter:i},emitter:n,storage:r,userStore:s}=this.growingIO,{referralPage:o,title:a,path:d,query:c,timestamp:l}=this.lastVisitEvent;let h=Object.assign(Object.assign({eventType:"VISIT"},t()),{referralPage:o||this.currentPage.getReferralPage(),timestamp:l});d&&(h.title=a,h.path=d,h.query=c),F(e)||(h.session=(null==e?void 0:e.session)||h.session,h.trackingId=null==e?void 0:e.trackingId,h=Object.assign(Object.assign({},h),e));const u=({requestData:e})=>{"VISIT"===e.eventType&&e.trackingId===this.growingIO.trackingId&&(s.sessionId===e.sessionId&&r.setItem(this.visitStorageName,e.sessionId),n.off("onSendAfter",u))};n.on("onSendAfter",u),i(h)},this.sendPage=e=>{e&&this.currentPage.parsePage(),this.currentPage.buildPageEvent()},this.buildErrorEvent=e=>{const{dataStore:{eventContextBuilder:t,eventConverter:i}}=this.growingIO;i(Object.assign({eventType:"CUSTOM",pageShowTimestamp:this.currentPage.time,eventName:"onError",attributes:e},t()))},this.currentPage=new ni(this.growingIO),this.eventContextBuilderInst=new ii(this.growingIO),this.eventContextBuilder=this.eventContextBuilderInst.main,this.generalProps={},this.lastVisitEvent=ri,null===(a=this.growingIO.emitter)||void 0===a||a.on("onComposeAfter",(({composedEvent:e})=>{"VISIT"!==e.eventType&&"vst"!==e.t||e.trackingId!==this.growingIO.trackingId||(this.lastVisitEvent=e)})),this.lastPageEvent={},null===(c=this.growingIO.emitter)||void 0===c||c.on("onComposeAfter",(({composedEvent:e})=>{"PAGE"!==e.eventType&&"page"!==e.t||e.trackingId!==this.growingIO.trackingId||(this.lastPageEvent=e)})),null===(l=this.growingIO.emitter)||void 0===l||l.on(Se,(()=>{if(this.growingIO.gioSDKInitialized){this.currentPage.parsePage();const{title:e,path:t,query:i,time:n,getReferralPage:r}=this.currentPage;this.lastVisitEvent={referralPage:document.referrer||r(),title:e,path:t,query:i,timestamp:n-1},this.sendVisit(!0),this.sendPage(!0)}}))}get esid(){const e=this.growingIO.storage.getItem(this.seqStorageIdName)||{};let t=Object.assign({},e);return M(t,"globalKey"),t=y(t)&&!v(t)?t:{},this._esid={},K(t).forEach((e=>{this._esid[e]=O(Number(t[e]))||t[e]>=1e9||1>t[e]?1:t[e]})),this._esid}set esid(e){const t={};K(e).forEach((i=>{t[i]=O(e[i])||e[i]>=1e9||1>e[i]?1:e[i]})),V(this._esid,t)||(this._esid=t,this.setSequenceIds("esid",this._esid))}get gsid(){const e=this.growingIO.storage.getItem(this.seqStorageIdName)||{},t=Number(e.globalKey);return this._gsid=O(t)||t>=1e9||1>t?1:t,this._gsid}set gsid(e){O(Number(e))||e>=1e9||1>e?this._gsid=1:this._gsid=e,this.setSequenceIds("gsid",this._gsid)}}class oi extends si{constructor(e){super(e),this.growingIO=e,this.eventConverter=e=>{var t;const{vdsConfig:i,dataStore:n,uploader:r}=this.growingIO;if(i.dataCollect){e.trackingId===this.growingIO.trackingId&&(e.globalSequenceId=n.gsid,e.eventSequenceId=n.esid[e.eventType]||1);const i={};W(e,((e,t)=>{var n;if("element"===t){const t=null!==(n=N(e))&&void 0!==n?n:{};W(t,((e,t)=>{F(e)&&0!==e||(i[t]=e)}))}else(F(e)||v(e))&&0!==e||(i[t]=e)})),e.trackingId===this.growingIO.trackingId&&(this.growingIO.dataStore.gsid+=1,this.growingIO.dataStore.esid=Object.assign(Object.assign({},this.growingIO.dataStore.esid),{[i.eventType]:(this.growingIO.dataStore.esid[i.eventType]||1)+1})),null===(t=this.growingIO.emitter)||void 0===t||t.emit("onComposeAfter",{composedEvent:Object.assign({},i)}),e.trackingId===this.growingIO.trackingId&&r.commitRequest(i)}else"VISIT"===e.eventType&&(this.lastVisitEvent=e)}}}class ai{constructor(e){this.growingIO=e,this.getSendType=()=>{const{sendType:e}=this.growingIO.vdsConfig;return"beacon"===e?(()=>{var e;const t=!!(null===(e=null===window||void 0===window?void 0:window.navigator)||void 0===e?void 0:e.sendBeacon),i=window.navigator.userAgent;if(i.match(/(iPad|iPhone|iPod)/g)){const e=(e=>{const t=e.toLowerCase().match(/cpu.*os (.*?) like mac os/i);return!t||2>t.length?0:+t[1].split("_").slice(0,2).join(".")})(i);return t&&e>13}return t})()?"beacon":"xhr":e},this.commitRequest=e=>{const t=Object.assign({},e);this.requestQueue.push(Object.assign(Object.assign({},t),{requestType:this.getSendType()})),this.initiateRequest()},this.initiateRequest=()=>{var e,t;if([...this.requestQueue].length>0&&this.requestingNum(this.retryIds[e.globalSequenceId||e.esid]||0)<=this.retryLimit)),F(this.requestQueue))return;const o=this.requestQueue.shift(),{requestType:a}=o;null==n||n.emit("onSendBefore",{requestData:Object.assign({},o)});const d=Object.assign({},o);if(M(d,["requestType","trackingId"]),i.debug&&console.log("[GrowingIO Debug]:",JSON.stringify(d,null,2).replace(/\"/g,(()=>{const e=window.navigator.userAgent;return/(\d+\.\d)?(?:\.\d)?\s+safari\/?(\d+\.\d+)?/i.test(e)&&!/chrome\/(\d+\.\d+)/i.test(e)})()?"":'"')),this.requestingNum+=1,s)return this.requestSuccessFn(o),!1;let c=Object.assign({},d);switch(i.compress&&(null==r?void 0:r.gioCompress)?"image"===a?(this.compressType="11",c=null===(e=null==r?void 0:r.gioCompress)||void 0===e?void 0:e.compressToEncodedURIComponent(JSON.stringify([c]))):(this.compressType="1",c=null===(t=null==r?void 0:r.gioCompress)||void 0===t?void 0:t.compressToUint8Array(JSON.stringify([c]))):(this.compressType="0",c=JSON.stringify([c])),a){case"beacon":default:this.sendByBeacon(o,c);break;case"xhr":this.sendByXHR(o,c);break;case"image":this.sendByImage(o,c)}}},this.generateURL=()=>`${this.requestURL}?stm=${+Date.now()}&compress=${this.compressType}`,this.sendByBeacon=(e,t)=>{navigator.sendBeacon(this.generateURL(),t)?this.requestSuccessFn(e):this.requestFailFn(e,"beacon")},this.sendByXHR=(e,t)=>{const i=new XMLHttpRequest;if(i)return i.open("POST",this.generateURL(),!0),i.onload=()=>{204===i.status?this.requestSuccessFn(e):this.requestFailFn(e,"xhr")},i.ontimeout=i.onerror=i.onabort=()=>{this.requestFailFn(e,"xhr")},i.setRequestHeader("Content-Type","text/plain;charset=UTF-8"),i.timeout=this.growingIO.vdsConfig.requestTimeout,void i.send(t);if(null===window||void 0===window?void 0:window.XDomainRequest){const i=new window.XDomainRequest;i.open("POST",this.generateURL().replace("https://","http://"),!0),i.onload=()=>{204===i.status?this.requestSuccessFn(e):this.requestFailFn(e,"xhr")},i.onerror=i.ontimeout=()=>{this.requestFailFn(e,"xhr")},i.send(t)}},this.sendByImage=(e,t)=>{const i=`${this.generateURL()}&data=${t}`;let n=document.createElement("img");n.width=1,n.height=1;let r=window.setTimeout((()=>{this.requestingNum-=1,this.clearImage(n),window.clearTimeout(r),r=null,this.initiateRequest()}),this.growingIO.vdsConfig.requestTimeout);n.onload=()=>{this.requestSuccessFn(e),this.clearImage(n),window.clearTimeout(r),r=null},n.onerror=n.onabort=()=>{this.requestSuccessFn(e),this.clearImage(n),window.clearTimeout(r),r=null},n.src=i},this.clearImage=e=>{e.src="",e.onload=()=>{},e.onerror=e.onabort=()=>{},e=null},this.requestSuccessFn=e=>{var t;this.requestingNum-=1;const i=e.globalSequenceId||e.esid||-1;this.retryIds[i]&&(this.retryIds[i]=0),e.trackingId===this.growingIO.trackingId&&this.growingIO.userStore.sessionId===e.sessionId&&(this.growingIO.userStore.sessionId=e.sessionId),null===(t=this.growingIO.emitter)||void 0===t||t.emit("onSendAfter",{requestData:Object.assign({},e)}),this.initiateRequest()},this.requestFailFn=(e,t)=>{this.requestingNum-=1;const i=e.globalSequenceId||e.esid||-1;this.retryIds[i]||(this.retryIds[i]=0),this.retryIds[i]+=1;const n=this.requestQueue.some((t=>t.globalSequenceId===e.globalSequenceId&&t.esid===e.esid));let r=t;if(this.retryIds[i]{this.requestQueue.push(Object.assign(Object.assign({},e),{requestType:r})),this.initiateRequest(),window.clearTimeout(t),t=null}),800)}this.initiateRequest()},this.requestQueue=[],this.requestLimit=10,this.requestTimeout=5e3,this.retryLimit=2,this.retryIds={},this.requestingNum=0,this.requestURL=""}}class di extends ai{constructor(e){super(e),this.growingIO=e,this.generateHost=()=>{let{scheme:e,host:t="",projectId:i}=this.growingIO.vdsConfig;e?q(k(e),"://")||(e+="://"):e=(location.protocol.indexOf("http")>-1?location.protocol.replace(":",""):"https")+"//",G(t,"http")&&(t=t.substring(t.indexOf("://")+(q(k(e),"://")?3:0))),this.requestURL=`${e}${t}/v3/projects/${i}/collect`},this.requestURL="",this.generateHost()}}class ci extends ei{constructor(){super(),this.registerPlugins=e=>{_(e)?(e.forEach(((t,i)=>{var n,r;F(t)||v(t)?X("插件不合法,跳过加载!","warn"):(null===(n=t.js)||void 0===n?void 0:n.default)&&(e[i]=Object.assign(Object.assign({},null===(r=t.js)||void 0===r?void 0:r.default),{options:t.options}))})),e=A(e),this.plugins.installAll(e)):X("插件注册失败,请检查!","error")},this.initCallback=()=>{this.uploader=new di(this),this.userStore=new ti(this)},this.getPlugins=()=>this.plugins.pluginItems,this.setTrackerScheme=e=>{L(["http","https"],e)?(this.dataStore.setOption("scheme",e),this.notRecommended()):this.callError("scheme",!1)},this.setTrackerHost=e=>{ie.test(e)||ne.test(e)?(this.dataStore.setOption("host",e),this.notRecommended()):this.callError("host",!1)},this.setDataCollect=e=>{this.setOption("dataCollect",!!e),this.notRecommended()},this.setAutotrack=e=>{this.setOption("autotrack",!!e),this.notRecommended()},this.enableDebug=e=>{this.setOption("debug",!!e),this.notRecommended()},this.enableHT=e=>{this.setOption("hashtag",!!e),this.notRecommended()},this.getVisitorId=()=>this.userStore.uid,this.getDeviceId=()=>this.userStore.uid,this.setUserAttributes=(e,t)=>{var i,n;!F(e)&&y(e)?null===(n=null===(i=this.plugins)||void 0===i?void 0:i.gioCustomTracking)||void 0===n||n.buildUserAttributesEvent(e,t):this.callError("setUserAttributes")},this.setUserId=(e,t)=>{if(te(k(e).trim())){const i=this.userStore.gioId;this.vdsConfig.enableIdMapping&&(this.userStore.userKey=!v(t)&&k(t).length>0?k(t).slice(0,1e3):""),this.userStore.userId=k(e).slice(0,1e3),i&&i!==this.userStore.userId&&(this.userStore.sessionId="")}else this.clearUserId(),this.callError("setUserId")},this.clearUserId=()=>{this.userStore.userId="",this.userStore.userKey=""},this.track=(e,t,i,n)=>{var r,s;((null===(s=null===(r=this.plugins)||void 0===r?void 0:r.gioCustomTracking)||void 0===s?void 0:s.buildCustomEvent)||function(){})(e,Object.assign(Object.assign({},this.dataStore.generalProps),y(t)&&!F(t)?t:{}),i,n)},this.sendPage=e=>this.dataStore.currentPage.buildPageEvent(e),this.sendVisit=e=>this.dataStore.buildVisitEvent(e),this.trackTimerStart=(e,t)=>{this.vdsConfig.dataCollect&&Q(e,(()=>{const i=oe();E(t)?(this.dataStore.trackTimers[i]={eventName:e,leng:0,start:+Date.now()},t(i)):X("回调方法不合法,返回timerId失败!")}))},this.trackTimerPause=e=>{if(e&&this.dataStore.trackTimers[e]){const t=this.dataStore.trackTimers[e];t.start&&(t.leng=t.leng+(+Date.now()-t.start)),t.start=0}},this.trackTimerResume=e=>{if(e&&this.dataStore.trackTimers[e]){const t=this.dataStore.trackTimers[e];0===t.start&&(t.start=+Date.now())}},this.trackTimerEnd=(e,t)=>{if(this.vdsConfig.dataCollect){const i=864e5;if(e&&this.dataStore.trackTimers[e]){const n=this.dataStore.trackTimers[e];if(0!==n.start){const e=+Date.now()-n.start;n.leng=e>0?n.leng+e:0}this.track(n.eventName,Object.assign(Object.assign({},t),{event_duration:n.leng>i?0:n.leng/1e3})),this.removeTimer(e)}else X("未查找到对应的计时器,请检查!","error")}},this.removeTimer=e=>{e&&this.dataStore.trackTimers[e]&&delete this.dataStore.trackTimers[e]},this.clearTrackTimer=()=>{this.dataStore.trackTimers={}},this.dataStore=new oi(this)}}let li;!function(){var e,t,i,n,s;let o=window.gioCompatibilityVds?"gdp_vds":"vds";if(null===(e=window[o])||void 0===e?void 0:e.gioSDKInstalled)return li=window.gdp,void X("SDK重复加载,请检查是否重复加载SDK或接入其他平台SDK导致冲突!","warn");window[o]=Object.assign(Object.assign({},null!==(t=window[o])&&void 0!==t?t:{}),{gioSDKInstalled:!0});const d=new ci;li=function(){var e;const t=arguments[0];if(I(t)&&L(r,t)&&d[t]){const e=x(R(arguments));if("init"===t){const t=(e=>{var t;return e.vdsConfig||e.gioSDKInitialized||(null===(t=window.vds)||void 0===t?void 0:t.gioSDKInitialized)?(X("SDK重复初始化,请检查是否重复加载SDK或接入其他平台SDK导致冲突!","warn"),!1):!(L(["","localhost","127.0.0.1"],location.hostname)&&!window._gr_ignore_local_rule&&(X("当前SDK不允许在本地环境初始化!","warn"),1))})(d);if(!t)return;const i=(e=>!F(A(e))||(X('SDK初始化失败,请使用 gdp("init", "您的GrowingIO项目 accountId", "您项目的 dataSourceId", options); 进行初始化!',"error"),!1))(e);if(!i)return;const n=(e=>{const t=N(e);let i=C(e);return te(k(t).trim())?(y(i)&&i||(i={}),{projectId:t,userOptions:i}):(X("SDK初始化失败,accountId 参数不合法!","error"),!1)})(e);if(!n)return;const r=(e=>{const t=e[1],i=e[2],n=C(e);return t&&I(t)?{dataSourceId:t,appId:I(i)?i:"",cdpOptions:n}:(X("SDK初始化失败,dataSourceId 参数不合法!","error"),!1)})(e);if(!r)return;const{projectId:s}=n,{dataSourceId:o,appId:a,cdpOptions:c}=r;d.init(Object.assign(Object.assign({},c),{projectId:s,dataSourceId:o,appId:a}))}else if("registerPlugins"===t)d.registerPlugins(e[0]);else{if(d.gioSDKInitialized&&d.vdsConfig)return d[t](...e);d.emitter.emit("UNINITIALIZED_CALL",arguments),X("SDK未初始化!","error")}}else L(a,t)?X(`方法 ${k(t)} 已被弃用,请移除!`,"warn"):X(`不存在名为 ${k(t)} 的方法调用!`,"error");window[o]=Object.assign(Object.assign({},window[o]),{_gr_ignore_local_rule:null!==(e=window._gr_ignore_local_rule)&&void 0!==e&&e,gioEnvironment:"cdp",gioSDKVersion:d.sdkVersion,gioSDKFull:d.gioSDKFull,canIUse:e=>L(r,e)&&d[e]})};const c=null===(i=null===window||void 0===window?void 0:window.gdp)||void 0===i?void 0:i.q,l=null===(n=null===window||void 0===window?void 0:window.gdp)||void 0===n?void 0:n.e,h=null===(s=null===window||void 0===window?void 0:window.gdp)||void 0===s?void 0:s.ef;window.gdp=li,window.gdp.e=l,window.gdp.ef=h,_(c)&&!F(c)&&c.forEach((e=>{li.apply(null,e)}))}();var hi=li;export{hi as default}; +const e=["web","wxwv","minp","alip","baidup","qq","bytedance"],t={autotrack:{type:"boolean",default:!0},compress:{type:"boolean",default:!0},dataCollect:{type:"boolean",default:!0},debug:{type:"boolean",default:!1},hashtag:{type:"boolean",default:!1},touch:{type:"boolean",default:!1},version:{type:"string",default:"1.0.0"},platform:{type:"string",default:"web"},cookieDomain:{type:"string",default:""},sendType:{type:"string",default:"beacon"}},i={enableIdMapping:{type:"boolean",default:!1},gtouchHost:{type:"string",default:""},host:{type:"string",default:"napi.growingio.com"},ignoreFields:{type:"array",default:[]},penetrateHybrid:{type:"boolean",default:!0},scheme:{type:"string",default:location.protocol.indexOf("http")>-1?location.protocol.replace(":",""):"https"},sessionExpires:{type:"number",default:30},performance:{type:"object",default:{monitor:!0,exception:!0}},embeddedIgnore:{type:"array",default:[]},storageType:{type:"string",default:"cookie"},requestTimeout:{type:"number",default:5e3}},n={},r=["clearUserId","getGioInfo","getLocation","getOption","init","setDataCollect","setOption","setUserId","track","setGeneralProps","clearGeneralProps","enableDebug","enableHT","setAutotrack","setTrackerHost","setTrackerScheme","setUserAttributes","getVisitorId","getDeviceId","registerPlugins","getPlugins","sendPage","sendVisit","trackTimerStart","trackTimerPause","trackTimerResume","trackTimerEnd","removeTimer","clearTrackTimer","updateImpression"],s=["autotrack","dataCollect","dataSourceId","debug","host","hashtag","scheme"],o={autotrack:"无埋点采集",dataCollect:"数据采集",debug:"调试模式"},a=["send","setConfig","collectImp","setPlatformProfile"],d=["screenHeight","screenWidth"],c={click:"VIEW_CLICK",change:"VIEW_CHANGE",submit:"FORM_SUBMIT"};var l,h,u,g,p,f="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},m="function"==typeof Array.from?Array.from:(h||(h=1,u=function(e){return"function"==typeof e},g=function(e){var t=function(e){var t=Number(e);return isNaN(t)?0:0!==t&&isFinite(t)?(t>0?1:-1)*Math.floor(Math.abs(t)):t}(e);return Math.min(Math.max(t,0),9007199254740991)},p=function(e){var t=e.next();return!t.done&&t},l=function(e){var t,i,n,r=this,s=arguments.length>1?arguments[1]:void 0;if(void 0!==s){if(!u(s))throw new TypeError("Array.from: when provided, the second argument must be a function");arguments.length>2&&(t=arguments[2])}var o=function(e,t){if(null!=e&&null!=t){var i=e[t];if(null==i)return;if(!u(i))throw new TypeError(i+" is not a function");return i}}(e,function(e){if(null!=e){if(["string","number","boolean","symbol"].indexOf(typeof e)>-1)return Symbol.iterator;if("undefined"!=typeof Symbol&&"iterator"in Symbol&&Symbol.iterator in e)return Symbol.iterator;if("@@iterator"in e)return"@@iterator"}}(e));if(void 0!==o){i=u(r)?Object(new r):[];var a,d,c=o.call(e);if(null==c)throw new TypeError("Array.from requires an array-like or iterable object");for(n=0;;){if(!(a=p(c)))return i.length=n,i;d=a.value,i[n]=s?s.call(t,d,n):d,n++}}else{var l=Object(e);if(null==e)throw new TypeError("Array.from requires an array-like object - not null or undefined");var h,f=g(l.length);for(i=u(r)?Object(new r(f)):Array(f),n=0;f>n;)h=l[n],i[n]=s?s.call(t,h,n):h,n++;i.length=f}return i}),l);const v=e=>L(["undefined","null"],$(e)),I=e=>"string"===$(e),w=e=>"number"===$(e),O=e=>"NaN"===k(Number(e)),b=e=>"boolean"===$(e),y=e=>"object"===$(e)&&!v(e),T=e=>"regexp"===$(e),E=e=>L(["function","asyncfunction"],$(e)),_=e=>Array.isArray(e)&&"array"===$(e),S=e=>"date"===$(e),N=e=>{try{return R(e)[0]}catch(e){return}},C=e=>{try{const t=R(e);return t[t.length-1]}catch(e){return}},x=(e,t=1)=>_(e)&&w(t)?e.slice(t>0?t:1,e.length):e,A=e=>{if(_(e)){let t=0;const i=[];for(const n of e)n&&!F(n)&&(i[t++]=n);return i}return e},P=(e,t)=>e[D(e,t)],D=(e,t)=>{let i=-1;return _(e)&&e.every(((e,n)=>!t(e)||(i=n,!1))),i},L=(e,t)=>("array"===$(e)||"string"===$(e))&&e.indexOf(t)>=0,R=m,k=e=>v(e)?"":""+e,U=(e,t)=>"string"==typeof e?e.split(t):e,j=e=>{if(I(e)){const t=U(e,"");return`${N(t).toLowerCase()}${x(t).join("")}`}return e},G=(e,t)=>!!I(e)&&e.slice(0,t.length)===t,q=(e,t)=>{if(I(e)){const{length:i}=e;let n=i;n>i&&(n=i);const r=n;return n-=t.length,n>=0&&e.slice(n,r)===t}return!1},H={}.hasOwnProperty,B=(e,t)=>!v(e)&&H.call(e,t),K=e=>y(e)?Object.keys(e):[],W=(e,t)=>{K(e).forEach((i=>t(e[i],i)))},V=(e,t)=>{const i=K(e);return!(!y(e)||!y(t)||i.length!==K(t).length||L(i.map(((i,n)=>y(e[i])?V(e[i],t[i]):e[i]===t[i])),!1))},M=(e,t)=>{if(!y(e))return!1;try{return"string"===$(t)?delete e[t]:"array"===$(t)?t.map((t=>delete e[t])):(T(t)&&K(e).forEach((i=>{t.test(i)&&M(e,i)})),!0)}catch(e){return!1}},F=e=>_(e)?0===e.length:y(e)?0===K(e).length:!e,$=e=>({}.toString.call(e).slice(8,-1).toLowerCase());var z=Object.freeze({__proto__:null,isNil:v,isString:I,isNumber:w,isNaN:O,isBoolean:b,isObject:y,isRegExp:T,isFunction:E,isArray:_,isDate:S,fixed:(e,t)=>w(e)?Number(e.toFixed(w(t)?t:2)):I(e)&&"NaN"!==k(Number(e))?Number(Number(e).toFixed(w(t)?t:2)):e,head:N,last:C,drop:x,dropWhile:(e,t)=>_(e)?e.filter((e=>!t(e))):e,compact:A,find:P,findIndex:D,includes:L,arrayFrom:R,toString:k,split:U,lowerFirst:j,upperFirst:e=>{if(I(e)){const t=U(e,"");return`${N(t).toUpperCase()}${x(t).join("")}`}return e},startsWith:G,endsWith:q,has:B,keys:K,forEach:W,isEqual:V,get:(e,t,i)=>{let n=e;return y(e)?(t.split(".").forEach((e=>{n=n?n[e]:i})),n):i},unset:M,isEmpty:F,typeOf:$,formatDate:e=>{if(S(e)){const t=e=>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())}return e}});const X=(e,t)=>{console.log("%c [GrowingIO]:"+e,{info:"color: #3B82F6;",error:"color: #EF4444;",warn:"color: #F59E0B;",success:"color: #10B981;"}[t]||"")},J=e=>{try{return e()}catch(e){return}},Z=e=>{const t={};return y(e)&&W(e,((e,i)=>{var n;const r=k(i).slice(0,100);y(e)?t[r]=Z(e):_(e)?(t[r]=e.slice(0,100),"cdp"===(null===(n=window.vds)||void 0===n?void 0:n.gioEnvironment)&&(t[r]=t[r].join("||").slice(0,1e3))):t[r]=v(e)?"":k(e).slice(0,1e3)})),t},Y=(e,t,i,n={})=>{document.addEventListener?e.addEventListener(t,i,Object.assign(Object.assign({},{capture:!0}),n)):e.attachEvent?e.attachEvent("on"+t,i):e["on"+t]=i},Q=(e,t)=>I(e)&&!F(e)&&e.match(/^[a-zA-Z_][0-9a-zA-Z_]{0,100}$/)?t():(X("事件名格式不正确,只能包含数字、字母和下划线,且不能以数字开头,字符总长度不能超过100!","error"),!1);var ee=Object.freeze({__proto__:null,consoleText:X,niceTry:J,limitObject:Z,addListener:Y,flattenObject:(e={})=>{const t=Object.assign({},e);return K(t).forEach((e=>{y(t[e])?(K(t[e]).forEach((i=>{t[`${e}_${i}`]=k(t[e][i])})),M(t,e)):_(t[e])?(t[e].forEach(((i,n)=>{y(i)?K(i).forEach((r=>{t[`${e}_${n}_${r}`]=k(i[r])})):t[`${e}_${n}`]=k(i)})),M(t,e)):v(t[e])||""===t[e]?M(t,e):t[e]=k(t[e])})),Z(t)},eventNameValidate:Q,getGioFunction:()=>{var e,t,i,n;const r=window._gio_local_vds||"vds",s=null!==(t=null===(e=window[r])||void 0===e?void 0:e.namespace)&&void 0!==t?t:"gdp";return E(window[s])?window[s]:null!==(n=null!==(i=window.gdp)&&void 0!==i?i:window.gio)&&void 0!==n?n:function(){}}});const te=e=>I(e)&&e.length>0||w(e)&&e>0,ie=/^((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})(\.((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})){3}/i,ne=/^(https?:\/\/)|(([a-zA-Z0-9_-])+(\.)?)*(:\d+)?(\/((\.)?(\?)?=?&?[a-zA-Z0-9_-](\?)?)*)*$/i;function re(e){for(var t=1;arguments.length>t;t++){var i=arguments[t];for(var n in i)e[n]=i[n]}return e}var se=function e(t,i){function n(e,n,r){if("undefined"!=typeof document){"number"==typeof(r=re({},i,r)).expires&&(r.expires=new Date(Date.now()+864e5*r.expires)),r.expires&&(r.expires=r.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var s="";for(var o in r)r[o]&&(s+="; "+o,!0!==r[o]&&(s+="="+r[o].split(";")[0]));return document.cookie=e+"="+t.write(n,e)+s}}return Object.create({set:n,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var i=document.cookie?document.cookie.split("; "):[],n={},r=0;r"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)})),ae=e=>q(e,"_gioenc")?e.slice(0,-7):e,de=e=>O(Number(e))&&J((()=>JSON.parse(e)))||e,ce={A:1,a:1,Z:1,z:1,"@":1,"{":1},le=e=>v(e)?e:J((()=>"gioenc-"+ue(e)))||e,he=e=>I(e)&&G(e,"gioenc-")&&J((()=>ue(e.replace("gioenc-",""))))||e,ue=e=>(e=e||"").split("").map((e=>ce[e]?e:ge(e))).join(""),ge=e=>{if(/[0-9]/.test(e))return 1^+e;{let t=e.charCodeAt(0);return String.fromCharCode(1^t)}};class pe{constructor(e){this.domain=e,this.getItem=e=>de(he(se.get(ae(e),{domain:this.domain,path:"/"}))),this.setItem=(e,t,i)=>{let n;n=I(t)?t.length?q(e,"_gioenc")?le(t):t:"":JSON.stringify(t),se.set(ae(e),n,{expires:i?new Date(i):3650,domain:this.domain,path:"/"})},this.removeItem=e=>{se.remove(ae(e),{domain:this.domain,path:"/"})},this.hasItem=e=>L(K(se.get()),ae(e)),this.getKeys=()=>K(se.get()),this.type="Cookie"}}class fe{constructor(){this.getItem=e=>{const t=J((()=>JSON.parse(localStorage.getItem(ae(e))||"")))||{};return y(t)&&t.expiredAt>+Date.now()?de(he(t.value)):void 0},this.setItem=(e,t,i)=>{const n=null!=i?i:+new Date(9999,12);localStorage.setItem(ae(e),JSON.stringify({value:I(t)&&t.length&&q(e,"_gioenc")?le(t):t,expiredAt:n}))},this.removeItem=e=>localStorage.removeItem(ae(e)),this.hasItem=e=>!!localStorage.getItem(ae(e)),this.getKeys=()=>R(Array(localStorage.length)).map(((e,t)=>localStorage.key(t))),this.type="localStorage"}}const me={};class ve{constructor(){this.getItem=e=>{const t=J((()=>JSON.parse(me[ae(e)]||"")));return y(t)&&t.expiredAt>+Date.now()?de(he(t.value)):void 0},this.setItem=(e,t,i)=>{const n=null!=i?i:+new Date(9999,12);me[ae(e)]=JSON.stringify({value:I(t)&&t.length?le(t):t,expiredAt:n})},this.removeItem=e=>M(me,ae(e)),this.hasItem=e=>B(me,ae(e)),this.getKeys=()=>K(me),this.type="memory"}}let Ie;const we=/^(\.ac\.|\.br\.|\.co\.|\.com\.|\.edu\.|\.gov\.|\.org\.|\.net\.)/,Oe=e=>{const t=[];try{const i=e.split("."),n=C(i);if(i.length>=2&&(isNaN(Number(n))||0>Number(n)||Number(n)>255)){const e="."+i.slice(-2).join(".");we.test(e)?Ie=e:t.push(e);const n="."+i.slice(-3).join(".");we.test(n)||L(t,n)||t.push(n);const r="."+i.slice(-4).join(".");we.test(r)||L(t,r)||t.push(r)}}catch(e){}return t},be=e=>{let t="";return e.every((e=>!ye(e)||(t=e,!1))),t},ye=e=>{try{se.set("gioCookie","yes",{domain:e});const t=!!se.get("gioCookie",{domain:e});return se.remove("gioCookie",{domain:e}),t}catch(e){return!1}},Te=e=>{let t,i,n,{storageType:r,cookieDomain:s,projectId:o}=e;if(L(["cookie","localstorage"],r)||(r="cookie"),"cookie"===r&&(n=navigator.userAgent.indexOf("Electron")>-1||L(["","localhost","127.0.0.1"],window.location.hostname)||!L(["http:","https:"],window.location.protocol)?"":be([...Oe(window.location.hostname),window.location.hostname]),i=!!n),"cookie"===r&&i){const e=new pe(n);if(s){let t=Oe(s);const i=be(F(t)?[]:[s,...Oe(s)]);i&&ye(i)?e.domain=i:X("指定Cookie域无效或无权限,使用默认域!","warn")}t=e}else t=(()=>{try{const e=window.localStorage,t="__storage_test__";return e.setItem(t,t),e.removeItem(t),!0}catch(e){return!1}})()?new fe:new ve;return"cookie"===r&&Ie&&ye(Ie)&&((e,t,i)=>{if(t&&ye(t)){let n=new pe(t);[i+"_gdp_session_id","gdp_user_id_gioenc",i+"_gdp_cs1_gioenc",i+"_gdp_user_key_gioenc",i+"_gdp_gio_id_gioenc",i+"_gdp_sequence_ids",i+"_gdp_session_id_sent"].forEach((t=>{const i=n.getItem(t);n.hasItem(t)&&(e.setItem(t,i),n.removeItem(t))})),n=void 0}})(t,Ie,o),t};var Ee="OPTION_INITIALIZED",_e="SDK_INITIALIZED",Se="SESSIONID_UPDATE",Ne="SET_USERID",Ce="SET_USERKEY",xe={name:"gioCompress",method:class{constructor(e){this.growingIO=e,this._compress=(e,t,i)=>{if(null===e)return"";let n,r,s,o={},a={},d="",c="",l="",h=2,u=3,g=2,p=[],f=0,m=0;for(s=0;sl.charCodeAt(0)){for(n=0;g>n;n++)f<<=1,m===t-1?(m=0,p.push(i(f)),f=0):m++;for(r=l.charCodeAt(0),n=0;8>n;n++)f=f<<1|1&r,m===t-1?(m=0,p.push(i(f)),f=0):m++,r>>=1}else{for(r=1,n=0;g>n;n++)f=f<<1|r,m===t-1?(m=0,p.push(i(f)),f=0):m++,r=0;for(r=l.charCodeAt(0),n=0;16>n;n++)f=f<<1|1&r,m===t-1?(m=0,p.push(i(f)),f=0):m++,r>>=1}h--,0===h&&(h=Math.pow(2,g),g++),delete a[l]}else for(r=o[l],n=0;g>n;n++)f=f<<1|1&r,m===t-1?(m=0,p.push(i(f)),f=0):m++,r>>=1;h--,0===h&&(h=Math.pow(2,g),g++),o[c]=u++,l=d+""}if(""!==l){if({}.hasOwnProperty.call(a,l)){if(256>l.charCodeAt(0)){for(n=0;g>n;n++)f<<=1,m===t-1?(m=0,p.push(i(f)),f=0):m++;for(r=l.charCodeAt(0),n=0;8>n;n++)f=f<<1|1&r,m===t-1?(m=0,p.push(i(f)),f=0):m++,r>>=1}else{for(r=1,n=0;g>n;n++)f=f<<1|r,m===t-1?(m=0,p.push(i(f)),f=0):m++,r=0;for(r=l.charCodeAt(0),n=0;16>n;n++)f=f<<1|1&r,m===t-1?(m=0,p.push(i(f)),f=0):m++,r>>=1}h--,0===h&&(h=Math.pow(2,g),g++),delete a[l]}else for(r=o[l],n=0;g>n;n++)f=f<<1|1&r,m===t-1?(m=0,p.push(i(f)),f=0):m++,r>>=1;h--,0===h&&(h=Math.pow(2,g),g++)}for(r=2,n=0;g>n;n++)f=f<<1|1&r,m===t-1?(m=0,p.push(i(f)),f=0):m++,r>>=1;for(;;){if(f<<=1,m===t-1){p.push(i(f));break}m++}return p.join("")},this.compress=e=>{const t=this;return this._compress(e,16,(function(e){return t.f(e)}))},this.compressToUTF16=e=>{const t=this;return null===e?"":this._compress(e,15,(function(e){return t.f(e+32)}))+" "},this.compressToUint8Array=e=>{const t=this.compress(e),i=new Uint8Array(2*t.length);for(let e=0,n=t.length;n>e;e++){const n=t.charCodeAt(e);i[2*e]=n>>>8,i[2*e+1]=n%256}return i},this.compressToEncodedURIComponent=e=>{if(null===e)return"";const t=this;return this._compress(e,6,(function(e){return t.keyStrUriSafe.charAt(e)}))},this.f=String.fromCharCode,this.keyStrUriSafe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$"}}},Ae={name:"gioCustomTracking",method:class{constructor(e){this.growingIO=e,this.getValidResourceItem=e=>{if(e&&y(e)&&e.id&&e.key){const t={id:I(e.id)?e.id:k(e.id),key:I(e.key)?e.key:k(e.key)};return e.attributes&&(t.attributes=e.attributes),t}},this.getDynamicAttributes=e=>(v(e)||K(e).forEach((t=>{E(e[t])?e[t]=e[t]():y(e[t])?M(e,t):_(e[t])||(e[t]=k(e[t]))})),e),this.buildCustomEvent=(e,t,i,n)=>{Q(e,(()=>{const{dataStore:{eventContextBuilder:r,eventConverter:s,currentPage:o}}=this.growingIO;let a=Object.assign({eventType:"CUSTOM",eventName:e,pageShowTimestamp:null==o?void 0:o.time,attributes:Z(this.getDynamicAttributes(y(t)&&!F(t)?t:void 0)),resourceItem:Z(this.getValidResourceItem(i))},r());F(n)||(a=Object.assign(Object.assign({},a),n)),s(a)}))},this.buildUserAttributesEvent=(e,t)=>{const{dataStore:{eventContextBuilder:i,eventConverter:n}}=this.growingIO;let r=Object.assign({eventType:"LOGIN_USER_ATTRIBUTES",attributes:Z(e)},i());F(t)||(r=Object.assign(Object.assign({},r),t)),n(r)}}}},Pe={},De={}.hasOwnProperty;function Le(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(e){return null}}function Re(e){try{return encodeURIComponent(e)}catch(e){return null}}Pe.stringify=function(e,t){t=t||"";var i,n,r=[];for(n in"string"!=typeof t&&(t="?"),e)if(De.call(e,n)){if((i=e[n])||null!=i&&!isNaN(i)||(i=""),n=Re(n),i=Re(i),null===n||null===i)continue;r.push(n+"="+i)}return r.length?t+r.join("&"):""},Pe.parse=function(e){for(var t,i=/([^=?#&]+)=?([^&]*)/g,n={};t=i.exec(e);){var r=Le(t[1]),s=Le(t[2]);null===r||null===s||r in n||(n[r]=s)}return n};const ke={gioprojectid:"projectId",giodatacollect:"dataCollect",gioappid:"domain",giodatasourceid:"dataSourceId",gios:"sessionId",giou:"uid",giocs1:"userId",gioid:"gioId",giouserkey:"userKey",gioappchannel:"appChannel",giodevicebrand:"deviceBrand",giodevicemodel:"deviceModel",giodevicetype:"deviceType",giolanguage:"language",gionetworkstate:"networkState",giooperatingsystem:"operatingSystem",gioplatform:"platform",gioplatformversion:"platformVersion",gioscreenheight:"screenHeight",gioscreenwidth:"screenWidth"},Ue=["giodatasourceid","gioplatform","gioappchannel","giodevicebrand","giodevicemodel","giodevicetype","giolanguage","gionetworkstate","giooperatingsystem","gioplatformversion","gioscreenheight","gioscreenwidth"],je=["giocs1","gios","giou","gioid","giouserkey"],Ge="gio_search_cookie_gioenc";var qe,He,Be={name:"gioEmbeddedAdapter",method:class{constructor(e){this.growingIO=e,this.main=()=>{var e;const{projectId:t,appId:i}=this.growingIO.vdsConfig,n=this.getGQS();let r=!1;return"none"!==this.qsFrom&&n.gioprojectid===t&&n.gioappid===i&&(F(n)?this.growingIO.storage.removeItem(Ge):this.growingIO.storage.setItem(Ge,Pe.stringify(n)),B(n,"giodatacollect")&&(this.growingIO.vdsConfig.dataCollect=L(["true",!0],n.giodatacollect)),null===(e=this.growingIO.emitter)||void 0===e||e.on("SDK_INITIALIZED",(()=>{const{userStore:e,vdsConfig:{sessionExpires:t},dataStore:{eventContextBuilderInst:i}}=this.growingIO;je.forEach((t=>{var i;e[ke[t]]=null!==(i=n[t])&&void 0!==i?i:""})),window.setInterval((()=>{e.sessionId=n.gios}),.8*t*60*1e3),Ue.forEach((e=>{B(n,e)&&(i.minpExtraParams[ke[e]]=n[e])}))})),this.growingIO.setUserId=()=>{},this.growingIO.clearUserId=()=>{},B(n,"giodatacollect")&&(this.growingIO.setDataCollect=()=>{},this.growingIO.setOption=()=>{}),r=!0),this.gioURLRewrite(),r},this.getGQS=()=>{const{hashtag:e}=this.growingIO.vdsConfig,t=this.growingIO.storage.getItem(Ge),i=window.location.search,n=window.location.hash,r=e?n.substring(n.indexOf("?")+1):"",s=Pe.parse(i),o=Pe.parse(r),a=Pe.parse((t||"").replace("gioenc-",""));let d={};if(B(s,"gioprojectid"))d=s,this.qsFrom="search";else if(B(o,"gioprojectid"))d=o,this.qsFrom="hash";else{if(!B(a,"gioprojectid"))return this.qsFrom="none",{};d=a,this.qsFrom="cookie"}const c={},l={},h=["gioappid","gioprojectid","giodatacollect",...je,...Ue];return K(d).forEach((e=>{const t=e.toLowerCase();L(h,t)?L(["","undefined","null",void 0,null],d[e])||(c[t]=d[e],L(["true","TRUE",!0],d[e])&&(c[t]=!0),L(["false","FALSE",!1],d[e])&&(c[t]=!1)):l[e]=d[e]})),this.gqs=c,this.ngqs=l,c},this.gioURLRewrite=()=>{const{hashtag:e}=this.growingIO.vdsConfig;let t=window.location.search,i=window.location.hash,n=!1;if("search"===this.qsFrom&&(t=Pe.stringify(this.ngqs,!0),n=!0),e&&"hash"===this.qsFrom&&(i=`${i.split("?")[0]}${Pe.stringify(this.ngqs,!0)}`,n=!0),n){const e=`${window.location.pathname}${t||""}${i||""}`;window.history.replaceState(null,document.title,e)}},this.gqs={},this.ngqs={},this.qsFrom="search",this.growingIO.emitter.on(Ee,(()=>{this.growingIO.useEmbeddedInherit=this.main()}))}}},Ke={},We={};qe=We,He=f&&f.__spreadArray||function(e,t,i){if(i||2===arguments.length)for(var n,r=0,s=t.length;s>r;r++)!n&&r in t||(n||(n=[].slice.call(t,0,r)),n[r]=t[r]);return e.concat(n||[].slice.call(t))},Object.defineProperty(qe,"__esModule",{value:!0}),qe.GROWING_TITLE_OLD=qe.GROWING_TITLE=qe.GROWING_GTITLE=qe.GROWING_CDP_INDEX=qe.GROWING_INDEX_OLD=qe.GROWING_INDEX=qe.GROWING_CONTAINER=qe.GROWING_TRACK=qe.GROWING_IGNORE=qe.VALID_CLASS_SELECTOR=qe.VALID_ID_SELECTOR=qe.EXCLUDE_CLASS_RE=qe.UNSUPPORTED_TAGS=qe.TEXT_NODE=qe.UNSUPPORTED_CLICK_TAGS=qe.SUPPORTED_ICON_TAGS=qe.SUPPORTED_CHANGE_TYPES=qe.SUPPORTED_CLICK_INPUT_TYPES=qe.SUPPORTED_CONTAINER_TAGS=qe.LIST_TAGS=void 0,qe.LIST_TAGS=["TR","LI","DL"],qe.SUPPORTED_CONTAINER_TAGS=He(["A","BUTTON"],qe.LIST_TAGS,!0),qe.SUPPORTED_CLICK_INPUT_TYPES=["button","submit","reset"],qe.SUPPORTED_CHANGE_TYPES=["radio","checkbox","search"],qe.SUPPORTED_ICON_TAGS=["I","EM","svg","IMG"],qe.UNSUPPORTED_CLICK_TAGS=["TEXTAREA","HTML","BODY"],qe.TEXT_NODE=["I","SPAN","EM","B","STRONG"],qe.UNSUPPORTED_TAGS=["tspan","text","g","rect","path","defs","clippath","desc","title","math","use"],qe.EXCLUDE_CLASS_RE=/(^| |[^ ]+\-)(clear|clearfix|active|hover|enabled|current|selected|unselected|hidden|display|focus|disabled|undisabled|open|checked|unchecked|undefined|null|ng-|growing-)[^\. ]*/g,qe.VALID_ID_SELECTOR=/^[a-zA-Z-\_][a-zA-Z\-\_0-9]+$/,qe.VALID_CLASS_SELECTOR=/^([a-zA-Z\-\_0-9]+)$/,qe.GROWING_IGNORE="data-growing-ignore",qe.GROWING_TRACK="data-growing-track",qe.GROWING_CONTAINER="data-growing-container",qe.GROWING_INDEX="data-growing-index",qe.GROWING_INDEX_OLD="data-growing-idx",qe.GROWING_CDP_INDEX="data-index",qe.GROWING_GTITLE="data-growing-title",qe.GROWING_TITLE="data-title",qe.GROWING_TITLE_OLD="growing-title";var Ve={},Me={};Object.defineProperty(Me,"__esModule",{value:!0}),Me.lastFindIndex=Me.findIndex=Me.arrayEquals=Me.rmBlank=Me.normalizePath=Me.splitNoEmpty=Me.filterText=void 0,Me.filterText=function(e,t){if(void 0===t&&(t=!0),e&&(null==(e=e.replace(/[\n \t]+/g," ").trim())?void 0:e.length))return e.slice(0,t?50:void 0)},Me.splitNoEmpty=function(e,t){return e?e.split(t).filter((function(e){return!!e})):[]},Me.normalizePath=function(e){var t=e.length;return t>1&&"/"===e.charAt(t-1)?e.slice(0,t-1):e},Me.rmBlank=function(e){return e?e.replace(/[\n \t]+/g,""):""},Me.arrayEquals=function(e,t){if(!e||!t)return!1;if(e.length!==t.length)return!1;for(var i=0,n=e.length;n>i;i++)if(e[i]!==t[i])return!1;return!0},Me.findIndex=function(e,t){if(null==e||"function"!=typeof t)return-1;for(var i=0;i=0;i--){var n=e[i];if(t.call(void 0,n))return i}return-1},function(e){var t=f&&f.__spreadArray||function(e,t,i){if(i||2===arguments.length)for(var n,r=0,s=t.length;s>r;r++)!n&&r in t||(n||(n=[].slice.call(t,0,r)),n[r]=t[r]);return e.concat(n||[].slice.call(t))},i=f&&f.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.removeDiffTagOnHeadAndTail=e.computeXpath=e.getMarkIndex=e.getEffectiveNode=e.isIgnore=e.depthInside=e.changeableInput=e.clickableInput=e.onlyContainsTextChildren=e.onlyContainsIconChildren=e.supportIconTag=e.isContainerTag=e.isListTag=e.isParentOfLeaf=e.isLeaf=e.getChildren=e.getDeepChildren=e.findParent=e.isRootNode=e.hasValidAttribute=void 0;var n=Me,r=We,s=i(m);e.hasValidAttribute=function(e,t){return e instanceof Element&&e.hasAttribute(t)&&"false"!==e.getAttribute(t)},e.isRootNode=function(e){return!e||-1!==["BODY","HTML","#document"].indexOf(e.nodeName)},e.findParent=function(t,i){for(var n=t.parentNode;n&&!(0,e.isRootNode)(n);){if(i(n))return n;n=n.parentNode}},e.getDeepChildren=function(i){return(0,s.default)((null==i?void 0:i.childNodes)||[]).reduce((function(i,n){return n instanceof Element?t(t(t([],i,!0),[n],!1),(0,e.getDeepChildren)(n),!0):i}),[])},e.getChildren=function(e){return(0,s.default)((null==e?void 0:e.childNodes)||[]).filter((function(e){return e instanceof Element}))},e.isLeaf=function(t){return!t.hasChildNodes()||"svg"===t.nodeName||0===(0,e.getChildren)(t).length},e.isParentOfLeaf=function(t){return!(!t.hasChildNodes()||"svg"===t.nodeName)&&0===(0,s.default)(t.childNodes).filter((function(t){return!(0,e.isLeaf)(t)})).length},e.isListTag=function(e){return-1!==r.LIST_TAGS.indexOf(e.nodeName)},e.isContainerTag=function(t){return(0,e.hasValidAttribute)(t,r.GROWING_CONTAINER)||-1!==r.SUPPORTED_CONTAINER_TAGS.indexOf(t.nodeName)},e.supportIconTag=function(e){var t=e.nodeName;return-1!==r.SUPPORTED_ICON_TAGS.indexOf(t)},e.onlyContainsIconChildren=function(t){if(t.textContent)return!1;var i=(0,e.getChildren)(t);if(0===i.length)return!1;for(var n=0,r=i;ni)return!1;for(var r="svg"===t.tagName?[]:(0,e.getChildren)(t),s=0;s=n},e.isIgnore=function(t){if(!(t instanceof Element)||(0,e.hasValidAttribute)(t,r.GROWING_IGNORE))return!0;for(var i=t.parentNode;i&&!(0,e.isRootNode)(i);){if((0,e.hasValidAttribute)(i,r.GROWING_IGNORE))return!0;i=i.parentNode}return!1},e.getEffectiveNode=function(t){for(var i,n;t&&(n=void 0,!((i=t)instanceof Element&&-1===r.UNSUPPORTED_TAGS.indexOf(null===(n=i.tagName)||void 0===n?void 0:n.toLowerCase())))&&t.parentNode;)t=t.parentNode;var s,o=t.parentNode;return!(0,e.isRootNode)(o)&&((0,e.onlyContainsIconChildren)(o)||"BUTTON"===(s=o).tagName&&(0,e.onlyContainsTextChildren)(s))?o:t},e.getMarkIndex=function(e){if(e instanceof Element){var t=e.getAttribute(r.GROWING_INDEX)||e.getAttribute(r.GROWING_INDEX_OLD)||e.getAttribute(r.GROWING_CDP_INDEX);if(t){if(/^\d{1,10}$/.test(t)&&+t>=0&&2147483647>+t)return+t;window.console.error("[GioNode]:标记的index不符合规范(index必须是大于等于0且小于2147483647的整数字)。",t)}}},e.computeXpath=function(e){for(var t=e.parentPaths(!0),i=Math.min(t.length,+(t.length>=10)+4),n=["","",""],r=0;rr&&(n[1]=s+n[1])}return n},e.removeDiffTagOnHeadAndTail=function(e,t){var i=function(e){return e.nodeName===t.nodeName},r=(0,n.findIndex)(e,i),s=(0,n.lastFindIndex)(e,i);return-1===r||-1===s?[]:e.slice(r,s+1)}}(Ve);var Fe={},$e={};Object.defineProperty($e,"__esModule",{value:!0});var ze=We,Xe=Me,Je=Ve;function Ze(e){var t;if(e instanceof Element){var i=e.getAttribute("name");if(i)return[i];if(e.hasAttribute("class")){var n=null===(t=e.getAttribute("class"))||void 0===t?void 0:t.replace(ze.EXCLUDE_CLASS_RE,"").trim();if(null==n?void 0:n.length)return n.split(/\s+/).filter((function(e){return ze.VALID_CLASS_SELECTOR.test(e)&&!e.match(/[a-z][A-Z][a-z][A-Z]/)&&!e.match(/[0-9][0-9][0-9][0-9]/)})).sort()}}return[]}var Ye=function(){function e(e){var t;this.node=e,this.tagName=this.node.nodeName,this.name=this.tagName.toLowerCase(),this.id=(t=this.node).id&&ze.VALID_ID_SELECTOR.test(t.id)?t.id:null,this.classList=Ze(this.node),this.guessListAndIndex()}return e.prototype.guessListAndIndex=function(){var e,t=this;this._tagList=(0,Je.isListTag)(this.node);var i=(0,Je.removeDiffTagOnHeadAndTail)((0,Je.getChildren)(this.node.parentNode),this.node);if(this._tagList&&-1!==(s=i.filter((function(e){return e.tagName===t.tagName})).indexOf(this.node))&&(this._index=s+1),i.length>=3&&(null===(e=this.classList)||void 0===e?void 0:e.length)){for(var n=0,r=0,s=1;s<=i.length;s++){var o=i[s-1];if(o.tagName!==this.tagName){r=0;break}(0,Xe.arrayEquals)(this.classList,Ze(o))&&(r+=1),this.node===o&&(n=s)}3>r||(this._pseudoList=!0,this._index=this._index||n)}},Object.defineProperty(e.prototype,"path",{get:function(){var e;return this._path||(this._path="/".concat(this.name),this.id&&(this._path+="#".concat(this.id)),(null===(e=this.classList)||void 0===e?void 0:e.length)&&(this._path+=".".concat(this.classList.join(".")))),this._path},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pseudoList",{get:function(){return!!this._pseudoList},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"list",{get:function(){return!!this._tagList||!!this._pseudoList},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"index",{get:function(){var e;return null!==(e=(0,Je.getMarkIndex)(this.node))&&void 0!==e?e:this._index},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"container",{get:function(){return(0,Je.isContainerTag)(this.node)||this.list},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"parent",{get:function(){return this.node.parentNode?new e(this.node.parentNode):null},enumerable:!1,configurable:!0}),e.prototype.parentPaths=function(e){void 0===e&&(e=!1);for(var t=e?[this]:[],i=this.parent;i&&!(0,Je.isRootNode)(i.node);)t.push(i),i=i.parent;return t},e}();$e.default=Ye;var Qe={};Object.defineProperty(Qe,"__esModule",{value:!0}),Qe.getElementHref=Qe.getImgHref=Qe.getAnchorHref=void 0;var et=Me;function tt(e){if(e.hasAttribute("href")){var t=e.getAttribute("href");if(t&&0!==t.indexOf("javascript"))return(0,et.normalizePath)(t.slice(0,320))}}function it(e){if(e.src&&-1===e.src.indexOf("data:image"))return e.src}Qe.getAnchorHref=tt,Qe.getImgHref=it,Qe.getElementHref=function(e){var t=e;if(t)switch(e.nodeName.toLowerCase()){case"a":return tt(t);case"img":return it(t)}};var nt={},rt=f&&f.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(nt,"__esModule",{value:!0}),nt.getElementContent=nt.getFormContent=void 0;var st=Ve,ot=Qe,at=We,dt=rt($e),ct=Me,lt=rt(m),ht=function(e){return e.htmlFor||e.getAttribute("for")},ut=function(e){var t=e.getAttribute(at.GROWING_GTITLE)||e.getAttribute(at.GROWING_TITLE)||e.getAttribute(at.GROWING_TITLE_OLD)||e.getAttribute("title");return null==t?void 0:t.trim()};function gt(e){var t=e.node;return e.list?pt(t):(0,ct.filterText)(t.textContent)||void 0}function pt(e){for(var t=void 0,i=!1,n=0,r=(0,lt.default)(e.childNodes);n-1?i.slice(0,n):i}}(t);case"svg":return function(e){for(var t=0,i=(0,lt.default)(e.childNodes);t0)return i[i.length-1]}}(t);case"label":return gt(o);case"input":return function(e){if((0,st.clickableInput)(e))return e.value;if("password"!==e.type&&(0,st.hasValidAttribute)(e,at.GROWING_TRACK))return e.value;if((0,st.changeableInput)(e)){var t=(0,st.findParent)(e,(function(e){return"LABEL"===e.nodeName}));if(!t&&e.id)for(var i=document.body.getElementsByTagName("label"),n=0;n0)return s+" ("+e.checked+")"}return e.value}}(t);case"select":return n=t,(0,lt.default)(n.options).filter((function(e){return e.selected})).map((function(e){return e.label})).join(", ")||n.value;case"form":return ft(t)}return(0,st.isLeaf)(t)?function(e){var t=(0,ct.filterText)(e.textContent);if(t)return t}(t):(0,st.isParentOfLeaf)(t)&&!(0,st.onlyContainsIconChildren)(t)?function(e){for(var t="",i=0,n=(0,lt.default)(e.childNodes);ii;i++)for(var r in t=arguments[i])({}).hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},_t.apply(this,arguments)},St=f&&f.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ke,"__esModule",{value:!0});var Nt=We,Ct=Ve,xt=St(Fe),At=function(){function e(e,t,i){void 0===t&&(t=null),void 0===i&&(i=!0),this.origin=e,this.action=t,this.direct=i,this.target="self"===t?e:(0,Ct.getEffectiveNode)(e),this.ignore=(0,Ct.isIgnore)(this.target),this.vnode=new xt.default(this.target),this.tagName=this.vnode.tagName}return Object.defineProperty(e.prototype,"content",{get:function(){return this.vnode.content},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"href",{get:function(){return this.vnode.href},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"index",{get:function(){return this.vnode.index},enumerable:!1,configurable:!0}),e.prototype.inferParentIndex=function(){var t=this;return this.parentIndex||(0,Ct.findParent)(this.target,(function(i){var n=new e(i,t.action,!1);n.traceable()&&n.index&&(t.parentIndex=n.index)})),this.parentIndex},Object.defineProperty(e.prototype,"xpath",{get:function(){return this.vnode.xpath},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fullXpath",{get:function(){return this.vnode.fullXpath},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"skeleton",{get:function(){return this.vnode.skeleton},enumerable:!1,configurable:!0}),e.prototype.info=function(e){return void 0===e&&(e=!0),e&&this.inferParentIndex(),{skeleton:this.skeleton,fullXpath:this.fullXpath,xpath:this.xpath,content:this.content,href:this.href,index:this.parentIndex||this.index}},e.prototype.traceable=function(){if(this.ignore)return!1;if(this.direct){if("click"===this.action||"hover"===this.action){if(-1!==Nt.UNSUPPORTED_CLICK_TAGS.indexOf(this.target.tagName))return!1;if("INPUT"===this.target.tagName&&!(0,Ct.clickableInput)(this.target))return!1;if(!(0,Ct.isContainerTag)(this.target)&&!(0,Ct.depthInside)(this.target,5))return!1}return!0}return this.vnode.container},e.prototype.trackNodes=function(){if(!this.traceable())return[];var e=[this];if("submit"!==this.action)for(var t=this.parentElement;t;){if(t.ignore)return[];t.traceable()&&e.unshift(t),t=t.parentElement}var i=void 0;return e.map((function(e){var t=e.info(!1),n=t.index;return!i&&n&&(i=n),_t(_t({},t),{index:i||n})}))},Object.defineProperty(e.prototype,"parentElement",{get:function(){var t=this.target.parentNode;if(t&&t.nodeName&&!(0,Ct.isRootNode)(t))return new e(t,this.action,!1)},enumerable:!1,configurable:!0}),e}(),Pt=Ke.default=At;class Dt{constructor(e){this.handler=e;const t=navigator.userAgent,i=/chrome/i.exec(t),n=/android/i.exec(t);this.hasTouch="ontouchstart"in window&&!(i&&!n)}main(){const e=this.hasTouch?["touchstart"]:["mousedown"],t=this.hasTouch?["touchend","touchcancel"]:["mouseup","mouseleave"],i=this.hasTouch?["touchmove"]:["mousemove"];for(const t of e)Y(window,t,this.touchStartHandler.bind(this));for(const e of i)Y(window,e,this.touchMoveHandler.bind(this));for(const e of t)Y(window,e,this.touchStopHandler.bind(this))}touchStartHandler(e){if(e.which>1)return;const t=+Date.now();this.safeguard!==t&&(this.touchTimeout&&clearTimeout(this.touchTimeout),this.safeguard=t,this.touchEvent={time:t,target:e.target,x:this._page("x",e),y:this._page("y",e),isTrusted:!0,type:"click"})}touchMoveHandler(e){const t=Math.abs(this._page("x",e)-(this.touchEvent&&this.touchEvent.x)||0),i=Math.abs(this._page("y",e)-(this.touchEvent&&this.touchEvent.y)||0);(t>10||i>10)&&(this.touchEvent=null)}touchStopHandler(e){const t=+Date.now()-(this.touchEvent&&this.touchEvent.time)||0;this.touchEvent&&200>t?this.touchTimeout=setTimeout((()=>{this.handler(this.touchEvent),this.touchEvent=null}),200):this.touchEvent&&t>=200&&700>t&&(this.handler(this.touchEvent),this.touchEvent=null)}_page(e,t){return(this.hasTouch?t.touches[0]:t)["page"+e.toUpperCase()]}}var Lt={name:"gioEventAutoTracking",method:class{constructor(e){this.growingIO=e,this.main=()=>{Y(document,"submit",this._handleAction),Y(document,"change",this._handleAction);const{vdsConfig:e}=this.growingIO;e.touch?new Dt(this._handleAction).main():Y(document,"click",this._handleAction)},this._handleAction=(e,t)=>{const{vdsConfig:i,emitter:n}=this.growingIO;if(!i.autotrack)return!1;const r=e.target;if(!r)return!1;let s=new Pt(r,e.type,!0).trackNodes();if("click"!==e.type&&(s=F(C(s))?[]:[C(s)]),F(s))return!1;null==n||n.emit("onComposeBefore",{event:t,params:null!=e?e:{}}),s.forEach((t=>{const{fullXpath:n,index:r,content:s,href:o}=t;if(!G(t.fullXpath||"","/div#__vconsole")&&!G(t.fullXpath||"","/div#__giokit")&&(i.debug&&console.log("Action:",e.type,Date.now()),n)){const{dataStore:{eventContextBuilder:t,eventConverter:i,currentPage:a}}=this.growingIO;i(Object.assign(Object.assign({eventType:c[e.type],element:[{xpath:n,index:r,textValue:s,hyperlink:o}]},t()),{pageShowTimestamp:a.time}))}}))}}}};let Rt;const kt=["VIEW_CLICK","VIEW_CHANGE","FORM_SUBMIT","PAGE","CUSTOM","LOGIN_USER_ATTRIBUTES"],Ut=["LOGIN_USER_ATTRIBUTES"];var jt={name:"gioHybridAdapter",method:class{constructor(e){this.growingIO=e,this.penetrateHybrid=!0,this.onOptionsInit=()=>{const{vdsConfig:e,emitter:t}=this.growingIO;b(e.penetrateHybrid)&&(this.penetrateHybrid=e.penetrateHybrid),this._initHybridBridge()&&(this.onSendBefore=this.sendBeforeListener,this.hybridConfig.projectId===this.growingIO.vdsConfig.projectId&&(this.growingIO.useHybridInherit=!0)),this.growingIO.useHybridInherit&&(null==t||t.on(Ne,(({newUserId:e,oldUserId:t,userKey:i})=>{this.penetrateHybrid&&(!e&&t?i?this._clearNativeUserIdAndUserKey():this._clearNativeUserId():i?this._setNativeUserIdAndUserKey(k(e),k(i)):this._setNativeUserId(k(e)))})),null==t||t.on(Ce,(({newUserKey:e,oldUserKey:t,userId:i})=>{this.penetrateHybrid&&(!e&&t?this._clearNativeUserIdAndUserKey():this._setNativeUserIdAndUserKey(k(i),k(e)))})))},this._initHybridBridge=()=>{var e,t,i;let n=!1;return this.hasHybridBridge=!!window.GrowingWebViewJavascriptBridge,this.hasHybridBridge?((null===(e=null===window||void 0===window?void 0:window.GrowingWebViewJavascriptBridge)||void 0===e?void 0:e.configuration)||(window.GrowingWebViewJavascriptBridge.configuration=JSON.parse(window.GrowingWebViewJavascriptBridge.getConfiguration())),(null===(t=null===window||void 0===window?void 0:window.GrowingWebViewJavascriptBridge)||void 0===t?void 0:t.configuration)&&(this.hybridConfig=null===(i=null===window||void 0===window?void 0:window.GrowingWebViewJavascriptBridge)||void 0===i?void 0:i.configuration),n=!0):Rt.consoleText("gioHybridAdapter:当前不存在 GrowingWebViewJavascriptBridge,Web模式。","info"),n},this.sendBeforeListener=({requestData:e})=>{if(this.hasHybridBridge){const t=this.processAttributes(Object.assign({},e));M(t,"trackingId"),L(kt,t.eventType)&&(L(Ut,t.eventType)?this.penetrateHybrid&&this._dispatchEvent(t):(this.penetrateHybrid||M(t,["userId","userKey","cs1"]),this._dispatchEvent(t)))}},this.processAttributes=e=>(W(e,((t,i)=>{y(t)||_(t)?W(e[i],((t,n)=>{y(t)||_(t)?e[i][n]=JSON.stringify(t):e[i][n]=k(t)})):e[i]=k(t)})),e),this._setNativeUserId=e=>{J((()=>window.GrowingWebViewJavascriptBridge.setNativeUserId(e)))},this._clearNativeUserId=()=>{J((()=>window.GrowingWebViewJavascriptBridge.clearNativeUserId()))},this._setNativeUserIdAndUserKey=(e,t)=>{J((()=>window.GrowingWebViewJavascriptBridge.setNativeUserIdAndUserKey(e,t)))},this._clearNativeUserIdAndUserKey=()=>{J((()=>window.GrowingWebViewJavascriptBridge.clearNativeUserIdAndUserKey()))},this._dispatchEvent=e=>{J((()=>{var t;return null===(t=window.GrowingWebViewJavascriptBridge)||void 0===t?void 0:t.dispatchEvent(JSON.stringify(e))}))};const{emitter:t,utils:i}=this.growingIO;Rt=i,t.on(Ee,this.onOptionsInit)}}};const Gt=["i","span","em","b","strong","svg"];var qt;!function(e){e[e.OUTER=0]="OUTER",e[e.INNER_COVERED=1]="INNER_COVERED",e[e.INNER_SHOW=2]="INNER_SHOW"}(qt||(qt={}));const Ht=["HR","BR","SCRIPT","NOSCRIPT","STYLE","HEAD","BASE","LINK","META","TITLE","BODY","HTML","TEMPLATE","CODE",...We.UNSUPPORTED_CLICK_TAGS],Bt=["SELECT","A","BUTTON","INPUT","IMG","FORM"],Kt=(e,t,i)=>document.elementFromPoint(t,i)===e;class Wt{constructor(e,t,i){this.node=e,this.parentNodeDesc=t,this.devicesInfo=i,this.proxy=new Pt(e),this.tagName=this.node.tagName,this.name=this.tagName.toLowerCase(),this.isIgnore=!!this.node.dataset.growingIgnore,this.isUnSupported=-1!==Ht.indexOf(this.tagName),this.rect=this.computeWindowRect()}info(){const e=this.desc();e.zLevel+=this.devicesInfo.webviewZLevel;const t=this.getDeviceRect(this.rect);return M(e,"isContainer"),Object.assign(Object.assign(Object.assign({},e),t),{parentXPath:this.parentNodeDesc.isContainer?this.parentNodeDesc.xpath:void 0,href:this.proxy.href,content:this.proxy.content,nodeType:this.nodeType()})}nodeType(){return"input"!==this.name||Ve.changeableInput(this.node)?this.node.tagName:"INPUT_BTN"}desc(){return{index:this.parentNodeDesc.index||this.proxy.index,zLevel:this.zLevel(),xpath:this.proxy.fullXpath,isContainer:this.isDefinedContainer()}}cssVisible(){const e=this.computedStyle();return Number(e.opacity)>0&&"visible"===e.visibility&&"none"!==e.display}viewportStatus(){const{top:e,left:t,width:i,height:n}=this.rect,{winWidth:r,winHeight:s}=this.devicesInfo;if(0>=i||0>=n)return qt.OUTER;const o=this.node;return s>e&&r>t&&i>0&&n>0?Kt(o,t+i/2,e+n/2)||Kt(o,t+1,e+1)||Kt(o,t+i-1,e+1)||Kt(o,t+1,e+n-1)||Kt(o,t+i-1,e+n-1)?qt.INNER_SHOW:qt.INNER_COVERED:qt.OUTER}isCircleable(){return this.proxy.target===this.proxy.origin&&(!!this.isDefinedContainer()||!("input"===this.name&&this.node instanceof HTMLInputElement&&"password"===this.node.type)&&(-1!==Bt.indexOf(this.name)||(Ve.isLeaf(this.node)?!this.isBigBlank():this.hasBackgroundImage()&&Ve.depthInside(this.node,4))))}isSimpleContainer(){return"select"===this.name||this.isDefaultContainer()&&(function(e,t){if(0===e.children.length)return!1;for(const i of R(e.children))if(-1===t.indexOf(i.tagName.toLowerCase()))return!1;return!0}(this.node,Gt)||!this.node.childElementCount)}isDefinedContainer(){var e;return v(this.isContainer)?this.isDefaultContainer()||this.isMarkContainer()||Ve.isParentOfLeaf(this.node)&&(!!(null===(e=this.node.innerText)||void 0===e?void 0:e.trim().length)||function(e){const t=e.attributes;if(t.length>0)for(let e=0;es>>1||r>o>>1)}hasBackgroundImage(){const e=this.computedStyle().backgroundImage;return!!e&&"none"!==e&&e.length>0}zLevel(){const e=this.computedStyle(),t=e.zIndex;if("auto"!==t)return Number(t||"0")+this.parentNodeDesc.zLevel;switch(e.position){case"relative":return this.parentNodeDesc.zLevel+2;case"sticky":return this.parentNodeDesc.zLevel+3;case"absolute":return this.parentNodeDesc.zLevel+4;case"fixed":return this.parentNodeDesc.zLevel+5;default:return this.parentNodeDesc.zLevel+1}}computeWindowRect(){if(this.rect)return this.rect;const e=this.node.getBoundingClientRect(),t=e.top,i=e.bottom,n=e.left;let r=e.right-n,s=i-t;return 0>t?s=t+s:t+s>this.devicesInfo.winHeight&&(s=this.devicesInfo.winHeight-t),0>n?r=n+r:n+r>this.devicesInfo.winWidth&&(r=this.devicesInfo.winWidth-n),this.rect={top:t,left:n,width:r,height:s},this.rect}computedStyle(){return window.getComputedStyle(this.node)}getDeviceRect(e){const{scale:t,webviewTop:i,webviewLeft:n}=this.devicesInfo;return{top:e.top*t+i,left:e.left*t+n,width:e.width*t,height:e.height*t}}}const Vt=["DOMContentLoaded","onreadystatechange"],Mt=["scroll","resize","load","beforeunload","popstate","hashchange","pagehide","unload"];class Ft{constructor(e){this.growingIO=e,this.addDomChangeListener()}getDomTree(e,t,i,n,r,s){const o=function(e,t,i,n,r){const s=document.documentElement.clientWidth;return{winWidth:s,winHeight:document.documentElement.clientHeight,scale:i/s,webviewTop:t,webviewLeft:e,webviewWidth:i,webviewHeight:n,webviewZLevel:r}}(e,t,i,n,r),a=this.getElementsByParent(s||document.body,{isContainer:!1,zLevel:0},o),{domain:d,path:c,query:l,title:h}=this.growingIO.dataStore.currentPage;return{page:{domain:d,path:c,query:l,title:h},elements:a}}getElementsByParent(e,t,i){const n=[];return[].slice.call(e.childNodes,0).filter((e=>1===e.nodeType)).forEach((e=>{const r=new Wt(e,t,i);if(r.cssVisible()&&!r.isIgnore){switch(r.viewportStatus()){case qt.INNER_SHOW:r.isCircleable()&&n.push(r.info());break;case qt.INNER_COVERED:r.isDefaultContainer()&&n.push(r.info())}r.isSimpleContainer()||[].push.apply(n,this.getElementsByParent(e,r.desc(),i))}})),n}addDomChangeListener(){let e;const t=(t="")=>()=>{var i;"beforeunload"===t&&e&&e.disconnect(),null===(i=window.GrowingWebViewJavascriptBridge)||void 0===i||i.onDomChanged()};e=new MutationObserver(t("mutation")),e.observe(document.body,{attributes:!0,characterData:!0,childList:!0,subtree:!0}),Vt.forEach((e=>{Y(document,e,t(e))})),Mt.forEach((e=>{Y(window,e,t(e))}))}}class $t{constructor(e){var t;this.growingIO=e,null===(t=this.growingIO.emitter)||void 0===t||t.on(_e,(()=>{if(window.GrowingWebViewJavascriptBridge){const e=this;window.GrowingWebViewJavascriptBridge.getDomTree=function(){if(arguments.length>=4)return $t.bindGetDomTree(e.growingIO),$t.domHelper.getDomTree.apply($t.domHelper,arguments)}}}))}static bindGetDomTree(e){this.domHelper||(this.domHelper=new Ft(e),window.GrowingWebViewJavascriptBridge.getDomTree=this.domHelper.getDomTree.bind(this.domHelper))}}var zt={name:"gioHybridCircle",method:$t},Xt={name:"gioImpressionTracking",method:class{constructor(e){var t;this.growingIO=e,this.documentReady=!1,this.main=e=>{"listener"===e?(this.documentReady=!0,this.growingIO.gioSDKInitialized&&this.initMutationObserver()):"emitter"===e&&this.documentReady&&this.initMutationObserver()},this.initIntersectionObserver=()=>{this.intersectionObserver=new IntersectionObserver((e=>{F(e)||e.map((e=>{const{dataset:t,id:i}=e.target;if(e.intersectionRatio>0){const{eventId:e,properties:n,items:r}=this.getImpressionProperties(t);if(i){if("once"===t.gioImpType&&B(this.sentImps,i))return;this.sentImps[i]={eventId:e,properties:n,items:r}}e&&this.growingIO.track(e,n,r)}}))}))},this.initMutationObserver=()=>{var e;this.mutationObserver&&(null===(e=this.mutationObserver)||void 0===e||e.disconnect());const t=document.querySelectorAll("[data-gio-imp-track]");R(t).map((e=>{var t;null===(t=this.intersectionObserver)||void 0===t||t.observe(e)})),this.mutationObserver=new MutationObserver((e=>{e.map((e=>{var t,i;"attributes"===e.type&&(null===(t=e.target.dataset)||void 0===t?void 0:t.gioImpTrack)&&(null===(i=this.intersectionObserver)||void 0===i||i.observe(e.target))}))})),this.mutationObserver.observe(document.body,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0,attributeFilter:["data-gio-imp-track","data-gio-imp-attrs","data-gio-imp-items",/^data-gio-track-[a-z]+$/i]})},this.getImpressionProperties=e=>{let t={eventId:void 0,properties:{}};if(!(null==e?void 0:e.gioImpTrack))return t;if(t.eventId=e.gioImpTrack,B(e,"gioImpAttrs"))t.properties=J((()=>y(e.gioImpAttrs)?e.gioImpAttrs:JSON.parse(e.gioImpAttrs))),t.items=J((()=>y(e.gioImpItems)?e.gioImpItems:JSON.parse(e.gioImpItems)));else{const i=/^gioTrack(.+)/;for(const n in e){let r;const s=n.match(i);s&&(r=j(s[1]),"track"!==r&&(t.properties[r]=e[n]))}}return t.properties=Z(t.properties),t.items=Z(t.items),/^\w+$/.test(t.eventId)&&!Number.isInteger(Number(N(t.eventId.split(""))))||(t.eventId=null,t={}),t},this.sentImps={},window.IntersectionObserver&&window.MutationObserver?(this.initIntersectionObserver(),Y(document,"readystatechange",(()=>{L(["interactive","complete"],document.readyState)&&this.main("listener")}),{once:!0}),null===(t=this.growingIO.emitter)||void 0===t||t.on(_e,(()=>this.main("emitter"))),Y(window,"unload",(()=>{var e,t;null===(e=this.intersectionObserver)||void 0===e||e.disconnect(),null===(t=this.mutationObserver)||void 0===t||t.disconnect()}))):X("当前浏览器不支持半自动埋点,gioImpressionTracking已自动关闭!","warn")}}},Jt={name:"gioWebCircle",method:class{constructor(e){var t;this.growingIO=e,this.injectCircle=(e,t)=>{const i=document.createElement("link"),n=document.createElement("script");i.rel="stylesheet",i.href=e,n.src=t,document.head.appendChild(i),document.head.appendChild(n)},null===(t=this.growingIO.emitter)||void 0===t||t.on(_e,(()=>{window.addEventListener("message",(e=>{const{data:t,source:i}=e,n=window.vds;if(t&&i){const e=i.vds,r=t.cssURL,s=t.jsURL;e&&"SDK_INJECT_CIRCLE_SCRIPT"===t.type&&n.projectId===e.projectId&&n.dataSourceId===e.dataSourceId&&this.injectCircle(r,s)}}))}))}}};const Zt=["gioPerformance"];class Yt{constructor(e){var t,i,n,r;this.growingIO=e,this.innerPluginInit=()=>{var e;Zt.forEach((e=>{var t;return M(null===(t=this.pluginsContext)||void 0===t?void 0:t.plugins,e)})),K(null===(e=this.pluginsContext)||void 0===e?void 0:e.plugins).forEach((e=>{var t;const{name:i,method:n}=null===(t=this.pluginsContext)||void 0===t?void 0:t.plugins[e];P(this.pluginItems,(e=>e.name===i))||this.pluginItems.push({name:j(i||e),method:n||(e=>{})})})),F(this.pluginItems)||this.installAll()},this.install=(e,t,i)=>{var n,r;const s=t||P(this.pluginItems,(t=>t.name===e));if((null===(n=this.growingIO)||void 0===n?void 0:n.plugins)[e])return X(`重复加载插件 ${e} 或插件重名,已跳过加载!`,"warn"),!1;if(!s)return X(`插件加载失败!不存在名为 ${e} 的插件!`,"error"),!1;try{return(null===(r=this.growingIO)||void 0===r?void 0:r.plugins)[e]=new s.method(this.growingIO,i),"cdp"===this.growingIO.gioEnvironment&&t&&X("加载插件 "+e,"info"),!0}catch(e){return X("插件加载异常 "+e,"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:j(t.name),method:t.method?t.method:()=>{}})}))},this.uninstall=e=>{var t;M(this.pluginItems,e);const i=M(null===(t=this.growingIO)||void 0===t?void 0:t.plugins,e);return i||X(`卸载插件 ${e} 失败!`,"error"),i},this.uninstallAll=()=>{this.pluginItems.forEach((e=>this.uninstall(e.name)))},this.lifeError=(e,t)=>X(`插件执行错误 ${e.name} ${t}`,"error"),this.onComposeBefore=e=>{this.pluginItems.forEach((t=>{var i;const n=null===(i=this.growingIO.plugins[t.name])||void 0===i?void 0:i.onComposeBefore;if(n&&E(n))try{n(e)}catch(e){this.lifeError(t,e)}}))},this.onComposeAfter=e=>{this.pluginItems.forEach((t=>{var i;const n=null===(i=this.growingIO.plugins[t.name])||void 0===i?void 0:i.onComposeAfter;if(n&&E(n))try{n(e)}catch(e){this.lifeError(t,e)}}))},this.onSendBefore=e=>{this.pluginItems.forEach((t=>{var i;const n=null===(i=this.growingIO.plugins[t.name])||void 0===i?void 0:i.onSendBefore;if(n&&E(n))try{n(e)}catch(e){this.lifeError(t,e)}}))},this.onSendAfter=e=>{this.pluginItems.forEach((t=>{var i;const n=null===(i=this.growingIO.plugins[t.name])||void 0===i?void 0:i.onSendAfter;if(n&&E(n))try{n(e)}catch(e){this.lifeError(t,e)}}))},this.pluginsContext={plugins:{}},this.pluginItems=[],null===(t=this.growingIO.emitter)||void 0===t||t.on("onComposeBefore",this.onComposeBefore),null===(i=this.growingIO.emitter)||void 0===i||i.on("onComposeAfter",this.onComposeAfter),null===(n=this.growingIO.emitter)||void 0===n||n.on("onSendBefore",this.onSendBefore),null===(r=this.growingIO.emitter)||void 0===r||r.on("onSendAfter",this.onSendAfter)}}class Qt extends Yt{constructor(e){super(e),this.growingIO=e,this.growingIO.gioSDKFull=!0,this.pluginsContext={plugins:{gioCompress:xe,gioCustomTracking:Ae,gioEmbeddedAdapter:Be,gioEventAutoTracking:Lt,gioHybridAdapter:jt,gioHybridCircle:zt,gioImpressionTracking:Xt,gioWebCircle:Jt}}}}class ei{constructor(){var e;this.trackingId="g0",this.init=e=>{var t,i,n,r,s;X("Gio Web SDK 初始化中...","info");const{initOptions:o,currentPage:a,sendVisit:d,sendPage:c}=this.dataStore;o(e),this.storage=Te(this.vdsConfig),this.initCallback(),null===(t=this.emitter)||void 0===t||t.emit(Ee,this),null===(n=null===(i=this.plugins)||void 0===i?void 0:i.gioEventAutoTracking)||void 0===n||n.main(),a.hookHistory(),a.parsePage(),null===(r=this.emitter)||void 0===r||r.emit(_e,this),X("Gio Web SDK 初始化完成!","success"),this.useEmbeddedInherit||(this.dataStore.lastVisitEvent.timestamp=a.time,d()),c(),this.gioSDKInitialized=!0,this.vdsConfig.gioSDKInitialized=!0,window[this.vds]=this.vdsConfig,null===(s=this.emitter)||void 0===s||s.emit("SDK_INITIALIZED_COMPLATE",this)},this.setOption=(e,t)=>{if(L(s,e)){const i=this.dataStore.setOption(e,t);return i&&o[e]&&X(`已${t?"开启":"关闭"}${o[e]}`,"info"),i}return X(`不存在可修改的配置项:${e},请检查后重试!`,"warn"),!1},this.getOption=e=>this.dataStore.getOption(e),this.setGeneralProps=e=>{y(e)&&!F(e)?(this.dataStore.generalProps=Object.assign(Object.assign({},this.dataStore.generalProps),e),K(this.dataStore.generalProps).forEach((e=>{L([void 0,null],this.dataStore.generalProps[e])&&(this.dataStore.generalProps[e]="")}))):this.callError("setGeneralProps")},this.clearGeneralProps=e=>{_(e)&&!F(e)?e.forEach((e=>{M(this.dataStore.generalProps,e)})):this.dataStore.generalProps={}},this.reissuePage=()=>{this.dataStore.sendPage()},this.notRecommended=()=>X("不推荐的方法使用,建议使用 gio('setOption', [optionName], [value])!","info"),this.callError=(e,t=!0,i="参数不合法")=>X(`${t?"调用":"设置"} ${e} 失败,${i}!`,"warn"),this.updateImpression=()=>{var e,t;const i=null===(t=null===(e=this.plugins)||void 0===e?void 0:e.gioImpressionTracking)||void 0===t?void 0:t.main;i?i("emitter"):X("updateImpression 错误! 请集成半自动埋点浏览插件后重试!","error")},this.gioEnvironment="cdp",this.sdkVersion="3.8.7",this.vds=window.gioCompatibilityVds?"gdp_vds":"vds",this.utils=Object.assign(Object.assign({},z),ee),this.emitter={all:e=e||new Map,on:function(t,i){var n=e.get(t);n?n.push(i):e.set(t,[i])},off:function(t,i){var n=e.get(t);n&&(i?n.splice(n.indexOf(i)>>>0,1):e.set(t,[]))},emit:function(t,i){var n=e.get(t);n&&n.slice().map((function(e){e(i)})),(n=e.get("*"))&&n.slice().map((function(e){e(t,i)}))}},this.useEmbeddedInherit=!1,this.useHybridInherit=!1,this.gioSDKInitialized=!1,this.plugins=new Qt(this),this.plugins.innerPluginInit()}}class ti{constructor(e){this.growingIO=e;const{projectId:t}=this.growingIO.vdsConfig,{getItem:i,setItem:n,getKeys:r,removeItem:s}=this.growingIO.storage;this.getItem=i,this.setItem=n,this.getKeys=r,this.removeItem=s,this.sIdStorageName=t+"_gdp_session_id",this.uidStorageName="gdp_user_id_gioenc",this.userIdStorageName=t+"_gdp_cs1_gioenc",this.userKeyStorageName=t+"_gdp_user_key_gioenc",this.gioIdStorageName=t+"_gdp_gio_id_gioenc"}get sessionId(){return this.getItem(this.sIdStorageName)||(this.sessionId=oe(),this.sessionId)}set sessionId(e){var t;e||(e=oe());const i=this.getItem(this.sIdStorageName)||this.prevSessionId,{sessionExpires:n=30}=this.growingIO.vdsConfig;this.setItem(this.sIdStorageName,e,+Date.now()+60*n*1e3),i!==e&&(this.getKeys().filter((e=>/.+_gdp_session_id_.{36}/.test(e))).forEach((e=>{this.removeItem(e)})),this.setItem(this.growingIO.dataStore.visitStorageName,""),null===(t=this.growingIO.emitter)||void 0===t||t.emit(Se,{newSessionId:e,oldSessionId:i})),this.prevSessionId=e}get uid(){return this.getItem(this.uidStorageName)||(this.uid=oe(),this.uid)}set uid(e){var t;const i=this.getItem(this.uidStorageName)||this.prevUId;this.setItem(this.uidStorageName,e),i!==e&&(null===(t=this.growingIO.emitter)||void 0===t||t.emit("UID_UPDATE",{newUId:e,oldUId:i})),this.prevUId=e}get userId(){return this.getItem(this.userIdStorageName)||""}set userId(e){var t,i;const n=this.getItem(this.userIdStorageName)||this.prevUserId;this.setItem(this.userIdStorageName,e),null===(t=this.growingIO.emitter)||void 0===t||t.emit(Ne,{newUserId:e,oldUserId:n,userKey:this.userKey}),n!==e&&(null===(i=this.growingIO.emitter)||void 0===i||i.emit("USERID_UPDATE",{newUserId:e,oldUserId:n,userKey:this.userKey})),e&&(this.gioId=e),this.prevUserId=e}get userKey(){return this.getItem(this.userKeyStorageName)||""}set userKey(e){var t,i;const n=this.getItem(this.userKeyStorageName)||this.prevUserKey;this.setItem(this.userKeyStorageName,e),null===(t=this.growingIO.emitter)||void 0===t||t.emit(Ce,{newUserKey:e,oldUserKey:n,userId:this.userId}),n!==e&&(null===(i=this.growingIO.emitter)||void 0===i||i.emit("USERKEY_UPDATE",{newUserKey:e,oldUserKey:n,userId:this.userId})),this.prevUserKey=e}get gioId(){return this.getItem(this.gioIdStorageName)||""}set gioId(e){var t;const i=this.getItem(this.gioIdStorageName)||this.prevGioId;this.setItem(this.gioIdStorageName,e),i!==e&&(null===(t=this.growingIO.emitter)||void 0===t||t.emit("GIOID_UPDATE",{newGioId:e,oldGioId:i})),this.prevGioId=e}}class ii{constructor(e){this.growingIO=e,this.main=()=>{var e,t;const{sdkVersion:i,useEmbeddedInherit:n,vdsConfig:r,userStore:s,dataStore:o,trackingId:a}=this.growingIO,{path:d,query:c}=o.currentPage;let l={appVersion:r.version,dataSourceId:r.dataSourceId,deviceId:s.uid,domain:n?r.appId:window.location.host,gioId:s.gioId,language:navigator.language,path:d,platform:r.platform,query:c,referralPage:(null===(e=o.lastPageEvent)||void 0===e?void 0:e.referralPage)||"",screenHeight:window.screen.height,screenWidth:window.screen.width,sdkVersion:i,sessionId:s.sessionId,timestamp:+Date.now(),title:null!==(t=J((()=>document.title.slice(0,255))))&&void 0!==t?t:"",userId:s.userId};if(r.enableIdMapping&&(l.userKey=s.userKey),F(r.ignoreFields)||r.ignoreFields.forEach((e=>{M(l,e)})),n&&!F(this.minpExtraParams)){const e=Object.assign({},l);W(Object.assign(Object.assign({},l),this.minpExtraParams),((t,i)=>{var n;L(r.embeddedIgnore,i)?(l[i]=e[i],"domain"===i&&(l[i]=window.location.host)):l[i]=null!==(n=this.minpExtraParams[i])&&void 0!==n?n:l[i]}))}return l.trackingId=a,l},this.minpExtraParams={}}}class ni{constructor(e){this.growingIO=e,this.parsePage=()=>{const{hashtag:e}=this.growingIO.vdsConfig,t=location.pathname,i=location.search,n=location.hash,r=n.indexOf("?");this.domain=window.location.host,this.title=document.title.slice(0,255),this.time=+Date.now(),this.path=t,this.query=i,e&&(r>-1?(this.path+=n.slice(0,r),this.query=this.query+"&"+n.slice(r+1)):this.path+=n),this.query&&L(["?","&"],this.query.charAt(0))&&(this.query=this.query.slice(1))},this._getNoHashHref=()=>{const{protocol:e,host:t,pathname:i,search:n}=window.location;return`${e}://${t}${i}${n}`},this.getReferralPage=()=>{var e,t;const{dataStore:{lastPageEvent:i}}=this.growingIO;return(null==i?void 0:i.path)===this.path&&(null!==(e=null==i?void 0:i.query)&&void 0!==e?e:"")===(null!==(t=this.query)&&void 0!==t?t:"")?null==i?void 0:i.referralPage:(null==i?void 0:i.path)?this.lastHref:document.referrer},this.pageListener=()=>{const{hashtag:e}=this.growingIO.vdsConfig;let t=window.location.href,i=this.lastHref;e||(t=this._getNoHashHref(),i=this.lastNoHashHref),i!==t&&(this.parsePage(),this.buildPageEvent())},this.hookHistory=()=>{const e=window.history.pushState,t=window.history.replaceState,i=this;e&&J((()=>window.history.pushState=function(){e.apply(window.history,arguments),setTimeout(i.pageListener)})),t&&J((()=>window.history.replaceState=function(){t.apply(window.history,arguments),setTimeout(i.pageListener)})),Y(window,"popstate",this.pageListener);const{hashtag:n}=this.growingIO.vdsConfig;n&&Y(window,"hashchange",this.pageListener)},this.buildPageEvent=e=>{const{dataStore:{lastPageEvent:t,eventContextBuilder:i,eventConverter:n}}=this.growingIO;let r=Object.assign(Object.assign({eventType:"PAGE"},i()),{protocolType:location.protocol.substring(0,location.protocol.length-1),referralPage:this.getReferralPage()});F(e)||(r=Object.assign(Object.assign({},r),e)),r.timestamp=this.time,n(r),this.lastHref=window.location.href,this.lastNoHashHref=this._getNoHashHref(),this.lastLocation=Object.assign({},window.location)},this.title=document.title.slice(0,255),this.lastLocation=Object.assign({},window.location)}}const ri={referralPage:document.referrer};class si{constructor(r){var a,c,l;this.growingIO=r,this.ALLOW_SETTING=Object.assign(Object.assign({},t),"saas"===this.growingIO.gioEnvironment?n:i),this.allowOptKeys=Object.keys(this.ALLOW_SETTING),this.trackTimers={},this.setSequenceIds=(e,t)=>{let i=this.growingIO.storage.getItem(this.seqStorageIdName)||{};"gsid"===e?i.globalKey=t:i=Object.assign(Object.assign({},i),t),this.growingIO.storage.setItem(this.seqStorageIdName,i)},this.initOptions=t=>{var i,n,r,s,a,c,l;const{projectId:h,dataSourceId:u,appId:g}=t;this.initialDataSourceId=u;const p={};this.allowOptKeys.forEach((i=>{const n=this.ALLOW_SETTING[i].type;let r=_(n)?!L(n,$(t[i])):$(t[i])!==n;"platform"!==i||L(e,t[i])||(r=!0),r?p[i]=this.ALLOW_SETTING[i].default:"ignoreFields"===i?p.ignoreFields=t.ignoreFields.filter((e=>L(d,e))):(p[i]=t[i],L(["dataCollect","autotrack"],i)&&(p[i]||X("已关闭"+o[i],"info")))})),p.sessionExpires=Math.round(p.sessionExpires),(O(p.sessionExpires)||1>p.sessionExpires||p.sessionExpires>360)&&(p.sessionExpires=30),p.storageType=p.storageType.toLowerCase(),p.sendType=p.sendType.toLowerCase(),L(["beacon","xhr","image"],p.sendType)||(p.sendType="beacon"),!O(Number(p.requestTimeout))&&p.requestTimeout>0||(p.requestTimeout=5e3),this.growingIO.vdsConfig=Object.assign(Object.assign(Object.assign({},null!==(i=window.vds)&&void 0!==i?i:{}),p),{projectId:h,dataSourceId:u,appId:g,performance:{monitor:null===(r=null===(n=p.performance)||void 0===n?void 0:n.monitor)||void 0===r||r,exception:null===(a=null===(s=p.performance)||void 0===s?void 0:s.exception)||void 0===a||a,network:null!==(l=null===(c=p.performance)||void 0===c?void 0:c.network)&&void 0!==l&&l}}),window.vds=this.growingIO.vdsConfig,this.seqStorageIdName=h+"_gdp_sequence_ids",this.visitStorageName=h+"_gdp_session_id_sent"},this.setOption=(e,t)=>{var i;const{vdsConfig:n,callError:r,uploader:o,emitter:a}=this.growingIO,d=I(e)&&L(s,e),c=d&&typeof t===((null===(i=this.ALLOW_SETTING[e])||void 0===i?void 0:i.type)||"string"),l=Object.assign({},n);return d&&c?(n[e]=t,"dataCollect"===e&&l.dataCollect!==t&&(t?(this.sendVisit(!0),this.sendPage()):this.growingIO.clearTrackTimer()),L(["host","scheme"],e)&&(null==o||o.generateHost()),null==a||a.emit("OPTION_CHANGE",{optionName:e,optionValue:t}),window.vds[e]=t,!0):(r("setOption > "+e),!1)},this.getOption=e=>{const{vdsConfig:t,callError:i}=this.growingIO;return e&&B(t,k(e))?t[k(e)]:v(e)?Object.assign({},t):void i("getOption > "+e)},this.sendVisit=e=>{const{userStore:{sessionId:t},storage:i}=this.growingIO,n=i.getItem(this.visitStorageName);!e&&t===n||(this.lastVisitEvent.timestamp=this.currentPage.time-1,this.buildVisitEvent())},this.buildVisitEvent=e=>{const{dataStore:{eventContextBuilder:t,eventConverter:i},emitter:n,storage:r,userStore:s}=this.growingIO,{referralPage:o,title:a,path:d,query:c,timestamp:l}=this.lastVisitEvent;let h=Object.assign(Object.assign({eventType:"VISIT"},t()),{referralPage:o||this.currentPage.getReferralPage(),timestamp:l});d&&(h.title=a,h.path=d,h.query=c),F(e)||(h.session=(null==e?void 0:e.session)||h.session,h.trackingId=null==e?void 0:e.trackingId,h=Object.assign(Object.assign({},h),e));const u=({requestData:e})=>{"VISIT"===e.eventType&&e.trackingId===this.growingIO.trackingId&&(s.sessionId===e.sessionId&&r.setItem(this.visitStorageName,e.sessionId),n.off("onSendAfter",u))};n.on("onSendAfter",u),i(h)},this.sendPage=e=>{e&&this.currentPage.parsePage(),this.currentPage.buildPageEvent()},this.buildErrorEvent=e=>{const{dataStore:{eventContextBuilder:t,eventConverter:i}}=this.growingIO;i(Object.assign({eventType:"CUSTOM",pageShowTimestamp:this.currentPage.time,eventName:"onError",attributes:e},t()))},this.currentPage=new ni(this.growingIO),this.eventContextBuilderInst=new ii(this.growingIO),this.eventContextBuilder=this.eventContextBuilderInst.main,this.generalProps={},this.lastVisitEvent=ri,null===(a=this.growingIO.emitter)||void 0===a||a.on("onComposeAfter",(({composedEvent:e})=>{"VISIT"!==e.eventType&&"vst"!==e.t||e.trackingId!==this.growingIO.trackingId||(this.lastVisitEvent=e)})),this.lastPageEvent={},null===(c=this.growingIO.emitter)||void 0===c||c.on("onComposeAfter",(({composedEvent:e})=>{"PAGE"!==e.eventType&&"page"!==e.t||e.trackingId!==this.growingIO.trackingId||(this.lastPageEvent=e)})),null===(l=this.growingIO.emitter)||void 0===l||l.on(Se,(()=>{if(this.growingIO.gioSDKInitialized){this.currentPage.parsePage();const{title:e,path:t,query:i,time:n,getReferralPage:r}=this.currentPage;this.lastVisitEvent={referralPage:document.referrer||r(),title:e,path:t,query:i,timestamp:n-1},this.sendVisit(!0),this.sendPage(!0)}}))}get esid(){const e=this.growingIO.storage.getItem(this.seqStorageIdName)||{};let t=Object.assign({},e);return M(t,"globalKey"),t=y(t)&&!v(t)?t:{},this._esid={},K(t).forEach((e=>{this._esid[e]=O(Number(t[e]))||t[e]>=1e9||1>t[e]?1:t[e]})),this._esid}set esid(e){const t={};K(e).forEach((i=>{t[i]=O(e[i])||e[i]>=1e9||1>e[i]?1:e[i]})),V(this._esid,t)||(this._esid=t,this.setSequenceIds("esid",this._esid))}get gsid(){const e=this.growingIO.storage.getItem(this.seqStorageIdName)||{},t=Number(e.globalKey);return this._gsid=O(t)||t>=1e9||1>t?1:t,this._gsid}set gsid(e){O(Number(e))||e>=1e9||1>e?this._gsid=1:this._gsid=e,this.setSequenceIds("gsid",this._gsid)}}class oi extends si{constructor(e){super(e),this.growingIO=e,this.eventConverter=e=>{var t;const{vdsConfig:i,dataStore:n,uploader:r}=this.growingIO;if(i.dataCollect){e.trackingId===this.growingIO.trackingId&&(e.globalSequenceId=n.gsid,e.eventSequenceId=n.esid[e.eventType]||1);const i={};W(e,((e,t)=>{var n;if("element"===t){const t=null!==(n=N(e))&&void 0!==n?n:{};W(t,((e,t)=>{F(e)&&0!==e||(i[t]=e)}))}else(F(e)||v(e))&&0!==e||(i[t]=e)})),e.trackingId===this.growingIO.trackingId&&(this.growingIO.dataStore.gsid+=1,this.growingIO.dataStore.esid=Object.assign(Object.assign({},this.growingIO.dataStore.esid),{[i.eventType]:(this.growingIO.dataStore.esid[i.eventType]||1)+1})),null===(t=this.growingIO.emitter)||void 0===t||t.emit("onComposeAfter",{composedEvent:Object.assign({},i)}),e.trackingId===this.growingIO.trackingId&&r.commitRequest(i)}else"VISIT"===e.eventType&&(this.lastVisitEvent=e)}}}class ai{constructor(e){this.growingIO=e,this.getSendType=()=>{const{sendType:e}=this.growingIO.vdsConfig;return"beacon"===e?(()=>{var e;const t=!!(null===(e=null===window||void 0===window?void 0:window.navigator)||void 0===e?void 0:e.sendBeacon),i=window.navigator.userAgent;if(i.match(/(iPad|iPhone|iPod)/g)){const e=(e=>{const t=e.toLowerCase().match(/cpu.*os (.*?) like mac os/i);return!t||2>t.length?0:+t[1].split("_").slice(0,2).join(".")})(i);return t&&e>13}return t})()?"beacon":"xhr":e},this.commitRequest=e=>{const t=Object.assign({},e);this.requestQueue.push(Object.assign(Object.assign({},t),{requestType:this.getSendType()})),this.initiateRequest()},this.initiateRequest=()=>{var e,t;if([...this.requestQueue].length>0&&this.requestingNum(this.retryIds[e.globalSequenceId||e.esid]||0)<=this.retryLimit)),F(this.requestQueue))return;const o=this.requestQueue.shift(),{requestType:a}=o;null==n||n.emit("onSendBefore",{requestData:Object.assign({},o)});const d=Object.assign({},o);if(M(d,["requestType","trackingId"]),i.debug&&console.log("[GrowingIO Debug]:",JSON.stringify(d,null,2).replace(/\"/g,(()=>{const e=window.navigator.userAgent;return/(\d+\.\d)?(?:\.\d)?\s+safari\/?(\d+\.\d+)?/i.test(e)&&!/chrome\/(\d+\.\d+)/i.test(e)})()?"":'"')),this.requestingNum+=1,s)return this.requestSuccessFn(o),!1;let c=Object.assign({},d);switch(i.compress&&(null==r?void 0:r.gioCompress)?"image"===a?(this.compressType="11",c=null===(e=null==r?void 0:r.gioCompress)||void 0===e?void 0:e.compressToEncodedURIComponent(JSON.stringify([c]))):(this.compressType="1",c=null===(t=null==r?void 0:r.gioCompress)||void 0===t?void 0:t.compressToUint8Array(JSON.stringify([c]))):(this.compressType="0",c=JSON.stringify([c])),a){case"beacon":default:this.sendByBeacon(o,c);break;case"xhr":this.sendByXHR(o,c);break;case"image":this.sendByImage(o,c)}}},this.generateURL=()=>`${this.requestURL}?stm=${+Date.now()}&compress=${this.compressType}`,this.sendByBeacon=(e,t)=>{navigator.sendBeacon(this.generateURL(),t)?this.requestSuccessFn(e):this.requestFailFn(e,"beacon")},this.sendByXHR=(e,t)=>{const i=new XMLHttpRequest;if(i)return i.open("POST",this.generateURL(),!0),i.onload=()=>{204===i.status?this.requestSuccessFn(e):this.requestFailFn(e,"xhr")},i.ontimeout=i.onerror=i.onabort=()=>{this.requestFailFn(e,"xhr")},i.setRequestHeader("Content-Type","text/plain;charset=UTF-8"),i.timeout=this.growingIO.vdsConfig.requestTimeout,void i.send(t);if(null===window||void 0===window?void 0:window.XDomainRequest){const i=new window.XDomainRequest;i.open("POST",this.generateURL().replace("https://","http://"),!0),i.onload=()=>{204===i.status?this.requestSuccessFn(e):this.requestFailFn(e,"xhr")},i.onerror=i.ontimeout=()=>{this.requestFailFn(e,"xhr")},i.send(t)}},this.sendByImage=(e,t)=>{const i=`${this.generateURL()}&data=${t}`;let n=document.createElement("img");n.width=1,n.height=1;let r=window.setTimeout((()=>{this.requestingNum-=1,this.clearImage(n),window.clearTimeout(r),r=null,this.initiateRequest()}),this.growingIO.vdsConfig.requestTimeout);n.onload=()=>{this.requestSuccessFn(e),this.clearImage(n),window.clearTimeout(r),r=null},n.onerror=n.onabort=()=>{this.requestSuccessFn(e),this.clearImage(n),window.clearTimeout(r),r=null},n.src=i},this.clearImage=e=>{e.src="",e.onload=()=>{},e.onerror=e.onabort=()=>{},e=null},this.requestSuccessFn=e=>{var t;this.requestingNum-=1;const i=e.globalSequenceId||e.esid||-1;this.retryIds[i]&&(this.retryIds[i]=0),e.trackingId===this.growingIO.trackingId&&this.growingIO.userStore.sessionId===e.sessionId&&(this.growingIO.userStore.sessionId=e.sessionId),null===(t=this.growingIO.emitter)||void 0===t||t.emit("onSendAfter",{requestData:Object.assign({},e)}),this.initiateRequest()},this.requestFailFn=(e,t)=>{this.requestingNum-=1;const i=e.globalSequenceId||e.esid||-1;this.retryIds[i]||(this.retryIds[i]=0),this.retryIds[i]+=1;const n=this.requestQueue.some((t=>t.globalSequenceId===e.globalSequenceId&&t.esid===e.esid));let r=t;if(this.retryIds[i]{this.requestQueue.push(Object.assign(Object.assign({},e),{requestType:r})),this.initiateRequest(),window.clearTimeout(t),t=null}),800)}this.initiateRequest()},this.requestQueue=[],this.requestLimit=10,this.requestTimeout=5e3,this.retryLimit=2,this.retryIds={},this.requestingNum=0,this.requestURL=""}}class di extends ai{constructor(e){super(e),this.growingIO=e,this.generateHost=()=>{let{scheme:e,host:t="",projectId:i}=this.growingIO.vdsConfig;e?q(k(e),"://")||(e+="://"):e=(location.protocol.indexOf("http")>-1?location.protocol.replace(":",""):"https")+"//",G(t,"http")&&(t=t.substring(t.indexOf("://")+(q(k(e),"://")?3:0))),this.requestURL=`${e}${t}/v3/projects/${i}/collect`},this.requestURL="",this.generateHost()}}class ci extends ei{constructor(){super(),this.registerPlugins=e=>{_(e)?(e.forEach(((t,i)=>{var n,r;F(t)||v(t)?X("插件不合法,跳过加载!","warn"):(null===(n=t.js)||void 0===n?void 0:n.default)&&(e[i]=Object.assign(Object.assign({},null===(r=t.js)||void 0===r?void 0:r.default),{options:t.options}))})),e=A(e),this.plugins.installAll(e)):X("插件注册失败,请检查!","error")},this.initCallback=()=>{this.uploader=new di(this),this.userStore=new ti(this)},this.getPlugins=()=>this.plugins.pluginItems,this.setTrackerScheme=e=>{L(["http","https"],e)?(this.dataStore.setOption("scheme",e),this.notRecommended()):this.callError("scheme",!1)},this.setTrackerHost=e=>{ie.test(e)||ne.test(e)?(this.dataStore.setOption("host",e),this.notRecommended()):this.callError("host",!1)},this.setDataCollect=e=>{this.setOption("dataCollect",!!e),this.notRecommended()},this.setAutotrack=e=>{this.setOption("autotrack",!!e),this.notRecommended()},this.enableDebug=e=>{this.setOption("debug",!!e),this.notRecommended()},this.enableHT=e=>{this.setOption("hashtag",!!e),this.notRecommended()},this.getVisitorId=()=>this.userStore.uid,this.getDeviceId=()=>this.userStore.uid,this.setUserAttributes=(e,t)=>{var i,n;!F(e)&&y(e)?null===(n=null===(i=this.plugins)||void 0===i?void 0:i.gioCustomTracking)||void 0===n||n.buildUserAttributesEvent(e,t):this.callError("setUserAttributes")},this.setUserId=(e,t)=>{if(te(k(e).trim())){const i=this.userStore.gioId;this.vdsConfig.enableIdMapping&&(this.userStore.userKey=!v(t)&&k(t).length>0?k(t).slice(0,1e3):""),this.userStore.userId=k(e).slice(0,1e3),i&&i!==this.userStore.userId&&(this.userStore.sessionId="")}else this.clearUserId(),this.callError("setUserId")},this.clearUserId=()=>{this.userStore.userId="",this.userStore.userKey=""},this.track=(e,t,i,n)=>{var r,s;((null===(s=null===(r=this.plugins)||void 0===r?void 0:r.gioCustomTracking)||void 0===s?void 0:s.buildCustomEvent)||function(){})(e,Object.assign(Object.assign({},this.dataStore.generalProps),y(t)&&!F(t)?t:{}),i,n)},this.sendPage=e=>this.dataStore.currentPage.buildPageEvent(e),this.sendVisit=e=>this.dataStore.buildVisitEvent(e),this.trackTimerStart=(e,t)=>{this.vdsConfig.dataCollect&&Q(e,(()=>{const i=oe();E(t)?(this.dataStore.trackTimers[i]={eventName:e,leng:0,start:+Date.now()},t(i)):X("回调方法不合法,返回timerId失败!")}))},this.trackTimerPause=e=>{if(e&&this.dataStore.trackTimers[e]){const t=this.dataStore.trackTimers[e];t.start&&(t.leng=t.leng+(+Date.now()-t.start)),t.start=0}},this.trackTimerResume=e=>{if(e&&this.dataStore.trackTimers[e]){const t=this.dataStore.trackTimers[e];0===t.start&&(t.start=+Date.now())}},this.trackTimerEnd=(e,t)=>{if(this.vdsConfig.dataCollect){const i=864e5;if(e&&this.dataStore.trackTimers[e]){const n=this.dataStore.trackTimers[e];if(0!==n.start){const e=+Date.now()-n.start;n.leng=e>0?n.leng+e:0}this.track(n.eventName,Object.assign(Object.assign({},t),{event_duration:n.leng>i?0:n.leng/1e3})),this.removeTimer(e)}else X("未查找到对应的计时器,请检查!","error")}},this.removeTimer=e=>{e&&this.dataStore.trackTimers[e]&&delete this.dataStore.trackTimers[e]},this.clearTrackTimer=()=>{this.dataStore.trackTimers={}},this.dataStore=new oi(this)}}let li;!function(){var e,t,i,n,s;let o=window.gioCompatibilityVds?"gdp_vds":"vds";if(null===(e=window[o])||void 0===e?void 0:e.gioSDKInstalled)return li=window.gdp,void X("SDK重复加载,请检查是否重复加载SDK或接入其他平台SDK导致冲突!","warn");window[o]=Object.assign(Object.assign({},null!==(t=window[o])&&void 0!==t?t:{}),{gioSDKInstalled:!0});const d=new ci;li=function(){var e;const t=arguments[0];if(I(t)&&L(r,t)&&d[t]){const e=x(R(arguments));if("init"===t){const t=(e=>{var t;return e.vdsConfig||e.gioSDKInitialized||(null===(t=window.vds)||void 0===t?void 0:t.gioSDKInitialized)?(X("SDK重复初始化,请检查是否重复加载SDK或接入其他平台SDK导致冲突!","warn"),!1):!(L(["","localhost","127.0.0.1"],location.hostname)&&!window._gr_ignore_local_rule&&(X("当前SDK不允许在本地环境初始化!","warn"),1))})(d);if(!t)return;const i=(e=>!F(A(e))||(X('SDK初始化失败,请使用 gdp("init", "您的GrowingIO项目 accountId", "您项目的 dataSourceId", options); 进行初始化!',"error"),!1))(e);if(!i)return;const n=(e=>{const t=N(e);let i=C(e);return te(k(t).trim())?(y(i)&&i||(i={}),{projectId:t,userOptions:i}):(X("SDK初始化失败,accountId 参数不合法!","error"),!1)})(e);if(!n)return;const r=(e=>{const t=e[1],i=e[2],n=C(e);return t&&I(t)?{dataSourceId:t,appId:I(i)?i:"",cdpOptions:n}:(X("SDK初始化失败,dataSourceId 参数不合法!","error"),!1)})(e);if(!r)return;const{projectId:s}=n,{dataSourceId:o,appId:a,cdpOptions:c}=r;d.init(Object.assign(Object.assign({},c),{projectId:s,dataSourceId:o,appId:a}))}else if("registerPlugins"===t)d.registerPlugins(e[0]);else{if(d.gioSDKInitialized&&d.vdsConfig)return d[t](...e);d.emitter.emit("UNINITIALIZED_CALL",arguments),X("SDK未初始化!","error")}}else L(a,t)?X(`方法 ${k(t)} 已被弃用,请移除!`,"warn"):X(`不存在名为 ${k(t)} 的方法调用!`,"error");window[o]=Object.assign(Object.assign({},window[o]),{_gr_ignore_local_rule:null!==(e=window._gr_ignore_local_rule)&&void 0!==e&&e,gioEnvironment:"cdp",gioSDKVersion:d.sdkVersion,gioSDKFull:d.gioSDKFull,canIUse:e=>L(r,e)&&d[e]})};const c=null===(i=null===window||void 0===window?void 0:window.gdp)||void 0===i?void 0:i.q,l=null===(n=null===window||void 0===window?void 0:window.gdp)||void 0===n?void 0:n.e,h=null===(s=null===window||void 0===window?void 0:window.gdp)||void 0===s?void 0:s.ef;window.gdp=li,window.gdp.e=l,window.gdp.ef=h,_(c)&&!F(c)&&c.forEach((e=>{li.apply(null,e)}))}();var hi=li;export{hi as default}; diff --git a/gdp-full.umd.js b/gdp-full.umd.js index 6a700a2..ad50d67 100644 --- a/gdp-full.umd.js +++ b/gdp-full.umd.js @@ -1 +1 @@ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).gdp=t()}(this,(function(){"use strict";const e=["web","wxwv","minp","alip","baidup","qq","bytedance"],t={autotrack:{type:"boolean",default:!0},compress:{type:"boolean",default:!0},dataCollect:{type:"boolean",default:!0},debug:{type:"boolean",default:!1},hashtag:{type:"boolean",default:!1},touch:{type:"boolean",default:!1},version:{type:"string",default:"1.0.0"},platform:{type:"string",default:"web"},cookieDomain:{type:"string",default:""},sendType:{type:"string",default:"beacon"}},i={enableIdMapping:{type:"boolean",default:!1},gtouchHost:{type:"string",default:""},host:{type:"string",default:"napi.growingio.com"},ignoreFields:{type:"array",default:[]},penetrateHybrid:{type:"boolean",default:!0},scheme:{type:"string",default:location.protocol.indexOf("http")>-1?location.protocol.replace(":",""):"https"},sessionExpires:{type:"number",default:30},performance:{type:"object",default:{monitor:!0,exception:!0}},embeddedIgnore:{type:"array",default:[]},storageType:{type:"string",default:"cookie"},requestTimeout:{type:"number",default:5e3}},n={},r=["clearUserId","getGioInfo","getLocation","getOption","init","setDataCollect","setOption","setUserId","track","setGeneralProps","clearGeneralProps","enableDebug","enableHT","setAutotrack","setTrackerHost","setTrackerScheme","setUserAttributes","getVisitorId","getDeviceId","registerPlugins","getPlugins","sendPage","sendVisit","trackTimerStart","trackTimerPause","trackTimerResume","trackTimerEnd","removeTimer","clearTrackTimer","updateImpression"],s=["autotrack","dataCollect","dataSourceId","debug","host","hashtag","scheme"],o={autotrack:"无埋点采集",dataCollect:"数据采集",debug:"调试模式"},a=["send","setConfig","collectImp","setPlatformProfile"],d=["screenHeight","screenWidth"],c={click:"VIEW_CLICK",change:"VIEW_CHANGE",submit:"FORM_SUBMIT"};var l,h,u,g,p,f="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},m="function"==typeof Array.from?Array.from:(h||(h=1,u=function(e){return"function"==typeof e},g=function(e){var t=function(e){var t=Number(e);return isNaN(t)?0:0!==t&&isFinite(t)?(t>0?1:-1)*Math.floor(Math.abs(t)):t}(e);return Math.min(Math.max(t,0),9007199254740991)},p=function(e){var t=e.next();return!t.done&&t},l=function(e){var t,i,n,r=this,s=arguments.length>1?arguments[1]:void 0;if(void 0!==s){if(!u(s))throw new TypeError("Array.from: when provided, the second argument must be a function");arguments.length>2&&(t=arguments[2])}var o=function(e,t){if(null!=e&&null!=t){var i=e[t];if(null==i)return;if(!u(i))throw new TypeError(i+" is not a function");return i}}(e,function(e){if(null!=e){if(["string","number","boolean","symbol"].indexOf(typeof e)>-1)return Symbol.iterator;if("undefined"!=typeof Symbol&&"iterator"in Symbol&&Symbol.iterator in e)return Symbol.iterator;if("@@iterator"in e)return"@@iterator"}}(e));if(void 0!==o){i=u(r)?Object(new r):[];var a,d,c=o.call(e);if(null==c)throw new TypeError("Array.from requires an array-like or iterable object");for(n=0;;){if(!(a=p(c)))return i.length=n,i;d=a.value,i[n]=s?s.call(t,d,n):d,n++}}else{var l=Object(e);if(null==e)throw new TypeError("Array.from requires an array-like object - not null or undefined");var h,f=g(l.length);for(i=u(r)?Object(new r(f)):Array(f),n=0;f>n;)h=l[n],i[n]=s?s.call(t,h,n):h,n++;i.length=f}return i}),l);const v=e=>L(["undefined","null"],$(e)),I=e=>"string"===$(e),w=e=>"number"===$(e),O=e=>"NaN"===k(Number(e)),b=e=>"boolean"===$(e),y=e=>"object"===$(e)&&!v(e),T=e=>"regexp"===$(e),E=e=>L(["function","asyncfunction"],$(e)),_=e=>Array.isArray(e)&&"array"===$(e),S=e=>"date"===$(e),N=e=>{try{return R(e)[0]}catch(e){return}},C=e=>{try{const t=R(e);return t[t.length-1]}catch(e){return}},x=(e,t=1)=>_(e)&&w(t)?e.slice(t>0?t:1,e.length):e,A=e=>{if(_(e)){let t=0;const i=[];for(const n of e)n&&!F(n)&&(i[t++]=n);return i}return e},P=(e,t)=>e[D(e,t)],D=(e,t)=>{let i=-1;return _(e)&&e.every(((e,n)=>!t(e)||(i=n,!1))),i},L=(e,t)=>("array"===$(e)||"string"===$(e))&&e.indexOf(t)>=0,R=m,k=e=>v(e)?"":""+e,U=(e,t)=>"string"==typeof e?e.split(t):e,j=e=>{if(I(e)){const t=U(e,"");return`${N(t).toLowerCase()}${x(t).join("")}`}return e},G=(e,t)=>!!I(e)&&e.slice(0,t.length)===t,q=(e,t)=>{if(I(e)){const{length:i}=e;let n=i;n>i&&(n=i);const r=n;return n-=t.length,n>=0&&e.slice(n,r)===t}return!1},H={}.hasOwnProperty,B=(e,t)=>!v(e)&&H.call(e,t),K=e=>y(e)?Object.keys(e):[],W=(e,t)=>{K(e).forEach((i=>t(e[i],i)))},V=(e,t)=>{const i=K(e);return!(!y(e)||!y(t)||i.length!==K(t).length||L(i.map(((i,n)=>y(e[i])?V(e[i],t[i]):e[i]===t[i])),!1))},M=(e,t)=>{if(!y(e))return!1;try{return"string"===$(t)?delete e[t]:"array"===$(t)?t.map((t=>delete e[t])):(T(t)&&K(e).forEach((i=>{t.test(i)&&M(e,i)})),!0)}catch(e){return!1}},F=e=>_(e)?0===e.length:y(e)?0===K(e).length:!e,$=e=>({}.toString.call(e).slice(8,-1).toLowerCase());var z=Object.freeze({__proto__:null,isNil:v,isString:I,isNumber:w,isNaN:O,isBoolean:b,isObject:y,isRegExp:T,isFunction:E,isArray:_,isDate:S,fixed:(e,t)=>w(e)?Number(e.toFixed(w(t)?t:2)):I(e)&&"NaN"!==k(Number(e))?Number(Number(e).toFixed(w(t)?t:2)):e,head:N,last:C,drop:x,dropWhile:(e,t)=>_(e)?e.filter((e=>!t(e))):e,compact:A,find:P,findIndex:D,includes:L,arrayFrom:R,toString:k,split:U,lowerFirst:j,upperFirst:e=>{if(I(e)){const t=U(e,"");return`${N(t).toUpperCase()}${x(t).join("")}`}return e},startsWith:G,endsWith:q,has:B,keys:K,forEach:W,isEqual:V,get:(e,t,i)=>{let n=e;return y(e)?(t.split(".").forEach((e=>{n=n?n[e]:i})),n):i},unset:M,isEmpty:F,typeOf:$,formatDate:e=>{if(S(e)){const t=e=>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())}return e}});const X=(e,t)=>{console.log("%c [GrowingIO]:"+e,{info:"color: #3B82F6;",error:"color: #EF4444;",warn:"color: #F59E0B;",success:"color: #10B981;"}[t]||"")},J=e=>{try{return e()}catch(e){return}},Z=e=>{const t={};return y(e)&&W(e,((e,i)=>{var n;const r=k(i).slice(0,100);y(e)?t[r]=Z(e):_(e)?(t[r]=e.slice(0,100),"cdp"===(null===(n=window.vds)||void 0===n?void 0:n.gioEnvironment)&&(t[r]=t[r].join("||").slice(0,1e3))):t[r]=v(e)?"":k(e).slice(0,1e3)})),t},Y=(e,t,i,n={})=>{document.addEventListener?e.addEventListener(t,i,Object.assign(Object.assign({},{capture:!0}),n)):e.attachEvent?e.attachEvent("on"+t,i):e["on"+t]=i},Q=(e,t)=>I(e)&&!F(e)&&e.match(/^[a-zA-Z_][0-9a-zA-Z_]{0,100}$/)?t():(X("事件名格式不正确,只能包含数字、字母和下划线,且不能以数字开头,字符总长度不能超过100!","error"),!1);var ee=Object.freeze({__proto__:null,consoleText:X,niceTry:J,limitObject:Z,addListener:Y,flattenObject:(e={})=>{const t=Object.assign({},e);return K(t).forEach((e=>{y(t[e])?(K(t[e]).forEach((i=>{t[`${e}_${i}`]=k(t[e][i])})),M(t,e)):_(t[e])?(t[e].forEach(((i,n)=>{y(i)?K(i).forEach((r=>{t[`${e}_${n}_${r}`]=k(i[r])})):t[`${e}_${n}`]=k(i)})),M(t,e)):v(t[e])||""===t[e]?M(t,e):t[e]=k(t[e])})),Z(t)},eventNameValidate:Q,getGioFunction:()=>{var e,t,i,n;const r=window._gio_local_vds||"vds",s=null!==(t=null===(e=window[r])||void 0===e?void 0:e.namespace)&&void 0!==t?t:"gdp";return E(window[s])?window[s]:null!==(n=null!==(i=window.gdp)&&void 0!==i?i:window.gio)&&void 0!==n?n:function(){}}});const te=e=>I(e)&&e.length>0||w(e)&&e>0,ie=/^((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})(\.((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})){3}/i,ne=/^(https?:\/\/)|(([a-zA-Z0-9_-])+(\.)?)*(:\d+)?(\/((\.)?(\?)?=?&?[a-zA-Z0-9_-](\?)?)*)*$/i;function re(e){for(var t=1;arguments.length>t;t++){var i=arguments[t];for(var n in i)e[n]=i[n]}return e}var se=function e(t,i){function n(e,n,r){if("undefined"!=typeof document){"number"==typeof(r=re({},i,r)).expires&&(r.expires=new Date(Date.now()+864e5*r.expires)),r.expires&&(r.expires=r.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var s="";for(var o in r)r[o]&&(s+="; "+o,!0!==r[o]&&(s+="="+r[o].split(";")[0]));return document.cookie=e+"="+t.write(n,e)+s}}return Object.create({set:n,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var i=document.cookie?document.cookie.split("; "):[],n={},r=0;r"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)})),ae=e=>q(e,"_gioenc")?e.slice(0,-7):e,de=e=>O(Number(e))&&J((()=>JSON.parse(e)))||e,ce={A:1,a:1,Z:1,z:1,"@":1,"{":1},le=e=>v(e)?e:J((()=>"gioenc-"+ue(e)))||e,he=e=>I(e)&&G(e,"gioenc-")&&J((()=>ue(e.replace("gioenc-",""))))||e,ue=e=>(e=e||"").split("").map((e=>ce[e]?e:ge(e))).join(""),ge=e=>{if(/[0-9]/.test(e))return 1^+e;{let t=e.charCodeAt(0);return String.fromCharCode(1^t)}};class pe{constructor(e){this.domain=e,this.getItem=e=>de(he(se.get(ae(e),{domain:this.domain,path:"/"}))),this.setItem=(e,t,i)=>{let n;n=I(t)?t.length?q(e,"_gioenc")?le(t):t:"":JSON.stringify(t),se.set(ae(e),n,{expires:i?new Date(i):3650,domain:this.domain,path:"/"})},this.removeItem=e=>{se.remove(ae(e),{domain:this.domain,path:"/"})},this.hasItem=e=>L(K(se.get()),ae(e)),this.getKeys=()=>K(se.get()),this.type="Cookie"}}class fe{constructor(){this.getItem=e=>{const t=J((()=>JSON.parse(localStorage.getItem(ae(e))||"")))||{};return y(t)&&t.expiredAt>+Date.now()?de(he(t.value)):void 0},this.setItem=(e,t,i)=>{const n=null!=i?i:+new Date(9999,12);localStorage.setItem(ae(e),JSON.stringify({value:I(t)&&t.length&&q(e,"_gioenc")?le(t):t,expiredAt:n}))},this.removeItem=e=>localStorage.removeItem(ae(e)),this.hasItem=e=>!!localStorage.getItem(ae(e)),this.getKeys=()=>R(Array(localStorage.length)).map(((e,t)=>localStorage.key(t))),this.type="localStorage"}}const me={};class ve{constructor(){this.getItem=e=>{const t=J((()=>JSON.parse(me[ae(e)]||"")));return y(t)&&t.expiredAt>+Date.now()?de(he(t.value)):void 0},this.setItem=(e,t,i)=>{const n=null!=i?i:+new Date(9999,12);me[ae(e)]=JSON.stringify({value:I(t)&&t.length?le(t):t,expiredAt:n})},this.removeItem=e=>M(me,ae(e)),this.hasItem=e=>B(me,ae(e)),this.getKeys=()=>K(me),this.type="memory"}}let Ie;const we=/^(\.ac\.|\.br\.|\.co\.|\.com\.|\.edu\.|\.gov\.|\.org\.|\.net\.)/,Oe=e=>{const t=[];try{const i=e.split("."),n=C(i);if(i.length>=2&&(isNaN(Number(n))||0>Number(n)||Number(n)>255)){const e="."+i.slice(-2).join(".");we.test(e)?Ie=e:t.push(e);const n="."+i.slice(-3).join(".");we.test(n)||L(t,n)||t.push(n);const r="."+i.slice(-4).join(".");we.test(r)||L(t,r)||t.push(r)}}catch(e){}return t},be=e=>{let t="";return e.every((e=>!ye(e)||(t=e,!1))),t},ye=e=>{try{se.set("gioCookie","yes",{domain:e});const t=!!se.get("gioCookie",{domain:e});return se.remove("gioCookie",{domain:e}),t}catch(e){return!1}},Te=e=>{let t,i,n,{storageType:r,cookieDomain:s,projectId:o}=e;if(L(["cookie","localstorage"],r)||(r="cookie"),"cookie"===r&&(n=navigator.userAgent.indexOf("Electron")>-1||L(["","localhost","127.0.0.1"],window.location.hostname)||!L(["http:","https:"],window.location.protocol)?"":be([...Oe(window.location.hostname),window.location.hostname]),i=!!n),"cookie"===r&&i){const e=new pe(n);if(s){let t=Oe(s);const i=be(F(t)?[]:[s,...Oe(s)]);i&&ye(i)?e.domain=i:X("指定Cookie域无效或无权限,使用默认域!","warn")}t=e}else t=(()=>{try{const e=window.localStorage,t="__storage_test__";return e.setItem(t,t),e.removeItem(t),!0}catch(e){return!1}})()?new fe:new ve;return"cookie"===r&&Ie&&ye(Ie)&&((e,t,i)=>{if(t&&ye(t)){let n=new pe(t);[i+"_gdp_session_id","gdp_user_id_gioenc",i+"_gdp_cs1_gioenc",i+"_gdp_user_key_gioenc",i+"_gdp_gio_id_gioenc",i+"_gdp_sequence_ids",i+"_gdp_session_id_sent"].forEach((t=>{const i=n.getItem(t);n.hasItem(t)&&(e.setItem(t,i),n.removeItem(t))})),n=void 0}})(t,Ie,o),t};var Ee="OPTION_INITIALIZED",_e="SDK_INITIALIZED",Se="SESSIONID_UPDATE",Ne="SET_USERID",Ce="SET_USERKEY",xe={name:"gioCompress",method:class{constructor(e){this.growingIO=e,this._compress=(e,t,i)=>{if(null===e)return"";let n,r,s,o={},a={},d="",c="",l="",h=2,u=3,g=2,p=[],f=0,m=0;for(s=0;sl.charCodeAt(0)){for(n=0;g>n;n++)f<<=1,m===t-1?(m=0,p.push(i(f)),f=0):m++;for(r=l.charCodeAt(0),n=0;8>n;n++)f=f<<1|1&r,m===t-1?(m=0,p.push(i(f)),f=0):m++,r>>=1}else{for(r=1,n=0;g>n;n++)f=f<<1|r,m===t-1?(m=0,p.push(i(f)),f=0):m++,r=0;for(r=l.charCodeAt(0),n=0;16>n;n++)f=f<<1|1&r,m===t-1?(m=0,p.push(i(f)),f=0):m++,r>>=1}h--,0===h&&(h=Math.pow(2,g),g++),delete a[l]}else for(r=o[l],n=0;g>n;n++)f=f<<1|1&r,m===t-1?(m=0,p.push(i(f)),f=0):m++,r>>=1;h--,0===h&&(h=Math.pow(2,g),g++),o[c]=u++,l=d+""}if(""!==l){if({}.hasOwnProperty.call(a,l)){if(256>l.charCodeAt(0)){for(n=0;g>n;n++)f<<=1,m===t-1?(m=0,p.push(i(f)),f=0):m++;for(r=l.charCodeAt(0),n=0;8>n;n++)f=f<<1|1&r,m===t-1?(m=0,p.push(i(f)),f=0):m++,r>>=1}else{for(r=1,n=0;g>n;n++)f=f<<1|r,m===t-1?(m=0,p.push(i(f)),f=0):m++,r=0;for(r=l.charCodeAt(0),n=0;16>n;n++)f=f<<1|1&r,m===t-1?(m=0,p.push(i(f)),f=0):m++,r>>=1}h--,0===h&&(h=Math.pow(2,g),g++),delete a[l]}else for(r=o[l],n=0;g>n;n++)f=f<<1|1&r,m===t-1?(m=0,p.push(i(f)),f=0):m++,r>>=1;h--,0===h&&(h=Math.pow(2,g),g++)}for(r=2,n=0;g>n;n++)f=f<<1|1&r,m===t-1?(m=0,p.push(i(f)),f=0):m++,r>>=1;for(;;){if(f<<=1,m===t-1){p.push(i(f));break}m++}return p.join("")},this.compress=e=>{const t=this;return this._compress(e,16,(function(e){return t.f(e)}))},this.compressToUTF16=e=>{const t=this;return null===e?"":this._compress(e,15,(function(e){return t.f(e+32)}))+" "},this.compressToUint8Array=e=>{const t=this.compress(e),i=new Uint8Array(2*t.length);for(let e=0,n=t.length;n>e;e++){const n=t.charCodeAt(e);i[2*e]=n>>>8,i[2*e+1]=n%256}return i},this.compressToEncodedURIComponent=e=>{if(null===e)return"";const t=this;return this._compress(e,6,(function(e){return t.keyStrUriSafe.charAt(e)}))},this.f=String.fromCharCode,this.keyStrUriSafe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$"}}},Ae={name:"gioCustomTracking",method:class{constructor(e){this.growingIO=e,this.getValidResourceItem=e=>{if(e&&y(e)&&e.id&&e.key){const t={id:I(e.id)?e.id:k(e.id),key:I(e.key)?e.key:k(e.key)};return e.attributes&&(t.attributes=e.attributes),t}},this.getDynamicAttributes=e=>(v(e)||K(e).forEach((t=>{E(e[t])?e[t]=e[t]():y(e[t])?M(e,t):_(e[t])||(e[t]=k(e[t]))})),e),this.buildCustomEvent=(e,t,i,n)=>{Q(e,(()=>{const{dataStore:{eventContextBuilder:r,eventConverter:s,currentPage:o}}=this.growingIO;let a=Object.assign({eventType:"CUSTOM",eventName:e,pageShowTimestamp:null==o?void 0:o.time,attributes:Z(this.getDynamicAttributes(y(t)&&!F(t)?t:void 0)),resourceItem:Z(this.getValidResourceItem(i))},r());F(n)||(a=Object.assign(Object.assign({},a),n)),s(a)}))},this.buildUserAttributesEvent=(e,t)=>{const{dataStore:{eventContextBuilder:i,eventConverter:n}}=this.growingIO;let r=Object.assign({eventType:"LOGIN_USER_ATTRIBUTES",attributes:Z(e)},i());F(t)||(r=Object.assign(Object.assign({},r),t)),n(r)}}}},Pe={},De={}.hasOwnProperty;function Le(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(e){return null}}function Re(e){try{return encodeURIComponent(e)}catch(e){return null}}Pe.stringify=function(e,t){t=t||"";var i,n,r=[];for(n in"string"!=typeof t&&(t="?"),e)if(De.call(e,n)){if((i=e[n])||null!=i&&!isNaN(i)||(i=""),n=Re(n),i=Re(i),null===n||null===i)continue;r.push(n+"="+i)}return r.length?t+r.join("&"):""},Pe.parse=function(e){for(var t,i=/([^=?#&]+)=?([^&]*)/g,n={};t=i.exec(e);){var r=Le(t[1]),s=Le(t[2]);null===r||null===s||r in n||(n[r]=s)}return n};const ke={gioprojectid:"projectId",giodatacollect:"dataCollect",gioappid:"domain",giodatasourceid:"dataSourceId",gios:"sessionId",giou:"uid",giocs1:"userId",gioid:"gioId",giouserkey:"userKey",gioappchannel:"appChannel",giodevicebrand:"deviceBrand",giodevicemodel:"deviceModel",giodevicetype:"deviceType",giolanguage:"language",gionetworkstate:"networkState",giooperatingsystem:"operatingSystem",gioplatform:"platform",gioplatformversion:"platformVersion",gioscreenheight:"screenHeight",gioscreenwidth:"screenWidth"},Ue=["giodatasourceid","gioplatform","gioappchannel","giodevicebrand","giodevicemodel","giodevicetype","giolanguage","gionetworkstate","giooperatingsystem","gioplatformversion","gioscreenheight","gioscreenwidth"],je=["giocs1","gios","giou","gioid","giouserkey"],Ge="gio_search_cookie_gioenc";var qe={name:"gioEmbeddedAdapter",method:class{constructor(e){this.growingIO=e,this.main=()=>{var e;const{projectId:t,appId:i}=this.growingIO.vdsConfig,n=this.getGQS();let r=!1;return"none"!==this.qsFrom&&n.gioprojectid===t&&n.gioappid===i&&(F(n)?this.growingIO.storage.removeItem(Ge):this.growingIO.storage.setItem(Ge,Pe.stringify(n)),B(n,"giodatacollect")&&(this.growingIO.vdsConfig.dataCollect=L(["true",!0],n.giodatacollect)),null===(e=this.growingIO.emitter)||void 0===e||e.on("SDK_INITIALIZED",(()=>{const{userStore:e,vdsConfig:{sessionExpires:t},dataStore:{eventContextBuilderInst:i}}=this.growingIO;je.forEach((t=>{var i;e[ke[t]]=null!==(i=n[t])&&void 0!==i?i:""})),window.setInterval((()=>{e.sessionId=n.gios}),.8*t*60*1e3),Ue.forEach((e=>{B(n,e)&&(i.minpExtraParams[ke[e]]=n[e])}))})),this.growingIO.setUserId=()=>{},this.growingIO.clearUserId=()=>{},B(n,"giodatacollect")&&(this.growingIO.setDataCollect=()=>{},this.growingIO.setOption=()=>{}),r=!0),this.gioURLRewrite(),r},this.getGQS=()=>{const{hashtag:e}=this.growingIO.vdsConfig,t=this.growingIO.storage.getItem(Ge),i=window.location.search,n=window.location.hash,r=e?n.substring(n.indexOf("?")+1):"",s=Pe.parse(i),o=Pe.parse(r),a=Pe.parse((t||"").replace("gioenc-",""));let d={};if(B(s,"gioprojectid"))d=s,this.qsFrom="search";else if(B(o,"gioprojectid"))d=o,this.qsFrom="hash";else{if(!B(a,"gioprojectid"))return this.qsFrom="none",{};d=a,this.qsFrom="cookie"}const c={},l={},h=["gioappid","gioprojectid","giodatacollect",...je,...Ue];return K(d).forEach((e=>{const t=e.toLowerCase();L(h,t)?L(["","undefined","null",void 0,null],d[e])||(c[t]=d[e],L(["true","TRUE",!0],d[e])&&(c[t]=!0),L(["false","FALSE",!1],d[e])&&(c[t]=!1)):l[e]=d[e]})),this.gqs=c,this.ngqs=l,c},this.gioURLRewrite=()=>{const{hashtag:e}=this.growingIO.vdsConfig;let t=window.location.search,i=window.location.hash,n=!1;if("search"===this.qsFrom&&(t=Pe.stringify(this.ngqs,!0),n=!0),e&&"hash"===this.qsFrom&&(i=`${i.split("?")[0]}${Pe.stringify(this.ngqs,!0)}`,n=!0),n){const e=`${window.location.pathname}${t||""}${i||""}`;window.history.replaceState(null,document.title,e)}},this.gqs={},this.ngqs={},this.qsFrom="search",this.growingIO.emitter.on(Ee,(()=>{this.growingIO.useEmbeddedInherit=this.main()}))}}},He={},Be={};!function(e){var t=f&&f.__spreadArray||function(e,t,i){if(i||2===arguments.length)for(var n,r=0,s=t.length;s>r;r++)!n&&r in t||(n||(n=[].slice.call(t,0,r)),n[r]=t[r]);return e.concat(n||[].slice.call(t))};Object.defineProperty(e,"__esModule",{value:!0}),e.GROWING_TITLE_OLD=e.GROWING_TITLE=e.GROWING_GTITLE=e.GROWING_CDP_INDEX=e.GROWING_INDEX_OLD=e.GROWING_INDEX=e.GROWING_CONTAINER=e.GROWING_TRACK=e.GROWING_IGNORE=e.VALID_CLASS_SELECTOR=e.VALID_ID_SELECTOR=e.EXCLUDE_CLASS_RE=e.UNSUPPORTED_TAGS=e.TEXT_NODE=e.UNSUPPORTED_CLICK_TAGS=e.SUPPORTED_ICON_TAGS=e.SUPPORTED_CHANGE_TYPES=e.SUPPORTED_CLICK_INPUT_TYPES=e.SUPPORTED_CONTAINER_TAGS=e.LIST_TAGS=void 0,e.LIST_TAGS=["TR","LI","DL"],e.SUPPORTED_CONTAINER_TAGS=t(["A","BUTTON"],e.LIST_TAGS,!0),e.SUPPORTED_CLICK_INPUT_TYPES=["button","submit","reset"],e.SUPPORTED_CHANGE_TYPES=["radio","checkbox","search"],e.SUPPORTED_ICON_TAGS=["I","EM","svg","IMG"],e.UNSUPPORTED_CLICK_TAGS=["TEXTAREA","HTML","BODY"],e.TEXT_NODE=["I","SPAN","EM","B","STRONG"],e.UNSUPPORTED_TAGS=["tspan","text","g","rect","path","defs","clippath","desc","title","math","use"],e.EXCLUDE_CLASS_RE=/(^| |[^ ]+\-)(clear|clearfix|active|hover|enabled|current|selected|unselected|hidden|display|focus|disabled|undisabled|open|checked|unchecked|undefined|null|ng-|growing-)[^\. ]*/g,e.VALID_ID_SELECTOR=/^[a-zA-Z-\_][a-zA-Z\-\_0-9]+$/,e.VALID_CLASS_SELECTOR=/^([a-zA-Z\-\_0-9]+)$/,e.GROWING_IGNORE="data-growing-ignore",e.GROWING_TRACK="data-growing-track",e.GROWING_CONTAINER="data-growing-container",e.GROWING_INDEX="data-growing-index",e.GROWING_INDEX_OLD="data-growing-idx",e.GROWING_CDP_INDEX="data-index",e.GROWING_GTITLE="data-growing-title",e.GROWING_TITLE="data-title",e.GROWING_TITLE_OLD="growing-title"}(Be);var Ke={},We={};Object.defineProperty(We,"__esModule",{value:!0}),We.lastFindIndex=We.findIndex=We.arrayEquals=We.rmBlank=We.normalizePath=We.splitNoEmpty=We.filterText=void 0,We.filterText=function(e,t){if(void 0===t&&(t=!0),e&&(null==(e=e.replace(/[\n \t]+/g," ").trim())?void 0:e.length))return e.slice(0,t?50:void 0)},We.splitNoEmpty=function(e,t){return e?e.split(t).filter((function(e){return!!e})):[]},We.normalizePath=function(e){var t=e.length;return t>1&&"/"===e.charAt(t-1)?e.slice(0,t-1):e},We.rmBlank=function(e){return e?e.replace(/[\n \t]+/g,""):""},We.arrayEquals=function(e,t){if(!e||!t)return!1;if(e.length!==t.length)return!1;for(var i=0,n=e.length;n>i;i++)if(e[i]!==t[i])return!1;return!0},We.findIndex=function(e,t){if(null==e||"function"!=typeof t)return-1;for(var i=0;i=0;i--){var n=e[i];if(t.call(void 0,n))return i}return-1},function(e){var t=f&&f.__spreadArray||function(e,t,i){if(i||2===arguments.length)for(var n,r=0,s=t.length;s>r;r++)!n&&r in t||(n||(n=[].slice.call(t,0,r)),n[r]=t[r]);return e.concat(n||[].slice.call(t))},i=f&&f.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.removeDiffTagOnHeadAndTail=e.computeXpath=e.getMarkIndex=e.getEffectiveNode=e.isIgnore=e.depthInside=e.changeableInput=e.clickableInput=e.onlyContainsTextChildren=e.onlyContainsIconChildren=e.supportIconTag=e.isContainerTag=e.isListTag=e.isParentOfLeaf=e.isLeaf=e.getChildren=e.getDeepChildren=e.findParent=e.isRootNode=e.hasValidAttribute=void 0;var n=We,r=Be,s=i(m);e.hasValidAttribute=function(e,t){return e instanceof Element&&e.hasAttribute(t)&&"false"!==e.getAttribute(t)},e.isRootNode=function(e){return!e||-1!==["BODY","HTML","#document"].indexOf(e.nodeName)},e.findParent=function(t,i){for(var n=t.parentNode;n&&!(0,e.isRootNode)(n);){if(i(n))return n;n=n.parentNode}},e.getDeepChildren=function(i){return(0,s.default)((null==i?void 0:i.childNodes)||[]).reduce((function(i,n){return n instanceof Element?t(t(t([],i,!0),[n],!1),(0,e.getDeepChildren)(n),!0):i}),[])},e.getChildren=function(e){return(0,s.default)((null==e?void 0:e.childNodes)||[]).filter((function(e){return e instanceof Element}))},e.isLeaf=function(t){return!t.hasChildNodes()||"svg"===t.nodeName||0===(0,e.getChildren)(t).length},e.isParentOfLeaf=function(t){return!(!t.hasChildNodes()||"svg"===t.nodeName)&&0===(0,s.default)(t.childNodes).filter((function(t){return!(0,e.isLeaf)(t)})).length},e.isListTag=function(e){return-1!==r.LIST_TAGS.indexOf(e.nodeName)},e.isContainerTag=function(t){return(0,e.hasValidAttribute)(t,r.GROWING_CONTAINER)||-1!==r.SUPPORTED_CONTAINER_TAGS.indexOf(t.nodeName)},e.supportIconTag=function(e){var t=e.nodeName;return-1!==r.SUPPORTED_ICON_TAGS.indexOf(t)},e.onlyContainsIconChildren=function(t){if(t.textContent)return!1;var i=(0,e.getChildren)(t);if(0===i.length)return!1;for(var n=0,r=i;ni)return!1;for(var r="svg"===t.tagName?[]:(0,e.getChildren)(t),s=0;s=n},e.isIgnore=function(t){if(!(t instanceof Element)||(0,e.hasValidAttribute)(t,r.GROWING_IGNORE))return!0;for(var i=t.parentNode;i&&!(0,e.isRootNode)(i);){if((0,e.hasValidAttribute)(i,r.GROWING_IGNORE))return!0;i=i.parentNode}return!1},e.getEffectiveNode=function(t){for(var i,n;t&&(n=void 0,!((i=t)instanceof Element&&-1===r.UNSUPPORTED_TAGS.indexOf(null===(n=i.tagName)||void 0===n?void 0:n.toLowerCase())))&&t.parentNode;)t=t.parentNode;var s,o=t.parentNode;return!(0,e.isRootNode)(o)&&((0,e.onlyContainsIconChildren)(o)||"BUTTON"===(s=o).tagName&&(0,e.onlyContainsTextChildren)(s))?o:t},e.getMarkIndex=function(e){if(e instanceof Element){var t=e.getAttribute(r.GROWING_INDEX)||e.getAttribute(r.GROWING_INDEX_OLD)||e.getAttribute(r.GROWING_CDP_INDEX);if(t){if(/^\d{1,10}$/.test(t)&&+t>=0&&2147483647>+t)return+t;window.console.error("[GioNode]:标记的index不符合规范(index必须是大于等于0且小于2147483647的整数字)。",t)}}},e.computeXpath=function(e){for(var t=e.parentPaths(!0),i=Math.min(t.length,+(t.length>=10)+4),n=["","",""],r=0;rr&&(n[1]=s+n[1])}return n},e.removeDiffTagOnHeadAndTail=function(e,t){var i=function(e){return e.nodeName===t.nodeName},r=(0,n.findIndex)(e,i),s=(0,n.lastFindIndex)(e,i);return-1===r||-1===s?[]:e.slice(r,s+1)}}(Ke);var Ve={},Me={};Object.defineProperty(Me,"__esModule",{value:!0});var Fe=Be,$e=We,ze=Ke;function Xe(e){var t;if(e instanceof Element){var i=e.getAttribute("name");if(i)return[i];if(e.hasAttribute("class")){var n=null===(t=e.getAttribute("class"))||void 0===t?void 0:t.replace(Fe.EXCLUDE_CLASS_RE,"").trim();if(null==n?void 0:n.length)return n.split(/\s+/).filter((function(e){return Fe.VALID_CLASS_SELECTOR.test(e)&&!e.match(/[a-z][A-Z][a-z][A-Z]/)&&!e.match(/[0-9][0-9][0-9][0-9]/)})).sort()}}return[]}var Je=function(){function e(e){var t;this.node=e,this.tagName=this.node.nodeName,this.name=this.tagName.toLowerCase(),this.id=(t=this.node).id&&Fe.VALID_ID_SELECTOR.test(t.id)?t.id:null,this.classList=Xe(this.node),this.guessListAndIndex()}return e.prototype.guessListAndIndex=function(){var e,t=this;this._tagList=(0,ze.isListTag)(this.node);var i=(0,ze.removeDiffTagOnHeadAndTail)((0,ze.getChildren)(this.node.parentNode),this.node);if(this._tagList&&-1!==(s=i.filter((function(e){return e.tagName===t.tagName})).indexOf(this.node))&&(this._index=s+1),i.length>=3&&(null===(e=this.classList)||void 0===e?void 0:e.length)){for(var n=0,r=0,s=1;s<=i.length;s++){var o=i[s-1];if(o.tagName!==this.tagName){r=0;break}(0,$e.arrayEquals)(this.classList,Xe(o))&&(r+=1),this.node===o&&(n=s)}3>r||(this._pseudoList=!0,this._index=this._index||n)}},Object.defineProperty(e.prototype,"path",{get:function(){var e;return this._path||(this._path="/".concat(this.name),this.id&&(this._path+="#".concat(this.id)),(null===(e=this.classList)||void 0===e?void 0:e.length)&&(this._path+=".".concat(this.classList.join(".")))),this._path},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pseudoList",{get:function(){return!!this._pseudoList},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"list",{get:function(){return!!this._tagList||!!this._pseudoList},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"index",{get:function(){var e;return null!==(e=(0,ze.getMarkIndex)(this.node))&&void 0!==e?e:this._index},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"container",{get:function(){return(0,ze.isContainerTag)(this.node)||this.list},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"parent",{get:function(){return this.node.parentNode?new e(this.node.parentNode):null},enumerable:!1,configurable:!0}),e.prototype.parentPaths=function(e){void 0===e&&(e=!1);for(var t=e?[this]:[],i=this.parent;i&&!(0,ze.isRootNode)(i.node);)t.push(i),i=i.parent;return t},e}();Me.default=Je;var Ze={};Object.defineProperty(Ze,"__esModule",{value:!0}),Ze.getElementHref=Ze.getImgHref=Ze.getAnchorHref=void 0;var Ye=We;function Qe(e){if(e.hasAttribute("href")){var t=e.getAttribute("href");if(t&&0!==t.indexOf("javascript"))return(0,Ye.normalizePath)(t.slice(0,320))}}function et(e){if(e.src&&-1===e.src.indexOf("data:image"))return e.src}Ze.getAnchorHref=Qe,Ze.getImgHref=et,Ze.getElementHref=function(e){var t=e;if(t)switch(e.nodeName.toLowerCase()){case"a":return Qe(t);case"img":return et(t)}};var tt={},it=f&&f.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(tt,"__esModule",{value:!0}),tt.getElementContent=tt.getFormContent=void 0;var nt=Ke,rt=Ze,st=Be,ot=it(Me),at=We,dt=it(m),ct=function(e){return e.htmlFor||e.getAttribute("for")},lt=function(e){var t=e.getAttribute(st.GROWING_GTITLE)||e.getAttribute(st.GROWING_TITLE)||e.getAttribute(st.GROWING_TITLE_OLD)||e.getAttribute("title");return null==t?void 0:t.trim()};function ht(e){var t=e.node;return e.list?ut(t):(0,at.filterText)(t.textContent)||void 0}function ut(e){for(var t=void 0,i=!1,n=0,r=(0,dt.default)(e.childNodes);n-1?i.slice(0,n):i}}(t);case"svg":return function(e){for(var t=0,i=(0,dt.default)(e.childNodes);t0)return i[i.length-1]}}(t);case"label":return ht(o);case"input":return function(e){if((0,nt.clickableInput)(e))return e.value;if("password"!==e.type&&(0,nt.hasValidAttribute)(e,st.GROWING_TRACK))return e.value;if((0,nt.changeableInput)(e)){var t=(0,nt.findParent)(e,(function(e){return"LABEL"===e.nodeName}));if(!t&&e.id)for(var i=document.body.getElementsByTagName("label"),n=0;n0)return s+" ("+e.checked+")"}return e.value}}(t);case"select":return n=t,(0,dt.default)(n.options).filter((function(e){return e.selected})).map((function(e){return e.label})).join(", ")||n.value;case"form":return gt(t)}return(0,nt.isLeaf)(t)?function(e){var t=(0,at.filterText)(e.textContent);if(t)return t}(t):(0,nt.isParentOfLeaf)(t)&&!(0,nt.onlyContainsIconChildren)(t)?function(e){for(var t="",i=0,n=(0,dt.default)(e.childNodes);ii;i++)for(var r in t=arguments[i])({}).hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},Tt.apply(this,arguments)},Et=f&&f.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(He,"__esModule",{value:!0});var _t=Be,St=Ke,Nt=Et(Ve),Ct=function(){function e(e,t,i){void 0===t&&(t=null),void 0===i&&(i=!0),this.origin=e,this.action=t,this.direct=i,this.target="self"===t?e:(0,St.getEffectiveNode)(e),this.ignore=(0,St.isIgnore)(this.target),this.vnode=new Nt.default(this.target),this.tagName=this.vnode.tagName}return Object.defineProperty(e.prototype,"content",{get:function(){return this.vnode.content},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"href",{get:function(){return this.vnode.href},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"index",{get:function(){return this.vnode.index},enumerable:!1,configurable:!0}),e.prototype.inferParentIndex=function(){var t=this;return this.parentIndex||(0,St.findParent)(this.target,(function(i){var n=new e(i,t.action,!1);n.traceable()&&n.index&&(t.parentIndex=n.index)})),this.parentIndex},Object.defineProperty(e.prototype,"xpath",{get:function(){return this.vnode.xpath},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fullXpath",{get:function(){return this.vnode.fullXpath},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"skeleton",{get:function(){return this.vnode.skeleton},enumerable:!1,configurable:!0}),e.prototype.info=function(e){return void 0===e&&(e=!0),e&&this.inferParentIndex(),{skeleton:this.skeleton,fullXpath:this.fullXpath,xpath:this.xpath,content:this.content,href:this.href,index:this.parentIndex||this.index}},e.prototype.traceable=function(){if(this.ignore)return!1;if(this.direct){if("click"===this.action||"hover"===this.action){if(-1!==_t.UNSUPPORTED_CLICK_TAGS.indexOf(this.target.tagName))return!1;if("INPUT"===this.target.tagName&&!(0,St.clickableInput)(this.target))return!1;if(!(0,St.isContainerTag)(this.target)&&!(0,St.depthInside)(this.target,5))return!1}return!0}return this.vnode.container},e.prototype.trackNodes=function(){if(!this.traceable())return[];var e=[this];if("submit"!==this.action)for(var t=this.parentElement;t;){if(t.ignore)return[];t.traceable()&&e.unshift(t),t=t.parentElement}var i=void 0;return e.map((function(e){var t=e.info(!1),n=t.index;return!i&&n&&(i=n),Tt(Tt({},t),{index:i||n})}))},Object.defineProperty(e.prototype,"parentElement",{get:function(){var t=this.target.parentNode;if(t&&t.nodeName&&!(0,St.isRootNode)(t))return new e(t,this.action,!1)},enumerable:!1,configurable:!0}),e}(),xt=He.default=Ct;class At{constructor(e){this.handler=e;const t=navigator.userAgent,i=/chrome/i.exec(t),n=/android/i.exec(t);this.hasTouch="ontouchstart"in window&&!(i&&!n)}main(){const e=this.hasTouch?["touchstart"]:["mousedown"],t=this.hasTouch?["touchend","touchcancel"]:["mouseup","mouseleave"],i=this.hasTouch?["touchmove"]:["mousemove"];for(const t of e)Y(window,t,this.touchStartHandler.bind(this));for(const e of i)Y(window,e,this.touchMoveHandler.bind(this));for(const e of t)Y(window,e,this.touchStopHandler.bind(this))}touchStartHandler(e){if(e.which>1)return;const t=+Date.now();this.safeguard!==t&&(this.touchTimeout&&clearTimeout(this.touchTimeout),this.safeguard=t,this.touchEvent={time:t,target:e.target,x:this._page("x",e),y:this._page("y",e),isTrusted:!0,type:"click"})}touchMoveHandler(e){const t=Math.abs(this._page("x",e)-(this.touchEvent&&this.touchEvent.x)||0),i=Math.abs(this._page("y",e)-(this.touchEvent&&this.touchEvent.y)||0);(t>10||i>10)&&(this.touchEvent=null)}touchStopHandler(e){const t=+Date.now()-(this.touchEvent&&this.touchEvent.time)||0;this.touchEvent&&200>t?this.touchTimeout=setTimeout((()=>{this.handler(this.touchEvent),this.touchEvent=null}),200):this.touchEvent&&t>=200&&700>t&&(this.handler(this.touchEvent),this.touchEvent=null)}_page(e,t){return(this.hasTouch?t.touches[0]:t)["page"+e.toUpperCase()]}}var Pt={name:"gioEventAutoTracking",method:class{constructor(e){this.growingIO=e,this.main=()=>{Y(document,"submit",this._handleAction),Y(document,"change",this._handleAction);const{vdsConfig:e}=this.growingIO;e.touch?new At(this._handleAction).main():Y(document,"click",this._handleAction)},this._handleAction=(e,t)=>{const{vdsConfig:i,emitter:n}=this.growingIO;if(!i.autotrack)return!1;const r=e.target;if(!r)return!1;let s=new xt(r,e.type,!0).trackNodes();if("click"!==e.type&&(s=F(C(s))?[]:[C(s)]),F(s))return!1;null==n||n.emit("onComposeBefore",{event:t,params:null!=e?e:{}}),s.forEach((t=>{const{fullXpath:n,index:r,content:s,href:o}=t;if(!G(t.fullXpath||"","/div#__vconsole")&&!G(t.fullXpath||"","/div#__giokit")&&(i.debug&&console.log("Action:",e.type,Date.now()),n)){const{dataStore:{eventContextBuilder:t,eventConverter:i,currentPage:a}}=this.growingIO;i(Object.assign(Object.assign({eventType:c[e.type],element:[{xpath:n,index:r,textValue:s,hyperlink:o}]},t()),{pageShowTimestamp:a.time}))}}))}}}};let Dt;const Lt=["VIEW_CLICK","VIEW_CHANGE","FORM_SUBMIT","PAGE","CUSTOM","LOGIN_USER_ATTRIBUTES"],Rt=["LOGIN_USER_ATTRIBUTES"];var kt={name:"gioHybridAdapter",method:class{constructor(e){this.growingIO=e,this.penetrateHybrid=!0,this.onOptionsInit=()=>{const{vdsConfig:e,emitter:t}=this.growingIO;b(e.penetrateHybrid)&&(this.penetrateHybrid=e.penetrateHybrid),this._initHybridBridge()&&(this.onSendBefore=this.sendBeforeListener,this.hybridConfig.projectId===this.growingIO.vdsConfig.projectId&&(this.growingIO.useHybridInherit=!0)),this.growingIO.useHybridInherit&&(null==t||t.on(Ne,(({newUserId:e,oldUserId:t,userKey:i})=>{this.penetrateHybrid&&(!e&&t?i?this._clearNativeUserIdAndUserKey():this._clearNativeUserId():i?this._setNativeUserIdAndUserKey(k(e),k(i)):this._setNativeUserId(k(e)))})),null==t||t.on(Ce,(({newUserKey:e,oldUserKey:t,userId:i})=>{this.penetrateHybrid&&(!e&&t?this._clearNativeUserIdAndUserKey():this._setNativeUserIdAndUserKey(k(i),k(e)))})))},this._initHybridBridge=()=>{var e,t,i;let n=!1;return this.hasHybridBridge=!!window.GrowingWebViewJavascriptBridge,this.hasHybridBridge?((null===(e=null===window||void 0===window?void 0:window.GrowingWebViewJavascriptBridge)||void 0===e?void 0:e.configuration)||(window.GrowingWebViewJavascriptBridge.configuration=JSON.parse(window.GrowingWebViewJavascriptBridge.getConfiguration())),(null===(t=null===window||void 0===window?void 0:window.GrowingWebViewJavascriptBridge)||void 0===t?void 0:t.configuration)&&(this.hybridConfig=null===(i=null===window||void 0===window?void 0:window.GrowingWebViewJavascriptBridge)||void 0===i?void 0:i.configuration),n=!0):Dt.consoleText("gioHybridAdapter:当前不存在 GrowingWebViewJavascriptBridge,Web模式。","info"),n},this.sendBeforeListener=({requestData:e})=>{if(this.hasHybridBridge){const t=this.processAttributes(Object.assign({},e));L(Lt,t.eventType)&&(L(Rt,t.eventType)?this.penetrateHybrid&&this._dispatchEvent(t):(this.penetrateHybrid||M(t,["userId","userKey","cs1"]),this._dispatchEvent(t)))}},this.processAttributes=e=>(W(e,((t,i)=>{y(t)||_(t)?W(e[i],((t,n)=>{y(t)||_(t)?e[i][n]=JSON.stringify(t):e[i][n]=k(t)})):e[i]=k(t)})),e),this._setNativeUserId=e=>{J((()=>window.GrowingWebViewJavascriptBridge.setNativeUserId(e)))},this._clearNativeUserId=()=>{J((()=>window.GrowingWebViewJavascriptBridge.clearNativeUserId()))},this._setNativeUserIdAndUserKey=(e,t)=>{J((()=>window.GrowingWebViewJavascriptBridge.setNativeUserIdAndUserKey(e,t)))},this._clearNativeUserIdAndUserKey=()=>{J((()=>window.GrowingWebViewJavascriptBridge.clearNativeUserIdAndUserKey()))},this._dispatchEvent=e=>{J((()=>{var t;return null===(t=window.GrowingWebViewJavascriptBridge)||void 0===t?void 0:t.dispatchEvent(JSON.stringify(e))}))};const{emitter:t,utils:i}=this.growingIO;Dt=i,t.on(Ee,this.onOptionsInit)}}};const Ut=["i","span","em","b","strong","svg"];var jt;!function(e){e[e.OUTER=0]="OUTER",e[e.INNER_COVERED=1]="INNER_COVERED",e[e.INNER_SHOW=2]="INNER_SHOW"}(jt||(jt={}));const Gt=["HR","BR","SCRIPT","NOSCRIPT","STYLE","HEAD","BASE","LINK","META","TITLE","BODY","HTML","TEMPLATE","CODE",...Be.UNSUPPORTED_CLICK_TAGS],qt=["SELECT","A","BUTTON","INPUT","IMG","FORM"],Ht=(e,t,i)=>document.elementFromPoint(t,i)===e;class Bt{constructor(e,t,i){this.node=e,this.parentNodeDesc=t,this.devicesInfo=i,this.proxy=new xt(e),this.tagName=this.node.tagName,this.name=this.tagName.toLowerCase(),this.isIgnore=!!this.node.dataset.growingIgnore,this.isUnSupported=-1!==Gt.indexOf(this.tagName),this.rect=this.computeWindowRect()}info(){const e=this.desc();e.zLevel+=this.devicesInfo.webviewZLevel;const t=this.getDeviceRect(this.rect);return M(e,"isContainer"),Object.assign(Object.assign(Object.assign({},e),t),{parentXPath:this.parentNodeDesc.isContainer?this.parentNodeDesc.xpath:void 0,href:this.proxy.href,content:this.proxy.content,nodeType:this.nodeType()})}nodeType(){return"input"!==this.name||Ke.changeableInput(this.node)?this.node.tagName:"INPUT_BTN"}desc(){return{index:this.parentNodeDesc.index||this.proxy.index,zLevel:this.zLevel(),xpath:this.proxy.xpath,isContainer:this.isDefinedContainer()}}cssVisible(){const e=this.computedStyle();return Number(e.opacity)>0&&"visible"===e.visibility&&"none"!==e.display}viewportStatus(){const{top:e,left:t,width:i,height:n}=this.rect,{winWidth:r,winHeight:s}=this.devicesInfo;if(0>=i||0>=n)return jt.OUTER;const o=this.node;return s>e&&r>t&&i>0&&n>0?Ht(o,t+i/2,e+n/2)||Ht(o,t+1,e+1)||Ht(o,t+i-1,e+1)||Ht(o,t+1,e+n-1)||Ht(o,t+i-1,e+n-1)?jt.INNER_SHOW:jt.INNER_COVERED:jt.OUTER}isCircleable(){return this.proxy.target===this.proxy.origin&&(!!this.isDefinedContainer()||!("input"===this.name&&this.node instanceof HTMLInputElement&&"password"===this.node.type)&&(-1!==qt.indexOf(this.name)||(Ke.isLeaf(this.node)?!this.isBigBlank():this.hasBackgroundImage()&&Ke.depthInside(this.node,4))))}isSimpleContainer(){return"select"===this.name||this.isDefaultContainer()&&(function(e,t){if(0===e.children.length)return!1;for(const i of R(e.children))if(-1===t.indexOf(i.tagName.toLowerCase()))return!1;return!0}(this.node,Ut)||!this.node.childElementCount)}isDefinedContainer(){var e;return v(this.isContainer)?this.isDefaultContainer()||this.isMarkContainer()||Ke.isParentOfLeaf(this.node)&&(!!(null===(e=this.node.innerText)||void 0===e?void 0:e.trim().length)||function(e){const t=e.attributes;if(t.length>0)for(let e=0;es>>1||r>o>>1)}hasBackgroundImage(){const e=this.computedStyle().backgroundImage;return!!e&&"none"!==e&&e.length>0}zLevel(){const e=this.computedStyle(),t=e.zIndex;if("auto"!==t)return Number(t||"0")+this.parentNodeDesc.zLevel;switch(e.position){case"relative":return this.parentNodeDesc.zLevel+2;case"sticky":return this.parentNodeDesc.zLevel+3;case"absolute":return this.parentNodeDesc.zLevel+4;case"fixed":return this.parentNodeDesc.zLevel+5;default:return this.parentNodeDesc.zLevel+1}}computeWindowRect(){if(this.rect)return this.rect;const e=this.node.getBoundingClientRect(),t=e.top,i=e.bottom,n=e.left;let r=e.right-n,s=i-t;return 0>t?s=t+s:t+s>this.devicesInfo.winHeight&&(s=this.devicesInfo.winHeight-t),0>n?r=n+r:n+r>this.devicesInfo.winWidth&&(r=this.devicesInfo.winWidth-n),this.rect={top:t,left:n,width:r,height:s},this.rect}computedStyle(){return window.getComputedStyle(this.node)}getDeviceRect(e){const{scale:t,webviewTop:i,webviewLeft:n}=this.devicesInfo;return{top:e.top*t+i,left:e.left*t+n,width:e.width*t,height:e.height*t}}}const Kt=["DOMContentLoaded","onreadystatechange"],Wt=["scroll","resize","load","beforeunload","popstate","hashchange","pagehide","unload"];class Vt{constructor(e){this.growingIO=e,this.addDomChangeListener()}getDomTree(e,t,i,n,r,s){const o=function(e,t,i,n,r){const s=document.documentElement.clientWidth;return{winWidth:s,winHeight:document.documentElement.clientHeight,scale:i/s,webviewTop:t,webviewLeft:e,webviewWidth:i,webviewHeight:n,webviewZLevel:r}}(e,t,i,n,r),a=this.getElementsByParent(s||document.body,{isContainer:!1,zLevel:0},o),{domain:d,path:c,query:l,title:h}=this.growingIO.dataStore.currentPage;return{page:{domain:d,path:c,query:l,title:h},elements:a}}getElementsByParent(e,t,i){const n=[];return[].slice.call(e.childNodes,0).filter((e=>1===e.nodeType)).forEach((e=>{const r=new Bt(e,t,i);if(r.cssVisible()&&!r.isIgnore){switch(r.viewportStatus()){case jt.INNER_SHOW:r.isCircleable()&&n.push(r.info());break;case jt.INNER_COVERED:r.isDefaultContainer()&&n.push(r.info())}r.isSimpleContainer()||[].push.apply(n,this.getElementsByParent(e,r.desc(),i))}})),n}addDomChangeListener(){let e;const t=(t="")=>()=>{var i;"beforeunload"===t&&e&&e.disconnect(),null===(i=window.GrowingWebViewJavascriptBridge)||void 0===i||i.onDomChanged()};e=new MutationObserver(t("mutation")),e.observe(document.body,{attributes:!0,characterData:!0,childList:!0,subtree:!0}),Kt.forEach((e=>{Y(document,e,t(e))})),Wt.forEach((e=>{Y(window,e,t(e))}))}}class Mt{constructor(e){var t;this.growingIO=e,null===(t=this.growingIO.emitter)||void 0===t||t.on(_e,(()=>{if(window.GrowingWebViewJavascriptBridge){const e=this;window.GrowingWebViewJavascriptBridge.getDomTree=function(){if(arguments.length>=4)return Mt.bindGetDomTree(e.growingIO),Mt.domHelper.getDomTree.apply(Mt.domHelper,arguments)}}}))}static bindGetDomTree(e){this.domHelper||(this.domHelper=new Vt(e),window.GrowingWebViewJavascriptBridge.getDomTree=this.domHelper.getDomTree.bind(this.domHelper))}}var Ft={name:"gioHybridCircle",method:Mt},$t={name:"gioImpressionTracking",method:class{constructor(e){var t;this.growingIO=e,this.documentReady=!1,this.main=e=>{"listener"===e?(this.documentReady=!0,this.growingIO.gioSDKInitialized&&this.initMutationObserver()):"emitter"===e&&this.documentReady&&this.initMutationObserver()},this.initIntersectionObserver=()=>{this.intersectionObserver=new IntersectionObserver((e=>{F(e)||e.map((e=>{const{dataset:t,id:i}=e.target;if(e.intersectionRatio>0){const{eventId:e,properties:n,items:r}=this.getImpressionProperties(t);if(i){if("once"===t.gioImpType&&B(this.sentImps,i))return;this.sentImps[i]={eventId:e,properties:n,items:r}}e&&this.growingIO.track(e,n,r)}}))}))},this.initMutationObserver=()=>{var e;this.mutationObserver&&(null===(e=this.mutationObserver)||void 0===e||e.disconnect());const t=document.querySelectorAll("[data-gio-imp-track]");R(t).map((e=>{var t;null===(t=this.intersectionObserver)||void 0===t||t.observe(e)})),this.mutationObserver=new MutationObserver((e=>{e.map((e=>{var t,i;"attributes"===e.type&&(null===(t=e.target.dataset)||void 0===t?void 0:t.gioImpTrack)&&(null===(i=this.intersectionObserver)||void 0===i||i.observe(e.target))}))})),this.mutationObserver.observe(document.body,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0,attributeFilter:["data-gio-imp-track","data-gio-imp-attrs","data-gio-imp-items",/^data-gio-track-[a-z]+$/i]})},this.getImpressionProperties=e=>{let t={eventId:void 0,properties:{}};if(!(null==e?void 0:e.gioImpTrack))return t;if(t.eventId=e.gioImpTrack,B(e,"gioImpAttrs"))t.properties=J((()=>y(e.gioImpAttrs)?e.gioImpAttrs:JSON.parse(e.gioImpAttrs))),t.items=J((()=>y(e.gioImpItems)?e.gioImpItems:JSON.parse(e.gioImpItems)));else{const i=/^gioTrack(.+)/;for(const n in e){let r;const s=n.match(i);s&&(r=j(s[1]),"track"!==r&&(t.properties[r]=e[n]))}}return t.properties=Z(t.properties),t.items=Z(t.items),/^\w+$/.test(t.eventId)&&!Number.isInteger(Number(N(t.eventId.split(""))))||(t.eventId=null,t={}),t},this.sentImps={},window.IntersectionObserver&&window.MutationObserver?(this.initIntersectionObserver(),Y(document,"readystatechange",(()=>{L(["interactive","complete"],document.readyState)&&this.main("listener")}),{once:!0}),null===(t=this.growingIO.emitter)||void 0===t||t.on(_e,(()=>this.main("emitter"))),Y(window,"unload",(()=>{var e,t;null===(e=this.intersectionObserver)||void 0===e||e.disconnect(),null===(t=this.mutationObserver)||void 0===t||t.disconnect()}))):X("当前浏览器不支持半自动埋点,gioImpressionTracking已自动关闭!","warn")}}},zt={name:"gioWebCircle",method:class{constructor(e){var t;this.growingIO=e,this.injectCircle=(e,t)=>{const i=document.createElement("link"),n=document.createElement("script");i.rel="stylesheet",i.href=e,n.src=t,document.head.appendChild(i),document.head.appendChild(n)},null===(t=this.growingIO.emitter)||void 0===t||t.on(_e,(()=>{window.addEventListener("message",(e=>{const{data:t,source:i}=e,n=window.vds;if(t&&i){const e=i.vds,r=t.cssURL,s=t.jsURL;e&&"SDK_INJECT_CIRCLE_SCRIPT"===t.type&&n.projectId===e.projectId&&n.dataSourceId===e.dataSourceId&&this.injectCircle(r,s)}}))}))}}};const Xt=["gioPerformance"];class Jt{constructor(e){var t,i,n,r;this.growingIO=e,this.innerPluginInit=()=>{var e;Xt.forEach((e=>{var t;return M(null===(t=this.pluginsContext)||void 0===t?void 0:t.plugins,e)})),K(null===(e=this.pluginsContext)||void 0===e?void 0:e.plugins).forEach((e=>{var t;const{name:i,method:n}=null===(t=this.pluginsContext)||void 0===t?void 0:t.plugins[e];P(this.pluginItems,(e=>e.name===i))||this.pluginItems.push({name:j(i||e),method:n||(e=>{})})})),F(this.pluginItems)||this.installAll()},this.install=(e,t,i)=>{var n,r;const s=t||P(this.pluginItems,(t=>t.name===e));if((null===(n=this.growingIO)||void 0===n?void 0:n.plugins)[e])return X(`重复加载插件 ${e} 或插件重名,已跳过加载!`,"warn"),!1;if(!s)return X(`插件加载失败!不存在名为 ${e} 的插件!`,"error"),!1;try{return(null===(r=this.growingIO)||void 0===r?void 0:r.plugins)[e]=new s.method(this.growingIO,i),"cdp"===this.growingIO.gioEnvironment&&t&&X("加载插件 "+e,"info"),!0}catch(e){return X("插件加载异常 "+e,"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:j(t.name),method:t.method?t.method:()=>{}})}))},this.uninstall=e=>{var t;M(this.pluginItems,e);const i=M(null===(t=this.growingIO)||void 0===t?void 0:t.plugins,e);return i||X(`卸载插件 ${e} 失败!`,"error"),i},this.uninstallAll=()=>{this.pluginItems.forEach((e=>this.uninstall(e.name)))},this.lifeError=(e,t)=>X(`插件执行错误 ${e.name} ${t}`,"error"),this.onComposeBefore=e=>{this.pluginItems.forEach((t=>{var i;const n=null===(i=this.growingIO.plugins[t.name])||void 0===i?void 0:i.onComposeBefore;if(n&&E(n))try{n(e)}catch(e){this.lifeError(t,e)}}))},this.onComposeAfter=e=>{this.pluginItems.forEach((t=>{var i;const n=null===(i=this.growingIO.plugins[t.name])||void 0===i?void 0:i.onComposeAfter;if(n&&E(n))try{n(e)}catch(e){this.lifeError(t,e)}}))},this.onSendBefore=e=>{this.pluginItems.forEach((t=>{var i;const n=null===(i=this.growingIO.plugins[t.name])||void 0===i?void 0:i.onSendBefore;if(n&&E(n))try{n(e)}catch(e){this.lifeError(t,e)}}))},this.onSendAfter=e=>{this.pluginItems.forEach((t=>{var i;const n=null===(i=this.growingIO.plugins[t.name])||void 0===i?void 0:i.onSendAfter;if(n&&E(n))try{n(e)}catch(e){this.lifeError(t,e)}}))},this.pluginsContext={plugins:{}},this.pluginItems=[],null===(t=this.growingIO.emitter)||void 0===t||t.on("onComposeBefore",this.onComposeBefore),null===(i=this.growingIO.emitter)||void 0===i||i.on("onComposeAfter",this.onComposeAfter),null===(n=this.growingIO.emitter)||void 0===n||n.on("onSendBefore",this.onSendBefore),null===(r=this.growingIO.emitter)||void 0===r||r.on("onSendAfter",this.onSendAfter)}}class Zt extends Jt{constructor(e){super(e),this.growingIO=e,this.growingIO.gioSDKFull=!0,this.pluginsContext={plugins:{gioCompress:xe,gioCustomTracking:Ae,gioEmbeddedAdapter:qe,gioEventAutoTracking:Pt,gioHybridAdapter:kt,gioHybridCircle:Ft,gioImpressionTracking:$t,gioWebCircle:zt}}}}class Yt{constructor(){var e;this.trackingId="g0",this.init=e=>{var t,i,n,r,s;X("Gio Web SDK 初始化中...","info");const{initOptions:o,currentPage:a,sendVisit:d,sendPage:c}=this.dataStore;o(e),this.storage=Te(this.vdsConfig),this.initCallback(),null===(t=this.emitter)||void 0===t||t.emit(Ee,this),null===(n=null===(i=this.plugins)||void 0===i?void 0:i.gioEventAutoTracking)||void 0===n||n.main(),a.hookHistory(),a.parsePage(),null===(r=this.emitter)||void 0===r||r.emit(_e,this),X("Gio Web SDK 初始化完成!","success"),this.useEmbeddedInherit||(this.dataStore.lastVisitEvent.timestamp=a.time,d()),c(),this.gioSDKInitialized=!0,this.vdsConfig.gioSDKInitialized=!0,window[this.vds]=this.vdsConfig,null===(s=this.emitter)||void 0===s||s.emit("SDK_INITIALIZED_COMPLATE",this)},this.setOption=(e,t)=>{if(L(s,e)){const i=this.dataStore.setOption(e,t);return i&&o[e]&&X(`已${t?"开启":"关闭"}${o[e]}`,"info"),i}return X(`不存在可修改的配置项:${e},请检查后重试!`,"warn"),!1},this.getOption=e=>this.dataStore.getOption(e),this.setGeneralProps=e=>{y(e)&&!F(e)?(this.dataStore.generalProps=Object.assign(Object.assign({},this.dataStore.generalProps),e),K(this.dataStore.generalProps).forEach((e=>{L([void 0,null],this.dataStore.generalProps[e])&&(this.dataStore.generalProps[e]="")}))):this.callError("setGeneralProps")},this.clearGeneralProps=e=>{_(e)&&!F(e)?e.forEach((e=>{M(this.dataStore.generalProps,e)})):this.dataStore.generalProps={}},this.reissuePage=()=>{this.dataStore.sendPage()},this.notRecommended=()=>X("不推荐的方法使用,建议使用 gio('setOption', [optionName], [value])!","info"),this.callError=(e,t=!0,i="参数不合法")=>X(`${t?"调用":"设置"} ${e} 失败,${i}!`,"warn"),this.updateImpression=()=>{var e,t;const i=null===(t=null===(e=this.plugins)||void 0===e?void 0:e.gioImpressionTracking)||void 0===t?void 0:t.main;i?i("emitter"):X("updateImpression 错误! 请集成半自动埋点浏览插件后重试!","error")},this.gioEnvironment="cdp",this.sdkVersion="3.8.6",this.vds=window.gioCompatibilityVds?"gdp_vds":"vds",this.utils=Object.assign(Object.assign({},z),ee),this.emitter={all:e=e||new Map,on:function(t,i){var n=e.get(t);n?n.push(i):e.set(t,[i])},off:function(t,i){var n=e.get(t);n&&(i?n.splice(n.indexOf(i)>>>0,1):e.set(t,[]))},emit:function(t,i){var n=e.get(t);n&&n.slice().map((function(e){e(i)})),(n=e.get("*"))&&n.slice().map((function(e){e(t,i)}))}},this.useEmbeddedInherit=!1,this.useHybridInherit=!1,this.gioSDKInitialized=!1,this.plugins=new Zt(this),this.plugins.innerPluginInit()}}class Qt{constructor(e){this.growingIO=e;const{projectId:t}=this.growingIO.vdsConfig,{getItem:i,setItem:n,getKeys:r,removeItem:s}=this.growingIO.storage;this.getItem=i,this.setItem=n,this.getKeys=r,this.removeItem=s,this.sIdStorageName=t+"_gdp_session_id",this.uidStorageName="gdp_user_id_gioenc",this.userIdStorageName=t+"_gdp_cs1_gioenc",this.userKeyStorageName=t+"_gdp_user_key_gioenc",this.gioIdStorageName=t+"_gdp_gio_id_gioenc"}get sessionId(){return this.getItem(this.sIdStorageName)||(this.sessionId=oe(),this.sessionId)}set sessionId(e){var t;e||(e=oe());const i=this.getItem(this.sIdStorageName)||this.prevSessionId,{sessionExpires:n=30}=this.growingIO.vdsConfig;this.setItem(this.sIdStorageName,e,+Date.now()+60*n*1e3),i!==e&&(this.getKeys().filter((e=>/.+_gdp_session_id_.{36}/.test(e))).forEach((e=>{this.removeItem(e)})),this.setItem(this.growingIO.dataStore.visitStorageName,""),null===(t=this.growingIO.emitter)||void 0===t||t.emit(Se,{newSessionId:e,oldSessionId:i})),this.prevSessionId=e}get uid(){return this.getItem(this.uidStorageName)||(this.uid=oe(),this.uid)}set uid(e){var t;const i=this.getItem(this.uidStorageName)||this.prevUId;this.setItem(this.uidStorageName,e),i!==e&&(null===(t=this.growingIO.emitter)||void 0===t||t.emit("UID_UPDATE",{newUId:e,oldUId:i})),this.prevUId=e}get userId(){return this.getItem(this.userIdStorageName)||""}set userId(e){var t,i;const n=this.getItem(this.userIdStorageName)||this.prevUserId;this.setItem(this.userIdStorageName,e),null===(t=this.growingIO.emitter)||void 0===t||t.emit(Ne,{newUserId:e,oldUserId:n,userKey:this.userKey}),n!==e&&(null===(i=this.growingIO.emitter)||void 0===i||i.emit("USERID_UPDATE",{newUserId:e,oldUserId:n,userKey:this.userKey})),e&&(this.gioId=e),this.prevUserId=e}get userKey(){return this.getItem(this.userKeyStorageName)||""}set userKey(e){var t,i;const n=this.getItem(this.userKeyStorageName)||this.prevUserKey;this.setItem(this.userKeyStorageName,e),null===(t=this.growingIO.emitter)||void 0===t||t.emit(Ce,{newUserKey:e,oldUserKey:n,userId:this.userId}),n!==e&&(null===(i=this.growingIO.emitter)||void 0===i||i.emit("USERKEY_UPDATE",{newUserKey:e,oldUserKey:n,userId:this.userId})),this.prevUserKey=e}get gioId(){return this.getItem(this.gioIdStorageName)||""}set gioId(e){var t;const i=this.getItem(this.gioIdStorageName)||this.prevGioId;this.setItem(this.gioIdStorageName,e),i!==e&&(null===(t=this.growingIO.emitter)||void 0===t||t.emit("GIOID_UPDATE",{newGioId:e,oldGioId:i})),this.prevGioId=e}}class ei{constructor(e){this.growingIO=e,this.main=()=>{var e,t;const{sdkVersion:i,useEmbeddedInherit:n,vdsConfig:r,userStore:s,dataStore:o,trackingId:a}=this.growingIO,{path:d,query:c}=o.currentPage;let l={appVersion:r.version,dataSourceId:r.dataSourceId,deviceId:s.uid,domain:n?r.appId:window.location.host,gioId:s.gioId,language:navigator.language,path:d,platform:r.platform,query:c,referralPage:(null===(e=o.lastPageEvent)||void 0===e?void 0:e.referralPage)||"",screenHeight:window.screen.height,screenWidth:window.screen.width,sdkVersion:i,sessionId:s.sessionId,timestamp:+Date.now(),title:null!==(t=J((()=>document.title.slice(0,255))))&&void 0!==t?t:"",userId:s.userId};if(r.enableIdMapping&&(l.userKey=s.userKey),F(r.ignoreFields)||r.ignoreFields.forEach((e=>{M(l,e)})),n&&!F(this.minpExtraParams)){const e=Object.assign({},l);W(Object.assign(Object.assign({},l),this.minpExtraParams),((t,i)=>{var n;L(r.embeddedIgnore,i)?(l[i]=e[i],"domain"===i&&(l[i]=window.location.host)):l[i]=null!==(n=this.minpExtraParams[i])&&void 0!==n?n:l[i]}))}return l.trackingId=a,l},this.minpExtraParams={}}}class ti{constructor(e){this.growingIO=e,this.parsePage=()=>{const{hashtag:e}=this.growingIO.vdsConfig,t=location.pathname,i=location.search,n=location.hash,r=n.indexOf("?");this.domain=window.location.host,this.title=document.title.slice(0,255),this.time=+Date.now(),this.path=t,this.query=i,e&&(r>-1?(this.path+=n.slice(0,r),this.query=this.query+"&"+n.slice(r+1)):this.path+=n),this.query&&L(["?","&"],this.query.charAt(0))&&(this.query=this.query.slice(1))},this._getNoHashHref=()=>{const{protocol:e,host:t,pathname:i,search:n}=window.location;return`${e}://${t}${i}${n}`},this.getReferralPage=()=>{var e,t;const{dataStore:{lastPageEvent:i}}=this.growingIO;return(null==i?void 0:i.path)===this.path&&(null!==(e=null==i?void 0:i.query)&&void 0!==e?e:"")===(null!==(t=this.query)&&void 0!==t?t:"")?null==i?void 0:i.referralPage:(null==i?void 0:i.path)?this.lastHref:document.referrer},this.pageListener=()=>{const{hashtag:e}=this.growingIO.vdsConfig;let t=window.location.href,i=this.lastHref;e||(t=this._getNoHashHref(),i=this.lastNoHashHref),i!==t&&(this.parsePage(),this.buildPageEvent())},this.hookHistory=()=>{const e=window.history.pushState,t=window.history.replaceState,i=this;e&&J((()=>window.history.pushState=function(){e.apply(window.history,arguments),setTimeout(i.pageListener)})),t&&J((()=>window.history.replaceState=function(){t.apply(window.history,arguments),setTimeout(i.pageListener)})),Y(window,"popstate",this.pageListener);const{hashtag:n}=this.growingIO.vdsConfig;n&&Y(window,"hashchange",this.pageListener)},this.buildPageEvent=e=>{const{dataStore:{lastPageEvent:t,eventContextBuilder:i,eventConverter:n}}=this.growingIO;let r=Object.assign(Object.assign({eventType:"PAGE"},i()),{protocolType:location.protocol.substring(0,location.protocol.length-1),referralPage:this.getReferralPage()});F(e)||(r=Object.assign(Object.assign({},r),e)),r.timestamp=this.time,n(r),this.lastHref=window.location.href,this.lastNoHashHref=this._getNoHashHref(),this.lastLocation=Object.assign({},window.location)},this.title=document.title.slice(0,255),this.lastLocation=Object.assign({},window.location)}}const ii={referralPage:document.referrer};class ni{constructor(r){var a,c,l;this.growingIO=r,this.ALLOW_SETTING=Object.assign(Object.assign({},t),"saas"===this.growingIO.gioEnvironment?n:i),this.allowOptKeys=Object.keys(this.ALLOW_SETTING),this.trackTimers={},this.setSequenceIds=(e,t)=>{let i=this.growingIO.storage.getItem(this.seqStorageIdName)||{};"gsid"===e?i.globalKey=t:i=Object.assign(Object.assign({},i),t),this.growingIO.storage.setItem(this.seqStorageIdName,i)},this.initOptions=t=>{var i,n,r,s,a,c,l;const{projectId:h,dataSourceId:u,appId:g}=t;this.initialDataSourceId=u;const p={};this.allowOptKeys.forEach((i=>{const n=this.ALLOW_SETTING[i].type;let r=_(n)?!L(n,$(t[i])):$(t[i])!==n;"platform"!==i||L(e,t[i])||(r=!0),r?p[i]=this.ALLOW_SETTING[i].default:"ignoreFields"===i?p.ignoreFields=t.ignoreFields.filter((e=>L(d,e))):(p[i]=t[i],L(["dataCollect","autotrack"],i)&&(p[i]||X("已关闭"+o[i],"info")))})),p.sessionExpires=Math.round(p.sessionExpires),(O(p.sessionExpires)||1>p.sessionExpires||p.sessionExpires>360)&&(p.sessionExpires=30),p.storageType=p.storageType.toLowerCase(),p.sendType=p.sendType.toLowerCase(),L(["beacon","xhr","image"],p.sendType)||(p.sendType="beacon"),!O(Number(p.requestTimeout))&&p.requestTimeout>0||(p.requestTimeout=5e3),this.growingIO.vdsConfig=Object.assign(Object.assign(Object.assign({},null!==(i=window.vds)&&void 0!==i?i:{}),p),{projectId:h,dataSourceId:u,appId:g,performance:{monitor:null===(r=null===(n=p.performance)||void 0===n?void 0:n.monitor)||void 0===r||r,exception:null===(a=null===(s=p.performance)||void 0===s?void 0:s.exception)||void 0===a||a,network:null!==(l=null===(c=p.performance)||void 0===c?void 0:c.network)&&void 0!==l&&l}}),window.vds=this.growingIO.vdsConfig,this.seqStorageIdName=h+"_gdp_sequence_ids",this.visitStorageName=h+"_gdp_session_id_sent"},this.setOption=(e,t)=>{var i;const{vdsConfig:n,callError:r,uploader:o,emitter:a}=this.growingIO,d=I(e)&&L(s,e),c=d&&typeof t===((null===(i=this.ALLOW_SETTING[e])||void 0===i?void 0:i.type)||"string"),l=Object.assign({},n);return d&&c?(n[e]=t,"dataCollect"===e&&l.dataCollect!==t&&(t?(this.sendVisit(!0),this.sendPage()):this.growingIO.clearTrackTimer()),L(["host","scheme"],e)&&(null==o||o.generateHost()),null==a||a.emit("OPTION_CHANGE",{optionName:e,optionValue:t}),window.vds[e]=t,!0):(r("setOption > "+e),!1)},this.getOption=e=>{const{vdsConfig:t,callError:i}=this.growingIO;return e&&B(t,k(e))?t[k(e)]:v(e)?Object.assign({},t):void i("getOption > "+e)},this.sendVisit=e=>{const{userStore:{sessionId:t},storage:i}=this.growingIO,n=i.getItem(this.visitStorageName);!e&&t===n||(this.lastVisitEvent.timestamp=this.currentPage.time-1,this.buildVisitEvent())},this.buildVisitEvent=e=>{const{dataStore:{eventContextBuilder:t,eventConverter:i},emitter:n,storage:r,userStore:s}=this.growingIO,{referralPage:o,title:a,path:d,query:c,timestamp:l}=this.lastVisitEvent;let h=Object.assign(Object.assign({eventType:"VISIT"},t()),{referralPage:o||this.currentPage.getReferralPage(),timestamp:l});d&&(h.title=a,h.path=d,h.query=c),F(e)||(h.session=(null==e?void 0:e.session)||h.session,h.trackingId=null==e?void 0:e.trackingId,h=Object.assign(Object.assign({},h),e));const u=({requestData:e})=>{"VISIT"===e.eventType&&e.trackingId===this.growingIO.trackingId&&(s.sessionId===e.sessionId&&r.setItem(this.visitStorageName,e.sessionId),n.off("onSendAfter",u))};n.on("onSendAfter",u),i(h)},this.sendPage=e=>{e&&this.currentPage.parsePage(),this.currentPage.buildPageEvent()},this.buildErrorEvent=e=>{const{dataStore:{eventContextBuilder:t,eventConverter:i}}=this.growingIO;i(Object.assign({eventType:"CUSTOM",pageShowTimestamp:this.currentPage.time,eventName:"onError",attributes:e},t()))},this.currentPage=new ti(this.growingIO),this.eventContextBuilderInst=new ei(this.growingIO),this.eventContextBuilder=this.eventContextBuilderInst.main,this.generalProps={},this.lastVisitEvent=ii,null===(a=this.growingIO.emitter)||void 0===a||a.on("onComposeAfter",(({composedEvent:e})=>{"VISIT"!==e.eventType&&"vst"!==e.t||e.trackingId!==this.growingIO.trackingId||(this.lastVisitEvent=e)})),this.lastPageEvent={},null===(c=this.growingIO.emitter)||void 0===c||c.on("onComposeAfter",(({composedEvent:e})=>{"PAGE"!==e.eventType&&"page"!==e.t||e.trackingId!==this.growingIO.trackingId||(this.lastPageEvent=e)})),null===(l=this.growingIO.emitter)||void 0===l||l.on(Se,(()=>{if(this.growingIO.gioSDKInitialized){this.currentPage.parsePage();const{title:e,path:t,query:i,time:n,getReferralPage:r}=this.currentPage;this.lastVisitEvent={referralPage:document.referrer||r(),title:e,path:t,query:i,timestamp:n-1},this.sendVisit(!0),this.sendPage(!0)}}))}get esid(){const e=this.growingIO.storage.getItem(this.seqStorageIdName)||{};let t=Object.assign({},e);return M(t,"globalKey"),t=y(t)&&!v(t)?t:{},this._esid={},K(t).forEach((e=>{this._esid[e]=O(Number(t[e]))||t[e]>=1e9||1>t[e]?1:t[e]})),this._esid}set esid(e){const t={};K(e).forEach((i=>{t[i]=O(e[i])||e[i]>=1e9||1>e[i]?1:e[i]})),V(this._esid,t)||(this._esid=t,this.setSequenceIds("esid",this._esid))}get gsid(){const e=this.growingIO.storage.getItem(this.seqStorageIdName)||{},t=Number(e.globalKey);return this._gsid=O(t)||t>=1e9||1>t?1:t,this._gsid}set gsid(e){O(Number(e))||e>=1e9||1>e?this._gsid=1:this._gsid=e,this.setSequenceIds("gsid",this._gsid)}}class ri extends ni{constructor(e){super(e),this.growingIO=e,this.eventConverter=e=>{var t;const{vdsConfig:i,dataStore:n,uploader:r}=this.growingIO;if(i.dataCollect){e.trackingId===this.growingIO.trackingId&&(e.globalSequenceId=n.gsid,e.eventSequenceId=n.esid[e.eventType]||1);const i={};W(e,((e,t)=>{var n;if("element"===t){const t=null!==(n=N(e))&&void 0!==n?n:{};W(t,((e,t)=>{F(e)&&0!==e||(i[t]=e)}))}else(F(e)||v(e))&&0!==e||(i[t]=e)})),e.trackingId===this.growingIO.trackingId&&(this.growingIO.dataStore.gsid+=1,this.growingIO.dataStore.esid=Object.assign(Object.assign({},this.growingIO.dataStore.esid),{[i.eventType]:(this.growingIO.dataStore.esid[i.eventType]||1)+1})),null===(t=this.growingIO.emitter)||void 0===t||t.emit("onComposeAfter",{composedEvent:Object.assign({},i)}),e.trackingId===this.growingIO.trackingId&&r.commitRequest(i)}else"VISIT"===e.eventType&&(this.lastVisitEvent=e)}}}class si{constructor(e){this.growingIO=e,this.getSendType=()=>{const{sendType:e}=this.growingIO.vdsConfig;return"beacon"===e?(()=>{var e;const t=!!(null===(e=null===window||void 0===window?void 0:window.navigator)||void 0===e?void 0:e.sendBeacon),i=window.navigator.userAgent;if(i.match(/(iPad|iPhone|iPod)/g)){const e=(e=>{const t=e.toLowerCase().match(/cpu.*os (.*?) like mac os/i);return!t||2>t.length?0:+t[1].split("_").slice(0,2).join(".")})(i);return t&&e>13}return t})()?"beacon":"xhr":e},this.commitRequest=e=>{const t=Object.assign({},e);this.requestQueue.push(Object.assign(Object.assign({},t),{requestType:this.getSendType()})),this.initiateRequest()},this.initiateRequest=()=>{var e,t;if([...this.requestQueue].length>0&&this.requestingNum(this.retryIds[e.globalSequenceId||e.esid]||0)<=this.retryLimit)),F(this.requestQueue))return;const o=this.requestQueue.shift(),{requestType:a}=o;null==n||n.emit("onSendBefore",{requestData:Object.assign({},o)});const d=Object.assign({},o);if(M(d,["requestType","trackingId"]),i.debug&&console.log("[GrowingIO Debug]:",JSON.stringify(d,null,2).replace(/\"/g,(()=>{const e=window.navigator.userAgent;return/(\d+\.\d)?(?:\.\d)?\s+safari\/?(\d+\.\d+)?/i.test(e)&&!/chrome\/(\d+\.\d+)/i.test(e)})()?"":'"')),this.requestingNum+=1,s)return this.requestSuccessFn(o),!1;let c=Object.assign({},d);switch(i.compress&&(null==r?void 0:r.gioCompress)?"image"===a?(this.compressType="11",c=null===(e=null==r?void 0:r.gioCompress)||void 0===e?void 0:e.compressToEncodedURIComponent(JSON.stringify([c]))):(this.compressType="1",c=null===(t=null==r?void 0:r.gioCompress)||void 0===t?void 0:t.compressToUint8Array(JSON.stringify([c]))):(this.compressType="0",c=JSON.stringify([c])),a){case"beacon":default:this.sendByBeacon(o,c);break;case"xhr":this.sendByXHR(o,c);break;case"image":this.sendByImage(o,c)}}},this.generateURL=()=>`${this.requestURL}?stm=${+Date.now()}&compress=${this.compressType}`,this.sendByBeacon=(e,t)=>{navigator.sendBeacon(this.generateURL(),t)?this.requestSuccessFn(e):this.requestFailFn(e,"beacon")},this.sendByXHR=(e,t)=>{const i=new XMLHttpRequest;if(i)return i.open("POST",this.generateURL(),!0),i.onload=()=>{204===i.status?this.requestSuccessFn(e):this.requestFailFn(e,"xhr")},i.ontimeout=i.onerror=i.onabort=()=>{this.requestFailFn(e,"xhr")},i.setRequestHeader("Content-Type","text/plain;charset=UTF-8"),i.timeout=this.growingIO.vdsConfig.requestTimeout,void i.send(t);if(null===window||void 0===window?void 0:window.XDomainRequest){const i=new window.XDomainRequest;i.open("POST",this.generateURL().replace("https://","http://"),!0),i.onload=()=>{204===i.status?this.requestSuccessFn(e):this.requestFailFn(e,"xhr")},i.onerror=i.ontimeout=()=>{this.requestFailFn(e,"xhr")},i.send(t)}},this.sendByImage=(e,t)=>{const i=`${this.generateURL()}&data=${t}`;let n=document.createElement("img");n.width=1,n.height=1;let r=window.setTimeout((()=>{this.requestingNum-=1,this.clearImage(n),window.clearTimeout(r),r=null,this.initiateRequest()}),this.growingIO.vdsConfig.requestTimeout);n.onload=()=>{this.requestSuccessFn(e),this.clearImage(n),window.clearTimeout(r),r=null},n.onerror=n.onabort=()=>{this.requestSuccessFn(e),this.clearImage(n),window.clearTimeout(r),r=null},n.src=i},this.clearImage=e=>{e.src="",e.onload=()=>{},e.onerror=e.onabort=()=>{},e=null},this.requestSuccessFn=e=>{var t;this.requestingNum-=1;const i=e.globalSequenceId||e.esid||-1;this.retryIds[i]&&(this.retryIds[i]=0),e.trackingId===this.growingIO.trackingId&&this.growingIO.userStore.sessionId===e.sessionId&&(this.growingIO.userStore.sessionId=e.sessionId),null===(t=this.growingIO.emitter)||void 0===t||t.emit("onSendAfter",{requestData:Object.assign({},e)}),this.initiateRequest()},this.requestFailFn=(e,t)=>{this.requestingNum-=1;const i=e.globalSequenceId||e.esid||-1;this.retryIds[i]||(this.retryIds[i]=0),this.retryIds[i]+=1;const n=this.requestQueue.some((t=>t.globalSequenceId===e.globalSequenceId&&t.esid===e.esid));let r=t;if(this.retryIds[i]{this.requestQueue.push(Object.assign(Object.assign({},e),{requestType:r})),this.initiateRequest(),window.clearTimeout(t),t=null}),800)}this.initiateRequest()},this.requestQueue=[],this.requestLimit=10,this.requestTimeout=5e3,this.retryLimit=2,this.retryIds={},this.requestingNum=0,this.requestURL=""}}class oi extends si{constructor(e){super(e),this.growingIO=e,this.generateHost=()=>{let{scheme:e,host:t="",projectId:i}=this.growingIO.vdsConfig;e?q(k(e),"://")||(e+="://"):e=(location.protocol.indexOf("http")>-1?location.protocol.replace(":",""):"https")+"//",G(t,"http")&&(t=t.substring(t.indexOf("://")+(q(k(e),"://")?3:0))),this.requestURL=`${e}${t}/v3/projects/${i}/collect`},this.requestURL="",this.generateHost()}}class ai extends Yt{constructor(){super(),this.registerPlugins=e=>{_(e)?(e.forEach(((t,i)=>{var n,r;F(t)||v(t)?X("插件不合法,跳过加载!","warn"):(null===(n=t.js)||void 0===n?void 0:n.default)&&(e[i]=Object.assign(Object.assign({},null===(r=t.js)||void 0===r?void 0:r.default),{options:t.options}))})),e=A(e),this.plugins.installAll(e)):X("插件注册失败,请检查!","error")},this.initCallback=()=>{this.uploader=new oi(this),this.userStore=new Qt(this)},this.getPlugins=()=>this.plugins.pluginItems,this.setTrackerScheme=e=>{L(["http","https"],e)?(this.dataStore.setOption("scheme",e),this.notRecommended()):this.callError("scheme",!1)},this.setTrackerHost=e=>{ie.test(e)||ne.test(e)?(this.dataStore.setOption("host",e),this.notRecommended()):this.callError("host",!1)},this.setDataCollect=e=>{this.setOption("dataCollect",!!e),this.notRecommended()},this.setAutotrack=e=>{this.setOption("autotrack",!!e),this.notRecommended()},this.enableDebug=e=>{this.setOption("debug",!!e),this.notRecommended()},this.enableHT=e=>{this.setOption("hashtag",!!e),this.notRecommended()},this.getVisitorId=()=>this.userStore.uid,this.getDeviceId=()=>this.userStore.uid,this.setUserAttributes=(e,t)=>{var i,n;!F(e)&&y(e)?null===(n=null===(i=this.plugins)||void 0===i?void 0:i.gioCustomTracking)||void 0===n||n.buildUserAttributesEvent(e,t):this.callError("setUserAttributes")},this.setUserId=(e,t)=>{if(te(k(e).trim())){const i=this.userStore.gioId;this.vdsConfig.enableIdMapping&&(this.userStore.userKey=!v(t)&&k(t).length>0?k(t).slice(0,1e3):""),this.userStore.userId=k(e).slice(0,1e3),i&&i!==this.userStore.userId&&(this.userStore.sessionId="")}else this.clearUserId(),this.callError("setUserId")},this.clearUserId=()=>{this.userStore.userId="",this.userStore.userKey=""},this.track=(e,t,i,n)=>{var r,s;((null===(s=null===(r=this.plugins)||void 0===r?void 0:r.gioCustomTracking)||void 0===s?void 0:s.buildCustomEvent)||function(){})(e,Object.assign(Object.assign({},this.dataStore.generalProps),y(t)&&!F(t)?t:{}),i,n)},this.sendPage=e=>this.dataStore.currentPage.buildPageEvent(e),this.sendVisit=e=>this.dataStore.buildVisitEvent(e),this.trackTimerStart=(e,t)=>{this.vdsConfig.dataCollect&&Q(e,(()=>{const i=oe();E(t)?(this.dataStore.trackTimers[i]={eventName:e,leng:0,start:+Date.now()},t(i)):X("回调方法不合法,返回timerId失败!")}))},this.trackTimerPause=e=>{if(e&&this.dataStore.trackTimers[e]){const t=this.dataStore.trackTimers[e];t.start&&(t.leng=t.leng+(+Date.now()-t.start)),t.start=0}},this.trackTimerResume=e=>{if(e&&this.dataStore.trackTimers[e]){const t=this.dataStore.trackTimers[e];0===t.start&&(t.start=+Date.now())}},this.trackTimerEnd=(e,t)=>{if(this.vdsConfig.dataCollect){const i=864e5;if(e&&this.dataStore.trackTimers[e]){const n=this.dataStore.trackTimers[e];if(0!==n.start){const e=+Date.now()-n.start;n.leng=e>0?n.leng+e:0}this.track(n.eventName,Object.assign(Object.assign({},t),{event_duration:n.leng>i?0:n.leng/1e3})),this.removeTimer(e)}else X("未查找到对应的计时器,请检查!","error")}},this.removeTimer=e=>{e&&this.dataStore.trackTimers[e]&&delete this.dataStore.trackTimers[e]},this.clearTrackTimer=()=>{this.dataStore.trackTimers={}},this.dataStore=new ri(this)}}let di;return function(){var e,t,i,n,s;let o=window.gioCompatibilityVds?"gdp_vds":"vds";if(null===(e=window[o])||void 0===e?void 0:e.gioSDKInstalled)return di=window.gdp,void X("SDK重复加载,请检查是否重复加载SDK或接入其他平台SDK导致冲突!","warn");window[o]=Object.assign(Object.assign({},null!==(t=window[o])&&void 0!==t?t:{}),{gioSDKInstalled:!0});const d=new ai;di=function(){var e;const t=arguments[0];if(I(t)&&L(r,t)&&d[t]){const e=x(R(arguments));if("init"===t){const t=(e=>{var t;return e.vdsConfig||e.gioSDKInitialized||(null===(t=window.vds)||void 0===t?void 0:t.gioSDKInitialized)?(X("SDK重复初始化,请检查是否重复加载SDK或接入其他平台SDK导致冲突!","warn"),!1):!(L(["","localhost","127.0.0.1"],location.hostname)&&!window._gr_ignore_local_rule&&(X("当前SDK不允许在本地环境初始化!","warn"),1))})(d);if(!t)return;const i=(e=>!F(A(e))||(X('SDK初始化失败,请使用 gdp("init", "您的GrowingIO项目 accountId", "您项目的 dataSourceId", options); 进行初始化!',"error"),!1))(e);if(!i)return;const n=(e=>{const t=N(e);let i=C(e);return te(k(t).trim())?(y(i)&&i||(i={}),{projectId:t,userOptions:i}):(X("SDK初始化失败,accountId 参数不合法!","error"),!1)})(e);if(!n)return;const r=(e=>{const t=e[1],i=e[2],n=C(e);return t&&I(t)?{dataSourceId:t,appId:I(i)?i:"",cdpOptions:n}:(X("SDK初始化失败,dataSourceId 参数不合法!","error"),!1)})(e);if(!r)return;const{projectId:s}=n,{dataSourceId:o,appId:a,cdpOptions:c}=r;d.init(Object.assign(Object.assign({},c),{projectId:s,dataSourceId:o,appId:a}))}else if("registerPlugins"===t)d.registerPlugins(e[0]);else{if(d.gioSDKInitialized&&d.vdsConfig)return d[t](...e);d.emitter.emit("UNINITIALIZED_CALL",arguments),X("SDK未初始化!","error")}}else L(a,t)?X(`方法 ${k(t)} 已被弃用,请移除!`,"warn"):X(`不存在名为 ${k(t)} 的方法调用!`,"error");window[o]=Object.assign(Object.assign({},window[o]),{_gr_ignore_local_rule:null!==(e=window._gr_ignore_local_rule)&&void 0!==e&&e,gioEnvironment:"cdp",gioSDKVersion:d.sdkVersion,gioSDKFull:d.gioSDKFull,canIUse:e=>L(r,e)&&d[e]})};const c=null===(i=null===window||void 0===window?void 0:window.gdp)||void 0===i?void 0:i.q,l=null===(n=null===window||void 0===window?void 0:window.gdp)||void 0===n?void 0:n.e,h=null===(s=null===window||void 0===window?void 0:window.gdp)||void 0===s?void 0:s.ef;window.gdp=di,window.gdp.e=l,window.gdp.ef=h,_(c)&&!F(c)&&c.forEach((e=>{di.apply(null,e)}))}(),di})); +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).gdp=t()}(this,(function(){"use strict";const e=["web","wxwv","minp","alip","baidup","qq","bytedance"],t={autotrack:{type:"boolean",default:!0},compress:{type:"boolean",default:!0},dataCollect:{type:"boolean",default:!0},debug:{type:"boolean",default:!1},hashtag:{type:"boolean",default:!1},touch:{type:"boolean",default:!1},version:{type:"string",default:"1.0.0"},platform:{type:"string",default:"web"},cookieDomain:{type:"string",default:""},sendType:{type:"string",default:"beacon"}},i={enableIdMapping:{type:"boolean",default:!1},gtouchHost:{type:"string",default:""},host:{type:"string",default:"napi.growingio.com"},ignoreFields:{type:"array",default:[]},penetrateHybrid:{type:"boolean",default:!0},scheme:{type:"string",default:location.protocol.indexOf("http")>-1?location.protocol.replace(":",""):"https"},sessionExpires:{type:"number",default:30},performance:{type:"object",default:{monitor:!0,exception:!0}},embeddedIgnore:{type:"array",default:[]},storageType:{type:"string",default:"cookie"},requestTimeout:{type:"number",default:5e3}},n={},r=["clearUserId","getGioInfo","getLocation","getOption","init","setDataCollect","setOption","setUserId","track","setGeneralProps","clearGeneralProps","enableDebug","enableHT","setAutotrack","setTrackerHost","setTrackerScheme","setUserAttributes","getVisitorId","getDeviceId","registerPlugins","getPlugins","sendPage","sendVisit","trackTimerStart","trackTimerPause","trackTimerResume","trackTimerEnd","removeTimer","clearTrackTimer","updateImpression"],s=["autotrack","dataCollect","dataSourceId","debug","host","hashtag","scheme"],o={autotrack:"无埋点采集",dataCollect:"数据采集",debug:"调试模式"},a=["send","setConfig","collectImp","setPlatformProfile"],d=["screenHeight","screenWidth"],c={click:"VIEW_CLICK",change:"VIEW_CHANGE",submit:"FORM_SUBMIT"};var l,h,u,g,p,f="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},m="function"==typeof Array.from?Array.from:(h||(h=1,u=function(e){return"function"==typeof e},g=function(e){var t=function(e){var t=Number(e);return isNaN(t)?0:0!==t&&isFinite(t)?(t>0?1:-1)*Math.floor(Math.abs(t)):t}(e);return Math.min(Math.max(t,0),9007199254740991)},p=function(e){var t=e.next();return!t.done&&t},l=function(e){var t,i,n,r=this,s=arguments.length>1?arguments[1]:void 0;if(void 0!==s){if(!u(s))throw new TypeError("Array.from: when provided, the second argument must be a function");arguments.length>2&&(t=arguments[2])}var o=function(e,t){if(null!=e&&null!=t){var i=e[t];if(null==i)return;if(!u(i))throw new TypeError(i+" is not a function");return i}}(e,function(e){if(null!=e){if(["string","number","boolean","symbol"].indexOf(typeof e)>-1)return Symbol.iterator;if("undefined"!=typeof Symbol&&"iterator"in Symbol&&Symbol.iterator in e)return Symbol.iterator;if("@@iterator"in e)return"@@iterator"}}(e));if(void 0!==o){i=u(r)?Object(new r):[];var a,d,c=o.call(e);if(null==c)throw new TypeError("Array.from requires an array-like or iterable object");for(n=0;;){if(!(a=p(c)))return i.length=n,i;d=a.value,i[n]=s?s.call(t,d,n):d,n++}}else{var l=Object(e);if(null==e)throw new TypeError("Array.from requires an array-like object - not null or undefined");var h,f=g(l.length);for(i=u(r)?Object(new r(f)):Array(f),n=0;f>n;)h=l[n],i[n]=s?s.call(t,h,n):h,n++;i.length=f}return i}),l);const v=e=>L(["undefined","null"],$(e)),I=e=>"string"===$(e),w=e=>"number"===$(e),O=e=>"NaN"===k(Number(e)),b=e=>"boolean"===$(e),y=e=>"object"===$(e)&&!v(e),T=e=>"regexp"===$(e),E=e=>L(["function","asyncfunction"],$(e)),_=e=>Array.isArray(e)&&"array"===$(e),S=e=>"date"===$(e),N=e=>{try{return R(e)[0]}catch(e){return}},C=e=>{try{const t=R(e);return t[t.length-1]}catch(e){return}},x=(e,t=1)=>_(e)&&w(t)?e.slice(t>0?t:1,e.length):e,A=e=>{if(_(e)){let t=0;const i=[];for(const n of e)n&&!F(n)&&(i[t++]=n);return i}return e},P=(e,t)=>e[D(e,t)],D=(e,t)=>{let i=-1;return _(e)&&e.every(((e,n)=>!t(e)||(i=n,!1))),i},L=(e,t)=>("array"===$(e)||"string"===$(e))&&e.indexOf(t)>=0,R=m,k=e=>v(e)?"":""+e,U=(e,t)=>"string"==typeof e?e.split(t):e,j=e=>{if(I(e)){const t=U(e,"");return`${N(t).toLowerCase()}${x(t).join("")}`}return e},G=(e,t)=>!!I(e)&&e.slice(0,t.length)===t,q=(e,t)=>{if(I(e)){const{length:i}=e;let n=i;n>i&&(n=i);const r=n;return n-=t.length,n>=0&&e.slice(n,r)===t}return!1},H={}.hasOwnProperty,B=(e,t)=>!v(e)&&H.call(e,t),K=e=>y(e)?Object.keys(e):[],W=(e,t)=>{K(e).forEach((i=>t(e[i],i)))},V=(e,t)=>{const i=K(e);return!(!y(e)||!y(t)||i.length!==K(t).length||L(i.map(((i,n)=>y(e[i])?V(e[i],t[i]):e[i]===t[i])),!1))},M=(e,t)=>{if(!y(e))return!1;try{return"string"===$(t)?delete e[t]:"array"===$(t)?t.map((t=>delete e[t])):(T(t)&&K(e).forEach((i=>{t.test(i)&&M(e,i)})),!0)}catch(e){return!1}},F=e=>_(e)?0===e.length:y(e)?0===K(e).length:!e,$=e=>({}.toString.call(e).slice(8,-1).toLowerCase());var z=Object.freeze({__proto__:null,isNil:v,isString:I,isNumber:w,isNaN:O,isBoolean:b,isObject:y,isRegExp:T,isFunction:E,isArray:_,isDate:S,fixed:(e,t)=>w(e)?Number(e.toFixed(w(t)?t:2)):I(e)&&"NaN"!==k(Number(e))?Number(Number(e).toFixed(w(t)?t:2)):e,head:N,last:C,drop:x,dropWhile:(e,t)=>_(e)?e.filter((e=>!t(e))):e,compact:A,find:P,findIndex:D,includes:L,arrayFrom:R,toString:k,split:U,lowerFirst:j,upperFirst:e=>{if(I(e)){const t=U(e,"");return`${N(t).toUpperCase()}${x(t).join("")}`}return e},startsWith:G,endsWith:q,has:B,keys:K,forEach:W,isEqual:V,get:(e,t,i)=>{let n=e;return y(e)?(t.split(".").forEach((e=>{n=n?n[e]:i})),n):i},unset:M,isEmpty:F,typeOf:$,formatDate:e=>{if(S(e)){const t=e=>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())}return e}});const X=(e,t)=>{console.log("%c [GrowingIO]:"+e,{info:"color: #3B82F6;",error:"color: #EF4444;",warn:"color: #F59E0B;",success:"color: #10B981;"}[t]||"")},J=e=>{try{return e()}catch(e){return}},Z=e=>{const t={};return y(e)&&W(e,((e,i)=>{var n;const r=k(i).slice(0,100);y(e)?t[r]=Z(e):_(e)?(t[r]=e.slice(0,100),"cdp"===(null===(n=window.vds)||void 0===n?void 0:n.gioEnvironment)&&(t[r]=t[r].join("||").slice(0,1e3))):t[r]=v(e)?"":k(e).slice(0,1e3)})),t},Y=(e,t,i,n={})=>{document.addEventListener?e.addEventListener(t,i,Object.assign(Object.assign({},{capture:!0}),n)):e.attachEvent?e.attachEvent("on"+t,i):e["on"+t]=i},Q=(e,t)=>I(e)&&!F(e)&&e.match(/^[a-zA-Z_][0-9a-zA-Z_]{0,100}$/)?t():(X("事件名格式不正确,只能包含数字、字母和下划线,且不能以数字开头,字符总长度不能超过100!","error"),!1);var ee=Object.freeze({__proto__:null,consoleText:X,niceTry:J,limitObject:Z,addListener:Y,flattenObject:(e={})=>{const t=Object.assign({},e);return K(t).forEach((e=>{y(t[e])?(K(t[e]).forEach((i=>{t[`${e}_${i}`]=k(t[e][i])})),M(t,e)):_(t[e])?(t[e].forEach(((i,n)=>{y(i)?K(i).forEach((r=>{t[`${e}_${n}_${r}`]=k(i[r])})):t[`${e}_${n}`]=k(i)})),M(t,e)):v(t[e])||""===t[e]?M(t,e):t[e]=k(t[e])})),Z(t)},eventNameValidate:Q,getGioFunction:()=>{var e,t,i,n;const r=window._gio_local_vds||"vds",s=null!==(t=null===(e=window[r])||void 0===e?void 0:e.namespace)&&void 0!==t?t:"gdp";return E(window[s])?window[s]:null!==(n=null!==(i=window.gdp)&&void 0!==i?i:window.gio)&&void 0!==n?n:function(){}}});const te=e=>I(e)&&e.length>0||w(e)&&e>0,ie=/^((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})(\.((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})){3}/i,ne=/^(https?:\/\/)|(([a-zA-Z0-9_-])+(\.)?)*(:\d+)?(\/((\.)?(\?)?=?&?[a-zA-Z0-9_-](\?)?)*)*$/i;function re(e){for(var t=1;arguments.length>t;t++){var i=arguments[t];for(var n in i)e[n]=i[n]}return e}var se=function e(t,i){function n(e,n,r){if("undefined"!=typeof document){"number"==typeof(r=re({},i,r)).expires&&(r.expires=new Date(Date.now()+864e5*r.expires)),r.expires&&(r.expires=r.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var s="";for(var o in r)r[o]&&(s+="; "+o,!0!==r[o]&&(s+="="+r[o].split(";")[0]));return document.cookie=e+"="+t.write(n,e)+s}}return Object.create({set:n,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var i=document.cookie?document.cookie.split("; "):[],n={},r=0;r"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)})),ae=e=>q(e,"_gioenc")?e.slice(0,-7):e,de=e=>O(Number(e))&&J((()=>JSON.parse(e)))||e,ce={A:1,a:1,Z:1,z:1,"@":1,"{":1},le=e=>v(e)?e:J((()=>"gioenc-"+ue(e)))||e,he=e=>I(e)&&G(e,"gioenc-")&&J((()=>ue(e.replace("gioenc-",""))))||e,ue=e=>(e=e||"").split("").map((e=>ce[e]?e:ge(e))).join(""),ge=e=>{if(/[0-9]/.test(e))return 1^+e;{let t=e.charCodeAt(0);return String.fromCharCode(1^t)}};class pe{constructor(e){this.domain=e,this.getItem=e=>de(he(se.get(ae(e),{domain:this.domain,path:"/"}))),this.setItem=(e,t,i)=>{let n;n=I(t)?t.length?q(e,"_gioenc")?le(t):t:"":JSON.stringify(t),se.set(ae(e),n,{expires:i?new Date(i):3650,domain:this.domain,path:"/"})},this.removeItem=e=>{se.remove(ae(e),{domain:this.domain,path:"/"})},this.hasItem=e=>L(K(se.get()),ae(e)),this.getKeys=()=>K(se.get()),this.type="Cookie"}}class fe{constructor(){this.getItem=e=>{const t=J((()=>JSON.parse(localStorage.getItem(ae(e))||"")))||{};return y(t)&&t.expiredAt>+Date.now()?de(he(t.value)):void 0},this.setItem=(e,t,i)=>{const n=null!=i?i:+new Date(9999,12);localStorage.setItem(ae(e),JSON.stringify({value:I(t)&&t.length&&q(e,"_gioenc")?le(t):t,expiredAt:n}))},this.removeItem=e=>localStorage.removeItem(ae(e)),this.hasItem=e=>!!localStorage.getItem(ae(e)),this.getKeys=()=>R(Array(localStorage.length)).map(((e,t)=>localStorage.key(t))),this.type="localStorage"}}const me={};class ve{constructor(){this.getItem=e=>{const t=J((()=>JSON.parse(me[ae(e)]||"")));return y(t)&&t.expiredAt>+Date.now()?de(he(t.value)):void 0},this.setItem=(e,t,i)=>{const n=null!=i?i:+new Date(9999,12);me[ae(e)]=JSON.stringify({value:I(t)&&t.length?le(t):t,expiredAt:n})},this.removeItem=e=>M(me,ae(e)),this.hasItem=e=>B(me,ae(e)),this.getKeys=()=>K(me),this.type="memory"}}let Ie;const we=/^(\.ac\.|\.br\.|\.co\.|\.com\.|\.edu\.|\.gov\.|\.org\.|\.net\.)/,Oe=e=>{const t=[];try{const i=e.split("."),n=C(i);if(i.length>=2&&(isNaN(Number(n))||0>Number(n)||Number(n)>255)){const e="."+i.slice(-2).join(".");we.test(e)?Ie=e:t.push(e);const n="."+i.slice(-3).join(".");we.test(n)||L(t,n)||t.push(n);const r="."+i.slice(-4).join(".");we.test(r)||L(t,r)||t.push(r)}}catch(e){}return t},be=e=>{let t="";return e.every((e=>!ye(e)||(t=e,!1))),t},ye=e=>{try{se.set("gioCookie","yes",{domain:e});const t=!!se.get("gioCookie",{domain:e});return se.remove("gioCookie",{domain:e}),t}catch(e){return!1}},Te=e=>{let t,i,n,{storageType:r,cookieDomain:s,projectId:o}=e;if(L(["cookie","localstorage"],r)||(r="cookie"),"cookie"===r&&(n=navigator.userAgent.indexOf("Electron")>-1||L(["","localhost","127.0.0.1"],window.location.hostname)||!L(["http:","https:"],window.location.protocol)?"":be([...Oe(window.location.hostname),window.location.hostname]),i=!!n),"cookie"===r&&i){const e=new pe(n);if(s){let t=Oe(s);const i=be(F(t)?[]:[s,...Oe(s)]);i&&ye(i)?e.domain=i:X("指定Cookie域无效或无权限,使用默认域!","warn")}t=e}else t=(()=>{try{const e=window.localStorage,t="__storage_test__";return e.setItem(t,t),e.removeItem(t),!0}catch(e){return!1}})()?new fe:new ve;return"cookie"===r&&Ie&&ye(Ie)&&((e,t,i)=>{if(t&&ye(t)){let n=new pe(t);[i+"_gdp_session_id","gdp_user_id_gioenc",i+"_gdp_cs1_gioenc",i+"_gdp_user_key_gioenc",i+"_gdp_gio_id_gioenc",i+"_gdp_sequence_ids",i+"_gdp_session_id_sent"].forEach((t=>{const i=n.getItem(t);n.hasItem(t)&&(e.setItem(t,i),n.removeItem(t))})),n=void 0}})(t,Ie,o),t};var Ee="OPTION_INITIALIZED",_e="SDK_INITIALIZED",Se="SESSIONID_UPDATE",Ne="SET_USERID",Ce="SET_USERKEY",xe={name:"gioCompress",method:class{constructor(e){this.growingIO=e,this._compress=(e,t,i)=>{if(null===e)return"";let n,r,s,o={},a={},d="",c="",l="",h=2,u=3,g=2,p=[],f=0,m=0;for(s=0;sl.charCodeAt(0)){for(n=0;g>n;n++)f<<=1,m===t-1?(m=0,p.push(i(f)),f=0):m++;for(r=l.charCodeAt(0),n=0;8>n;n++)f=f<<1|1&r,m===t-1?(m=0,p.push(i(f)),f=0):m++,r>>=1}else{for(r=1,n=0;g>n;n++)f=f<<1|r,m===t-1?(m=0,p.push(i(f)),f=0):m++,r=0;for(r=l.charCodeAt(0),n=0;16>n;n++)f=f<<1|1&r,m===t-1?(m=0,p.push(i(f)),f=0):m++,r>>=1}h--,0===h&&(h=Math.pow(2,g),g++),delete a[l]}else for(r=o[l],n=0;g>n;n++)f=f<<1|1&r,m===t-1?(m=0,p.push(i(f)),f=0):m++,r>>=1;h--,0===h&&(h=Math.pow(2,g),g++),o[c]=u++,l=d+""}if(""!==l){if({}.hasOwnProperty.call(a,l)){if(256>l.charCodeAt(0)){for(n=0;g>n;n++)f<<=1,m===t-1?(m=0,p.push(i(f)),f=0):m++;for(r=l.charCodeAt(0),n=0;8>n;n++)f=f<<1|1&r,m===t-1?(m=0,p.push(i(f)),f=0):m++,r>>=1}else{for(r=1,n=0;g>n;n++)f=f<<1|r,m===t-1?(m=0,p.push(i(f)),f=0):m++,r=0;for(r=l.charCodeAt(0),n=0;16>n;n++)f=f<<1|1&r,m===t-1?(m=0,p.push(i(f)),f=0):m++,r>>=1}h--,0===h&&(h=Math.pow(2,g),g++),delete a[l]}else for(r=o[l],n=0;g>n;n++)f=f<<1|1&r,m===t-1?(m=0,p.push(i(f)),f=0):m++,r>>=1;h--,0===h&&(h=Math.pow(2,g),g++)}for(r=2,n=0;g>n;n++)f=f<<1|1&r,m===t-1?(m=0,p.push(i(f)),f=0):m++,r>>=1;for(;;){if(f<<=1,m===t-1){p.push(i(f));break}m++}return p.join("")},this.compress=e=>{const t=this;return this._compress(e,16,(function(e){return t.f(e)}))},this.compressToUTF16=e=>{const t=this;return null===e?"":this._compress(e,15,(function(e){return t.f(e+32)}))+" "},this.compressToUint8Array=e=>{const t=this.compress(e),i=new Uint8Array(2*t.length);for(let e=0,n=t.length;n>e;e++){const n=t.charCodeAt(e);i[2*e]=n>>>8,i[2*e+1]=n%256}return i},this.compressToEncodedURIComponent=e=>{if(null===e)return"";const t=this;return this._compress(e,6,(function(e){return t.keyStrUriSafe.charAt(e)}))},this.f=String.fromCharCode,this.keyStrUriSafe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$"}}},Ae={name:"gioCustomTracking",method:class{constructor(e){this.growingIO=e,this.getValidResourceItem=e=>{if(e&&y(e)&&e.id&&e.key){const t={id:I(e.id)?e.id:k(e.id),key:I(e.key)?e.key:k(e.key)};return e.attributes&&(t.attributes=e.attributes),t}},this.getDynamicAttributes=e=>(v(e)||K(e).forEach((t=>{E(e[t])?e[t]=e[t]():y(e[t])?M(e,t):_(e[t])||(e[t]=k(e[t]))})),e),this.buildCustomEvent=(e,t,i,n)=>{Q(e,(()=>{const{dataStore:{eventContextBuilder:r,eventConverter:s,currentPage:o}}=this.growingIO;let a=Object.assign({eventType:"CUSTOM",eventName:e,pageShowTimestamp:null==o?void 0:o.time,attributes:Z(this.getDynamicAttributes(y(t)&&!F(t)?t:void 0)),resourceItem:Z(this.getValidResourceItem(i))},r());F(n)||(a=Object.assign(Object.assign({},a),n)),s(a)}))},this.buildUserAttributesEvent=(e,t)=>{const{dataStore:{eventContextBuilder:i,eventConverter:n}}=this.growingIO;let r=Object.assign({eventType:"LOGIN_USER_ATTRIBUTES",attributes:Z(e)},i());F(t)||(r=Object.assign(Object.assign({},r),t)),n(r)}}}},Pe={},De={}.hasOwnProperty;function Le(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(e){return null}}function Re(e){try{return encodeURIComponent(e)}catch(e){return null}}Pe.stringify=function(e,t){t=t||"";var i,n,r=[];for(n in"string"!=typeof t&&(t="?"),e)if(De.call(e,n)){if((i=e[n])||null!=i&&!isNaN(i)||(i=""),n=Re(n),i=Re(i),null===n||null===i)continue;r.push(n+"="+i)}return r.length?t+r.join("&"):""},Pe.parse=function(e){for(var t,i=/([^=?#&]+)=?([^&]*)/g,n={};t=i.exec(e);){var r=Le(t[1]),s=Le(t[2]);null===r||null===s||r in n||(n[r]=s)}return n};const ke={gioprojectid:"projectId",giodatacollect:"dataCollect",gioappid:"domain",giodatasourceid:"dataSourceId",gios:"sessionId",giou:"uid",giocs1:"userId",gioid:"gioId",giouserkey:"userKey",gioappchannel:"appChannel",giodevicebrand:"deviceBrand",giodevicemodel:"deviceModel",giodevicetype:"deviceType",giolanguage:"language",gionetworkstate:"networkState",giooperatingsystem:"operatingSystem",gioplatform:"platform",gioplatformversion:"platformVersion",gioscreenheight:"screenHeight",gioscreenwidth:"screenWidth"},Ue=["giodatasourceid","gioplatform","gioappchannel","giodevicebrand","giodevicemodel","giodevicetype","giolanguage","gionetworkstate","giooperatingsystem","gioplatformversion","gioscreenheight","gioscreenwidth"],je=["giocs1","gios","giou","gioid","giouserkey"],Ge="gio_search_cookie_gioenc";var qe={name:"gioEmbeddedAdapter",method:class{constructor(e){this.growingIO=e,this.main=()=>{var e;const{projectId:t,appId:i}=this.growingIO.vdsConfig,n=this.getGQS();let r=!1;return"none"!==this.qsFrom&&n.gioprojectid===t&&n.gioappid===i&&(F(n)?this.growingIO.storage.removeItem(Ge):this.growingIO.storage.setItem(Ge,Pe.stringify(n)),B(n,"giodatacollect")&&(this.growingIO.vdsConfig.dataCollect=L(["true",!0],n.giodatacollect)),null===(e=this.growingIO.emitter)||void 0===e||e.on("SDK_INITIALIZED",(()=>{const{userStore:e,vdsConfig:{sessionExpires:t},dataStore:{eventContextBuilderInst:i}}=this.growingIO;je.forEach((t=>{var i;e[ke[t]]=null!==(i=n[t])&&void 0!==i?i:""})),window.setInterval((()=>{e.sessionId=n.gios}),.8*t*60*1e3),Ue.forEach((e=>{B(n,e)&&(i.minpExtraParams[ke[e]]=n[e])}))})),this.growingIO.setUserId=()=>{},this.growingIO.clearUserId=()=>{},B(n,"giodatacollect")&&(this.growingIO.setDataCollect=()=>{},this.growingIO.setOption=()=>{}),r=!0),this.gioURLRewrite(),r},this.getGQS=()=>{const{hashtag:e}=this.growingIO.vdsConfig,t=this.growingIO.storage.getItem(Ge),i=window.location.search,n=window.location.hash,r=e?n.substring(n.indexOf("?")+1):"",s=Pe.parse(i),o=Pe.parse(r),a=Pe.parse((t||"").replace("gioenc-",""));let d={};if(B(s,"gioprojectid"))d=s,this.qsFrom="search";else if(B(o,"gioprojectid"))d=o,this.qsFrom="hash";else{if(!B(a,"gioprojectid"))return this.qsFrom="none",{};d=a,this.qsFrom="cookie"}const c={},l={},h=["gioappid","gioprojectid","giodatacollect",...je,...Ue];return K(d).forEach((e=>{const t=e.toLowerCase();L(h,t)?L(["","undefined","null",void 0,null],d[e])||(c[t]=d[e],L(["true","TRUE",!0],d[e])&&(c[t]=!0),L(["false","FALSE",!1],d[e])&&(c[t]=!1)):l[e]=d[e]})),this.gqs=c,this.ngqs=l,c},this.gioURLRewrite=()=>{const{hashtag:e}=this.growingIO.vdsConfig;let t=window.location.search,i=window.location.hash,n=!1;if("search"===this.qsFrom&&(t=Pe.stringify(this.ngqs,!0),n=!0),e&&"hash"===this.qsFrom&&(i=`${i.split("?")[0]}${Pe.stringify(this.ngqs,!0)}`,n=!0),n){const e=`${window.location.pathname}${t||""}${i||""}`;window.history.replaceState(null,document.title,e)}},this.gqs={},this.ngqs={},this.qsFrom="search",this.growingIO.emitter.on(Ee,(()=>{this.growingIO.useEmbeddedInherit=this.main()}))}}},He={},Be={};!function(e){var t=f&&f.__spreadArray||function(e,t,i){if(i||2===arguments.length)for(var n,r=0,s=t.length;s>r;r++)!n&&r in t||(n||(n=[].slice.call(t,0,r)),n[r]=t[r]);return e.concat(n||[].slice.call(t))};Object.defineProperty(e,"__esModule",{value:!0}),e.GROWING_TITLE_OLD=e.GROWING_TITLE=e.GROWING_GTITLE=e.GROWING_CDP_INDEX=e.GROWING_INDEX_OLD=e.GROWING_INDEX=e.GROWING_CONTAINER=e.GROWING_TRACK=e.GROWING_IGNORE=e.VALID_CLASS_SELECTOR=e.VALID_ID_SELECTOR=e.EXCLUDE_CLASS_RE=e.UNSUPPORTED_TAGS=e.TEXT_NODE=e.UNSUPPORTED_CLICK_TAGS=e.SUPPORTED_ICON_TAGS=e.SUPPORTED_CHANGE_TYPES=e.SUPPORTED_CLICK_INPUT_TYPES=e.SUPPORTED_CONTAINER_TAGS=e.LIST_TAGS=void 0,e.LIST_TAGS=["TR","LI","DL"],e.SUPPORTED_CONTAINER_TAGS=t(["A","BUTTON"],e.LIST_TAGS,!0),e.SUPPORTED_CLICK_INPUT_TYPES=["button","submit","reset"],e.SUPPORTED_CHANGE_TYPES=["radio","checkbox","search"],e.SUPPORTED_ICON_TAGS=["I","EM","svg","IMG"],e.UNSUPPORTED_CLICK_TAGS=["TEXTAREA","HTML","BODY"],e.TEXT_NODE=["I","SPAN","EM","B","STRONG"],e.UNSUPPORTED_TAGS=["tspan","text","g","rect","path","defs","clippath","desc","title","math","use"],e.EXCLUDE_CLASS_RE=/(^| |[^ ]+\-)(clear|clearfix|active|hover|enabled|current|selected|unselected|hidden|display|focus|disabled|undisabled|open|checked|unchecked|undefined|null|ng-|growing-)[^\. ]*/g,e.VALID_ID_SELECTOR=/^[a-zA-Z-\_][a-zA-Z\-\_0-9]+$/,e.VALID_CLASS_SELECTOR=/^([a-zA-Z\-\_0-9]+)$/,e.GROWING_IGNORE="data-growing-ignore",e.GROWING_TRACK="data-growing-track",e.GROWING_CONTAINER="data-growing-container",e.GROWING_INDEX="data-growing-index",e.GROWING_INDEX_OLD="data-growing-idx",e.GROWING_CDP_INDEX="data-index",e.GROWING_GTITLE="data-growing-title",e.GROWING_TITLE="data-title",e.GROWING_TITLE_OLD="growing-title"}(Be);var Ke={},We={};Object.defineProperty(We,"__esModule",{value:!0}),We.lastFindIndex=We.findIndex=We.arrayEquals=We.rmBlank=We.normalizePath=We.splitNoEmpty=We.filterText=void 0,We.filterText=function(e,t){if(void 0===t&&(t=!0),e&&(null==(e=e.replace(/[\n \t]+/g," ").trim())?void 0:e.length))return e.slice(0,t?50:void 0)},We.splitNoEmpty=function(e,t){return e?e.split(t).filter((function(e){return!!e})):[]},We.normalizePath=function(e){var t=e.length;return t>1&&"/"===e.charAt(t-1)?e.slice(0,t-1):e},We.rmBlank=function(e){return e?e.replace(/[\n \t]+/g,""):""},We.arrayEquals=function(e,t){if(!e||!t)return!1;if(e.length!==t.length)return!1;for(var i=0,n=e.length;n>i;i++)if(e[i]!==t[i])return!1;return!0},We.findIndex=function(e,t){if(null==e||"function"!=typeof t)return-1;for(var i=0;i=0;i--){var n=e[i];if(t.call(void 0,n))return i}return-1},function(e){var t=f&&f.__spreadArray||function(e,t,i){if(i||2===arguments.length)for(var n,r=0,s=t.length;s>r;r++)!n&&r in t||(n||(n=[].slice.call(t,0,r)),n[r]=t[r]);return e.concat(n||[].slice.call(t))},i=f&&f.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.removeDiffTagOnHeadAndTail=e.computeXpath=e.getMarkIndex=e.getEffectiveNode=e.isIgnore=e.depthInside=e.changeableInput=e.clickableInput=e.onlyContainsTextChildren=e.onlyContainsIconChildren=e.supportIconTag=e.isContainerTag=e.isListTag=e.isParentOfLeaf=e.isLeaf=e.getChildren=e.getDeepChildren=e.findParent=e.isRootNode=e.hasValidAttribute=void 0;var n=We,r=Be,s=i(m);e.hasValidAttribute=function(e,t){return e instanceof Element&&e.hasAttribute(t)&&"false"!==e.getAttribute(t)},e.isRootNode=function(e){return!e||-1!==["BODY","HTML","#document"].indexOf(e.nodeName)},e.findParent=function(t,i){for(var n=t.parentNode;n&&!(0,e.isRootNode)(n);){if(i(n))return n;n=n.parentNode}},e.getDeepChildren=function(i){return(0,s.default)((null==i?void 0:i.childNodes)||[]).reduce((function(i,n){return n instanceof Element?t(t(t([],i,!0),[n],!1),(0,e.getDeepChildren)(n),!0):i}),[])},e.getChildren=function(e){return(0,s.default)((null==e?void 0:e.childNodes)||[]).filter((function(e){return e instanceof Element}))},e.isLeaf=function(t){return!t.hasChildNodes()||"svg"===t.nodeName||0===(0,e.getChildren)(t).length},e.isParentOfLeaf=function(t){return!(!t.hasChildNodes()||"svg"===t.nodeName)&&0===(0,s.default)(t.childNodes).filter((function(t){return!(0,e.isLeaf)(t)})).length},e.isListTag=function(e){return-1!==r.LIST_TAGS.indexOf(e.nodeName)},e.isContainerTag=function(t){return(0,e.hasValidAttribute)(t,r.GROWING_CONTAINER)||-1!==r.SUPPORTED_CONTAINER_TAGS.indexOf(t.nodeName)},e.supportIconTag=function(e){var t=e.nodeName;return-1!==r.SUPPORTED_ICON_TAGS.indexOf(t)},e.onlyContainsIconChildren=function(t){if(t.textContent)return!1;var i=(0,e.getChildren)(t);if(0===i.length)return!1;for(var n=0,r=i;ni)return!1;for(var r="svg"===t.tagName?[]:(0,e.getChildren)(t),s=0;s=n},e.isIgnore=function(t){if(!(t instanceof Element)||(0,e.hasValidAttribute)(t,r.GROWING_IGNORE))return!0;for(var i=t.parentNode;i&&!(0,e.isRootNode)(i);){if((0,e.hasValidAttribute)(i,r.GROWING_IGNORE))return!0;i=i.parentNode}return!1},e.getEffectiveNode=function(t){for(var i,n;t&&(n=void 0,!((i=t)instanceof Element&&-1===r.UNSUPPORTED_TAGS.indexOf(null===(n=i.tagName)||void 0===n?void 0:n.toLowerCase())))&&t.parentNode;)t=t.parentNode;var s,o=t.parentNode;return!(0,e.isRootNode)(o)&&((0,e.onlyContainsIconChildren)(o)||"BUTTON"===(s=o).tagName&&(0,e.onlyContainsTextChildren)(s))?o:t},e.getMarkIndex=function(e){if(e instanceof Element){var t=e.getAttribute(r.GROWING_INDEX)||e.getAttribute(r.GROWING_INDEX_OLD)||e.getAttribute(r.GROWING_CDP_INDEX);if(t){if(/^\d{1,10}$/.test(t)&&+t>=0&&2147483647>+t)return+t;window.console.error("[GioNode]:标记的index不符合规范(index必须是大于等于0且小于2147483647的整数字)。",t)}}},e.computeXpath=function(e){for(var t=e.parentPaths(!0),i=Math.min(t.length,+(t.length>=10)+4),n=["","",""],r=0;rr&&(n[1]=s+n[1])}return n},e.removeDiffTagOnHeadAndTail=function(e,t){var i=function(e){return e.nodeName===t.nodeName},r=(0,n.findIndex)(e,i),s=(0,n.lastFindIndex)(e,i);return-1===r||-1===s?[]:e.slice(r,s+1)}}(Ke);var Ve={},Me={};Object.defineProperty(Me,"__esModule",{value:!0});var Fe=Be,$e=We,ze=Ke;function Xe(e){var t;if(e instanceof Element){var i=e.getAttribute("name");if(i)return[i];if(e.hasAttribute("class")){var n=null===(t=e.getAttribute("class"))||void 0===t?void 0:t.replace(Fe.EXCLUDE_CLASS_RE,"").trim();if(null==n?void 0:n.length)return n.split(/\s+/).filter((function(e){return Fe.VALID_CLASS_SELECTOR.test(e)&&!e.match(/[a-z][A-Z][a-z][A-Z]/)&&!e.match(/[0-9][0-9][0-9][0-9]/)})).sort()}}return[]}var Je=function(){function e(e){var t;this.node=e,this.tagName=this.node.nodeName,this.name=this.tagName.toLowerCase(),this.id=(t=this.node).id&&Fe.VALID_ID_SELECTOR.test(t.id)?t.id:null,this.classList=Xe(this.node),this.guessListAndIndex()}return e.prototype.guessListAndIndex=function(){var e,t=this;this._tagList=(0,ze.isListTag)(this.node);var i=(0,ze.removeDiffTagOnHeadAndTail)((0,ze.getChildren)(this.node.parentNode),this.node);if(this._tagList&&-1!==(s=i.filter((function(e){return e.tagName===t.tagName})).indexOf(this.node))&&(this._index=s+1),i.length>=3&&(null===(e=this.classList)||void 0===e?void 0:e.length)){for(var n=0,r=0,s=1;s<=i.length;s++){var o=i[s-1];if(o.tagName!==this.tagName){r=0;break}(0,$e.arrayEquals)(this.classList,Xe(o))&&(r+=1),this.node===o&&(n=s)}3>r||(this._pseudoList=!0,this._index=this._index||n)}},Object.defineProperty(e.prototype,"path",{get:function(){var e;return this._path||(this._path="/".concat(this.name),this.id&&(this._path+="#".concat(this.id)),(null===(e=this.classList)||void 0===e?void 0:e.length)&&(this._path+=".".concat(this.classList.join(".")))),this._path},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pseudoList",{get:function(){return!!this._pseudoList},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"list",{get:function(){return!!this._tagList||!!this._pseudoList},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"index",{get:function(){var e;return null!==(e=(0,ze.getMarkIndex)(this.node))&&void 0!==e?e:this._index},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"container",{get:function(){return(0,ze.isContainerTag)(this.node)||this.list},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"parent",{get:function(){return this.node.parentNode?new e(this.node.parentNode):null},enumerable:!1,configurable:!0}),e.prototype.parentPaths=function(e){void 0===e&&(e=!1);for(var t=e?[this]:[],i=this.parent;i&&!(0,ze.isRootNode)(i.node);)t.push(i),i=i.parent;return t},e}();Me.default=Je;var Ze={};Object.defineProperty(Ze,"__esModule",{value:!0}),Ze.getElementHref=Ze.getImgHref=Ze.getAnchorHref=void 0;var Ye=We;function Qe(e){if(e.hasAttribute("href")){var t=e.getAttribute("href");if(t&&0!==t.indexOf("javascript"))return(0,Ye.normalizePath)(t.slice(0,320))}}function et(e){if(e.src&&-1===e.src.indexOf("data:image"))return e.src}Ze.getAnchorHref=Qe,Ze.getImgHref=et,Ze.getElementHref=function(e){var t=e;if(t)switch(e.nodeName.toLowerCase()){case"a":return Qe(t);case"img":return et(t)}};var tt={},it=f&&f.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(tt,"__esModule",{value:!0}),tt.getElementContent=tt.getFormContent=void 0;var nt=Ke,rt=Ze,st=Be,ot=it(Me),at=We,dt=it(m),ct=function(e){return e.htmlFor||e.getAttribute("for")},lt=function(e){var t=e.getAttribute(st.GROWING_GTITLE)||e.getAttribute(st.GROWING_TITLE)||e.getAttribute(st.GROWING_TITLE_OLD)||e.getAttribute("title");return null==t?void 0:t.trim()};function ht(e){var t=e.node;return e.list?ut(t):(0,at.filterText)(t.textContent)||void 0}function ut(e){for(var t=void 0,i=!1,n=0,r=(0,dt.default)(e.childNodes);n-1?i.slice(0,n):i}}(t);case"svg":return function(e){for(var t=0,i=(0,dt.default)(e.childNodes);t0)return i[i.length-1]}}(t);case"label":return ht(o);case"input":return function(e){if((0,nt.clickableInput)(e))return e.value;if("password"!==e.type&&(0,nt.hasValidAttribute)(e,st.GROWING_TRACK))return e.value;if((0,nt.changeableInput)(e)){var t=(0,nt.findParent)(e,(function(e){return"LABEL"===e.nodeName}));if(!t&&e.id)for(var i=document.body.getElementsByTagName("label"),n=0;n0)return s+" ("+e.checked+")"}return e.value}}(t);case"select":return n=t,(0,dt.default)(n.options).filter((function(e){return e.selected})).map((function(e){return e.label})).join(", ")||n.value;case"form":return gt(t)}return(0,nt.isLeaf)(t)?function(e){var t=(0,at.filterText)(e.textContent);if(t)return t}(t):(0,nt.isParentOfLeaf)(t)&&!(0,nt.onlyContainsIconChildren)(t)?function(e){for(var t="",i=0,n=(0,dt.default)(e.childNodes);ii;i++)for(var r in t=arguments[i])({}).hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},Tt.apply(this,arguments)},Et=f&&f.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(He,"__esModule",{value:!0});var _t=Be,St=Ke,Nt=Et(Ve),Ct=function(){function e(e,t,i){void 0===t&&(t=null),void 0===i&&(i=!0),this.origin=e,this.action=t,this.direct=i,this.target="self"===t?e:(0,St.getEffectiveNode)(e),this.ignore=(0,St.isIgnore)(this.target),this.vnode=new Nt.default(this.target),this.tagName=this.vnode.tagName}return Object.defineProperty(e.prototype,"content",{get:function(){return this.vnode.content},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"href",{get:function(){return this.vnode.href},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"index",{get:function(){return this.vnode.index},enumerable:!1,configurable:!0}),e.prototype.inferParentIndex=function(){var t=this;return this.parentIndex||(0,St.findParent)(this.target,(function(i){var n=new e(i,t.action,!1);n.traceable()&&n.index&&(t.parentIndex=n.index)})),this.parentIndex},Object.defineProperty(e.prototype,"xpath",{get:function(){return this.vnode.xpath},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fullXpath",{get:function(){return this.vnode.fullXpath},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"skeleton",{get:function(){return this.vnode.skeleton},enumerable:!1,configurable:!0}),e.prototype.info=function(e){return void 0===e&&(e=!0),e&&this.inferParentIndex(),{skeleton:this.skeleton,fullXpath:this.fullXpath,xpath:this.xpath,content:this.content,href:this.href,index:this.parentIndex||this.index}},e.prototype.traceable=function(){if(this.ignore)return!1;if(this.direct){if("click"===this.action||"hover"===this.action){if(-1!==_t.UNSUPPORTED_CLICK_TAGS.indexOf(this.target.tagName))return!1;if("INPUT"===this.target.tagName&&!(0,St.clickableInput)(this.target))return!1;if(!(0,St.isContainerTag)(this.target)&&!(0,St.depthInside)(this.target,5))return!1}return!0}return this.vnode.container},e.prototype.trackNodes=function(){if(!this.traceable())return[];var e=[this];if("submit"!==this.action)for(var t=this.parentElement;t;){if(t.ignore)return[];t.traceable()&&e.unshift(t),t=t.parentElement}var i=void 0;return e.map((function(e){var t=e.info(!1),n=t.index;return!i&&n&&(i=n),Tt(Tt({},t),{index:i||n})}))},Object.defineProperty(e.prototype,"parentElement",{get:function(){var t=this.target.parentNode;if(t&&t.nodeName&&!(0,St.isRootNode)(t))return new e(t,this.action,!1)},enumerable:!1,configurable:!0}),e}(),xt=He.default=Ct;class At{constructor(e){this.handler=e;const t=navigator.userAgent,i=/chrome/i.exec(t),n=/android/i.exec(t);this.hasTouch="ontouchstart"in window&&!(i&&!n)}main(){const e=this.hasTouch?["touchstart"]:["mousedown"],t=this.hasTouch?["touchend","touchcancel"]:["mouseup","mouseleave"],i=this.hasTouch?["touchmove"]:["mousemove"];for(const t of e)Y(window,t,this.touchStartHandler.bind(this));for(const e of i)Y(window,e,this.touchMoveHandler.bind(this));for(const e of t)Y(window,e,this.touchStopHandler.bind(this))}touchStartHandler(e){if(e.which>1)return;const t=+Date.now();this.safeguard!==t&&(this.touchTimeout&&clearTimeout(this.touchTimeout),this.safeguard=t,this.touchEvent={time:t,target:e.target,x:this._page("x",e),y:this._page("y",e),isTrusted:!0,type:"click"})}touchMoveHandler(e){const t=Math.abs(this._page("x",e)-(this.touchEvent&&this.touchEvent.x)||0),i=Math.abs(this._page("y",e)-(this.touchEvent&&this.touchEvent.y)||0);(t>10||i>10)&&(this.touchEvent=null)}touchStopHandler(e){const t=+Date.now()-(this.touchEvent&&this.touchEvent.time)||0;this.touchEvent&&200>t?this.touchTimeout=setTimeout((()=>{this.handler(this.touchEvent),this.touchEvent=null}),200):this.touchEvent&&t>=200&&700>t&&(this.handler(this.touchEvent),this.touchEvent=null)}_page(e,t){return(this.hasTouch?t.touches[0]:t)["page"+e.toUpperCase()]}}var Pt={name:"gioEventAutoTracking",method:class{constructor(e){this.growingIO=e,this.main=()=>{Y(document,"submit",this._handleAction),Y(document,"change",this._handleAction);const{vdsConfig:e}=this.growingIO;e.touch?new At(this._handleAction).main():Y(document,"click",this._handleAction)},this._handleAction=(e,t)=>{const{vdsConfig:i,emitter:n}=this.growingIO;if(!i.autotrack)return!1;const r=e.target;if(!r)return!1;let s=new xt(r,e.type,!0).trackNodes();if("click"!==e.type&&(s=F(C(s))?[]:[C(s)]),F(s))return!1;null==n||n.emit("onComposeBefore",{event:t,params:null!=e?e:{}}),s.forEach((t=>{const{fullXpath:n,index:r,content:s,href:o}=t;if(!G(t.fullXpath||"","/div#__vconsole")&&!G(t.fullXpath||"","/div#__giokit")&&(i.debug&&console.log("Action:",e.type,Date.now()),n)){const{dataStore:{eventContextBuilder:t,eventConverter:i,currentPage:a}}=this.growingIO;i(Object.assign(Object.assign({eventType:c[e.type],element:[{xpath:n,index:r,textValue:s,hyperlink:o}]},t()),{pageShowTimestamp:a.time}))}}))}}}};let Dt;const Lt=["VIEW_CLICK","VIEW_CHANGE","FORM_SUBMIT","PAGE","CUSTOM","LOGIN_USER_ATTRIBUTES"],Rt=["LOGIN_USER_ATTRIBUTES"];var kt={name:"gioHybridAdapter",method:class{constructor(e){this.growingIO=e,this.penetrateHybrid=!0,this.onOptionsInit=()=>{const{vdsConfig:e,emitter:t}=this.growingIO;b(e.penetrateHybrid)&&(this.penetrateHybrid=e.penetrateHybrid),this._initHybridBridge()&&(this.onSendBefore=this.sendBeforeListener,this.hybridConfig.projectId===this.growingIO.vdsConfig.projectId&&(this.growingIO.useHybridInherit=!0)),this.growingIO.useHybridInherit&&(null==t||t.on(Ne,(({newUserId:e,oldUserId:t,userKey:i})=>{this.penetrateHybrid&&(!e&&t?i?this._clearNativeUserIdAndUserKey():this._clearNativeUserId():i?this._setNativeUserIdAndUserKey(k(e),k(i)):this._setNativeUserId(k(e)))})),null==t||t.on(Ce,(({newUserKey:e,oldUserKey:t,userId:i})=>{this.penetrateHybrid&&(!e&&t?this._clearNativeUserIdAndUserKey():this._setNativeUserIdAndUserKey(k(i),k(e)))})))},this._initHybridBridge=()=>{var e,t,i;let n=!1;return this.hasHybridBridge=!!window.GrowingWebViewJavascriptBridge,this.hasHybridBridge?((null===(e=null===window||void 0===window?void 0:window.GrowingWebViewJavascriptBridge)||void 0===e?void 0:e.configuration)||(window.GrowingWebViewJavascriptBridge.configuration=JSON.parse(window.GrowingWebViewJavascriptBridge.getConfiguration())),(null===(t=null===window||void 0===window?void 0:window.GrowingWebViewJavascriptBridge)||void 0===t?void 0:t.configuration)&&(this.hybridConfig=null===(i=null===window||void 0===window?void 0:window.GrowingWebViewJavascriptBridge)||void 0===i?void 0:i.configuration),n=!0):Dt.consoleText("gioHybridAdapter:当前不存在 GrowingWebViewJavascriptBridge,Web模式。","info"),n},this.sendBeforeListener=({requestData:e})=>{if(this.hasHybridBridge){const t=this.processAttributes(Object.assign({},e));M(t,"trackingId"),L(Lt,t.eventType)&&(L(Rt,t.eventType)?this.penetrateHybrid&&this._dispatchEvent(t):(this.penetrateHybrid||M(t,["userId","userKey","cs1"]),this._dispatchEvent(t)))}},this.processAttributes=e=>(W(e,((t,i)=>{y(t)||_(t)?W(e[i],((t,n)=>{y(t)||_(t)?e[i][n]=JSON.stringify(t):e[i][n]=k(t)})):e[i]=k(t)})),e),this._setNativeUserId=e=>{J((()=>window.GrowingWebViewJavascriptBridge.setNativeUserId(e)))},this._clearNativeUserId=()=>{J((()=>window.GrowingWebViewJavascriptBridge.clearNativeUserId()))},this._setNativeUserIdAndUserKey=(e,t)=>{J((()=>window.GrowingWebViewJavascriptBridge.setNativeUserIdAndUserKey(e,t)))},this._clearNativeUserIdAndUserKey=()=>{J((()=>window.GrowingWebViewJavascriptBridge.clearNativeUserIdAndUserKey()))},this._dispatchEvent=e=>{J((()=>{var t;return null===(t=window.GrowingWebViewJavascriptBridge)||void 0===t?void 0:t.dispatchEvent(JSON.stringify(e))}))};const{emitter:t,utils:i}=this.growingIO;Dt=i,t.on(Ee,this.onOptionsInit)}}};const Ut=["i","span","em","b","strong","svg"];var jt;!function(e){e[e.OUTER=0]="OUTER",e[e.INNER_COVERED=1]="INNER_COVERED",e[e.INNER_SHOW=2]="INNER_SHOW"}(jt||(jt={}));const Gt=["HR","BR","SCRIPT","NOSCRIPT","STYLE","HEAD","BASE","LINK","META","TITLE","BODY","HTML","TEMPLATE","CODE",...Be.UNSUPPORTED_CLICK_TAGS],qt=["SELECT","A","BUTTON","INPUT","IMG","FORM"],Ht=(e,t,i)=>document.elementFromPoint(t,i)===e;class Bt{constructor(e,t,i){this.node=e,this.parentNodeDesc=t,this.devicesInfo=i,this.proxy=new xt(e),this.tagName=this.node.tagName,this.name=this.tagName.toLowerCase(),this.isIgnore=!!this.node.dataset.growingIgnore,this.isUnSupported=-1!==Gt.indexOf(this.tagName),this.rect=this.computeWindowRect()}info(){const e=this.desc();e.zLevel+=this.devicesInfo.webviewZLevel;const t=this.getDeviceRect(this.rect);return M(e,"isContainer"),Object.assign(Object.assign(Object.assign({},e),t),{parentXPath:this.parentNodeDesc.isContainer?this.parentNodeDesc.xpath:void 0,href:this.proxy.href,content:this.proxy.content,nodeType:this.nodeType()})}nodeType(){return"input"!==this.name||Ke.changeableInput(this.node)?this.node.tagName:"INPUT_BTN"}desc(){return{index:this.parentNodeDesc.index||this.proxy.index,zLevel:this.zLevel(),xpath:this.proxy.fullXpath,isContainer:this.isDefinedContainer()}}cssVisible(){const e=this.computedStyle();return Number(e.opacity)>0&&"visible"===e.visibility&&"none"!==e.display}viewportStatus(){const{top:e,left:t,width:i,height:n}=this.rect,{winWidth:r,winHeight:s}=this.devicesInfo;if(0>=i||0>=n)return jt.OUTER;const o=this.node;return s>e&&r>t&&i>0&&n>0?Ht(o,t+i/2,e+n/2)||Ht(o,t+1,e+1)||Ht(o,t+i-1,e+1)||Ht(o,t+1,e+n-1)||Ht(o,t+i-1,e+n-1)?jt.INNER_SHOW:jt.INNER_COVERED:jt.OUTER}isCircleable(){return this.proxy.target===this.proxy.origin&&(!!this.isDefinedContainer()||!("input"===this.name&&this.node instanceof HTMLInputElement&&"password"===this.node.type)&&(-1!==qt.indexOf(this.name)||(Ke.isLeaf(this.node)?!this.isBigBlank():this.hasBackgroundImage()&&Ke.depthInside(this.node,4))))}isSimpleContainer(){return"select"===this.name||this.isDefaultContainer()&&(function(e,t){if(0===e.children.length)return!1;for(const i of R(e.children))if(-1===t.indexOf(i.tagName.toLowerCase()))return!1;return!0}(this.node,Ut)||!this.node.childElementCount)}isDefinedContainer(){var e;return v(this.isContainer)?this.isDefaultContainer()||this.isMarkContainer()||Ke.isParentOfLeaf(this.node)&&(!!(null===(e=this.node.innerText)||void 0===e?void 0:e.trim().length)||function(e){const t=e.attributes;if(t.length>0)for(let e=0;es>>1||r>o>>1)}hasBackgroundImage(){const e=this.computedStyle().backgroundImage;return!!e&&"none"!==e&&e.length>0}zLevel(){const e=this.computedStyle(),t=e.zIndex;if("auto"!==t)return Number(t||"0")+this.parentNodeDesc.zLevel;switch(e.position){case"relative":return this.parentNodeDesc.zLevel+2;case"sticky":return this.parentNodeDesc.zLevel+3;case"absolute":return this.parentNodeDesc.zLevel+4;case"fixed":return this.parentNodeDesc.zLevel+5;default:return this.parentNodeDesc.zLevel+1}}computeWindowRect(){if(this.rect)return this.rect;const e=this.node.getBoundingClientRect(),t=e.top,i=e.bottom,n=e.left;let r=e.right-n,s=i-t;return 0>t?s=t+s:t+s>this.devicesInfo.winHeight&&(s=this.devicesInfo.winHeight-t),0>n?r=n+r:n+r>this.devicesInfo.winWidth&&(r=this.devicesInfo.winWidth-n),this.rect={top:t,left:n,width:r,height:s},this.rect}computedStyle(){return window.getComputedStyle(this.node)}getDeviceRect(e){const{scale:t,webviewTop:i,webviewLeft:n}=this.devicesInfo;return{top:e.top*t+i,left:e.left*t+n,width:e.width*t,height:e.height*t}}}const Kt=["DOMContentLoaded","onreadystatechange"],Wt=["scroll","resize","load","beforeunload","popstate","hashchange","pagehide","unload"];class Vt{constructor(e){this.growingIO=e,this.addDomChangeListener()}getDomTree(e,t,i,n,r,s){const o=function(e,t,i,n,r){const s=document.documentElement.clientWidth;return{winWidth:s,winHeight:document.documentElement.clientHeight,scale:i/s,webviewTop:t,webviewLeft:e,webviewWidth:i,webviewHeight:n,webviewZLevel:r}}(e,t,i,n,r),a=this.getElementsByParent(s||document.body,{isContainer:!1,zLevel:0},o),{domain:d,path:c,query:l,title:h}=this.growingIO.dataStore.currentPage;return{page:{domain:d,path:c,query:l,title:h},elements:a}}getElementsByParent(e,t,i){const n=[];return[].slice.call(e.childNodes,0).filter((e=>1===e.nodeType)).forEach((e=>{const r=new Bt(e,t,i);if(r.cssVisible()&&!r.isIgnore){switch(r.viewportStatus()){case jt.INNER_SHOW:r.isCircleable()&&n.push(r.info());break;case jt.INNER_COVERED:r.isDefaultContainer()&&n.push(r.info())}r.isSimpleContainer()||[].push.apply(n,this.getElementsByParent(e,r.desc(),i))}})),n}addDomChangeListener(){let e;const t=(t="")=>()=>{var i;"beforeunload"===t&&e&&e.disconnect(),null===(i=window.GrowingWebViewJavascriptBridge)||void 0===i||i.onDomChanged()};e=new MutationObserver(t("mutation")),e.observe(document.body,{attributes:!0,characterData:!0,childList:!0,subtree:!0}),Kt.forEach((e=>{Y(document,e,t(e))})),Wt.forEach((e=>{Y(window,e,t(e))}))}}class Mt{constructor(e){var t;this.growingIO=e,null===(t=this.growingIO.emitter)||void 0===t||t.on(_e,(()=>{if(window.GrowingWebViewJavascriptBridge){const e=this;window.GrowingWebViewJavascriptBridge.getDomTree=function(){if(arguments.length>=4)return Mt.bindGetDomTree(e.growingIO),Mt.domHelper.getDomTree.apply(Mt.domHelper,arguments)}}}))}static bindGetDomTree(e){this.domHelper||(this.domHelper=new Vt(e),window.GrowingWebViewJavascriptBridge.getDomTree=this.domHelper.getDomTree.bind(this.domHelper))}}var Ft={name:"gioHybridCircle",method:Mt},$t={name:"gioImpressionTracking",method:class{constructor(e){var t;this.growingIO=e,this.documentReady=!1,this.main=e=>{"listener"===e?(this.documentReady=!0,this.growingIO.gioSDKInitialized&&this.initMutationObserver()):"emitter"===e&&this.documentReady&&this.initMutationObserver()},this.initIntersectionObserver=()=>{this.intersectionObserver=new IntersectionObserver((e=>{F(e)||e.map((e=>{const{dataset:t,id:i}=e.target;if(e.intersectionRatio>0){const{eventId:e,properties:n,items:r}=this.getImpressionProperties(t);if(i){if("once"===t.gioImpType&&B(this.sentImps,i))return;this.sentImps[i]={eventId:e,properties:n,items:r}}e&&this.growingIO.track(e,n,r)}}))}))},this.initMutationObserver=()=>{var e;this.mutationObserver&&(null===(e=this.mutationObserver)||void 0===e||e.disconnect());const t=document.querySelectorAll("[data-gio-imp-track]");R(t).map((e=>{var t;null===(t=this.intersectionObserver)||void 0===t||t.observe(e)})),this.mutationObserver=new MutationObserver((e=>{e.map((e=>{var t,i;"attributes"===e.type&&(null===(t=e.target.dataset)||void 0===t?void 0:t.gioImpTrack)&&(null===(i=this.intersectionObserver)||void 0===i||i.observe(e.target))}))})),this.mutationObserver.observe(document.body,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0,attributeFilter:["data-gio-imp-track","data-gio-imp-attrs","data-gio-imp-items",/^data-gio-track-[a-z]+$/i]})},this.getImpressionProperties=e=>{let t={eventId:void 0,properties:{}};if(!(null==e?void 0:e.gioImpTrack))return t;if(t.eventId=e.gioImpTrack,B(e,"gioImpAttrs"))t.properties=J((()=>y(e.gioImpAttrs)?e.gioImpAttrs:JSON.parse(e.gioImpAttrs))),t.items=J((()=>y(e.gioImpItems)?e.gioImpItems:JSON.parse(e.gioImpItems)));else{const i=/^gioTrack(.+)/;for(const n in e){let r;const s=n.match(i);s&&(r=j(s[1]),"track"!==r&&(t.properties[r]=e[n]))}}return t.properties=Z(t.properties),t.items=Z(t.items),/^\w+$/.test(t.eventId)&&!Number.isInteger(Number(N(t.eventId.split(""))))||(t.eventId=null,t={}),t},this.sentImps={},window.IntersectionObserver&&window.MutationObserver?(this.initIntersectionObserver(),Y(document,"readystatechange",(()=>{L(["interactive","complete"],document.readyState)&&this.main("listener")}),{once:!0}),null===(t=this.growingIO.emitter)||void 0===t||t.on(_e,(()=>this.main("emitter"))),Y(window,"unload",(()=>{var e,t;null===(e=this.intersectionObserver)||void 0===e||e.disconnect(),null===(t=this.mutationObserver)||void 0===t||t.disconnect()}))):X("当前浏览器不支持半自动埋点,gioImpressionTracking已自动关闭!","warn")}}},zt={name:"gioWebCircle",method:class{constructor(e){var t;this.growingIO=e,this.injectCircle=(e,t)=>{const i=document.createElement("link"),n=document.createElement("script");i.rel="stylesheet",i.href=e,n.src=t,document.head.appendChild(i),document.head.appendChild(n)},null===(t=this.growingIO.emitter)||void 0===t||t.on(_e,(()=>{window.addEventListener("message",(e=>{const{data:t,source:i}=e,n=window.vds;if(t&&i){const e=i.vds,r=t.cssURL,s=t.jsURL;e&&"SDK_INJECT_CIRCLE_SCRIPT"===t.type&&n.projectId===e.projectId&&n.dataSourceId===e.dataSourceId&&this.injectCircle(r,s)}}))}))}}};const Xt=["gioPerformance"];class Jt{constructor(e){var t,i,n,r;this.growingIO=e,this.innerPluginInit=()=>{var e;Xt.forEach((e=>{var t;return M(null===(t=this.pluginsContext)||void 0===t?void 0:t.plugins,e)})),K(null===(e=this.pluginsContext)||void 0===e?void 0:e.plugins).forEach((e=>{var t;const{name:i,method:n}=null===(t=this.pluginsContext)||void 0===t?void 0:t.plugins[e];P(this.pluginItems,(e=>e.name===i))||this.pluginItems.push({name:j(i||e),method:n||(e=>{})})})),F(this.pluginItems)||this.installAll()},this.install=(e,t,i)=>{var n,r;const s=t||P(this.pluginItems,(t=>t.name===e));if((null===(n=this.growingIO)||void 0===n?void 0:n.plugins)[e])return X(`重复加载插件 ${e} 或插件重名,已跳过加载!`,"warn"),!1;if(!s)return X(`插件加载失败!不存在名为 ${e} 的插件!`,"error"),!1;try{return(null===(r=this.growingIO)||void 0===r?void 0:r.plugins)[e]=new s.method(this.growingIO,i),"cdp"===this.growingIO.gioEnvironment&&t&&X("加载插件 "+e,"info"),!0}catch(e){return X("插件加载异常 "+e,"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:j(t.name),method:t.method?t.method:()=>{}})}))},this.uninstall=e=>{var t;M(this.pluginItems,e);const i=M(null===(t=this.growingIO)||void 0===t?void 0:t.plugins,e);return i||X(`卸载插件 ${e} 失败!`,"error"),i},this.uninstallAll=()=>{this.pluginItems.forEach((e=>this.uninstall(e.name)))},this.lifeError=(e,t)=>X(`插件执行错误 ${e.name} ${t}`,"error"),this.onComposeBefore=e=>{this.pluginItems.forEach((t=>{var i;const n=null===(i=this.growingIO.plugins[t.name])||void 0===i?void 0:i.onComposeBefore;if(n&&E(n))try{n(e)}catch(e){this.lifeError(t,e)}}))},this.onComposeAfter=e=>{this.pluginItems.forEach((t=>{var i;const n=null===(i=this.growingIO.plugins[t.name])||void 0===i?void 0:i.onComposeAfter;if(n&&E(n))try{n(e)}catch(e){this.lifeError(t,e)}}))},this.onSendBefore=e=>{this.pluginItems.forEach((t=>{var i;const n=null===(i=this.growingIO.plugins[t.name])||void 0===i?void 0:i.onSendBefore;if(n&&E(n))try{n(e)}catch(e){this.lifeError(t,e)}}))},this.onSendAfter=e=>{this.pluginItems.forEach((t=>{var i;const n=null===(i=this.growingIO.plugins[t.name])||void 0===i?void 0:i.onSendAfter;if(n&&E(n))try{n(e)}catch(e){this.lifeError(t,e)}}))},this.pluginsContext={plugins:{}},this.pluginItems=[],null===(t=this.growingIO.emitter)||void 0===t||t.on("onComposeBefore",this.onComposeBefore),null===(i=this.growingIO.emitter)||void 0===i||i.on("onComposeAfter",this.onComposeAfter),null===(n=this.growingIO.emitter)||void 0===n||n.on("onSendBefore",this.onSendBefore),null===(r=this.growingIO.emitter)||void 0===r||r.on("onSendAfter",this.onSendAfter)}}class Zt extends Jt{constructor(e){super(e),this.growingIO=e,this.growingIO.gioSDKFull=!0,this.pluginsContext={plugins:{gioCompress:xe,gioCustomTracking:Ae,gioEmbeddedAdapter:qe,gioEventAutoTracking:Pt,gioHybridAdapter:kt,gioHybridCircle:Ft,gioImpressionTracking:$t,gioWebCircle:zt}}}}class Yt{constructor(){var e;this.trackingId="g0",this.init=e=>{var t,i,n,r,s;X("Gio Web SDK 初始化中...","info");const{initOptions:o,currentPage:a,sendVisit:d,sendPage:c}=this.dataStore;o(e),this.storage=Te(this.vdsConfig),this.initCallback(),null===(t=this.emitter)||void 0===t||t.emit(Ee,this),null===(n=null===(i=this.plugins)||void 0===i?void 0:i.gioEventAutoTracking)||void 0===n||n.main(),a.hookHistory(),a.parsePage(),null===(r=this.emitter)||void 0===r||r.emit(_e,this),X("Gio Web SDK 初始化完成!","success"),this.useEmbeddedInherit||(this.dataStore.lastVisitEvent.timestamp=a.time,d()),c(),this.gioSDKInitialized=!0,this.vdsConfig.gioSDKInitialized=!0,window[this.vds]=this.vdsConfig,null===(s=this.emitter)||void 0===s||s.emit("SDK_INITIALIZED_COMPLATE",this)},this.setOption=(e,t)=>{if(L(s,e)){const i=this.dataStore.setOption(e,t);return i&&o[e]&&X(`已${t?"开启":"关闭"}${o[e]}`,"info"),i}return X(`不存在可修改的配置项:${e},请检查后重试!`,"warn"),!1},this.getOption=e=>this.dataStore.getOption(e),this.setGeneralProps=e=>{y(e)&&!F(e)?(this.dataStore.generalProps=Object.assign(Object.assign({},this.dataStore.generalProps),e),K(this.dataStore.generalProps).forEach((e=>{L([void 0,null],this.dataStore.generalProps[e])&&(this.dataStore.generalProps[e]="")}))):this.callError("setGeneralProps")},this.clearGeneralProps=e=>{_(e)&&!F(e)?e.forEach((e=>{M(this.dataStore.generalProps,e)})):this.dataStore.generalProps={}},this.reissuePage=()=>{this.dataStore.sendPage()},this.notRecommended=()=>X("不推荐的方法使用,建议使用 gio('setOption', [optionName], [value])!","info"),this.callError=(e,t=!0,i="参数不合法")=>X(`${t?"调用":"设置"} ${e} 失败,${i}!`,"warn"),this.updateImpression=()=>{var e,t;const i=null===(t=null===(e=this.plugins)||void 0===e?void 0:e.gioImpressionTracking)||void 0===t?void 0:t.main;i?i("emitter"):X("updateImpression 错误! 请集成半自动埋点浏览插件后重试!","error")},this.gioEnvironment="cdp",this.sdkVersion="3.8.7",this.vds=window.gioCompatibilityVds?"gdp_vds":"vds",this.utils=Object.assign(Object.assign({},z),ee),this.emitter={all:e=e||new Map,on:function(t,i){var n=e.get(t);n?n.push(i):e.set(t,[i])},off:function(t,i){var n=e.get(t);n&&(i?n.splice(n.indexOf(i)>>>0,1):e.set(t,[]))},emit:function(t,i){var n=e.get(t);n&&n.slice().map((function(e){e(i)})),(n=e.get("*"))&&n.slice().map((function(e){e(t,i)}))}},this.useEmbeddedInherit=!1,this.useHybridInherit=!1,this.gioSDKInitialized=!1,this.plugins=new Zt(this),this.plugins.innerPluginInit()}}class Qt{constructor(e){this.growingIO=e;const{projectId:t}=this.growingIO.vdsConfig,{getItem:i,setItem:n,getKeys:r,removeItem:s}=this.growingIO.storage;this.getItem=i,this.setItem=n,this.getKeys=r,this.removeItem=s,this.sIdStorageName=t+"_gdp_session_id",this.uidStorageName="gdp_user_id_gioenc",this.userIdStorageName=t+"_gdp_cs1_gioenc",this.userKeyStorageName=t+"_gdp_user_key_gioenc",this.gioIdStorageName=t+"_gdp_gio_id_gioenc"}get sessionId(){return this.getItem(this.sIdStorageName)||(this.sessionId=oe(),this.sessionId)}set sessionId(e){var t;e||(e=oe());const i=this.getItem(this.sIdStorageName)||this.prevSessionId,{sessionExpires:n=30}=this.growingIO.vdsConfig;this.setItem(this.sIdStorageName,e,+Date.now()+60*n*1e3),i!==e&&(this.getKeys().filter((e=>/.+_gdp_session_id_.{36}/.test(e))).forEach((e=>{this.removeItem(e)})),this.setItem(this.growingIO.dataStore.visitStorageName,""),null===(t=this.growingIO.emitter)||void 0===t||t.emit(Se,{newSessionId:e,oldSessionId:i})),this.prevSessionId=e}get uid(){return this.getItem(this.uidStorageName)||(this.uid=oe(),this.uid)}set uid(e){var t;const i=this.getItem(this.uidStorageName)||this.prevUId;this.setItem(this.uidStorageName,e),i!==e&&(null===(t=this.growingIO.emitter)||void 0===t||t.emit("UID_UPDATE",{newUId:e,oldUId:i})),this.prevUId=e}get userId(){return this.getItem(this.userIdStorageName)||""}set userId(e){var t,i;const n=this.getItem(this.userIdStorageName)||this.prevUserId;this.setItem(this.userIdStorageName,e),null===(t=this.growingIO.emitter)||void 0===t||t.emit(Ne,{newUserId:e,oldUserId:n,userKey:this.userKey}),n!==e&&(null===(i=this.growingIO.emitter)||void 0===i||i.emit("USERID_UPDATE",{newUserId:e,oldUserId:n,userKey:this.userKey})),e&&(this.gioId=e),this.prevUserId=e}get userKey(){return this.getItem(this.userKeyStorageName)||""}set userKey(e){var t,i;const n=this.getItem(this.userKeyStorageName)||this.prevUserKey;this.setItem(this.userKeyStorageName,e),null===(t=this.growingIO.emitter)||void 0===t||t.emit(Ce,{newUserKey:e,oldUserKey:n,userId:this.userId}),n!==e&&(null===(i=this.growingIO.emitter)||void 0===i||i.emit("USERKEY_UPDATE",{newUserKey:e,oldUserKey:n,userId:this.userId})),this.prevUserKey=e}get gioId(){return this.getItem(this.gioIdStorageName)||""}set gioId(e){var t;const i=this.getItem(this.gioIdStorageName)||this.prevGioId;this.setItem(this.gioIdStorageName,e),i!==e&&(null===(t=this.growingIO.emitter)||void 0===t||t.emit("GIOID_UPDATE",{newGioId:e,oldGioId:i})),this.prevGioId=e}}class ei{constructor(e){this.growingIO=e,this.main=()=>{var e,t;const{sdkVersion:i,useEmbeddedInherit:n,vdsConfig:r,userStore:s,dataStore:o,trackingId:a}=this.growingIO,{path:d,query:c}=o.currentPage;let l={appVersion:r.version,dataSourceId:r.dataSourceId,deviceId:s.uid,domain:n?r.appId:window.location.host,gioId:s.gioId,language:navigator.language,path:d,platform:r.platform,query:c,referralPage:(null===(e=o.lastPageEvent)||void 0===e?void 0:e.referralPage)||"",screenHeight:window.screen.height,screenWidth:window.screen.width,sdkVersion:i,sessionId:s.sessionId,timestamp:+Date.now(),title:null!==(t=J((()=>document.title.slice(0,255))))&&void 0!==t?t:"",userId:s.userId};if(r.enableIdMapping&&(l.userKey=s.userKey),F(r.ignoreFields)||r.ignoreFields.forEach((e=>{M(l,e)})),n&&!F(this.minpExtraParams)){const e=Object.assign({},l);W(Object.assign(Object.assign({},l),this.minpExtraParams),((t,i)=>{var n;L(r.embeddedIgnore,i)?(l[i]=e[i],"domain"===i&&(l[i]=window.location.host)):l[i]=null!==(n=this.minpExtraParams[i])&&void 0!==n?n:l[i]}))}return l.trackingId=a,l},this.minpExtraParams={}}}class ti{constructor(e){this.growingIO=e,this.parsePage=()=>{const{hashtag:e}=this.growingIO.vdsConfig,t=location.pathname,i=location.search,n=location.hash,r=n.indexOf("?");this.domain=window.location.host,this.title=document.title.slice(0,255),this.time=+Date.now(),this.path=t,this.query=i,e&&(r>-1?(this.path+=n.slice(0,r),this.query=this.query+"&"+n.slice(r+1)):this.path+=n),this.query&&L(["?","&"],this.query.charAt(0))&&(this.query=this.query.slice(1))},this._getNoHashHref=()=>{const{protocol:e,host:t,pathname:i,search:n}=window.location;return`${e}://${t}${i}${n}`},this.getReferralPage=()=>{var e,t;const{dataStore:{lastPageEvent:i}}=this.growingIO;return(null==i?void 0:i.path)===this.path&&(null!==(e=null==i?void 0:i.query)&&void 0!==e?e:"")===(null!==(t=this.query)&&void 0!==t?t:"")?null==i?void 0:i.referralPage:(null==i?void 0:i.path)?this.lastHref:document.referrer},this.pageListener=()=>{const{hashtag:e}=this.growingIO.vdsConfig;let t=window.location.href,i=this.lastHref;e||(t=this._getNoHashHref(),i=this.lastNoHashHref),i!==t&&(this.parsePage(),this.buildPageEvent())},this.hookHistory=()=>{const e=window.history.pushState,t=window.history.replaceState,i=this;e&&J((()=>window.history.pushState=function(){e.apply(window.history,arguments),setTimeout(i.pageListener)})),t&&J((()=>window.history.replaceState=function(){t.apply(window.history,arguments),setTimeout(i.pageListener)})),Y(window,"popstate",this.pageListener);const{hashtag:n}=this.growingIO.vdsConfig;n&&Y(window,"hashchange",this.pageListener)},this.buildPageEvent=e=>{const{dataStore:{lastPageEvent:t,eventContextBuilder:i,eventConverter:n}}=this.growingIO;let r=Object.assign(Object.assign({eventType:"PAGE"},i()),{protocolType:location.protocol.substring(0,location.protocol.length-1),referralPage:this.getReferralPage()});F(e)||(r=Object.assign(Object.assign({},r),e)),r.timestamp=this.time,n(r),this.lastHref=window.location.href,this.lastNoHashHref=this._getNoHashHref(),this.lastLocation=Object.assign({},window.location)},this.title=document.title.slice(0,255),this.lastLocation=Object.assign({},window.location)}}const ii={referralPage:document.referrer};class ni{constructor(r){var a,c,l;this.growingIO=r,this.ALLOW_SETTING=Object.assign(Object.assign({},t),"saas"===this.growingIO.gioEnvironment?n:i),this.allowOptKeys=Object.keys(this.ALLOW_SETTING),this.trackTimers={},this.setSequenceIds=(e,t)=>{let i=this.growingIO.storage.getItem(this.seqStorageIdName)||{};"gsid"===e?i.globalKey=t:i=Object.assign(Object.assign({},i),t),this.growingIO.storage.setItem(this.seqStorageIdName,i)},this.initOptions=t=>{var i,n,r,s,a,c,l;const{projectId:h,dataSourceId:u,appId:g}=t;this.initialDataSourceId=u;const p={};this.allowOptKeys.forEach((i=>{const n=this.ALLOW_SETTING[i].type;let r=_(n)?!L(n,$(t[i])):$(t[i])!==n;"platform"!==i||L(e,t[i])||(r=!0),r?p[i]=this.ALLOW_SETTING[i].default:"ignoreFields"===i?p.ignoreFields=t.ignoreFields.filter((e=>L(d,e))):(p[i]=t[i],L(["dataCollect","autotrack"],i)&&(p[i]||X("已关闭"+o[i],"info")))})),p.sessionExpires=Math.round(p.sessionExpires),(O(p.sessionExpires)||1>p.sessionExpires||p.sessionExpires>360)&&(p.sessionExpires=30),p.storageType=p.storageType.toLowerCase(),p.sendType=p.sendType.toLowerCase(),L(["beacon","xhr","image"],p.sendType)||(p.sendType="beacon"),!O(Number(p.requestTimeout))&&p.requestTimeout>0||(p.requestTimeout=5e3),this.growingIO.vdsConfig=Object.assign(Object.assign(Object.assign({},null!==(i=window.vds)&&void 0!==i?i:{}),p),{projectId:h,dataSourceId:u,appId:g,performance:{monitor:null===(r=null===(n=p.performance)||void 0===n?void 0:n.monitor)||void 0===r||r,exception:null===(a=null===(s=p.performance)||void 0===s?void 0:s.exception)||void 0===a||a,network:null!==(l=null===(c=p.performance)||void 0===c?void 0:c.network)&&void 0!==l&&l}}),window.vds=this.growingIO.vdsConfig,this.seqStorageIdName=h+"_gdp_sequence_ids",this.visitStorageName=h+"_gdp_session_id_sent"},this.setOption=(e,t)=>{var i;const{vdsConfig:n,callError:r,uploader:o,emitter:a}=this.growingIO,d=I(e)&&L(s,e),c=d&&typeof t===((null===(i=this.ALLOW_SETTING[e])||void 0===i?void 0:i.type)||"string"),l=Object.assign({},n);return d&&c?(n[e]=t,"dataCollect"===e&&l.dataCollect!==t&&(t?(this.sendVisit(!0),this.sendPage()):this.growingIO.clearTrackTimer()),L(["host","scheme"],e)&&(null==o||o.generateHost()),null==a||a.emit("OPTION_CHANGE",{optionName:e,optionValue:t}),window.vds[e]=t,!0):(r("setOption > "+e),!1)},this.getOption=e=>{const{vdsConfig:t,callError:i}=this.growingIO;return e&&B(t,k(e))?t[k(e)]:v(e)?Object.assign({},t):void i("getOption > "+e)},this.sendVisit=e=>{const{userStore:{sessionId:t},storage:i}=this.growingIO,n=i.getItem(this.visitStorageName);!e&&t===n||(this.lastVisitEvent.timestamp=this.currentPage.time-1,this.buildVisitEvent())},this.buildVisitEvent=e=>{const{dataStore:{eventContextBuilder:t,eventConverter:i},emitter:n,storage:r,userStore:s}=this.growingIO,{referralPage:o,title:a,path:d,query:c,timestamp:l}=this.lastVisitEvent;let h=Object.assign(Object.assign({eventType:"VISIT"},t()),{referralPage:o||this.currentPage.getReferralPage(),timestamp:l});d&&(h.title=a,h.path=d,h.query=c),F(e)||(h.session=(null==e?void 0:e.session)||h.session,h.trackingId=null==e?void 0:e.trackingId,h=Object.assign(Object.assign({},h),e));const u=({requestData:e})=>{"VISIT"===e.eventType&&e.trackingId===this.growingIO.trackingId&&(s.sessionId===e.sessionId&&r.setItem(this.visitStorageName,e.sessionId),n.off("onSendAfter",u))};n.on("onSendAfter",u),i(h)},this.sendPage=e=>{e&&this.currentPage.parsePage(),this.currentPage.buildPageEvent()},this.buildErrorEvent=e=>{const{dataStore:{eventContextBuilder:t,eventConverter:i}}=this.growingIO;i(Object.assign({eventType:"CUSTOM",pageShowTimestamp:this.currentPage.time,eventName:"onError",attributes:e},t()))},this.currentPage=new ti(this.growingIO),this.eventContextBuilderInst=new ei(this.growingIO),this.eventContextBuilder=this.eventContextBuilderInst.main,this.generalProps={},this.lastVisitEvent=ii,null===(a=this.growingIO.emitter)||void 0===a||a.on("onComposeAfter",(({composedEvent:e})=>{"VISIT"!==e.eventType&&"vst"!==e.t||e.trackingId!==this.growingIO.trackingId||(this.lastVisitEvent=e)})),this.lastPageEvent={},null===(c=this.growingIO.emitter)||void 0===c||c.on("onComposeAfter",(({composedEvent:e})=>{"PAGE"!==e.eventType&&"page"!==e.t||e.trackingId!==this.growingIO.trackingId||(this.lastPageEvent=e)})),null===(l=this.growingIO.emitter)||void 0===l||l.on(Se,(()=>{if(this.growingIO.gioSDKInitialized){this.currentPage.parsePage();const{title:e,path:t,query:i,time:n,getReferralPage:r}=this.currentPage;this.lastVisitEvent={referralPage:document.referrer||r(),title:e,path:t,query:i,timestamp:n-1},this.sendVisit(!0),this.sendPage(!0)}}))}get esid(){const e=this.growingIO.storage.getItem(this.seqStorageIdName)||{};let t=Object.assign({},e);return M(t,"globalKey"),t=y(t)&&!v(t)?t:{},this._esid={},K(t).forEach((e=>{this._esid[e]=O(Number(t[e]))||t[e]>=1e9||1>t[e]?1:t[e]})),this._esid}set esid(e){const t={};K(e).forEach((i=>{t[i]=O(e[i])||e[i]>=1e9||1>e[i]?1:e[i]})),V(this._esid,t)||(this._esid=t,this.setSequenceIds("esid",this._esid))}get gsid(){const e=this.growingIO.storage.getItem(this.seqStorageIdName)||{},t=Number(e.globalKey);return this._gsid=O(t)||t>=1e9||1>t?1:t,this._gsid}set gsid(e){O(Number(e))||e>=1e9||1>e?this._gsid=1:this._gsid=e,this.setSequenceIds("gsid",this._gsid)}}class ri extends ni{constructor(e){super(e),this.growingIO=e,this.eventConverter=e=>{var t;const{vdsConfig:i,dataStore:n,uploader:r}=this.growingIO;if(i.dataCollect){e.trackingId===this.growingIO.trackingId&&(e.globalSequenceId=n.gsid,e.eventSequenceId=n.esid[e.eventType]||1);const i={};W(e,((e,t)=>{var n;if("element"===t){const t=null!==(n=N(e))&&void 0!==n?n:{};W(t,((e,t)=>{F(e)&&0!==e||(i[t]=e)}))}else(F(e)||v(e))&&0!==e||(i[t]=e)})),e.trackingId===this.growingIO.trackingId&&(this.growingIO.dataStore.gsid+=1,this.growingIO.dataStore.esid=Object.assign(Object.assign({},this.growingIO.dataStore.esid),{[i.eventType]:(this.growingIO.dataStore.esid[i.eventType]||1)+1})),null===(t=this.growingIO.emitter)||void 0===t||t.emit("onComposeAfter",{composedEvent:Object.assign({},i)}),e.trackingId===this.growingIO.trackingId&&r.commitRequest(i)}else"VISIT"===e.eventType&&(this.lastVisitEvent=e)}}}class si{constructor(e){this.growingIO=e,this.getSendType=()=>{const{sendType:e}=this.growingIO.vdsConfig;return"beacon"===e?(()=>{var e;const t=!!(null===(e=null===window||void 0===window?void 0:window.navigator)||void 0===e?void 0:e.sendBeacon),i=window.navigator.userAgent;if(i.match(/(iPad|iPhone|iPod)/g)){const e=(e=>{const t=e.toLowerCase().match(/cpu.*os (.*?) like mac os/i);return!t||2>t.length?0:+t[1].split("_").slice(0,2).join(".")})(i);return t&&e>13}return t})()?"beacon":"xhr":e},this.commitRequest=e=>{const t=Object.assign({},e);this.requestQueue.push(Object.assign(Object.assign({},t),{requestType:this.getSendType()})),this.initiateRequest()},this.initiateRequest=()=>{var e,t;if([...this.requestQueue].length>0&&this.requestingNum(this.retryIds[e.globalSequenceId||e.esid]||0)<=this.retryLimit)),F(this.requestQueue))return;const o=this.requestQueue.shift(),{requestType:a}=o;null==n||n.emit("onSendBefore",{requestData:Object.assign({},o)});const d=Object.assign({},o);if(M(d,["requestType","trackingId"]),i.debug&&console.log("[GrowingIO Debug]:",JSON.stringify(d,null,2).replace(/\"/g,(()=>{const e=window.navigator.userAgent;return/(\d+\.\d)?(?:\.\d)?\s+safari\/?(\d+\.\d+)?/i.test(e)&&!/chrome\/(\d+\.\d+)/i.test(e)})()?"":'"')),this.requestingNum+=1,s)return this.requestSuccessFn(o),!1;let c=Object.assign({},d);switch(i.compress&&(null==r?void 0:r.gioCompress)?"image"===a?(this.compressType="11",c=null===(e=null==r?void 0:r.gioCompress)||void 0===e?void 0:e.compressToEncodedURIComponent(JSON.stringify([c]))):(this.compressType="1",c=null===(t=null==r?void 0:r.gioCompress)||void 0===t?void 0:t.compressToUint8Array(JSON.stringify([c]))):(this.compressType="0",c=JSON.stringify([c])),a){case"beacon":default:this.sendByBeacon(o,c);break;case"xhr":this.sendByXHR(o,c);break;case"image":this.sendByImage(o,c)}}},this.generateURL=()=>`${this.requestURL}?stm=${+Date.now()}&compress=${this.compressType}`,this.sendByBeacon=(e,t)=>{navigator.sendBeacon(this.generateURL(),t)?this.requestSuccessFn(e):this.requestFailFn(e,"beacon")},this.sendByXHR=(e,t)=>{const i=new XMLHttpRequest;if(i)return i.open("POST",this.generateURL(),!0),i.onload=()=>{204===i.status?this.requestSuccessFn(e):this.requestFailFn(e,"xhr")},i.ontimeout=i.onerror=i.onabort=()=>{this.requestFailFn(e,"xhr")},i.setRequestHeader("Content-Type","text/plain;charset=UTF-8"),i.timeout=this.growingIO.vdsConfig.requestTimeout,void i.send(t);if(null===window||void 0===window?void 0:window.XDomainRequest){const i=new window.XDomainRequest;i.open("POST",this.generateURL().replace("https://","http://"),!0),i.onload=()=>{204===i.status?this.requestSuccessFn(e):this.requestFailFn(e,"xhr")},i.onerror=i.ontimeout=()=>{this.requestFailFn(e,"xhr")},i.send(t)}},this.sendByImage=(e,t)=>{const i=`${this.generateURL()}&data=${t}`;let n=document.createElement("img");n.width=1,n.height=1;let r=window.setTimeout((()=>{this.requestingNum-=1,this.clearImage(n),window.clearTimeout(r),r=null,this.initiateRequest()}),this.growingIO.vdsConfig.requestTimeout);n.onload=()=>{this.requestSuccessFn(e),this.clearImage(n),window.clearTimeout(r),r=null},n.onerror=n.onabort=()=>{this.requestSuccessFn(e),this.clearImage(n),window.clearTimeout(r),r=null},n.src=i},this.clearImage=e=>{e.src="",e.onload=()=>{},e.onerror=e.onabort=()=>{},e=null},this.requestSuccessFn=e=>{var t;this.requestingNum-=1;const i=e.globalSequenceId||e.esid||-1;this.retryIds[i]&&(this.retryIds[i]=0),e.trackingId===this.growingIO.trackingId&&this.growingIO.userStore.sessionId===e.sessionId&&(this.growingIO.userStore.sessionId=e.sessionId),null===(t=this.growingIO.emitter)||void 0===t||t.emit("onSendAfter",{requestData:Object.assign({},e)}),this.initiateRequest()},this.requestFailFn=(e,t)=>{this.requestingNum-=1;const i=e.globalSequenceId||e.esid||-1;this.retryIds[i]||(this.retryIds[i]=0),this.retryIds[i]+=1;const n=this.requestQueue.some((t=>t.globalSequenceId===e.globalSequenceId&&t.esid===e.esid));let r=t;if(this.retryIds[i]{this.requestQueue.push(Object.assign(Object.assign({},e),{requestType:r})),this.initiateRequest(),window.clearTimeout(t),t=null}),800)}this.initiateRequest()},this.requestQueue=[],this.requestLimit=10,this.requestTimeout=5e3,this.retryLimit=2,this.retryIds={},this.requestingNum=0,this.requestURL=""}}class oi extends si{constructor(e){super(e),this.growingIO=e,this.generateHost=()=>{let{scheme:e,host:t="",projectId:i}=this.growingIO.vdsConfig;e?q(k(e),"://")||(e+="://"):e=(location.protocol.indexOf("http")>-1?location.protocol.replace(":",""):"https")+"//",G(t,"http")&&(t=t.substring(t.indexOf("://")+(q(k(e),"://")?3:0))),this.requestURL=`${e}${t}/v3/projects/${i}/collect`},this.requestURL="",this.generateHost()}}class ai extends Yt{constructor(){super(),this.registerPlugins=e=>{_(e)?(e.forEach(((t,i)=>{var n,r;F(t)||v(t)?X("插件不合法,跳过加载!","warn"):(null===(n=t.js)||void 0===n?void 0:n.default)&&(e[i]=Object.assign(Object.assign({},null===(r=t.js)||void 0===r?void 0:r.default),{options:t.options}))})),e=A(e),this.plugins.installAll(e)):X("插件注册失败,请检查!","error")},this.initCallback=()=>{this.uploader=new oi(this),this.userStore=new Qt(this)},this.getPlugins=()=>this.plugins.pluginItems,this.setTrackerScheme=e=>{L(["http","https"],e)?(this.dataStore.setOption("scheme",e),this.notRecommended()):this.callError("scheme",!1)},this.setTrackerHost=e=>{ie.test(e)||ne.test(e)?(this.dataStore.setOption("host",e),this.notRecommended()):this.callError("host",!1)},this.setDataCollect=e=>{this.setOption("dataCollect",!!e),this.notRecommended()},this.setAutotrack=e=>{this.setOption("autotrack",!!e),this.notRecommended()},this.enableDebug=e=>{this.setOption("debug",!!e),this.notRecommended()},this.enableHT=e=>{this.setOption("hashtag",!!e),this.notRecommended()},this.getVisitorId=()=>this.userStore.uid,this.getDeviceId=()=>this.userStore.uid,this.setUserAttributes=(e,t)=>{var i,n;!F(e)&&y(e)?null===(n=null===(i=this.plugins)||void 0===i?void 0:i.gioCustomTracking)||void 0===n||n.buildUserAttributesEvent(e,t):this.callError("setUserAttributes")},this.setUserId=(e,t)=>{if(te(k(e).trim())){const i=this.userStore.gioId;this.vdsConfig.enableIdMapping&&(this.userStore.userKey=!v(t)&&k(t).length>0?k(t).slice(0,1e3):""),this.userStore.userId=k(e).slice(0,1e3),i&&i!==this.userStore.userId&&(this.userStore.sessionId="")}else this.clearUserId(),this.callError("setUserId")},this.clearUserId=()=>{this.userStore.userId="",this.userStore.userKey=""},this.track=(e,t,i,n)=>{var r,s;((null===(s=null===(r=this.plugins)||void 0===r?void 0:r.gioCustomTracking)||void 0===s?void 0:s.buildCustomEvent)||function(){})(e,Object.assign(Object.assign({},this.dataStore.generalProps),y(t)&&!F(t)?t:{}),i,n)},this.sendPage=e=>this.dataStore.currentPage.buildPageEvent(e),this.sendVisit=e=>this.dataStore.buildVisitEvent(e),this.trackTimerStart=(e,t)=>{this.vdsConfig.dataCollect&&Q(e,(()=>{const i=oe();E(t)?(this.dataStore.trackTimers[i]={eventName:e,leng:0,start:+Date.now()},t(i)):X("回调方法不合法,返回timerId失败!")}))},this.trackTimerPause=e=>{if(e&&this.dataStore.trackTimers[e]){const t=this.dataStore.trackTimers[e];t.start&&(t.leng=t.leng+(+Date.now()-t.start)),t.start=0}},this.trackTimerResume=e=>{if(e&&this.dataStore.trackTimers[e]){const t=this.dataStore.trackTimers[e];0===t.start&&(t.start=+Date.now())}},this.trackTimerEnd=(e,t)=>{if(this.vdsConfig.dataCollect){const i=864e5;if(e&&this.dataStore.trackTimers[e]){const n=this.dataStore.trackTimers[e];if(0!==n.start){const e=+Date.now()-n.start;n.leng=e>0?n.leng+e:0}this.track(n.eventName,Object.assign(Object.assign({},t),{event_duration:n.leng>i?0:n.leng/1e3})),this.removeTimer(e)}else X("未查找到对应的计时器,请检查!","error")}},this.removeTimer=e=>{e&&this.dataStore.trackTimers[e]&&delete this.dataStore.trackTimers[e]},this.clearTrackTimer=()=>{this.dataStore.trackTimers={}},this.dataStore=new ri(this)}}let di;return function(){var e,t,i,n,s;let o=window.gioCompatibilityVds?"gdp_vds":"vds";if(null===(e=window[o])||void 0===e?void 0:e.gioSDKInstalled)return di=window.gdp,void X("SDK重复加载,请检查是否重复加载SDK或接入其他平台SDK导致冲突!","warn");window[o]=Object.assign(Object.assign({},null!==(t=window[o])&&void 0!==t?t:{}),{gioSDKInstalled:!0});const d=new ai;di=function(){var e;const t=arguments[0];if(I(t)&&L(r,t)&&d[t]){const e=x(R(arguments));if("init"===t){const t=(e=>{var t;return e.vdsConfig||e.gioSDKInitialized||(null===(t=window.vds)||void 0===t?void 0:t.gioSDKInitialized)?(X("SDK重复初始化,请检查是否重复加载SDK或接入其他平台SDK导致冲突!","warn"),!1):!(L(["","localhost","127.0.0.1"],location.hostname)&&!window._gr_ignore_local_rule&&(X("当前SDK不允许在本地环境初始化!","warn"),1))})(d);if(!t)return;const i=(e=>!F(A(e))||(X('SDK初始化失败,请使用 gdp("init", "您的GrowingIO项目 accountId", "您项目的 dataSourceId", options); 进行初始化!',"error"),!1))(e);if(!i)return;const n=(e=>{const t=N(e);let i=C(e);return te(k(t).trim())?(y(i)&&i||(i={}),{projectId:t,userOptions:i}):(X("SDK初始化失败,accountId 参数不合法!","error"),!1)})(e);if(!n)return;const r=(e=>{const t=e[1],i=e[2],n=C(e);return t&&I(t)?{dataSourceId:t,appId:I(i)?i:"",cdpOptions:n}:(X("SDK初始化失败,dataSourceId 参数不合法!","error"),!1)})(e);if(!r)return;const{projectId:s}=n,{dataSourceId:o,appId:a,cdpOptions:c}=r;d.init(Object.assign(Object.assign({},c),{projectId:s,dataSourceId:o,appId:a}))}else if("registerPlugins"===t)d.registerPlugins(e[0]);else{if(d.gioSDKInitialized&&d.vdsConfig)return d[t](...e);d.emitter.emit("UNINITIALIZED_CALL",arguments),X("SDK未初始化!","error")}}else L(a,t)?X(`方法 ${k(t)} 已被弃用,请移除!`,"warn"):X(`不存在名为 ${k(t)} 的方法调用!`,"error");window[o]=Object.assign(Object.assign({},window[o]),{_gr_ignore_local_rule:null!==(e=window._gr_ignore_local_rule)&&void 0!==e&&e,gioEnvironment:"cdp",gioSDKVersion:d.sdkVersion,gioSDKFull:d.gioSDKFull,canIUse:e=>L(r,e)&&d[e]})};const c=null===(i=null===window||void 0===window?void 0:window.gdp)||void 0===i?void 0:i.q,l=null===(n=null===window||void 0===window?void 0:window.gdp)||void 0===n?void 0:n.e,h=null===(s=null===window||void 0===window?void 0:window.gdp)||void 0===s?void 0:s.ef;window.gdp=di,window.gdp.e=l,window.gdp.ef=h,_(c)&&!F(c)&&c.forEach((e=>{di.apply(null,e)}))}(),di})); diff --git a/gdp.js b/gdp.js index aa5ae7e..dc6f81a 100644 --- a/gdp.js +++ b/gdp.js @@ -1 +1 @@ -const e=["web","wxwv","minp","alip","baidup","qq","bytedance"],t={autotrack:{type:"boolean",default:!0},compress:{type:"boolean",default:!0},dataCollect:{type:"boolean",default:!0},debug:{type:"boolean",default:!1},hashtag:{type:"boolean",default:!1},touch:{type:"boolean",default:!1},version:{type:"string",default:"1.0.0"},platform:{type:"string",default:"web"},cookieDomain:{type:"string",default:""},sendType:{type:"string",default:"beacon"}},i={enableIdMapping:{type:"boolean",default:!1},gtouchHost:{type:"string",default:""},host:{type:"string",default:"napi.growingio.com"},ignoreFields:{type:"array",default:[]},penetrateHybrid:{type:"boolean",default:!0},scheme:{type:"string",default:location.protocol.indexOf("http")>-1?location.protocol.replace(":",""):"https"},sessionExpires:{type:"number",default:30},performance:{type:"object",default:{monitor:!0,exception:!0}},embeddedIgnore:{type:"array",default:[]},storageType:{type:"string",default:"cookie"},requestTimeout:{type:"number",default:5e3}},s={},r=["clearUserId","getGioInfo","getLocation","getOption","init","setDataCollect","setOption","setUserId","track","setGeneralProps","clearGeneralProps","enableDebug","enableHT","setAutotrack","setTrackerHost","setTrackerScheme","setUserAttributes","getVisitorId","getDeviceId","registerPlugins","getPlugins","sendPage","sendVisit","trackTimerStart","trackTimerPause","trackTimerResume","trackTimerEnd","removeTimer","clearTrackTimer","updateImpression"],o=["autotrack","dataCollect","dataSourceId","debug","host","hashtag","scheme"],n={autotrack:"无埋点采集",dataCollect:"数据采集",debug:"调试模式"},a=["send","setConfig","collectImp","setPlatformProfile"],d=["screenHeight","screenWidth"];var l,g,h,c,u,m="function"==typeof Array.from?Array.from:(g||(g=1,h=function(e){return"function"==typeof e},c=function(e){var t=function(e){var t=Number(e);return isNaN(t)?0:0!==t&&isFinite(t)?(t>0?1:-1)*Math.floor(Math.abs(t)):t}(e);return Math.min(Math.max(t,0),9007199254740991)},u=function(e){var t=e.next();return!t.done&&t},l=function(e){var t,i,s,r=this,o=arguments.length>1?arguments[1]:void 0;if(void 0!==o){if(!h(o))throw new TypeError("Array.from: when provided, the second argument must be a function");arguments.length>2&&(t=arguments[2])}var n=function(e,t){if(null!=e&&null!=t){var i=e[t];if(null==i)return;if(!h(i))throw new TypeError(i+" is not a function");return i}}(e,function(e){if(null!=e){if(["string","number","boolean","symbol"].indexOf(typeof e)>-1)return Symbol.iterator;if("undefined"!=typeof Symbol&&"iterator"in Symbol&&Symbol.iterator in e)return Symbol.iterator;if("@@iterator"in e)return"@@iterator"}}(e));if(void 0!==n){i=h(r)?Object(new r):[];var a,d,l=n.call(e);if(null==l)throw new TypeError("Array.from requires an array-like or iterable object");for(s=0;;){if(!(a=u(l)))return i.length=s,i;d=a.value,i[s]=o?o.call(t,d,s):d,s++}}else{var g=Object(e);if(null==e)throw new TypeError("Array.from requires an array-like object - not null or undefined");var m,p=c(g.length);for(i=h(r)?Object(new r(p)):Array(p),s=0;p>s;)m=g[s],i[s]=o?o.call(t,m,s):m,s++;i.length=p}return i}),l);const p=e=>j(["undefined","null"],V(e)),I=e=>"string"===V(e),v=e=>"number"===V(e),w=e=>"NaN"===N(Number(e)),f=e=>"object"===V(e)&&!p(e),y=e=>"regexp"===V(e),S=e=>j(["function","asyncfunction"],V(e)),O=e=>Array.isArray(e)&&"array"===V(e),b=e=>"date"===V(e),E=e=>{try{return q(e)[0]}catch(e){return}},T=e=>{try{const t=q(e);return t[t.length-1]}catch(e){return}},_=(e,t=1)=>O(e)&&v(t)?e.slice(t>0?t:1,e.length):e,C=e=>{if(O(e)){let t=0;const i=[];for(const s of e)s&&!H(s)&&(i[t++]=s);return i}return e},k=(e,t)=>e[x(e,t)],x=(e,t)=>{let i=-1;return O(e)&&e.every(((e,s)=>!t(e)||(i=s,!1))),i},j=(e,t)=>("array"===V(e)||"string"===V(e))&&e.indexOf(t)>=0,q=m,N=e=>p(e)?"":""+e,P=(e,t)=>"string"==typeof e?e.split(t):e,D=e=>{if(I(e)){const t=P(e,"");return`${E(t).toLowerCase()}${_(t).join("")}`}return e},A=(e,t)=>!!I(e)&&e.slice(0,t.length)===t,U=(e,t)=>{if(I(e)){const{length:i}=e;let s=i;s>i&&(s=i);const r=s;return s-=t.length,s>=0&&e.slice(s,r)===t}return!1},K={}.hasOwnProperty,R=(e,t)=>!p(e)&&K.call(e,t),L=e=>f(e)?Object.keys(e):[],F=(e,t)=>{L(e).forEach((i=>t(e[i],i)))},$=(e,t)=>{const i=L(e);return!(!f(e)||!f(t)||i.length!==L(t).length||j(i.map(((i,s)=>f(e[i])?$(e[i],t[i]):e[i]===t[i])),!1))},B=(e,t)=>{if(!f(e))return!1;try{return"string"===V(t)?delete e[t]:"array"===V(t)?t.map((t=>delete e[t])):(y(t)&&L(e).forEach((i=>{t.test(i)&&B(e,i)})),!0)}catch(e){return!1}},H=e=>O(e)?0===e.length:f(e)?0===L(e).length:!e,V=e=>({}.toString.call(e).slice(8,-1).toLowerCase());var G=Object.freeze({__proto__:null,isNil:p,isString:I,isNumber:v,isNaN:w,isBoolean:e=>"boolean"===V(e),isObject:f,isRegExp:y,isFunction:S,isArray:O,isDate:b,fixed:(e,t)=>v(e)?Number(e.toFixed(v(t)?t:2)):I(e)&&"NaN"!==N(Number(e))?Number(Number(e).toFixed(v(t)?t:2)):e,head:E,last:T,drop:_,dropWhile:(e,t)=>O(e)?e.filter((e=>!t(e))):e,compact:C,find:k,findIndex:x,includes:j,arrayFrom:q,toString:N,split:P,lowerFirst:D,upperFirst:e=>{if(I(e)){const t=P(e,"");return`${E(t).toUpperCase()}${_(t).join("")}`}return e},startsWith:A,endsWith:U,has:R,keys:L,forEach:F,isEqual:$,get:(e,t,i)=>{let s=e;return f(e)?(t.split(".").forEach((e=>{s=s?s[e]:i})),s):i},unset:B,isEmpty:H,typeOf:V,formatDate:e=>{if(b(e)){const t=e=>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())}return e}});const M=(e,t)=>{console.log("%c [GrowingIO]:"+e,{info:"color: #3B82F6;",error:"color: #EF4444;",warn:"color: #F59E0B;",success:"color: #10B981;"}[t]||"")},z=e=>{try{return e()}catch(e){return}},W=e=>{const t={};return f(e)&&F(e,((e,i)=>{var s;const r=N(i).slice(0,100);f(e)?t[r]=W(e):O(e)?(t[r]=e.slice(0,100),"cdp"===(null===(s=window.vds)||void 0===s?void 0:s.gioEnvironment)&&(t[r]=t[r].join("||").slice(0,1e3))):t[r]=p(e)?"":N(e).slice(0,1e3)})),t},J=(e,t,i,s={})=>{document.addEventListener?e.addEventListener(t,i,Object.assign(Object.assign({},{capture:!0}),s)):e.attachEvent?e.attachEvent("on"+t,i):e["on"+t]=i},Q=(e,t)=>I(e)&&!H(e)&&e.match(/^[a-zA-Z_][0-9a-zA-Z_]{0,100}$/)?t():(M("事件名格式不正确,只能包含数字、字母和下划线,且不能以数字开头,字符总长度不能超过100!","error"),!1);var Z=Object.freeze({__proto__:null,consoleText:M,niceTry:z,limitObject:W,addListener:J,flattenObject:(e={})=>{const t=Object.assign({},e);return L(t).forEach((e=>{f(t[e])?(L(t[e]).forEach((i=>{t[`${e}_${i}`]=N(t[e][i])})),B(t,e)):O(t[e])?(t[e].forEach(((i,s)=>{f(i)?L(i).forEach((r=>{t[`${e}_${s}_${r}`]=N(i[r])})):t[`${e}_${s}`]=N(i)})),B(t,e)):p(t[e])||""===t[e]?B(t,e):t[e]=N(t[e])})),W(t)},eventNameValidate:Q,getGioFunction:()=>{var e,t,i,s;const r=window._gio_local_vds||"vds",o=null!==(t=null===(e=window[r])||void 0===e?void 0:e.namespace)&&void 0!==t?t:"gdp";return S(window[o])?window[o]:null!==(s=null!==(i=window.gdp)&&void 0!==i?i:window.gio)&&void 0!==s?s:function(){}}});const X=e=>I(e)&&e.length>0||v(e)&&e>0,Y=/^((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})(\.((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})){3}/i,ee=/^(https?:\/\/)|(([a-zA-Z0-9_-])+(\.)?)*(:\d+)?(\/((\.)?(\?)?=?&?[a-zA-Z0-9_-](\?)?)*)*$/i;function te(e){for(var t=1;arguments.length>t;t++){var i=arguments[t];for(var s in i)e[s]=i[s]}return e}var ie=function e(t,i){function s(e,s,r){if("undefined"!=typeof document){"number"==typeof(r=te({},i,r)).expires&&(r.expires=new Date(Date.now()+864e5*r.expires)),r.expires&&(r.expires=r.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var o="";for(var n in r)r[n]&&(o+="; "+n,!0!==r[n]&&(o+="="+r[n].split(";")[0]));return document.cookie=e+"="+t.write(s,e)+o}}return Object.create({set:s,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var i=document.cookie?document.cookie.split("; "):[],s={},r=0;r"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)})),re=e=>U(e,"_gioenc")?e.slice(0,-7):e,oe=e=>w(Number(e))&&z((()=>JSON.parse(e)))||e,ne={A:1,a:1,Z:1,z:1,"@":1,"{":1},ae=e=>p(e)?e:z((()=>"gioenc-"+le(e)))||e,de=e=>I(e)&&A(e,"gioenc-")&&z((()=>le(e.replace("gioenc-",""))))||e,le=e=>(e=e||"").split("").map((e=>ne[e]?e:ge(e))).join(""),ge=e=>{if(/[0-9]/.test(e))return 1^+e;{let t=e.charCodeAt(0);return String.fromCharCode(1^t)}};class he{constructor(e){this.domain=e,this.getItem=e=>oe(de(ie.get(re(e),{domain:this.domain,path:"/"}))),this.setItem=(e,t,i)=>{let s;s=I(t)?t.length?U(e,"_gioenc")?ae(t):t:"":JSON.stringify(t),ie.set(re(e),s,{expires:i?new Date(i):3650,domain:this.domain,path:"/"})},this.removeItem=e=>{ie.remove(re(e),{domain:this.domain,path:"/"})},this.hasItem=e=>j(L(ie.get()),re(e)),this.getKeys=()=>L(ie.get()),this.type="Cookie"}}class ce{constructor(){this.getItem=e=>{const t=z((()=>JSON.parse(localStorage.getItem(re(e))||"")))||{};return f(t)&&t.expiredAt>+Date.now()?oe(de(t.value)):void 0},this.setItem=(e,t,i)=>{const s=null!=i?i:+new Date(9999,12);localStorage.setItem(re(e),JSON.stringify({value:I(t)&&t.length&&U(e,"_gioenc")?ae(t):t,expiredAt:s}))},this.removeItem=e=>localStorage.removeItem(re(e)),this.hasItem=e=>!!localStorage.getItem(re(e)),this.getKeys=()=>q(Array(localStorage.length)).map(((e,t)=>localStorage.key(t))),this.type="localStorage"}}const ue={};class me{constructor(){this.getItem=e=>{const t=z((()=>JSON.parse(ue[re(e)]||"")));return f(t)&&t.expiredAt>+Date.now()?oe(de(t.value)):void 0},this.setItem=(e,t,i)=>{const s=null!=i?i:+new Date(9999,12);ue[re(e)]=JSON.stringify({value:I(t)&&t.length?ae(t):t,expiredAt:s})},this.removeItem=e=>B(ue,re(e)),this.hasItem=e=>R(ue,re(e)),this.getKeys=()=>L(ue),this.type="memory"}}let pe;const Ie=/^(\.ac\.|\.br\.|\.co\.|\.com\.|\.edu\.|\.gov\.|\.org\.|\.net\.)/,ve=e=>{const t=[];try{const i=e.split("."),s=T(i);if(i.length>=2&&(isNaN(Number(s))||0>Number(s)||Number(s)>255)){const e="."+i.slice(-2).join(".");Ie.test(e)?pe=e:t.push(e);const s="."+i.slice(-3).join(".");Ie.test(s)||j(t,s)||t.push(s);const r="."+i.slice(-4).join(".");Ie.test(r)||j(t,r)||t.push(r)}}catch(e){}return t},we=e=>{let t="";return e.every((e=>!fe(e)||(t=e,!1))),t},fe=e=>{try{ie.set("gioCookie","yes",{domain:e});const t=!!ie.get("gioCookie",{domain:e});return ie.remove("gioCookie",{domain:e}),t}catch(e){return!1}},ye=e=>{let t,i,s,{storageType:r,cookieDomain:o,projectId:n}=e;if(j(["cookie","localstorage"],r)||(r="cookie"),"cookie"===r&&(s=navigator.userAgent.indexOf("Electron")>-1||j(["","localhost","127.0.0.1"],window.location.hostname)||!j(["http:","https:"],window.location.protocol)?"":we([...ve(window.location.hostname),window.location.hostname]),i=!!s),"cookie"===r&&i){const e=new he(s);if(o){let t=ve(o);const i=we(H(t)?[]:[o,...ve(o)]);i&&fe(i)?e.domain=i:M("指定Cookie域无效或无权限,使用默认域!","warn")}t=e}else t=(()=>{try{const e=window.localStorage,t="__storage_test__";return e.setItem(t,t),e.removeItem(t),!0}catch(e){return!1}})()?new ce:new me;return"cookie"===r&&pe&&fe(pe)&&((e,t,i)=>{if(t&&fe(t)){let s=new he(t);[i+"_gdp_session_id","gdp_user_id_gioenc",i+"_gdp_cs1_gioenc",i+"_gdp_user_key_gioenc",i+"_gdp_gio_id_gioenc",i+"_gdp_sequence_ids",i+"_gdp_session_id_sent"].forEach((t=>{const i=s.getItem(t);s.hasItem(t)&&(e.setItem(t,i),s.removeItem(t))})),s=void 0}})(t,pe,n),t};var Se="SESSIONID_UPDATE",Oe={name:"gioCustomTracking",method:class{constructor(e){this.growingIO=e,this.getValidResourceItem=e=>{if(e&&f(e)&&e.id&&e.key){const t={id:I(e.id)?e.id:N(e.id),key:I(e.key)?e.key:N(e.key)};return e.attributes&&(t.attributes=e.attributes),t}},this.getDynamicAttributes=e=>(p(e)||L(e).forEach((t=>{S(e[t])?e[t]=e[t]():f(e[t])?B(e,t):O(e[t])||(e[t]=N(e[t]))})),e),this.buildCustomEvent=(e,t,i,s)=>{Q(e,(()=>{const{dataStore:{eventContextBuilder:r,eventConverter:o,currentPage:n}}=this.growingIO;let a=Object.assign({eventType:"CUSTOM",eventName:e,pageShowTimestamp:null==n?void 0:n.time,attributes:W(this.getDynamicAttributes(f(t)&&!H(t)?t:void 0)),resourceItem:W(this.getValidResourceItem(i))},r());H(s)||(a=Object.assign(Object.assign({},a),s)),o(a)}))},this.buildUserAttributesEvent=(e,t)=>{const{dataStore:{eventContextBuilder:i,eventConverter:s}}=this.growingIO;let r=Object.assign({eventType:"LOGIN_USER_ATTRIBUTES",attributes:W(e)},i());H(t)||(r=Object.assign(Object.assign({},r),t)),s(r)}}}};const be=["gioPerformance"];class Ee{constructor(e){var t,i,s,r;this.growingIO=e,this.innerPluginInit=()=>{var e;be.forEach((e=>{var t;return B(null===(t=this.pluginsContext)||void 0===t?void 0:t.plugins,e)})),L(null===(e=this.pluginsContext)||void 0===e?void 0:e.plugins).forEach((e=>{var t;const{name:i,method:s}=null===(t=this.pluginsContext)||void 0===t?void 0:t.plugins[e];k(this.pluginItems,(e=>e.name===i))||this.pluginItems.push({name:D(i||e),method:s||(e=>{})})})),H(this.pluginItems)||this.installAll()},this.install=(e,t,i)=>{var s,r;const o=t||k(this.pluginItems,(t=>t.name===e));if((null===(s=this.growingIO)||void 0===s?void 0:s.plugins)[e])return M(`重复加载插件 ${e} 或插件重名,已跳过加载!`,"warn"),!1;if(!o)return M(`插件加载失败!不存在名为 ${e} 的插件!`,"error"),!1;try{return(null===(r=this.growingIO)||void 0===r?void 0:r.plugins)[e]=new o.method(this.growingIO,i),"cdp"===this.growingIO.gioEnvironment&&t&&M("加载插件 "+e,"info"),!0}catch(e){return M("插件加载异常 "+e,"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)&&!k(this.pluginItems,(e=>e.name===t.name))&&this.pluginItems.push({name:D(t.name),method:t.method?t.method:()=>{}})}))},this.uninstall=e=>{var t;B(this.pluginItems,e);const i=B(null===(t=this.growingIO)||void 0===t?void 0:t.plugins,e);return i||M(`卸载插件 ${e} 失败!`,"error"),i},this.uninstallAll=()=>{this.pluginItems.forEach((e=>this.uninstall(e.name)))},this.lifeError=(e,t)=>M(`插件执行错误 ${e.name} ${t}`,"error"),this.onComposeBefore=e=>{this.pluginItems.forEach((t=>{var i;const s=null===(i=this.growingIO.plugins[t.name])||void 0===i?void 0:i.onComposeBefore;if(s&&S(s))try{s(e)}catch(e){this.lifeError(t,e)}}))},this.onComposeAfter=e=>{this.pluginItems.forEach((t=>{var i;const s=null===(i=this.growingIO.plugins[t.name])||void 0===i?void 0:i.onComposeAfter;if(s&&S(s))try{s(e)}catch(e){this.lifeError(t,e)}}))},this.onSendBefore=e=>{this.pluginItems.forEach((t=>{var i;const s=null===(i=this.growingIO.plugins[t.name])||void 0===i?void 0:i.onSendBefore;if(s&&S(s))try{s(e)}catch(e){this.lifeError(t,e)}}))},this.onSendAfter=e=>{this.pluginItems.forEach((t=>{var i;const s=null===(i=this.growingIO.plugins[t.name])||void 0===i?void 0:i.onSendAfter;if(s&&S(s))try{s(e)}catch(e){this.lifeError(t,e)}}))},this.pluginsContext={plugins:{}},this.pluginItems=[],null===(t=this.growingIO.emitter)||void 0===t||t.on("onComposeBefore",this.onComposeBefore),null===(i=this.growingIO.emitter)||void 0===i||i.on("onComposeAfter",this.onComposeAfter),null===(s=this.growingIO.emitter)||void 0===s||s.on("onSendBefore",this.onSendBefore),null===(r=this.growingIO.emitter)||void 0===r||r.on("onSendAfter",this.onSendAfter)}}class Te extends Ee{constructor(e){super(e),this.growingIO=e,this.growingIO.gioSDKFull=!1,this.pluginsContext={plugins:{gioCustomTracking:Oe}}}}class _e{constructor(){var e;this.trackingId="g0",this.init=e=>{var t,i,s,r,o;M("Gio Web SDK 初始化中...","info");const{initOptions:n,currentPage:a,sendVisit:d,sendPage:l}=this.dataStore;n(e),this.storage=ye(this.vdsConfig),this.initCallback(),null===(t=this.emitter)||void 0===t||t.emit("OPTION_INITIALIZED",this),null===(s=null===(i=this.plugins)||void 0===i?void 0:i.gioEventAutoTracking)||void 0===s||s.main(),a.hookHistory(),a.parsePage(),null===(r=this.emitter)||void 0===r||r.emit("SDK_INITIALIZED",this),M("Gio Web SDK 初始化完成!","success"),this.useEmbeddedInherit||(this.dataStore.lastVisitEvent.timestamp=a.time,d()),l(),this.gioSDKInitialized=!0,this.vdsConfig.gioSDKInitialized=!0,window[this.vds]=this.vdsConfig,null===(o=this.emitter)||void 0===o||o.emit("SDK_INITIALIZED_COMPLATE",this)},this.setOption=(e,t)=>{if(j(o,e)){const i=this.dataStore.setOption(e,t);return i&&n[e]&&M(`已${t?"开启":"关闭"}${n[e]}`,"info"),i}return M(`不存在可修改的配置项:${e},请检查后重试!`,"warn"),!1},this.getOption=e=>this.dataStore.getOption(e),this.setGeneralProps=e=>{f(e)&&!H(e)?(this.dataStore.generalProps=Object.assign(Object.assign({},this.dataStore.generalProps),e),L(this.dataStore.generalProps).forEach((e=>{j([void 0,null],this.dataStore.generalProps[e])&&(this.dataStore.generalProps[e]="")}))):this.callError("setGeneralProps")},this.clearGeneralProps=e=>{O(e)&&!H(e)?e.forEach((e=>{B(this.dataStore.generalProps,e)})):this.dataStore.generalProps={}},this.reissuePage=()=>{this.dataStore.sendPage()},this.notRecommended=()=>M("不推荐的方法使用,建议使用 gio('setOption', [optionName], [value])!","info"),this.callError=(e,t=!0,i="参数不合法")=>M(`${t?"调用":"设置"} ${e} 失败,${i}!`,"warn"),this.updateImpression=()=>{var e,t;const i=null===(t=null===(e=this.plugins)||void 0===e?void 0:e.gioImpressionTracking)||void 0===t?void 0:t.main;i?i("emitter"):M("updateImpression 错误! 请集成半自动埋点浏览插件后重试!","error")},this.gioEnvironment="cdp",this.sdkVersion="3.8.6",this.vds=window.gioCompatibilityVds?"gdp_vds":"vds",this.utils=Object.assign(Object.assign({},G),Z),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.useEmbeddedInherit=!1,this.useHybridInherit=!1,this.gioSDKInitialized=!1,this.plugins=new Te(this),this.plugins.innerPluginInit()}}class Ce{constructor(e){this.growingIO=e;const{projectId:t}=this.growingIO.vdsConfig,{getItem:i,setItem:s,getKeys:r,removeItem:o}=this.growingIO.storage;this.getItem=i,this.setItem=s,this.getKeys=r,this.removeItem=o,this.sIdStorageName=t+"_gdp_session_id",this.uidStorageName="gdp_user_id_gioenc",this.userIdStorageName=t+"_gdp_cs1_gioenc",this.userKeyStorageName=t+"_gdp_user_key_gioenc",this.gioIdStorageName=t+"_gdp_gio_id_gioenc"}get sessionId(){return this.getItem(this.sIdStorageName)||(this.sessionId=se(),this.sessionId)}set sessionId(e){var t;e||(e=se());const i=this.getItem(this.sIdStorageName)||this.prevSessionId,{sessionExpires:s=30}=this.growingIO.vdsConfig;this.setItem(this.sIdStorageName,e,+Date.now()+60*s*1e3),i!==e&&(this.getKeys().filter((e=>/.+_gdp_session_id_.{36}/.test(e))).forEach((e=>{this.removeItem(e)})),this.setItem(this.growingIO.dataStore.visitStorageName,""),null===(t=this.growingIO.emitter)||void 0===t||t.emit(Se,{newSessionId:e,oldSessionId:i})),this.prevSessionId=e}get uid(){return this.getItem(this.uidStorageName)||(this.uid=se(),this.uid)}set uid(e){var t;const i=this.getItem(this.uidStorageName)||this.prevUId;this.setItem(this.uidStorageName,e),i!==e&&(null===(t=this.growingIO.emitter)||void 0===t||t.emit("UID_UPDATE",{newUId:e,oldUId:i})),this.prevUId=e}get userId(){return this.getItem(this.userIdStorageName)||""}set userId(e){var t,i;const s=this.getItem(this.userIdStorageName)||this.prevUserId;this.setItem(this.userIdStorageName,e),null===(t=this.growingIO.emitter)||void 0===t||t.emit("SET_USERID",{newUserId:e,oldUserId:s,userKey:this.userKey}),s!==e&&(null===(i=this.growingIO.emitter)||void 0===i||i.emit("USERID_UPDATE",{newUserId:e,oldUserId:s,userKey:this.userKey})),e&&(this.gioId=e),this.prevUserId=e}get userKey(){return this.getItem(this.userKeyStorageName)||""}set userKey(e){var t,i;const s=this.getItem(this.userKeyStorageName)||this.prevUserKey;this.setItem(this.userKeyStorageName,e),null===(t=this.growingIO.emitter)||void 0===t||t.emit("SET_USERKEY",{newUserKey:e,oldUserKey:s,userId:this.userId}),s!==e&&(null===(i=this.growingIO.emitter)||void 0===i||i.emit("USERKEY_UPDATE",{newUserKey:e,oldUserKey:s,userId:this.userId})),this.prevUserKey=e}get gioId(){return this.getItem(this.gioIdStorageName)||""}set gioId(e){var t;const i=this.getItem(this.gioIdStorageName)||this.prevGioId;this.setItem(this.gioIdStorageName,e),i!==e&&(null===(t=this.growingIO.emitter)||void 0===t||t.emit("GIOID_UPDATE",{newGioId:e,oldGioId:i})),this.prevGioId=e}}class ke{constructor(e){this.growingIO=e,this.main=()=>{var e,t;const{sdkVersion:i,useEmbeddedInherit:s,vdsConfig:r,userStore:o,dataStore:n,trackingId:a}=this.growingIO,{path:d,query:l}=n.currentPage;let g={appVersion:r.version,dataSourceId:r.dataSourceId,deviceId:o.uid,domain:s?r.appId:window.location.host,gioId:o.gioId,language:navigator.language,path:d,platform:r.platform,query:l,referralPage:(null===(e=n.lastPageEvent)||void 0===e?void 0:e.referralPage)||"",screenHeight:window.screen.height,screenWidth:window.screen.width,sdkVersion:i,sessionId:o.sessionId,timestamp:+Date.now(),title:null!==(t=z((()=>document.title.slice(0,255))))&&void 0!==t?t:"",userId:o.userId};if(r.enableIdMapping&&(g.userKey=o.userKey),H(r.ignoreFields)||r.ignoreFields.forEach((e=>{B(g,e)})),s&&!H(this.minpExtraParams)){const e=Object.assign({},g);F(Object.assign(Object.assign({},g),this.minpExtraParams),((t,i)=>{var s;j(r.embeddedIgnore,i)?(g[i]=e[i],"domain"===i&&(g[i]=window.location.host)):g[i]=null!==(s=this.minpExtraParams[i])&&void 0!==s?s:g[i]}))}return g.trackingId=a,g},this.minpExtraParams={}}}class xe{constructor(e){this.growingIO=e,this.parsePage=()=>{const{hashtag:e}=this.growingIO.vdsConfig,t=location.pathname,i=location.search,s=location.hash,r=s.indexOf("?");this.domain=window.location.host,this.title=document.title.slice(0,255),this.time=+Date.now(),this.path=t,this.query=i,e&&(r>-1?(this.path+=s.slice(0,r),this.query=this.query+"&"+s.slice(r+1)):this.path+=s),this.query&&j(["?","&"],this.query.charAt(0))&&(this.query=this.query.slice(1))},this._getNoHashHref=()=>{const{protocol:e,host:t,pathname:i,search:s}=window.location;return`${e}://${t}${i}${s}`},this.getReferralPage=()=>{var e,t;const{dataStore:{lastPageEvent:i}}=this.growingIO;return(null==i?void 0:i.path)===this.path&&(null!==(e=null==i?void 0:i.query)&&void 0!==e?e:"")===(null!==(t=this.query)&&void 0!==t?t:"")?null==i?void 0:i.referralPage:(null==i?void 0:i.path)?this.lastHref:document.referrer},this.pageListener=()=>{const{hashtag:e}=this.growingIO.vdsConfig;let t=window.location.href,i=this.lastHref;e||(t=this._getNoHashHref(),i=this.lastNoHashHref),i!==t&&(this.parsePage(),this.buildPageEvent())},this.hookHistory=()=>{const e=window.history.pushState,t=window.history.replaceState,i=this;e&&z((()=>window.history.pushState=function(){e.apply(window.history,arguments),setTimeout(i.pageListener)})),t&&z((()=>window.history.replaceState=function(){t.apply(window.history,arguments),setTimeout(i.pageListener)})),J(window,"popstate",this.pageListener);const{hashtag:s}=this.growingIO.vdsConfig;s&&J(window,"hashchange",this.pageListener)},this.buildPageEvent=e=>{const{dataStore:{lastPageEvent:t,eventContextBuilder:i,eventConverter:s}}=this.growingIO;let r=Object.assign(Object.assign({eventType:"PAGE"},i()),{protocolType:location.protocol.substring(0,location.protocol.length-1),referralPage:this.getReferralPage()});H(e)||(r=Object.assign(Object.assign({},r),e)),r.timestamp=this.time,s(r),this.lastHref=window.location.href,this.lastNoHashHref=this._getNoHashHref(),this.lastLocation=Object.assign({},window.location)},this.title=document.title.slice(0,255),this.lastLocation=Object.assign({},window.location)}}const je={referralPage:document.referrer};class qe{constructor(r){var a,l,g;this.growingIO=r,this.ALLOW_SETTING=Object.assign(Object.assign({},t),"saas"===this.growingIO.gioEnvironment?s:i),this.allowOptKeys=Object.keys(this.ALLOW_SETTING),this.trackTimers={},this.setSequenceIds=(e,t)=>{let i=this.growingIO.storage.getItem(this.seqStorageIdName)||{};"gsid"===e?i.globalKey=t:i=Object.assign(Object.assign({},i),t),this.growingIO.storage.setItem(this.seqStorageIdName,i)},this.initOptions=t=>{var i,s,r,o,a,l,g;const{projectId:h,dataSourceId:c,appId:u}=t;this.initialDataSourceId=c;const m={};this.allowOptKeys.forEach((i=>{const s=this.ALLOW_SETTING[i].type;let r=O(s)?!j(s,V(t[i])):V(t[i])!==s;"platform"!==i||j(e,t[i])||(r=!0),r?m[i]=this.ALLOW_SETTING[i].default:"ignoreFields"===i?m.ignoreFields=t.ignoreFields.filter((e=>j(d,e))):(m[i]=t[i],j(["dataCollect","autotrack"],i)&&(m[i]||M("已关闭"+n[i],"info")))})),m.sessionExpires=Math.round(m.sessionExpires),(w(m.sessionExpires)||1>m.sessionExpires||m.sessionExpires>360)&&(m.sessionExpires=30),m.storageType=m.storageType.toLowerCase(),m.sendType=m.sendType.toLowerCase(),j(["beacon","xhr","image"],m.sendType)||(m.sendType="beacon"),!w(Number(m.requestTimeout))&&m.requestTimeout>0||(m.requestTimeout=5e3),this.growingIO.vdsConfig=Object.assign(Object.assign(Object.assign({},null!==(i=window.vds)&&void 0!==i?i:{}),m),{projectId:h,dataSourceId:c,appId:u,performance:{monitor:null===(r=null===(s=m.performance)||void 0===s?void 0:s.monitor)||void 0===r||r,exception:null===(a=null===(o=m.performance)||void 0===o?void 0:o.exception)||void 0===a||a,network:null!==(g=null===(l=m.performance)||void 0===l?void 0:l.network)&&void 0!==g&&g}}),window.vds=this.growingIO.vdsConfig,this.seqStorageIdName=h+"_gdp_sequence_ids",this.visitStorageName=h+"_gdp_session_id_sent"},this.setOption=(e,t)=>{var i;const{vdsConfig:s,callError:r,uploader:n,emitter:a}=this.growingIO,d=I(e)&&j(o,e),l=d&&typeof t===((null===(i=this.ALLOW_SETTING[e])||void 0===i?void 0:i.type)||"string"),g=Object.assign({},s);return d&&l?(s[e]=t,"dataCollect"===e&&g.dataCollect!==t&&(t?(this.sendVisit(!0),this.sendPage()):this.growingIO.clearTrackTimer()),j(["host","scheme"],e)&&(null==n||n.generateHost()),null==a||a.emit("OPTION_CHANGE",{optionName:e,optionValue:t}),window.vds[e]=t,!0):(r("setOption > "+e),!1)},this.getOption=e=>{const{vdsConfig:t,callError:i}=this.growingIO;return e&&R(t,N(e))?t[N(e)]:p(e)?Object.assign({},t):void i("getOption > "+e)},this.sendVisit=e=>{const{userStore:{sessionId:t},storage:i}=this.growingIO,s=i.getItem(this.visitStorageName);!e&&t===s||(this.lastVisitEvent.timestamp=this.currentPage.time-1,this.buildVisitEvent())},this.buildVisitEvent=e=>{const{dataStore:{eventContextBuilder:t,eventConverter:i},emitter:s,storage:r,userStore:o}=this.growingIO,{referralPage:n,title:a,path:d,query:l,timestamp:g}=this.lastVisitEvent;let h=Object.assign(Object.assign({eventType:"VISIT"},t()),{referralPage:n||this.currentPage.getReferralPage(),timestamp:g});d&&(h.title=a,h.path=d,h.query=l),H(e)||(h.session=(null==e?void 0:e.session)||h.session,h.trackingId=null==e?void 0:e.trackingId,h=Object.assign(Object.assign({},h),e));const c=({requestData:e})=>{"VISIT"===e.eventType&&e.trackingId===this.growingIO.trackingId&&(o.sessionId===e.sessionId&&r.setItem(this.visitStorageName,e.sessionId),s.off("onSendAfter",c))};s.on("onSendAfter",c),i(h)},this.sendPage=e=>{e&&this.currentPage.parsePage(),this.currentPage.buildPageEvent()},this.buildErrorEvent=e=>{const{dataStore:{eventContextBuilder:t,eventConverter:i}}=this.growingIO;i(Object.assign({eventType:"CUSTOM",pageShowTimestamp:this.currentPage.time,eventName:"onError",attributes:e},t()))},this.currentPage=new xe(this.growingIO),this.eventContextBuilderInst=new ke(this.growingIO),this.eventContextBuilder=this.eventContextBuilderInst.main,this.generalProps={},this.lastVisitEvent=je,null===(a=this.growingIO.emitter)||void 0===a||a.on("onComposeAfter",(({composedEvent:e})=>{"VISIT"!==e.eventType&&"vst"!==e.t||e.trackingId!==this.growingIO.trackingId||(this.lastVisitEvent=e)})),this.lastPageEvent={},null===(l=this.growingIO.emitter)||void 0===l||l.on("onComposeAfter",(({composedEvent:e})=>{"PAGE"!==e.eventType&&"page"!==e.t||e.trackingId!==this.growingIO.trackingId||(this.lastPageEvent=e)})),null===(g=this.growingIO.emitter)||void 0===g||g.on(Se,(()=>{if(this.growingIO.gioSDKInitialized){this.currentPage.parsePage();const{title:e,path:t,query:i,time:s,getReferralPage:r}=this.currentPage;this.lastVisitEvent={referralPage:document.referrer||r(),title:e,path:t,query:i,timestamp:s-1},this.sendVisit(!0),this.sendPage(!0)}}))}get esid(){const e=this.growingIO.storage.getItem(this.seqStorageIdName)||{};let t=Object.assign({},e);return B(t,"globalKey"),t=f(t)&&!p(t)?t:{},this._esid={},L(t).forEach((e=>{this._esid[e]=w(Number(t[e]))||t[e]>=1e9||1>t[e]?1:t[e]})),this._esid}set esid(e){const t={};L(e).forEach((i=>{t[i]=w(e[i])||e[i]>=1e9||1>e[i]?1:e[i]})),$(this._esid,t)||(this._esid=t,this.setSequenceIds("esid",this._esid))}get gsid(){const e=this.growingIO.storage.getItem(this.seqStorageIdName)||{},t=Number(e.globalKey);return this._gsid=w(t)||t>=1e9||1>t?1:t,this._gsid}set gsid(e){w(Number(e))||e>=1e9||1>e?this._gsid=1:this._gsid=e,this.setSequenceIds("gsid",this._gsid)}}class Ne extends qe{constructor(e){super(e),this.growingIO=e,this.eventConverter=e=>{var t;const{vdsConfig:i,dataStore:s,uploader:r}=this.growingIO;if(i.dataCollect){e.trackingId===this.growingIO.trackingId&&(e.globalSequenceId=s.gsid,e.eventSequenceId=s.esid[e.eventType]||1);const i={};F(e,((e,t)=>{var s;if("element"===t){const t=null!==(s=E(e))&&void 0!==s?s:{};F(t,((e,t)=>{H(e)&&0!==e||(i[t]=e)}))}else(H(e)||p(e))&&0!==e||(i[t]=e)})),e.trackingId===this.growingIO.trackingId&&(this.growingIO.dataStore.gsid+=1,this.growingIO.dataStore.esid=Object.assign(Object.assign({},this.growingIO.dataStore.esid),{[i.eventType]:(this.growingIO.dataStore.esid[i.eventType]||1)+1})),null===(t=this.growingIO.emitter)||void 0===t||t.emit("onComposeAfter",{composedEvent:Object.assign({},i)}),e.trackingId===this.growingIO.trackingId&&r.commitRequest(i)}else"VISIT"===e.eventType&&(this.lastVisitEvent=e)}}}class Pe{constructor(e){this.growingIO=e,this.getSendType=()=>{const{sendType:e}=this.growingIO.vdsConfig;return"beacon"===e?(()=>{var e;const t=!!(null===(e=null===window||void 0===window?void 0:window.navigator)||void 0===e?void 0:e.sendBeacon),i=window.navigator.userAgent;if(i.match(/(iPad|iPhone|iPod)/g)){const e=(e=>{const t=e.toLowerCase().match(/cpu.*os (.*?) like mac os/i);return!t||2>t.length?0:+t[1].split("_").slice(0,2).join(".")})(i);return t&&e>13}return t})()?"beacon":"xhr":e},this.commitRequest=e=>{const t=Object.assign({},e);this.requestQueue.push(Object.assign(Object.assign({},t),{requestType:this.getSendType()})),this.initiateRequest()},this.initiateRequest=()=>{var e,t;if([...this.requestQueue].length>0&&this.requestingNum(this.retryIds[e.globalSequenceId||e.esid]||0)<=this.retryLimit)),H(this.requestQueue))return;const n=this.requestQueue.shift(),{requestType:a}=n;null==s||s.emit("onSendBefore",{requestData:Object.assign({},n)});const d=Object.assign({},n);if(B(d,["requestType","trackingId"]),i.debug&&console.log("[GrowingIO Debug]:",JSON.stringify(d,null,2).replace(/\"/g,(()=>{const e=window.navigator.userAgent;return/(\d+\.\d)?(?:\.\d)?\s+safari\/?(\d+\.\d+)?/i.test(e)&&!/chrome\/(\d+\.\d+)/i.test(e)})()?"":'"')),this.requestingNum+=1,o)return this.requestSuccessFn(n),!1;let l=Object.assign({},d);switch(i.compress&&(null==r?void 0:r.gioCompress)?"image"===a?(this.compressType="11",l=null===(e=null==r?void 0:r.gioCompress)||void 0===e?void 0:e.compressToEncodedURIComponent(JSON.stringify([l]))):(this.compressType="1",l=null===(t=null==r?void 0:r.gioCompress)||void 0===t?void 0:t.compressToUint8Array(JSON.stringify([l]))):(this.compressType="0",l=JSON.stringify([l])),a){case"beacon":default:this.sendByBeacon(n,l);break;case"xhr":this.sendByXHR(n,l);break;case"image":this.sendByImage(n,l)}}},this.generateURL=()=>`${this.requestURL}?stm=${+Date.now()}&compress=${this.compressType}`,this.sendByBeacon=(e,t)=>{navigator.sendBeacon(this.generateURL(),t)?this.requestSuccessFn(e):this.requestFailFn(e,"beacon")},this.sendByXHR=(e,t)=>{const i=new XMLHttpRequest;if(i)return i.open("POST",this.generateURL(),!0),i.onload=()=>{204===i.status?this.requestSuccessFn(e):this.requestFailFn(e,"xhr")},i.ontimeout=i.onerror=i.onabort=()=>{this.requestFailFn(e,"xhr")},i.setRequestHeader("Content-Type","text/plain;charset=UTF-8"),i.timeout=this.growingIO.vdsConfig.requestTimeout,void i.send(t);if(null===window||void 0===window?void 0:window.XDomainRequest){const i=new window.XDomainRequest;i.open("POST",this.generateURL().replace("https://","http://"),!0),i.onload=()=>{204===i.status?this.requestSuccessFn(e):this.requestFailFn(e,"xhr")},i.onerror=i.ontimeout=()=>{this.requestFailFn(e,"xhr")},i.send(t)}},this.sendByImage=(e,t)=>{const i=`${this.generateURL()}&data=${t}`;let s=document.createElement("img");s.width=1,s.height=1;let r=window.setTimeout((()=>{this.requestingNum-=1,this.clearImage(s),window.clearTimeout(r),r=null,this.initiateRequest()}),this.growingIO.vdsConfig.requestTimeout);s.onload=()=>{this.requestSuccessFn(e),this.clearImage(s),window.clearTimeout(r),r=null},s.onerror=s.onabort=()=>{this.requestSuccessFn(e),this.clearImage(s),window.clearTimeout(r),r=null},s.src=i},this.clearImage=e=>{e.src="",e.onload=()=>{},e.onerror=e.onabort=()=>{},e=null},this.requestSuccessFn=e=>{var t;this.requestingNum-=1;const i=e.globalSequenceId||e.esid||-1;this.retryIds[i]&&(this.retryIds[i]=0),e.trackingId===this.growingIO.trackingId&&this.growingIO.userStore.sessionId===e.sessionId&&(this.growingIO.userStore.sessionId=e.sessionId),null===(t=this.growingIO.emitter)||void 0===t||t.emit("onSendAfter",{requestData:Object.assign({},e)}),this.initiateRequest()},this.requestFailFn=(e,t)=>{this.requestingNum-=1;const i=e.globalSequenceId||e.esid||-1;this.retryIds[i]||(this.retryIds[i]=0),this.retryIds[i]+=1;const s=this.requestQueue.some((t=>t.globalSequenceId===e.globalSequenceId&&t.esid===e.esid));let r=t;if(this.retryIds[i]{this.requestQueue.push(Object.assign(Object.assign({},e),{requestType:r})),this.initiateRequest(),window.clearTimeout(t),t=null}),800)}this.initiateRequest()},this.requestQueue=[],this.requestLimit=10,this.requestTimeout=5e3,this.retryLimit=2,this.retryIds={},this.requestingNum=0,this.requestURL=""}}class De extends Pe{constructor(e){super(e),this.growingIO=e,this.generateHost=()=>{let{scheme:e,host:t="",projectId:i}=this.growingIO.vdsConfig;e?U(N(e),"://")||(e+="://"):e=(location.protocol.indexOf("http")>-1?location.protocol.replace(":",""):"https")+"//",A(t,"http")&&(t=t.substring(t.indexOf("://")+(U(N(e),"://")?3:0))),this.requestURL=`${e}${t}/v3/projects/${i}/collect`},this.requestURL="",this.generateHost()}}class Ae extends _e{constructor(){super(),this.registerPlugins=e=>{O(e)?(e.forEach(((t,i)=>{var s,r;H(t)||p(t)?M("插件不合法,跳过加载!","warn"):(null===(s=t.js)||void 0===s?void 0:s.default)&&(e[i]=Object.assign(Object.assign({},null===(r=t.js)||void 0===r?void 0:r.default),{options:t.options}))})),e=C(e),this.plugins.installAll(e)):M("插件注册失败,请检查!","error")},this.initCallback=()=>{this.uploader=new De(this),this.userStore=new Ce(this)},this.getPlugins=()=>this.plugins.pluginItems,this.setTrackerScheme=e=>{j(["http","https"],e)?(this.dataStore.setOption("scheme",e),this.notRecommended()):this.callError("scheme",!1)},this.setTrackerHost=e=>{Y.test(e)||ee.test(e)?(this.dataStore.setOption("host",e),this.notRecommended()):this.callError("host",!1)},this.setDataCollect=e=>{this.setOption("dataCollect",!!e),this.notRecommended()},this.setAutotrack=e=>{this.setOption("autotrack",!!e),this.notRecommended()},this.enableDebug=e=>{this.setOption("debug",!!e),this.notRecommended()},this.enableHT=e=>{this.setOption("hashtag",!!e),this.notRecommended()},this.getVisitorId=()=>this.userStore.uid,this.getDeviceId=()=>this.userStore.uid,this.setUserAttributes=(e,t)=>{var i,s;!H(e)&&f(e)?null===(s=null===(i=this.plugins)||void 0===i?void 0:i.gioCustomTracking)||void 0===s||s.buildUserAttributesEvent(e,t):this.callError("setUserAttributes")},this.setUserId=(e,t)=>{if(X(N(e).trim())){const i=this.userStore.gioId;this.vdsConfig.enableIdMapping&&(this.userStore.userKey=!p(t)&&N(t).length>0?N(t).slice(0,1e3):""),this.userStore.userId=N(e).slice(0,1e3),i&&i!==this.userStore.userId&&(this.userStore.sessionId="")}else this.clearUserId(),this.callError("setUserId")},this.clearUserId=()=>{this.userStore.userId="",this.userStore.userKey=""},this.track=(e,t,i,s)=>{var r,o;((null===(o=null===(r=this.plugins)||void 0===r?void 0:r.gioCustomTracking)||void 0===o?void 0:o.buildCustomEvent)||function(){})(e,Object.assign(Object.assign({},this.dataStore.generalProps),f(t)&&!H(t)?t:{}),i,s)},this.sendPage=e=>this.dataStore.currentPage.buildPageEvent(e),this.sendVisit=e=>this.dataStore.buildVisitEvent(e),this.trackTimerStart=(e,t)=>{this.vdsConfig.dataCollect&&Q(e,(()=>{const i=se();S(t)?(this.dataStore.trackTimers[i]={eventName:e,leng:0,start:+Date.now()},t(i)):M("回调方法不合法,返回timerId失败!")}))},this.trackTimerPause=e=>{if(e&&this.dataStore.trackTimers[e]){const t=this.dataStore.trackTimers[e];t.start&&(t.leng=t.leng+(+Date.now()-t.start)),t.start=0}},this.trackTimerResume=e=>{if(e&&this.dataStore.trackTimers[e]){const t=this.dataStore.trackTimers[e];0===t.start&&(t.start=+Date.now())}},this.trackTimerEnd=(e,t)=>{if(this.vdsConfig.dataCollect){const i=864e5;if(e&&this.dataStore.trackTimers[e]){const s=this.dataStore.trackTimers[e];if(0!==s.start){const e=+Date.now()-s.start;s.leng=e>0?s.leng+e:0}this.track(s.eventName,Object.assign(Object.assign({},t),{event_duration:s.leng>i?0:s.leng/1e3})),this.removeTimer(e)}else M("未查找到对应的计时器,请检查!","error")}},this.removeTimer=e=>{e&&this.dataStore.trackTimers[e]&&delete this.dataStore.trackTimers[e]},this.clearTrackTimer=()=>{this.dataStore.trackTimers={}},this.dataStore=new Ne(this)}}let Ue;!function(){var e,t,i,s,o;let n=window.gioCompatibilityVds?"gdp_vds":"vds";if(null===(e=window[n])||void 0===e?void 0:e.gioSDKInstalled)return Ue=window.gdp,void M("SDK重复加载,请检查是否重复加载SDK或接入其他平台SDK导致冲突!","warn");window[n]=Object.assign(Object.assign({},null!==(t=window[n])&&void 0!==t?t:{}),{gioSDKInstalled:!0});const d=new Ae;Ue=function(){var e;const t=arguments[0];if(I(t)&&j(r,t)&&d[t]){const e=_(q(arguments));if("init"===t){const t=(e=>{var t;return e.vdsConfig||e.gioSDKInitialized||(null===(t=window.vds)||void 0===t?void 0:t.gioSDKInitialized)?(M("SDK重复初始化,请检查是否重复加载SDK或接入其他平台SDK导致冲突!","warn"),!1):!(j(["","localhost","127.0.0.1"],location.hostname)&&!window._gr_ignore_local_rule&&(M("当前SDK不允许在本地环境初始化!","warn"),1))})(d);if(!t)return;const i=(e=>!H(C(e))||(M('SDK初始化失败,请使用 gdp("init", "您的GrowingIO项目 accountId", "您项目的 dataSourceId", options); 进行初始化!',"error"),!1))(e);if(!i)return;const s=(e=>{const t=E(e);let i=T(e);return X(N(t).trim())?(f(i)&&i||(i={}),{projectId:t,userOptions:i}):(M("SDK初始化失败,accountId 参数不合法!","error"),!1)})(e);if(!s)return;const r=(e=>{const t=e[1],i=e[2],s=T(e);return t&&I(t)?{dataSourceId:t,appId:I(i)?i:"",cdpOptions:s}:(M("SDK初始化失败,dataSourceId 参数不合法!","error"),!1)})(e);if(!r)return;const{projectId:o}=s,{dataSourceId:n,appId:a,cdpOptions:l}=r;d.init(Object.assign(Object.assign({},l),{projectId:o,dataSourceId:n,appId:a}))}else if("registerPlugins"===t)d.registerPlugins(e[0]);else{if(d.gioSDKInitialized&&d.vdsConfig)return d[t](...e);d.emitter.emit("UNINITIALIZED_CALL",arguments),M("SDK未初始化!","error")}}else j(a,t)?M(`方法 ${N(t)} 已被弃用,请移除!`,"warn"):M(`不存在名为 ${N(t)} 的方法调用!`,"error");window[n]=Object.assign(Object.assign({},window[n]),{_gr_ignore_local_rule:null!==(e=window._gr_ignore_local_rule)&&void 0!==e&&e,gioEnvironment:"cdp",gioSDKVersion:d.sdkVersion,gioSDKFull:d.gioSDKFull,canIUse:e=>j(r,e)&&d[e]})};const l=null===(i=null===window||void 0===window?void 0:window.gdp)||void 0===i?void 0:i.q,g=null===(s=null===window||void 0===window?void 0:window.gdp)||void 0===s?void 0:s.e,h=null===(o=null===window||void 0===window?void 0:window.gdp)||void 0===o?void 0:o.ef;window.gdp=Ue,window.gdp.e=g,window.gdp.ef=h,O(l)&&!H(l)&&l.forEach((e=>{Ue.apply(null,e)}))}();var Ke=Ue;export{Ke as default}; +const e=["web","wxwv","minp","alip","baidup","qq","bytedance"],t={autotrack:{type:"boolean",default:!0},compress:{type:"boolean",default:!0},dataCollect:{type:"boolean",default:!0},debug:{type:"boolean",default:!1},hashtag:{type:"boolean",default:!1},touch:{type:"boolean",default:!1},version:{type:"string",default:"1.0.0"},platform:{type:"string",default:"web"},cookieDomain:{type:"string",default:""},sendType:{type:"string",default:"beacon"}},i={enableIdMapping:{type:"boolean",default:!1},gtouchHost:{type:"string",default:""},host:{type:"string",default:"napi.growingio.com"},ignoreFields:{type:"array",default:[]},penetrateHybrid:{type:"boolean",default:!0},scheme:{type:"string",default:location.protocol.indexOf("http")>-1?location.protocol.replace(":",""):"https"},sessionExpires:{type:"number",default:30},performance:{type:"object",default:{monitor:!0,exception:!0}},embeddedIgnore:{type:"array",default:[]},storageType:{type:"string",default:"cookie"},requestTimeout:{type:"number",default:5e3}},s={},r=["clearUserId","getGioInfo","getLocation","getOption","init","setDataCollect","setOption","setUserId","track","setGeneralProps","clearGeneralProps","enableDebug","enableHT","setAutotrack","setTrackerHost","setTrackerScheme","setUserAttributes","getVisitorId","getDeviceId","registerPlugins","getPlugins","sendPage","sendVisit","trackTimerStart","trackTimerPause","trackTimerResume","trackTimerEnd","removeTimer","clearTrackTimer","updateImpression"],o=["autotrack","dataCollect","dataSourceId","debug","host","hashtag","scheme"],n={autotrack:"无埋点采集",dataCollect:"数据采集",debug:"调试模式"},a=["send","setConfig","collectImp","setPlatformProfile"],d=["screenHeight","screenWidth"];var l,g,h,c,u,m="function"==typeof Array.from?Array.from:(g||(g=1,h=function(e){return"function"==typeof e},c=function(e){var t=function(e){var t=Number(e);return isNaN(t)?0:0!==t&&isFinite(t)?(t>0?1:-1)*Math.floor(Math.abs(t)):t}(e);return Math.min(Math.max(t,0),9007199254740991)},u=function(e){var t=e.next();return!t.done&&t},l=function(e){var t,i,s,r=this,o=arguments.length>1?arguments[1]:void 0;if(void 0!==o){if(!h(o))throw new TypeError("Array.from: when provided, the second argument must be a function");arguments.length>2&&(t=arguments[2])}var n=function(e,t){if(null!=e&&null!=t){var i=e[t];if(null==i)return;if(!h(i))throw new TypeError(i+" is not a function");return i}}(e,function(e){if(null!=e){if(["string","number","boolean","symbol"].indexOf(typeof e)>-1)return Symbol.iterator;if("undefined"!=typeof Symbol&&"iterator"in Symbol&&Symbol.iterator in e)return Symbol.iterator;if("@@iterator"in e)return"@@iterator"}}(e));if(void 0!==n){i=h(r)?Object(new r):[];var a,d,l=n.call(e);if(null==l)throw new TypeError("Array.from requires an array-like or iterable object");for(s=0;;){if(!(a=u(l)))return i.length=s,i;d=a.value,i[s]=o?o.call(t,d,s):d,s++}}else{var g=Object(e);if(null==e)throw new TypeError("Array.from requires an array-like object - not null or undefined");var m,p=c(g.length);for(i=h(r)?Object(new r(p)):Array(p),s=0;p>s;)m=g[s],i[s]=o?o.call(t,m,s):m,s++;i.length=p}return i}),l);const p=e=>j(["undefined","null"],V(e)),I=e=>"string"===V(e),v=e=>"number"===V(e),w=e=>"NaN"===N(Number(e)),f=e=>"object"===V(e)&&!p(e),y=e=>"regexp"===V(e),S=e=>j(["function","asyncfunction"],V(e)),O=e=>Array.isArray(e)&&"array"===V(e),b=e=>"date"===V(e),E=e=>{try{return q(e)[0]}catch(e){return}},T=e=>{try{const t=q(e);return t[t.length-1]}catch(e){return}},_=(e,t=1)=>O(e)&&v(t)?e.slice(t>0?t:1,e.length):e,C=e=>{if(O(e)){let t=0;const i=[];for(const s of e)s&&!H(s)&&(i[t++]=s);return i}return e},k=(e,t)=>e[x(e,t)],x=(e,t)=>{let i=-1;return O(e)&&e.every(((e,s)=>!t(e)||(i=s,!1))),i},j=(e,t)=>("array"===V(e)||"string"===V(e))&&e.indexOf(t)>=0,q=m,N=e=>p(e)?"":""+e,P=(e,t)=>"string"==typeof e?e.split(t):e,D=e=>{if(I(e)){const t=P(e,"");return`${E(t).toLowerCase()}${_(t).join("")}`}return e},A=(e,t)=>!!I(e)&&e.slice(0,t.length)===t,U=(e,t)=>{if(I(e)){const{length:i}=e;let s=i;s>i&&(s=i);const r=s;return s-=t.length,s>=0&&e.slice(s,r)===t}return!1},K={}.hasOwnProperty,R=(e,t)=>!p(e)&&K.call(e,t),L=e=>f(e)?Object.keys(e):[],F=(e,t)=>{L(e).forEach((i=>t(e[i],i)))},$=(e,t)=>{const i=L(e);return!(!f(e)||!f(t)||i.length!==L(t).length||j(i.map(((i,s)=>f(e[i])?$(e[i],t[i]):e[i]===t[i])),!1))},B=(e,t)=>{if(!f(e))return!1;try{return"string"===V(t)?delete e[t]:"array"===V(t)?t.map((t=>delete e[t])):(y(t)&&L(e).forEach((i=>{t.test(i)&&B(e,i)})),!0)}catch(e){return!1}},H=e=>O(e)?0===e.length:f(e)?0===L(e).length:!e,V=e=>({}.toString.call(e).slice(8,-1).toLowerCase());var G=Object.freeze({__proto__:null,isNil:p,isString:I,isNumber:v,isNaN:w,isBoolean:e=>"boolean"===V(e),isObject:f,isRegExp:y,isFunction:S,isArray:O,isDate:b,fixed:(e,t)=>v(e)?Number(e.toFixed(v(t)?t:2)):I(e)&&"NaN"!==N(Number(e))?Number(Number(e).toFixed(v(t)?t:2)):e,head:E,last:T,drop:_,dropWhile:(e,t)=>O(e)?e.filter((e=>!t(e))):e,compact:C,find:k,findIndex:x,includes:j,arrayFrom:q,toString:N,split:P,lowerFirst:D,upperFirst:e=>{if(I(e)){const t=P(e,"");return`${E(t).toUpperCase()}${_(t).join("")}`}return e},startsWith:A,endsWith:U,has:R,keys:L,forEach:F,isEqual:$,get:(e,t,i)=>{let s=e;return f(e)?(t.split(".").forEach((e=>{s=s?s[e]:i})),s):i},unset:B,isEmpty:H,typeOf:V,formatDate:e=>{if(b(e)){const t=e=>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())}return e}});const M=(e,t)=>{console.log("%c [GrowingIO]:"+e,{info:"color: #3B82F6;",error:"color: #EF4444;",warn:"color: #F59E0B;",success:"color: #10B981;"}[t]||"")},z=e=>{try{return e()}catch(e){return}},W=e=>{const t={};return f(e)&&F(e,((e,i)=>{var s;const r=N(i).slice(0,100);f(e)?t[r]=W(e):O(e)?(t[r]=e.slice(0,100),"cdp"===(null===(s=window.vds)||void 0===s?void 0:s.gioEnvironment)&&(t[r]=t[r].join("||").slice(0,1e3))):t[r]=p(e)?"":N(e).slice(0,1e3)})),t},J=(e,t,i,s={})=>{document.addEventListener?e.addEventListener(t,i,Object.assign(Object.assign({},{capture:!0}),s)):e.attachEvent?e.attachEvent("on"+t,i):e["on"+t]=i},Q=(e,t)=>I(e)&&!H(e)&&e.match(/^[a-zA-Z_][0-9a-zA-Z_]{0,100}$/)?t():(M("事件名格式不正确,只能包含数字、字母和下划线,且不能以数字开头,字符总长度不能超过100!","error"),!1);var Z=Object.freeze({__proto__:null,consoleText:M,niceTry:z,limitObject:W,addListener:J,flattenObject:(e={})=>{const t=Object.assign({},e);return L(t).forEach((e=>{f(t[e])?(L(t[e]).forEach((i=>{t[`${e}_${i}`]=N(t[e][i])})),B(t,e)):O(t[e])?(t[e].forEach(((i,s)=>{f(i)?L(i).forEach((r=>{t[`${e}_${s}_${r}`]=N(i[r])})):t[`${e}_${s}`]=N(i)})),B(t,e)):p(t[e])||""===t[e]?B(t,e):t[e]=N(t[e])})),W(t)},eventNameValidate:Q,getGioFunction:()=>{var e,t,i,s;const r=window._gio_local_vds||"vds",o=null!==(t=null===(e=window[r])||void 0===e?void 0:e.namespace)&&void 0!==t?t:"gdp";return S(window[o])?window[o]:null!==(s=null!==(i=window.gdp)&&void 0!==i?i:window.gio)&&void 0!==s?s:function(){}}});const X=e=>I(e)&&e.length>0||v(e)&&e>0,Y=/^((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})(\.((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})){3}/i,ee=/^(https?:\/\/)|(([a-zA-Z0-9_-])+(\.)?)*(:\d+)?(\/((\.)?(\?)?=?&?[a-zA-Z0-9_-](\?)?)*)*$/i;function te(e){for(var t=1;arguments.length>t;t++){var i=arguments[t];for(var s in i)e[s]=i[s]}return e}var ie=function e(t,i){function s(e,s,r){if("undefined"!=typeof document){"number"==typeof(r=te({},i,r)).expires&&(r.expires=new Date(Date.now()+864e5*r.expires)),r.expires&&(r.expires=r.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var o="";for(var n in r)r[n]&&(o+="; "+n,!0!==r[n]&&(o+="="+r[n].split(";")[0]));return document.cookie=e+"="+t.write(s,e)+o}}return Object.create({set:s,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var i=document.cookie?document.cookie.split("; "):[],s={},r=0;r"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)})),re=e=>U(e,"_gioenc")?e.slice(0,-7):e,oe=e=>w(Number(e))&&z((()=>JSON.parse(e)))||e,ne={A:1,a:1,Z:1,z:1,"@":1,"{":1},ae=e=>p(e)?e:z((()=>"gioenc-"+le(e)))||e,de=e=>I(e)&&A(e,"gioenc-")&&z((()=>le(e.replace("gioenc-",""))))||e,le=e=>(e=e||"").split("").map((e=>ne[e]?e:ge(e))).join(""),ge=e=>{if(/[0-9]/.test(e))return 1^+e;{let t=e.charCodeAt(0);return String.fromCharCode(1^t)}};class he{constructor(e){this.domain=e,this.getItem=e=>oe(de(ie.get(re(e),{domain:this.domain,path:"/"}))),this.setItem=(e,t,i)=>{let s;s=I(t)?t.length?U(e,"_gioenc")?ae(t):t:"":JSON.stringify(t),ie.set(re(e),s,{expires:i?new Date(i):3650,domain:this.domain,path:"/"})},this.removeItem=e=>{ie.remove(re(e),{domain:this.domain,path:"/"})},this.hasItem=e=>j(L(ie.get()),re(e)),this.getKeys=()=>L(ie.get()),this.type="Cookie"}}class ce{constructor(){this.getItem=e=>{const t=z((()=>JSON.parse(localStorage.getItem(re(e))||"")))||{};return f(t)&&t.expiredAt>+Date.now()?oe(de(t.value)):void 0},this.setItem=(e,t,i)=>{const s=null!=i?i:+new Date(9999,12);localStorage.setItem(re(e),JSON.stringify({value:I(t)&&t.length&&U(e,"_gioenc")?ae(t):t,expiredAt:s}))},this.removeItem=e=>localStorage.removeItem(re(e)),this.hasItem=e=>!!localStorage.getItem(re(e)),this.getKeys=()=>q(Array(localStorage.length)).map(((e,t)=>localStorage.key(t))),this.type="localStorage"}}const ue={};class me{constructor(){this.getItem=e=>{const t=z((()=>JSON.parse(ue[re(e)]||"")));return f(t)&&t.expiredAt>+Date.now()?oe(de(t.value)):void 0},this.setItem=(e,t,i)=>{const s=null!=i?i:+new Date(9999,12);ue[re(e)]=JSON.stringify({value:I(t)&&t.length?ae(t):t,expiredAt:s})},this.removeItem=e=>B(ue,re(e)),this.hasItem=e=>R(ue,re(e)),this.getKeys=()=>L(ue),this.type="memory"}}let pe;const Ie=/^(\.ac\.|\.br\.|\.co\.|\.com\.|\.edu\.|\.gov\.|\.org\.|\.net\.)/,ve=e=>{const t=[];try{const i=e.split("."),s=T(i);if(i.length>=2&&(isNaN(Number(s))||0>Number(s)||Number(s)>255)){const e="."+i.slice(-2).join(".");Ie.test(e)?pe=e:t.push(e);const s="."+i.slice(-3).join(".");Ie.test(s)||j(t,s)||t.push(s);const r="."+i.slice(-4).join(".");Ie.test(r)||j(t,r)||t.push(r)}}catch(e){}return t},we=e=>{let t="";return e.every((e=>!fe(e)||(t=e,!1))),t},fe=e=>{try{ie.set("gioCookie","yes",{domain:e});const t=!!ie.get("gioCookie",{domain:e});return ie.remove("gioCookie",{domain:e}),t}catch(e){return!1}},ye=e=>{let t,i,s,{storageType:r,cookieDomain:o,projectId:n}=e;if(j(["cookie","localstorage"],r)||(r="cookie"),"cookie"===r&&(s=navigator.userAgent.indexOf("Electron")>-1||j(["","localhost","127.0.0.1"],window.location.hostname)||!j(["http:","https:"],window.location.protocol)?"":we([...ve(window.location.hostname),window.location.hostname]),i=!!s),"cookie"===r&&i){const e=new he(s);if(o){let t=ve(o);const i=we(H(t)?[]:[o,...ve(o)]);i&&fe(i)?e.domain=i:M("指定Cookie域无效或无权限,使用默认域!","warn")}t=e}else t=(()=>{try{const e=window.localStorage,t="__storage_test__";return e.setItem(t,t),e.removeItem(t),!0}catch(e){return!1}})()?new ce:new me;return"cookie"===r&&pe&&fe(pe)&&((e,t,i)=>{if(t&&fe(t)){let s=new he(t);[i+"_gdp_session_id","gdp_user_id_gioenc",i+"_gdp_cs1_gioenc",i+"_gdp_user_key_gioenc",i+"_gdp_gio_id_gioenc",i+"_gdp_sequence_ids",i+"_gdp_session_id_sent"].forEach((t=>{const i=s.getItem(t);s.hasItem(t)&&(e.setItem(t,i),s.removeItem(t))})),s=void 0}})(t,pe,n),t};var Se="SESSIONID_UPDATE",Oe={name:"gioCustomTracking",method:class{constructor(e){this.growingIO=e,this.getValidResourceItem=e=>{if(e&&f(e)&&e.id&&e.key){const t={id:I(e.id)?e.id:N(e.id),key:I(e.key)?e.key:N(e.key)};return e.attributes&&(t.attributes=e.attributes),t}},this.getDynamicAttributes=e=>(p(e)||L(e).forEach((t=>{S(e[t])?e[t]=e[t]():f(e[t])?B(e,t):O(e[t])||(e[t]=N(e[t]))})),e),this.buildCustomEvent=(e,t,i,s)=>{Q(e,(()=>{const{dataStore:{eventContextBuilder:r,eventConverter:o,currentPage:n}}=this.growingIO;let a=Object.assign({eventType:"CUSTOM",eventName:e,pageShowTimestamp:null==n?void 0:n.time,attributes:W(this.getDynamicAttributes(f(t)&&!H(t)?t:void 0)),resourceItem:W(this.getValidResourceItem(i))},r());H(s)||(a=Object.assign(Object.assign({},a),s)),o(a)}))},this.buildUserAttributesEvent=(e,t)=>{const{dataStore:{eventContextBuilder:i,eventConverter:s}}=this.growingIO;let r=Object.assign({eventType:"LOGIN_USER_ATTRIBUTES",attributes:W(e)},i());H(t)||(r=Object.assign(Object.assign({},r),t)),s(r)}}}};const be=["gioPerformance"];class Ee{constructor(e){var t,i,s,r;this.growingIO=e,this.innerPluginInit=()=>{var e;be.forEach((e=>{var t;return B(null===(t=this.pluginsContext)||void 0===t?void 0:t.plugins,e)})),L(null===(e=this.pluginsContext)||void 0===e?void 0:e.plugins).forEach((e=>{var t;const{name:i,method:s}=null===(t=this.pluginsContext)||void 0===t?void 0:t.plugins[e];k(this.pluginItems,(e=>e.name===i))||this.pluginItems.push({name:D(i||e),method:s||(e=>{})})})),H(this.pluginItems)||this.installAll()},this.install=(e,t,i)=>{var s,r;const o=t||k(this.pluginItems,(t=>t.name===e));if((null===(s=this.growingIO)||void 0===s?void 0:s.plugins)[e])return M(`重复加载插件 ${e} 或插件重名,已跳过加载!`,"warn"),!1;if(!o)return M(`插件加载失败!不存在名为 ${e} 的插件!`,"error"),!1;try{return(null===(r=this.growingIO)||void 0===r?void 0:r.plugins)[e]=new o.method(this.growingIO,i),"cdp"===this.growingIO.gioEnvironment&&t&&M("加载插件 "+e,"info"),!0}catch(e){return M("插件加载异常 "+e,"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)&&!k(this.pluginItems,(e=>e.name===t.name))&&this.pluginItems.push({name:D(t.name),method:t.method?t.method:()=>{}})}))},this.uninstall=e=>{var t;B(this.pluginItems,e);const i=B(null===(t=this.growingIO)||void 0===t?void 0:t.plugins,e);return i||M(`卸载插件 ${e} 失败!`,"error"),i},this.uninstallAll=()=>{this.pluginItems.forEach((e=>this.uninstall(e.name)))},this.lifeError=(e,t)=>M(`插件执行错误 ${e.name} ${t}`,"error"),this.onComposeBefore=e=>{this.pluginItems.forEach((t=>{var i;const s=null===(i=this.growingIO.plugins[t.name])||void 0===i?void 0:i.onComposeBefore;if(s&&S(s))try{s(e)}catch(e){this.lifeError(t,e)}}))},this.onComposeAfter=e=>{this.pluginItems.forEach((t=>{var i;const s=null===(i=this.growingIO.plugins[t.name])||void 0===i?void 0:i.onComposeAfter;if(s&&S(s))try{s(e)}catch(e){this.lifeError(t,e)}}))},this.onSendBefore=e=>{this.pluginItems.forEach((t=>{var i;const s=null===(i=this.growingIO.plugins[t.name])||void 0===i?void 0:i.onSendBefore;if(s&&S(s))try{s(e)}catch(e){this.lifeError(t,e)}}))},this.onSendAfter=e=>{this.pluginItems.forEach((t=>{var i;const s=null===(i=this.growingIO.plugins[t.name])||void 0===i?void 0:i.onSendAfter;if(s&&S(s))try{s(e)}catch(e){this.lifeError(t,e)}}))},this.pluginsContext={plugins:{}},this.pluginItems=[],null===(t=this.growingIO.emitter)||void 0===t||t.on("onComposeBefore",this.onComposeBefore),null===(i=this.growingIO.emitter)||void 0===i||i.on("onComposeAfter",this.onComposeAfter),null===(s=this.growingIO.emitter)||void 0===s||s.on("onSendBefore",this.onSendBefore),null===(r=this.growingIO.emitter)||void 0===r||r.on("onSendAfter",this.onSendAfter)}}class Te extends Ee{constructor(e){super(e),this.growingIO=e,this.growingIO.gioSDKFull=!1,this.pluginsContext={plugins:{gioCustomTracking:Oe}}}}class _e{constructor(){var e;this.trackingId="g0",this.init=e=>{var t,i,s,r,o;M("Gio Web SDK 初始化中...","info");const{initOptions:n,currentPage:a,sendVisit:d,sendPage:l}=this.dataStore;n(e),this.storage=ye(this.vdsConfig),this.initCallback(),null===(t=this.emitter)||void 0===t||t.emit("OPTION_INITIALIZED",this),null===(s=null===(i=this.plugins)||void 0===i?void 0:i.gioEventAutoTracking)||void 0===s||s.main(),a.hookHistory(),a.parsePage(),null===(r=this.emitter)||void 0===r||r.emit("SDK_INITIALIZED",this),M("Gio Web SDK 初始化完成!","success"),this.useEmbeddedInherit||(this.dataStore.lastVisitEvent.timestamp=a.time,d()),l(),this.gioSDKInitialized=!0,this.vdsConfig.gioSDKInitialized=!0,window[this.vds]=this.vdsConfig,null===(o=this.emitter)||void 0===o||o.emit("SDK_INITIALIZED_COMPLATE",this)},this.setOption=(e,t)=>{if(j(o,e)){const i=this.dataStore.setOption(e,t);return i&&n[e]&&M(`已${t?"开启":"关闭"}${n[e]}`,"info"),i}return M(`不存在可修改的配置项:${e},请检查后重试!`,"warn"),!1},this.getOption=e=>this.dataStore.getOption(e),this.setGeneralProps=e=>{f(e)&&!H(e)?(this.dataStore.generalProps=Object.assign(Object.assign({},this.dataStore.generalProps),e),L(this.dataStore.generalProps).forEach((e=>{j([void 0,null],this.dataStore.generalProps[e])&&(this.dataStore.generalProps[e]="")}))):this.callError("setGeneralProps")},this.clearGeneralProps=e=>{O(e)&&!H(e)?e.forEach((e=>{B(this.dataStore.generalProps,e)})):this.dataStore.generalProps={}},this.reissuePage=()=>{this.dataStore.sendPage()},this.notRecommended=()=>M("不推荐的方法使用,建议使用 gio('setOption', [optionName], [value])!","info"),this.callError=(e,t=!0,i="参数不合法")=>M(`${t?"调用":"设置"} ${e} 失败,${i}!`,"warn"),this.updateImpression=()=>{var e,t;const i=null===(t=null===(e=this.plugins)||void 0===e?void 0:e.gioImpressionTracking)||void 0===t?void 0:t.main;i?i("emitter"):M("updateImpression 错误! 请集成半自动埋点浏览插件后重试!","error")},this.gioEnvironment="cdp",this.sdkVersion="3.8.7",this.vds=window.gioCompatibilityVds?"gdp_vds":"vds",this.utils=Object.assign(Object.assign({},G),Z),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.useEmbeddedInherit=!1,this.useHybridInherit=!1,this.gioSDKInitialized=!1,this.plugins=new Te(this),this.plugins.innerPluginInit()}}class Ce{constructor(e){this.growingIO=e;const{projectId:t}=this.growingIO.vdsConfig,{getItem:i,setItem:s,getKeys:r,removeItem:o}=this.growingIO.storage;this.getItem=i,this.setItem=s,this.getKeys=r,this.removeItem=o,this.sIdStorageName=t+"_gdp_session_id",this.uidStorageName="gdp_user_id_gioenc",this.userIdStorageName=t+"_gdp_cs1_gioenc",this.userKeyStorageName=t+"_gdp_user_key_gioenc",this.gioIdStorageName=t+"_gdp_gio_id_gioenc"}get sessionId(){return this.getItem(this.sIdStorageName)||(this.sessionId=se(),this.sessionId)}set sessionId(e){var t;e||(e=se());const i=this.getItem(this.sIdStorageName)||this.prevSessionId,{sessionExpires:s=30}=this.growingIO.vdsConfig;this.setItem(this.sIdStorageName,e,+Date.now()+60*s*1e3),i!==e&&(this.getKeys().filter((e=>/.+_gdp_session_id_.{36}/.test(e))).forEach((e=>{this.removeItem(e)})),this.setItem(this.growingIO.dataStore.visitStorageName,""),null===(t=this.growingIO.emitter)||void 0===t||t.emit(Se,{newSessionId:e,oldSessionId:i})),this.prevSessionId=e}get uid(){return this.getItem(this.uidStorageName)||(this.uid=se(),this.uid)}set uid(e){var t;const i=this.getItem(this.uidStorageName)||this.prevUId;this.setItem(this.uidStorageName,e),i!==e&&(null===(t=this.growingIO.emitter)||void 0===t||t.emit("UID_UPDATE",{newUId:e,oldUId:i})),this.prevUId=e}get userId(){return this.getItem(this.userIdStorageName)||""}set userId(e){var t,i;const s=this.getItem(this.userIdStorageName)||this.prevUserId;this.setItem(this.userIdStorageName,e),null===(t=this.growingIO.emitter)||void 0===t||t.emit("SET_USERID",{newUserId:e,oldUserId:s,userKey:this.userKey}),s!==e&&(null===(i=this.growingIO.emitter)||void 0===i||i.emit("USERID_UPDATE",{newUserId:e,oldUserId:s,userKey:this.userKey})),e&&(this.gioId=e),this.prevUserId=e}get userKey(){return this.getItem(this.userKeyStorageName)||""}set userKey(e){var t,i;const s=this.getItem(this.userKeyStorageName)||this.prevUserKey;this.setItem(this.userKeyStorageName,e),null===(t=this.growingIO.emitter)||void 0===t||t.emit("SET_USERKEY",{newUserKey:e,oldUserKey:s,userId:this.userId}),s!==e&&(null===(i=this.growingIO.emitter)||void 0===i||i.emit("USERKEY_UPDATE",{newUserKey:e,oldUserKey:s,userId:this.userId})),this.prevUserKey=e}get gioId(){return this.getItem(this.gioIdStorageName)||""}set gioId(e){var t;const i=this.getItem(this.gioIdStorageName)||this.prevGioId;this.setItem(this.gioIdStorageName,e),i!==e&&(null===(t=this.growingIO.emitter)||void 0===t||t.emit("GIOID_UPDATE",{newGioId:e,oldGioId:i})),this.prevGioId=e}}class ke{constructor(e){this.growingIO=e,this.main=()=>{var e,t;const{sdkVersion:i,useEmbeddedInherit:s,vdsConfig:r,userStore:o,dataStore:n,trackingId:a}=this.growingIO,{path:d,query:l}=n.currentPage;let g={appVersion:r.version,dataSourceId:r.dataSourceId,deviceId:o.uid,domain:s?r.appId:window.location.host,gioId:o.gioId,language:navigator.language,path:d,platform:r.platform,query:l,referralPage:(null===(e=n.lastPageEvent)||void 0===e?void 0:e.referralPage)||"",screenHeight:window.screen.height,screenWidth:window.screen.width,sdkVersion:i,sessionId:o.sessionId,timestamp:+Date.now(),title:null!==(t=z((()=>document.title.slice(0,255))))&&void 0!==t?t:"",userId:o.userId};if(r.enableIdMapping&&(g.userKey=o.userKey),H(r.ignoreFields)||r.ignoreFields.forEach((e=>{B(g,e)})),s&&!H(this.minpExtraParams)){const e=Object.assign({},g);F(Object.assign(Object.assign({},g),this.minpExtraParams),((t,i)=>{var s;j(r.embeddedIgnore,i)?(g[i]=e[i],"domain"===i&&(g[i]=window.location.host)):g[i]=null!==(s=this.minpExtraParams[i])&&void 0!==s?s:g[i]}))}return g.trackingId=a,g},this.minpExtraParams={}}}class xe{constructor(e){this.growingIO=e,this.parsePage=()=>{const{hashtag:e}=this.growingIO.vdsConfig,t=location.pathname,i=location.search,s=location.hash,r=s.indexOf("?");this.domain=window.location.host,this.title=document.title.slice(0,255),this.time=+Date.now(),this.path=t,this.query=i,e&&(r>-1?(this.path+=s.slice(0,r),this.query=this.query+"&"+s.slice(r+1)):this.path+=s),this.query&&j(["?","&"],this.query.charAt(0))&&(this.query=this.query.slice(1))},this._getNoHashHref=()=>{const{protocol:e,host:t,pathname:i,search:s}=window.location;return`${e}://${t}${i}${s}`},this.getReferralPage=()=>{var e,t;const{dataStore:{lastPageEvent:i}}=this.growingIO;return(null==i?void 0:i.path)===this.path&&(null!==(e=null==i?void 0:i.query)&&void 0!==e?e:"")===(null!==(t=this.query)&&void 0!==t?t:"")?null==i?void 0:i.referralPage:(null==i?void 0:i.path)?this.lastHref:document.referrer},this.pageListener=()=>{const{hashtag:e}=this.growingIO.vdsConfig;let t=window.location.href,i=this.lastHref;e||(t=this._getNoHashHref(),i=this.lastNoHashHref),i!==t&&(this.parsePage(),this.buildPageEvent())},this.hookHistory=()=>{const e=window.history.pushState,t=window.history.replaceState,i=this;e&&z((()=>window.history.pushState=function(){e.apply(window.history,arguments),setTimeout(i.pageListener)})),t&&z((()=>window.history.replaceState=function(){t.apply(window.history,arguments),setTimeout(i.pageListener)})),J(window,"popstate",this.pageListener);const{hashtag:s}=this.growingIO.vdsConfig;s&&J(window,"hashchange",this.pageListener)},this.buildPageEvent=e=>{const{dataStore:{lastPageEvent:t,eventContextBuilder:i,eventConverter:s}}=this.growingIO;let r=Object.assign(Object.assign({eventType:"PAGE"},i()),{protocolType:location.protocol.substring(0,location.protocol.length-1),referralPage:this.getReferralPage()});H(e)||(r=Object.assign(Object.assign({},r),e)),r.timestamp=this.time,s(r),this.lastHref=window.location.href,this.lastNoHashHref=this._getNoHashHref(),this.lastLocation=Object.assign({},window.location)},this.title=document.title.slice(0,255),this.lastLocation=Object.assign({},window.location)}}const je={referralPage:document.referrer};class qe{constructor(r){var a,l,g;this.growingIO=r,this.ALLOW_SETTING=Object.assign(Object.assign({},t),"saas"===this.growingIO.gioEnvironment?s:i),this.allowOptKeys=Object.keys(this.ALLOW_SETTING),this.trackTimers={},this.setSequenceIds=(e,t)=>{let i=this.growingIO.storage.getItem(this.seqStorageIdName)||{};"gsid"===e?i.globalKey=t:i=Object.assign(Object.assign({},i),t),this.growingIO.storage.setItem(this.seqStorageIdName,i)},this.initOptions=t=>{var i,s,r,o,a,l,g;const{projectId:h,dataSourceId:c,appId:u}=t;this.initialDataSourceId=c;const m={};this.allowOptKeys.forEach((i=>{const s=this.ALLOW_SETTING[i].type;let r=O(s)?!j(s,V(t[i])):V(t[i])!==s;"platform"!==i||j(e,t[i])||(r=!0),r?m[i]=this.ALLOW_SETTING[i].default:"ignoreFields"===i?m.ignoreFields=t.ignoreFields.filter((e=>j(d,e))):(m[i]=t[i],j(["dataCollect","autotrack"],i)&&(m[i]||M("已关闭"+n[i],"info")))})),m.sessionExpires=Math.round(m.sessionExpires),(w(m.sessionExpires)||1>m.sessionExpires||m.sessionExpires>360)&&(m.sessionExpires=30),m.storageType=m.storageType.toLowerCase(),m.sendType=m.sendType.toLowerCase(),j(["beacon","xhr","image"],m.sendType)||(m.sendType="beacon"),!w(Number(m.requestTimeout))&&m.requestTimeout>0||(m.requestTimeout=5e3),this.growingIO.vdsConfig=Object.assign(Object.assign(Object.assign({},null!==(i=window.vds)&&void 0!==i?i:{}),m),{projectId:h,dataSourceId:c,appId:u,performance:{monitor:null===(r=null===(s=m.performance)||void 0===s?void 0:s.monitor)||void 0===r||r,exception:null===(a=null===(o=m.performance)||void 0===o?void 0:o.exception)||void 0===a||a,network:null!==(g=null===(l=m.performance)||void 0===l?void 0:l.network)&&void 0!==g&&g}}),window.vds=this.growingIO.vdsConfig,this.seqStorageIdName=h+"_gdp_sequence_ids",this.visitStorageName=h+"_gdp_session_id_sent"},this.setOption=(e,t)=>{var i;const{vdsConfig:s,callError:r,uploader:n,emitter:a}=this.growingIO,d=I(e)&&j(o,e),l=d&&typeof t===((null===(i=this.ALLOW_SETTING[e])||void 0===i?void 0:i.type)||"string"),g=Object.assign({},s);return d&&l?(s[e]=t,"dataCollect"===e&&g.dataCollect!==t&&(t?(this.sendVisit(!0),this.sendPage()):this.growingIO.clearTrackTimer()),j(["host","scheme"],e)&&(null==n||n.generateHost()),null==a||a.emit("OPTION_CHANGE",{optionName:e,optionValue:t}),window.vds[e]=t,!0):(r("setOption > "+e),!1)},this.getOption=e=>{const{vdsConfig:t,callError:i}=this.growingIO;return e&&R(t,N(e))?t[N(e)]:p(e)?Object.assign({},t):void i("getOption > "+e)},this.sendVisit=e=>{const{userStore:{sessionId:t},storage:i}=this.growingIO,s=i.getItem(this.visitStorageName);!e&&t===s||(this.lastVisitEvent.timestamp=this.currentPage.time-1,this.buildVisitEvent())},this.buildVisitEvent=e=>{const{dataStore:{eventContextBuilder:t,eventConverter:i},emitter:s,storage:r,userStore:o}=this.growingIO,{referralPage:n,title:a,path:d,query:l,timestamp:g}=this.lastVisitEvent;let h=Object.assign(Object.assign({eventType:"VISIT"},t()),{referralPage:n||this.currentPage.getReferralPage(),timestamp:g});d&&(h.title=a,h.path=d,h.query=l),H(e)||(h.session=(null==e?void 0:e.session)||h.session,h.trackingId=null==e?void 0:e.trackingId,h=Object.assign(Object.assign({},h),e));const c=({requestData:e})=>{"VISIT"===e.eventType&&e.trackingId===this.growingIO.trackingId&&(o.sessionId===e.sessionId&&r.setItem(this.visitStorageName,e.sessionId),s.off("onSendAfter",c))};s.on("onSendAfter",c),i(h)},this.sendPage=e=>{e&&this.currentPage.parsePage(),this.currentPage.buildPageEvent()},this.buildErrorEvent=e=>{const{dataStore:{eventContextBuilder:t,eventConverter:i}}=this.growingIO;i(Object.assign({eventType:"CUSTOM",pageShowTimestamp:this.currentPage.time,eventName:"onError",attributes:e},t()))},this.currentPage=new xe(this.growingIO),this.eventContextBuilderInst=new ke(this.growingIO),this.eventContextBuilder=this.eventContextBuilderInst.main,this.generalProps={},this.lastVisitEvent=je,null===(a=this.growingIO.emitter)||void 0===a||a.on("onComposeAfter",(({composedEvent:e})=>{"VISIT"!==e.eventType&&"vst"!==e.t||e.trackingId!==this.growingIO.trackingId||(this.lastVisitEvent=e)})),this.lastPageEvent={},null===(l=this.growingIO.emitter)||void 0===l||l.on("onComposeAfter",(({composedEvent:e})=>{"PAGE"!==e.eventType&&"page"!==e.t||e.trackingId!==this.growingIO.trackingId||(this.lastPageEvent=e)})),null===(g=this.growingIO.emitter)||void 0===g||g.on(Se,(()=>{if(this.growingIO.gioSDKInitialized){this.currentPage.parsePage();const{title:e,path:t,query:i,time:s,getReferralPage:r}=this.currentPage;this.lastVisitEvent={referralPage:document.referrer||r(),title:e,path:t,query:i,timestamp:s-1},this.sendVisit(!0),this.sendPage(!0)}}))}get esid(){const e=this.growingIO.storage.getItem(this.seqStorageIdName)||{};let t=Object.assign({},e);return B(t,"globalKey"),t=f(t)&&!p(t)?t:{},this._esid={},L(t).forEach((e=>{this._esid[e]=w(Number(t[e]))||t[e]>=1e9||1>t[e]?1:t[e]})),this._esid}set esid(e){const t={};L(e).forEach((i=>{t[i]=w(e[i])||e[i]>=1e9||1>e[i]?1:e[i]})),$(this._esid,t)||(this._esid=t,this.setSequenceIds("esid",this._esid))}get gsid(){const e=this.growingIO.storage.getItem(this.seqStorageIdName)||{},t=Number(e.globalKey);return this._gsid=w(t)||t>=1e9||1>t?1:t,this._gsid}set gsid(e){w(Number(e))||e>=1e9||1>e?this._gsid=1:this._gsid=e,this.setSequenceIds("gsid",this._gsid)}}class Ne extends qe{constructor(e){super(e),this.growingIO=e,this.eventConverter=e=>{var t;const{vdsConfig:i,dataStore:s,uploader:r}=this.growingIO;if(i.dataCollect){e.trackingId===this.growingIO.trackingId&&(e.globalSequenceId=s.gsid,e.eventSequenceId=s.esid[e.eventType]||1);const i={};F(e,((e,t)=>{var s;if("element"===t){const t=null!==(s=E(e))&&void 0!==s?s:{};F(t,((e,t)=>{H(e)&&0!==e||(i[t]=e)}))}else(H(e)||p(e))&&0!==e||(i[t]=e)})),e.trackingId===this.growingIO.trackingId&&(this.growingIO.dataStore.gsid+=1,this.growingIO.dataStore.esid=Object.assign(Object.assign({},this.growingIO.dataStore.esid),{[i.eventType]:(this.growingIO.dataStore.esid[i.eventType]||1)+1})),null===(t=this.growingIO.emitter)||void 0===t||t.emit("onComposeAfter",{composedEvent:Object.assign({},i)}),e.trackingId===this.growingIO.trackingId&&r.commitRequest(i)}else"VISIT"===e.eventType&&(this.lastVisitEvent=e)}}}class Pe{constructor(e){this.growingIO=e,this.getSendType=()=>{const{sendType:e}=this.growingIO.vdsConfig;return"beacon"===e?(()=>{var e;const t=!!(null===(e=null===window||void 0===window?void 0:window.navigator)||void 0===e?void 0:e.sendBeacon),i=window.navigator.userAgent;if(i.match(/(iPad|iPhone|iPod)/g)){const e=(e=>{const t=e.toLowerCase().match(/cpu.*os (.*?) like mac os/i);return!t||2>t.length?0:+t[1].split("_").slice(0,2).join(".")})(i);return t&&e>13}return t})()?"beacon":"xhr":e},this.commitRequest=e=>{const t=Object.assign({},e);this.requestQueue.push(Object.assign(Object.assign({},t),{requestType:this.getSendType()})),this.initiateRequest()},this.initiateRequest=()=>{var e,t;if([...this.requestQueue].length>0&&this.requestingNum(this.retryIds[e.globalSequenceId||e.esid]||0)<=this.retryLimit)),H(this.requestQueue))return;const n=this.requestQueue.shift(),{requestType:a}=n;null==s||s.emit("onSendBefore",{requestData:Object.assign({},n)});const d=Object.assign({},n);if(B(d,["requestType","trackingId"]),i.debug&&console.log("[GrowingIO Debug]:",JSON.stringify(d,null,2).replace(/\"/g,(()=>{const e=window.navigator.userAgent;return/(\d+\.\d)?(?:\.\d)?\s+safari\/?(\d+\.\d+)?/i.test(e)&&!/chrome\/(\d+\.\d+)/i.test(e)})()?"":'"')),this.requestingNum+=1,o)return this.requestSuccessFn(n),!1;let l=Object.assign({},d);switch(i.compress&&(null==r?void 0:r.gioCompress)?"image"===a?(this.compressType="11",l=null===(e=null==r?void 0:r.gioCompress)||void 0===e?void 0:e.compressToEncodedURIComponent(JSON.stringify([l]))):(this.compressType="1",l=null===(t=null==r?void 0:r.gioCompress)||void 0===t?void 0:t.compressToUint8Array(JSON.stringify([l]))):(this.compressType="0",l=JSON.stringify([l])),a){case"beacon":default:this.sendByBeacon(n,l);break;case"xhr":this.sendByXHR(n,l);break;case"image":this.sendByImage(n,l)}}},this.generateURL=()=>`${this.requestURL}?stm=${+Date.now()}&compress=${this.compressType}`,this.sendByBeacon=(e,t)=>{navigator.sendBeacon(this.generateURL(),t)?this.requestSuccessFn(e):this.requestFailFn(e,"beacon")},this.sendByXHR=(e,t)=>{const i=new XMLHttpRequest;if(i)return i.open("POST",this.generateURL(),!0),i.onload=()=>{204===i.status?this.requestSuccessFn(e):this.requestFailFn(e,"xhr")},i.ontimeout=i.onerror=i.onabort=()=>{this.requestFailFn(e,"xhr")},i.setRequestHeader("Content-Type","text/plain;charset=UTF-8"),i.timeout=this.growingIO.vdsConfig.requestTimeout,void i.send(t);if(null===window||void 0===window?void 0:window.XDomainRequest){const i=new window.XDomainRequest;i.open("POST",this.generateURL().replace("https://","http://"),!0),i.onload=()=>{204===i.status?this.requestSuccessFn(e):this.requestFailFn(e,"xhr")},i.onerror=i.ontimeout=()=>{this.requestFailFn(e,"xhr")},i.send(t)}},this.sendByImage=(e,t)=>{const i=`${this.generateURL()}&data=${t}`;let s=document.createElement("img");s.width=1,s.height=1;let r=window.setTimeout((()=>{this.requestingNum-=1,this.clearImage(s),window.clearTimeout(r),r=null,this.initiateRequest()}),this.growingIO.vdsConfig.requestTimeout);s.onload=()=>{this.requestSuccessFn(e),this.clearImage(s),window.clearTimeout(r),r=null},s.onerror=s.onabort=()=>{this.requestSuccessFn(e),this.clearImage(s),window.clearTimeout(r),r=null},s.src=i},this.clearImage=e=>{e.src="",e.onload=()=>{},e.onerror=e.onabort=()=>{},e=null},this.requestSuccessFn=e=>{var t;this.requestingNum-=1;const i=e.globalSequenceId||e.esid||-1;this.retryIds[i]&&(this.retryIds[i]=0),e.trackingId===this.growingIO.trackingId&&this.growingIO.userStore.sessionId===e.sessionId&&(this.growingIO.userStore.sessionId=e.sessionId),null===(t=this.growingIO.emitter)||void 0===t||t.emit("onSendAfter",{requestData:Object.assign({},e)}),this.initiateRequest()},this.requestFailFn=(e,t)=>{this.requestingNum-=1;const i=e.globalSequenceId||e.esid||-1;this.retryIds[i]||(this.retryIds[i]=0),this.retryIds[i]+=1;const s=this.requestQueue.some((t=>t.globalSequenceId===e.globalSequenceId&&t.esid===e.esid));let r=t;if(this.retryIds[i]{this.requestQueue.push(Object.assign(Object.assign({},e),{requestType:r})),this.initiateRequest(),window.clearTimeout(t),t=null}),800)}this.initiateRequest()},this.requestQueue=[],this.requestLimit=10,this.requestTimeout=5e3,this.retryLimit=2,this.retryIds={},this.requestingNum=0,this.requestURL=""}}class De extends Pe{constructor(e){super(e),this.growingIO=e,this.generateHost=()=>{let{scheme:e,host:t="",projectId:i}=this.growingIO.vdsConfig;e?U(N(e),"://")||(e+="://"):e=(location.protocol.indexOf("http")>-1?location.protocol.replace(":",""):"https")+"//",A(t,"http")&&(t=t.substring(t.indexOf("://")+(U(N(e),"://")?3:0))),this.requestURL=`${e}${t}/v3/projects/${i}/collect`},this.requestURL="",this.generateHost()}}class Ae extends _e{constructor(){super(),this.registerPlugins=e=>{O(e)?(e.forEach(((t,i)=>{var s,r;H(t)||p(t)?M("插件不合法,跳过加载!","warn"):(null===(s=t.js)||void 0===s?void 0:s.default)&&(e[i]=Object.assign(Object.assign({},null===(r=t.js)||void 0===r?void 0:r.default),{options:t.options}))})),e=C(e),this.plugins.installAll(e)):M("插件注册失败,请检查!","error")},this.initCallback=()=>{this.uploader=new De(this),this.userStore=new Ce(this)},this.getPlugins=()=>this.plugins.pluginItems,this.setTrackerScheme=e=>{j(["http","https"],e)?(this.dataStore.setOption("scheme",e),this.notRecommended()):this.callError("scheme",!1)},this.setTrackerHost=e=>{Y.test(e)||ee.test(e)?(this.dataStore.setOption("host",e),this.notRecommended()):this.callError("host",!1)},this.setDataCollect=e=>{this.setOption("dataCollect",!!e),this.notRecommended()},this.setAutotrack=e=>{this.setOption("autotrack",!!e),this.notRecommended()},this.enableDebug=e=>{this.setOption("debug",!!e),this.notRecommended()},this.enableHT=e=>{this.setOption("hashtag",!!e),this.notRecommended()},this.getVisitorId=()=>this.userStore.uid,this.getDeviceId=()=>this.userStore.uid,this.setUserAttributes=(e,t)=>{var i,s;!H(e)&&f(e)?null===(s=null===(i=this.plugins)||void 0===i?void 0:i.gioCustomTracking)||void 0===s||s.buildUserAttributesEvent(e,t):this.callError("setUserAttributes")},this.setUserId=(e,t)=>{if(X(N(e).trim())){const i=this.userStore.gioId;this.vdsConfig.enableIdMapping&&(this.userStore.userKey=!p(t)&&N(t).length>0?N(t).slice(0,1e3):""),this.userStore.userId=N(e).slice(0,1e3),i&&i!==this.userStore.userId&&(this.userStore.sessionId="")}else this.clearUserId(),this.callError("setUserId")},this.clearUserId=()=>{this.userStore.userId="",this.userStore.userKey=""},this.track=(e,t,i,s)=>{var r,o;((null===(o=null===(r=this.plugins)||void 0===r?void 0:r.gioCustomTracking)||void 0===o?void 0:o.buildCustomEvent)||function(){})(e,Object.assign(Object.assign({},this.dataStore.generalProps),f(t)&&!H(t)?t:{}),i,s)},this.sendPage=e=>this.dataStore.currentPage.buildPageEvent(e),this.sendVisit=e=>this.dataStore.buildVisitEvent(e),this.trackTimerStart=(e,t)=>{this.vdsConfig.dataCollect&&Q(e,(()=>{const i=se();S(t)?(this.dataStore.trackTimers[i]={eventName:e,leng:0,start:+Date.now()},t(i)):M("回调方法不合法,返回timerId失败!")}))},this.trackTimerPause=e=>{if(e&&this.dataStore.trackTimers[e]){const t=this.dataStore.trackTimers[e];t.start&&(t.leng=t.leng+(+Date.now()-t.start)),t.start=0}},this.trackTimerResume=e=>{if(e&&this.dataStore.trackTimers[e]){const t=this.dataStore.trackTimers[e];0===t.start&&(t.start=+Date.now())}},this.trackTimerEnd=(e,t)=>{if(this.vdsConfig.dataCollect){const i=864e5;if(e&&this.dataStore.trackTimers[e]){const s=this.dataStore.trackTimers[e];if(0!==s.start){const e=+Date.now()-s.start;s.leng=e>0?s.leng+e:0}this.track(s.eventName,Object.assign(Object.assign({},t),{event_duration:s.leng>i?0:s.leng/1e3})),this.removeTimer(e)}else M("未查找到对应的计时器,请检查!","error")}},this.removeTimer=e=>{e&&this.dataStore.trackTimers[e]&&delete this.dataStore.trackTimers[e]},this.clearTrackTimer=()=>{this.dataStore.trackTimers={}},this.dataStore=new Ne(this)}}let Ue;!function(){var e,t,i,s,o;let n=window.gioCompatibilityVds?"gdp_vds":"vds";if(null===(e=window[n])||void 0===e?void 0:e.gioSDKInstalled)return Ue=window.gdp,void M("SDK重复加载,请检查是否重复加载SDK或接入其他平台SDK导致冲突!","warn");window[n]=Object.assign(Object.assign({},null!==(t=window[n])&&void 0!==t?t:{}),{gioSDKInstalled:!0});const d=new Ae;Ue=function(){var e;const t=arguments[0];if(I(t)&&j(r,t)&&d[t]){const e=_(q(arguments));if("init"===t){const t=(e=>{var t;return e.vdsConfig||e.gioSDKInitialized||(null===(t=window.vds)||void 0===t?void 0:t.gioSDKInitialized)?(M("SDK重复初始化,请检查是否重复加载SDK或接入其他平台SDK导致冲突!","warn"),!1):!(j(["","localhost","127.0.0.1"],location.hostname)&&!window._gr_ignore_local_rule&&(M("当前SDK不允许在本地环境初始化!","warn"),1))})(d);if(!t)return;const i=(e=>!H(C(e))||(M('SDK初始化失败,请使用 gdp("init", "您的GrowingIO项目 accountId", "您项目的 dataSourceId", options); 进行初始化!',"error"),!1))(e);if(!i)return;const s=(e=>{const t=E(e);let i=T(e);return X(N(t).trim())?(f(i)&&i||(i={}),{projectId:t,userOptions:i}):(M("SDK初始化失败,accountId 参数不合法!","error"),!1)})(e);if(!s)return;const r=(e=>{const t=e[1],i=e[2],s=T(e);return t&&I(t)?{dataSourceId:t,appId:I(i)?i:"",cdpOptions:s}:(M("SDK初始化失败,dataSourceId 参数不合法!","error"),!1)})(e);if(!r)return;const{projectId:o}=s,{dataSourceId:n,appId:a,cdpOptions:l}=r;d.init(Object.assign(Object.assign({},l),{projectId:o,dataSourceId:n,appId:a}))}else if("registerPlugins"===t)d.registerPlugins(e[0]);else{if(d.gioSDKInitialized&&d.vdsConfig)return d[t](...e);d.emitter.emit("UNINITIALIZED_CALL",arguments),M("SDK未初始化!","error")}}else j(a,t)?M(`方法 ${N(t)} 已被弃用,请移除!`,"warn"):M(`不存在名为 ${N(t)} 的方法调用!`,"error");window[n]=Object.assign(Object.assign({},window[n]),{_gr_ignore_local_rule:null!==(e=window._gr_ignore_local_rule)&&void 0!==e&&e,gioEnvironment:"cdp",gioSDKVersion:d.sdkVersion,gioSDKFull:d.gioSDKFull,canIUse:e=>j(r,e)&&d[e]})};const l=null===(i=null===window||void 0===window?void 0:window.gdp)||void 0===i?void 0:i.q,g=null===(s=null===window||void 0===window?void 0:window.gdp)||void 0===s?void 0:s.e,h=null===(o=null===window||void 0===window?void 0:window.gdp)||void 0===o?void 0:o.ef;window.gdp=Ue,window.gdp.e=g,window.gdp.ef=h,O(l)&&!H(l)&&l.forEach((e=>{Ue.apply(null,e)}))}();var Ke=Ue;export{Ke as default}; diff --git a/gdp.umd.js b/gdp.umd.js index 0986057..fb7374d 100644 --- a/gdp.umd.js +++ b/gdp.umd.js @@ -1 +1 @@ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).gdp=t()}(this,(function(){"use strict";const e=["web","wxwv","minp","alip","baidup","qq","bytedance"],t={autotrack:{type:"boolean",default:!0},compress:{type:"boolean",default:!0},dataCollect:{type:"boolean",default:!0},debug:{type:"boolean",default:!1},hashtag:{type:"boolean",default:!1},touch:{type:"boolean",default:!1},version:{type:"string",default:"1.0.0"},platform:{type:"string",default:"web"},cookieDomain:{type:"string",default:""},sendType:{type:"string",default:"beacon"}},i={enableIdMapping:{type:"boolean",default:!1},gtouchHost:{type:"string",default:""},host:{type:"string",default:"napi.growingio.com"},ignoreFields:{type:"array",default:[]},penetrateHybrid:{type:"boolean",default:!0},scheme:{type:"string",default:location.protocol.indexOf("http")>-1?location.protocol.replace(":",""):"https"},sessionExpires:{type:"number",default:30},performance:{type:"object",default:{monitor:!0,exception:!0}},embeddedIgnore:{type:"array",default:[]},storageType:{type:"string",default:"cookie"},requestTimeout:{type:"number",default:5e3}},s={},o=["clearUserId","getGioInfo","getLocation","getOption","init","setDataCollect","setOption","setUserId","track","setGeneralProps","clearGeneralProps","enableDebug","enableHT","setAutotrack","setTrackerHost","setTrackerScheme","setUserAttributes","getVisitorId","getDeviceId","registerPlugins","getPlugins","sendPage","sendVisit","trackTimerStart","trackTimerPause","trackTimerResume","trackTimerEnd","removeTimer","clearTrackTimer","updateImpression"],r=["autotrack","dataCollect","dataSourceId","debug","host","hashtag","scheme"],n={autotrack:"无埋点采集",dataCollect:"数据采集",debug:"调试模式"},a=["send","setConfig","collectImp","setPlatformProfile"],d=["screenHeight","screenWidth"];var l,g,h,c,u,m="function"==typeof Array.from?Array.from:(g||(g=1,h=function(e){return"function"==typeof e},c=function(e){var t=function(e){var t=Number(e);return isNaN(t)?0:0!==t&&isFinite(t)?(t>0?1:-1)*Math.floor(Math.abs(t)):t}(e);return Math.min(Math.max(t,0),9007199254740991)},u=function(e){var t=e.next();return!t.done&&t},l=function(e){var t,i,s,o=this,r=arguments.length>1?arguments[1]:void 0;if(void 0!==r){if(!h(r))throw new TypeError("Array.from: when provided, the second argument must be a function");arguments.length>2&&(t=arguments[2])}var n=function(e,t){if(null!=e&&null!=t){var i=e[t];if(null==i)return;if(!h(i))throw new TypeError(i+" is not a function");return i}}(e,function(e){if(null!=e){if(["string","number","boolean","symbol"].indexOf(typeof e)>-1)return Symbol.iterator;if("undefined"!=typeof Symbol&&"iterator"in Symbol&&Symbol.iterator in e)return Symbol.iterator;if("@@iterator"in e)return"@@iterator"}}(e));if(void 0!==n){i=h(o)?Object(new o):[];var a,d,l=n.call(e);if(null==l)throw new TypeError("Array.from requires an array-like or iterable object");for(s=0;;){if(!(a=u(l)))return i.length=s,i;d=a.value,i[s]=r?r.call(t,d,s):d,s++}}else{var g=Object(e);if(null==e)throw new TypeError("Array.from requires an array-like object - not null or undefined");var m,p=c(g.length);for(i=h(o)?Object(new o(p)):Array(p),s=0;p>s;)m=g[s],i[s]=r?r.call(t,m,s):m,s++;i.length=p}return i}),l);const p=e=>j(["undefined","null"],V(e)),I=e=>"string"===V(e),v=e=>"number"===V(e),f=e=>"NaN"===N(Number(e)),w=e=>"object"===V(e)&&!p(e),y=e=>"regexp"===V(e),S=e=>j(["function","asyncfunction"],V(e)),O=e=>Array.isArray(e)&&"array"===V(e),b=e=>"date"===V(e),E=e=>{try{return q(e)[0]}catch(e){return}},T=e=>{try{const t=q(e);return t[t.length-1]}catch(e){return}},_=(e,t=1)=>O(e)&&v(t)?e.slice(t>0?t:1,e.length):e,C=e=>{if(O(e)){let t=0;const i=[];for(const s of e)s&&!H(s)&&(i[t++]=s);return i}return e},x=(e,t)=>e[k(e,t)],k=(e,t)=>{let i=-1;return O(e)&&e.every(((e,s)=>!t(e)||(i=s,!1))),i},j=(e,t)=>("array"===V(e)||"string"===V(e))&&e.indexOf(t)>=0,q=m,N=e=>p(e)?"":""+e,P=(e,t)=>"string"==typeof e?e.split(t):e,D=e=>{if(I(e)){const t=P(e,"");return`${E(t).toLowerCase()}${_(t).join("")}`}return e},A=(e,t)=>!!I(e)&&e.slice(0,t.length)===t,U=(e,t)=>{if(I(e)){const{length:i}=e;let s=i;s>i&&(s=i);const o=s;return s-=t.length,s>=0&&e.slice(s,o)===t}return!1},K={}.hasOwnProperty,R=(e,t)=>!p(e)&&K.call(e,t),L=e=>w(e)?Object.keys(e):[],F=(e,t)=>{L(e).forEach((i=>t(e[i],i)))},$=(e,t)=>{const i=L(e);return!(!w(e)||!w(t)||i.length!==L(t).length||j(i.map(((i,s)=>w(e[i])?$(e[i],t[i]):e[i]===t[i])),!1))},B=(e,t)=>{if(!w(e))return!1;try{return"string"===V(t)?delete e[t]:"array"===V(t)?t.map((t=>delete e[t])):(y(t)&&L(e).forEach((i=>{t.test(i)&&B(e,i)})),!0)}catch(e){return!1}},H=e=>O(e)?0===e.length:w(e)?0===L(e).length:!e,V=e=>({}.toString.call(e).slice(8,-1).toLowerCase());var G=Object.freeze({__proto__:null,isNil:p,isString:I,isNumber:v,isNaN:f,isBoolean:e=>"boolean"===V(e),isObject:w,isRegExp:y,isFunction:S,isArray:O,isDate:b,fixed:(e,t)=>v(e)?Number(e.toFixed(v(t)?t:2)):I(e)&&"NaN"!==N(Number(e))?Number(Number(e).toFixed(v(t)?t:2)):e,head:E,last:T,drop:_,dropWhile:(e,t)=>O(e)?e.filter((e=>!t(e))):e,compact:C,find:x,findIndex:k,includes:j,arrayFrom:q,toString:N,split:P,lowerFirst:D,upperFirst:e=>{if(I(e)){const t=P(e,"");return`${E(t).toUpperCase()}${_(t).join("")}`}return e},startsWith:A,endsWith:U,has:R,keys:L,forEach:F,isEqual:$,get:(e,t,i)=>{let s=e;return w(e)?(t.split(".").forEach((e=>{s=s?s[e]:i})),s):i},unset:B,isEmpty:H,typeOf:V,formatDate:e=>{if(b(e)){const t=e=>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())}return e}});const M=(e,t)=>{console.log("%c [GrowingIO]:"+e,{info:"color: #3B82F6;",error:"color: #EF4444;",warn:"color: #F59E0B;",success:"color: #10B981;"}[t]||"")},z=e=>{try{return e()}catch(e){return}},W=e=>{const t={};return w(e)&&F(e,((e,i)=>{var s;const o=N(i).slice(0,100);w(e)?t[o]=W(e):O(e)?(t[o]=e.slice(0,100),"cdp"===(null===(s=window.vds)||void 0===s?void 0:s.gioEnvironment)&&(t[o]=t[o].join("||").slice(0,1e3))):t[o]=p(e)?"":N(e).slice(0,1e3)})),t},J=(e,t,i,s={})=>{document.addEventListener?e.addEventListener(t,i,Object.assign(Object.assign({},{capture:!0}),s)):e.attachEvent?e.attachEvent("on"+t,i):e["on"+t]=i},Q=(e,t)=>I(e)&&!H(e)&&e.match(/^[a-zA-Z_][0-9a-zA-Z_]{0,100}$/)?t():(M("事件名格式不正确,只能包含数字、字母和下划线,且不能以数字开头,字符总长度不能超过100!","error"),!1);var Z=Object.freeze({__proto__:null,consoleText:M,niceTry:z,limitObject:W,addListener:J,flattenObject:(e={})=>{const t=Object.assign({},e);return L(t).forEach((e=>{w(t[e])?(L(t[e]).forEach((i=>{t[`${e}_${i}`]=N(t[e][i])})),B(t,e)):O(t[e])?(t[e].forEach(((i,s)=>{w(i)?L(i).forEach((o=>{t[`${e}_${s}_${o}`]=N(i[o])})):t[`${e}_${s}`]=N(i)})),B(t,e)):p(t[e])||""===t[e]?B(t,e):t[e]=N(t[e])})),W(t)},eventNameValidate:Q,getGioFunction:()=>{var e,t,i,s;const o=window._gio_local_vds||"vds",r=null!==(t=null===(e=window[o])||void 0===e?void 0:e.namespace)&&void 0!==t?t:"gdp";return S(window[r])?window[r]:null!==(s=null!==(i=window.gdp)&&void 0!==i?i:window.gio)&&void 0!==s?s:function(){}}});const X=e=>I(e)&&e.length>0||v(e)&&e>0,Y=/^((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})(\.((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})){3}/i,ee=/^(https?:\/\/)|(([a-zA-Z0-9_-])+(\.)?)*(:\d+)?(\/((\.)?(\?)?=?&?[a-zA-Z0-9_-](\?)?)*)*$/i;function te(e){for(var t=1;arguments.length>t;t++){var i=arguments[t];for(var s in i)e[s]=i[s]}return e}var ie=function e(t,i){function s(e,s,o){if("undefined"!=typeof document){"number"==typeof(o=te({},i,o)).expires&&(o.expires=new Date(Date.now()+864e5*o.expires)),o.expires&&(o.expires=o.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var r="";for(var n in o)o[n]&&(r+="; "+n,!0!==o[n]&&(r+="="+o[n].split(";")[0]));return document.cookie=e+"="+t.write(s,e)+r}}return Object.create({set:s,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var i=document.cookie?document.cookie.split("; "):[],s={},o=0;o"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)})),oe=e=>U(e,"_gioenc")?e.slice(0,-7):e,re=e=>f(Number(e))&&z((()=>JSON.parse(e)))||e,ne={A:1,a:1,Z:1,z:1,"@":1,"{":1},ae=e=>p(e)?e:z((()=>"gioenc-"+le(e)))||e,de=e=>I(e)&&A(e,"gioenc-")&&z((()=>le(e.replace("gioenc-",""))))||e,le=e=>(e=e||"").split("").map((e=>ne[e]?e:ge(e))).join(""),ge=e=>{if(/[0-9]/.test(e))return 1^+e;{let t=e.charCodeAt(0);return String.fromCharCode(1^t)}};class he{constructor(e){this.domain=e,this.getItem=e=>re(de(ie.get(oe(e),{domain:this.domain,path:"/"}))),this.setItem=(e,t,i)=>{let s;s=I(t)?t.length?U(e,"_gioenc")?ae(t):t:"":JSON.stringify(t),ie.set(oe(e),s,{expires:i?new Date(i):3650,domain:this.domain,path:"/"})},this.removeItem=e=>{ie.remove(oe(e),{domain:this.domain,path:"/"})},this.hasItem=e=>j(L(ie.get()),oe(e)),this.getKeys=()=>L(ie.get()),this.type="Cookie"}}class ce{constructor(){this.getItem=e=>{const t=z((()=>JSON.parse(localStorage.getItem(oe(e))||"")))||{};return w(t)&&t.expiredAt>+Date.now()?re(de(t.value)):void 0},this.setItem=(e,t,i)=>{const s=null!=i?i:+new Date(9999,12);localStorage.setItem(oe(e),JSON.stringify({value:I(t)&&t.length&&U(e,"_gioenc")?ae(t):t,expiredAt:s}))},this.removeItem=e=>localStorage.removeItem(oe(e)),this.hasItem=e=>!!localStorage.getItem(oe(e)),this.getKeys=()=>q(Array(localStorage.length)).map(((e,t)=>localStorage.key(t))),this.type="localStorage"}}const ue={};class me{constructor(){this.getItem=e=>{const t=z((()=>JSON.parse(ue[oe(e)]||"")));return w(t)&&t.expiredAt>+Date.now()?re(de(t.value)):void 0},this.setItem=(e,t,i)=>{const s=null!=i?i:+new Date(9999,12);ue[oe(e)]=JSON.stringify({value:I(t)&&t.length?ae(t):t,expiredAt:s})},this.removeItem=e=>B(ue,oe(e)),this.hasItem=e=>R(ue,oe(e)),this.getKeys=()=>L(ue),this.type="memory"}}let pe;const Ie=/^(\.ac\.|\.br\.|\.co\.|\.com\.|\.edu\.|\.gov\.|\.org\.|\.net\.)/,ve=e=>{const t=[];try{const i=e.split("."),s=T(i);if(i.length>=2&&(isNaN(Number(s))||0>Number(s)||Number(s)>255)){const e="."+i.slice(-2).join(".");Ie.test(e)?pe=e:t.push(e);const s="."+i.slice(-3).join(".");Ie.test(s)||j(t,s)||t.push(s);const o="."+i.slice(-4).join(".");Ie.test(o)||j(t,o)||t.push(o)}}catch(e){}return t},fe=e=>{let t="";return e.every((e=>!we(e)||(t=e,!1))),t},we=e=>{try{ie.set("gioCookie","yes",{domain:e});const t=!!ie.get("gioCookie",{domain:e});return ie.remove("gioCookie",{domain:e}),t}catch(e){return!1}},ye=e=>{let t,i,s,{storageType:o,cookieDomain:r,projectId:n}=e;if(j(["cookie","localstorage"],o)||(o="cookie"),"cookie"===o&&(s=navigator.userAgent.indexOf("Electron")>-1||j(["","localhost","127.0.0.1"],window.location.hostname)||!j(["http:","https:"],window.location.protocol)?"":fe([...ve(window.location.hostname),window.location.hostname]),i=!!s),"cookie"===o&&i){const e=new he(s);if(r){let t=ve(r);const i=fe(H(t)?[]:[r,...ve(r)]);i&&we(i)?e.domain=i:M("指定Cookie域无效或无权限,使用默认域!","warn")}t=e}else t=(()=>{try{const e=window.localStorage,t="__storage_test__";return e.setItem(t,t),e.removeItem(t),!0}catch(e){return!1}})()?new ce:new me;return"cookie"===o&&pe&&we(pe)&&((e,t,i)=>{if(t&&we(t)){let s=new he(t);[i+"_gdp_session_id","gdp_user_id_gioenc",i+"_gdp_cs1_gioenc",i+"_gdp_user_key_gioenc",i+"_gdp_gio_id_gioenc",i+"_gdp_sequence_ids",i+"_gdp_session_id_sent"].forEach((t=>{const i=s.getItem(t);s.hasItem(t)&&(e.setItem(t,i),s.removeItem(t))})),s=void 0}})(t,pe,n),t};var Se="SESSIONID_UPDATE",Oe={name:"gioCustomTracking",method:class{constructor(e){this.growingIO=e,this.getValidResourceItem=e=>{if(e&&w(e)&&e.id&&e.key){const t={id:I(e.id)?e.id:N(e.id),key:I(e.key)?e.key:N(e.key)};return e.attributes&&(t.attributes=e.attributes),t}},this.getDynamicAttributes=e=>(p(e)||L(e).forEach((t=>{S(e[t])?e[t]=e[t]():w(e[t])?B(e,t):O(e[t])||(e[t]=N(e[t]))})),e),this.buildCustomEvent=(e,t,i,s)=>{Q(e,(()=>{const{dataStore:{eventContextBuilder:o,eventConverter:r,currentPage:n}}=this.growingIO;let a=Object.assign({eventType:"CUSTOM",eventName:e,pageShowTimestamp:null==n?void 0:n.time,attributes:W(this.getDynamicAttributes(w(t)&&!H(t)?t:void 0)),resourceItem:W(this.getValidResourceItem(i))},o());H(s)||(a=Object.assign(Object.assign({},a),s)),r(a)}))},this.buildUserAttributesEvent=(e,t)=>{const{dataStore:{eventContextBuilder:i,eventConverter:s}}=this.growingIO;let o=Object.assign({eventType:"LOGIN_USER_ATTRIBUTES",attributes:W(e)},i());H(t)||(o=Object.assign(Object.assign({},o),t)),s(o)}}}};const be=["gioPerformance"];class Ee{constructor(e){var t,i,s,o;this.growingIO=e,this.innerPluginInit=()=>{var e;be.forEach((e=>{var t;return B(null===(t=this.pluginsContext)||void 0===t?void 0:t.plugins,e)})),L(null===(e=this.pluginsContext)||void 0===e?void 0:e.plugins).forEach((e=>{var t;const{name:i,method:s}=null===(t=this.pluginsContext)||void 0===t?void 0:t.plugins[e];x(this.pluginItems,(e=>e.name===i))||this.pluginItems.push({name:D(i||e),method:s||(e=>{})})})),H(this.pluginItems)||this.installAll()},this.install=(e,t,i)=>{var s,o;const r=t||x(this.pluginItems,(t=>t.name===e));if((null===(s=this.growingIO)||void 0===s?void 0:s.plugins)[e])return M(`重复加载插件 ${e} 或插件重名,已跳过加载!`,"warn"),!1;if(!r)return M(`插件加载失败!不存在名为 ${e} 的插件!`,"error"),!1;try{return(null===(o=this.growingIO)||void 0===o?void 0:o.plugins)[e]=new r.method(this.growingIO,i),"cdp"===this.growingIO.gioEnvironment&&t&&M("加载插件 "+e,"info"),!0}catch(e){return M("插件加载异常 "+e,"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)&&!x(this.pluginItems,(e=>e.name===t.name))&&this.pluginItems.push({name:D(t.name),method:t.method?t.method:()=>{}})}))},this.uninstall=e=>{var t;B(this.pluginItems,e);const i=B(null===(t=this.growingIO)||void 0===t?void 0:t.plugins,e);return i||M(`卸载插件 ${e} 失败!`,"error"),i},this.uninstallAll=()=>{this.pluginItems.forEach((e=>this.uninstall(e.name)))},this.lifeError=(e,t)=>M(`插件执行错误 ${e.name} ${t}`,"error"),this.onComposeBefore=e=>{this.pluginItems.forEach((t=>{var i;const s=null===(i=this.growingIO.plugins[t.name])||void 0===i?void 0:i.onComposeBefore;if(s&&S(s))try{s(e)}catch(e){this.lifeError(t,e)}}))},this.onComposeAfter=e=>{this.pluginItems.forEach((t=>{var i;const s=null===(i=this.growingIO.plugins[t.name])||void 0===i?void 0:i.onComposeAfter;if(s&&S(s))try{s(e)}catch(e){this.lifeError(t,e)}}))},this.onSendBefore=e=>{this.pluginItems.forEach((t=>{var i;const s=null===(i=this.growingIO.plugins[t.name])||void 0===i?void 0:i.onSendBefore;if(s&&S(s))try{s(e)}catch(e){this.lifeError(t,e)}}))},this.onSendAfter=e=>{this.pluginItems.forEach((t=>{var i;const s=null===(i=this.growingIO.plugins[t.name])||void 0===i?void 0:i.onSendAfter;if(s&&S(s))try{s(e)}catch(e){this.lifeError(t,e)}}))},this.pluginsContext={plugins:{}},this.pluginItems=[],null===(t=this.growingIO.emitter)||void 0===t||t.on("onComposeBefore",this.onComposeBefore),null===(i=this.growingIO.emitter)||void 0===i||i.on("onComposeAfter",this.onComposeAfter),null===(s=this.growingIO.emitter)||void 0===s||s.on("onSendBefore",this.onSendBefore),null===(o=this.growingIO.emitter)||void 0===o||o.on("onSendAfter",this.onSendAfter)}}class Te extends Ee{constructor(e){super(e),this.growingIO=e,this.growingIO.gioSDKFull=!1,this.pluginsContext={plugins:{gioCustomTracking:Oe}}}}class _e{constructor(){var e;this.trackingId="g0",this.init=e=>{var t,i,s,o,r;M("Gio Web SDK 初始化中...","info");const{initOptions:n,currentPage:a,sendVisit:d,sendPage:l}=this.dataStore;n(e),this.storage=ye(this.vdsConfig),this.initCallback(),null===(t=this.emitter)||void 0===t||t.emit("OPTION_INITIALIZED",this),null===(s=null===(i=this.plugins)||void 0===i?void 0:i.gioEventAutoTracking)||void 0===s||s.main(),a.hookHistory(),a.parsePage(),null===(o=this.emitter)||void 0===o||o.emit("SDK_INITIALIZED",this),M("Gio Web SDK 初始化完成!","success"),this.useEmbeddedInherit||(this.dataStore.lastVisitEvent.timestamp=a.time,d()),l(),this.gioSDKInitialized=!0,this.vdsConfig.gioSDKInitialized=!0,window[this.vds]=this.vdsConfig,null===(r=this.emitter)||void 0===r||r.emit("SDK_INITIALIZED_COMPLATE",this)},this.setOption=(e,t)=>{if(j(r,e)){const i=this.dataStore.setOption(e,t);return i&&n[e]&&M(`已${t?"开启":"关闭"}${n[e]}`,"info"),i}return M(`不存在可修改的配置项:${e},请检查后重试!`,"warn"),!1},this.getOption=e=>this.dataStore.getOption(e),this.setGeneralProps=e=>{w(e)&&!H(e)?(this.dataStore.generalProps=Object.assign(Object.assign({},this.dataStore.generalProps),e),L(this.dataStore.generalProps).forEach((e=>{j([void 0,null],this.dataStore.generalProps[e])&&(this.dataStore.generalProps[e]="")}))):this.callError("setGeneralProps")},this.clearGeneralProps=e=>{O(e)&&!H(e)?e.forEach((e=>{B(this.dataStore.generalProps,e)})):this.dataStore.generalProps={}},this.reissuePage=()=>{this.dataStore.sendPage()},this.notRecommended=()=>M("不推荐的方法使用,建议使用 gio('setOption', [optionName], [value])!","info"),this.callError=(e,t=!0,i="参数不合法")=>M(`${t?"调用":"设置"} ${e} 失败,${i}!`,"warn"),this.updateImpression=()=>{var e,t;const i=null===(t=null===(e=this.plugins)||void 0===e?void 0:e.gioImpressionTracking)||void 0===t?void 0:t.main;i?i("emitter"):M("updateImpression 错误! 请集成半自动埋点浏览插件后重试!","error")},this.gioEnvironment="cdp",this.sdkVersion="3.8.6",this.vds=window.gioCompatibilityVds?"gdp_vds":"vds",this.utils=Object.assign(Object.assign({},G),Z),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.useEmbeddedInherit=!1,this.useHybridInherit=!1,this.gioSDKInitialized=!1,this.plugins=new Te(this),this.plugins.innerPluginInit()}}class Ce{constructor(e){this.growingIO=e;const{projectId:t}=this.growingIO.vdsConfig,{getItem:i,setItem:s,getKeys:o,removeItem:r}=this.growingIO.storage;this.getItem=i,this.setItem=s,this.getKeys=o,this.removeItem=r,this.sIdStorageName=t+"_gdp_session_id",this.uidStorageName="gdp_user_id_gioenc",this.userIdStorageName=t+"_gdp_cs1_gioenc",this.userKeyStorageName=t+"_gdp_user_key_gioenc",this.gioIdStorageName=t+"_gdp_gio_id_gioenc"}get sessionId(){return this.getItem(this.sIdStorageName)||(this.sessionId=se(),this.sessionId)}set sessionId(e){var t;e||(e=se());const i=this.getItem(this.sIdStorageName)||this.prevSessionId,{sessionExpires:s=30}=this.growingIO.vdsConfig;this.setItem(this.sIdStorageName,e,+Date.now()+60*s*1e3),i!==e&&(this.getKeys().filter((e=>/.+_gdp_session_id_.{36}/.test(e))).forEach((e=>{this.removeItem(e)})),this.setItem(this.growingIO.dataStore.visitStorageName,""),null===(t=this.growingIO.emitter)||void 0===t||t.emit(Se,{newSessionId:e,oldSessionId:i})),this.prevSessionId=e}get uid(){return this.getItem(this.uidStorageName)||(this.uid=se(),this.uid)}set uid(e){var t;const i=this.getItem(this.uidStorageName)||this.prevUId;this.setItem(this.uidStorageName,e),i!==e&&(null===(t=this.growingIO.emitter)||void 0===t||t.emit("UID_UPDATE",{newUId:e,oldUId:i})),this.prevUId=e}get userId(){return this.getItem(this.userIdStorageName)||""}set userId(e){var t,i;const s=this.getItem(this.userIdStorageName)||this.prevUserId;this.setItem(this.userIdStorageName,e),null===(t=this.growingIO.emitter)||void 0===t||t.emit("SET_USERID",{newUserId:e,oldUserId:s,userKey:this.userKey}),s!==e&&(null===(i=this.growingIO.emitter)||void 0===i||i.emit("USERID_UPDATE",{newUserId:e,oldUserId:s,userKey:this.userKey})),e&&(this.gioId=e),this.prevUserId=e}get userKey(){return this.getItem(this.userKeyStorageName)||""}set userKey(e){var t,i;const s=this.getItem(this.userKeyStorageName)||this.prevUserKey;this.setItem(this.userKeyStorageName,e),null===(t=this.growingIO.emitter)||void 0===t||t.emit("SET_USERKEY",{newUserKey:e,oldUserKey:s,userId:this.userId}),s!==e&&(null===(i=this.growingIO.emitter)||void 0===i||i.emit("USERKEY_UPDATE",{newUserKey:e,oldUserKey:s,userId:this.userId})),this.prevUserKey=e}get gioId(){return this.getItem(this.gioIdStorageName)||""}set gioId(e){var t;const i=this.getItem(this.gioIdStorageName)||this.prevGioId;this.setItem(this.gioIdStorageName,e),i!==e&&(null===(t=this.growingIO.emitter)||void 0===t||t.emit("GIOID_UPDATE",{newGioId:e,oldGioId:i})),this.prevGioId=e}}class xe{constructor(e){this.growingIO=e,this.main=()=>{var e,t;const{sdkVersion:i,useEmbeddedInherit:s,vdsConfig:o,userStore:r,dataStore:n,trackingId:a}=this.growingIO,{path:d,query:l}=n.currentPage;let g={appVersion:o.version,dataSourceId:o.dataSourceId,deviceId:r.uid,domain:s?o.appId:window.location.host,gioId:r.gioId,language:navigator.language,path:d,platform:o.platform,query:l,referralPage:(null===(e=n.lastPageEvent)||void 0===e?void 0:e.referralPage)||"",screenHeight:window.screen.height,screenWidth:window.screen.width,sdkVersion:i,sessionId:r.sessionId,timestamp:+Date.now(),title:null!==(t=z((()=>document.title.slice(0,255))))&&void 0!==t?t:"",userId:r.userId};if(o.enableIdMapping&&(g.userKey=r.userKey),H(o.ignoreFields)||o.ignoreFields.forEach((e=>{B(g,e)})),s&&!H(this.minpExtraParams)){const e=Object.assign({},g);F(Object.assign(Object.assign({},g),this.minpExtraParams),((t,i)=>{var s;j(o.embeddedIgnore,i)?(g[i]=e[i],"domain"===i&&(g[i]=window.location.host)):g[i]=null!==(s=this.minpExtraParams[i])&&void 0!==s?s:g[i]}))}return g.trackingId=a,g},this.minpExtraParams={}}}class ke{constructor(e){this.growingIO=e,this.parsePage=()=>{const{hashtag:e}=this.growingIO.vdsConfig,t=location.pathname,i=location.search,s=location.hash,o=s.indexOf("?");this.domain=window.location.host,this.title=document.title.slice(0,255),this.time=+Date.now(),this.path=t,this.query=i,e&&(o>-1?(this.path+=s.slice(0,o),this.query=this.query+"&"+s.slice(o+1)):this.path+=s),this.query&&j(["?","&"],this.query.charAt(0))&&(this.query=this.query.slice(1))},this._getNoHashHref=()=>{const{protocol:e,host:t,pathname:i,search:s}=window.location;return`${e}://${t}${i}${s}`},this.getReferralPage=()=>{var e,t;const{dataStore:{lastPageEvent:i}}=this.growingIO;return(null==i?void 0:i.path)===this.path&&(null!==(e=null==i?void 0:i.query)&&void 0!==e?e:"")===(null!==(t=this.query)&&void 0!==t?t:"")?null==i?void 0:i.referralPage:(null==i?void 0:i.path)?this.lastHref:document.referrer},this.pageListener=()=>{const{hashtag:e}=this.growingIO.vdsConfig;let t=window.location.href,i=this.lastHref;e||(t=this._getNoHashHref(),i=this.lastNoHashHref),i!==t&&(this.parsePage(),this.buildPageEvent())},this.hookHistory=()=>{const e=window.history.pushState,t=window.history.replaceState,i=this;e&&z((()=>window.history.pushState=function(){e.apply(window.history,arguments),setTimeout(i.pageListener)})),t&&z((()=>window.history.replaceState=function(){t.apply(window.history,arguments),setTimeout(i.pageListener)})),J(window,"popstate",this.pageListener);const{hashtag:s}=this.growingIO.vdsConfig;s&&J(window,"hashchange",this.pageListener)},this.buildPageEvent=e=>{const{dataStore:{lastPageEvent:t,eventContextBuilder:i,eventConverter:s}}=this.growingIO;let o=Object.assign(Object.assign({eventType:"PAGE"},i()),{protocolType:location.protocol.substring(0,location.protocol.length-1),referralPage:this.getReferralPage()});H(e)||(o=Object.assign(Object.assign({},o),e)),o.timestamp=this.time,s(o),this.lastHref=window.location.href,this.lastNoHashHref=this._getNoHashHref(),this.lastLocation=Object.assign({},window.location)},this.title=document.title.slice(0,255),this.lastLocation=Object.assign({},window.location)}}const je={referralPage:document.referrer};class qe{constructor(o){var a,l,g;this.growingIO=o,this.ALLOW_SETTING=Object.assign(Object.assign({},t),"saas"===this.growingIO.gioEnvironment?s:i),this.allowOptKeys=Object.keys(this.ALLOW_SETTING),this.trackTimers={},this.setSequenceIds=(e,t)=>{let i=this.growingIO.storage.getItem(this.seqStorageIdName)||{};"gsid"===e?i.globalKey=t:i=Object.assign(Object.assign({},i),t),this.growingIO.storage.setItem(this.seqStorageIdName,i)},this.initOptions=t=>{var i,s,o,r,a,l,g;const{projectId:h,dataSourceId:c,appId:u}=t;this.initialDataSourceId=c;const m={};this.allowOptKeys.forEach((i=>{const s=this.ALLOW_SETTING[i].type;let o=O(s)?!j(s,V(t[i])):V(t[i])!==s;"platform"!==i||j(e,t[i])||(o=!0),o?m[i]=this.ALLOW_SETTING[i].default:"ignoreFields"===i?m.ignoreFields=t.ignoreFields.filter((e=>j(d,e))):(m[i]=t[i],j(["dataCollect","autotrack"],i)&&(m[i]||M("已关闭"+n[i],"info")))})),m.sessionExpires=Math.round(m.sessionExpires),(f(m.sessionExpires)||1>m.sessionExpires||m.sessionExpires>360)&&(m.sessionExpires=30),m.storageType=m.storageType.toLowerCase(),m.sendType=m.sendType.toLowerCase(),j(["beacon","xhr","image"],m.sendType)||(m.sendType="beacon"),!f(Number(m.requestTimeout))&&m.requestTimeout>0||(m.requestTimeout=5e3),this.growingIO.vdsConfig=Object.assign(Object.assign(Object.assign({},null!==(i=window.vds)&&void 0!==i?i:{}),m),{projectId:h,dataSourceId:c,appId:u,performance:{monitor:null===(o=null===(s=m.performance)||void 0===s?void 0:s.monitor)||void 0===o||o,exception:null===(a=null===(r=m.performance)||void 0===r?void 0:r.exception)||void 0===a||a,network:null!==(g=null===(l=m.performance)||void 0===l?void 0:l.network)&&void 0!==g&&g}}),window.vds=this.growingIO.vdsConfig,this.seqStorageIdName=h+"_gdp_sequence_ids",this.visitStorageName=h+"_gdp_session_id_sent"},this.setOption=(e,t)=>{var i;const{vdsConfig:s,callError:o,uploader:n,emitter:a}=this.growingIO,d=I(e)&&j(r,e),l=d&&typeof t===((null===(i=this.ALLOW_SETTING[e])||void 0===i?void 0:i.type)||"string"),g=Object.assign({},s);return d&&l?(s[e]=t,"dataCollect"===e&&g.dataCollect!==t&&(t?(this.sendVisit(!0),this.sendPage()):this.growingIO.clearTrackTimer()),j(["host","scheme"],e)&&(null==n||n.generateHost()),null==a||a.emit("OPTION_CHANGE",{optionName:e,optionValue:t}),window.vds[e]=t,!0):(o("setOption > "+e),!1)},this.getOption=e=>{const{vdsConfig:t,callError:i}=this.growingIO;return e&&R(t,N(e))?t[N(e)]:p(e)?Object.assign({},t):void i("getOption > "+e)},this.sendVisit=e=>{const{userStore:{sessionId:t},storage:i}=this.growingIO,s=i.getItem(this.visitStorageName);!e&&t===s||(this.lastVisitEvent.timestamp=this.currentPage.time-1,this.buildVisitEvent())},this.buildVisitEvent=e=>{const{dataStore:{eventContextBuilder:t,eventConverter:i},emitter:s,storage:o,userStore:r}=this.growingIO,{referralPage:n,title:a,path:d,query:l,timestamp:g}=this.lastVisitEvent;let h=Object.assign(Object.assign({eventType:"VISIT"},t()),{referralPage:n||this.currentPage.getReferralPage(),timestamp:g});d&&(h.title=a,h.path=d,h.query=l),H(e)||(h.session=(null==e?void 0:e.session)||h.session,h.trackingId=null==e?void 0:e.trackingId,h=Object.assign(Object.assign({},h),e));const c=({requestData:e})=>{"VISIT"===e.eventType&&e.trackingId===this.growingIO.trackingId&&(r.sessionId===e.sessionId&&o.setItem(this.visitStorageName,e.sessionId),s.off("onSendAfter",c))};s.on("onSendAfter",c),i(h)},this.sendPage=e=>{e&&this.currentPage.parsePage(),this.currentPage.buildPageEvent()},this.buildErrorEvent=e=>{const{dataStore:{eventContextBuilder:t,eventConverter:i}}=this.growingIO;i(Object.assign({eventType:"CUSTOM",pageShowTimestamp:this.currentPage.time,eventName:"onError",attributes:e},t()))},this.currentPage=new ke(this.growingIO),this.eventContextBuilderInst=new xe(this.growingIO),this.eventContextBuilder=this.eventContextBuilderInst.main,this.generalProps={},this.lastVisitEvent=je,null===(a=this.growingIO.emitter)||void 0===a||a.on("onComposeAfter",(({composedEvent:e})=>{"VISIT"!==e.eventType&&"vst"!==e.t||e.trackingId!==this.growingIO.trackingId||(this.lastVisitEvent=e)})),this.lastPageEvent={},null===(l=this.growingIO.emitter)||void 0===l||l.on("onComposeAfter",(({composedEvent:e})=>{"PAGE"!==e.eventType&&"page"!==e.t||e.trackingId!==this.growingIO.trackingId||(this.lastPageEvent=e)})),null===(g=this.growingIO.emitter)||void 0===g||g.on(Se,(()=>{if(this.growingIO.gioSDKInitialized){this.currentPage.parsePage();const{title:e,path:t,query:i,time:s,getReferralPage:o}=this.currentPage;this.lastVisitEvent={referralPage:document.referrer||o(),title:e,path:t,query:i,timestamp:s-1},this.sendVisit(!0),this.sendPage(!0)}}))}get esid(){const e=this.growingIO.storage.getItem(this.seqStorageIdName)||{};let t=Object.assign({},e);return B(t,"globalKey"),t=w(t)&&!p(t)?t:{},this._esid={},L(t).forEach((e=>{this._esid[e]=f(Number(t[e]))||t[e]>=1e9||1>t[e]?1:t[e]})),this._esid}set esid(e){const t={};L(e).forEach((i=>{t[i]=f(e[i])||e[i]>=1e9||1>e[i]?1:e[i]})),$(this._esid,t)||(this._esid=t,this.setSequenceIds("esid",this._esid))}get gsid(){const e=this.growingIO.storage.getItem(this.seqStorageIdName)||{},t=Number(e.globalKey);return this._gsid=f(t)||t>=1e9||1>t?1:t,this._gsid}set gsid(e){f(Number(e))||e>=1e9||1>e?this._gsid=1:this._gsid=e,this.setSequenceIds("gsid",this._gsid)}}class Ne extends qe{constructor(e){super(e),this.growingIO=e,this.eventConverter=e=>{var t;const{vdsConfig:i,dataStore:s,uploader:o}=this.growingIO;if(i.dataCollect){e.trackingId===this.growingIO.trackingId&&(e.globalSequenceId=s.gsid,e.eventSequenceId=s.esid[e.eventType]||1);const i={};F(e,((e,t)=>{var s;if("element"===t){const t=null!==(s=E(e))&&void 0!==s?s:{};F(t,((e,t)=>{H(e)&&0!==e||(i[t]=e)}))}else(H(e)||p(e))&&0!==e||(i[t]=e)})),e.trackingId===this.growingIO.trackingId&&(this.growingIO.dataStore.gsid+=1,this.growingIO.dataStore.esid=Object.assign(Object.assign({},this.growingIO.dataStore.esid),{[i.eventType]:(this.growingIO.dataStore.esid[i.eventType]||1)+1})),null===(t=this.growingIO.emitter)||void 0===t||t.emit("onComposeAfter",{composedEvent:Object.assign({},i)}),e.trackingId===this.growingIO.trackingId&&o.commitRequest(i)}else"VISIT"===e.eventType&&(this.lastVisitEvent=e)}}}class Pe{constructor(e){this.growingIO=e,this.getSendType=()=>{const{sendType:e}=this.growingIO.vdsConfig;return"beacon"===e?(()=>{var e;const t=!!(null===(e=null===window||void 0===window?void 0:window.navigator)||void 0===e?void 0:e.sendBeacon),i=window.navigator.userAgent;if(i.match(/(iPad|iPhone|iPod)/g)){const e=(e=>{const t=e.toLowerCase().match(/cpu.*os (.*?) like mac os/i);return!t||2>t.length?0:+t[1].split("_").slice(0,2).join(".")})(i);return t&&e>13}return t})()?"beacon":"xhr":e},this.commitRequest=e=>{const t=Object.assign({},e);this.requestQueue.push(Object.assign(Object.assign({},t),{requestType:this.getSendType()})),this.initiateRequest()},this.initiateRequest=()=>{var e,t;if([...this.requestQueue].length>0&&this.requestingNum(this.retryIds[e.globalSequenceId||e.esid]||0)<=this.retryLimit)),H(this.requestQueue))return;const n=this.requestQueue.shift(),{requestType:a}=n;null==s||s.emit("onSendBefore",{requestData:Object.assign({},n)});const d=Object.assign({},n);if(B(d,["requestType","trackingId"]),i.debug&&console.log("[GrowingIO Debug]:",JSON.stringify(d,null,2).replace(/\"/g,(()=>{const e=window.navigator.userAgent;return/(\d+\.\d)?(?:\.\d)?\s+safari\/?(\d+\.\d+)?/i.test(e)&&!/chrome\/(\d+\.\d+)/i.test(e)})()?"":'"')),this.requestingNum+=1,r)return this.requestSuccessFn(n),!1;let l=Object.assign({},d);switch(i.compress&&(null==o?void 0:o.gioCompress)?"image"===a?(this.compressType="11",l=null===(e=null==o?void 0:o.gioCompress)||void 0===e?void 0:e.compressToEncodedURIComponent(JSON.stringify([l]))):(this.compressType="1",l=null===(t=null==o?void 0:o.gioCompress)||void 0===t?void 0:t.compressToUint8Array(JSON.stringify([l]))):(this.compressType="0",l=JSON.stringify([l])),a){case"beacon":default:this.sendByBeacon(n,l);break;case"xhr":this.sendByXHR(n,l);break;case"image":this.sendByImage(n,l)}}},this.generateURL=()=>`${this.requestURL}?stm=${+Date.now()}&compress=${this.compressType}`,this.sendByBeacon=(e,t)=>{navigator.sendBeacon(this.generateURL(),t)?this.requestSuccessFn(e):this.requestFailFn(e,"beacon")},this.sendByXHR=(e,t)=>{const i=new XMLHttpRequest;if(i)return i.open("POST",this.generateURL(),!0),i.onload=()=>{204===i.status?this.requestSuccessFn(e):this.requestFailFn(e,"xhr")},i.ontimeout=i.onerror=i.onabort=()=>{this.requestFailFn(e,"xhr")},i.setRequestHeader("Content-Type","text/plain;charset=UTF-8"),i.timeout=this.growingIO.vdsConfig.requestTimeout,void i.send(t);if(null===window||void 0===window?void 0:window.XDomainRequest){const i=new window.XDomainRequest;i.open("POST",this.generateURL().replace("https://","http://"),!0),i.onload=()=>{204===i.status?this.requestSuccessFn(e):this.requestFailFn(e,"xhr")},i.onerror=i.ontimeout=()=>{this.requestFailFn(e,"xhr")},i.send(t)}},this.sendByImage=(e,t)=>{const i=`${this.generateURL()}&data=${t}`;let s=document.createElement("img");s.width=1,s.height=1;let o=window.setTimeout((()=>{this.requestingNum-=1,this.clearImage(s),window.clearTimeout(o),o=null,this.initiateRequest()}),this.growingIO.vdsConfig.requestTimeout);s.onload=()=>{this.requestSuccessFn(e),this.clearImage(s),window.clearTimeout(o),o=null},s.onerror=s.onabort=()=>{this.requestSuccessFn(e),this.clearImage(s),window.clearTimeout(o),o=null},s.src=i},this.clearImage=e=>{e.src="",e.onload=()=>{},e.onerror=e.onabort=()=>{},e=null},this.requestSuccessFn=e=>{var t;this.requestingNum-=1;const i=e.globalSequenceId||e.esid||-1;this.retryIds[i]&&(this.retryIds[i]=0),e.trackingId===this.growingIO.trackingId&&this.growingIO.userStore.sessionId===e.sessionId&&(this.growingIO.userStore.sessionId=e.sessionId),null===(t=this.growingIO.emitter)||void 0===t||t.emit("onSendAfter",{requestData:Object.assign({},e)}),this.initiateRequest()},this.requestFailFn=(e,t)=>{this.requestingNum-=1;const i=e.globalSequenceId||e.esid||-1;this.retryIds[i]||(this.retryIds[i]=0),this.retryIds[i]+=1;const s=this.requestQueue.some((t=>t.globalSequenceId===e.globalSequenceId&&t.esid===e.esid));let o=t;if(this.retryIds[i]{this.requestQueue.push(Object.assign(Object.assign({},e),{requestType:o})),this.initiateRequest(),window.clearTimeout(t),t=null}),800)}this.initiateRequest()},this.requestQueue=[],this.requestLimit=10,this.requestTimeout=5e3,this.retryLimit=2,this.retryIds={},this.requestingNum=0,this.requestURL=""}}class De extends Pe{constructor(e){super(e),this.growingIO=e,this.generateHost=()=>{let{scheme:e,host:t="",projectId:i}=this.growingIO.vdsConfig;e?U(N(e),"://")||(e+="://"):e=(location.protocol.indexOf("http")>-1?location.protocol.replace(":",""):"https")+"//",A(t,"http")&&(t=t.substring(t.indexOf("://")+(U(N(e),"://")?3:0))),this.requestURL=`${e}${t}/v3/projects/${i}/collect`},this.requestURL="",this.generateHost()}}class Ae extends _e{constructor(){super(),this.registerPlugins=e=>{O(e)?(e.forEach(((t,i)=>{var s,o;H(t)||p(t)?M("插件不合法,跳过加载!","warn"):(null===(s=t.js)||void 0===s?void 0:s.default)&&(e[i]=Object.assign(Object.assign({},null===(o=t.js)||void 0===o?void 0:o.default),{options:t.options}))})),e=C(e),this.plugins.installAll(e)):M("插件注册失败,请检查!","error")},this.initCallback=()=>{this.uploader=new De(this),this.userStore=new Ce(this)},this.getPlugins=()=>this.plugins.pluginItems,this.setTrackerScheme=e=>{j(["http","https"],e)?(this.dataStore.setOption("scheme",e),this.notRecommended()):this.callError("scheme",!1)},this.setTrackerHost=e=>{Y.test(e)||ee.test(e)?(this.dataStore.setOption("host",e),this.notRecommended()):this.callError("host",!1)},this.setDataCollect=e=>{this.setOption("dataCollect",!!e),this.notRecommended()},this.setAutotrack=e=>{this.setOption("autotrack",!!e),this.notRecommended()},this.enableDebug=e=>{this.setOption("debug",!!e),this.notRecommended()},this.enableHT=e=>{this.setOption("hashtag",!!e),this.notRecommended()},this.getVisitorId=()=>this.userStore.uid,this.getDeviceId=()=>this.userStore.uid,this.setUserAttributes=(e,t)=>{var i,s;!H(e)&&w(e)?null===(s=null===(i=this.plugins)||void 0===i?void 0:i.gioCustomTracking)||void 0===s||s.buildUserAttributesEvent(e,t):this.callError("setUserAttributes")},this.setUserId=(e,t)=>{if(X(N(e).trim())){const i=this.userStore.gioId;this.vdsConfig.enableIdMapping&&(this.userStore.userKey=!p(t)&&N(t).length>0?N(t).slice(0,1e3):""),this.userStore.userId=N(e).slice(0,1e3),i&&i!==this.userStore.userId&&(this.userStore.sessionId="")}else this.clearUserId(),this.callError("setUserId")},this.clearUserId=()=>{this.userStore.userId="",this.userStore.userKey=""},this.track=(e,t,i,s)=>{var o,r;((null===(r=null===(o=this.plugins)||void 0===o?void 0:o.gioCustomTracking)||void 0===r?void 0:r.buildCustomEvent)||function(){})(e,Object.assign(Object.assign({},this.dataStore.generalProps),w(t)&&!H(t)?t:{}),i,s)},this.sendPage=e=>this.dataStore.currentPage.buildPageEvent(e),this.sendVisit=e=>this.dataStore.buildVisitEvent(e),this.trackTimerStart=(e,t)=>{this.vdsConfig.dataCollect&&Q(e,(()=>{const i=se();S(t)?(this.dataStore.trackTimers[i]={eventName:e,leng:0,start:+Date.now()},t(i)):M("回调方法不合法,返回timerId失败!")}))},this.trackTimerPause=e=>{if(e&&this.dataStore.trackTimers[e]){const t=this.dataStore.trackTimers[e];t.start&&(t.leng=t.leng+(+Date.now()-t.start)),t.start=0}},this.trackTimerResume=e=>{if(e&&this.dataStore.trackTimers[e]){const t=this.dataStore.trackTimers[e];0===t.start&&(t.start=+Date.now())}},this.trackTimerEnd=(e,t)=>{if(this.vdsConfig.dataCollect){const i=864e5;if(e&&this.dataStore.trackTimers[e]){const s=this.dataStore.trackTimers[e];if(0!==s.start){const e=+Date.now()-s.start;s.leng=e>0?s.leng+e:0}this.track(s.eventName,Object.assign(Object.assign({},t),{event_duration:s.leng>i?0:s.leng/1e3})),this.removeTimer(e)}else M("未查找到对应的计时器,请检查!","error")}},this.removeTimer=e=>{e&&this.dataStore.trackTimers[e]&&delete this.dataStore.trackTimers[e]},this.clearTrackTimer=()=>{this.dataStore.trackTimers={}},this.dataStore=new Ne(this)}}let Ue;return function(){var e,t,i,s,r;let n=window.gioCompatibilityVds?"gdp_vds":"vds";if(null===(e=window[n])||void 0===e?void 0:e.gioSDKInstalled)return Ue=window.gdp,void M("SDK重复加载,请检查是否重复加载SDK或接入其他平台SDK导致冲突!","warn");window[n]=Object.assign(Object.assign({},null!==(t=window[n])&&void 0!==t?t:{}),{gioSDKInstalled:!0});const d=new Ae;Ue=function(){var e;const t=arguments[0];if(I(t)&&j(o,t)&&d[t]){const e=_(q(arguments));if("init"===t){const t=(e=>{var t;return e.vdsConfig||e.gioSDKInitialized||(null===(t=window.vds)||void 0===t?void 0:t.gioSDKInitialized)?(M("SDK重复初始化,请检查是否重复加载SDK或接入其他平台SDK导致冲突!","warn"),!1):!(j(["","localhost","127.0.0.1"],location.hostname)&&!window._gr_ignore_local_rule&&(M("当前SDK不允许在本地环境初始化!","warn"),1))})(d);if(!t)return;const i=(e=>!H(C(e))||(M('SDK初始化失败,请使用 gdp("init", "您的GrowingIO项目 accountId", "您项目的 dataSourceId", options); 进行初始化!',"error"),!1))(e);if(!i)return;const s=(e=>{const t=E(e);let i=T(e);return X(N(t).trim())?(w(i)&&i||(i={}),{projectId:t,userOptions:i}):(M("SDK初始化失败,accountId 参数不合法!","error"),!1)})(e);if(!s)return;const o=(e=>{const t=e[1],i=e[2],s=T(e);return t&&I(t)?{dataSourceId:t,appId:I(i)?i:"",cdpOptions:s}:(M("SDK初始化失败,dataSourceId 参数不合法!","error"),!1)})(e);if(!o)return;const{projectId:r}=s,{dataSourceId:n,appId:a,cdpOptions:l}=o;d.init(Object.assign(Object.assign({},l),{projectId:r,dataSourceId:n,appId:a}))}else if("registerPlugins"===t)d.registerPlugins(e[0]);else{if(d.gioSDKInitialized&&d.vdsConfig)return d[t](...e);d.emitter.emit("UNINITIALIZED_CALL",arguments),M("SDK未初始化!","error")}}else j(a,t)?M(`方法 ${N(t)} 已被弃用,请移除!`,"warn"):M(`不存在名为 ${N(t)} 的方法调用!`,"error");window[n]=Object.assign(Object.assign({},window[n]),{_gr_ignore_local_rule:null!==(e=window._gr_ignore_local_rule)&&void 0!==e&&e,gioEnvironment:"cdp",gioSDKVersion:d.sdkVersion,gioSDKFull:d.gioSDKFull,canIUse:e=>j(o,e)&&d[e]})};const l=null===(i=null===window||void 0===window?void 0:window.gdp)||void 0===i?void 0:i.q,g=null===(s=null===window||void 0===window?void 0:window.gdp)||void 0===s?void 0:s.e,h=null===(r=null===window||void 0===window?void 0:window.gdp)||void 0===r?void 0:r.ef;window.gdp=Ue,window.gdp.e=g,window.gdp.ef=h,O(l)&&!H(l)&&l.forEach((e=>{Ue.apply(null,e)}))}(),Ue})); +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).gdp=t()}(this,(function(){"use strict";const e=["web","wxwv","minp","alip","baidup","qq","bytedance"],t={autotrack:{type:"boolean",default:!0},compress:{type:"boolean",default:!0},dataCollect:{type:"boolean",default:!0},debug:{type:"boolean",default:!1},hashtag:{type:"boolean",default:!1},touch:{type:"boolean",default:!1},version:{type:"string",default:"1.0.0"},platform:{type:"string",default:"web"},cookieDomain:{type:"string",default:""},sendType:{type:"string",default:"beacon"}},i={enableIdMapping:{type:"boolean",default:!1},gtouchHost:{type:"string",default:""},host:{type:"string",default:"napi.growingio.com"},ignoreFields:{type:"array",default:[]},penetrateHybrid:{type:"boolean",default:!0},scheme:{type:"string",default:location.protocol.indexOf("http")>-1?location.protocol.replace(":",""):"https"},sessionExpires:{type:"number",default:30},performance:{type:"object",default:{monitor:!0,exception:!0}},embeddedIgnore:{type:"array",default:[]},storageType:{type:"string",default:"cookie"},requestTimeout:{type:"number",default:5e3}},s={},o=["clearUserId","getGioInfo","getLocation","getOption","init","setDataCollect","setOption","setUserId","track","setGeneralProps","clearGeneralProps","enableDebug","enableHT","setAutotrack","setTrackerHost","setTrackerScheme","setUserAttributes","getVisitorId","getDeviceId","registerPlugins","getPlugins","sendPage","sendVisit","trackTimerStart","trackTimerPause","trackTimerResume","trackTimerEnd","removeTimer","clearTrackTimer","updateImpression"],r=["autotrack","dataCollect","dataSourceId","debug","host","hashtag","scheme"],n={autotrack:"无埋点采集",dataCollect:"数据采集",debug:"调试模式"},a=["send","setConfig","collectImp","setPlatformProfile"],d=["screenHeight","screenWidth"];var l,g,h,c,u,m="function"==typeof Array.from?Array.from:(g||(g=1,h=function(e){return"function"==typeof e},c=function(e){var t=function(e){var t=Number(e);return isNaN(t)?0:0!==t&&isFinite(t)?(t>0?1:-1)*Math.floor(Math.abs(t)):t}(e);return Math.min(Math.max(t,0),9007199254740991)},u=function(e){var t=e.next();return!t.done&&t},l=function(e){var t,i,s,o=this,r=arguments.length>1?arguments[1]:void 0;if(void 0!==r){if(!h(r))throw new TypeError("Array.from: when provided, the second argument must be a function");arguments.length>2&&(t=arguments[2])}var n=function(e,t){if(null!=e&&null!=t){var i=e[t];if(null==i)return;if(!h(i))throw new TypeError(i+" is not a function");return i}}(e,function(e){if(null!=e){if(["string","number","boolean","symbol"].indexOf(typeof e)>-1)return Symbol.iterator;if("undefined"!=typeof Symbol&&"iterator"in Symbol&&Symbol.iterator in e)return Symbol.iterator;if("@@iterator"in e)return"@@iterator"}}(e));if(void 0!==n){i=h(o)?Object(new o):[];var a,d,l=n.call(e);if(null==l)throw new TypeError("Array.from requires an array-like or iterable object");for(s=0;;){if(!(a=u(l)))return i.length=s,i;d=a.value,i[s]=r?r.call(t,d,s):d,s++}}else{var g=Object(e);if(null==e)throw new TypeError("Array.from requires an array-like object - not null or undefined");var m,p=c(g.length);for(i=h(o)?Object(new o(p)):Array(p),s=0;p>s;)m=g[s],i[s]=r?r.call(t,m,s):m,s++;i.length=p}return i}),l);const p=e=>j(["undefined","null"],V(e)),I=e=>"string"===V(e),v=e=>"number"===V(e),f=e=>"NaN"===N(Number(e)),w=e=>"object"===V(e)&&!p(e),y=e=>"regexp"===V(e),S=e=>j(["function","asyncfunction"],V(e)),O=e=>Array.isArray(e)&&"array"===V(e),b=e=>"date"===V(e),E=e=>{try{return q(e)[0]}catch(e){return}},T=e=>{try{const t=q(e);return t[t.length-1]}catch(e){return}},_=(e,t=1)=>O(e)&&v(t)?e.slice(t>0?t:1,e.length):e,C=e=>{if(O(e)){let t=0;const i=[];for(const s of e)s&&!H(s)&&(i[t++]=s);return i}return e},x=(e,t)=>e[k(e,t)],k=(e,t)=>{let i=-1;return O(e)&&e.every(((e,s)=>!t(e)||(i=s,!1))),i},j=(e,t)=>("array"===V(e)||"string"===V(e))&&e.indexOf(t)>=0,q=m,N=e=>p(e)?"":""+e,P=(e,t)=>"string"==typeof e?e.split(t):e,D=e=>{if(I(e)){const t=P(e,"");return`${E(t).toLowerCase()}${_(t).join("")}`}return e},A=(e,t)=>!!I(e)&&e.slice(0,t.length)===t,U=(e,t)=>{if(I(e)){const{length:i}=e;let s=i;s>i&&(s=i);const o=s;return s-=t.length,s>=0&&e.slice(s,o)===t}return!1},K={}.hasOwnProperty,R=(e,t)=>!p(e)&&K.call(e,t),L=e=>w(e)?Object.keys(e):[],F=(e,t)=>{L(e).forEach((i=>t(e[i],i)))},$=(e,t)=>{const i=L(e);return!(!w(e)||!w(t)||i.length!==L(t).length||j(i.map(((i,s)=>w(e[i])?$(e[i],t[i]):e[i]===t[i])),!1))},B=(e,t)=>{if(!w(e))return!1;try{return"string"===V(t)?delete e[t]:"array"===V(t)?t.map((t=>delete e[t])):(y(t)&&L(e).forEach((i=>{t.test(i)&&B(e,i)})),!0)}catch(e){return!1}},H=e=>O(e)?0===e.length:w(e)?0===L(e).length:!e,V=e=>({}.toString.call(e).slice(8,-1).toLowerCase());var G=Object.freeze({__proto__:null,isNil:p,isString:I,isNumber:v,isNaN:f,isBoolean:e=>"boolean"===V(e),isObject:w,isRegExp:y,isFunction:S,isArray:O,isDate:b,fixed:(e,t)=>v(e)?Number(e.toFixed(v(t)?t:2)):I(e)&&"NaN"!==N(Number(e))?Number(Number(e).toFixed(v(t)?t:2)):e,head:E,last:T,drop:_,dropWhile:(e,t)=>O(e)?e.filter((e=>!t(e))):e,compact:C,find:x,findIndex:k,includes:j,arrayFrom:q,toString:N,split:P,lowerFirst:D,upperFirst:e=>{if(I(e)){const t=P(e,"");return`${E(t).toUpperCase()}${_(t).join("")}`}return e},startsWith:A,endsWith:U,has:R,keys:L,forEach:F,isEqual:$,get:(e,t,i)=>{let s=e;return w(e)?(t.split(".").forEach((e=>{s=s?s[e]:i})),s):i},unset:B,isEmpty:H,typeOf:V,formatDate:e=>{if(b(e)){const t=e=>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())}return e}});const M=(e,t)=>{console.log("%c [GrowingIO]:"+e,{info:"color: #3B82F6;",error:"color: #EF4444;",warn:"color: #F59E0B;",success:"color: #10B981;"}[t]||"")},z=e=>{try{return e()}catch(e){return}},W=e=>{const t={};return w(e)&&F(e,((e,i)=>{var s;const o=N(i).slice(0,100);w(e)?t[o]=W(e):O(e)?(t[o]=e.slice(0,100),"cdp"===(null===(s=window.vds)||void 0===s?void 0:s.gioEnvironment)&&(t[o]=t[o].join("||").slice(0,1e3))):t[o]=p(e)?"":N(e).slice(0,1e3)})),t},J=(e,t,i,s={})=>{document.addEventListener?e.addEventListener(t,i,Object.assign(Object.assign({},{capture:!0}),s)):e.attachEvent?e.attachEvent("on"+t,i):e["on"+t]=i},Q=(e,t)=>I(e)&&!H(e)&&e.match(/^[a-zA-Z_][0-9a-zA-Z_]{0,100}$/)?t():(M("事件名格式不正确,只能包含数字、字母和下划线,且不能以数字开头,字符总长度不能超过100!","error"),!1);var Z=Object.freeze({__proto__:null,consoleText:M,niceTry:z,limitObject:W,addListener:J,flattenObject:(e={})=>{const t=Object.assign({},e);return L(t).forEach((e=>{w(t[e])?(L(t[e]).forEach((i=>{t[`${e}_${i}`]=N(t[e][i])})),B(t,e)):O(t[e])?(t[e].forEach(((i,s)=>{w(i)?L(i).forEach((o=>{t[`${e}_${s}_${o}`]=N(i[o])})):t[`${e}_${s}`]=N(i)})),B(t,e)):p(t[e])||""===t[e]?B(t,e):t[e]=N(t[e])})),W(t)},eventNameValidate:Q,getGioFunction:()=>{var e,t,i,s;const o=window._gio_local_vds||"vds",r=null!==(t=null===(e=window[o])||void 0===e?void 0:e.namespace)&&void 0!==t?t:"gdp";return S(window[r])?window[r]:null!==(s=null!==(i=window.gdp)&&void 0!==i?i:window.gio)&&void 0!==s?s:function(){}}});const X=e=>I(e)&&e.length>0||v(e)&&e>0,Y=/^((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})(\.((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})){3}/i,ee=/^(https?:\/\/)|(([a-zA-Z0-9_-])+(\.)?)*(:\d+)?(\/((\.)?(\?)?=?&?[a-zA-Z0-9_-](\?)?)*)*$/i;function te(e){for(var t=1;arguments.length>t;t++){var i=arguments[t];for(var s in i)e[s]=i[s]}return e}var ie=function e(t,i){function s(e,s,o){if("undefined"!=typeof document){"number"==typeof(o=te({},i,o)).expires&&(o.expires=new Date(Date.now()+864e5*o.expires)),o.expires&&(o.expires=o.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var r="";for(var n in o)o[n]&&(r+="; "+n,!0!==o[n]&&(r+="="+o[n].split(";")[0]));return document.cookie=e+"="+t.write(s,e)+r}}return Object.create({set:s,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var i=document.cookie?document.cookie.split("; "):[],s={},o=0;o"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)})),oe=e=>U(e,"_gioenc")?e.slice(0,-7):e,re=e=>f(Number(e))&&z((()=>JSON.parse(e)))||e,ne={A:1,a:1,Z:1,z:1,"@":1,"{":1},ae=e=>p(e)?e:z((()=>"gioenc-"+le(e)))||e,de=e=>I(e)&&A(e,"gioenc-")&&z((()=>le(e.replace("gioenc-",""))))||e,le=e=>(e=e||"").split("").map((e=>ne[e]?e:ge(e))).join(""),ge=e=>{if(/[0-9]/.test(e))return 1^+e;{let t=e.charCodeAt(0);return String.fromCharCode(1^t)}};class he{constructor(e){this.domain=e,this.getItem=e=>re(de(ie.get(oe(e),{domain:this.domain,path:"/"}))),this.setItem=(e,t,i)=>{let s;s=I(t)?t.length?U(e,"_gioenc")?ae(t):t:"":JSON.stringify(t),ie.set(oe(e),s,{expires:i?new Date(i):3650,domain:this.domain,path:"/"})},this.removeItem=e=>{ie.remove(oe(e),{domain:this.domain,path:"/"})},this.hasItem=e=>j(L(ie.get()),oe(e)),this.getKeys=()=>L(ie.get()),this.type="Cookie"}}class ce{constructor(){this.getItem=e=>{const t=z((()=>JSON.parse(localStorage.getItem(oe(e))||"")))||{};return w(t)&&t.expiredAt>+Date.now()?re(de(t.value)):void 0},this.setItem=(e,t,i)=>{const s=null!=i?i:+new Date(9999,12);localStorage.setItem(oe(e),JSON.stringify({value:I(t)&&t.length&&U(e,"_gioenc")?ae(t):t,expiredAt:s}))},this.removeItem=e=>localStorage.removeItem(oe(e)),this.hasItem=e=>!!localStorage.getItem(oe(e)),this.getKeys=()=>q(Array(localStorage.length)).map(((e,t)=>localStorage.key(t))),this.type="localStorage"}}const ue={};class me{constructor(){this.getItem=e=>{const t=z((()=>JSON.parse(ue[oe(e)]||"")));return w(t)&&t.expiredAt>+Date.now()?re(de(t.value)):void 0},this.setItem=(e,t,i)=>{const s=null!=i?i:+new Date(9999,12);ue[oe(e)]=JSON.stringify({value:I(t)&&t.length?ae(t):t,expiredAt:s})},this.removeItem=e=>B(ue,oe(e)),this.hasItem=e=>R(ue,oe(e)),this.getKeys=()=>L(ue),this.type="memory"}}let pe;const Ie=/^(\.ac\.|\.br\.|\.co\.|\.com\.|\.edu\.|\.gov\.|\.org\.|\.net\.)/,ve=e=>{const t=[];try{const i=e.split("."),s=T(i);if(i.length>=2&&(isNaN(Number(s))||0>Number(s)||Number(s)>255)){const e="."+i.slice(-2).join(".");Ie.test(e)?pe=e:t.push(e);const s="."+i.slice(-3).join(".");Ie.test(s)||j(t,s)||t.push(s);const o="."+i.slice(-4).join(".");Ie.test(o)||j(t,o)||t.push(o)}}catch(e){}return t},fe=e=>{let t="";return e.every((e=>!we(e)||(t=e,!1))),t},we=e=>{try{ie.set("gioCookie","yes",{domain:e});const t=!!ie.get("gioCookie",{domain:e});return ie.remove("gioCookie",{domain:e}),t}catch(e){return!1}},ye=e=>{let t,i,s,{storageType:o,cookieDomain:r,projectId:n}=e;if(j(["cookie","localstorage"],o)||(o="cookie"),"cookie"===o&&(s=navigator.userAgent.indexOf("Electron")>-1||j(["","localhost","127.0.0.1"],window.location.hostname)||!j(["http:","https:"],window.location.protocol)?"":fe([...ve(window.location.hostname),window.location.hostname]),i=!!s),"cookie"===o&&i){const e=new he(s);if(r){let t=ve(r);const i=fe(H(t)?[]:[r,...ve(r)]);i&&we(i)?e.domain=i:M("指定Cookie域无效或无权限,使用默认域!","warn")}t=e}else t=(()=>{try{const e=window.localStorage,t="__storage_test__";return e.setItem(t,t),e.removeItem(t),!0}catch(e){return!1}})()?new ce:new me;return"cookie"===o&&pe&&we(pe)&&((e,t,i)=>{if(t&&we(t)){let s=new he(t);[i+"_gdp_session_id","gdp_user_id_gioenc",i+"_gdp_cs1_gioenc",i+"_gdp_user_key_gioenc",i+"_gdp_gio_id_gioenc",i+"_gdp_sequence_ids",i+"_gdp_session_id_sent"].forEach((t=>{const i=s.getItem(t);s.hasItem(t)&&(e.setItem(t,i),s.removeItem(t))})),s=void 0}})(t,pe,n),t};var Se="SESSIONID_UPDATE",Oe={name:"gioCustomTracking",method:class{constructor(e){this.growingIO=e,this.getValidResourceItem=e=>{if(e&&w(e)&&e.id&&e.key){const t={id:I(e.id)?e.id:N(e.id),key:I(e.key)?e.key:N(e.key)};return e.attributes&&(t.attributes=e.attributes),t}},this.getDynamicAttributes=e=>(p(e)||L(e).forEach((t=>{S(e[t])?e[t]=e[t]():w(e[t])?B(e,t):O(e[t])||(e[t]=N(e[t]))})),e),this.buildCustomEvent=(e,t,i,s)=>{Q(e,(()=>{const{dataStore:{eventContextBuilder:o,eventConverter:r,currentPage:n}}=this.growingIO;let a=Object.assign({eventType:"CUSTOM",eventName:e,pageShowTimestamp:null==n?void 0:n.time,attributes:W(this.getDynamicAttributes(w(t)&&!H(t)?t:void 0)),resourceItem:W(this.getValidResourceItem(i))},o());H(s)||(a=Object.assign(Object.assign({},a),s)),r(a)}))},this.buildUserAttributesEvent=(e,t)=>{const{dataStore:{eventContextBuilder:i,eventConverter:s}}=this.growingIO;let o=Object.assign({eventType:"LOGIN_USER_ATTRIBUTES",attributes:W(e)},i());H(t)||(o=Object.assign(Object.assign({},o),t)),s(o)}}}};const be=["gioPerformance"];class Ee{constructor(e){var t,i,s,o;this.growingIO=e,this.innerPluginInit=()=>{var e;be.forEach((e=>{var t;return B(null===(t=this.pluginsContext)||void 0===t?void 0:t.plugins,e)})),L(null===(e=this.pluginsContext)||void 0===e?void 0:e.plugins).forEach((e=>{var t;const{name:i,method:s}=null===(t=this.pluginsContext)||void 0===t?void 0:t.plugins[e];x(this.pluginItems,(e=>e.name===i))||this.pluginItems.push({name:D(i||e),method:s||(e=>{})})})),H(this.pluginItems)||this.installAll()},this.install=(e,t,i)=>{var s,o;const r=t||x(this.pluginItems,(t=>t.name===e));if((null===(s=this.growingIO)||void 0===s?void 0:s.plugins)[e])return M(`重复加载插件 ${e} 或插件重名,已跳过加载!`,"warn"),!1;if(!r)return M(`插件加载失败!不存在名为 ${e} 的插件!`,"error"),!1;try{return(null===(o=this.growingIO)||void 0===o?void 0:o.plugins)[e]=new r.method(this.growingIO,i),"cdp"===this.growingIO.gioEnvironment&&t&&M("加载插件 "+e,"info"),!0}catch(e){return M("插件加载异常 "+e,"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)&&!x(this.pluginItems,(e=>e.name===t.name))&&this.pluginItems.push({name:D(t.name),method:t.method?t.method:()=>{}})}))},this.uninstall=e=>{var t;B(this.pluginItems,e);const i=B(null===(t=this.growingIO)||void 0===t?void 0:t.plugins,e);return i||M(`卸载插件 ${e} 失败!`,"error"),i},this.uninstallAll=()=>{this.pluginItems.forEach((e=>this.uninstall(e.name)))},this.lifeError=(e,t)=>M(`插件执行错误 ${e.name} ${t}`,"error"),this.onComposeBefore=e=>{this.pluginItems.forEach((t=>{var i;const s=null===(i=this.growingIO.plugins[t.name])||void 0===i?void 0:i.onComposeBefore;if(s&&S(s))try{s(e)}catch(e){this.lifeError(t,e)}}))},this.onComposeAfter=e=>{this.pluginItems.forEach((t=>{var i;const s=null===(i=this.growingIO.plugins[t.name])||void 0===i?void 0:i.onComposeAfter;if(s&&S(s))try{s(e)}catch(e){this.lifeError(t,e)}}))},this.onSendBefore=e=>{this.pluginItems.forEach((t=>{var i;const s=null===(i=this.growingIO.plugins[t.name])||void 0===i?void 0:i.onSendBefore;if(s&&S(s))try{s(e)}catch(e){this.lifeError(t,e)}}))},this.onSendAfter=e=>{this.pluginItems.forEach((t=>{var i;const s=null===(i=this.growingIO.plugins[t.name])||void 0===i?void 0:i.onSendAfter;if(s&&S(s))try{s(e)}catch(e){this.lifeError(t,e)}}))},this.pluginsContext={plugins:{}},this.pluginItems=[],null===(t=this.growingIO.emitter)||void 0===t||t.on("onComposeBefore",this.onComposeBefore),null===(i=this.growingIO.emitter)||void 0===i||i.on("onComposeAfter",this.onComposeAfter),null===(s=this.growingIO.emitter)||void 0===s||s.on("onSendBefore",this.onSendBefore),null===(o=this.growingIO.emitter)||void 0===o||o.on("onSendAfter",this.onSendAfter)}}class Te extends Ee{constructor(e){super(e),this.growingIO=e,this.growingIO.gioSDKFull=!1,this.pluginsContext={plugins:{gioCustomTracking:Oe}}}}class _e{constructor(){var e;this.trackingId="g0",this.init=e=>{var t,i,s,o,r;M("Gio Web SDK 初始化中...","info");const{initOptions:n,currentPage:a,sendVisit:d,sendPage:l}=this.dataStore;n(e),this.storage=ye(this.vdsConfig),this.initCallback(),null===(t=this.emitter)||void 0===t||t.emit("OPTION_INITIALIZED",this),null===(s=null===(i=this.plugins)||void 0===i?void 0:i.gioEventAutoTracking)||void 0===s||s.main(),a.hookHistory(),a.parsePage(),null===(o=this.emitter)||void 0===o||o.emit("SDK_INITIALIZED",this),M("Gio Web SDK 初始化完成!","success"),this.useEmbeddedInherit||(this.dataStore.lastVisitEvent.timestamp=a.time,d()),l(),this.gioSDKInitialized=!0,this.vdsConfig.gioSDKInitialized=!0,window[this.vds]=this.vdsConfig,null===(r=this.emitter)||void 0===r||r.emit("SDK_INITIALIZED_COMPLATE",this)},this.setOption=(e,t)=>{if(j(r,e)){const i=this.dataStore.setOption(e,t);return i&&n[e]&&M(`已${t?"开启":"关闭"}${n[e]}`,"info"),i}return M(`不存在可修改的配置项:${e},请检查后重试!`,"warn"),!1},this.getOption=e=>this.dataStore.getOption(e),this.setGeneralProps=e=>{w(e)&&!H(e)?(this.dataStore.generalProps=Object.assign(Object.assign({},this.dataStore.generalProps),e),L(this.dataStore.generalProps).forEach((e=>{j([void 0,null],this.dataStore.generalProps[e])&&(this.dataStore.generalProps[e]="")}))):this.callError("setGeneralProps")},this.clearGeneralProps=e=>{O(e)&&!H(e)?e.forEach((e=>{B(this.dataStore.generalProps,e)})):this.dataStore.generalProps={}},this.reissuePage=()=>{this.dataStore.sendPage()},this.notRecommended=()=>M("不推荐的方法使用,建议使用 gio('setOption', [optionName], [value])!","info"),this.callError=(e,t=!0,i="参数不合法")=>M(`${t?"调用":"设置"} ${e} 失败,${i}!`,"warn"),this.updateImpression=()=>{var e,t;const i=null===(t=null===(e=this.plugins)||void 0===e?void 0:e.gioImpressionTracking)||void 0===t?void 0:t.main;i?i("emitter"):M("updateImpression 错误! 请集成半自动埋点浏览插件后重试!","error")},this.gioEnvironment="cdp",this.sdkVersion="3.8.7",this.vds=window.gioCompatibilityVds?"gdp_vds":"vds",this.utils=Object.assign(Object.assign({},G),Z),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.useEmbeddedInherit=!1,this.useHybridInherit=!1,this.gioSDKInitialized=!1,this.plugins=new Te(this),this.plugins.innerPluginInit()}}class Ce{constructor(e){this.growingIO=e;const{projectId:t}=this.growingIO.vdsConfig,{getItem:i,setItem:s,getKeys:o,removeItem:r}=this.growingIO.storage;this.getItem=i,this.setItem=s,this.getKeys=o,this.removeItem=r,this.sIdStorageName=t+"_gdp_session_id",this.uidStorageName="gdp_user_id_gioenc",this.userIdStorageName=t+"_gdp_cs1_gioenc",this.userKeyStorageName=t+"_gdp_user_key_gioenc",this.gioIdStorageName=t+"_gdp_gio_id_gioenc"}get sessionId(){return this.getItem(this.sIdStorageName)||(this.sessionId=se(),this.sessionId)}set sessionId(e){var t;e||(e=se());const i=this.getItem(this.sIdStorageName)||this.prevSessionId,{sessionExpires:s=30}=this.growingIO.vdsConfig;this.setItem(this.sIdStorageName,e,+Date.now()+60*s*1e3),i!==e&&(this.getKeys().filter((e=>/.+_gdp_session_id_.{36}/.test(e))).forEach((e=>{this.removeItem(e)})),this.setItem(this.growingIO.dataStore.visitStorageName,""),null===(t=this.growingIO.emitter)||void 0===t||t.emit(Se,{newSessionId:e,oldSessionId:i})),this.prevSessionId=e}get uid(){return this.getItem(this.uidStorageName)||(this.uid=se(),this.uid)}set uid(e){var t;const i=this.getItem(this.uidStorageName)||this.prevUId;this.setItem(this.uidStorageName,e),i!==e&&(null===(t=this.growingIO.emitter)||void 0===t||t.emit("UID_UPDATE",{newUId:e,oldUId:i})),this.prevUId=e}get userId(){return this.getItem(this.userIdStorageName)||""}set userId(e){var t,i;const s=this.getItem(this.userIdStorageName)||this.prevUserId;this.setItem(this.userIdStorageName,e),null===(t=this.growingIO.emitter)||void 0===t||t.emit("SET_USERID",{newUserId:e,oldUserId:s,userKey:this.userKey}),s!==e&&(null===(i=this.growingIO.emitter)||void 0===i||i.emit("USERID_UPDATE",{newUserId:e,oldUserId:s,userKey:this.userKey})),e&&(this.gioId=e),this.prevUserId=e}get userKey(){return this.getItem(this.userKeyStorageName)||""}set userKey(e){var t,i;const s=this.getItem(this.userKeyStorageName)||this.prevUserKey;this.setItem(this.userKeyStorageName,e),null===(t=this.growingIO.emitter)||void 0===t||t.emit("SET_USERKEY",{newUserKey:e,oldUserKey:s,userId:this.userId}),s!==e&&(null===(i=this.growingIO.emitter)||void 0===i||i.emit("USERKEY_UPDATE",{newUserKey:e,oldUserKey:s,userId:this.userId})),this.prevUserKey=e}get gioId(){return this.getItem(this.gioIdStorageName)||""}set gioId(e){var t;const i=this.getItem(this.gioIdStorageName)||this.prevGioId;this.setItem(this.gioIdStorageName,e),i!==e&&(null===(t=this.growingIO.emitter)||void 0===t||t.emit("GIOID_UPDATE",{newGioId:e,oldGioId:i})),this.prevGioId=e}}class xe{constructor(e){this.growingIO=e,this.main=()=>{var e,t;const{sdkVersion:i,useEmbeddedInherit:s,vdsConfig:o,userStore:r,dataStore:n,trackingId:a}=this.growingIO,{path:d,query:l}=n.currentPage;let g={appVersion:o.version,dataSourceId:o.dataSourceId,deviceId:r.uid,domain:s?o.appId:window.location.host,gioId:r.gioId,language:navigator.language,path:d,platform:o.platform,query:l,referralPage:(null===(e=n.lastPageEvent)||void 0===e?void 0:e.referralPage)||"",screenHeight:window.screen.height,screenWidth:window.screen.width,sdkVersion:i,sessionId:r.sessionId,timestamp:+Date.now(),title:null!==(t=z((()=>document.title.slice(0,255))))&&void 0!==t?t:"",userId:r.userId};if(o.enableIdMapping&&(g.userKey=r.userKey),H(o.ignoreFields)||o.ignoreFields.forEach((e=>{B(g,e)})),s&&!H(this.minpExtraParams)){const e=Object.assign({},g);F(Object.assign(Object.assign({},g),this.minpExtraParams),((t,i)=>{var s;j(o.embeddedIgnore,i)?(g[i]=e[i],"domain"===i&&(g[i]=window.location.host)):g[i]=null!==(s=this.minpExtraParams[i])&&void 0!==s?s:g[i]}))}return g.trackingId=a,g},this.minpExtraParams={}}}class ke{constructor(e){this.growingIO=e,this.parsePage=()=>{const{hashtag:e}=this.growingIO.vdsConfig,t=location.pathname,i=location.search,s=location.hash,o=s.indexOf("?");this.domain=window.location.host,this.title=document.title.slice(0,255),this.time=+Date.now(),this.path=t,this.query=i,e&&(o>-1?(this.path+=s.slice(0,o),this.query=this.query+"&"+s.slice(o+1)):this.path+=s),this.query&&j(["?","&"],this.query.charAt(0))&&(this.query=this.query.slice(1))},this._getNoHashHref=()=>{const{protocol:e,host:t,pathname:i,search:s}=window.location;return`${e}://${t}${i}${s}`},this.getReferralPage=()=>{var e,t;const{dataStore:{lastPageEvent:i}}=this.growingIO;return(null==i?void 0:i.path)===this.path&&(null!==(e=null==i?void 0:i.query)&&void 0!==e?e:"")===(null!==(t=this.query)&&void 0!==t?t:"")?null==i?void 0:i.referralPage:(null==i?void 0:i.path)?this.lastHref:document.referrer},this.pageListener=()=>{const{hashtag:e}=this.growingIO.vdsConfig;let t=window.location.href,i=this.lastHref;e||(t=this._getNoHashHref(),i=this.lastNoHashHref),i!==t&&(this.parsePage(),this.buildPageEvent())},this.hookHistory=()=>{const e=window.history.pushState,t=window.history.replaceState,i=this;e&&z((()=>window.history.pushState=function(){e.apply(window.history,arguments),setTimeout(i.pageListener)})),t&&z((()=>window.history.replaceState=function(){t.apply(window.history,arguments),setTimeout(i.pageListener)})),J(window,"popstate",this.pageListener);const{hashtag:s}=this.growingIO.vdsConfig;s&&J(window,"hashchange",this.pageListener)},this.buildPageEvent=e=>{const{dataStore:{lastPageEvent:t,eventContextBuilder:i,eventConverter:s}}=this.growingIO;let o=Object.assign(Object.assign({eventType:"PAGE"},i()),{protocolType:location.protocol.substring(0,location.protocol.length-1),referralPage:this.getReferralPage()});H(e)||(o=Object.assign(Object.assign({},o),e)),o.timestamp=this.time,s(o),this.lastHref=window.location.href,this.lastNoHashHref=this._getNoHashHref(),this.lastLocation=Object.assign({},window.location)},this.title=document.title.slice(0,255),this.lastLocation=Object.assign({},window.location)}}const je={referralPage:document.referrer};class qe{constructor(o){var a,l,g;this.growingIO=o,this.ALLOW_SETTING=Object.assign(Object.assign({},t),"saas"===this.growingIO.gioEnvironment?s:i),this.allowOptKeys=Object.keys(this.ALLOW_SETTING),this.trackTimers={},this.setSequenceIds=(e,t)=>{let i=this.growingIO.storage.getItem(this.seqStorageIdName)||{};"gsid"===e?i.globalKey=t:i=Object.assign(Object.assign({},i),t),this.growingIO.storage.setItem(this.seqStorageIdName,i)},this.initOptions=t=>{var i,s,o,r,a,l,g;const{projectId:h,dataSourceId:c,appId:u}=t;this.initialDataSourceId=c;const m={};this.allowOptKeys.forEach((i=>{const s=this.ALLOW_SETTING[i].type;let o=O(s)?!j(s,V(t[i])):V(t[i])!==s;"platform"!==i||j(e,t[i])||(o=!0),o?m[i]=this.ALLOW_SETTING[i].default:"ignoreFields"===i?m.ignoreFields=t.ignoreFields.filter((e=>j(d,e))):(m[i]=t[i],j(["dataCollect","autotrack"],i)&&(m[i]||M("已关闭"+n[i],"info")))})),m.sessionExpires=Math.round(m.sessionExpires),(f(m.sessionExpires)||1>m.sessionExpires||m.sessionExpires>360)&&(m.sessionExpires=30),m.storageType=m.storageType.toLowerCase(),m.sendType=m.sendType.toLowerCase(),j(["beacon","xhr","image"],m.sendType)||(m.sendType="beacon"),!f(Number(m.requestTimeout))&&m.requestTimeout>0||(m.requestTimeout=5e3),this.growingIO.vdsConfig=Object.assign(Object.assign(Object.assign({},null!==(i=window.vds)&&void 0!==i?i:{}),m),{projectId:h,dataSourceId:c,appId:u,performance:{monitor:null===(o=null===(s=m.performance)||void 0===s?void 0:s.monitor)||void 0===o||o,exception:null===(a=null===(r=m.performance)||void 0===r?void 0:r.exception)||void 0===a||a,network:null!==(g=null===(l=m.performance)||void 0===l?void 0:l.network)&&void 0!==g&&g}}),window.vds=this.growingIO.vdsConfig,this.seqStorageIdName=h+"_gdp_sequence_ids",this.visitStorageName=h+"_gdp_session_id_sent"},this.setOption=(e,t)=>{var i;const{vdsConfig:s,callError:o,uploader:n,emitter:a}=this.growingIO,d=I(e)&&j(r,e),l=d&&typeof t===((null===(i=this.ALLOW_SETTING[e])||void 0===i?void 0:i.type)||"string"),g=Object.assign({},s);return d&&l?(s[e]=t,"dataCollect"===e&&g.dataCollect!==t&&(t?(this.sendVisit(!0),this.sendPage()):this.growingIO.clearTrackTimer()),j(["host","scheme"],e)&&(null==n||n.generateHost()),null==a||a.emit("OPTION_CHANGE",{optionName:e,optionValue:t}),window.vds[e]=t,!0):(o("setOption > "+e),!1)},this.getOption=e=>{const{vdsConfig:t,callError:i}=this.growingIO;return e&&R(t,N(e))?t[N(e)]:p(e)?Object.assign({},t):void i("getOption > "+e)},this.sendVisit=e=>{const{userStore:{sessionId:t},storage:i}=this.growingIO,s=i.getItem(this.visitStorageName);!e&&t===s||(this.lastVisitEvent.timestamp=this.currentPage.time-1,this.buildVisitEvent())},this.buildVisitEvent=e=>{const{dataStore:{eventContextBuilder:t,eventConverter:i},emitter:s,storage:o,userStore:r}=this.growingIO,{referralPage:n,title:a,path:d,query:l,timestamp:g}=this.lastVisitEvent;let h=Object.assign(Object.assign({eventType:"VISIT"},t()),{referralPage:n||this.currentPage.getReferralPage(),timestamp:g});d&&(h.title=a,h.path=d,h.query=l),H(e)||(h.session=(null==e?void 0:e.session)||h.session,h.trackingId=null==e?void 0:e.trackingId,h=Object.assign(Object.assign({},h),e));const c=({requestData:e})=>{"VISIT"===e.eventType&&e.trackingId===this.growingIO.trackingId&&(r.sessionId===e.sessionId&&o.setItem(this.visitStorageName,e.sessionId),s.off("onSendAfter",c))};s.on("onSendAfter",c),i(h)},this.sendPage=e=>{e&&this.currentPage.parsePage(),this.currentPage.buildPageEvent()},this.buildErrorEvent=e=>{const{dataStore:{eventContextBuilder:t,eventConverter:i}}=this.growingIO;i(Object.assign({eventType:"CUSTOM",pageShowTimestamp:this.currentPage.time,eventName:"onError",attributes:e},t()))},this.currentPage=new ke(this.growingIO),this.eventContextBuilderInst=new xe(this.growingIO),this.eventContextBuilder=this.eventContextBuilderInst.main,this.generalProps={},this.lastVisitEvent=je,null===(a=this.growingIO.emitter)||void 0===a||a.on("onComposeAfter",(({composedEvent:e})=>{"VISIT"!==e.eventType&&"vst"!==e.t||e.trackingId!==this.growingIO.trackingId||(this.lastVisitEvent=e)})),this.lastPageEvent={},null===(l=this.growingIO.emitter)||void 0===l||l.on("onComposeAfter",(({composedEvent:e})=>{"PAGE"!==e.eventType&&"page"!==e.t||e.trackingId!==this.growingIO.trackingId||(this.lastPageEvent=e)})),null===(g=this.growingIO.emitter)||void 0===g||g.on(Se,(()=>{if(this.growingIO.gioSDKInitialized){this.currentPage.parsePage();const{title:e,path:t,query:i,time:s,getReferralPage:o}=this.currentPage;this.lastVisitEvent={referralPage:document.referrer||o(),title:e,path:t,query:i,timestamp:s-1},this.sendVisit(!0),this.sendPage(!0)}}))}get esid(){const e=this.growingIO.storage.getItem(this.seqStorageIdName)||{};let t=Object.assign({},e);return B(t,"globalKey"),t=w(t)&&!p(t)?t:{},this._esid={},L(t).forEach((e=>{this._esid[e]=f(Number(t[e]))||t[e]>=1e9||1>t[e]?1:t[e]})),this._esid}set esid(e){const t={};L(e).forEach((i=>{t[i]=f(e[i])||e[i]>=1e9||1>e[i]?1:e[i]})),$(this._esid,t)||(this._esid=t,this.setSequenceIds("esid",this._esid))}get gsid(){const e=this.growingIO.storage.getItem(this.seqStorageIdName)||{},t=Number(e.globalKey);return this._gsid=f(t)||t>=1e9||1>t?1:t,this._gsid}set gsid(e){f(Number(e))||e>=1e9||1>e?this._gsid=1:this._gsid=e,this.setSequenceIds("gsid",this._gsid)}}class Ne extends qe{constructor(e){super(e),this.growingIO=e,this.eventConverter=e=>{var t;const{vdsConfig:i,dataStore:s,uploader:o}=this.growingIO;if(i.dataCollect){e.trackingId===this.growingIO.trackingId&&(e.globalSequenceId=s.gsid,e.eventSequenceId=s.esid[e.eventType]||1);const i={};F(e,((e,t)=>{var s;if("element"===t){const t=null!==(s=E(e))&&void 0!==s?s:{};F(t,((e,t)=>{H(e)&&0!==e||(i[t]=e)}))}else(H(e)||p(e))&&0!==e||(i[t]=e)})),e.trackingId===this.growingIO.trackingId&&(this.growingIO.dataStore.gsid+=1,this.growingIO.dataStore.esid=Object.assign(Object.assign({},this.growingIO.dataStore.esid),{[i.eventType]:(this.growingIO.dataStore.esid[i.eventType]||1)+1})),null===(t=this.growingIO.emitter)||void 0===t||t.emit("onComposeAfter",{composedEvent:Object.assign({},i)}),e.trackingId===this.growingIO.trackingId&&o.commitRequest(i)}else"VISIT"===e.eventType&&(this.lastVisitEvent=e)}}}class Pe{constructor(e){this.growingIO=e,this.getSendType=()=>{const{sendType:e}=this.growingIO.vdsConfig;return"beacon"===e?(()=>{var e;const t=!!(null===(e=null===window||void 0===window?void 0:window.navigator)||void 0===e?void 0:e.sendBeacon),i=window.navigator.userAgent;if(i.match(/(iPad|iPhone|iPod)/g)){const e=(e=>{const t=e.toLowerCase().match(/cpu.*os (.*?) like mac os/i);return!t||2>t.length?0:+t[1].split("_").slice(0,2).join(".")})(i);return t&&e>13}return t})()?"beacon":"xhr":e},this.commitRequest=e=>{const t=Object.assign({},e);this.requestQueue.push(Object.assign(Object.assign({},t),{requestType:this.getSendType()})),this.initiateRequest()},this.initiateRequest=()=>{var e,t;if([...this.requestQueue].length>0&&this.requestingNum(this.retryIds[e.globalSequenceId||e.esid]||0)<=this.retryLimit)),H(this.requestQueue))return;const n=this.requestQueue.shift(),{requestType:a}=n;null==s||s.emit("onSendBefore",{requestData:Object.assign({},n)});const d=Object.assign({},n);if(B(d,["requestType","trackingId"]),i.debug&&console.log("[GrowingIO Debug]:",JSON.stringify(d,null,2).replace(/\"/g,(()=>{const e=window.navigator.userAgent;return/(\d+\.\d)?(?:\.\d)?\s+safari\/?(\d+\.\d+)?/i.test(e)&&!/chrome\/(\d+\.\d+)/i.test(e)})()?"":'"')),this.requestingNum+=1,r)return this.requestSuccessFn(n),!1;let l=Object.assign({},d);switch(i.compress&&(null==o?void 0:o.gioCompress)?"image"===a?(this.compressType="11",l=null===(e=null==o?void 0:o.gioCompress)||void 0===e?void 0:e.compressToEncodedURIComponent(JSON.stringify([l]))):(this.compressType="1",l=null===(t=null==o?void 0:o.gioCompress)||void 0===t?void 0:t.compressToUint8Array(JSON.stringify([l]))):(this.compressType="0",l=JSON.stringify([l])),a){case"beacon":default:this.sendByBeacon(n,l);break;case"xhr":this.sendByXHR(n,l);break;case"image":this.sendByImage(n,l)}}},this.generateURL=()=>`${this.requestURL}?stm=${+Date.now()}&compress=${this.compressType}`,this.sendByBeacon=(e,t)=>{navigator.sendBeacon(this.generateURL(),t)?this.requestSuccessFn(e):this.requestFailFn(e,"beacon")},this.sendByXHR=(e,t)=>{const i=new XMLHttpRequest;if(i)return i.open("POST",this.generateURL(),!0),i.onload=()=>{204===i.status?this.requestSuccessFn(e):this.requestFailFn(e,"xhr")},i.ontimeout=i.onerror=i.onabort=()=>{this.requestFailFn(e,"xhr")},i.setRequestHeader("Content-Type","text/plain;charset=UTF-8"),i.timeout=this.growingIO.vdsConfig.requestTimeout,void i.send(t);if(null===window||void 0===window?void 0:window.XDomainRequest){const i=new window.XDomainRequest;i.open("POST",this.generateURL().replace("https://","http://"),!0),i.onload=()=>{204===i.status?this.requestSuccessFn(e):this.requestFailFn(e,"xhr")},i.onerror=i.ontimeout=()=>{this.requestFailFn(e,"xhr")},i.send(t)}},this.sendByImage=(e,t)=>{const i=`${this.generateURL()}&data=${t}`;let s=document.createElement("img");s.width=1,s.height=1;let o=window.setTimeout((()=>{this.requestingNum-=1,this.clearImage(s),window.clearTimeout(o),o=null,this.initiateRequest()}),this.growingIO.vdsConfig.requestTimeout);s.onload=()=>{this.requestSuccessFn(e),this.clearImage(s),window.clearTimeout(o),o=null},s.onerror=s.onabort=()=>{this.requestSuccessFn(e),this.clearImage(s),window.clearTimeout(o),o=null},s.src=i},this.clearImage=e=>{e.src="",e.onload=()=>{},e.onerror=e.onabort=()=>{},e=null},this.requestSuccessFn=e=>{var t;this.requestingNum-=1;const i=e.globalSequenceId||e.esid||-1;this.retryIds[i]&&(this.retryIds[i]=0),e.trackingId===this.growingIO.trackingId&&this.growingIO.userStore.sessionId===e.sessionId&&(this.growingIO.userStore.sessionId=e.sessionId),null===(t=this.growingIO.emitter)||void 0===t||t.emit("onSendAfter",{requestData:Object.assign({},e)}),this.initiateRequest()},this.requestFailFn=(e,t)=>{this.requestingNum-=1;const i=e.globalSequenceId||e.esid||-1;this.retryIds[i]||(this.retryIds[i]=0),this.retryIds[i]+=1;const s=this.requestQueue.some((t=>t.globalSequenceId===e.globalSequenceId&&t.esid===e.esid));let o=t;if(this.retryIds[i]{this.requestQueue.push(Object.assign(Object.assign({},e),{requestType:o})),this.initiateRequest(),window.clearTimeout(t),t=null}),800)}this.initiateRequest()},this.requestQueue=[],this.requestLimit=10,this.requestTimeout=5e3,this.retryLimit=2,this.retryIds={},this.requestingNum=0,this.requestURL=""}}class De extends Pe{constructor(e){super(e),this.growingIO=e,this.generateHost=()=>{let{scheme:e,host:t="",projectId:i}=this.growingIO.vdsConfig;e?U(N(e),"://")||(e+="://"):e=(location.protocol.indexOf("http")>-1?location.protocol.replace(":",""):"https")+"//",A(t,"http")&&(t=t.substring(t.indexOf("://")+(U(N(e),"://")?3:0))),this.requestURL=`${e}${t}/v3/projects/${i}/collect`},this.requestURL="",this.generateHost()}}class Ae extends _e{constructor(){super(),this.registerPlugins=e=>{O(e)?(e.forEach(((t,i)=>{var s,o;H(t)||p(t)?M("插件不合法,跳过加载!","warn"):(null===(s=t.js)||void 0===s?void 0:s.default)&&(e[i]=Object.assign(Object.assign({},null===(o=t.js)||void 0===o?void 0:o.default),{options:t.options}))})),e=C(e),this.plugins.installAll(e)):M("插件注册失败,请检查!","error")},this.initCallback=()=>{this.uploader=new De(this),this.userStore=new Ce(this)},this.getPlugins=()=>this.plugins.pluginItems,this.setTrackerScheme=e=>{j(["http","https"],e)?(this.dataStore.setOption("scheme",e),this.notRecommended()):this.callError("scheme",!1)},this.setTrackerHost=e=>{Y.test(e)||ee.test(e)?(this.dataStore.setOption("host",e),this.notRecommended()):this.callError("host",!1)},this.setDataCollect=e=>{this.setOption("dataCollect",!!e),this.notRecommended()},this.setAutotrack=e=>{this.setOption("autotrack",!!e),this.notRecommended()},this.enableDebug=e=>{this.setOption("debug",!!e),this.notRecommended()},this.enableHT=e=>{this.setOption("hashtag",!!e),this.notRecommended()},this.getVisitorId=()=>this.userStore.uid,this.getDeviceId=()=>this.userStore.uid,this.setUserAttributes=(e,t)=>{var i,s;!H(e)&&w(e)?null===(s=null===(i=this.plugins)||void 0===i?void 0:i.gioCustomTracking)||void 0===s||s.buildUserAttributesEvent(e,t):this.callError("setUserAttributes")},this.setUserId=(e,t)=>{if(X(N(e).trim())){const i=this.userStore.gioId;this.vdsConfig.enableIdMapping&&(this.userStore.userKey=!p(t)&&N(t).length>0?N(t).slice(0,1e3):""),this.userStore.userId=N(e).slice(0,1e3),i&&i!==this.userStore.userId&&(this.userStore.sessionId="")}else this.clearUserId(),this.callError("setUserId")},this.clearUserId=()=>{this.userStore.userId="",this.userStore.userKey=""},this.track=(e,t,i,s)=>{var o,r;((null===(r=null===(o=this.plugins)||void 0===o?void 0:o.gioCustomTracking)||void 0===r?void 0:r.buildCustomEvent)||function(){})(e,Object.assign(Object.assign({},this.dataStore.generalProps),w(t)&&!H(t)?t:{}),i,s)},this.sendPage=e=>this.dataStore.currentPage.buildPageEvent(e),this.sendVisit=e=>this.dataStore.buildVisitEvent(e),this.trackTimerStart=(e,t)=>{this.vdsConfig.dataCollect&&Q(e,(()=>{const i=se();S(t)?(this.dataStore.trackTimers[i]={eventName:e,leng:0,start:+Date.now()},t(i)):M("回调方法不合法,返回timerId失败!")}))},this.trackTimerPause=e=>{if(e&&this.dataStore.trackTimers[e]){const t=this.dataStore.trackTimers[e];t.start&&(t.leng=t.leng+(+Date.now()-t.start)),t.start=0}},this.trackTimerResume=e=>{if(e&&this.dataStore.trackTimers[e]){const t=this.dataStore.trackTimers[e];0===t.start&&(t.start=+Date.now())}},this.trackTimerEnd=(e,t)=>{if(this.vdsConfig.dataCollect){const i=864e5;if(e&&this.dataStore.trackTimers[e]){const s=this.dataStore.trackTimers[e];if(0!==s.start){const e=+Date.now()-s.start;s.leng=e>0?s.leng+e:0}this.track(s.eventName,Object.assign(Object.assign({},t),{event_duration:s.leng>i?0:s.leng/1e3})),this.removeTimer(e)}else M("未查找到对应的计时器,请检查!","error")}},this.removeTimer=e=>{e&&this.dataStore.trackTimers[e]&&delete this.dataStore.trackTimers[e]},this.clearTrackTimer=()=>{this.dataStore.trackTimers={}},this.dataStore=new Ne(this)}}let Ue;return function(){var e,t,i,s,r;let n=window.gioCompatibilityVds?"gdp_vds":"vds";if(null===(e=window[n])||void 0===e?void 0:e.gioSDKInstalled)return Ue=window.gdp,void M("SDK重复加载,请检查是否重复加载SDK或接入其他平台SDK导致冲突!","warn");window[n]=Object.assign(Object.assign({},null!==(t=window[n])&&void 0!==t?t:{}),{gioSDKInstalled:!0});const d=new Ae;Ue=function(){var e;const t=arguments[0];if(I(t)&&j(o,t)&&d[t]){const e=_(q(arguments));if("init"===t){const t=(e=>{var t;return e.vdsConfig||e.gioSDKInitialized||(null===(t=window.vds)||void 0===t?void 0:t.gioSDKInitialized)?(M("SDK重复初始化,请检查是否重复加载SDK或接入其他平台SDK导致冲突!","warn"),!1):!(j(["","localhost","127.0.0.1"],location.hostname)&&!window._gr_ignore_local_rule&&(M("当前SDK不允许在本地环境初始化!","warn"),1))})(d);if(!t)return;const i=(e=>!H(C(e))||(M('SDK初始化失败,请使用 gdp("init", "您的GrowingIO项目 accountId", "您项目的 dataSourceId", options); 进行初始化!',"error"),!1))(e);if(!i)return;const s=(e=>{const t=E(e);let i=T(e);return X(N(t).trim())?(w(i)&&i||(i={}),{projectId:t,userOptions:i}):(M("SDK初始化失败,accountId 参数不合法!","error"),!1)})(e);if(!s)return;const o=(e=>{const t=e[1],i=e[2],s=T(e);return t&&I(t)?{dataSourceId:t,appId:I(i)?i:"",cdpOptions:s}:(M("SDK初始化失败,dataSourceId 参数不合法!","error"),!1)})(e);if(!o)return;const{projectId:r}=s,{dataSourceId:n,appId:a,cdpOptions:l}=o;d.init(Object.assign(Object.assign({},l),{projectId:r,dataSourceId:n,appId:a}))}else if("registerPlugins"===t)d.registerPlugins(e[0]);else{if(d.gioSDKInitialized&&d.vdsConfig)return d[t](...e);d.emitter.emit("UNINITIALIZED_CALL",arguments),M("SDK未初始化!","error")}}else j(a,t)?M(`方法 ${N(t)} 已被弃用,请移除!`,"warn"):M(`不存在名为 ${N(t)} 的方法调用!`,"error");window[n]=Object.assign(Object.assign({},window[n]),{_gr_ignore_local_rule:null!==(e=window._gr_ignore_local_rule)&&void 0!==e&&e,gioEnvironment:"cdp",gioSDKVersion:d.sdkVersion,gioSDKFull:d.gioSDKFull,canIUse:e=>j(o,e)&&d[e]})};const l=null===(i=null===window||void 0===window?void 0:window.gdp)||void 0===i?void 0:i.q,g=null===(s=null===window||void 0===window?void 0:window.gdp)||void 0===s?void 0:s.e,h=null===(r=null===window||void 0===window?void 0:window.gdp)||void 0===r?void 0:r.ef;window.gdp=Ue,window.gdp.e=g,window.gdp.ef=h,O(l)&&!H(l)&&l.forEach((e=>{Ue.apply(null,e)}))}(),Ue})); diff --git a/package.json b/package.json index 0cc151d..261372d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gio-webjs-sdk-cdp", - "version": "3.8.6", + "version": "3.8.7", "description": "GrowngIO官方 WebJS SDK,具备自动采集基本的用户行为事件,比如访问和行为数据等。目前支持代码埋点、无埋点、可视化圈选、热图等功能。", "main": "gdp.js", "scripts": { diff --git a/plugins/gioCustomTracking.js b/plugins/gioCustomTracking.js index daa82c9..207e7cb 100644 --- a/plugins/gioCustomTracking.js +++ b/plugins/gioCustomTracking.js @@ -1 +1 @@ -var t=function(){return t=Object.assign||function(t){for(var n,e=1,r=arguments.length;r>e;e++)for(var i in n=arguments[e])({}).hasOwnProperty.call(n,i)&&(t[i]=n[i]);return t},t.apply(this,arguments)},n=function(t){return o(["undefined","null"],f(t))},e=function(t){return"string"===f(t)},r=function(t){return"object"===f(t)&&!n(t)},i=function(t){return Array.isArray(t)&&"array"===f(t)},o=function(t,n){return("array"===f(t)||"string"===f(t))&&t.indexOf(n)>=0},u=function(t){return n(t)?"":"".concat(t)},c=function(t){return r(t)?Object.keys(t):[]},a=function(t,n){if(!r(t))return!1;try{return"string"===f(n)?delete t[n]:"array"===f(n)?n.map((function(n){return delete t[n]})):(function(t){return"regexp"===f(t)}(n)&&c(t).forEach((function(e){n.test(e)&&a(t,e)})),!0)}catch(t){return!1}},s=function(t){return i(t)?0===t.length:r(t)?0===c(t).length:!t},f=function(t){return{}.toString.call(t).slice(8,-1).toLowerCase()},l=function(t){var e={};return r(t)&&function(t,o){c(t).forEach((function(o){return function(t,o){var c,a=u(o).slice(0,100);r(t)?e[a]=l(t):i(t)?(e[a]=t.slice(0,100),"cdp"===(null===(c=window.vds)||void 0===c?void 0:c.gioEnvironment)&&(e[a]=e[a].join("||").slice(0,1e3))):e[a]=n(t)?"":u(t).slice(0,1e3)}(t[o],o)}))}(t),e},v={name:"gioCustomTracking",method:function(v){var d=this;this.growingIO=v,this.getValidResourceItem=function(t){if(t&&r(t)&&t.id&&t.key){var n={id:e(t.id)?t.id:u(t.id),key:e(t.key)?t.key:u(t.key)};return t.attributes&&(n.attributes=t.attributes),n}},this.getDynamicAttributes=function(t){return n(t)||c(t).forEach((function(n){var e;e=t[n],o(["function","asyncfunction"],f(e))?t[n]=t[n]():r(t[n])?a(t,n):i(t[n])||(t[n]=u(t[n]))})),t},this.buildCustomEvent=function(n,i,o,u){var c,a;a=function(){var e=d.growingIO.dataStore,c=e.eventContextBuilder,a=e.eventConverter,f=e.currentPage,v=t({eventType:"CUSTOM",eventName:n,pageShowTimestamp:null==f?void 0:f.time,attributes:l(d.getDynamicAttributes(r(i)&&!s(i)?i:void 0)),resourceItem:l(d.getValidResourceItem(o))},c());s(u)||(v=t(t({},v),u)),a(v)},e(c=n)&&!s(c)&&c.match(/^[a-zA-Z_][0-9a-zA-Z_]{0,100}$/)?a():console.log("%c [GrowingIO]:事件名格式不正确,只能包含数字、字母和下划线,且不能以数字开头,字符总长度不能超过100!","color: #EF4444;")},this.buildUserAttributesEvent=function(n,e){var r=d.growingIO.dataStore,i=r.eventContextBuilder,o=r.eventConverter,u=t({eventType:"LOGIN_USER_ATTRIBUTES",attributes:l(n)},i());s(e)||(u=t(t({},u),e)),o(u)}}};export{v as default}; +var t=function(){return t=Object.assign||function(t){for(var n,e=1,r=arguments.length;r>e;e++)for(var i in n=arguments[e])({}).hasOwnProperty.call(n,i)&&(t[i]=n[i]);return t},t.apply(this,arguments)};"function"==typeof SuppressedError&&SuppressedError;var n=function(t){return o(["undefined","null"],f(t))},e=function(t){return"string"===f(t)},r=function(t){return"object"===f(t)&&!n(t)},i=function(t){return Array.isArray(t)&&"array"===f(t)},o=function(t,n){return("array"===f(t)||"string"===f(t))&&t.indexOf(n)>=0},u=function(t){return n(t)?"":"".concat(t)},c=function(t){return r(t)?Object.keys(t):[]},a=function(t,n){if(!r(t))return!1;try{return"string"===f(n)?delete t[n]:"array"===f(n)?n.map((function(n){return delete t[n]})):(function(t){return"regexp"===f(t)}(n)&&c(t).forEach((function(e){n.test(e)&&a(t,e)})),!0)}catch(t){return!1}},s=function(t){return i(t)?0===t.length:r(t)?0===c(t).length:!t},f=function(t){return{}.toString.call(t).slice(8,-1).toLowerCase()},l=function(t){var e={};return r(t)&&function(t,o){c(t).forEach((function(o){return function(t,o){var c,a=u(o).slice(0,100);r(t)?e[a]=l(t):i(t)?(e[a]=t.slice(0,100),"cdp"===(null===(c=window.vds)||void 0===c?void 0:c.gioEnvironment)&&(e[a]=e[a].join("||").slice(0,1e3))):e[a]=n(t)?"":u(t).slice(0,1e3)}(t[o],o)}))}(t),e},d={name:"gioCustomTracking",method:function(d){var v=this;this.growingIO=d,this.getValidResourceItem=function(t){if(t&&r(t)&&t.id&&t.key){var n={id:e(t.id)?t.id:u(t.id),key:e(t.key)?t.key:u(t.key)};return t.attributes&&(n.attributes=t.attributes),n}},this.getDynamicAttributes=function(t){return n(t)||c(t).forEach((function(n){var e;e=t[n],o(["function","asyncfunction"],f(e))?t[n]=t[n]():r(t[n])?a(t,n):i(t[n])||(t[n]=u(t[n]))})),t},this.buildCustomEvent=function(n,i,o,u){var c,a;a=function(){var e=v.growingIO.dataStore,c=e.eventContextBuilder,a=e.eventConverter,f=e.currentPage,d=t({eventType:"CUSTOM",eventName:n,pageShowTimestamp:null==f?void 0:f.time,attributes:l(v.getDynamicAttributes(r(i)&&!s(i)?i:void 0)),resourceItem:l(v.getValidResourceItem(o))},c());s(u)||(d=t(t({},d),u)),a(d)},e(c=n)&&!s(c)&&c.match(/^[a-zA-Z_][0-9a-zA-Z_]{0,100}$/)?a():console.log("%c [GrowingIO]:事件名格式不正确,只能包含数字、字母和下划线,且不能以数字开头,字符总长度不能超过100!","color: #EF4444;")},this.buildUserAttributesEvent=function(n,e){var r=v.growingIO.dataStore,i=r.eventContextBuilder,o=r.eventConverter,u=t({eventType:"LOGIN_USER_ATTRIBUTES",attributes:l(n)},i());s(e)||(u=t(t({},u),e)),o(u)}}};export{d as default}; diff --git a/plugins/gioEmbeddedAdapter.js b/plugins/gioEmbeddedAdapter.js index 258e3df..4084a1f 100644 --- a/plugins/gioEmbeddedAdapter.js +++ b/plugins/gioEmbeddedAdapter.js @@ -1 +1 @@ -function o(o,e,i){if(i||2===arguments.length)for(var n,t=0,r=e.length;r>t;t++)!n&&t in e||(n||(n=[].slice.call(e,0,t)),n[t]=e[t]);return o.concat(n||[].slice.call(e))}var e=function(o){return n(["undefined","null"],g(o))},i=function(o){return"object"===g(o)&&!e(o)},n=function(o,e){return("array"===g(o)||"string"===g(o))&&o.indexOf(e)>=0},t={}.hasOwnProperty,r=function(o,i){return!e(o)&&t.call(o,i)},a=function(o){return i(o)?Object.keys(o):[]},g=function(o){return{}.toString.call(o).slice(8,-1).toLowerCase()},c={},s={}.hasOwnProperty;function l(o){try{return decodeURIComponent(o.replace(/\+/g," "))}catch(o){return null}}function d(o){try{return encodeURIComponent(o)}catch(o){return null}}c.stringify=function(o,e){e=e||"";var i,n,t=[];for(n in"string"!=typeof e&&(e="?"),o)if(s.call(o,n)){if((i=o[n])||null!=i&&!isNaN(i)||(i=""),n=d(n),i=d(i),null===n||null===i)continue;t.push(n+"="+i)}return t.length?e+t.join("&"):""},c.parse=function(o){for(var e,i=/([^=?#&]+)=?([^&]*)/g,n={};e=i.exec(o);){var t=l(e[1]),r=l(e[2]);null===t||null===r||t in n||(n[t]=r)}return n};var u={gioprojectid:"projectId",giodatacollect:"dataCollect",gioappid:"domain",giodatasourceid:"dataSourceId",gios:"sessionId",giou:"uid",giocs1:"userId",gioid:"gioId",giouserkey:"userKey",gioappchannel:"appChannel",giodevicebrand:"deviceBrand",giodevicemodel:"deviceModel",giodevicetype:"deviceType",giolanguage:"language",gionetworkstate:"networkState",giooperatingsystem:"operatingSystem",gioplatform:"platform",gioplatformversion:"platformVersion",gioscreenheight:"screenHeight",gioscreenwidth:"screenWidth"},f=["giodatasourceid","gioplatform","gioappchannel","giodevicebrand","giodevicemodel","giodevicetype","giolanguage","gionetworkstate","giooperatingsystem","gioplatformversion","gioscreenheight","gioscreenwidth"],h=["giocs1","gios","giou","gioid","giouserkey"],p="gio_search_cookie_gioenc",I={name:"gioEmbeddedAdapter",method:function(e){var t=this;this.growingIO=e,this.main=function(){var o,e,s=t.growingIO.vdsConfig,l=s.projectId,d=s.appId,I=t.getGQS(),w=!1;return"none"!==t.qsFrom&&I.gioprojectid===l&&I.gioappid===d&&((function(o){return Array.isArray(o)&&"array"===g(o)}(e=I)?0!==e.length:i(e)?0!==a(e).length:e)?t.growingIO.storage.setItem(p,c.stringify(I)):t.growingIO.storage.removeItem(p),r(I,"giodatacollect")&&(t.growingIO.vdsConfig.dataCollect=n(["true",!0],I.giodatacollect)),null===(o=t.growingIO.emitter)||void 0===o||o.on("SDK_INITIALIZED",(function(){var o=t.growingIO,e=o.userStore,i=o.vdsConfig.sessionExpires,n=o.dataStore.eventContextBuilderInst;h.forEach((function(o){var i;e[u[o]]=null!==(i=I[o])&&void 0!==i?i:""})),window.setInterval((function(){e.sessionId=I.gios}),.8*i*60*1e3),f.forEach((function(o){r(I,o)&&(n.minpExtraParams[u[o]]=I[o])}))})),t.growingIO.setUserId=function(){},t.growingIO.clearUserId=function(){},r(I,"giodatacollect")&&(t.growingIO.setDataCollect=function(){},t.growingIO.setOption=function(){}),w=!0),t.gioURLRewrite(),w},this.getGQS=function(){var e=t.growingIO.vdsConfig.hashtag,i=t.growingIO.storage.getItem(p),g=window.location.search,s=window.location.hash,l=e?s.substring(s.indexOf("?")+1):"",d=c.parse(g),u=c.parse(l),I=c.parse((i||"").replace("gioenc-","")),w={};if(r(d,"gioprojectid"))w=d,t.qsFrom="search";else if(r(u,"gioprojectid"))w=u,t.qsFrom="hash";else{if(!r(I,"gioprojectid"))return t.qsFrom="none",{};w=I,t.qsFrom="cookie"}var m={},v={},y=o(o(["gioappid","gioprojectid","giodatacollect"],h,!0),f,!0);return a(w).forEach((function(o){var e=o.toLowerCase();n(y,e)?n(["","undefined","null",void 0,null],w[o])||(m[e]=w[o],n(["true","TRUE",!0],w[o])&&(m[e]=!0),n(["false","FALSE",!1],w[o])&&(m[e]=!1)):v[o]=w[o]})),t.gqs=m,t.ngqs=v,m},this.gioURLRewrite=function(){var o=t.growingIO.vdsConfig.hashtag,e=window.location.search,i=window.location.hash,n=!1;if("search"===t.qsFrom&&(e=c.stringify(t.ngqs,!0),n=!0),o&&"hash"===t.qsFrom&&(i="".concat(i.split("?")[0]).concat(c.stringify(t.ngqs,!0)),n=!0),n){var r="".concat(window.location.pathname).concat(e||"").concat(i||"");window.history.replaceState(null,document.title,r)}},this.gqs={},this.ngqs={},this.qsFrom="search",this.growingIO.emitter.on("OPTION_INITIALIZED",(function(){t.growingIO.useEmbeddedInherit=t.main()}))}};export{I as default}; +function e(e,o,i){if(i||2===arguments.length)for(var n,t=0,r=o.length;r>t;t++)!n&&t in o||(n||(n=[].slice.call(o,0,t)),n[t]=o[t]);return e.concat(n||[].slice.call(o))}"function"==typeof SuppressedError&&SuppressedError;var o=function(e){return n(["undefined","null"],g(e))},i=function(e){return"object"===g(e)&&!o(e)},n=function(e,o){return("array"===g(e)||"string"===g(e))&&e.indexOf(o)>=0},t={}.hasOwnProperty,r=function(e,i){return!o(e)&&t.call(e,i)},a=function(e){return i(e)?Object.keys(e):[]},g=function(e){return{}.toString.call(e).slice(8,-1).toLowerCase()},s={},c={}.hasOwnProperty;function l(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(e){return null}}function d(e){try{return encodeURIComponent(e)}catch(e){return null}}s.stringify=function(e,o){o=o||"";var i,n,t=[];for(n in"string"!=typeof o&&(o="?"),e)if(c.call(e,n)){if((i=e[n])||null!=i&&!isNaN(i)||(i=""),n=d(n),i=d(i),null===n||null===i)continue;t.push(n+"="+i)}return t.length?o+t.join("&"):""},s.parse=function(e){for(var o,i=/([^=?#&]+)=?([^&]*)/g,n={};o=i.exec(e);){var t=l(o[1]),r=l(o[2]);null===t||null===r||t in n||(n[t]=r)}return n};var u={gioprojectid:"projectId",giodatacollect:"dataCollect",gioappid:"domain",giodatasourceid:"dataSourceId",gios:"sessionId",giou:"uid",giocs1:"userId",gioid:"gioId",giouserkey:"userKey",gioappchannel:"appChannel",giodevicebrand:"deviceBrand",giodevicemodel:"deviceModel",giodevicetype:"deviceType",giolanguage:"language",gionetworkstate:"networkState",giooperatingsystem:"operatingSystem",gioplatform:"platform",gioplatformversion:"platformVersion",gioscreenheight:"screenHeight",gioscreenwidth:"screenWidth"},f=["giodatasourceid","gioplatform","gioappchannel","giodevicebrand","giodevicemodel","giodevicetype","giolanguage","gionetworkstate","giooperatingsystem","gioplatformversion","gioscreenheight","gioscreenwidth"],p=["giocs1","gios","giou","gioid","giouserkey"],h="gio_search_cookie_gioenc",I={name:"gioEmbeddedAdapter",method:function(o){var t=this;this.growingIO=o,this.main=function(){var e,o,c=t.growingIO.vdsConfig,l=c.projectId,d=c.appId,I=t.getGQS(),w=!1;return"none"!==t.qsFrom&&I.gioprojectid===l&&I.gioappid===d&&((function(e){return Array.isArray(e)&&"array"===g(e)}(o=I)?0!==o.length:i(o)?0!==a(o).length:o)?t.growingIO.storage.setItem(h,s.stringify(I)):t.growingIO.storage.removeItem(h),r(I,"giodatacollect")&&(t.growingIO.vdsConfig.dataCollect=n(["true",!0],I.giodatacollect)),null===(e=t.growingIO.emitter)||void 0===e||e.on("SDK_INITIALIZED",(function(){var e=t.growingIO,o=e.userStore,i=e.vdsConfig.sessionExpires,n=e.dataStore.eventContextBuilderInst;p.forEach((function(e){var i;o[u[e]]=null!==(i=I[e])&&void 0!==i?i:""})),window.setInterval((function(){o.sessionId=I.gios}),.8*i*60*1e3),f.forEach((function(e){r(I,e)&&(n.minpExtraParams[u[e]]=I[e])}))})),t.growingIO.setUserId=function(){},t.growingIO.clearUserId=function(){},r(I,"giodatacollect")&&(t.growingIO.setDataCollect=function(){},t.growingIO.setOption=function(){}),w=!0),t.gioURLRewrite(),w},this.getGQS=function(){var o=t.growingIO.vdsConfig.hashtag,i=t.growingIO.storage.getItem(h),g=window.location.search,c=window.location.hash,l=o?c.substring(c.indexOf("?")+1):"",d=s.parse(g),u=s.parse(l),I=s.parse((i||"").replace("gioenc-","")),w={};if(r(d,"gioprojectid"))w=d,t.qsFrom="search";else if(r(u,"gioprojectid"))w=u,t.qsFrom="hash";else{if(!r(I,"gioprojectid"))return t.qsFrom="none",{};w=I,t.qsFrom="cookie"}var m={},v={},y=e(e(["gioappid","gioprojectid","giodatacollect"],p,!0),f,!0);return a(w).forEach((function(e){var o=e.toLowerCase();n(y,o)?n(["","undefined","null",void 0,null],w[e])||(m[o]=w[e],n(["true","TRUE",!0],w[e])&&(m[o]=!0),n(["false","FALSE",!1],w[e])&&(m[o]=!1)):v[e]=w[e]})),t.gqs=m,t.ngqs=v,m},this.gioURLRewrite=function(){var e=t.growingIO.vdsConfig.hashtag,o=window.location.search,i=window.location.hash,n=!1;if("search"===t.qsFrom&&(o=s.stringify(t.ngqs,!0),n=!0),e&&"hash"===t.qsFrom&&(i="".concat(i.split("?")[0]).concat(s.stringify(t.ngqs,!0)),n=!0),n){var r="".concat(window.location.pathname).concat(o||"").concat(i||"");window.history.replaceState(null,document.title,r)}},this.gqs={},this.ngqs={},this.qsFrom="search",this.growingIO.emitter.on("OPTION_INITIALIZED",(function(){t.growingIO.useEmbeddedInherit=t.main()}))}};export{I as default}; diff --git a/plugins/gioEventAutoTracking.js b/plugins/gioEventAutoTracking.js index 9fd5307..9549933 100644 --- a/plugins/gioEventAutoTracking.js +++ b/plugins/gioEventAutoTracking.js @@ -1 +1 @@ -var e=function(){return e=Object.assign||function(e){for(var t,n=1,r=arguments.length;r>n;n++)for(var i in t=arguments[n])({}).hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},e.apply(this,arguments)};function t(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;o>i;i++)!r&&i in t||(r||(r=[].slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||[].slice.call(t))}location.protocol.indexOf("http")>-1&&location.protocol.replace(":","");var n=["clearUserId","getGioInfo","getLocation","getOption","init","setDataCollect","setOption","setUserId","track","setGeneralProps","clearGeneralProps"];t(t([],n,!0),["setEvar","setPage","setUser","setVisitor"],!1),t(t([],n,!0),["enableDebug","enableHT","setAutotrack","setTrackerHost","setTrackerScheme","setUserAttributes","getVisitorId","getDeviceId","registerPlugins","getPlugins","sendPage","sendVisit","trackTimerStart","trackTimerPause","trackTimerResume","trackTimerEnd","removeTimer","clearTrackTimer","updateImpression"],!1);var r,i,o,a,u,l={click:"VIEW_CLICK",change:"VIEW_CHANGE",submit:"FORM_SUBMIT"},s="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},f="function"==typeof Array.from?Array.from:(i||(i=1,o=function(e){return"function"==typeof e},a=function(e){var t=function(e){var t=Number(e);return isNaN(t)?0:0!==t&&isFinite(t)?(t>0?1:-1)*Math.floor(Math.abs(t)):t}(e);return Math.min(Math.max(t,0),9007199254740991)},u=function(e){var t=e.next();return!t.done&&t},r=function(e){var t,n,r,i=this,l=arguments.length>1?arguments[1]:void 0;if(void 0!==l){if(!o(l))throw new TypeError("Array.from: when provided, the second argument must be a function");arguments.length>2&&(t=arguments[2])}var s=function(e,t){if(null!=e&&null!=t){var n=e[t];if(null==n)return;if(!o(n))throw new TypeError(n+" is not a function");return n}}(e,function(e){if(null!=e){if(["string","number","boolean","symbol"].indexOf(typeof e)>-1)return Symbol.iterator;if("undefined"!=typeof Symbol&&"iterator"in Symbol&&Symbol.iterator in e)return Symbol.iterator;if("@@iterator"in e)return"@@iterator"}}(e));if(void 0!==s){n=o(i)?Object(new i):[];var f,c,d=s.call(e);if(null==d)throw new TypeError("Array.from requires an array-like or iterable object");for(r=0;;){if(!(f=u(d)))return n.length=r,n;c=f.value,n[r]=l?l.call(t,c,r):c,r++}}else{var h=Object(e);if(null==e)throw new TypeError("Array.from requires an array-like object - not null or undefined");var g,p=a(h.length);for(n=o(i)?Object(new i(p)):Array(p),r=0;p>r;)g=h[r],n[r]=l?l.call(t,g,r):g,r++;n.length=p}return n}),r),c=function(e){return"object"===_(e)&&!function(e){return h(["undefined","null"],_(e))}(e)},d=function(e){try{var t=g(e);return t[t.length-1]}catch(e){return}},h=function(e,t){return("array"===_(e)||"string"===_(e))&&e.indexOf(t)>=0},g=f,p=function(e,t){return"string"===_(e)&&e.slice(0,t.length)===t},v=function(e){return function(e){return Array.isArray(e)&&"array"===_(e)}(e)?0===e.length:c(e)?0===function(e){return c(e)?Object.keys(e):[]}(e).length:!e},_=function(e){return{}.toString.call(e).slice(8,-1).toLowerCase()},m=function(t,n,r,i){void 0===i&&(i={}),document.addEventListener?t.addEventListener(n,r,e(e({},{capture:!0}),i)):t.attachEvent?t.attachEvent("on"+n,r):t["on"+n]=r},T={},N={};!function(e){var t=s&&s.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;o>i;i++)!r&&i in t||(r||(r=[].slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||[].slice.call(t))};Object.defineProperty(e,"__esModule",{value:!0}),e.GROWING_TITLE_OLD=e.GROWING_TITLE=e.GROWING_GTITLE=e.GROWING_CDP_INDEX=e.GROWING_INDEX_OLD=e.GROWING_INDEX=e.GROWING_CONTAINER=e.GROWING_TRACK=e.GROWING_IGNORE=e.VALID_CLASS_SELECTOR=e.VALID_ID_SELECTOR=e.EXCLUDE_CLASS_RE=e.UNSUPPORTED_TAGS=e.TEXT_NODE=e.UNSUPPORTED_CLICK_TAGS=e.SUPPORTED_ICON_TAGS=e.SUPPORTED_CHANGE_TYPES=e.SUPPORTED_CLICK_INPUT_TYPES=e.SUPPORTED_CONTAINER_TAGS=e.LIST_TAGS=void 0,e.LIST_TAGS=["TR","LI","DL"],e.SUPPORTED_CONTAINER_TAGS=t(["A","BUTTON"],e.LIST_TAGS,!0),e.SUPPORTED_CLICK_INPUT_TYPES=["button","submit","reset"],e.SUPPORTED_CHANGE_TYPES=["radio","checkbox","search"],e.SUPPORTED_ICON_TAGS=["I","EM","svg","IMG"],e.UNSUPPORTED_CLICK_TAGS=["TEXTAREA","HTML","BODY"],e.TEXT_NODE=["I","SPAN","EM","B","STRONG"],e.UNSUPPORTED_TAGS=["tspan","text","g","rect","path","defs","clippath","desc","title","math","use"],e.EXCLUDE_CLASS_RE=/(^| |[^ ]+\-)(clear|clearfix|active|hover|enabled|current|selected|unselected|hidden|display|focus|disabled|undisabled|open|checked|unchecked|undefined|null|ng-|growing-)[^\. ]*/g,e.VALID_ID_SELECTOR=/^[a-zA-Z-\_][a-zA-Z\-\_0-9]+$/,e.VALID_CLASS_SELECTOR=/^([a-zA-Z\-\_0-9]+)$/,e.GROWING_IGNORE="data-growing-ignore",e.GROWING_TRACK="data-growing-track",e.GROWING_CONTAINER="data-growing-container",e.GROWING_INDEX="data-growing-index",e.GROWING_INDEX_OLD="data-growing-idx",e.GROWING_CDP_INDEX="data-index",e.GROWING_GTITLE="data-growing-title",e.GROWING_TITLE="data-title",e.GROWING_TITLE_OLD="growing-title"}(N);var E={},I={};Object.defineProperty(I,"__esModule",{value:!0}),I.lastFindIndex=I.findIndex=I.arrayEquals=I.rmBlank=I.normalizePath=I.splitNoEmpty=I.filterText=void 0,I.filterText=function(e,t){if(void 0===t&&(t=!0),e&&(null==(e=e.replace(/[\n \t]+/g," ").trim())?void 0:e.length))return e.slice(0,t?50:void 0)},I.splitNoEmpty=function(e,t){return e?e.split(t).filter((function(e){return!!e})):[]},I.normalizePath=function(e){var t=e.length;return t>1&&"/"===e.charAt(t-1)?e.slice(0,t-1):e},I.rmBlank=function(e){return e?e.replace(/[\n \t]+/g,""):""},I.arrayEquals=function(e,t){if(!e||!t)return!1;if(e.length!==t.length)return!1;for(var n=0,r=e.length;r>n;n++)if(e[n]!==t[n])return!1;return!0},I.findIndex=function(e,t){if(null==e||"function"!=typeof t)return-1;for(var n=0;n=0;n--){var r=e[n];if(t.call(void 0,r))return n}return-1},function(e){var t=s&&s.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;o>i;i++)!r&&i in t||(r||(r=[].slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||[].slice.call(t))},n=s&&s.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.removeDiffTagOnHeadAndTail=e.computeXpath=e.getMarkIndex=e.getEffectiveNode=e.isIgnore=e.depthInside=e.changeableInput=e.clickableInput=e.onlyContainsTextChildren=e.onlyContainsIconChildren=e.supportIconTag=e.isContainerTag=e.isListTag=e.isParentOfLeaf=e.isLeaf=e.getChildren=e.getDeepChildren=e.findParent=e.isRootNode=e.hasValidAttribute=void 0;var r=I,i=N,o=n(f);e.hasValidAttribute=function(e,t){return e instanceof Element&&e.hasAttribute(t)&&"false"!==e.getAttribute(t)},e.isRootNode=function(e){return!e||-1!==["BODY","HTML","#document"].indexOf(e.nodeName)},e.findParent=function(t,n){for(var r=t.parentNode;r&&!(0,e.isRootNode)(r);){if(n(r))return r;r=r.parentNode}},e.getDeepChildren=function(n){return(0,o.default)((null==n?void 0:n.childNodes)||[]).reduce((function(n,r){return r instanceof Element?t(t(t([],n,!0),[r],!1),(0,e.getDeepChildren)(r),!0):n}),[])},e.getChildren=function(e){return(0,o.default)((null==e?void 0:e.childNodes)||[]).filter((function(e){return e instanceof Element}))},e.isLeaf=function(t){return!t.hasChildNodes()||"svg"===t.nodeName||0===(0,e.getChildren)(t).length},e.isParentOfLeaf=function(t){return!(!t.hasChildNodes()||"svg"===t.nodeName)&&0===(0,o.default)(t.childNodes).filter((function(t){return!(0,e.isLeaf)(t)})).length},e.isListTag=function(e){return-1!==i.LIST_TAGS.indexOf(e.nodeName)},e.isContainerTag=function(t){return(0,e.hasValidAttribute)(t,i.GROWING_CONTAINER)||-1!==i.SUPPORTED_CONTAINER_TAGS.indexOf(t.nodeName)},e.supportIconTag=function(e){var t=e.nodeName;return-1!==i.SUPPORTED_ICON_TAGS.indexOf(t)},e.onlyContainsIconChildren=function(t){if(t.textContent)return!1;var n=(0,e.getChildren)(t);if(0===n.length)return!1;for(var r=0,i=n;rn)return!1;for(var i="svg"===t.tagName?[]:(0,e.getChildren)(t),o=0;o=r},e.isIgnore=function(t){if(!(t instanceof Element)||(0,e.hasValidAttribute)(t,i.GROWING_IGNORE))return!0;for(var n=t.parentNode;n&&!(0,e.isRootNode)(n);){if((0,e.hasValidAttribute)(n,i.GROWING_IGNORE))return!0;n=n.parentNode}return!1},e.getEffectiveNode=function(t){for(var n,r;t&&(r=void 0,!((n=t)instanceof Element&&-1===i.UNSUPPORTED_TAGS.indexOf(null===(r=n.tagName)||void 0===r?void 0:r.toLowerCase())))&&t.parentNode;)t=t.parentNode;var o,a=t.parentNode;return!(0,e.isRootNode)(a)&&((0,e.onlyContainsIconChildren)(a)||"BUTTON"===(o=a).tagName&&(0,e.onlyContainsTextChildren)(o))?a:t},e.getMarkIndex=function(e){if(e instanceof Element){var t=e.getAttribute(i.GROWING_INDEX)||e.getAttribute(i.GROWING_INDEX_OLD)||e.getAttribute(i.GROWING_CDP_INDEX);if(t){if(/^\d{1,10}$/.test(t)&&+t>=0&&2147483647>+t)return+t;window.console.error("[GioNode]:标记的index不符合规范(index必须是大于等于0且小于2147483647的整数字)。",t)}}},e.computeXpath=function(e){for(var t=e.parentPaths(!0),n=Math.min(t.length,+(t.length>=10)+4),r=["","",""],i=0;ii&&(r[1]=o+r[1])}return r},e.removeDiffTagOnHeadAndTail=function(e,t){var n=function(e){return e.nodeName===t.nodeName},i=(0,r.findIndex)(e,n),o=(0,r.lastFindIndex)(e,n);return-1===i||-1===o?[]:e.slice(i,o+1)}}(E);var O={},b={};Object.defineProperty(b,"__esModule",{value:!0});var y=N,C=I,A=E;function P(e){var t;if(e instanceof Element){var n=e.getAttribute("name");if(n)return[n];if(e.hasAttribute("class")){var r=null===(t=e.getAttribute("class"))||void 0===t?void 0:t.replace(y.EXCLUDE_CLASS_RE,"").trim();if(null==r?void 0:r.length)return r.split(/\s+/).filter((function(e){return y.VALID_CLASS_SELECTOR.test(e)&&!e.match(/[a-z][A-Z][a-z][A-Z]/)&&!e.match(/[0-9][0-9][0-9][0-9]/)})).sort()}}return[]}var x=function(){function e(e){var t;this.node=e,this.tagName=this.node.nodeName,this.name=this.tagName.toLowerCase(),this.id=(t=this.node).id&&y.VALID_ID_SELECTOR.test(t.id)?t.id:null,this.classList=P(this.node),this.guessListAndIndex()}return e.prototype.guessListAndIndex=function(){var e,t=this;this._tagList=(0,A.isListTag)(this.node);var n=(0,A.removeDiffTagOnHeadAndTail)((0,A.getChildren)(this.node.parentNode),this.node);if(this._tagList&&-1!==(o=n.filter((function(e){return e.tagName===t.tagName})).indexOf(this.node))&&(this._index=o+1),n.length>=3&&(null===(e=this.classList)||void 0===e?void 0:e.length)){for(var r=0,i=0,o=1;o<=n.length;o++){var a=n[o-1];if(a.tagName!==this.tagName){i=0;break}(0,C.arrayEquals)(this.classList,P(a))&&(i+=1),this.node===a&&(r=o)}3>i||(this._pseudoList=!0,this._index=this._index||r)}},Object.defineProperty(e.prototype,"path",{get:function(){var e;return this._path||(this._path="/".concat(this.name),this.id&&(this._path+="#".concat(this.id)),(null===(e=this.classList)||void 0===e?void 0:e.length)&&(this._path+=".".concat(this.classList.join(".")))),this._path},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pseudoList",{get:function(){return!!this._pseudoList},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"list",{get:function(){return!!this._tagList||!!this._pseudoList},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"index",{get:function(){var e;return null!==(e=(0,A.getMarkIndex)(this.node))&&void 0!==e?e:this._index},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"container",{get:function(){return(0,A.isContainerTag)(this.node)||this.list},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"parent",{get:function(){return this.node.parentNode?new e(this.node.parentNode):null},enumerable:!1,configurable:!0}),e.prototype.parentPaths=function(e){void 0===e&&(e=!1);for(var t=e?[this]:[],n=this.parent;n&&!(0,A.isRootNode)(n.node);)t.push(n),n=n.parent;return t},e}();b.default=x;var L={};Object.defineProperty(L,"__esModule",{value:!0}),L.getElementHref=L.getImgHref=L.getAnchorHref=void 0;var G=I;function S(e){if(e.hasAttribute("href")){var t=e.getAttribute("href");if(t&&0!==t.indexOf("javascript"))return(0,G.normalizePath)(t.slice(0,320))}}function R(e){if(e.src&&-1===e.src.indexOf("data:image"))return e.src}L.getAnchorHref=S,L.getImgHref=R,L.getElementHref=function(e){var t=e;if(t)switch(e.nodeName.toLowerCase()){case"a":return S(t);case"img":return R(t)}};var D={},w=s&&s.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(D,"__esModule",{value:!0}),D.getElementContent=D.getFormContent=void 0;var k=E,U=L,j=N,M=w(b),W=I,X=w(f),H=function(e){return e.htmlFor||e.getAttribute("for")},V=function(e){var t=e.getAttribute(j.GROWING_GTITLE)||e.getAttribute(j.GROWING_TITLE)||e.getAttribute(j.GROWING_TITLE_OLD)||e.getAttribute("title");return null==t?void 0:t.trim()};function B(e){var t=e.node;return e.list?K(t):(0,W.filterText)(t.textContent)||void 0}function K(e){for(var t=void 0,n=!1,r=0,i=(0,X.default)(e.childNodes);r-1?n.slice(0,r):n}}(t);case"svg":return function(e){for(var t=0,n=(0,X.default)(e.childNodes);t0)return n[n.length-1]}}(t);case"label":return B(a);case"input":return function(e){if((0,k.clickableInput)(e))return e.value;if("password"!==e.type&&(0,k.hasValidAttribute)(e,j.GROWING_TRACK))return e.value;if((0,k.changeableInput)(e)){var t=(0,k.findParent)(e,(function(e){return"LABEL"===e.nodeName}));if(!t&&e.id)for(var n=document.body.getElementsByTagName("label"),r=0;r0)return o+" ("+e.checked+")"}return e.value}}(t);case"select":return r=t,(0,X.default)(r.options).filter((function(e){return e.selected})).map((function(e){return e.label})).join(", ")||r.value;case"form":return z(t)}return(0,k.isLeaf)(t)?function(e){var t=(0,W.filterText)(e.textContent);if(t)return t}(t):(0,k.isParentOfLeaf)(t)&&!(0,k.onlyContainsIconChildren)(t)?function(e){for(var t="",n=0,r=(0,X.default)(e.childNodes);nn;n++)for(var i in t=arguments[n])({}).hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},ne.apply(this,arguments)},re=s&&s.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(T,"__esModule",{value:!0});var ie=N,oe=E,ae=re(O),ue=function(){function e(e,t,n){void 0===t&&(t=null),void 0===n&&(n=!0),this.origin=e,this.action=t,this.direct=n,this.target="self"===t?e:(0,oe.getEffectiveNode)(e),this.ignore=(0,oe.isIgnore)(this.target),this.vnode=new ae.default(this.target),this.tagName=this.vnode.tagName}return Object.defineProperty(e.prototype,"content",{get:function(){return this.vnode.content},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"href",{get:function(){return this.vnode.href},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"index",{get:function(){return this.vnode.index},enumerable:!1,configurable:!0}),e.prototype.inferParentIndex=function(){var t=this;return this.parentIndex||(0,oe.findParent)(this.target,(function(n){var r=new e(n,t.action,!1);r.traceable()&&r.index&&(t.parentIndex=r.index)})),this.parentIndex},Object.defineProperty(e.prototype,"xpath",{get:function(){return this.vnode.xpath},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fullXpath",{get:function(){return this.vnode.fullXpath},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"skeleton",{get:function(){return this.vnode.skeleton},enumerable:!1,configurable:!0}),e.prototype.info=function(e){return void 0===e&&(e=!0),e&&this.inferParentIndex(),{skeleton:this.skeleton,fullXpath:this.fullXpath,xpath:this.xpath,content:this.content,href:this.href,index:this.parentIndex||this.index}},e.prototype.traceable=function(){if(this.ignore)return!1;if(this.direct){if("click"===this.action||"hover"===this.action){if(-1!==ie.UNSUPPORTED_CLICK_TAGS.indexOf(this.target.tagName))return!1;if("INPUT"===this.target.tagName&&!(0,oe.clickableInput)(this.target))return!1;if(!(0,oe.isContainerTag)(this.target)&&!(0,oe.depthInside)(this.target,5))return!1}return!0}return this.vnode.container},e.prototype.trackNodes=function(){if(!this.traceable())return[];var e=[this];if("submit"!==this.action)for(var t=this.parentElement;t;){if(t.ignore)return[];t.traceable()&&e.unshift(t),t=t.parentElement}var n=void 0;return e.map((function(e){var t=e.info(!1),r=t.index;return!n&&r&&(n=r),ne(ne({},t),{index:n||r})}))},Object.defineProperty(e.prototype,"parentElement",{get:function(){var t=this.target.parentNode;if(t&&t.nodeName&&!(0,oe.isRootNode)(t))return new e(t,this.action,!1)},enumerable:!1,configurable:!0}),e}(),le=T.default=ue,se=function(){function e(e){this.handler=e;var t=navigator.userAgent,n=/chrome/i.exec(t),r=/android/i.exec(t);this.hasTouch="ontouchstart"in window&&!(n&&!r)}return e.prototype.main=function(){for(var e=this.hasTouch?["touchstart"]:["mousedown"],t=this.hasTouch?["touchend","touchcancel"]:["mouseup","mouseleave"],n=this.hasTouch?["touchmove"]:["mousemove"],r=0,i=e;i.length>r;r++)m(window,i[r],this.touchStartHandler.bind(this));for(var o=0,a=n;a.length>o;o++)m(window,a[o],this.touchMoveHandler.bind(this));for(var u=0,l=t;l.length>u;u++)m(window,l[u],this.touchStopHandler.bind(this))},e.prototype.touchStartHandler=function(e){if(1>=e.which){var t=+Date.now();this.safeguard!==t&&(this.touchTimeout&&clearTimeout(this.touchTimeout),this.safeguard=t,this.touchEvent={time:t,target:e.target,x:this._page("x",e),y:this._page("y",e),isTrusted:!0,type:"click"})}},e.prototype.touchMoveHandler=function(e){var t=Math.abs(this._page("x",e)-(this.touchEvent&&this.touchEvent.x)||0),n=Math.abs(this._page("y",e)-(this.touchEvent&&this.touchEvent.y)||0);(t>10||n>10)&&(this.touchEvent=null)},e.prototype.touchStopHandler=function(e){var t=this,n=+Date.now()-(this.touchEvent&&this.touchEvent.time)||0;this.touchEvent&&200>n?this.touchTimeout=setTimeout((function(){t.handler(t.touchEvent),t.touchEvent=null}),200):this.touchEvent&&n>=200&&700>n&&(this.handler(this.touchEvent),this.touchEvent=null)},e.prototype._page=function(e,t){return(this.hasTouch?t.touches[0]:t)["page".concat(e.toUpperCase())]},e}(),fe={name:"gioEventAutoTracking",method:function(t){var n=this;this.growingIO=t,this.main=function(){m(document,"submit",n._handleAction),m(document,"change",n._handleAction),n.growingIO.vdsConfig.touch?new se(n._handleAction).main():m(document,"click",n._handleAction)},this._handleAction=function(t,r){var i=n.growingIO,o=i.vdsConfig,a=i.emitter;if(!o.autotrack)return!1;var u=t.target;if(!u)return!1;var s=new le(u,t.type,!0).trackNodes();if("click"!==t.type&&(s=v(d(s))?[]:[d(s)]),v(s))return!1;null==a||a.emit("onComposeBefore",{event:r,params:null!=t?t:{}}),s.forEach((function(r){var i=r.fullXpath,a=r.index,u=r.content,s=r.href;if(!p(r.fullXpath||"","/div#__vconsole")&&!p(r.fullXpath||"","/div#__giokit")&&(o.debug&&console.log("Action:",t.type,Date.now()),i)){var f=n.growingIO.dataStore,c=f.eventContextBuilder,d=f.eventConverter,h=f.currentPage;d(e(e({eventType:l[t.type],element:[{xpath:i,index:a,textValue:u,hyperlink:s}]},c()),{pageShowTimestamp:h.time}))}}))}}};export{fe as default}; +var e=function(){return e=Object.assign||function(e){for(var t,n=1,r=arguments.length;r>n;n++)for(var i in t=arguments[n])({}).hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},e.apply(this,arguments)};function t(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;o>i;i++)!r&&i in t||(r||(r=[].slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||[].slice.call(t))}"function"==typeof SuppressedError&&SuppressedError,location.protocol.indexOf("http")>-1&&location.protocol.replace(":","");var n=["clearUserId","getGioInfo","getLocation","getOption","init","setDataCollect","setOption","setUserId","track","setGeneralProps","clearGeneralProps"];t(t([],n,!0),["setEvar","setPage","setUser","setVisitor"],!1),t(t([],n,!0),["enableDebug","enableHT","setAutotrack","setTrackerHost","setTrackerScheme","setUserAttributes","getVisitorId","getDeviceId","registerPlugins","getPlugins","sendPage","sendVisit","trackTimerStart","trackTimerPause","trackTimerResume","trackTimerEnd","removeTimer","clearTrackTimer","updateImpression"],!1);var r,i,o,a,u,l={click:"VIEW_CLICK",change:"VIEW_CHANGE",submit:"FORM_SUBMIT"},s="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},f="function"==typeof Array.from?Array.from:(i||(i=1,o=function(e){return"function"==typeof e},a=function(e){var t=function(e){var t=Number(e);return isNaN(t)?0:0!==t&&isFinite(t)?(t>0?1:-1)*Math.floor(Math.abs(t)):t}(e);return Math.min(Math.max(t,0),9007199254740991)},u=function(e){var t=e.next();return!t.done&&t},r=function(e){var t,n,r,i=this,l=arguments.length>1?arguments[1]:void 0;if(void 0!==l){if(!o(l))throw new TypeError("Array.from: when provided, the second argument must be a function");arguments.length>2&&(t=arguments[2])}var s=function(e,t){if(null!=e&&null!=t){var n=e[t];if(null==n)return;if(!o(n))throw new TypeError(n+" is not a function");return n}}(e,function(e){if(null!=e){if(["string","number","boolean","symbol"].indexOf(typeof e)>-1)return Symbol.iterator;if("undefined"!=typeof Symbol&&"iterator"in Symbol&&Symbol.iterator in e)return Symbol.iterator;if("@@iterator"in e)return"@@iterator"}}(e));if(void 0!==s){n=o(i)?Object(new i):[];var f,c,d=s.call(e);if(null==d)throw new TypeError("Array.from requires an array-like or iterable object");for(r=0;;){if(!(f=u(d)))return n.length=r,n;c=f.value,n[r]=l?l.call(t,c,r):c,r++}}else{var h=Object(e);if(null==e)throw new TypeError("Array.from requires an array-like object - not null or undefined");var g,p=a(h.length);for(n=o(i)?Object(new i(p)):Array(p),r=0;p>r;)g=h[r],n[r]=l?l.call(t,g,r):g,r++;n.length=p}return n}),r),c=function(e){return"object"===_(e)&&!function(e){return h(["undefined","null"],_(e))}(e)},d=function(e){try{var t=g(e);return t[t.length-1]}catch(e){return}},h=function(e,t){return("array"===_(e)||"string"===_(e))&&e.indexOf(t)>=0},g=f,p=function(e,t){return"string"===_(e)&&e.slice(0,t.length)===t},v=function(e){return function(e){return Array.isArray(e)&&"array"===_(e)}(e)?0===e.length:c(e)?0===function(e){return c(e)?Object.keys(e):[]}(e).length:!e},_=function(e){return{}.toString.call(e).slice(8,-1).toLowerCase()},m=function(t,n,r,i){void 0===i&&(i={}),document.addEventListener?t.addEventListener(n,r,e(e({},{capture:!0}),i)):t.attachEvent?t.attachEvent("on"+n,r):t["on"+n]=r},T={},N={};!function(e){var t=s&&s.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;o>i;i++)!r&&i in t||(r||(r=[].slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||[].slice.call(t))};Object.defineProperty(e,"__esModule",{value:!0}),e.GROWING_TITLE_OLD=e.GROWING_TITLE=e.GROWING_GTITLE=e.GROWING_CDP_INDEX=e.GROWING_INDEX_OLD=e.GROWING_INDEX=e.GROWING_CONTAINER=e.GROWING_TRACK=e.GROWING_IGNORE=e.VALID_CLASS_SELECTOR=e.VALID_ID_SELECTOR=e.EXCLUDE_CLASS_RE=e.UNSUPPORTED_TAGS=e.TEXT_NODE=e.UNSUPPORTED_CLICK_TAGS=e.SUPPORTED_ICON_TAGS=e.SUPPORTED_CHANGE_TYPES=e.SUPPORTED_CLICK_INPUT_TYPES=e.SUPPORTED_CONTAINER_TAGS=e.LIST_TAGS=void 0,e.LIST_TAGS=["TR","LI","DL"],e.SUPPORTED_CONTAINER_TAGS=t(["A","BUTTON"],e.LIST_TAGS,!0),e.SUPPORTED_CLICK_INPUT_TYPES=["button","submit","reset"],e.SUPPORTED_CHANGE_TYPES=["radio","checkbox","search"],e.SUPPORTED_ICON_TAGS=["I","EM","svg","IMG"],e.UNSUPPORTED_CLICK_TAGS=["TEXTAREA","HTML","BODY"],e.TEXT_NODE=["I","SPAN","EM","B","STRONG"],e.UNSUPPORTED_TAGS=["tspan","text","g","rect","path","defs","clippath","desc","title","math","use"],e.EXCLUDE_CLASS_RE=/(^| |[^ ]+\-)(clear|clearfix|active|hover|enabled|current|selected|unselected|hidden|display|focus|disabled|undisabled|open|checked|unchecked|undefined|null|ng-|growing-)[^\. ]*/g,e.VALID_ID_SELECTOR=/^[a-zA-Z-\_][a-zA-Z\-\_0-9]+$/,e.VALID_CLASS_SELECTOR=/^([a-zA-Z\-\_0-9]+)$/,e.GROWING_IGNORE="data-growing-ignore",e.GROWING_TRACK="data-growing-track",e.GROWING_CONTAINER="data-growing-container",e.GROWING_INDEX="data-growing-index",e.GROWING_INDEX_OLD="data-growing-idx",e.GROWING_CDP_INDEX="data-index",e.GROWING_GTITLE="data-growing-title",e.GROWING_TITLE="data-title",e.GROWING_TITLE_OLD="growing-title"}(N);var E={},I={};Object.defineProperty(I,"__esModule",{value:!0}),I.lastFindIndex=I.findIndex=I.arrayEquals=I.rmBlank=I.normalizePath=I.splitNoEmpty=I.filterText=void 0,I.filterText=function(e,t){if(void 0===t&&(t=!0),e&&(null==(e=e.replace(/[\n \t]+/g," ").trim())?void 0:e.length))return e.slice(0,t?50:void 0)},I.splitNoEmpty=function(e,t){return e?e.split(t).filter((function(e){return!!e})):[]},I.normalizePath=function(e){var t=e.length;return t>1&&"/"===e.charAt(t-1)?e.slice(0,t-1):e},I.rmBlank=function(e){return e?e.replace(/[\n \t]+/g,""):""},I.arrayEquals=function(e,t){if(!e||!t)return!1;if(e.length!==t.length)return!1;for(var n=0,r=e.length;r>n;n++)if(e[n]!==t[n])return!1;return!0},I.findIndex=function(e,t){if(null==e||"function"!=typeof t)return-1;for(var n=0;n=0;n--){var r=e[n];if(t.call(void 0,r))return n}return-1},function(e){var t=s&&s.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;o>i;i++)!r&&i in t||(r||(r=[].slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||[].slice.call(t))},n=s&&s.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.removeDiffTagOnHeadAndTail=e.computeXpath=e.getMarkIndex=e.getEffectiveNode=e.isIgnore=e.depthInside=e.changeableInput=e.clickableInput=e.onlyContainsTextChildren=e.onlyContainsIconChildren=e.supportIconTag=e.isContainerTag=e.isListTag=e.isParentOfLeaf=e.isLeaf=e.getChildren=e.getDeepChildren=e.findParent=e.isRootNode=e.hasValidAttribute=void 0;var r=I,i=N,o=n(f);e.hasValidAttribute=function(e,t){return e instanceof Element&&e.hasAttribute(t)&&"false"!==e.getAttribute(t)},e.isRootNode=function(e){return!e||-1!==["BODY","HTML","#document"].indexOf(e.nodeName)},e.findParent=function(t,n){for(var r=t.parentNode;r&&!(0,e.isRootNode)(r);){if(n(r))return r;r=r.parentNode}},e.getDeepChildren=function(n){return(0,o.default)((null==n?void 0:n.childNodes)||[]).reduce((function(n,r){return r instanceof Element?t(t(t([],n,!0),[r],!1),(0,e.getDeepChildren)(r),!0):n}),[])},e.getChildren=function(e){return(0,o.default)((null==e?void 0:e.childNodes)||[]).filter((function(e){return e instanceof Element}))},e.isLeaf=function(t){return!t.hasChildNodes()||"svg"===t.nodeName||0===(0,e.getChildren)(t).length},e.isParentOfLeaf=function(t){return!(!t.hasChildNodes()||"svg"===t.nodeName)&&0===(0,o.default)(t.childNodes).filter((function(t){return!(0,e.isLeaf)(t)})).length},e.isListTag=function(e){return-1!==i.LIST_TAGS.indexOf(e.nodeName)},e.isContainerTag=function(t){return(0,e.hasValidAttribute)(t,i.GROWING_CONTAINER)||-1!==i.SUPPORTED_CONTAINER_TAGS.indexOf(t.nodeName)},e.supportIconTag=function(e){var t=e.nodeName;return-1!==i.SUPPORTED_ICON_TAGS.indexOf(t)},e.onlyContainsIconChildren=function(t){if(t.textContent)return!1;var n=(0,e.getChildren)(t);if(0===n.length)return!1;for(var r=0,i=n;rn)return!1;for(var i="svg"===t.tagName?[]:(0,e.getChildren)(t),o=0;o=r},e.isIgnore=function(t){if(!(t instanceof Element)||(0,e.hasValidAttribute)(t,i.GROWING_IGNORE))return!0;for(var n=t.parentNode;n&&!(0,e.isRootNode)(n);){if((0,e.hasValidAttribute)(n,i.GROWING_IGNORE))return!0;n=n.parentNode}return!1},e.getEffectiveNode=function(t){for(var n,r;t&&(r=void 0,!((n=t)instanceof Element&&-1===i.UNSUPPORTED_TAGS.indexOf(null===(r=n.tagName)||void 0===r?void 0:r.toLowerCase())))&&t.parentNode;)t=t.parentNode;var o,a=t.parentNode;return!(0,e.isRootNode)(a)&&((0,e.onlyContainsIconChildren)(a)||"BUTTON"===(o=a).tagName&&(0,e.onlyContainsTextChildren)(o))?a:t},e.getMarkIndex=function(e){if(e instanceof Element){var t=e.getAttribute(i.GROWING_INDEX)||e.getAttribute(i.GROWING_INDEX_OLD)||e.getAttribute(i.GROWING_CDP_INDEX);if(t){if(/^\d{1,10}$/.test(t)&&+t>=0&&2147483647>+t)return+t;window.console.error("[GioNode]:标记的index不符合规范(index必须是大于等于0且小于2147483647的整数字)。",t)}}},e.computeXpath=function(e){for(var t=e.parentPaths(!0),n=Math.min(t.length,+(t.length>=10)+4),r=["","",""],i=0;ii&&(r[1]=o+r[1])}return r},e.removeDiffTagOnHeadAndTail=function(e,t){var n=function(e){return e.nodeName===t.nodeName},i=(0,r.findIndex)(e,n),o=(0,r.lastFindIndex)(e,n);return-1===i||-1===o?[]:e.slice(i,o+1)}}(E);var O={},b={};Object.defineProperty(b,"__esModule",{value:!0});var y=N,C=I,A=E;function P(e){var t;if(e instanceof Element){var n=e.getAttribute("name");if(n)return[n];if(e.hasAttribute("class")){var r=null===(t=e.getAttribute("class"))||void 0===t?void 0:t.replace(y.EXCLUDE_CLASS_RE,"").trim();if(null==r?void 0:r.length)return r.split(/\s+/).filter((function(e){return y.VALID_CLASS_SELECTOR.test(e)&&!e.match(/[a-z][A-Z][a-z][A-Z]/)&&!e.match(/[0-9][0-9][0-9][0-9]/)})).sort()}}return[]}var x=function(){function e(e){var t;this.node=e,this.tagName=this.node.nodeName,this.name=this.tagName.toLowerCase(),this.id=(t=this.node).id&&y.VALID_ID_SELECTOR.test(t.id)?t.id:null,this.classList=P(this.node),this.guessListAndIndex()}return e.prototype.guessListAndIndex=function(){var e,t=this;this._tagList=(0,A.isListTag)(this.node);var n=(0,A.removeDiffTagOnHeadAndTail)((0,A.getChildren)(this.node.parentNode),this.node);if(this._tagList&&-1!==(o=n.filter((function(e){return e.tagName===t.tagName})).indexOf(this.node))&&(this._index=o+1),n.length>=3&&(null===(e=this.classList)||void 0===e?void 0:e.length)){for(var r=0,i=0,o=1;o<=n.length;o++){var a=n[o-1];if(a.tagName!==this.tagName){i=0;break}(0,C.arrayEquals)(this.classList,P(a))&&(i+=1),this.node===a&&(r=o)}3>i||(this._pseudoList=!0,this._index=this._index||r)}},Object.defineProperty(e.prototype,"path",{get:function(){var e;return this._path||(this._path="/".concat(this.name),this.id&&(this._path+="#".concat(this.id)),(null===(e=this.classList)||void 0===e?void 0:e.length)&&(this._path+=".".concat(this.classList.join(".")))),this._path},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pseudoList",{get:function(){return!!this._pseudoList},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"list",{get:function(){return!!this._tagList||!!this._pseudoList},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"index",{get:function(){var e;return null!==(e=(0,A.getMarkIndex)(this.node))&&void 0!==e?e:this._index},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"container",{get:function(){return(0,A.isContainerTag)(this.node)||this.list},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"parent",{get:function(){return this.node.parentNode?new e(this.node.parentNode):null},enumerable:!1,configurable:!0}),e.prototype.parentPaths=function(e){void 0===e&&(e=!1);for(var t=e?[this]:[],n=this.parent;n&&!(0,A.isRootNode)(n.node);)t.push(n),n=n.parent;return t},e}();b.default=x;var L={};Object.defineProperty(L,"__esModule",{value:!0}),L.getElementHref=L.getImgHref=L.getAnchorHref=void 0;var G=I;function S(e){if(e.hasAttribute("href")){var t=e.getAttribute("href");if(t&&0!==t.indexOf("javascript"))return(0,G.normalizePath)(t.slice(0,320))}}function R(e){if(e.src&&-1===e.src.indexOf("data:image"))return e.src}L.getAnchorHref=S,L.getImgHref=R,L.getElementHref=function(e){var t=e;if(t)switch(e.nodeName.toLowerCase()){case"a":return S(t);case"img":return R(t)}};var D={},w=s&&s.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(D,"__esModule",{value:!0}),D.getElementContent=D.getFormContent=void 0;var k=E,U=L,j=N,M=w(b),W=I,X=w(f),H=function(e){return e.htmlFor||e.getAttribute("for")},V=function(e){var t=e.getAttribute(j.GROWING_GTITLE)||e.getAttribute(j.GROWING_TITLE)||e.getAttribute(j.GROWING_TITLE_OLD)||e.getAttribute("title");return null==t?void 0:t.trim()};function B(e){var t=e.node;return e.list?K(t):(0,W.filterText)(t.textContent)||void 0}function K(e){for(var t=void 0,n=!1,r=0,i=(0,X.default)(e.childNodes);r-1?n.slice(0,r):n}}(t);case"svg":return function(e){for(var t=0,n=(0,X.default)(e.childNodes);t0)return n[n.length-1]}}(t);case"label":return B(a);case"input":return function(e){if((0,k.clickableInput)(e))return e.value;if("password"!==e.type&&(0,k.hasValidAttribute)(e,j.GROWING_TRACK))return e.value;if((0,k.changeableInput)(e)){var t=(0,k.findParent)(e,(function(e){return"LABEL"===e.nodeName}));if(!t&&e.id)for(var n=document.body.getElementsByTagName("label"),r=0;r0)return o+" ("+e.checked+")"}return e.value}}(t);case"select":return r=t,(0,X.default)(r.options).filter((function(e){return e.selected})).map((function(e){return e.label})).join(", ")||r.value;case"form":return z(t)}return(0,k.isLeaf)(t)?function(e){var t=(0,W.filterText)(e.textContent);if(t)return t}(t):(0,k.isParentOfLeaf)(t)&&!(0,k.onlyContainsIconChildren)(t)?function(e){for(var t="",n=0,r=(0,X.default)(e.childNodes);nn;n++)for(var i in t=arguments[n])({}).hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},ne.apply(this,arguments)},re=s&&s.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(T,"__esModule",{value:!0});var ie=N,oe=E,ae=re(O),ue=function(){function e(e,t,n){void 0===t&&(t=null),void 0===n&&(n=!0),this.origin=e,this.action=t,this.direct=n,this.target="self"===t?e:(0,oe.getEffectiveNode)(e),this.ignore=(0,oe.isIgnore)(this.target),this.vnode=new ae.default(this.target),this.tagName=this.vnode.tagName}return Object.defineProperty(e.prototype,"content",{get:function(){return this.vnode.content},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"href",{get:function(){return this.vnode.href},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"index",{get:function(){return this.vnode.index},enumerable:!1,configurable:!0}),e.prototype.inferParentIndex=function(){var t=this;return this.parentIndex||(0,oe.findParent)(this.target,(function(n){var r=new e(n,t.action,!1);r.traceable()&&r.index&&(t.parentIndex=r.index)})),this.parentIndex},Object.defineProperty(e.prototype,"xpath",{get:function(){return this.vnode.xpath},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fullXpath",{get:function(){return this.vnode.fullXpath},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"skeleton",{get:function(){return this.vnode.skeleton},enumerable:!1,configurable:!0}),e.prototype.info=function(e){return void 0===e&&(e=!0),e&&this.inferParentIndex(),{skeleton:this.skeleton,fullXpath:this.fullXpath,xpath:this.xpath,content:this.content,href:this.href,index:this.parentIndex||this.index}},e.prototype.traceable=function(){if(this.ignore)return!1;if(this.direct){if("click"===this.action||"hover"===this.action){if(-1!==ie.UNSUPPORTED_CLICK_TAGS.indexOf(this.target.tagName))return!1;if("INPUT"===this.target.tagName&&!(0,oe.clickableInput)(this.target))return!1;if(!(0,oe.isContainerTag)(this.target)&&!(0,oe.depthInside)(this.target,5))return!1}return!0}return this.vnode.container},e.prototype.trackNodes=function(){if(!this.traceable())return[];var e=[this];if("submit"!==this.action)for(var t=this.parentElement;t;){if(t.ignore)return[];t.traceable()&&e.unshift(t),t=t.parentElement}var n=void 0;return e.map((function(e){var t=e.info(!1),r=t.index;return!n&&r&&(n=r),ne(ne({},t),{index:n||r})}))},Object.defineProperty(e.prototype,"parentElement",{get:function(){var t=this.target.parentNode;if(t&&t.nodeName&&!(0,oe.isRootNode)(t))return new e(t,this.action,!1)},enumerable:!1,configurable:!0}),e}(),le=T.default=ue,se=function(){function e(e){this.handler=e;var t=navigator.userAgent,n=/chrome/i.exec(t),r=/android/i.exec(t);this.hasTouch="ontouchstart"in window&&!(n&&!r)}return e.prototype.main=function(){for(var e=this.hasTouch?["touchstart"]:["mousedown"],t=this.hasTouch?["touchend","touchcancel"]:["mouseup","mouseleave"],n=this.hasTouch?["touchmove"]:["mousemove"],r=0,i=e;i.length>r;r++)m(window,i[r],this.touchStartHandler.bind(this));for(var o=0,a=n;a.length>o;o++)m(window,a[o],this.touchMoveHandler.bind(this));for(var u=0,l=t;l.length>u;u++)m(window,l[u],this.touchStopHandler.bind(this))},e.prototype.touchStartHandler=function(e){if(1>=e.which){var t=+Date.now();this.safeguard!==t&&(this.touchTimeout&&clearTimeout(this.touchTimeout),this.safeguard=t,this.touchEvent={time:t,target:e.target,x:this._page("x",e),y:this._page("y",e),isTrusted:!0,type:"click"})}},e.prototype.touchMoveHandler=function(e){var t=Math.abs(this._page("x",e)-(this.touchEvent&&this.touchEvent.x)||0),n=Math.abs(this._page("y",e)-(this.touchEvent&&this.touchEvent.y)||0);(t>10||n>10)&&(this.touchEvent=null)},e.prototype.touchStopHandler=function(e){var t=this,n=+Date.now()-(this.touchEvent&&this.touchEvent.time)||0;this.touchEvent&&200>n?this.touchTimeout=setTimeout((function(){t.handler(t.touchEvent),t.touchEvent=null}),200):this.touchEvent&&n>=200&&700>n&&(this.handler(this.touchEvent),this.touchEvent=null)},e.prototype._page=function(e,t){return(this.hasTouch?t.touches[0]:t)["page".concat(e.toUpperCase())]},e}(),fe={name:"gioEventAutoTracking",method:function(t){var n=this;this.growingIO=t,this.main=function(){m(document,"submit",n._handleAction),m(document,"change",n._handleAction),n.growingIO.vdsConfig.touch?new se(n._handleAction).main():m(document,"click",n._handleAction)},this._handleAction=function(t,r){var i=n.growingIO,o=i.vdsConfig,a=i.emitter;if(!o.autotrack)return!1;var u=t.target;if(!u)return!1;var s=new le(u,t.type,!0).trackNodes();if("click"!==t.type&&(s=v(d(s))?[]:[d(s)]),v(s))return!1;null==a||a.emit("onComposeBefore",{event:r,params:null!=t?t:{}}),s.forEach((function(r){var i=r.fullXpath,a=r.index,u=r.content,s=r.href;if(!p(r.fullXpath||"","/div#__vconsole")&&!p(r.fullXpath||"","/div#__giokit")&&(o.debug&&console.log("Action:",t.type,Date.now()),i)){var f=n.growingIO.dataStore,c=f.eventContextBuilder,d=f.eventConverter,h=f.currentPage;d(e(e({eventType:l[t.type],element:[{xpath:i,index:a,textValue:u,hyperlink:s}]},c()),{pageShowTimestamp:h.time}))}}))}}};export{fe as default}; diff --git a/plugins/gioHybridAdapter.js b/plugins/gioHybridAdapter.js index 9807bf6..73358d6 100644 --- a/plugins/gioHybridAdapter.js +++ b/plugins/gioHybridAdapter.js @@ -1 +1 @@ -var e,i=function(){return i=Object.assign||function(e){for(var i,r=1,n=arguments.length;n>r;r++)for(var t in i=arguments[r])({}).hasOwnProperty.call(i,t)&&(e[t]=i[t]);return e},i.apply(this,arguments)},r=function(e){return o(["undefined","null"],c(e))},n=function(e){return"object"===c(e)&&!r(e)},t=function(e){return Array.isArray(e)&&"array"===c(e)},o=function(e,i){return("array"===c(e)||"string"===c(e))&&e.indexOf(i)>=0},d=function(e){return r(e)?"":"".concat(e)},a=function(e){return n(e)?Object.keys(e):[]},s=function(e,i){a(e).forEach((function(r){return i(e[r],r)}))},u=function(e,i){if(!n(e))return!1;try{return"string"===c(i)?delete e[i]:"array"===c(i)?i.map((function(i){return delete e[i]})):(function(e){return"regexp"===c(e)}(i)&&a(e).forEach((function(r){i.test(r)&&u(e,r)})),!0)}catch(e){return!1}},c=function(e){return{}.toString.call(e).slice(8,-1).toLowerCase()},w=function(e){try{return e()}catch(e){return}},g=["VIEW_CLICK","VIEW_CHANGE","FORM_SUBMIT","PAGE","CUSTOM","LOGIN_USER_ATTRIBUTES"],v=["LOGIN_USER_ATTRIBUTES"],f={name:"gioHybridAdapter",method:function(r){var a=this;this.growingIO=r,this.penetrateHybrid=!0,this.onOptionsInit=function(){var e,i=a.growingIO,r=i.vdsConfig,n=i.emitter;e=r.penetrateHybrid,"boolean"===c(e)&&(a.penetrateHybrid=r.penetrateHybrid),a._initHybridBridge()&&(a.onSendBefore=a.sendBeforeListener,a.hybridConfig.projectId===a.growingIO.vdsConfig.projectId&&(a.growingIO.useHybridInherit=!0)),a.growingIO.useHybridInherit&&(null==n||n.on("SET_USERID",(function(e){var i=e.newUserId,r=e.oldUserId,n=e.userKey;a.penetrateHybrid&&(!i&&r?n?a._clearNativeUserIdAndUserKey():a._clearNativeUserId():n?a._setNativeUserIdAndUserKey(d(i),d(n)):a._setNativeUserId(d(i)))})),null==n||n.on("SET_USERKEY",(function(e){var i=e.newUserKey,r=e.oldUserKey,n=e.userId;a.penetrateHybrid&&(!i&&r?a._clearNativeUserIdAndUserKey():a._setNativeUserIdAndUserKey(d(n),d(i)))})))},this._initHybridBridge=function(){var i,r,n,t=!1;return a.hasHybridBridge=!!window.GrowingWebViewJavascriptBridge,a.hasHybridBridge?((null===(i=null===window||void 0===window?void 0:window.GrowingWebViewJavascriptBridge)||void 0===i?void 0:i.configuration)||(window.GrowingWebViewJavascriptBridge.configuration=JSON.parse(window.GrowingWebViewJavascriptBridge.getConfiguration())),(null===(r=null===window||void 0===window?void 0:window.GrowingWebViewJavascriptBridge)||void 0===r?void 0:r.configuration)&&(a.hybridConfig=null===(n=null===window||void 0===window?void 0:window.GrowingWebViewJavascriptBridge)||void 0===n?void 0:n.configuration),t=!0):e.consoleText("gioHybridAdapter:当前不存在 GrowingWebViewJavascriptBridge,Web模式。","info"),t},this.sendBeforeListener=function(e){var r=e.requestData;if(a.hasHybridBridge){var n=a.processAttributes(i({},r));o(g,n.eventType)&&(o(v,n.eventType)?a.penetrateHybrid&&a._dispatchEvent(n):(a.penetrateHybrid||u(n,["userId","userKey","cs1"]),a._dispatchEvent(n)))}},this.processAttributes=function(e){return s(e,(function(i,r){n(i)||t(i)?s(e[r],(function(i,o){n(i)||t(i)?e[r][o]=JSON.stringify(i):e[r][o]=d(i)})):e[r]=d(i)})),e},this._setNativeUserId=function(e){w((function(){return window.GrowingWebViewJavascriptBridge.setNativeUserId(e)}))},this._clearNativeUserId=function(){w((function(){return window.GrowingWebViewJavascriptBridge.clearNativeUserId()}))},this._setNativeUserIdAndUserKey=function(e,i){w((function(){return window.GrowingWebViewJavascriptBridge.setNativeUserIdAndUserKey(e,i)}))},this._clearNativeUserIdAndUserKey=function(){w((function(){return window.GrowingWebViewJavascriptBridge.clearNativeUserIdAndUserKey()}))},this._dispatchEvent=function(e){w((function(){var i;return null===(i=window.GrowingWebViewJavascriptBridge)||void 0===i?void 0:i.dispatchEvent(JSON.stringify(e))}))};var f=this.growingIO,y=f.emitter,I=f.utils;e=I,y.on("OPTION_INITIALIZED",this.onOptionsInit)}};export{f as default}; +var e=function(){return e=Object.assign||function(e){for(var r,i=1,n=arguments.length;n>i;i++)for(var t in r=arguments[i])({}).hasOwnProperty.call(r,t)&&(e[t]=r[t]);return e},e.apply(this,arguments)};"function"==typeof SuppressedError&&SuppressedError;var r,i=function(e){return o(["undefined","null"],c(e))},n=function(e){return"object"===c(e)&&!i(e)},t=function(e){return Array.isArray(e)&&"array"===c(e)},o=function(e,r){return("array"===c(e)||"string"===c(e))&&e.indexOf(r)>=0},d=function(e){return i(e)?"":"".concat(e)},s=function(e){return n(e)?Object.keys(e):[]},a=function(e,r){s(e).forEach((function(i){return r(e[i],i)}))},u=function(e,r){if(!n(e))return!1;try{return"string"===c(r)?delete e[r]:"array"===c(r)?r.map((function(r){return delete e[r]})):(function(e){return"regexp"===c(e)}(r)&&s(e).forEach((function(i){r.test(i)&&u(e,i)})),!0)}catch(e){return!1}},c=function(e){return{}.toString.call(e).slice(8,-1).toLowerCase()},w=function(e){try{return e()}catch(e){return}},g=["VIEW_CLICK","VIEW_CHANGE","FORM_SUBMIT","PAGE","CUSTOM","LOGIN_USER_ATTRIBUTES"],f=["LOGIN_USER_ATTRIBUTES"],v={name:"gioHybridAdapter",method:function(i){var s=this;this.growingIO=i,this.penetrateHybrid=!0,this.onOptionsInit=function(){var e,r=s.growingIO,i=r.vdsConfig,n=r.emitter;e=i.penetrateHybrid,"boolean"===c(e)&&(s.penetrateHybrid=i.penetrateHybrid),s._initHybridBridge()&&(s.onSendBefore=s.sendBeforeListener,s.hybridConfig.projectId===s.growingIO.vdsConfig.projectId&&(s.growingIO.useHybridInherit=!0)),s.growingIO.useHybridInherit&&(null==n||n.on("SET_USERID",(function(e){var r=e.newUserId,i=e.oldUserId,n=e.userKey;s.penetrateHybrid&&(!r&&i?n?s._clearNativeUserIdAndUserKey():s._clearNativeUserId():n?s._setNativeUserIdAndUserKey(d(r),d(n)):s._setNativeUserId(d(r)))})),null==n||n.on("SET_USERKEY",(function(e){var r=e.newUserKey,i=e.oldUserKey,n=e.userId;s.penetrateHybrid&&(!r&&i?s._clearNativeUserIdAndUserKey():s._setNativeUserIdAndUserKey(d(n),d(r)))})))},this._initHybridBridge=function(){var e,i,n,t=!1;return s.hasHybridBridge=!!window.GrowingWebViewJavascriptBridge,s.hasHybridBridge?((null===(e=null===window||void 0===window?void 0:window.GrowingWebViewJavascriptBridge)||void 0===e?void 0:e.configuration)||(window.GrowingWebViewJavascriptBridge.configuration=JSON.parse(window.GrowingWebViewJavascriptBridge.getConfiguration())),(null===(i=null===window||void 0===window?void 0:window.GrowingWebViewJavascriptBridge)||void 0===i?void 0:i.configuration)&&(s.hybridConfig=null===(n=null===window||void 0===window?void 0:window.GrowingWebViewJavascriptBridge)||void 0===n?void 0:n.configuration),t=!0):r.consoleText("gioHybridAdapter:当前不存在 GrowingWebViewJavascriptBridge,Web模式。","info"),t},this.sendBeforeListener=function(r){var i=r.requestData;if(s.hasHybridBridge){var n=s.processAttributes(e({},i));u(n,"trackingId"),o(g,n.eventType)&&(o(f,n.eventType)?s.penetrateHybrid&&s._dispatchEvent(n):(s.penetrateHybrid||u(n,["userId","userKey","cs1"]),s._dispatchEvent(n)))}},this.processAttributes=function(e){return a(e,(function(r,i){n(r)||t(r)?a(e[i],(function(r,o){n(r)||t(r)?e[i][o]=JSON.stringify(r):e[i][o]=d(r)})):e[i]=d(r)})),e},this._setNativeUserId=function(e){w((function(){return window.GrowingWebViewJavascriptBridge.setNativeUserId(e)}))},this._clearNativeUserId=function(){w((function(){return window.GrowingWebViewJavascriptBridge.clearNativeUserId()}))},this._setNativeUserIdAndUserKey=function(e,r){w((function(){return window.GrowingWebViewJavascriptBridge.setNativeUserIdAndUserKey(e,r)}))},this._clearNativeUserIdAndUserKey=function(){w((function(){return window.GrowingWebViewJavascriptBridge.clearNativeUserIdAndUserKey()}))},this._dispatchEvent=function(e){w((function(){var r;return null===(r=window.GrowingWebViewJavascriptBridge)||void 0===r?void 0:r.dispatchEvent(JSON.stringify(e))}))};var v=this.growingIO,p=v.emitter,y=v.utils;r=y,p.on("OPTION_INITIALIZED",this.onOptionsInit)}};export{v as default}; diff --git a/plugins/gioHybridCircle.js b/plugins/gioHybridCircle.js index fc51c17..701b947 100644 --- a/plugins/gioHybridCircle.js +++ b/plugins/gioHybridCircle.js @@ -1 +1 @@ -var e,t,n,r,i,o,a,u=function(){return u=Object.assign||function(e){for(var t,n=1,r=arguments.length;r>n;n++)for(var i in t=arguments[n])({}).hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},u.apply(this,arguments)},s="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},l="function"==typeof Array.from?Array.from:(t||(t=1,n=function(e){return"function"==typeof e},r=function(e){var t=function(e){var t=Number(e);return isNaN(t)?0:0!==t&&isFinite(t)?(t>0?1:-1)*Math.floor(Math.abs(t)):t}(e);return Math.min(Math.max(t,0),9007199254740991)},i=function(e){var t=e.next();return!t.done&&t},e=function(e){var t,o,a,u=this,s=arguments.length>1?arguments[1]:void 0;if(void 0!==s){if(!n(s))throw new TypeError("Array.from: when provided, the second argument must be a function");arguments.length>2&&(t=arguments[2])}var l=function(e,t){if(null!=e&&null!=t){var r=e[t];if(null==r)return;if(!n(r))throw new TypeError(r+" is not a function");return r}}(e,function(e){if(null!=e){if(["string","number","boolean","symbol"].indexOf(typeof e)>-1)return Symbol.iterator;if("undefined"!=typeof Symbol&&"iterator"in Symbol&&Symbol.iterator in e)return Symbol.iterator;if("@@iterator"in e)return"@@iterator"}}(e));if(void 0!==l){o=n(u)?Object(new u):[];var f,d,c=l.call(e);if(null==c)throw new TypeError("Array.from requires an array-like or iterable object");for(a=0;;){if(!(f=i(c)))return o.length=a,o;d=f.value,o[a]=s?s.call(t,d,a):d,a++}}else{var h=Object(e);if(null==e)throw new TypeError("Array.from requires an array-like object - not null or undefined");var p,g=r(h.length);for(o=n(u)?Object(new u(g)):Array(g),a=0;g>a;)p=h[a],o[a]=s?s.call(t,p,a):p,a++;o.length=g}return o}),e),f=function(e){return c(["undefined","null"],g(e))},d=function(e){return"object"===g(e)&&!f(e)},c=function(e,t){return("array"===g(e)||"string"===g(e))&&e.indexOf(t)>=0},h=l,p=function(e,t){if(!d(e))return!1;try{return"string"===g(t)?delete e[t]:"array"===g(t)?t.map((function(t){return delete e[t]})):(function(e){return"regexp"===g(e)}(t)&&function(e){return d(e)?Object.keys(e):[]}(e).forEach((function(n){t.test(n)&&p(e,n)})),!0)}catch(e){return!1}},g=function(e){return{}.toString.call(e).slice(8,-1).toLowerCase()},v=function(e,t,n,r){void 0===r&&(r={}),document.addEventListener?e.addEventListener(t,n,u(u({},{capture:!0}),r)):e.attachEvent?e.attachEvent("on"+t,n):e["on"+t]=n},m={},N={};o=N,a=s&&s.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;o>i;i++)!r&&i in t||(r||(r=[].slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||[].slice.call(t))},Object.defineProperty(o,"__esModule",{value:!0}),o.GROWING_TITLE_OLD=o.GROWING_TITLE=o.GROWING_GTITLE=o.GROWING_CDP_INDEX=o.GROWING_INDEX_OLD=o.GROWING_INDEX=o.GROWING_CONTAINER=o.GROWING_TRACK=o.GROWING_IGNORE=o.VALID_CLASS_SELECTOR=o.VALID_ID_SELECTOR=o.EXCLUDE_CLASS_RE=o.UNSUPPORTED_TAGS=o.TEXT_NODE=o.UNSUPPORTED_CLICK_TAGS=o.SUPPORTED_ICON_TAGS=o.SUPPORTED_CHANGE_TYPES=o.SUPPORTED_CLICK_INPUT_TYPES=o.SUPPORTED_CONTAINER_TAGS=o.LIST_TAGS=void 0,o.LIST_TAGS=["TR","LI","DL"],o.SUPPORTED_CONTAINER_TAGS=a(["A","BUTTON"],o.LIST_TAGS,!0),o.SUPPORTED_CLICK_INPUT_TYPES=["button","submit","reset"],o.SUPPORTED_CHANGE_TYPES=["radio","checkbox","search"],o.SUPPORTED_ICON_TAGS=["I","EM","svg","IMG"],o.UNSUPPORTED_CLICK_TAGS=["TEXTAREA","HTML","BODY"],o.TEXT_NODE=["I","SPAN","EM","B","STRONG"],o.UNSUPPORTED_TAGS=["tspan","text","g","rect","path","defs","clippath","desc","title","math","use"],o.EXCLUDE_CLASS_RE=/(^| |[^ ]+\-)(clear|clearfix|active|hover|enabled|current|selected|unselected|hidden|display|focus|disabled|undisabled|open|checked|unchecked|undefined|null|ng-|growing-)[^\. ]*/g,o.VALID_ID_SELECTOR=/^[a-zA-Z-\_][a-zA-Z\-\_0-9]+$/,o.VALID_CLASS_SELECTOR=/^([a-zA-Z\-\_0-9]+)$/,o.GROWING_IGNORE="data-growing-ignore",o.GROWING_TRACK="data-growing-track",o.GROWING_CONTAINER="data-growing-container",o.GROWING_INDEX="data-growing-index",o.GROWING_INDEX_OLD="data-growing-idx",o.GROWING_CDP_INDEX="data-index",o.GROWING_GTITLE="data-growing-title",o.GROWING_TITLE="data-title",o.GROWING_TITLE_OLD="growing-title";var T={},E={};Object.defineProperty(E,"__esModule",{value:!0}),E.lastFindIndex=E.findIndex=E.arrayEquals=E.rmBlank=E.normalizePath=E.splitNoEmpty=E.filterText=void 0,E.filterText=function(e,t){if(void 0===t&&(t=!0),e&&(null==(e=e.replace(/[\n \t]+/g," ").trim())?void 0:e.length))return e.slice(0,t?50:void 0)},E.splitNoEmpty=function(e,t){return e?e.split(t).filter((function(e){return!!e})):[]},E.normalizePath=function(e){var t=e.length;return t>1&&"/"===e.charAt(t-1)?e.slice(0,t-1):e},E.rmBlank=function(e){return e?e.replace(/[\n \t]+/g,""):""},E.arrayEquals=function(e,t){if(!e||!t)return!1;if(e.length!==t.length)return!1;for(var n=0,r=e.length;r>n;n++)if(e[n]!==t[n])return!1;return!0},E.findIndex=function(e,t){if(null==e||"function"!=typeof t)return-1;for(var n=0;n=0;n--){var r=e[n];if(t.call(void 0,r))return n}return-1},function(e){var t=s&&s.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;o>i;i++)!r&&i in t||(r||(r=[].slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||[].slice.call(t))},n=s&&s.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.removeDiffTagOnHeadAndTail=e.computeXpath=e.getMarkIndex=e.getEffectiveNode=e.isIgnore=e.depthInside=e.changeableInput=e.clickableInput=e.onlyContainsTextChildren=e.onlyContainsIconChildren=e.supportIconTag=e.isContainerTag=e.isListTag=e.isParentOfLeaf=e.isLeaf=e.getChildren=e.getDeepChildren=e.findParent=e.isRootNode=e.hasValidAttribute=void 0;var r=E,i=N,o=n(l);e.hasValidAttribute=function(e,t){return e instanceof Element&&e.hasAttribute(t)&&"false"!==e.getAttribute(t)},e.isRootNode=function(e){return!e||-1!==["BODY","HTML","#document"].indexOf(e.nodeName)},e.findParent=function(t,n){for(var r=t.parentNode;r&&!(0,e.isRootNode)(r);){if(n(r))return r;r=r.parentNode}},e.getDeepChildren=function(n){return(0,o.default)((null==n?void 0:n.childNodes)||[]).reduce((function(n,r){return r instanceof Element?t(t(t([],n,!0),[r],!1),(0,e.getDeepChildren)(r),!0):n}),[])},e.getChildren=function(e){return(0,o.default)((null==e?void 0:e.childNodes)||[]).filter((function(e){return e instanceof Element}))},e.isLeaf=function(t){return!t.hasChildNodes()||"svg"===t.nodeName||0===(0,e.getChildren)(t).length},e.isParentOfLeaf=function(t){return!(!t.hasChildNodes()||"svg"===t.nodeName)&&0===(0,o.default)(t.childNodes).filter((function(t){return!(0,e.isLeaf)(t)})).length},e.isListTag=function(e){return-1!==i.LIST_TAGS.indexOf(e.nodeName)},e.isContainerTag=function(t){return(0,e.hasValidAttribute)(t,i.GROWING_CONTAINER)||-1!==i.SUPPORTED_CONTAINER_TAGS.indexOf(t.nodeName)},e.supportIconTag=function(e){var t=e.nodeName;return-1!==i.SUPPORTED_ICON_TAGS.indexOf(t)},e.onlyContainsIconChildren=function(t){if(t.textContent)return!1;var n=(0,e.getChildren)(t);if(0===n.length)return!1;for(var r=0,i=n;rn)return!1;for(var i="svg"===t.tagName?[]:(0,e.getChildren)(t),o=0;o=r},e.isIgnore=function(t){if(!(t instanceof Element)||(0,e.hasValidAttribute)(t,i.GROWING_IGNORE))return!0;for(var n=t.parentNode;n&&!(0,e.isRootNode)(n);){if((0,e.hasValidAttribute)(n,i.GROWING_IGNORE))return!0;n=n.parentNode}return!1},e.getEffectiveNode=function(t){for(var n,r;t&&(r=void 0,!((n=t)instanceof Element&&-1===i.UNSUPPORTED_TAGS.indexOf(null===(r=n.tagName)||void 0===r?void 0:r.toLowerCase())))&&t.parentNode;)t=t.parentNode;var o,a=t.parentNode;return!(0,e.isRootNode)(a)&&((0,e.onlyContainsIconChildren)(a)||"BUTTON"===(o=a).tagName&&(0,e.onlyContainsTextChildren)(o))?a:t},e.getMarkIndex=function(e){if(e instanceof Element){var t=e.getAttribute(i.GROWING_INDEX)||e.getAttribute(i.GROWING_INDEX_OLD)||e.getAttribute(i.GROWING_CDP_INDEX);if(t){if(/^\d{1,10}$/.test(t)&&+t>=0&&2147483647>+t)return+t;window.console.error("[GioNode]:标记的index不符合规范(index必须是大于等于0且小于2147483647的整数字)。",t)}}},e.computeXpath=function(e){for(var t=e.parentPaths(!0),n=Math.min(t.length,+(t.length>=10)+4),r=["","",""],i=0;ii&&(r[1]=o+r[1])}return r},e.removeDiffTagOnHeadAndTail=function(e,t){var n=function(e){return e.nodeName===t.nodeName},i=(0,r.findIndex)(e,n),o=(0,r.lastFindIndex)(e,n);return-1===i||-1===o?[]:e.slice(i,o+1)}}(T);var I={},_={};Object.defineProperty(_,"__esModule",{value:!0});var O=N,b=E,y=T;function C(e){var t;if(e instanceof Element){var n=e.getAttribute("name");if(n)return[n];if(e.hasAttribute("class")){var r=null===(t=e.getAttribute("class"))||void 0===t?void 0:t.replace(O.EXCLUDE_CLASS_RE,"").trim();if(null==r?void 0:r.length)return r.split(/\s+/).filter((function(e){return O.VALID_CLASS_SELECTOR.test(e)&&!e.match(/[a-z][A-Z][a-z][A-Z]/)&&!e.match(/[0-9][0-9][0-9][0-9]/)})).sort()}}return[]}var L=function(){function e(e){var t;this.node=e,this.tagName=this.node.nodeName,this.name=this.tagName.toLowerCase(),this.id=(t=this.node).id&&O.VALID_ID_SELECTOR.test(t.id)?t.id:null,this.classList=C(this.node),this.guessListAndIndex()}return e.prototype.guessListAndIndex=function(){var e,t=this;this._tagList=(0,y.isListTag)(this.node);var n=(0,y.removeDiffTagOnHeadAndTail)((0,y.getChildren)(this.node.parentNode),this.node);if(this._tagList&&-1!==(o=n.filter((function(e){return e.tagName===t.tagName})).indexOf(this.node))&&(this._index=o+1),n.length>=3&&(null===(e=this.classList)||void 0===e?void 0:e.length)){for(var r=0,i=0,o=1;o<=n.length;o++){var a=n[o-1];if(a.tagName!==this.tagName){i=0;break}(0,b.arrayEquals)(this.classList,C(a))&&(i+=1),this.node===a&&(r=o)}3>i||(this._pseudoList=!0,this._index=this._index||r)}},Object.defineProperty(e.prototype,"path",{get:function(){var e;return this._path||(this._path="/".concat(this.name),this.id&&(this._path+="#".concat(this.id)),(null===(e=this.classList)||void 0===e?void 0:e.length)&&(this._path+=".".concat(this.classList.join(".")))),this._path},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pseudoList",{get:function(){return!!this._pseudoList},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"list",{get:function(){return!!this._tagList||!!this._pseudoList},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"index",{get:function(){var e;return null!==(e=(0,y.getMarkIndex)(this.node))&&void 0!==e?e:this._index},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"container",{get:function(){return(0,y.isContainerTag)(this.node)||this.list},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"parent",{get:function(){return this.node.parentNode?new e(this.node.parentNode):null},enumerable:!1,configurable:!0}),e.prototype.parentPaths=function(e){void 0===e&&(e=!1);for(var t=e?[this]:[],n=this.parent;n&&!(0,y.isRootNode)(n.node);)t.push(n),n=n.parent;return t},e}();_.default=L;var w={};Object.defineProperty(w,"__esModule",{value:!0}),w.getElementHref=w.getImgHref=w.getAnchorHref=void 0;var x=E;function D(e){if(e.hasAttribute("href")){var t=e.getAttribute("href");if(t&&0!==t.indexOf("javascript"))return(0,x.normalizePath)(t.slice(0,320))}}function P(e){if(e.src&&-1===e.src.indexOf("data:image"))return e.src}w.getAnchorHref=D,w.getImgHref=P,w.getElementHref=function(e){var t=e;if(t)switch(e.nodeName.toLowerCase()){case"a":return D(t);case"img":return P(t)}};var R={},A=s&&s.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(R,"__esModule",{value:!0}),R.getElementContent=R.getFormContent=void 0;var S=T,G=w,U=N,W=A(_),H=E,M=A(l),k=function(e){return e.htmlFor||e.getAttribute("for")},j=function(e){var t=e.getAttribute(U.GROWING_GTITLE)||e.getAttribute(U.GROWING_TITLE)||e.getAttribute(U.GROWING_TITLE_OLD)||e.getAttribute("title");return null==t?void 0:t.trim()};function B(e){var t=e.node;return e.list?X(t):(0,H.filterText)(t.textContent)||void 0}function X(e){for(var t=void 0,n=!1,r=0,i=(0,M.default)(e.childNodes);r-1?n.slice(0,r):n}}(t);case"svg":return function(e){for(var t=0,n=(0,M.default)(e.childNodes);t0)return n[n.length-1]}}(t);case"label":return B(a);case"input":return function(e){if((0,S.clickableInput)(e))return e.value;if("password"!==e.type&&(0,S.hasValidAttribute)(e,U.GROWING_TRACK))return e.value;if((0,S.changeableInput)(e)){var t=(0,S.findParent)(e,(function(e){return"LABEL"===e.nodeName}));if(!t&&e.id)for(var n=document.body.getElementsByTagName("label"),r=0;r0)return o+" ("+e.checked+")"}return e.value}}(t);case"select":return r=t,(0,M.default)(r.options).filter((function(e){return e.selected})).map((function(e){return e.label})).join(", ")||r.value;case"form":return V(t)}return(0,S.isLeaf)(t)?function(e){var t=(0,H.filterText)(e.textContent);if(t)return t}(t):(0,S.isParentOfLeaf)(t)&&!(0,S.onlyContainsIconChildren)(t)?function(e){for(var t="",n=0,r=(0,M.default)(e.childNodes);nn;n++)for(var i in t=arguments[n])({}).hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},ee.apply(this,arguments)},te=s&&s.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(m,"__esModule",{value:!0});var ne,re=N,ie=T,oe=te(I),ae=function(){function e(e,t,n){void 0===t&&(t=null),void 0===n&&(n=!0),this.origin=e,this.action=t,this.direct=n,this.target="self"===t?e:(0,ie.getEffectiveNode)(e),this.ignore=(0,ie.isIgnore)(this.target),this.vnode=new oe.default(this.target),this.tagName=this.vnode.tagName}return Object.defineProperty(e.prototype,"content",{get:function(){return this.vnode.content},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"href",{get:function(){return this.vnode.href},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"index",{get:function(){return this.vnode.index},enumerable:!1,configurable:!0}),e.prototype.inferParentIndex=function(){var t=this;return this.parentIndex||(0,ie.findParent)(this.target,(function(n){var r=new e(n,t.action,!1);r.traceable()&&r.index&&(t.parentIndex=r.index)})),this.parentIndex},Object.defineProperty(e.prototype,"xpath",{get:function(){return this.vnode.xpath},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fullXpath",{get:function(){return this.vnode.fullXpath},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"skeleton",{get:function(){return this.vnode.skeleton},enumerable:!1,configurable:!0}),e.prototype.info=function(e){return void 0===e&&(e=!0),e&&this.inferParentIndex(),{skeleton:this.skeleton,fullXpath:this.fullXpath,xpath:this.xpath,content:this.content,href:this.href,index:this.parentIndex||this.index}},e.prototype.traceable=function(){if(this.ignore)return!1;if(this.direct){if("click"===this.action||"hover"===this.action){if(-1!==re.UNSUPPORTED_CLICK_TAGS.indexOf(this.target.tagName))return!1;if("INPUT"===this.target.tagName&&!(0,ie.clickableInput)(this.target))return!1;if(!(0,ie.isContainerTag)(this.target)&&!(0,ie.depthInside)(this.target,5))return!1}return!0}return this.vnode.container},e.prototype.trackNodes=function(){if(!this.traceable())return[];var e=[this];if("submit"!==this.action)for(var t=this.parentElement;t;){if(t.ignore)return[];t.traceable()&&e.unshift(t),t=t.parentElement}var n=void 0;return e.map((function(e){var t=e.info(!1),r=t.index;return!n&&r&&(n=r),ee(ee({},t),{index:n||r})}))},Object.defineProperty(e.prototype,"parentElement",{get:function(){var t=this.target.parentNode;if(t&&t.nodeName&&!(0,ie.isRootNode)(t))return new e(t,this.action,!1)},enumerable:!1,configurable:!0}),e}(),ue=m.default=ae,se=["i","span","em","b","strong","svg"];!function(e){e[e.OUTER=0]="OUTER",e[e.INNER_COVERED=1]="INNER_COVERED",e[e.INNER_SHOW=2]="INNER_SHOW"}(ne||(ne={}));var le=function(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;o>i;i++)!r&&i in t||(r||(r=[].slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||[].slice.call(t))}(["HR","BR","SCRIPT","NOSCRIPT","STYLE","HEAD","BASE","LINK","META","TITLE","BODY","HTML","TEMPLATE","CODE"],N.UNSUPPORTED_CLICK_TAGS,!0),fe=["SELECT","A","BUTTON","INPUT","IMG","FORM"],de=function(e,t,n){return document.elementFromPoint(t,n)===e},ce=function(){function e(e,t,n){this.node=e,this.parentNodeDesc=t,this.devicesInfo=n,this.proxy=new ue(e),this.tagName=this.node.tagName,this.name=this.tagName.toLowerCase(),this.isIgnore=!!this.node.dataset.growingIgnore,this.isUnSupported=-1!==le.indexOf(this.tagName),this.rect=this.computeWindowRect()}return e.prototype.info=function(){var e=this.desc();e.zLevel+=this.devicesInfo.webviewZLevel;var t=this.getDeviceRect(this.rect);return p(e,"isContainer"),u(u(u({},e),t),{parentXPath:this.parentNodeDesc.isContainer?this.parentNodeDesc.xpath:void 0,href:this.proxy.href,content:this.proxy.content,nodeType:this.nodeType()})},e.prototype.nodeType=function(){return"input"!==this.name||T.changeableInput(this.node)?this.node.tagName:"INPUT_BTN"},e.prototype.desc=function(){return{index:this.parentNodeDesc.index||this.proxy.index,zLevel:this.zLevel(),xpath:this.proxy.xpath,isContainer:this.isDefinedContainer()}},e.prototype.cssVisible=function(){var e=this.computedStyle();return Number(e.opacity)>0&&"visible"===e.visibility&&"none"!==e.display},e.prototype.viewportStatus=function(){var e=this.rect,t=e.top,n=e.left,r=e.width,i=e.height,o=this.devicesInfo,a=o.winWidth,u=o.winHeight;if(0>=r||0>=i)return ne.OUTER;var s=this.node;return u>t&&a>n&&r>0&&i>0?de(s,n+r/2,t+i/2)||de(s,n+1,t+1)||de(s,n+r-1,t+1)||de(s,n+1,t+i-1)||de(s,n+r-1,t+i-1)?ne.INNER_SHOW:ne.INNER_COVERED:ne.OUTER},e.prototype.isCircleable=function(){return this.proxy.target===this.proxy.origin&&(!!this.isDefinedContainer()||!("input"===this.name&&this.node instanceof HTMLInputElement&&"password"===this.node.type)&&(-1!==fe.indexOf(this.name)||(T.isLeaf(this.node)?!this.isBigBlank():this.hasBackgroundImage()&&T.depthInside(this.node,4))))},e.prototype.isSimpleContainer=function(){return"select"===this.name||this.isDefaultContainer()&&(function(e,t){if(0===e.children.length)return!1;for(var n=0,r=h(e.children);n0)for(var n=0;nu>>1||o>s>>1)},e.prototype.hasBackgroundImage=function(){var e=this.computedStyle().backgroundImage;return!!e&&"none"!==e&&e.length>0},e.prototype.zLevel=function(){var e=this.computedStyle(),t=e.zIndex;if("auto"!==t)return Number(t||"0")+this.parentNodeDesc.zLevel;switch(e.position){case"relative":return this.parentNodeDesc.zLevel+2;case"sticky":return this.parentNodeDesc.zLevel+3;case"absolute":return this.parentNodeDesc.zLevel+4;case"fixed":return this.parentNodeDesc.zLevel+5;default:return this.parentNodeDesc.zLevel+1}},e.prototype.computeWindowRect=function(){if(this.rect)return this.rect;var e=this.node.getBoundingClientRect(),t=e.top,n=e.bottom,r=e.left,i=e.right-r,o=n-t;return 0>t?o=t+o:t+o>this.devicesInfo.winHeight&&(o=this.devicesInfo.winHeight-t),0>r?i=r+i:r+i>this.devicesInfo.winWidth&&(i=this.devicesInfo.winWidth-r),this.rect={top:t,left:r,width:i,height:o},this.rect},e.prototype.computedStyle=function(){return window.getComputedStyle(this.node)},e.prototype.getDeviceRect=function(e){var t=this.devicesInfo,n=t.scale,r=t.webviewTop,i=t.webviewLeft;return{top:e.top*n+r,left:e.left*n+i,width:e.width*n,height:e.height*n}},e}(),he=["DOMContentLoaded","onreadystatechange"],pe=["scroll","resize","load","beforeunload","popstate","hashchange","pagehide","unload"],ge=function(){function e(e){this.growingIO=e,this.addDomChangeListener()}return e.prototype.getDomTree=function(e,t,n,r,i,o){var a=function(e,t,n,r,i){var o=document.documentElement.clientWidth;return{winWidth:o,winHeight:document.documentElement.clientHeight,scale:n/o,webviewTop:t,webviewLeft:e,webviewWidth:n,webviewHeight:r,webviewZLevel:i}}(e,t,n,r,i),u=this.getElementsByParent(o||document.body,{isContainer:!1,zLevel:0},a),s=this.growingIO.dataStore.currentPage;return{page:{domain:s.domain,path:s.path,query:s.query,title:s.title},elements:u}},e.prototype.getElementsByParent=function(e,t,n){var r=this,i=[];return[].slice.call(e.childNodes,0).filter((function(e){return 1===e.nodeType})).forEach((function(e){var o=new ce(e,t,n);if(o.cssVisible()&&!o.isIgnore){switch(o.viewportStatus()){case ne.INNER_SHOW:o.isCircleable()&&i.push(o.info());break;case ne.INNER_COVERED:o.isDefaultContainer()&&i.push(o.info())}o.isSimpleContainer()||[].push.apply(i,r.getElementsByParent(e,o.desc(),n))}})),i},e.prototype.addDomChangeListener=function(){var e,t=function(t){return void 0===t&&(t=""),function(){var n;"beforeunload"===t&&e&&e.disconnect(),null===(n=window.GrowingWebViewJavascriptBridge)||void 0===n||n.onDomChanged()}};(e=new MutationObserver(t("mutation"))).observe(document.body,{attributes:!0,characterData:!0,childList:!0,subtree:!0}),he.forEach((function(e){v(document,e,t(e))})),pe.forEach((function(e){v(window,e,t(e))}))},e}(),ve={name:"gioHybridCircle",method:function(){function e(t){var n,r=this;this.growingIO=t,null===(n=this.growingIO.emitter)||void 0===n||n.on("SDK_INITIALIZED",(function(){if(window.GrowingWebViewJavascriptBridge){var t=r;window.GrowingWebViewJavascriptBridge.getDomTree=function(){if(arguments.length>=4)return e.bindGetDomTree(t.growingIO),e.domHelper.getDomTree.apply(e.domHelper,arguments)}}}))}return e.bindGetDomTree=function(e){this.domHelper||(this.domHelper=new ge(e),window.GrowingWebViewJavascriptBridge.getDomTree=this.domHelper.getDomTree.bind(this.domHelper))},e}()};export{ve as default}; +var e=function(){return e=Object.assign||function(e){for(var t,n=1,r=arguments.length;r>n;n++)for(var i in t=arguments[n])({}).hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},e.apply(this,arguments)};"function"==typeof SuppressedError&&SuppressedError;var t,n,r,i,o,a,u,s="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},l="function"==typeof Array.from?Array.from:(n||(n=1,r=function(e){return"function"==typeof e},i=function(e){var t=function(e){var t=Number(e);return isNaN(t)?0:0!==t&&isFinite(t)?(t>0?1:-1)*Math.floor(Math.abs(t)):t}(e);return Math.min(Math.max(t,0),9007199254740991)},o=function(e){var t=e.next();return!t.done&&t},t=function(e){var t,n,a,u=this,s=arguments.length>1?arguments[1]:void 0;if(void 0!==s){if(!r(s))throw new TypeError("Array.from: when provided, the second argument must be a function");arguments.length>2&&(t=arguments[2])}var l=function(e,t){if(null!=e&&null!=t){var n=e[t];if(null==n)return;if(!r(n))throw new TypeError(n+" is not a function");return n}}(e,function(e){if(null!=e){if(["string","number","boolean","symbol"].indexOf(typeof e)>-1)return Symbol.iterator;if("undefined"!=typeof Symbol&&"iterator"in Symbol&&Symbol.iterator in e)return Symbol.iterator;if("@@iterator"in e)return"@@iterator"}}(e));if(void 0!==l){n=r(u)?Object(new u):[];var f,d,c=l.call(e);if(null==c)throw new TypeError("Array.from requires an array-like or iterable object");for(a=0;;){if(!(f=o(c)))return n.length=a,n;d=f.value,n[a]=s?s.call(t,d,a):d,a++}}else{var h=Object(e);if(null==e)throw new TypeError("Array.from requires an array-like object - not null or undefined");var p,g=i(h.length);for(n=r(u)?Object(new u(g)):Array(g),a=0;g>a;)p=h[a],n[a]=s?s.call(t,p,a):p,a++;n.length=g}return n}),t),f=function(e){return c(["undefined","null"],g(e))},d=function(e){return"object"===g(e)&&!f(e)},c=function(e,t){return("array"===g(e)||"string"===g(e))&&e.indexOf(t)>=0},h=l,p=function(e,t){if(!d(e))return!1;try{return"string"===g(t)?delete e[t]:"array"===g(t)?t.map((function(t){return delete e[t]})):(function(e){return"regexp"===g(e)}(t)&&function(e){return d(e)?Object.keys(e):[]}(e).forEach((function(n){t.test(n)&&p(e,n)})),!0)}catch(e){return!1}},g=function(e){return{}.toString.call(e).slice(8,-1).toLowerCase()},v=function(t,n,r,i){void 0===i&&(i={}),document.addEventListener?t.addEventListener(n,r,e(e({},{capture:!0}),i)):t.attachEvent?t.attachEvent("on"+n,r):t["on"+n]=r},m={},N={};a=N,u=s&&s.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;o>i;i++)!r&&i in t||(r||(r=[].slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||[].slice.call(t))},Object.defineProperty(a,"__esModule",{value:!0}),a.GROWING_TITLE_OLD=a.GROWING_TITLE=a.GROWING_GTITLE=a.GROWING_CDP_INDEX=a.GROWING_INDEX_OLD=a.GROWING_INDEX=a.GROWING_CONTAINER=a.GROWING_TRACK=a.GROWING_IGNORE=a.VALID_CLASS_SELECTOR=a.VALID_ID_SELECTOR=a.EXCLUDE_CLASS_RE=a.UNSUPPORTED_TAGS=a.TEXT_NODE=a.UNSUPPORTED_CLICK_TAGS=a.SUPPORTED_ICON_TAGS=a.SUPPORTED_CHANGE_TYPES=a.SUPPORTED_CLICK_INPUT_TYPES=a.SUPPORTED_CONTAINER_TAGS=a.LIST_TAGS=void 0,a.LIST_TAGS=["TR","LI","DL"],a.SUPPORTED_CONTAINER_TAGS=u(["A","BUTTON"],a.LIST_TAGS,!0),a.SUPPORTED_CLICK_INPUT_TYPES=["button","submit","reset"],a.SUPPORTED_CHANGE_TYPES=["radio","checkbox","search"],a.SUPPORTED_ICON_TAGS=["I","EM","svg","IMG"],a.UNSUPPORTED_CLICK_TAGS=["TEXTAREA","HTML","BODY"],a.TEXT_NODE=["I","SPAN","EM","B","STRONG"],a.UNSUPPORTED_TAGS=["tspan","text","g","rect","path","defs","clippath","desc","title","math","use"],a.EXCLUDE_CLASS_RE=/(^| |[^ ]+\-)(clear|clearfix|active|hover|enabled|current|selected|unselected|hidden|display|focus|disabled|undisabled|open|checked|unchecked|undefined|null|ng-|growing-)[^\. ]*/g,a.VALID_ID_SELECTOR=/^[a-zA-Z-\_][a-zA-Z\-\_0-9]+$/,a.VALID_CLASS_SELECTOR=/^([a-zA-Z\-\_0-9]+)$/,a.GROWING_IGNORE="data-growing-ignore",a.GROWING_TRACK="data-growing-track",a.GROWING_CONTAINER="data-growing-container",a.GROWING_INDEX="data-growing-index",a.GROWING_INDEX_OLD="data-growing-idx",a.GROWING_CDP_INDEX="data-index",a.GROWING_GTITLE="data-growing-title",a.GROWING_TITLE="data-title",a.GROWING_TITLE_OLD="growing-title";var T={},E={};Object.defineProperty(E,"__esModule",{value:!0}),E.lastFindIndex=E.findIndex=E.arrayEquals=E.rmBlank=E.normalizePath=E.splitNoEmpty=E.filterText=void 0,E.filterText=function(e,t){if(void 0===t&&(t=!0),e&&(null==(e=e.replace(/[\n \t]+/g," ").trim())?void 0:e.length))return e.slice(0,t?50:void 0)},E.splitNoEmpty=function(e,t){return e?e.split(t).filter((function(e){return!!e})):[]},E.normalizePath=function(e){var t=e.length;return t>1&&"/"===e.charAt(t-1)?e.slice(0,t-1):e},E.rmBlank=function(e){return e?e.replace(/[\n \t]+/g,""):""},E.arrayEquals=function(e,t){if(!e||!t)return!1;if(e.length!==t.length)return!1;for(var n=0,r=e.length;r>n;n++)if(e[n]!==t[n])return!1;return!0},E.findIndex=function(e,t){if(null==e||"function"!=typeof t)return-1;for(var n=0;n=0;n--){var r=e[n];if(t.call(void 0,r))return n}return-1},function(e){var t=s&&s.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;o>i;i++)!r&&i in t||(r||(r=[].slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||[].slice.call(t))},n=s&&s.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.removeDiffTagOnHeadAndTail=e.computeXpath=e.getMarkIndex=e.getEffectiveNode=e.isIgnore=e.depthInside=e.changeableInput=e.clickableInput=e.onlyContainsTextChildren=e.onlyContainsIconChildren=e.supportIconTag=e.isContainerTag=e.isListTag=e.isParentOfLeaf=e.isLeaf=e.getChildren=e.getDeepChildren=e.findParent=e.isRootNode=e.hasValidAttribute=void 0;var r=E,i=N,o=n(l);e.hasValidAttribute=function(e,t){return e instanceof Element&&e.hasAttribute(t)&&"false"!==e.getAttribute(t)},e.isRootNode=function(e){return!e||-1!==["BODY","HTML","#document"].indexOf(e.nodeName)},e.findParent=function(t,n){for(var r=t.parentNode;r&&!(0,e.isRootNode)(r);){if(n(r))return r;r=r.parentNode}},e.getDeepChildren=function(n){return(0,o.default)((null==n?void 0:n.childNodes)||[]).reduce((function(n,r){return r instanceof Element?t(t(t([],n,!0),[r],!1),(0,e.getDeepChildren)(r),!0):n}),[])},e.getChildren=function(e){return(0,o.default)((null==e?void 0:e.childNodes)||[]).filter((function(e){return e instanceof Element}))},e.isLeaf=function(t){return!t.hasChildNodes()||"svg"===t.nodeName||0===(0,e.getChildren)(t).length},e.isParentOfLeaf=function(t){return!(!t.hasChildNodes()||"svg"===t.nodeName)&&0===(0,o.default)(t.childNodes).filter((function(t){return!(0,e.isLeaf)(t)})).length},e.isListTag=function(e){return-1!==i.LIST_TAGS.indexOf(e.nodeName)},e.isContainerTag=function(t){return(0,e.hasValidAttribute)(t,i.GROWING_CONTAINER)||-1!==i.SUPPORTED_CONTAINER_TAGS.indexOf(t.nodeName)},e.supportIconTag=function(e){var t=e.nodeName;return-1!==i.SUPPORTED_ICON_TAGS.indexOf(t)},e.onlyContainsIconChildren=function(t){if(t.textContent)return!1;var n=(0,e.getChildren)(t);if(0===n.length)return!1;for(var r=0,i=n;rn)return!1;for(var i="svg"===t.tagName?[]:(0,e.getChildren)(t),o=0;o=r},e.isIgnore=function(t){if(!(t instanceof Element)||(0,e.hasValidAttribute)(t,i.GROWING_IGNORE))return!0;for(var n=t.parentNode;n&&!(0,e.isRootNode)(n);){if((0,e.hasValidAttribute)(n,i.GROWING_IGNORE))return!0;n=n.parentNode}return!1},e.getEffectiveNode=function(t){for(var n,r;t&&(r=void 0,!((n=t)instanceof Element&&-1===i.UNSUPPORTED_TAGS.indexOf(null===(r=n.tagName)||void 0===r?void 0:r.toLowerCase())))&&t.parentNode;)t=t.parentNode;var o,a=t.parentNode;return!(0,e.isRootNode)(a)&&((0,e.onlyContainsIconChildren)(a)||"BUTTON"===(o=a).tagName&&(0,e.onlyContainsTextChildren)(o))?a:t},e.getMarkIndex=function(e){if(e instanceof Element){var t=e.getAttribute(i.GROWING_INDEX)||e.getAttribute(i.GROWING_INDEX_OLD)||e.getAttribute(i.GROWING_CDP_INDEX);if(t){if(/^\d{1,10}$/.test(t)&&+t>=0&&2147483647>+t)return+t;window.console.error("[GioNode]:标记的index不符合规范(index必须是大于等于0且小于2147483647的整数字)。",t)}}},e.computeXpath=function(e){for(var t=e.parentPaths(!0),n=Math.min(t.length,+(t.length>=10)+4),r=["","",""],i=0;ii&&(r[1]=o+r[1])}return r},e.removeDiffTagOnHeadAndTail=function(e,t){var n=function(e){return e.nodeName===t.nodeName},i=(0,r.findIndex)(e,n),o=(0,r.lastFindIndex)(e,n);return-1===i||-1===o?[]:e.slice(i,o+1)}}(T);var I={},_={};Object.defineProperty(_,"__esModule",{value:!0});var O=N,b=E,y=T;function C(e){var t;if(e instanceof Element){var n=e.getAttribute("name");if(n)return[n];if(e.hasAttribute("class")){var r=null===(t=e.getAttribute("class"))||void 0===t?void 0:t.replace(O.EXCLUDE_CLASS_RE,"").trim();if(null==r?void 0:r.length)return r.split(/\s+/).filter((function(e){return O.VALID_CLASS_SELECTOR.test(e)&&!e.match(/[a-z][A-Z][a-z][A-Z]/)&&!e.match(/[0-9][0-9][0-9][0-9]/)})).sort()}}return[]}var L=function(){function e(e){var t;this.node=e,this.tagName=this.node.nodeName,this.name=this.tagName.toLowerCase(),this.id=(t=this.node).id&&O.VALID_ID_SELECTOR.test(t.id)?t.id:null,this.classList=C(this.node),this.guessListAndIndex()}return e.prototype.guessListAndIndex=function(){var e,t=this;this._tagList=(0,y.isListTag)(this.node);var n=(0,y.removeDiffTagOnHeadAndTail)((0,y.getChildren)(this.node.parentNode),this.node);if(this._tagList&&-1!==(o=n.filter((function(e){return e.tagName===t.tagName})).indexOf(this.node))&&(this._index=o+1),n.length>=3&&(null===(e=this.classList)||void 0===e?void 0:e.length)){for(var r=0,i=0,o=1;o<=n.length;o++){var a=n[o-1];if(a.tagName!==this.tagName){i=0;break}(0,b.arrayEquals)(this.classList,C(a))&&(i+=1),this.node===a&&(r=o)}3>i||(this._pseudoList=!0,this._index=this._index||r)}},Object.defineProperty(e.prototype,"path",{get:function(){var e;return this._path||(this._path="/".concat(this.name),this.id&&(this._path+="#".concat(this.id)),(null===(e=this.classList)||void 0===e?void 0:e.length)&&(this._path+=".".concat(this.classList.join(".")))),this._path},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pseudoList",{get:function(){return!!this._pseudoList},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"list",{get:function(){return!!this._tagList||!!this._pseudoList},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"index",{get:function(){var e;return null!==(e=(0,y.getMarkIndex)(this.node))&&void 0!==e?e:this._index},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"container",{get:function(){return(0,y.isContainerTag)(this.node)||this.list},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"parent",{get:function(){return this.node.parentNode?new e(this.node.parentNode):null},enumerable:!1,configurable:!0}),e.prototype.parentPaths=function(e){void 0===e&&(e=!1);for(var t=e?[this]:[],n=this.parent;n&&!(0,y.isRootNode)(n.node);)t.push(n),n=n.parent;return t},e}();_.default=L;var w={};Object.defineProperty(w,"__esModule",{value:!0}),w.getElementHref=w.getImgHref=w.getAnchorHref=void 0;var D=E;function P(e){if(e.hasAttribute("href")){var t=e.getAttribute("href");if(t&&0!==t.indexOf("javascript"))return(0,D.normalizePath)(t.slice(0,320))}}function x(e){if(e.src&&-1===e.src.indexOf("data:image"))return e.src}w.getAnchorHref=P,w.getImgHref=x,w.getElementHref=function(e){var t=e;if(t)switch(e.nodeName.toLowerCase()){case"a":return P(t);case"img":return x(t)}};var R={},A=s&&s.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(R,"__esModule",{value:!0}),R.getElementContent=R.getFormContent=void 0;var S=T,G=w,U=N,W=A(_),H=E,M=A(l),k=function(e){return e.htmlFor||e.getAttribute("for")},j=function(e){var t=e.getAttribute(U.GROWING_GTITLE)||e.getAttribute(U.GROWING_TITLE)||e.getAttribute(U.GROWING_TITLE_OLD)||e.getAttribute("title");return null==t?void 0:t.trim()};function B(e){var t=e.node;return e.list?X(t):(0,H.filterText)(t.textContent)||void 0}function X(e){for(var t=void 0,n=!1,r=0,i=(0,M.default)(e.childNodes);r-1?n.slice(0,r):n}}(t);case"svg":return function(e){for(var t=0,n=(0,M.default)(e.childNodes);t0)return n[n.length-1]}}(t);case"label":return B(a);case"input":return function(e){if((0,S.clickableInput)(e))return e.value;if("password"!==e.type&&(0,S.hasValidAttribute)(e,U.GROWING_TRACK))return e.value;if((0,S.changeableInput)(e)){var t=(0,S.findParent)(e,(function(e){return"LABEL"===e.nodeName}));if(!t&&e.id)for(var n=document.body.getElementsByTagName("label"),r=0;r0)return o+" ("+e.checked+")"}return e.value}}(t);case"select":return r=t,(0,M.default)(r.options).filter((function(e){return e.selected})).map((function(e){return e.label})).join(", ")||r.value;case"form":return V(t)}return(0,S.isLeaf)(t)?function(e){var t=(0,H.filterText)(e.textContent);if(t)return t}(t):(0,S.isParentOfLeaf)(t)&&!(0,S.onlyContainsIconChildren)(t)?function(e){for(var t="",n=0,r=(0,M.default)(e.childNodes);nn;n++)for(var i in t=arguments[n])({}).hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},ee.apply(this,arguments)},te=s&&s.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(m,"__esModule",{value:!0});var ne,re=N,ie=T,oe=te(I),ae=function(){function e(e,t,n){void 0===t&&(t=null),void 0===n&&(n=!0),this.origin=e,this.action=t,this.direct=n,this.target="self"===t?e:(0,ie.getEffectiveNode)(e),this.ignore=(0,ie.isIgnore)(this.target),this.vnode=new oe.default(this.target),this.tagName=this.vnode.tagName}return Object.defineProperty(e.prototype,"content",{get:function(){return this.vnode.content},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"href",{get:function(){return this.vnode.href},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"index",{get:function(){return this.vnode.index},enumerable:!1,configurable:!0}),e.prototype.inferParentIndex=function(){var t=this;return this.parentIndex||(0,ie.findParent)(this.target,(function(n){var r=new e(n,t.action,!1);r.traceable()&&r.index&&(t.parentIndex=r.index)})),this.parentIndex},Object.defineProperty(e.prototype,"xpath",{get:function(){return this.vnode.xpath},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fullXpath",{get:function(){return this.vnode.fullXpath},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"skeleton",{get:function(){return this.vnode.skeleton},enumerable:!1,configurable:!0}),e.prototype.info=function(e){return void 0===e&&(e=!0),e&&this.inferParentIndex(),{skeleton:this.skeleton,fullXpath:this.fullXpath,xpath:this.xpath,content:this.content,href:this.href,index:this.parentIndex||this.index}},e.prototype.traceable=function(){if(this.ignore)return!1;if(this.direct){if("click"===this.action||"hover"===this.action){if(-1!==re.UNSUPPORTED_CLICK_TAGS.indexOf(this.target.tagName))return!1;if("INPUT"===this.target.tagName&&!(0,ie.clickableInput)(this.target))return!1;if(!(0,ie.isContainerTag)(this.target)&&!(0,ie.depthInside)(this.target,5))return!1}return!0}return this.vnode.container},e.prototype.trackNodes=function(){if(!this.traceable())return[];var e=[this];if("submit"!==this.action)for(var t=this.parentElement;t;){if(t.ignore)return[];t.traceable()&&e.unshift(t),t=t.parentElement}var n=void 0;return e.map((function(e){var t=e.info(!1),r=t.index;return!n&&r&&(n=r),ee(ee({},t),{index:n||r})}))},Object.defineProperty(e.prototype,"parentElement",{get:function(){var t=this.target.parentNode;if(t&&t.nodeName&&!(0,ie.isRootNode)(t))return new e(t,this.action,!1)},enumerable:!1,configurable:!0}),e}(),ue=m.default=ae,se=["i","span","em","b","strong","svg"];!function(e){e[e.OUTER=0]="OUTER",e[e.INNER_COVERED=1]="INNER_COVERED",e[e.INNER_SHOW=2]="INNER_SHOW"}(ne||(ne={}));var le=function(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;o>i;i++)!r&&i in t||(r||(r=[].slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||[].slice.call(t))}(["HR","BR","SCRIPT","NOSCRIPT","STYLE","HEAD","BASE","LINK","META","TITLE","BODY","HTML","TEMPLATE","CODE"],N.UNSUPPORTED_CLICK_TAGS,!0),fe=["SELECT","A","BUTTON","INPUT","IMG","FORM"],de=function(e,t,n){return document.elementFromPoint(t,n)===e},ce=function(){function t(e,t,n){this.node=e,this.parentNodeDesc=t,this.devicesInfo=n,this.proxy=new ue(e),this.tagName=this.node.tagName,this.name=this.tagName.toLowerCase(),this.isIgnore=!!this.node.dataset.growingIgnore,this.isUnSupported=-1!==le.indexOf(this.tagName),this.rect=this.computeWindowRect()}return t.prototype.info=function(){var t=this.desc();t.zLevel+=this.devicesInfo.webviewZLevel;var n=this.getDeviceRect(this.rect);return p(t,"isContainer"),e(e(e({},t),n),{parentXPath:this.parentNodeDesc.isContainer?this.parentNodeDesc.xpath:void 0,href:this.proxy.href,content:this.proxy.content,nodeType:this.nodeType()})},t.prototype.nodeType=function(){return"input"!==this.name||T.changeableInput(this.node)?this.node.tagName:"INPUT_BTN"},t.prototype.desc=function(){return{index:this.parentNodeDesc.index||this.proxy.index,zLevel:this.zLevel(),xpath:this.proxy.fullXpath,isContainer:this.isDefinedContainer()}},t.prototype.cssVisible=function(){var e=this.computedStyle();return Number(e.opacity)>0&&"visible"===e.visibility&&"none"!==e.display},t.prototype.viewportStatus=function(){var e=this.rect,t=e.top,n=e.left,r=e.width,i=e.height,o=this.devicesInfo,a=o.winWidth,u=o.winHeight;if(0>=r||0>=i)return ne.OUTER;var s=this.node;return u>t&&a>n&&r>0&&i>0?de(s,n+r/2,t+i/2)||de(s,n+1,t+1)||de(s,n+r-1,t+1)||de(s,n+1,t+i-1)||de(s,n+r-1,t+i-1)?ne.INNER_SHOW:ne.INNER_COVERED:ne.OUTER},t.prototype.isCircleable=function(){return this.proxy.target===this.proxy.origin&&(!!this.isDefinedContainer()||!("input"===this.name&&this.node instanceof HTMLInputElement&&"password"===this.node.type)&&(-1!==fe.indexOf(this.name)||(T.isLeaf(this.node)?!this.isBigBlank():this.hasBackgroundImage()&&T.depthInside(this.node,4))))},t.prototype.isSimpleContainer=function(){return"select"===this.name||this.isDefaultContainer()&&(function(e,t){if(0===e.children.length)return!1;for(var n=0,r=h(e.children);n0)for(var n=0;nu>>1||o>s>>1)},t.prototype.hasBackgroundImage=function(){var e=this.computedStyle().backgroundImage;return!!e&&"none"!==e&&e.length>0},t.prototype.zLevel=function(){var e=this.computedStyle(),t=e.zIndex;if("auto"!==t)return Number(t||"0")+this.parentNodeDesc.zLevel;switch(e.position){case"relative":return this.parentNodeDesc.zLevel+2;case"sticky":return this.parentNodeDesc.zLevel+3;case"absolute":return this.parentNodeDesc.zLevel+4;case"fixed":return this.parentNodeDesc.zLevel+5;default:return this.parentNodeDesc.zLevel+1}},t.prototype.computeWindowRect=function(){if(this.rect)return this.rect;var e=this.node.getBoundingClientRect(),t=e.top,n=e.bottom,r=e.left,i=e.right-r,o=n-t;return 0>t?o=t+o:t+o>this.devicesInfo.winHeight&&(o=this.devicesInfo.winHeight-t),0>r?i=r+i:r+i>this.devicesInfo.winWidth&&(i=this.devicesInfo.winWidth-r),this.rect={top:t,left:r,width:i,height:o},this.rect},t.prototype.computedStyle=function(){return window.getComputedStyle(this.node)},t.prototype.getDeviceRect=function(e){var t=this.devicesInfo,n=t.scale,r=t.webviewTop,i=t.webviewLeft;return{top:e.top*n+r,left:e.left*n+i,width:e.width*n,height:e.height*n}},t}(),he=["DOMContentLoaded","onreadystatechange"],pe=["scroll","resize","load","beforeunload","popstate","hashchange","pagehide","unload"],ge=function(){function e(e){this.growingIO=e,this.addDomChangeListener()}return e.prototype.getDomTree=function(e,t,n,r,i,o){var a=function(e,t,n,r,i){var o=document.documentElement.clientWidth;return{winWidth:o,winHeight:document.documentElement.clientHeight,scale:n/o,webviewTop:t,webviewLeft:e,webviewWidth:n,webviewHeight:r,webviewZLevel:i}}(e,t,n,r,i),u=this.getElementsByParent(o||document.body,{isContainer:!1,zLevel:0},a),s=this.growingIO.dataStore.currentPage;return{page:{domain:s.domain,path:s.path,query:s.query,title:s.title},elements:u}},e.prototype.getElementsByParent=function(e,t,n){var r=this,i=[];return[].slice.call(e.childNodes,0).filter((function(e){return 1===e.nodeType})).forEach((function(e){var o=new ce(e,t,n);if(o.cssVisible()&&!o.isIgnore){switch(o.viewportStatus()){case ne.INNER_SHOW:o.isCircleable()&&i.push(o.info());break;case ne.INNER_COVERED:o.isDefaultContainer()&&i.push(o.info())}o.isSimpleContainer()||[].push.apply(i,r.getElementsByParent(e,o.desc(),n))}})),i},e.prototype.addDomChangeListener=function(){var e,t=function(t){return void 0===t&&(t=""),function(){var n;"beforeunload"===t&&e&&e.disconnect(),null===(n=window.GrowingWebViewJavascriptBridge)||void 0===n||n.onDomChanged()}};(e=new MutationObserver(t("mutation"))).observe(document.body,{attributes:!0,characterData:!0,childList:!0,subtree:!0}),he.forEach((function(e){v(document,e,t(e))})),pe.forEach((function(e){v(window,e,t(e))}))},e}(),ve={name:"gioHybridCircle",method:function(){function e(t){var n,r=this;this.growingIO=t,null===(n=this.growingIO.emitter)||void 0===n||n.on("SDK_INITIALIZED",(function(){if(window.GrowingWebViewJavascriptBridge){var t=r;window.GrowingWebViewJavascriptBridge.getDomTree=function(){if(arguments.length>=4)return e.bindGetDomTree(t.growingIO),e.domHelper.getDomTree.apply(e.domHelper,arguments)}}}))}return e.bindGetDomTree=function(e){this.domHelper||(this.domHelper=new ge(e),window.GrowingWebViewJavascriptBridge.getDomTree=this.domHelper.getDomTree.bind(this.domHelper))},e}()};export{ve as default}; diff --git a/plugins/gioImpressionTracking.js b/plugins/gioImpressionTracking.js index 2489e2c..8f3e4e8 100644 --- a/plugins/gioImpressionTracking.js +++ b/plugins/gioImpressionTracking.js @@ -1 +1 @@ -var t,r,e,n,i,o="function"==typeof Array.from?Array.from:(r||(r=1,e=function(t){return"function"==typeof t},n=function(t){var r=function(t){var r=Number(t);return isNaN(r)?0:0!==r&&isFinite(r)?(r>0?1:-1)*Math.floor(Math.abs(r)):r}(t);return Math.min(Math.max(r,0),9007199254740991)},i=function(t){var r=t.next();return!r.done&&r},t=function(t){var r,o,a,u=this,s=arguments.length>1?arguments[1]:void 0;if(void 0!==s){if(!e(s))throw new TypeError("Array.from: when provided, the second argument must be a function");arguments.length>2&&(r=arguments[2])}var c=function(t,r){if(null!=t&&null!=r){var n=t[r];if(null==n)return;if(!e(n))throw new TypeError(n+" is not a function");return n}}(t,function(t){if(null!=t){if(["string","number","boolean","symbol"].indexOf(typeof t)>-1)return Symbol.iterator;if("undefined"!=typeof Symbol&&"iterator"in Symbol&&Symbol.iterator in t)return Symbol.iterator;if("@@iterator"in t)return"@@iterator"}}(t));if(void 0!==c){o=e(u)?Object(new u):[];var l,f,v=c.call(t);if(null==v)throw new TypeError("Array.from requires an array-like or iterable object");for(a=0;;){if(!(l=i(v)))return o.length=a,o;f=l.value,o[a]=s?s.call(r,f,a):f,a++}}else{var d=Object(t);if(null==t)throw new TypeError("Array.from requires an array-like object - not null or undefined");var m,p=n(d.length);for(o=e(u)?Object(new u(p)):Array(p),a=0;p>a;)m=d[a],o[a]=s?s.call(r,m,a):m,a++;o.length=p}return o}),t),a=function(t){return l(["undefined","null"],b(t))},u=function(t){return"object"===b(t)&&!a(t)},s=function(t){return Array.isArray(t)&&"array"===b(t)},c=function(t){try{return f(t)[0]}catch(t){return}},l=function(t,r){return("array"===b(t)||"string"===b(t))&&t.indexOf(r)>=0},f=o,v=function(t){return a(t)?"":"".concat(t)},d=function(t){if("string"===b(t)){var r=function(t,r){return"string"==typeof t?t.split(""):t}(t);return"".concat(c(r).toLowerCase()).concat((e=r,void 0===n&&(n=1),s(e)&&function(t){return"number"===b(t)}(n)?e.slice(n>0?n:1,e.length):e).join(""))}var e,n;return t},m={}.hasOwnProperty,p=function(t,r){return!a(t)&&m.call(t,r)},g=function(t){return u(t)?Object.keys(t):[]},b=function(t){return{}.toString.call(t).slice(8,-1).toLowerCase()},I=function(){return I=Object.assign||function(t){for(var r,e=1,n=arguments.length;n>e;e++)for(var i in r=arguments[e])({}).hasOwnProperty.call(r,i)&&(t[i]=r[i]);return t},I.apply(this,arguments)},h=function(t){try{return t()}catch(t){return}},y=function(t){var r={};return u(t)&&function(t,e){g(t).forEach((function(e){return function(t,e){var n,i=v(e).slice(0,100);u(t)?r[i]=y(t):s(t)?(r[i]=t.slice(0,100),"cdp"===(null===(n=window.vds)||void 0===n?void 0:n.gioEnvironment)&&(r[i]=r[i].join("||").slice(0,1e3))):r[i]=a(t)?"":v(t).slice(0,1e3)}(t[e],e)}))}(t),r},O=function(t,r,e,n){void 0===n&&(n={}),document.addEventListener?t.addEventListener(r,e,I(I({},{capture:!0}),n)):t.attachEvent?t.attachEvent("on"+r,e):t["on"+r]=e},w={name:"gioImpressionTracking",method:function(t){var r,e=this;this.growingIO=t,this.documentReady=!1,this.main=function(t){"listener"===t?(e.documentReady=!0,e.growingIO.gioSDKInitialized&&e.initMutationObserver()):"emitter"===t&&e.documentReady&&e.initMutationObserver()},this.initIntersectionObserver=function(){e.intersectionObserver=new IntersectionObserver((function(t){var r;(s(r=t)?0===r.length:u(r)?0===g(r).length:!r)||t.map((function(t){var r=t.target,n=r.dataset,i=r.id;if(t.intersectionRatio>0){var o=e.getImpressionProperties(n),a=o.eventId,u=o.properties,s=o.items;if(i){if("once"===n.gioImpType&&p(e.sentImps,i))return;e.sentImps[i]={eventId:a,properties:u,items:s}}a&&e.growingIO.track(a,u,s)}}))}))},this.initMutationObserver=function(){var t;e.mutationObserver&&(null===(t=e.mutationObserver)||void 0===t||t.disconnect());var r=document.querySelectorAll("[data-gio-imp-track]");f(r).map((function(t){var r;null===(r=e.intersectionObserver)||void 0===r||r.observe(t)})),e.mutationObserver=new MutationObserver((function(t){t.map((function(t){var r,n;"attributes"===t.type&&(null===(r=t.target.dataset)||void 0===r?void 0:r.gioImpTrack)&&(null===(n=e.intersectionObserver)||void 0===n||n.observe(t.target))}))})),e.mutationObserver.observe(document.body,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0,attributeFilter:["data-gio-imp-track","data-gio-imp-attrs","data-gio-imp-items",/^data-gio-track-[a-z]+$/i]})},this.getImpressionProperties=function(t){var r={eventId:void 0,properties:{}};if(!(null==t?void 0:t.gioImpTrack))return r;if(r.eventId=t.gioImpTrack,p(t,"gioImpAttrs"))r.properties=h((function(){return u(t.gioImpAttrs)?t.gioImpAttrs:JSON.parse(t.gioImpAttrs)})),r.items=h((function(){return u(t.gioImpItems)?t.gioImpItems:JSON.parse(t.gioImpItems)}));else{var e=/^gioTrack(.+)/;for(var n in t){var i=void 0,o=n.match(e);o&&"track"!==(i=d(o[1]))&&(r.properties[i]=t[n])}}return r.properties=y(r.properties),r.items=y(r.items),/^\w+$/.test(r.eventId)&&!Number.isInteger(Number(c(r.eventId.split(""))))||(r.eventId=null,r={}),r},this.sentImps={},window.IntersectionObserver&&window.MutationObserver?(this.initIntersectionObserver(),O(document,"readystatechange",(function(){l(["interactive","complete"],document.readyState)&&e.main("listener")}),{once:!0}),null===(r=this.growingIO.emitter)||void 0===r||r.on("SDK_INITIALIZED",(function(){return e.main("emitter")})),O(window,"unload",(function(){var t,r;null===(t=e.intersectionObserver)||void 0===t||t.disconnect(),null===(r=e.mutationObserver)||void 0===r||r.disconnect()}))):("warn",console.log("%c [GrowingIO]:当前浏览器不支持半自动埋点,gioImpressionTracking已自动关闭!","color: #F59E0B;"))}};export{w as default}; +var t,r,e,n,i,o="function"==typeof Array.from?Array.from:(r||(r=1,e=function(t){return"function"==typeof t},n=function(t){var r=function(t){var r=Number(t);return isNaN(r)?0:0!==r&&isFinite(r)?(r>0?1:-1)*Math.floor(Math.abs(r)):r}(t);return Math.min(Math.max(r,0),9007199254740991)},i=function(t){var r=t.next();return!r.done&&r},t=function(t){var r,o,a,u=this,s=arguments.length>1?arguments[1]:void 0;if(void 0!==s){if(!e(s))throw new TypeError("Array.from: when provided, the second argument must be a function");arguments.length>2&&(r=arguments[2])}var c=function(t,r){if(null!=t&&null!=r){var n=t[r];if(null==n)return;if(!e(n))throw new TypeError(n+" is not a function");return n}}(t,function(t){if(null!=t){if(["string","number","boolean","symbol"].indexOf(typeof t)>-1)return Symbol.iterator;if("undefined"!=typeof Symbol&&"iterator"in Symbol&&Symbol.iterator in t)return Symbol.iterator;if("@@iterator"in t)return"@@iterator"}}(t));if(void 0!==c){o=e(u)?Object(new u):[];var l,f,v=c.call(t);if(null==v)throw new TypeError("Array.from requires an array-like or iterable object");for(a=0;;){if(!(l=i(v)))return o.length=a,o;f=l.value,o[a]=s?s.call(r,f,a):f,a++}}else{var d=Object(t);if(null==t)throw new TypeError("Array.from requires an array-like object - not null or undefined");var m,p=n(d.length);for(o=e(u)?Object(new u(p)):Array(p),a=0;p>a;)m=d[a],o[a]=s?s.call(r,m,a):m,a++;o.length=p}return o}),t),a=function(t){return l(["undefined","null"],b(t))},u=function(t){return"object"===b(t)&&!a(t)},s=function(t){return Array.isArray(t)&&"array"===b(t)},c=function(t){try{return f(t)[0]}catch(t){return}},l=function(t,r){return("array"===b(t)||"string"===b(t))&&t.indexOf(r)>=0},f=o,v=function(t){return a(t)?"":"".concat(t)},d=function(t){if("string"===b(t)){var r=function(t,r){return"string"==typeof t?t.split(""):t}(t);return"".concat(c(r).toLowerCase()).concat((e=r,void 0===n&&(n=1),s(e)&&function(t){return"number"===b(t)}(n)?e.slice(n>0?n:1,e.length):e).join(""))}var e,n;return t},m={}.hasOwnProperty,p=function(t,r){return!a(t)&&m.call(t,r)},g=function(t){return u(t)?Object.keys(t):[]},b=function(t){return{}.toString.call(t).slice(8,-1).toLowerCase()},y=function(){return y=Object.assign||function(t){for(var r,e=1,n=arguments.length;n>e;e++)for(var i in r=arguments[e])({}).hasOwnProperty.call(r,i)&&(t[i]=r[i]);return t},y.apply(this,arguments)};"function"==typeof SuppressedError&&SuppressedError;var I=function(t){try{return t()}catch(t){return}},h=function(t){var r={};return u(t)&&function(t,e){g(t).forEach((function(e){return function(t,e){var n,i=v(e).slice(0,100);u(t)?r[i]=h(t):s(t)?(r[i]=t.slice(0,100),"cdp"===(null===(n=window.vds)||void 0===n?void 0:n.gioEnvironment)&&(r[i]=r[i].join("||").slice(0,1e3))):r[i]=a(t)?"":v(t).slice(0,1e3)}(t[e],e)}))}(t),r},O=function(t,r,e,n){void 0===n&&(n={}),document.addEventListener?t.addEventListener(r,e,y(y({},{capture:!0}),n)):t.attachEvent?t.attachEvent("on"+r,e):t["on"+r]=e},w={name:"gioImpressionTracking",method:function(t){var r,e=this;this.growingIO=t,this.documentReady=!1,this.main=function(t){"listener"===t?(e.documentReady=!0,e.growingIO.gioSDKInitialized&&e.initMutationObserver()):"emitter"===t&&e.documentReady&&e.initMutationObserver()},this.initIntersectionObserver=function(){e.intersectionObserver=new IntersectionObserver((function(t){var r;(s(r=t)?0===r.length:u(r)?0===g(r).length:!r)||t.map((function(t){var r=t.target,n=r.dataset,i=r.id;if(t.intersectionRatio>0){var o=e.getImpressionProperties(n),a=o.eventId,u=o.properties,s=o.items;if(i){if("once"===n.gioImpType&&p(e.sentImps,i))return;e.sentImps[i]={eventId:a,properties:u,items:s}}a&&e.growingIO.track(a,u,s)}}))}))},this.initMutationObserver=function(){var t;e.mutationObserver&&(null===(t=e.mutationObserver)||void 0===t||t.disconnect());var r=document.querySelectorAll("[data-gio-imp-track]");f(r).map((function(t){var r;null===(r=e.intersectionObserver)||void 0===r||r.observe(t)})),e.mutationObserver=new MutationObserver((function(t){t.map((function(t){var r,n;"attributes"===t.type&&(null===(r=t.target.dataset)||void 0===r?void 0:r.gioImpTrack)&&(null===(n=e.intersectionObserver)||void 0===n||n.observe(t.target))}))})),e.mutationObserver.observe(document.body,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0,attributeFilter:["data-gio-imp-track","data-gio-imp-attrs","data-gio-imp-items",/^data-gio-track-[a-z]+$/i]})},this.getImpressionProperties=function(t){var r={eventId:void 0,properties:{}};if(!(null==t?void 0:t.gioImpTrack))return r;if(r.eventId=t.gioImpTrack,p(t,"gioImpAttrs"))r.properties=I((function(){return u(t.gioImpAttrs)?t.gioImpAttrs:JSON.parse(t.gioImpAttrs)})),r.items=I((function(){return u(t.gioImpItems)?t.gioImpItems:JSON.parse(t.gioImpItems)}));else{var e=/^gioTrack(.+)/;for(var n in t){var i=void 0,o=n.match(e);o&&"track"!==(i=d(o[1]))&&(r.properties[i]=t[n])}}return r.properties=h(r.properties),r.items=h(r.items),/^\w+$/.test(r.eventId)&&!Number.isInteger(Number(c(r.eventId.split(""))))||(r.eventId=null,r={}),r},this.sentImps={},window.IntersectionObserver&&window.MutationObserver?(this.initIntersectionObserver(),O(document,"readystatechange",(function(){l(["interactive","complete"],document.readyState)&&e.main("listener")}),{once:!0}),null===(r=this.growingIO.emitter)||void 0===r||r.on("SDK_INITIALIZED",(function(){return e.main("emitter")})),O(window,"unload",(function(){var t,r;null===(t=e.intersectionObserver)||void 0===t||t.disconnect(),null===(r=e.mutationObserver)||void 0===r||r.disconnect()}))):("warn",console.log("%c [GrowingIO]:当前浏览器不支持半自动埋点,gioImpressionTracking已自动关闭!","color: #F59E0B;"))}};export{w as default}; diff --git a/plugins/umd/gioCustomTracking.js b/plugins/umd/gioCustomTracking.js index b7a1240..2cb478a 100644 --- a/plugins/umd/gioCustomTracking.js +++ b/plugins/umd/gioCustomTracking.js @@ -1 +1 @@ -!function(t){"function"==typeof define&&define.amd?define(t):t()}((function(){"use strict";var t=function(){return t=Object.assign||function(t){for(var n,e=1,r=arguments.length;r>e;e++)for(var i in n=arguments[e])({}).hasOwnProperty.call(n,i)&&(t[i]=n[i]);return t},t.apply(this,arguments)},n=function(t){return o(["undefined","null"],s(t))},e=function(t){return"string"===s(t)},r=function(t){return"object"===s(t)&&!n(t)},i=function(t){return Array.isArray(t)&&"array"===s(t)},o=function(t,n){return("array"===s(t)||"string"===s(t))&&t.indexOf(n)>=0},u=function(t){return n(t)?"":"".concat(t)},c=function(t){return r(t)?Object.keys(t):[]},a=function(t,n){if(!r(t))return!1;try{return"string"===s(n)?delete t[n]:"array"===s(n)?n.map((function(n){return delete t[n]})):(function(t){return"regexp"===s(t)}(n)&&c(t).forEach((function(e){n.test(e)&&a(t,e)})),!0)}catch(t){return!1}},f=function(t){return i(t)?0===t.length:r(t)?0===c(t).length:!t},s=function(t){return{}.toString.call(t).slice(8,-1).toLowerCase()},d=function(t){var e={};return r(t)&&function(t,o){c(t).forEach((function(o){return function(t,o){var c,a=u(o).slice(0,100);r(t)?e[a]=d(t):i(t)?(e[a]=t.slice(0,100),"cdp"===(null===(c=window.vds)||void 0===c?void 0:c.gioEnvironment)&&(e[a]=e[a].join("||").slice(0,1e3))):e[a]=n(t)?"":u(t).slice(0,1e3)}(t[o],o)}))}(t),e};window.gioCustomTracking={name:"gioCustomTracking",method:function(l){var g=this;this.growingIO=l,this.getValidResourceItem=function(t){if(t&&r(t)&&t.id&&t.key){var n={id:e(t.id)?t.id:u(t.id),key:e(t.key)?t.key:u(t.key)};return t.attributes&&(n.attributes=t.attributes),n}},this.getDynamicAttributes=function(t){return n(t)||c(t).forEach((function(n){var e;e=t[n],o(["function","asyncfunction"],s(e))?t[n]=t[n]():r(t[n])?a(t,n):i(t[n])||(t[n]=u(t[n]))})),t},this.buildCustomEvent=function(n,i,o,u){var c,a;a=function(){var e=g.growingIO.dataStore,c=e.eventContextBuilder,a=e.eventConverter,s=e.currentPage,l=t({eventType:"CUSTOM",eventName:n,pageShowTimestamp:null==s?void 0:s.time,attributes:d(g.getDynamicAttributes(r(i)&&!f(i)?i:void 0)),resourceItem:d(g.getValidResourceItem(o))},c());f(u)||(l=t(t({},l),u)),a(l)},e(c=n)&&!f(c)&&c.match(/^[a-zA-Z_][0-9a-zA-Z_]{0,100}$/)?a():console.log("%c [GrowingIO]:事件名格式不正确,只能包含数字、字母和下划线,且不能以数字开头,字符总长度不能超过100!","color: #EF4444;")},this.buildUserAttributesEvent=function(n,e){var r=g.growingIO.dataStore,i=r.eventContextBuilder,o=r.eventConverter,u=t({eventType:"LOGIN_USER_ATTRIBUTES",attributes:d(n)},i());f(e)||(u=t(t({},u),e)),o(u)}}}})); +!function(t){"function"==typeof define&&define.amd?define(t):t()}((function(){"use strict";var t=function(){return t=Object.assign||function(t){for(var n,e=1,r=arguments.length;r>e;e++)for(var i in n=arguments[e])({}).hasOwnProperty.call(n,i)&&(t[i]=n[i]);return t},t.apply(this,arguments)};"function"==typeof SuppressedError&&SuppressedError;var n=function(t){return o(["undefined","null"],f(t))},e=function(t){return"string"===f(t)},r=function(t){return"object"===f(t)&&!n(t)},i=function(t){return Array.isArray(t)&&"array"===f(t)},o=function(t,n){return("array"===f(t)||"string"===f(t))&&t.indexOf(n)>=0},u=function(t){return n(t)?"":"".concat(t)},c=function(t){return r(t)?Object.keys(t):[]},a=function(t,n){if(!r(t))return!1;try{return"string"===f(n)?delete t[n]:"array"===f(n)?n.map((function(n){return delete t[n]})):(function(t){return"regexp"===f(t)}(n)&&c(t).forEach((function(e){n.test(e)&&a(t,e)})),!0)}catch(t){return!1}},s=function(t){return i(t)?0===t.length:r(t)?0===c(t).length:!t},f=function(t){return{}.toString.call(t).slice(8,-1).toLowerCase()},d=function(t){var e={};return r(t)&&function(t,o){c(t).forEach((function(o){return function(t,o){var c,a=u(o).slice(0,100);r(t)?e[a]=d(t):i(t)?(e[a]=t.slice(0,100),"cdp"===(null===(c=window.vds)||void 0===c?void 0:c.gioEnvironment)&&(e[a]=e[a].join("||").slice(0,1e3))):e[a]=n(t)?"":u(t).slice(0,1e3)}(t[o],o)}))}(t),e};window.gioCustomTracking={name:"gioCustomTracking",method:function(l){var v=this;this.growingIO=l,this.getValidResourceItem=function(t){if(t&&r(t)&&t.id&&t.key){var n={id:e(t.id)?t.id:u(t.id),key:e(t.key)?t.key:u(t.key)};return t.attributes&&(n.attributes=t.attributes),n}},this.getDynamicAttributes=function(t){return n(t)||c(t).forEach((function(n){var e;e=t[n],o(["function","asyncfunction"],f(e))?t[n]=t[n]():r(t[n])?a(t,n):i(t[n])||(t[n]=u(t[n]))})),t},this.buildCustomEvent=function(n,i,o,u){var c,a;a=function(){var e=v.growingIO.dataStore,c=e.eventContextBuilder,a=e.eventConverter,f=e.currentPage,l=t({eventType:"CUSTOM",eventName:n,pageShowTimestamp:null==f?void 0:f.time,attributes:d(v.getDynamicAttributes(r(i)&&!s(i)?i:void 0)),resourceItem:d(v.getValidResourceItem(o))},c());s(u)||(l=t(t({},l),u)),a(l)},e(c=n)&&!s(c)&&c.match(/^[a-zA-Z_][0-9a-zA-Z_]{0,100}$/)?a():console.log("%c [GrowingIO]:事件名格式不正确,只能包含数字、字母和下划线,且不能以数字开头,字符总长度不能超过100!","color: #EF4444;")},this.buildUserAttributesEvent=function(n,e){var r=v.growingIO.dataStore,i=r.eventContextBuilder,o=r.eventConverter,u=t({eventType:"LOGIN_USER_ATTRIBUTES",attributes:d(n)},i());s(e)||(u=t(t({},u),e)),o(u)}}}})); diff --git a/plugins/umd/gioEmbeddedAdapter.js b/plugins/umd/gioEmbeddedAdapter.js index 841b7df..08513a3 100644 --- a/plugins/umd/gioEmbeddedAdapter.js +++ b/plugins/umd/gioEmbeddedAdapter.js @@ -1 +1 @@ -!function(e){"function"==typeof define&&define.amd?define(e):e()}((function(){"use strict";function e(e,o,i){if(i||2===arguments.length)for(var n,t=0,r=o.length;r>t;t++)!n&&t in o||(n||(n=[].slice.call(o,0,t)),n[t]=o[t]);return e.concat(n||[].slice.call(o))}var o=function(e){return n(["undefined","null"],g(e))},i=function(e){return"object"===g(e)&&!o(e)},n=function(e,o){return("array"===g(e)||"string"===g(e))&&e.indexOf(o)>=0},t={}.hasOwnProperty,r=function(e,i){return!o(e)&&t.call(e,i)},a=function(e){return i(e)?Object.keys(e):[]},g=function(e){return{}.toString.call(e).slice(8,-1).toLowerCase()},c={},s={}.hasOwnProperty;function d(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(e){return null}}function l(e){try{return encodeURIComponent(e)}catch(e){return null}}c.stringify=function(e,o){o=o||"";var i,n,t=[];for(n in"string"!=typeof o&&(o="?"),e)if(s.call(e,n)){if((i=e[n])||null!=i&&!isNaN(i)||(i=""),n=l(n),i=l(i),null===n||null===i)continue;t.push(n+"="+i)}return t.length?o+t.join("&"):""},c.parse=function(e){for(var o,i=/([^=?#&]+)=?([^&]*)/g,n={};o=i.exec(e);){var t=d(o[1]),r=d(o[2]);null===t||null===r||t in n||(n[t]=r)}return n};var u={gioprojectid:"projectId",giodatacollect:"dataCollect",gioappid:"domain",giodatasourceid:"dataSourceId",gios:"sessionId",giou:"uid",giocs1:"userId",gioid:"gioId",giouserkey:"userKey",gioappchannel:"appChannel",giodevicebrand:"deviceBrand",giodevicemodel:"deviceModel",giodevicetype:"deviceType",giolanguage:"language",gionetworkstate:"networkState",giooperatingsystem:"operatingSystem",gioplatform:"platform",gioplatformversion:"platformVersion",gioscreenheight:"screenHeight",gioscreenwidth:"screenWidth"},f=["giodatasourceid","gioplatform","gioappchannel","giodevicebrand","giodevicemodel","giodevicetype","giolanguage","gionetworkstate","giooperatingsystem","gioplatformversion","gioscreenheight","gioscreenwidth"],h=["giocs1","gios","giou","gioid","giouserkey"],p="gio_search_cookie_gioenc";window.gioEmbeddedAdapter={name:"gioEmbeddedAdapter",method:function(o){var t=this;this.growingIO=o,this.main=function(){var e,o,s=t.growingIO.vdsConfig,d=s.projectId,l=s.appId,w=t.getGQS(),I=!1;return"none"!==t.qsFrom&&w.gioprojectid===d&&w.gioappid===l&&((function(e){return Array.isArray(e)&&"array"===g(e)}(o=w)?0!==o.length:i(o)?0!==a(o).length:o)?t.growingIO.storage.setItem(p,c.stringify(w)):t.growingIO.storage.removeItem(p),r(w,"giodatacollect")&&(t.growingIO.vdsConfig.dataCollect=n(["true",!0],w.giodatacollect)),null===(e=t.growingIO.emitter)||void 0===e||e.on("SDK_INITIALIZED",(function(){var e=t.growingIO,o=e.userStore,i=e.vdsConfig.sessionExpires,n=e.dataStore.eventContextBuilderInst;h.forEach((function(e){var i;o[u[e]]=null!==(i=w[e])&&void 0!==i?i:""})),window.setInterval((function(){o.sessionId=w.gios}),.8*i*60*1e3),f.forEach((function(e){r(w,e)&&(n.minpExtraParams[u[e]]=w[e])}))})),t.growingIO.setUserId=function(){},t.growingIO.clearUserId=function(){},r(w,"giodatacollect")&&(t.growingIO.setDataCollect=function(){},t.growingIO.setOption=function(){}),I=!0),t.gioURLRewrite(),I},this.getGQS=function(){var o=t.growingIO.vdsConfig.hashtag,i=t.growingIO.storage.getItem(p),g=window.location.search,s=window.location.hash,d=o?s.substring(s.indexOf("?")+1):"",l=c.parse(g),u=c.parse(d),w=c.parse((i||"").replace("gioenc-","")),I={};if(r(l,"gioprojectid"))I=l,t.qsFrom="search";else if(r(u,"gioprojectid"))I=u,t.qsFrom="hash";else{if(!r(w,"gioprojectid"))return t.qsFrom="none",{};I=w,t.qsFrom="cookie"}var m={},v={},y=e(e(["gioappid","gioprojectid","giodatacollect"],h,!0),f,!0);return a(I).forEach((function(e){var o=e.toLowerCase();n(y,o)?n(["","undefined","null",void 0,null],I[e])||(m[o]=I[e],n(["true","TRUE",!0],I[e])&&(m[o]=!0),n(["false","FALSE",!1],I[e])&&(m[o]=!1)):v[e]=I[e]})),t.gqs=m,t.ngqs=v,m},this.gioURLRewrite=function(){var e=t.growingIO.vdsConfig.hashtag,o=window.location.search,i=window.location.hash,n=!1;if("search"===t.qsFrom&&(o=c.stringify(t.ngqs,!0),n=!0),e&&"hash"===t.qsFrom&&(i="".concat(i.split("?")[0]).concat(c.stringify(t.ngqs,!0)),n=!0),n){var r="".concat(window.location.pathname).concat(o||"").concat(i||"");window.history.replaceState(null,document.title,r)}},this.gqs={},this.ngqs={},this.qsFrom="search",this.growingIO.emitter.on("OPTION_INITIALIZED",(function(){t.growingIO.useEmbeddedInherit=t.main()}))}}})); +!function(e){"function"==typeof define&&define.amd?define(e):e()}((function(){"use strict";function e(e,o,i){if(i||2===arguments.length)for(var n,t=0,r=o.length;r>t;t++)!n&&t in o||(n||(n=[].slice.call(o,0,t)),n[t]=o[t]);return e.concat(n||[].slice.call(o))}"function"==typeof SuppressedError&&SuppressedError;var o=function(e){return n(["undefined","null"],g(e))},i=function(e){return"object"===g(e)&&!o(e)},n=function(e,o){return("array"===g(e)||"string"===g(e))&&e.indexOf(o)>=0},t={}.hasOwnProperty,r=function(e,i){return!o(e)&&t.call(e,i)},a=function(e){return i(e)?Object.keys(e):[]},g=function(e){return{}.toString.call(e).slice(8,-1).toLowerCase()},c={},s={}.hasOwnProperty;function d(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(e){return null}}function l(e){try{return encodeURIComponent(e)}catch(e){return null}}c.stringify=function(e,o){o=o||"";var i,n,t=[];for(n in"string"!=typeof o&&(o="?"),e)if(s.call(e,n)){if((i=e[n])||null!=i&&!isNaN(i)||(i=""),n=l(n),i=l(i),null===n||null===i)continue;t.push(n+"="+i)}return t.length?o+t.join("&"):""},c.parse=function(e){for(var o,i=/([^=?#&]+)=?([^&]*)/g,n={};o=i.exec(e);){var t=d(o[1]),r=d(o[2]);null===t||null===r||t in n||(n[t]=r)}return n};var u={gioprojectid:"projectId",giodatacollect:"dataCollect",gioappid:"domain",giodatasourceid:"dataSourceId",gios:"sessionId",giou:"uid",giocs1:"userId",gioid:"gioId",giouserkey:"userKey",gioappchannel:"appChannel",giodevicebrand:"deviceBrand",giodevicemodel:"deviceModel",giodevicetype:"deviceType",giolanguage:"language",gionetworkstate:"networkState",giooperatingsystem:"operatingSystem",gioplatform:"platform",gioplatformversion:"platformVersion",gioscreenheight:"screenHeight",gioscreenwidth:"screenWidth"},f=["giodatasourceid","gioplatform","gioappchannel","giodevicebrand","giodevicemodel","giodevicetype","giolanguage","gionetworkstate","giooperatingsystem","gioplatformversion","gioscreenheight","gioscreenwidth"],p=["giocs1","gios","giou","gioid","giouserkey"],h="gio_search_cookie_gioenc";window.gioEmbeddedAdapter={name:"gioEmbeddedAdapter",method:function(o){var t=this;this.growingIO=o,this.main=function(){var e,o,s=t.growingIO.vdsConfig,d=s.projectId,l=s.appId,w=t.getGQS(),I=!1;return"none"!==t.qsFrom&&w.gioprojectid===d&&w.gioappid===l&&((function(e){return Array.isArray(e)&&"array"===g(e)}(o=w)?0!==o.length:i(o)?0!==a(o).length:o)?t.growingIO.storage.setItem(h,c.stringify(w)):t.growingIO.storage.removeItem(h),r(w,"giodatacollect")&&(t.growingIO.vdsConfig.dataCollect=n(["true",!0],w.giodatacollect)),null===(e=t.growingIO.emitter)||void 0===e||e.on("SDK_INITIALIZED",(function(){var e=t.growingIO,o=e.userStore,i=e.vdsConfig.sessionExpires,n=e.dataStore.eventContextBuilderInst;p.forEach((function(e){var i;o[u[e]]=null!==(i=w[e])&&void 0!==i?i:""})),window.setInterval((function(){o.sessionId=w.gios}),.8*i*60*1e3),f.forEach((function(e){r(w,e)&&(n.minpExtraParams[u[e]]=w[e])}))})),t.growingIO.setUserId=function(){},t.growingIO.clearUserId=function(){},r(w,"giodatacollect")&&(t.growingIO.setDataCollect=function(){},t.growingIO.setOption=function(){}),I=!0),t.gioURLRewrite(),I},this.getGQS=function(){var o=t.growingIO.vdsConfig.hashtag,i=t.growingIO.storage.getItem(h),g=window.location.search,s=window.location.hash,d=o?s.substring(s.indexOf("?")+1):"",l=c.parse(g),u=c.parse(d),w=c.parse((i||"").replace("gioenc-","")),I={};if(r(l,"gioprojectid"))I=l,t.qsFrom="search";else if(r(u,"gioprojectid"))I=u,t.qsFrom="hash";else{if(!r(w,"gioprojectid"))return t.qsFrom="none",{};I=w,t.qsFrom="cookie"}var m={},v={},y=e(e(["gioappid","gioprojectid","giodatacollect"],p,!0),f,!0);return a(I).forEach((function(e){var o=e.toLowerCase();n(y,o)?n(["","undefined","null",void 0,null],I[e])||(m[o]=I[e],n(["true","TRUE",!0],I[e])&&(m[o]=!0),n(["false","FALSE",!1],I[e])&&(m[o]=!1)):v[e]=I[e]})),t.gqs=m,t.ngqs=v,m},this.gioURLRewrite=function(){var e=t.growingIO.vdsConfig.hashtag,o=window.location.search,i=window.location.hash,n=!1;if("search"===t.qsFrom&&(o=c.stringify(t.ngqs,!0),n=!0),e&&"hash"===t.qsFrom&&(i="".concat(i.split("?")[0]).concat(c.stringify(t.ngqs,!0)),n=!0),n){var r="".concat(window.location.pathname).concat(o||"").concat(i||"");window.history.replaceState(null,document.title,r)}},this.gqs={},this.ngqs={},this.qsFrom="search",this.growingIO.emitter.on("OPTION_INITIALIZED",(function(){t.growingIO.useEmbeddedInherit=t.main()}))}}})); diff --git a/plugins/umd/gioEventAutoTracking.js b/plugins/umd/gioEventAutoTracking.js index 358d045..ba3133e 100644 --- a/plugins/umd/gioEventAutoTracking.js +++ b/plugins/umd/gioEventAutoTracking.js @@ -1 +1 @@ -!function(e){"function"==typeof define&&define.amd?define(e):e()}((function(){"use strict";var e=function(){return e=Object.assign||function(e){for(var t,n=1,r=arguments.length;r>n;n++)for(var i in t=arguments[n])({}).hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},e.apply(this,arguments)};function t(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;o>i;i++)!r&&i in t||(r||(r=[].slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||[].slice.call(t))}location.protocol.indexOf("http")>-1&&location.protocol.replace(":","");var n=["clearUserId","getGioInfo","getLocation","getOption","init","setDataCollect","setOption","setUserId","track","setGeneralProps","clearGeneralProps"];t(t([],n,!0),["setEvar","setPage","setUser","setVisitor"],!1),t(t([],n,!0),["enableDebug","enableHT","setAutotrack","setTrackerHost","setTrackerScheme","setUserAttributes","getVisitorId","getDeviceId","registerPlugins","getPlugins","sendPage","sendVisit","trackTimerStart","trackTimerPause","trackTimerResume","trackTimerEnd","removeTimer","clearTrackTimer","updateImpression"],!1);var r,i,o,a,u,l={click:"VIEW_CLICK",change:"VIEW_CHANGE",submit:"FORM_SUBMIT"},f="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},c="function"==typeof Array.from?Array.from:(i||(i=1,o=function(e){return"function"==typeof e},a=function(e){var t=function(e){var t=Number(e);return isNaN(t)?0:0!==t&&isFinite(t)?(t>0?1:-1)*Math.floor(Math.abs(t)):t}(e);return Math.min(Math.max(t,0),9007199254740991)},u=function(e){var t=e.next();return!t.done&&t},r=function(e){var t,n,r,i=this,l=arguments.length>1?arguments[1]:void 0;if(void 0!==l){if(!o(l))throw new TypeError("Array.from: when provided, the second argument must be a function");arguments.length>2&&(t=arguments[2])}var f=function(e,t){if(null!=e&&null!=t){var n=e[t];if(null==n)return;if(!o(n))throw new TypeError(n+" is not a function");return n}}(e,function(e){if(null!=e){if(["string","number","boolean","symbol"].indexOf(typeof e)>-1)return Symbol.iterator;if("undefined"!=typeof Symbol&&"iterator"in Symbol&&Symbol.iterator in e)return Symbol.iterator;if("@@iterator"in e)return"@@iterator"}}(e));if(void 0!==f){n=o(i)?Object(new i):[];var c,s,d=f.call(e);if(null==d)throw new TypeError("Array.from requires an array-like or iterable object");for(r=0;;){if(!(c=u(d)))return n.length=r,n;s=c.value,n[r]=l?l.call(t,s,r):s,r++}}else{var h=Object(e);if(null==e)throw new TypeError("Array.from requires an array-like object - not null or undefined");var g,p=a(h.length);for(n=o(i)?Object(new i(p)):Array(p),r=0;p>r;)g=h[r],n[r]=l?l.call(t,g,r):g,r++;n.length=p}return n}),r),s=function(e){return"object"===_(e)&&!function(e){return h(["undefined","null"],_(e))}(e)},d=function(e){try{var t=g(e);return t[t.length-1]}catch(e){return}},h=function(e,t){return("array"===_(e)||"string"===_(e))&&e.indexOf(t)>=0},g=c,p=function(e,t){return"string"===_(e)&&e.slice(0,t.length)===t},v=function(e){return function(e){return Array.isArray(e)&&"array"===_(e)}(e)?0===e.length:s(e)?0===function(e){return s(e)?Object.keys(e):[]}(e).length:!e},_=function(e){return{}.toString.call(e).slice(8,-1).toLowerCase()},m=function(t,n,r,i){void 0===i&&(i={}),document.addEventListener?t.addEventListener(n,r,e(e({},{capture:!0}),i)):t.attachEvent?t.attachEvent("on"+n,r):t["on"+n]=r},T={},N={};!function(e){var t=f&&f.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;o>i;i++)!r&&i in t||(r||(r=[].slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||[].slice.call(t))};Object.defineProperty(e,"__esModule",{value:!0}),e.GROWING_TITLE_OLD=e.GROWING_TITLE=e.GROWING_GTITLE=e.GROWING_CDP_INDEX=e.GROWING_INDEX_OLD=e.GROWING_INDEX=e.GROWING_CONTAINER=e.GROWING_TRACK=e.GROWING_IGNORE=e.VALID_CLASS_SELECTOR=e.VALID_ID_SELECTOR=e.EXCLUDE_CLASS_RE=e.UNSUPPORTED_TAGS=e.TEXT_NODE=e.UNSUPPORTED_CLICK_TAGS=e.SUPPORTED_ICON_TAGS=e.SUPPORTED_CHANGE_TYPES=e.SUPPORTED_CLICK_INPUT_TYPES=e.SUPPORTED_CONTAINER_TAGS=e.LIST_TAGS=void 0,e.LIST_TAGS=["TR","LI","DL"],e.SUPPORTED_CONTAINER_TAGS=t(["A","BUTTON"],e.LIST_TAGS,!0),e.SUPPORTED_CLICK_INPUT_TYPES=["button","submit","reset"],e.SUPPORTED_CHANGE_TYPES=["radio","checkbox","search"],e.SUPPORTED_ICON_TAGS=["I","EM","svg","IMG"],e.UNSUPPORTED_CLICK_TAGS=["TEXTAREA","HTML","BODY"],e.TEXT_NODE=["I","SPAN","EM","B","STRONG"],e.UNSUPPORTED_TAGS=["tspan","text","g","rect","path","defs","clippath","desc","title","math","use"],e.EXCLUDE_CLASS_RE=/(^| |[^ ]+\-)(clear|clearfix|active|hover|enabled|current|selected|unselected|hidden|display|focus|disabled|undisabled|open|checked|unchecked|undefined|null|ng-|growing-)[^\. ]*/g,e.VALID_ID_SELECTOR=/^[a-zA-Z-\_][a-zA-Z\-\_0-9]+$/,e.VALID_CLASS_SELECTOR=/^([a-zA-Z\-\_0-9]+)$/,e.GROWING_IGNORE="data-growing-ignore",e.GROWING_TRACK="data-growing-track",e.GROWING_CONTAINER="data-growing-container",e.GROWING_INDEX="data-growing-index",e.GROWING_INDEX_OLD="data-growing-idx",e.GROWING_CDP_INDEX="data-index",e.GROWING_GTITLE="data-growing-title",e.GROWING_TITLE="data-title",e.GROWING_TITLE_OLD="growing-title"}(N);var E={},I={};Object.defineProperty(I,"__esModule",{value:!0}),I.lastFindIndex=I.findIndex=I.arrayEquals=I.rmBlank=I.normalizePath=I.splitNoEmpty=I.filterText=void 0,I.filterText=function(e,t){if(void 0===t&&(t=!0),e&&(null==(e=e.replace(/[\n \t]+/g," ").trim())?void 0:e.length))return e.slice(0,t?50:void 0)},I.splitNoEmpty=function(e,t){return e?e.split(t).filter((function(e){return!!e})):[]},I.normalizePath=function(e){var t=e.length;return t>1&&"/"===e.charAt(t-1)?e.slice(0,t-1):e},I.rmBlank=function(e){return e?e.replace(/[\n \t]+/g,""):""},I.arrayEquals=function(e,t){if(!e||!t)return!1;if(e.length!==t.length)return!1;for(var n=0,r=e.length;r>n;n++)if(e[n]!==t[n])return!1;return!0},I.findIndex=function(e,t){if(null==e||"function"!=typeof t)return-1;for(var n=0;n=0;n--){var r=e[n];if(t.call(void 0,r))return n}return-1},function(e){var t=f&&f.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;o>i;i++)!r&&i in t||(r||(r=[].slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||[].slice.call(t))},n=f&&f.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.removeDiffTagOnHeadAndTail=e.computeXpath=e.getMarkIndex=e.getEffectiveNode=e.isIgnore=e.depthInside=e.changeableInput=e.clickableInput=e.onlyContainsTextChildren=e.onlyContainsIconChildren=e.supportIconTag=e.isContainerTag=e.isListTag=e.isParentOfLeaf=e.isLeaf=e.getChildren=e.getDeepChildren=e.findParent=e.isRootNode=e.hasValidAttribute=void 0;var r=I,i=N,o=n(c);e.hasValidAttribute=function(e,t){return e instanceof Element&&e.hasAttribute(t)&&"false"!==e.getAttribute(t)},e.isRootNode=function(e){return!e||-1!==["BODY","HTML","#document"].indexOf(e.nodeName)},e.findParent=function(t,n){for(var r=t.parentNode;r&&!(0,e.isRootNode)(r);){if(n(r))return r;r=r.parentNode}},e.getDeepChildren=function(n){return(0,o.default)((null==n?void 0:n.childNodes)||[]).reduce((function(n,r){return r instanceof Element?t(t(t([],n,!0),[r],!1),(0,e.getDeepChildren)(r),!0):n}),[])},e.getChildren=function(e){return(0,o.default)((null==e?void 0:e.childNodes)||[]).filter((function(e){return e instanceof Element}))},e.isLeaf=function(t){return!t.hasChildNodes()||"svg"===t.nodeName||0===(0,e.getChildren)(t).length},e.isParentOfLeaf=function(t){return!(!t.hasChildNodes()||"svg"===t.nodeName)&&0===(0,o.default)(t.childNodes).filter((function(t){return!(0,e.isLeaf)(t)})).length},e.isListTag=function(e){return-1!==i.LIST_TAGS.indexOf(e.nodeName)},e.isContainerTag=function(t){return(0,e.hasValidAttribute)(t,i.GROWING_CONTAINER)||-1!==i.SUPPORTED_CONTAINER_TAGS.indexOf(t.nodeName)},e.supportIconTag=function(e){var t=e.nodeName;return-1!==i.SUPPORTED_ICON_TAGS.indexOf(t)},e.onlyContainsIconChildren=function(t){if(t.textContent)return!1;var n=(0,e.getChildren)(t);if(0===n.length)return!1;for(var r=0,i=n;rn)return!1;for(var i="svg"===t.tagName?[]:(0,e.getChildren)(t),o=0;o=r},e.isIgnore=function(t){if(!(t instanceof Element)||(0,e.hasValidAttribute)(t,i.GROWING_IGNORE))return!0;for(var n=t.parentNode;n&&!(0,e.isRootNode)(n);){if((0,e.hasValidAttribute)(n,i.GROWING_IGNORE))return!0;n=n.parentNode}return!1},e.getEffectiveNode=function(t){for(var n,r;t&&(r=void 0,!((n=t)instanceof Element&&-1===i.UNSUPPORTED_TAGS.indexOf(null===(r=n.tagName)||void 0===r?void 0:r.toLowerCase())))&&t.parentNode;)t=t.parentNode;var o,a=t.parentNode;return!(0,e.isRootNode)(a)&&((0,e.onlyContainsIconChildren)(a)||"BUTTON"===(o=a).tagName&&(0,e.onlyContainsTextChildren)(o))?a:t},e.getMarkIndex=function(e){if(e instanceof Element){var t=e.getAttribute(i.GROWING_INDEX)||e.getAttribute(i.GROWING_INDEX_OLD)||e.getAttribute(i.GROWING_CDP_INDEX);if(t){if(/^\d{1,10}$/.test(t)&&+t>=0&&2147483647>+t)return+t;window.console.error("[GioNode]:标记的index不符合规范(index必须是大于等于0且小于2147483647的整数字)。",t)}}},e.computeXpath=function(e){for(var t=e.parentPaths(!0),n=Math.min(t.length,+(t.length>=10)+4),r=["","",""],i=0;ii&&(r[1]=o+r[1])}return r},e.removeDiffTagOnHeadAndTail=function(e,t){var n=function(e){return e.nodeName===t.nodeName},i=(0,r.findIndex)(e,n),o=(0,r.lastFindIndex)(e,n);return-1===i||-1===o?[]:e.slice(i,o+1)}}(E);var O={},b={};Object.defineProperty(b,"__esModule",{value:!0});var y=N,C=I,A=E;function P(e){var t;if(e instanceof Element){var n=e.getAttribute("name");if(n)return[n];if(e.hasAttribute("class")){var r=null===(t=e.getAttribute("class"))||void 0===t?void 0:t.replace(y.EXCLUDE_CLASS_RE,"").trim();if(null==r?void 0:r.length)return r.split(/\s+/).filter((function(e){return y.VALID_CLASS_SELECTOR.test(e)&&!e.match(/[a-z][A-Z][a-z][A-Z]/)&&!e.match(/[0-9][0-9][0-9][0-9]/)})).sort()}}return[]}var x=function(){function e(e){var t;this.node=e,this.tagName=this.node.nodeName,this.name=this.tagName.toLowerCase(),this.id=(t=this.node).id&&y.VALID_ID_SELECTOR.test(t.id)?t.id:null,this.classList=P(this.node),this.guessListAndIndex()}return e.prototype.guessListAndIndex=function(){var e,t=this;this._tagList=(0,A.isListTag)(this.node);var n=(0,A.removeDiffTagOnHeadAndTail)((0,A.getChildren)(this.node.parentNode),this.node);if(this._tagList&&-1!==(o=n.filter((function(e){return e.tagName===t.tagName})).indexOf(this.node))&&(this._index=o+1),n.length>=3&&(null===(e=this.classList)||void 0===e?void 0:e.length)){for(var r=0,i=0,o=1;o<=n.length;o++){var a=n[o-1];if(a.tagName!==this.tagName){i=0;break}(0,C.arrayEquals)(this.classList,P(a))&&(i+=1),this.node===a&&(r=o)}3>i||(this._pseudoList=!0,this._index=this._index||r)}},Object.defineProperty(e.prototype,"path",{get:function(){var e;return this._path||(this._path="/".concat(this.name),this.id&&(this._path+="#".concat(this.id)),(null===(e=this.classList)||void 0===e?void 0:e.length)&&(this._path+=".".concat(this.classList.join(".")))),this._path},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pseudoList",{get:function(){return!!this._pseudoList},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"list",{get:function(){return!!this._tagList||!!this._pseudoList},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"index",{get:function(){var e;return null!==(e=(0,A.getMarkIndex)(this.node))&&void 0!==e?e:this._index},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"container",{get:function(){return(0,A.isContainerTag)(this.node)||this.list},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"parent",{get:function(){return this.node.parentNode?new e(this.node.parentNode):null},enumerable:!1,configurable:!0}),e.prototype.parentPaths=function(e){void 0===e&&(e=!1);for(var t=e?[this]:[],n=this.parent;n&&!(0,A.isRootNode)(n.node);)t.push(n),n=n.parent;return t},e}();b.default=x;var L={};Object.defineProperty(L,"__esModule",{value:!0}),L.getElementHref=L.getImgHref=L.getAnchorHref=void 0;var G=I;function S(e){if(e.hasAttribute("href")){var t=e.getAttribute("href");if(t&&0!==t.indexOf("javascript"))return(0,G.normalizePath)(t.slice(0,320))}}function R(e){if(e.src&&-1===e.src.indexOf("data:image"))return e.src}L.getAnchorHref=S,L.getImgHref=R,L.getElementHref=function(e){var t=e;if(t)switch(e.nodeName.toLowerCase()){case"a":return S(t);case"img":return R(t)}};var D={},w=f&&f.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(D,"__esModule",{value:!0}),D.getElementContent=D.getFormContent=void 0;var k=E,U=L,j=N,M=w(b),W=I,X=w(c),H=function(e){return e.htmlFor||e.getAttribute("for")},V=function(e){var t=e.getAttribute(j.GROWING_GTITLE)||e.getAttribute(j.GROWING_TITLE)||e.getAttribute(j.GROWING_TITLE_OLD)||e.getAttribute("title");return null==t?void 0:t.trim()};function B(e){var t=e.node;return e.list?K(t):(0,W.filterText)(t.textContent)||void 0}function K(e){for(var t=void 0,n=!1,r=0,i=(0,X.default)(e.childNodes);r-1?n.slice(0,r):n}}(t);case"svg":return function(e){for(var t=0,n=(0,X.default)(e.childNodes);t0)return n[n.length-1]}}(t);case"label":return B(a);case"input":return function(e){if((0,k.clickableInput)(e))return e.value;if("password"!==e.type&&(0,k.hasValidAttribute)(e,j.GROWING_TRACK))return e.value;if((0,k.changeableInput)(e)){var t=(0,k.findParent)(e,(function(e){return"LABEL"===e.nodeName}));if(!t&&e.id)for(var n=document.body.getElementsByTagName("label"),r=0;r0)return o+" ("+e.checked+")"}return e.value}}(t);case"select":return r=t,(0,X.default)(r.options).filter((function(e){return e.selected})).map((function(e){return e.label})).join(", ")||r.value;case"form":return z(t)}return(0,k.isLeaf)(t)?function(e){var t=(0,W.filterText)(e.textContent);if(t)return t}(t):(0,k.isParentOfLeaf)(t)&&!(0,k.onlyContainsIconChildren)(t)?function(e){for(var t="",n=0,r=(0,X.default)(e.childNodes);nn;n++)for(var i in t=arguments[n])({}).hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},ne.apply(this,arguments)},re=f&&f.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(T,"__esModule",{value:!0});var ie=N,oe=E,ae=re(O),ue=function(){function e(e,t,n){void 0===t&&(t=null),void 0===n&&(n=!0),this.origin=e,this.action=t,this.direct=n,this.target="self"===t?e:(0,oe.getEffectiveNode)(e),this.ignore=(0,oe.isIgnore)(this.target),this.vnode=new ae.default(this.target),this.tagName=this.vnode.tagName}return Object.defineProperty(e.prototype,"content",{get:function(){return this.vnode.content},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"href",{get:function(){return this.vnode.href},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"index",{get:function(){return this.vnode.index},enumerable:!1,configurable:!0}),e.prototype.inferParentIndex=function(){var t=this;return this.parentIndex||(0,oe.findParent)(this.target,(function(n){var r=new e(n,t.action,!1);r.traceable()&&r.index&&(t.parentIndex=r.index)})),this.parentIndex},Object.defineProperty(e.prototype,"xpath",{get:function(){return this.vnode.xpath},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fullXpath",{get:function(){return this.vnode.fullXpath},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"skeleton",{get:function(){return this.vnode.skeleton},enumerable:!1,configurable:!0}),e.prototype.info=function(e){return void 0===e&&(e=!0),e&&this.inferParentIndex(),{skeleton:this.skeleton,fullXpath:this.fullXpath,xpath:this.xpath,content:this.content,href:this.href,index:this.parentIndex||this.index}},e.prototype.traceable=function(){if(this.ignore)return!1;if(this.direct){if("click"===this.action||"hover"===this.action){if(-1!==ie.UNSUPPORTED_CLICK_TAGS.indexOf(this.target.tagName))return!1;if("INPUT"===this.target.tagName&&!(0,oe.clickableInput)(this.target))return!1;if(!(0,oe.isContainerTag)(this.target)&&!(0,oe.depthInside)(this.target,5))return!1}return!0}return this.vnode.container},e.prototype.trackNodes=function(){if(!this.traceable())return[];var e=[this];if("submit"!==this.action)for(var t=this.parentElement;t;){if(t.ignore)return[];t.traceable()&&e.unshift(t),t=t.parentElement}var n=void 0;return e.map((function(e){var t=e.info(!1),r=t.index;return!n&&r&&(n=r),ne(ne({},t),{index:n||r})}))},Object.defineProperty(e.prototype,"parentElement",{get:function(){var t=this.target.parentNode;if(t&&t.nodeName&&!(0,oe.isRootNode)(t))return new e(t,this.action,!1)},enumerable:!1,configurable:!0}),e}(),le=T.default=ue,fe=function(){function e(e){this.handler=e;var t=navigator.userAgent,n=/chrome/i.exec(t),r=/android/i.exec(t);this.hasTouch="ontouchstart"in window&&!(n&&!r)}return e.prototype.main=function(){for(var e=this.hasTouch?["touchstart"]:["mousedown"],t=this.hasTouch?["touchend","touchcancel"]:["mouseup","mouseleave"],n=this.hasTouch?["touchmove"]:["mousemove"],r=0,i=e;i.length>r;r++)m(window,i[r],this.touchStartHandler.bind(this));for(var o=0,a=n;a.length>o;o++)m(window,a[o],this.touchMoveHandler.bind(this));for(var u=0,l=t;l.length>u;u++)m(window,l[u],this.touchStopHandler.bind(this))},e.prototype.touchStartHandler=function(e){if(1>=e.which){var t=+Date.now();this.safeguard!==t&&(this.touchTimeout&&clearTimeout(this.touchTimeout),this.safeguard=t,this.touchEvent={time:t,target:e.target,x:this._page("x",e),y:this._page("y",e),isTrusted:!0,type:"click"})}},e.prototype.touchMoveHandler=function(e){var t=Math.abs(this._page("x",e)-(this.touchEvent&&this.touchEvent.x)||0),n=Math.abs(this._page("y",e)-(this.touchEvent&&this.touchEvent.y)||0);(t>10||n>10)&&(this.touchEvent=null)},e.prototype.touchStopHandler=function(e){var t=this,n=+Date.now()-(this.touchEvent&&this.touchEvent.time)||0;this.touchEvent&&200>n?this.touchTimeout=setTimeout((function(){t.handler(t.touchEvent),t.touchEvent=null}),200):this.touchEvent&&n>=200&&700>n&&(this.handler(this.touchEvent),this.touchEvent=null)},e.prototype._page=function(e,t){return(this.hasTouch?t.touches[0]:t)["page".concat(e.toUpperCase())]},e}();window.gioEventAutoTracking={name:"gioEventAutoTracking",method:function(t){var n=this;this.growingIO=t,this.main=function(){m(document,"submit",n._handleAction),m(document,"change",n._handleAction),n.growingIO.vdsConfig.touch?new fe(n._handleAction).main():m(document,"click",n._handleAction)},this._handleAction=function(t,r){var i=n.growingIO,o=i.vdsConfig,a=i.emitter;if(!o.autotrack)return!1;var u=t.target;if(!u)return!1;var f=new le(u,t.type,!0).trackNodes();if("click"!==t.type&&(f=v(d(f))?[]:[d(f)]),v(f))return!1;null==a||a.emit("onComposeBefore",{event:r,params:null!=t?t:{}}),f.forEach((function(r){var i=r.fullXpath,a=r.index,u=r.content,f=r.href;if(!p(r.fullXpath||"","/div#__vconsole")&&!p(r.fullXpath||"","/div#__giokit")&&(o.debug&&console.log("Action:",t.type,Date.now()),i)){var c=n.growingIO.dataStore,s=c.eventContextBuilder,d=c.eventConverter,h=c.currentPage;d(e(e({eventType:l[t.type],element:[{xpath:i,index:a,textValue:u,hyperlink:f}]},s()),{pageShowTimestamp:h.time}))}}))}}}})); +!function(e){"function"==typeof define&&define.amd?define(e):e()}((function(){"use strict";var e=function(){return e=Object.assign||function(e){for(var t,n=1,r=arguments.length;r>n;n++)for(var i in t=arguments[n])({}).hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},e.apply(this,arguments)};function t(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;o>i;i++)!r&&i in t||(r||(r=[].slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||[].slice.call(t))}"function"==typeof SuppressedError&&SuppressedError,location.protocol.indexOf("http")>-1&&location.protocol.replace(":","");var n=["clearUserId","getGioInfo","getLocation","getOption","init","setDataCollect","setOption","setUserId","track","setGeneralProps","clearGeneralProps"];t(t([],n,!0),["setEvar","setPage","setUser","setVisitor"],!1),t(t([],n,!0),["enableDebug","enableHT","setAutotrack","setTrackerHost","setTrackerScheme","setUserAttributes","getVisitorId","getDeviceId","registerPlugins","getPlugins","sendPage","sendVisit","trackTimerStart","trackTimerPause","trackTimerResume","trackTimerEnd","removeTimer","clearTrackTimer","updateImpression"],!1);var r,i,o,a,u,l={click:"VIEW_CLICK",change:"VIEW_CHANGE",submit:"FORM_SUBMIT"},f="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},s="function"==typeof Array.from?Array.from:(i||(i=1,o=function(e){return"function"==typeof e},a=function(e){var t=function(e){var t=Number(e);return isNaN(t)?0:0!==t&&isFinite(t)?(t>0?1:-1)*Math.floor(Math.abs(t)):t}(e);return Math.min(Math.max(t,0),9007199254740991)},u=function(e){var t=e.next();return!t.done&&t},r=function(e){var t,n,r,i=this,l=arguments.length>1?arguments[1]:void 0;if(void 0!==l){if(!o(l))throw new TypeError("Array.from: when provided, the second argument must be a function");arguments.length>2&&(t=arguments[2])}var f=function(e,t){if(null!=e&&null!=t){var n=e[t];if(null==n)return;if(!o(n))throw new TypeError(n+" is not a function");return n}}(e,function(e){if(null!=e){if(["string","number","boolean","symbol"].indexOf(typeof e)>-1)return Symbol.iterator;if("undefined"!=typeof Symbol&&"iterator"in Symbol&&Symbol.iterator in e)return Symbol.iterator;if("@@iterator"in e)return"@@iterator"}}(e));if(void 0!==f){n=o(i)?Object(new i):[];var s,c,d=f.call(e);if(null==d)throw new TypeError("Array.from requires an array-like or iterable object");for(r=0;;){if(!(s=u(d)))return n.length=r,n;c=s.value,n[r]=l?l.call(t,c,r):c,r++}}else{var h=Object(e);if(null==e)throw new TypeError("Array.from requires an array-like object - not null or undefined");var g,p=a(h.length);for(n=o(i)?Object(new i(p)):Array(p),r=0;p>r;)g=h[r],n[r]=l?l.call(t,g,r):g,r++;n.length=p}return n}),r),c=function(e){return"object"===_(e)&&!function(e){return h(["undefined","null"],_(e))}(e)},d=function(e){try{var t=g(e);return t[t.length-1]}catch(e){return}},h=function(e,t){return("array"===_(e)||"string"===_(e))&&e.indexOf(t)>=0},g=s,p=function(e,t){return"string"===_(e)&&e.slice(0,t.length)===t},v=function(e){return function(e){return Array.isArray(e)&&"array"===_(e)}(e)?0===e.length:c(e)?0===function(e){return c(e)?Object.keys(e):[]}(e).length:!e},_=function(e){return{}.toString.call(e).slice(8,-1).toLowerCase()},m=function(t,n,r,i){void 0===i&&(i={}),document.addEventListener?t.addEventListener(n,r,e(e({},{capture:!0}),i)):t.attachEvent?t.attachEvent("on"+n,r):t["on"+n]=r},T={},E={};!function(e){var t=f&&f.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;o>i;i++)!r&&i in t||(r||(r=[].slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||[].slice.call(t))};Object.defineProperty(e,"__esModule",{value:!0}),e.GROWING_TITLE_OLD=e.GROWING_TITLE=e.GROWING_GTITLE=e.GROWING_CDP_INDEX=e.GROWING_INDEX_OLD=e.GROWING_INDEX=e.GROWING_CONTAINER=e.GROWING_TRACK=e.GROWING_IGNORE=e.VALID_CLASS_SELECTOR=e.VALID_ID_SELECTOR=e.EXCLUDE_CLASS_RE=e.UNSUPPORTED_TAGS=e.TEXT_NODE=e.UNSUPPORTED_CLICK_TAGS=e.SUPPORTED_ICON_TAGS=e.SUPPORTED_CHANGE_TYPES=e.SUPPORTED_CLICK_INPUT_TYPES=e.SUPPORTED_CONTAINER_TAGS=e.LIST_TAGS=void 0,e.LIST_TAGS=["TR","LI","DL"],e.SUPPORTED_CONTAINER_TAGS=t(["A","BUTTON"],e.LIST_TAGS,!0),e.SUPPORTED_CLICK_INPUT_TYPES=["button","submit","reset"],e.SUPPORTED_CHANGE_TYPES=["radio","checkbox","search"],e.SUPPORTED_ICON_TAGS=["I","EM","svg","IMG"],e.UNSUPPORTED_CLICK_TAGS=["TEXTAREA","HTML","BODY"],e.TEXT_NODE=["I","SPAN","EM","B","STRONG"],e.UNSUPPORTED_TAGS=["tspan","text","g","rect","path","defs","clippath","desc","title","math","use"],e.EXCLUDE_CLASS_RE=/(^| |[^ ]+\-)(clear|clearfix|active|hover|enabled|current|selected|unselected|hidden|display|focus|disabled|undisabled|open|checked|unchecked|undefined|null|ng-|growing-)[^\. ]*/g,e.VALID_ID_SELECTOR=/^[a-zA-Z-\_][a-zA-Z\-\_0-9]+$/,e.VALID_CLASS_SELECTOR=/^([a-zA-Z\-\_0-9]+)$/,e.GROWING_IGNORE="data-growing-ignore",e.GROWING_TRACK="data-growing-track",e.GROWING_CONTAINER="data-growing-container",e.GROWING_INDEX="data-growing-index",e.GROWING_INDEX_OLD="data-growing-idx",e.GROWING_CDP_INDEX="data-index",e.GROWING_GTITLE="data-growing-title",e.GROWING_TITLE="data-title",e.GROWING_TITLE_OLD="growing-title"}(E);var N={},I={};Object.defineProperty(I,"__esModule",{value:!0}),I.lastFindIndex=I.findIndex=I.arrayEquals=I.rmBlank=I.normalizePath=I.splitNoEmpty=I.filterText=void 0,I.filterText=function(e,t){if(void 0===t&&(t=!0),e&&(null==(e=e.replace(/[\n \t]+/g," ").trim())?void 0:e.length))return e.slice(0,t?50:void 0)},I.splitNoEmpty=function(e,t){return e?e.split(t).filter((function(e){return!!e})):[]},I.normalizePath=function(e){var t=e.length;return t>1&&"/"===e.charAt(t-1)?e.slice(0,t-1):e},I.rmBlank=function(e){return e?e.replace(/[\n \t]+/g,""):""},I.arrayEquals=function(e,t){if(!e||!t)return!1;if(e.length!==t.length)return!1;for(var n=0,r=e.length;r>n;n++)if(e[n]!==t[n])return!1;return!0},I.findIndex=function(e,t){if(null==e||"function"!=typeof t)return-1;for(var n=0;n=0;n--){var r=e[n];if(t.call(void 0,r))return n}return-1},function(e){var t=f&&f.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;o>i;i++)!r&&i in t||(r||(r=[].slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||[].slice.call(t))},n=f&&f.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.removeDiffTagOnHeadAndTail=e.computeXpath=e.getMarkIndex=e.getEffectiveNode=e.isIgnore=e.depthInside=e.changeableInput=e.clickableInput=e.onlyContainsTextChildren=e.onlyContainsIconChildren=e.supportIconTag=e.isContainerTag=e.isListTag=e.isParentOfLeaf=e.isLeaf=e.getChildren=e.getDeepChildren=e.findParent=e.isRootNode=e.hasValidAttribute=void 0;var r=I,i=E,o=n(s);e.hasValidAttribute=function(e,t){return e instanceof Element&&e.hasAttribute(t)&&"false"!==e.getAttribute(t)},e.isRootNode=function(e){return!e||-1!==["BODY","HTML","#document"].indexOf(e.nodeName)},e.findParent=function(t,n){for(var r=t.parentNode;r&&!(0,e.isRootNode)(r);){if(n(r))return r;r=r.parentNode}},e.getDeepChildren=function(n){return(0,o.default)((null==n?void 0:n.childNodes)||[]).reduce((function(n,r){return r instanceof Element?t(t(t([],n,!0),[r],!1),(0,e.getDeepChildren)(r),!0):n}),[])},e.getChildren=function(e){return(0,o.default)((null==e?void 0:e.childNodes)||[]).filter((function(e){return e instanceof Element}))},e.isLeaf=function(t){return!t.hasChildNodes()||"svg"===t.nodeName||0===(0,e.getChildren)(t).length},e.isParentOfLeaf=function(t){return!(!t.hasChildNodes()||"svg"===t.nodeName)&&0===(0,o.default)(t.childNodes).filter((function(t){return!(0,e.isLeaf)(t)})).length},e.isListTag=function(e){return-1!==i.LIST_TAGS.indexOf(e.nodeName)},e.isContainerTag=function(t){return(0,e.hasValidAttribute)(t,i.GROWING_CONTAINER)||-1!==i.SUPPORTED_CONTAINER_TAGS.indexOf(t.nodeName)},e.supportIconTag=function(e){var t=e.nodeName;return-1!==i.SUPPORTED_ICON_TAGS.indexOf(t)},e.onlyContainsIconChildren=function(t){if(t.textContent)return!1;var n=(0,e.getChildren)(t);if(0===n.length)return!1;for(var r=0,i=n;rn)return!1;for(var i="svg"===t.tagName?[]:(0,e.getChildren)(t),o=0;o=r},e.isIgnore=function(t){if(!(t instanceof Element)||(0,e.hasValidAttribute)(t,i.GROWING_IGNORE))return!0;for(var n=t.parentNode;n&&!(0,e.isRootNode)(n);){if((0,e.hasValidAttribute)(n,i.GROWING_IGNORE))return!0;n=n.parentNode}return!1},e.getEffectiveNode=function(t){for(var n,r;t&&(r=void 0,!((n=t)instanceof Element&&-1===i.UNSUPPORTED_TAGS.indexOf(null===(r=n.tagName)||void 0===r?void 0:r.toLowerCase())))&&t.parentNode;)t=t.parentNode;var o,a=t.parentNode;return!(0,e.isRootNode)(a)&&((0,e.onlyContainsIconChildren)(a)||"BUTTON"===(o=a).tagName&&(0,e.onlyContainsTextChildren)(o))?a:t},e.getMarkIndex=function(e){if(e instanceof Element){var t=e.getAttribute(i.GROWING_INDEX)||e.getAttribute(i.GROWING_INDEX_OLD)||e.getAttribute(i.GROWING_CDP_INDEX);if(t){if(/^\d{1,10}$/.test(t)&&+t>=0&&2147483647>+t)return+t;window.console.error("[GioNode]:标记的index不符合规范(index必须是大于等于0且小于2147483647的整数字)。",t)}}},e.computeXpath=function(e){for(var t=e.parentPaths(!0),n=Math.min(t.length,+(t.length>=10)+4),r=["","",""],i=0;ii&&(r[1]=o+r[1])}return r},e.removeDiffTagOnHeadAndTail=function(e,t){var n=function(e){return e.nodeName===t.nodeName},i=(0,r.findIndex)(e,n),o=(0,r.lastFindIndex)(e,n);return-1===i||-1===o?[]:e.slice(i,o+1)}}(N);var O={},b={};Object.defineProperty(b,"__esModule",{value:!0});var y=E,C=I,A=N;function P(e){var t;if(e instanceof Element){var n=e.getAttribute("name");if(n)return[n];if(e.hasAttribute("class")){var r=null===(t=e.getAttribute("class"))||void 0===t?void 0:t.replace(y.EXCLUDE_CLASS_RE,"").trim();if(null==r?void 0:r.length)return r.split(/\s+/).filter((function(e){return y.VALID_CLASS_SELECTOR.test(e)&&!e.match(/[a-z][A-Z][a-z][A-Z]/)&&!e.match(/[0-9][0-9][0-9][0-9]/)})).sort()}}return[]}var x=function(){function e(e){var t;this.node=e,this.tagName=this.node.nodeName,this.name=this.tagName.toLowerCase(),this.id=(t=this.node).id&&y.VALID_ID_SELECTOR.test(t.id)?t.id:null,this.classList=P(this.node),this.guessListAndIndex()}return e.prototype.guessListAndIndex=function(){var e,t=this;this._tagList=(0,A.isListTag)(this.node);var n=(0,A.removeDiffTagOnHeadAndTail)((0,A.getChildren)(this.node.parentNode),this.node);if(this._tagList&&-1!==(o=n.filter((function(e){return e.tagName===t.tagName})).indexOf(this.node))&&(this._index=o+1),n.length>=3&&(null===(e=this.classList)||void 0===e?void 0:e.length)){for(var r=0,i=0,o=1;o<=n.length;o++){var a=n[o-1];if(a.tagName!==this.tagName){i=0;break}(0,C.arrayEquals)(this.classList,P(a))&&(i+=1),this.node===a&&(r=o)}3>i||(this._pseudoList=!0,this._index=this._index||r)}},Object.defineProperty(e.prototype,"path",{get:function(){var e;return this._path||(this._path="/".concat(this.name),this.id&&(this._path+="#".concat(this.id)),(null===(e=this.classList)||void 0===e?void 0:e.length)&&(this._path+=".".concat(this.classList.join(".")))),this._path},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pseudoList",{get:function(){return!!this._pseudoList},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"list",{get:function(){return!!this._tagList||!!this._pseudoList},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"index",{get:function(){var e;return null!==(e=(0,A.getMarkIndex)(this.node))&&void 0!==e?e:this._index},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"container",{get:function(){return(0,A.isContainerTag)(this.node)||this.list},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"parent",{get:function(){return this.node.parentNode?new e(this.node.parentNode):null},enumerable:!1,configurable:!0}),e.prototype.parentPaths=function(e){void 0===e&&(e=!1);for(var t=e?[this]:[],n=this.parent;n&&!(0,A.isRootNode)(n.node);)t.push(n),n=n.parent;return t},e}();b.default=x;var L={};Object.defineProperty(L,"__esModule",{value:!0}),L.getElementHref=L.getImgHref=L.getAnchorHref=void 0;var G=I;function S(e){if(e.hasAttribute("href")){var t=e.getAttribute("href");if(t&&0!==t.indexOf("javascript"))return(0,G.normalizePath)(t.slice(0,320))}}function R(e){if(e.src&&-1===e.src.indexOf("data:image"))return e.src}L.getAnchorHref=S,L.getImgHref=R,L.getElementHref=function(e){var t=e;if(t)switch(e.nodeName.toLowerCase()){case"a":return S(t);case"img":return R(t)}};var D={},w=f&&f.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(D,"__esModule",{value:!0}),D.getElementContent=D.getFormContent=void 0;var k=N,U=L,j=E,M=w(b),W=I,X=w(s),H=function(e){return e.htmlFor||e.getAttribute("for")},V=function(e){var t=e.getAttribute(j.GROWING_GTITLE)||e.getAttribute(j.GROWING_TITLE)||e.getAttribute(j.GROWING_TITLE_OLD)||e.getAttribute("title");return null==t?void 0:t.trim()};function B(e){var t=e.node;return e.list?K(t):(0,W.filterText)(t.textContent)||void 0}function K(e){for(var t=void 0,n=!1,r=0,i=(0,X.default)(e.childNodes);r-1?n.slice(0,r):n}}(t);case"svg":return function(e){for(var t=0,n=(0,X.default)(e.childNodes);t0)return n[n.length-1]}}(t);case"label":return B(a);case"input":return function(e){if((0,k.clickableInput)(e))return e.value;if("password"!==e.type&&(0,k.hasValidAttribute)(e,j.GROWING_TRACK))return e.value;if((0,k.changeableInput)(e)){var t=(0,k.findParent)(e,(function(e){return"LABEL"===e.nodeName}));if(!t&&e.id)for(var n=document.body.getElementsByTagName("label"),r=0;r0)return o+" ("+e.checked+")"}return e.value}}(t);case"select":return r=t,(0,X.default)(r.options).filter((function(e){return e.selected})).map((function(e){return e.label})).join(", ")||r.value;case"form":return z(t)}return(0,k.isLeaf)(t)?function(e){var t=(0,W.filterText)(e.textContent);if(t)return t}(t):(0,k.isParentOfLeaf)(t)&&!(0,k.onlyContainsIconChildren)(t)?function(e){for(var t="",n=0,r=(0,X.default)(e.childNodes);nn;n++)for(var i in t=arguments[n])({}).hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},ne.apply(this,arguments)},re=f&&f.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(T,"__esModule",{value:!0});var ie=E,oe=N,ae=re(O),ue=function(){function e(e,t,n){void 0===t&&(t=null),void 0===n&&(n=!0),this.origin=e,this.action=t,this.direct=n,this.target="self"===t?e:(0,oe.getEffectiveNode)(e),this.ignore=(0,oe.isIgnore)(this.target),this.vnode=new ae.default(this.target),this.tagName=this.vnode.tagName}return Object.defineProperty(e.prototype,"content",{get:function(){return this.vnode.content},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"href",{get:function(){return this.vnode.href},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"index",{get:function(){return this.vnode.index},enumerable:!1,configurable:!0}),e.prototype.inferParentIndex=function(){var t=this;return this.parentIndex||(0,oe.findParent)(this.target,(function(n){var r=new e(n,t.action,!1);r.traceable()&&r.index&&(t.parentIndex=r.index)})),this.parentIndex},Object.defineProperty(e.prototype,"xpath",{get:function(){return this.vnode.xpath},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fullXpath",{get:function(){return this.vnode.fullXpath},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"skeleton",{get:function(){return this.vnode.skeleton},enumerable:!1,configurable:!0}),e.prototype.info=function(e){return void 0===e&&(e=!0),e&&this.inferParentIndex(),{skeleton:this.skeleton,fullXpath:this.fullXpath,xpath:this.xpath,content:this.content,href:this.href,index:this.parentIndex||this.index}},e.prototype.traceable=function(){if(this.ignore)return!1;if(this.direct){if("click"===this.action||"hover"===this.action){if(-1!==ie.UNSUPPORTED_CLICK_TAGS.indexOf(this.target.tagName))return!1;if("INPUT"===this.target.tagName&&!(0,oe.clickableInput)(this.target))return!1;if(!(0,oe.isContainerTag)(this.target)&&!(0,oe.depthInside)(this.target,5))return!1}return!0}return this.vnode.container},e.prototype.trackNodes=function(){if(!this.traceable())return[];var e=[this];if("submit"!==this.action)for(var t=this.parentElement;t;){if(t.ignore)return[];t.traceable()&&e.unshift(t),t=t.parentElement}var n=void 0;return e.map((function(e){var t=e.info(!1),r=t.index;return!n&&r&&(n=r),ne(ne({},t),{index:n||r})}))},Object.defineProperty(e.prototype,"parentElement",{get:function(){var t=this.target.parentNode;if(t&&t.nodeName&&!(0,oe.isRootNode)(t))return new e(t,this.action,!1)},enumerable:!1,configurable:!0}),e}(),le=T.default=ue,fe=function(){function e(e){this.handler=e;var t=navigator.userAgent,n=/chrome/i.exec(t),r=/android/i.exec(t);this.hasTouch="ontouchstart"in window&&!(n&&!r)}return e.prototype.main=function(){for(var e=this.hasTouch?["touchstart"]:["mousedown"],t=this.hasTouch?["touchend","touchcancel"]:["mouseup","mouseleave"],n=this.hasTouch?["touchmove"]:["mousemove"],r=0,i=e;i.length>r;r++)m(window,i[r],this.touchStartHandler.bind(this));for(var o=0,a=n;a.length>o;o++)m(window,a[o],this.touchMoveHandler.bind(this));for(var u=0,l=t;l.length>u;u++)m(window,l[u],this.touchStopHandler.bind(this))},e.prototype.touchStartHandler=function(e){if(1>=e.which){var t=+Date.now();this.safeguard!==t&&(this.touchTimeout&&clearTimeout(this.touchTimeout),this.safeguard=t,this.touchEvent={time:t,target:e.target,x:this._page("x",e),y:this._page("y",e),isTrusted:!0,type:"click"})}},e.prototype.touchMoveHandler=function(e){var t=Math.abs(this._page("x",e)-(this.touchEvent&&this.touchEvent.x)||0),n=Math.abs(this._page("y",e)-(this.touchEvent&&this.touchEvent.y)||0);(t>10||n>10)&&(this.touchEvent=null)},e.prototype.touchStopHandler=function(e){var t=this,n=+Date.now()-(this.touchEvent&&this.touchEvent.time)||0;this.touchEvent&&200>n?this.touchTimeout=setTimeout((function(){t.handler(t.touchEvent),t.touchEvent=null}),200):this.touchEvent&&n>=200&&700>n&&(this.handler(this.touchEvent),this.touchEvent=null)},e.prototype._page=function(e,t){return(this.hasTouch?t.touches[0]:t)["page".concat(e.toUpperCase())]},e}();window.gioEventAutoTracking={name:"gioEventAutoTracking",method:function(t){var n=this;this.growingIO=t,this.main=function(){m(document,"submit",n._handleAction),m(document,"change",n._handleAction),n.growingIO.vdsConfig.touch?new fe(n._handleAction).main():m(document,"click",n._handleAction)},this._handleAction=function(t,r){var i=n.growingIO,o=i.vdsConfig,a=i.emitter;if(!o.autotrack)return!1;var u=t.target;if(!u)return!1;var f=new le(u,t.type,!0).trackNodes();if("click"!==t.type&&(f=v(d(f))?[]:[d(f)]),v(f))return!1;null==a||a.emit("onComposeBefore",{event:r,params:null!=t?t:{}}),f.forEach((function(r){var i=r.fullXpath,a=r.index,u=r.content,f=r.href;if(!p(r.fullXpath||"","/div#__vconsole")&&!p(r.fullXpath||"","/div#__giokit")&&(o.debug&&console.log("Action:",t.type,Date.now()),i)){var s=n.growingIO.dataStore,c=s.eventContextBuilder,d=s.eventConverter,h=s.currentPage;d(e(e({eventType:l[t.type],element:[{xpath:i,index:a,textValue:u,hyperlink:f}]},c()),{pageShowTimestamp:h.time}))}}))}}}})); diff --git a/plugins/umd/gioHybridAdapter.js b/plugins/umd/gioHybridAdapter.js index e35428c..eaaa0b1 100644 --- a/plugins/umd/gioHybridAdapter.js +++ b/plugins/umd/gioHybridAdapter.js @@ -1 +1 @@ -!function(e){"function"==typeof define&&define.amd?define(e):e()}((function(){"use strict";var e,i=function(){return i=Object.assign||function(e){for(var i,n=1,r=arguments.length;r>n;n++)for(var t in i=arguments[n])({}).hasOwnProperty.call(i,t)&&(e[t]=i[t]);return e},i.apply(this,arguments)},n=function(e){return o(["undefined","null"],c(e))},r=function(e){return"object"===c(e)&&!n(e)},t=function(e){return Array.isArray(e)&&"array"===c(e)},o=function(e,i){return("array"===c(e)||"string"===c(e))&&e.indexOf(i)>=0},d=function(e){return n(e)?"":"".concat(e)},a=function(e){return r(e)?Object.keys(e):[]},s=function(e,i){a(e).forEach((function(n){return i(e[n],n)}))},u=function(e,i){if(!r(e))return!1;try{return"string"===c(i)?delete e[i]:"array"===c(i)?i.map((function(i){return delete e[i]})):(function(e){return"regexp"===c(e)}(i)&&a(e).forEach((function(n){i.test(n)&&u(e,n)})),!0)}catch(e){return!1}},c=function(e){return{}.toString.call(e).slice(8,-1).toLowerCase()},w=function(e){try{return e()}catch(e){return}},f=["VIEW_CLICK","VIEW_CHANGE","FORM_SUBMIT","PAGE","CUSTOM","LOGIN_USER_ATTRIBUTES"],g=["LOGIN_USER_ATTRIBUTES"];window.gioHybridAdapter={name:"gioHybridAdapter",method:function(n){var a=this;this.growingIO=n,this.penetrateHybrid=!0,this.onOptionsInit=function(){var e,i=a.growingIO,n=i.vdsConfig,r=i.emitter;e=n.penetrateHybrid,"boolean"===c(e)&&(a.penetrateHybrid=n.penetrateHybrid),a._initHybridBridge()&&(a.onSendBefore=a.sendBeforeListener,a.hybridConfig.projectId===a.growingIO.vdsConfig.projectId&&(a.growingIO.useHybridInherit=!0)),a.growingIO.useHybridInherit&&(null==r||r.on("SET_USERID",(function(e){var i=e.newUserId,n=e.oldUserId,r=e.userKey;a.penetrateHybrid&&(!i&&n?r?a._clearNativeUserIdAndUserKey():a._clearNativeUserId():r?a._setNativeUserIdAndUserKey(d(i),d(r)):a._setNativeUserId(d(i)))})),null==r||r.on("SET_USERKEY",(function(e){var i=e.newUserKey,n=e.oldUserKey,r=e.userId;a.penetrateHybrid&&(!i&&n?a._clearNativeUserIdAndUserKey():a._setNativeUserIdAndUserKey(d(r),d(i)))})))},this._initHybridBridge=function(){var i,n,r,t=!1;return a.hasHybridBridge=!!window.GrowingWebViewJavascriptBridge,a.hasHybridBridge?((null===(i=null===window||void 0===window?void 0:window.GrowingWebViewJavascriptBridge)||void 0===i?void 0:i.configuration)||(window.GrowingWebViewJavascriptBridge.configuration=JSON.parse(window.GrowingWebViewJavascriptBridge.getConfiguration())),(null===(n=null===window||void 0===window?void 0:window.GrowingWebViewJavascriptBridge)||void 0===n?void 0:n.configuration)&&(a.hybridConfig=null===(r=null===window||void 0===window?void 0:window.GrowingWebViewJavascriptBridge)||void 0===r?void 0:r.configuration),t=!0):e.consoleText("gioHybridAdapter:当前不存在 GrowingWebViewJavascriptBridge,Web模式。","info"),t},this.sendBeforeListener=function(e){var n=e.requestData;if(a.hasHybridBridge){var r=a.processAttributes(i({},n));o(f,r.eventType)&&(o(g,r.eventType)?a.penetrateHybrid&&a._dispatchEvent(r):(a.penetrateHybrid||u(r,["userId","userKey","cs1"]),a._dispatchEvent(r)))}},this.processAttributes=function(e){return s(e,(function(i,n){r(i)||t(i)?s(e[n],(function(i,o){r(i)||t(i)?e[n][o]=JSON.stringify(i):e[n][o]=d(i)})):e[n]=d(i)})),e},this._setNativeUserId=function(e){w((function(){return window.GrowingWebViewJavascriptBridge.setNativeUserId(e)}))},this._clearNativeUserId=function(){w((function(){return window.GrowingWebViewJavascriptBridge.clearNativeUserId()}))},this._setNativeUserIdAndUserKey=function(e,i){w((function(){return window.GrowingWebViewJavascriptBridge.setNativeUserIdAndUserKey(e,i)}))},this._clearNativeUserIdAndUserKey=function(){w((function(){return window.GrowingWebViewJavascriptBridge.clearNativeUserIdAndUserKey()}))},this._dispatchEvent=function(e){w((function(){var i;return null===(i=window.GrowingWebViewJavascriptBridge)||void 0===i?void 0:i.dispatchEvent(JSON.stringify(e))}))};var v=this.growingIO,y=v.emitter,I=v.utils;e=I,y.on("OPTION_INITIALIZED",this.onOptionsInit)}}})); +!function(e){"function"==typeof define&&define.amd?define(e):e()}((function(){"use strict";var e=function(){return e=Object.assign||function(e){for(var i,r=1,n=arguments.length;n>r;r++)for(var t in i=arguments[r])({}).hasOwnProperty.call(i,t)&&(e[t]=i[t]);return e},e.apply(this,arguments)};"function"==typeof SuppressedError&&SuppressedError;var i,r=function(e){return o(["undefined","null"],c(e))},n=function(e){return"object"===c(e)&&!r(e)},t=function(e){return Array.isArray(e)&&"array"===c(e)},o=function(e,i){return("array"===c(e)||"string"===c(e))&&e.indexOf(i)>=0},d=function(e){return r(e)?"":"".concat(e)},s=function(e){return n(e)?Object.keys(e):[]},a=function(e,i){s(e).forEach((function(r){return i(e[r],r)}))},u=function(e,i){if(!n(e))return!1;try{return"string"===c(i)?delete e[i]:"array"===c(i)?i.map((function(i){return delete e[i]})):(function(e){return"regexp"===c(e)}(i)&&s(e).forEach((function(r){i.test(r)&&u(e,r)})),!0)}catch(e){return!1}},c=function(e){return{}.toString.call(e).slice(8,-1).toLowerCase()},w=function(e){try{return e()}catch(e){return}},f=["VIEW_CLICK","VIEW_CHANGE","FORM_SUBMIT","PAGE","CUSTOM","LOGIN_USER_ATTRIBUTES"],g=["LOGIN_USER_ATTRIBUTES"];window.gioHybridAdapter={name:"gioHybridAdapter",method:function(r){var s=this;this.growingIO=r,this.penetrateHybrid=!0,this.onOptionsInit=function(){var e,i=s.growingIO,r=i.vdsConfig,n=i.emitter;e=r.penetrateHybrid,"boolean"===c(e)&&(s.penetrateHybrid=r.penetrateHybrid),s._initHybridBridge()&&(s.onSendBefore=s.sendBeforeListener,s.hybridConfig.projectId===s.growingIO.vdsConfig.projectId&&(s.growingIO.useHybridInherit=!0)),s.growingIO.useHybridInherit&&(null==n||n.on("SET_USERID",(function(e){var i=e.newUserId,r=e.oldUserId,n=e.userKey;s.penetrateHybrid&&(!i&&r?n?s._clearNativeUserIdAndUserKey():s._clearNativeUserId():n?s._setNativeUserIdAndUserKey(d(i),d(n)):s._setNativeUserId(d(i)))})),null==n||n.on("SET_USERKEY",(function(e){var i=e.newUserKey,r=e.oldUserKey,n=e.userId;s.penetrateHybrid&&(!i&&r?s._clearNativeUserIdAndUserKey():s._setNativeUserIdAndUserKey(d(n),d(i)))})))},this._initHybridBridge=function(){var e,r,n,t=!1;return s.hasHybridBridge=!!window.GrowingWebViewJavascriptBridge,s.hasHybridBridge?((null===(e=null===window||void 0===window?void 0:window.GrowingWebViewJavascriptBridge)||void 0===e?void 0:e.configuration)||(window.GrowingWebViewJavascriptBridge.configuration=JSON.parse(window.GrowingWebViewJavascriptBridge.getConfiguration())),(null===(r=null===window||void 0===window?void 0:window.GrowingWebViewJavascriptBridge)||void 0===r?void 0:r.configuration)&&(s.hybridConfig=null===(n=null===window||void 0===window?void 0:window.GrowingWebViewJavascriptBridge)||void 0===n?void 0:n.configuration),t=!0):i.consoleText("gioHybridAdapter:当前不存在 GrowingWebViewJavascriptBridge,Web模式。","info"),t},this.sendBeforeListener=function(i){var r=i.requestData;if(s.hasHybridBridge){var n=s.processAttributes(e({},r));u(n,"trackingId"),o(f,n.eventType)&&(o(g,n.eventType)?s.penetrateHybrid&&s._dispatchEvent(n):(s.penetrateHybrid||u(n,["userId","userKey","cs1"]),s._dispatchEvent(n)))}},this.processAttributes=function(e){return a(e,(function(i,r){n(i)||t(i)?a(e[r],(function(i,o){n(i)||t(i)?e[r][o]=JSON.stringify(i):e[r][o]=d(i)})):e[r]=d(i)})),e},this._setNativeUserId=function(e){w((function(){return window.GrowingWebViewJavascriptBridge.setNativeUserId(e)}))},this._clearNativeUserId=function(){w((function(){return window.GrowingWebViewJavascriptBridge.clearNativeUserId()}))},this._setNativeUserIdAndUserKey=function(e,i){w((function(){return window.GrowingWebViewJavascriptBridge.setNativeUserIdAndUserKey(e,i)}))},this._clearNativeUserIdAndUserKey=function(){w((function(){return window.GrowingWebViewJavascriptBridge.clearNativeUserIdAndUserKey()}))},this._dispatchEvent=function(e){w((function(){var i;return null===(i=window.GrowingWebViewJavascriptBridge)||void 0===i?void 0:i.dispatchEvent(JSON.stringify(e))}))};var v=this.growingIO,y=v.emitter,p=v.utils;i=p,y.on("OPTION_INITIALIZED",this.onOptionsInit)}}})); diff --git a/plugins/umd/gioHybridCircle.js b/plugins/umd/gioHybridCircle.js index f283480..4d396fa 100644 --- a/plugins/umd/gioHybridCircle.js +++ b/plugins/umd/gioHybridCircle.js @@ -1 +1 @@ -!function(e){"function"==typeof define&&define.amd?define(e):e()}((function(){"use strict";var e,t,n,r,i,o,a,u=function(){return u=Object.assign||function(e){for(var t,n=1,r=arguments.length;r>n;n++)for(var i in t=arguments[n])({}).hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},u.apply(this,arguments)},s="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},f="function"==typeof Array.from?Array.from:(t||(t=1,n=function(e){return"function"==typeof e},r=function(e){var t=function(e){var t=Number(e);return isNaN(t)?0:0!==t&&isFinite(t)?(t>0?1:-1)*Math.floor(Math.abs(t)):t}(e);return Math.min(Math.max(t,0),9007199254740991)},i=function(e){var t=e.next();return!t.done&&t},e=function(e){var t,o,a,u=this,s=arguments.length>1?arguments[1]:void 0;if(void 0!==s){if(!n(s))throw new TypeError("Array.from: when provided, the second argument must be a function");arguments.length>2&&(t=arguments[2])}var f=function(e,t){if(null!=e&&null!=t){var r=e[t];if(null==r)return;if(!n(r))throw new TypeError(r+" is not a function");return r}}(e,function(e){if(null!=e){if(["string","number","boolean","symbol"].indexOf(typeof e)>-1)return Symbol.iterator;if("undefined"!=typeof Symbol&&"iterator"in Symbol&&Symbol.iterator in e)return Symbol.iterator;if("@@iterator"in e)return"@@iterator"}}(e));if(void 0!==f){o=n(u)?Object(new u):[];var d,l,c=f.call(e);if(null==c)throw new TypeError("Array.from requires an array-like or iterable object");for(a=0;;){if(!(d=i(c)))return o.length=a,o;l=d.value,o[a]=s?s.call(t,l,a):l,a++}}else{var h=Object(e);if(null==e)throw new TypeError("Array.from requires an array-like object - not null or undefined");var p,g=r(h.length);for(o=n(u)?Object(new u(g)):Array(g),a=0;g>a;)p=h[a],o[a]=s?s.call(t,p,a):p,a++;o.length=g}return o}),e),d=function(e){return c(["undefined","null"],g(e))},l=function(e){return"object"===g(e)&&!d(e)},c=function(e,t){return("array"===g(e)||"string"===g(e))&&e.indexOf(t)>=0},h=f,p=function(e,t){if(!l(e))return!1;try{return"string"===g(t)?delete e[t]:"array"===g(t)?t.map((function(t){return delete e[t]})):(function(e){return"regexp"===g(e)}(t)&&function(e){return l(e)?Object.keys(e):[]}(e).forEach((function(n){t.test(n)&&p(e,n)})),!0)}catch(e){return!1}},g=function(e){return{}.toString.call(e).slice(8,-1).toLowerCase()},v=function(e,t,n,r){void 0===r&&(r={}),document.addEventListener?e.addEventListener(t,n,u(u({},{capture:!0}),r)):e.attachEvent?e.attachEvent("on"+t,n):e["on"+t]=n},m={},N={};o=N,a=s&&s.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;o>i;i++)!r&&i in t||(r||(r=[].slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||[].slice.call(t))},Object.defineProperty(o,"__esModule",{value:!0}),o.GROWING_TITLE_OLD=o.GROWING_TITLE=o.GROWING_GTITLE=o.GROWING_CDP_INDEX=o.GROWING_INDEX_OLD=o.GROWING_INDEX=o.GROWING_CONTAINER=o.GROWING_TRACK=o.GROWING_IGNORE=o.VALID_CLASS_SELECTOR=o.VALID_ID_SELECTOR=o.EXCLUDE_CLASS_RE=o.UNSUPPORTED_TAGS=o.TEXT_NODE=o.UNSUPPORTED_CLICK_TAGS=o.SUPPORTED_ICON_TAGS=o.SUPPORTED_CHANGE_TYPES=o.SUPPORTED_CLICK_INPUT_TYPES=o.SUPPORTED_CONTAINER_TAGS=o.LIST_TAGS=void 0,o.LIST_TAGS=["TR","LI","DL"],o.SUPPORTED_CONTAINER_TAGS=a(["A","BUTTON"],o.LIST_TAGS,!0),o.SUPPORTED_CLICK_INPUT_TYPES=["button","submit","reset"],o.SUPPORTED_CHANGE_TYPES=["radio","checkbox","search"],o.SUPPORTED_ICON_TAGS=["I","EM","svg","IMG"],o.UNSUPPORTED_CLICK_TAGS=["TEXTAREA","HTML","BODY"],o.TEXT_NODE=["I","SPAN","EM","B","STRONG"],o.UNSUPPORTED_TAGS=["tspan","text","g","rect","path","defs","clippath","desc","title","math","use"],o.EXCLUDE_CLASS_RE=/(^| |[^ ]+\-)(clear|clearfix|active|hover|enabled|current|selected|unselected|hidden|display|focus|disabled|undisabled|open|checked|unchecked|undefined|null|ng-|growing-)[^\. ]*/g,o.VALID_ID_SELECTOR=/^[a-zA-Z-\_][a-zA-Z\-\_0-9]+$/,o.VALID_CLASS_SELECTOR=/^([a-zA-Z\-\_0-9]+)$/,o.GROWING_IGNORE="data-growing-ignore",o.GROWING_TRACK="data-growing-track",o.GROWING_CONTAINER="data-growing-container",o.GROWING_INDEX="data-growing-index",o.GROWING_INDEX_OLD="data-growing-idx",o.GROWING_CDP_INDEX="data-index",o.GROWING_GTITLE="data-growing-title",o.GROWING_TITLE="data-title",o.GROWING_TITLE_OLD="growing-title";var T={},E={};Object.defineProperty(E,"__esModule",{value:!0}),E.lastFindIndex=E.findIndex=E.arrayEquals=E.rmBlank=E.normalizePath=E.splitNoEmpty=E.filterText=void 0,E.filterText=function(e,t){if(void 0===t&&(t=!0),e&&(null==(e=e.replace(/[\n \t]+/g," ").trim())?void 0:e.length))return e.slice(0,t?50:void 0)},E.splitNoEmpty=function(e,t){return e?e.split(t).filter((function(e){return!!e})):[]},E.normalizePath=function(e){var t=e.length;return t>1&&"/"===e.charAt(t-1)?e.slice(0,t-1):e},E.rmBlank=function(e){return e?e.replace(/[\n \t]+/g,""):""},E.arrayEquals=function(e,t){if(!e||!t)return!1;if(e.length!==t.length)return!1;for(var n=0,r=e.length;r>n;n++)if(e[n]!==t[n])return!1;return!0},E.findIndex=function(e,t){if(null==e||"function"!=typeof t)return-1;for(var n=0;n=0;n--){var r=e[n];if(t.call(void 0,r))return n}return-1},function(e){var t=s&&s.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;o>i;i++)!r&&i in t||(r||(r=[].slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||[].slice.call(t))},n=s&&s.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.removeDiffTagOnHeadAndTail=e.computeXpath=e.getMarkIndex=e.getEffectiveNode=e.isIgnore=e.depthInside=e.changeableInput=e.clickableInput=e.onlyContainsTextChildren=e.onlyContainsIconChildren=e.supportIconTag=e.isContainerTag=e.isListTag=e.isParentOfLeaf=e.isLeaf=e.getChildren=e.getDeepChildren=e.findParent=e.isRootNode=e.hasValidAttribute=void 0;var r=E,i=N,o=n(f);e.hasValidAttribute=function(e,t){return e instanceof Element&&e.hasAttribute(t)&&"false"!==e.getAttribute(t)},e.isRootNode=function(e){return!e||-1!==["BODY","HTML","#document"].indexOf(e.nodeName)},e.findParent=function(t,n){for(var r=t.parentNode;r&&!(0,e.isRootNode)(r);){if(n(r))return r;r=r.parentNode}},e.getDeepChildren=function(n){return(0,o.default)((null==n?void 0:n.childNodes)||[]).reduce((function(n,r){return r instanceof Element?t(t(t([],n,!0),[r],!1),(0,e.getDeepChildren)(r),!0):n}),[])},e.getChildren=function(e){return(0,o.default)((null==e?void 0:e.childNodes)||[]).filter((function(e){return e instanceof Element}))},e.isLeaf=function(t){return!t.hasChildNodes()||"svg"===t.nodeName||0===(0,e.getChildren)(t).length},e.isParentOfLeaf=function(t){return!(!t.hasChildNodes()||"svg"===t.nodeName)&&0===(0,o.default)(t.childNodes).filter((function(t){return!(0,e.isLeaf)(t)})).length},e.isListTag=function(e){return-1!==i.LIST_TAGS.indexOf(e.nodeName)},e.isContainerTag=function(t){return(0,e.hasValidAttribute)(t,i.GROWING_CONTAINER)||-1!==i.SUPPORTED_CONTAINER_TAGS.indexOf(t.nodeName)},e.supportIconTag=function(e){var t=e.nodeName;return-1!==i.SUPPORTED_ICON_TAGS.indexOf(t)},e.onlyContainsIconChildren=function(t){if(t.textContent)return!1;var n=(0,e.getChildren)(t);if(0===n.length)return!1;for(var r=0,i=n;rn)return!1;for(var i="svg"===t.tagName?[]:(0,e.getChildren)(t),o=0;o=r},e.isIgnore=function(t){if(!(t instanceof Element)||(0,e.hasValidAttribute)(t,i.GROWING_IGNORE))return!0;for(var n=t.parentNode;n&&!(0,e.isRootNode)(n);){if((0,e.hasValidAttribute)(n,i.GROWING_IGNORE))return!0;n=n.parentNode}return!1},e.getEffectiveNode=function(t){for(var n,r;t&&(r=void 0,!((n=t)instanceof Element&&-1===i.UNSUPPORTED_TAGS.indexOf(null===(r=n.tagName)||void 0===r?void 0:r.toLowerCase())))&&t.parentNode;)t=t.parentNode;var o,a=t.parentNode;return!(0,e.isRootNode)(a)&&((0,e.onlyContainsIconChildren)(a)||"BUTTON"===(o=a).tagName&&(0,e.onlyContainsTextChildren)(o))?a:t},e.getMarkIndex=function(e){if(e instanceof Element){var t=e.getAttribute(i.GROWING_INDEX)||e.getAttribute(i.GROWING_INDEX_OLD)||e.getAttribute(i.GROWING_CDP_INDEX);if(t){if(/^\d{1,10}$/.test(t)&&+t>=0&&2147483647>+t)return+t;window.console.error("[GioNode]:标记的index不符合规范(index必须是大于等于0且小于2147483647的整数字)。",t)}}},e.computeXpath=function(e){for(var t=e.parentPaths(!0),n=Math.min(t.length,+(t.length>=10)+4),r=["","",""],i=0;ii&&(r[1]=o+r[1])}return r},e.removeDiffTagOnHeadAndTail=function(e,t){var n=function(e){return e.nodeName===t.nodeName},i=(0,r.findIndex)(e,n),o=(0,r.lastFindIndex)(e,n);return-1===i||-1===o?[]:e.slice(i,o+1)}}(T);var I={},_={};Object.defineProperty(_,"__esModule",{value:!0});var O=N,b=E,y=T;function C(e){var t;if(e instanceof Element){var n=e.getAttribute("name");if(n)return[n];if(e.hasAttribute("class")){var r=null===(t=e.getAttribute("class"))||void 0===t?void 0:t.replace(O.EXCLUDE_CLASS_RE,"").trim();if(null==r?void 0:r.length)return r.split(/\s+/).filter((function(e){return O.VALID_CLASS_SELECTOR.test(e)&&!e.match(/[a-z][A-Z][a-z][A-Z]/)&&!e.match(/[0-9][0-9][0-9][0-9]/)})).sort()}}return[]}var L=function(){function e(e){var t;this.node=e,this.tagName=this.node.nodeName,this.name=this.tagName.toLowerCase(),this.id=(t=this.node).id&&O.VALID_ID_SELECTOR.test(t.id)?t.id:null,this.classList=C(this.node),this.guessListAndIndex()}return e.prototype.guessListAndIndex=function(){var e,t=this;this._tagList=(0,y.isListTag)(this.node);var n=(0,y.removeDiffTagOnHeadAndTail)((0,y.getChildren)(this.node.parentNode),this.node);if(this._tagList&&-1!==(o=n.filter((function(e){return e.tagName===t.tagName})).indexOf(this.node))&&(this._index=o+1),n.length>=3&&(null===(e=this.classList)||void 0===e?void 0:e.length)){for(var r=0,i=0,o=1;o<=n.length;o++){var a=n[o-1];if(a.tagName!==this.tagName){i=0;break}(0,b.arrayEquals)(this.classList,C(a))&&(i+=1),this.node===a&&(r=o)}3>i||(this._pseudoList=!0,this._index=this._index||r)}},Object.defineProperty(e.prototype,"path",{get:function(){var e;return this._path||(this._path="/".concat(this.name),this.id&&(this._path+="#".concat(this.id)),(null===(e=this.classList)||void 0===e?void 0:e.length)&&(this._path+=".".concat(this.classList.join(".")))),this._path},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pseudoList",{get:function(){return!!this._pseudoList},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"list",{get:function(){return!!this._tagList||!!this._pseudoList},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"index",{get:function(){var e;return null!==(e=(0,y.getMarkIndex)(this.node))&&void 0!==e?e:this._index},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"container",{get:function(){return(0,y.isContainerTag)(this.node)||this.list},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"parent",{get:function(){return this.node.parentNode?new e(this.node.parentNode):null},enumerable:!1,configurable:!0}),e.prototype.parentPaths=function(e){void 0===e&&(e=!1);for(var t=e?[this]:[],n=this.parent;n&&!(0,y.isRootNode)(n.node);)t.push(n),n=n.parent;return t},e}();_.default=L;var w={};Object.defineProperty(w,"__esModule",{value:!0}),w.getElementHref=w.getImgHref=w.getAnchorHref=void 0;var D=E;function P(e){if(e.hasAttribute("href")){var t=e.getAttribute("href");if(t&&0!==t.indexOf("javascript"))return(0,D.normalizePath)(t.slice(0,320))}}function x(e){if(e.src&&-1===e.src.indexOf("data:image"))return e.src}w.getAnchorHref=P,w.getImgHref=x,w.getElementHref=function(e){var t=e;if(t)switch(e.nodeName.toLowerCase()){case"a":return P(t);case"img":return x(t)}};var R={},A=s&&s.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(R,"__esModule",{value:!0}),R.getElementContent=R.getFormContent=void 0;var S=T,G=w,U=N,W=A(_),H=E,M=A(f),k=function(e){return e.htmlFor||e.getAttribute("for")},j=function(e){var t=e.getAttribute(U.GROWING_GTITLE)||e.getAttribute(U.GROWING_TITLE)||e.getAttribute(U.GROWING_TITLE_OLD)||e.getAttribute("title");return null==t?void 0:t.trim()};function B(e){var t=e.node;return e.list?X(t):(0,H.filterText)(t.textContent)||void 0}function X(e){for(var t=void 0,n=!1,r=0,i=(0,M.default)(e.childNodes);r-1?n.slice(0,r):n}}(t);case"svg":return function(e){for(var t=0,n=(0,M.default)(e.childNodes);t0)return n[n.length-1]}}(t);case"label":return B(a);case"input":return function(e){if((0,S.clickableInput)(e))return e.value;if("password"!==e.type&&(0,S.hasValidAttribute)(e,U.GROWING_TRACK))return e.value;if((0,S.changeableInput)(e)){var t=(0,S.findParent)(e,(function(e){return"LABEL"===e.nodeName}));if(!t&&e.id)for(var n=document.body.getElementsByTagName("label"),r=0;r0)return o+" ("+e.checked+")"}return e.value}}(t);case"select":return r=t,(0,M.default)(r.options).filter((function(e){return e.selected})).map((function(e){return e.label})).join(", ")||r.value;case"form":return V(t)}return(0,S.isLeaf)(t)?function(e){var t=(0,H.filterText)(e.textContent);if(t)return t}(t):(0,S.isParentOfLeaf)(t)&&!(0,S.onlyContainsIconChildren)(t)?function(e){for(var t="",n=0,r=(0,M.default)(e.childNodes);nn;n++)for(var i in t=arguments[n])({}).hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},ee.apply(this,arguments)},te=s&&s.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(m,"__esModule",{value:!0});var ne,re=N,ie=T,oe=te(I),ae=function(){function e(e,t,n){void 0===t&&(t=null),void 0===n&&(n=!0),this.origin=e,this.action=t,this.direct=n,this.target="self"===t?e:(0,ie.getEffectiveNode)(e),this.ignore=(0,ie.isIgnore)(this.target),this.vnode=new oe.default(this.target),this.tagName=this.vnode.tagName}return Object.defineProperty(e.prototype,"content",{get:function(){return this.vnode.content},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"href",{get:function(){return this.vnode.href},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"index",{get:function(){return this.vnode.index},enumerable:!1,configurable:!0}),e.prototype.inferParentIndex=function(){var t=this;return this.parentIndex||(0,ie.findParent)(this.target,(function(n){var r=new e(n,t.action,!1);r.traceable()&&r.index&&(t.parentIndex=r.index)})),this.parentIndex},Object.defineProperty(e.prototype,"xpath",{get:function(){return this.vnode.xpath},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fullXpath",{get:function(){return this.vnode.fullXpath},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"skeleton",{get:function(){return this.vnode.skeleton},enumerable:!1,configurable:!0}),e.prototype.info=function(e){return void 0===e&&(e=!0),e&&this.inferParentIndex(),{skeleton:this.skeleton,fullXpath:this.fullXpath,xpath:this.xpath,content:this.content,href:this.href,index:this.parentIndex||this.index}},e.prototype.traceable=function(){if(this.ignore)return!1;if(this.direct){if("click"===this.action||"hover"===this.action){if(-1!==re.UNSUPPORTED_CLICK_TAGS.indexOf(this.target.tagName))return!1;if("INPUT"===this.target.tagName&&!(0,ie.clickableInput)(this.target))return!1;if(!(0,ie.isContainerTag)(this.target)&&!(0,ie.depthInside)(this.target,5))return!1}return!0}return this.vnode.container},e.prototype.trackNodes=function(){if(!this.traceable())return[];var e=[this];if("submit"!==this.action)for(var t=this.parentElement;t;){if(t.ignore)return[];t.traceable()&&e.unshift(t),t=t.parentElement}var n=void 0;return e.map((function(e){var t=e.info(!1),r=t.index;return!n&&r&&(n=r),ee(ee({},t),{index:n||r})}))},Object.defineProperty(e.prototype,"parentElement",{get:function(){var t=this.target.parentNode;if(t&&t.nodeName&&!(0,ie.isRootNode)(t))return new e(t,this.action,!1)},enumerable:!1,configurable:!0}),e}(),ue=m.default=ae,se=["i","span","em","b","strong","svg"];!function(e){e[e.OUTER=0]="OUTER",e[e.INNER_COVERED=1]="INNER_COVERED",e[e.INNER_SHOW=2]="INNER_SHOW"}(ne||(ne={}));var fe=function(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;o>i;i++)!r&&i in t||(r||(r=[].slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||[].slice.call(t))}(["HR","BR","SCRIPT","NOSCRIPT","STYLE","HEAD","BASE","LINK","META","TITLE","BODY","HTML","TEMPLATE","CODE"],N.UNSUPPORTED_CLICK_TAGS,!0),de=["SELECT","A","BUTTON","INPUT","IMG","FORM"],le=function(e,t,n){return document.elementFromPoint(t,n)===e},ce=function(){function e(e,t,n){this.node=e,this.parentNodeDesc=t,this.devicesInfo=n,this.proxy=new ue(e),this.tagName=this.node.tagName,this.name=this.tagName.toLowerCase(),this.isIgnore=!!this.node.dataset.growingIgnore,this.isUnSupported=-1!==fe.indexOf(this.tagName),this.rect=this.computeWindowRect()}return e.prototype.info=function(){var e=this.desc();e.zLevel+=this.devicesInfo.webviewZLevel;var t=this.getDeviceRect(this.rect);return p(e,"isContainer"),u(u(u({},e),t),{parentXPath:this.parentNodeDesc.isContainer?this.parentNodeDesc.xpath:void 0,href:this.proxy.href,content:this.proxy.content,nodeType:this.nodeType()})},e.prototype.nodeType=function(){return"input"!==this.name||T.changeableInput(this.node)?this.node.tagName:"INPUT_BTN"},e.prototype.desc=function(){return{index:this.parentNodeDesc.index||this.proxy.index,zLevel:this.zLevel(),xpath:this.proxy.xpath,isContainer:this.isDefinedContainer()}},e.prototype.cssVisible=function(){var e=this.computedStyle();return Number(e.opacity)>0&&"visible"===e.visibility&&"none"!==e.display},e.prototype.viewportStatus=function(){var e=this.rect,t=e.top,n=e.left,r=e.width,i=e.height,o=this.devicesInfo,a=o.winWidth,u=o.winHeight;if(0>=r||0>=i)return ne.OUTER;var s=this.node;return u>t&&a>n&&r>0&&i>0?le(s,n+r/2,t+i/2)||le(s,n+1,t+1)||le(s,n+r-1,t+1)||le(s,n+1,t+i-1)||le(s,n+r-1,t+i-1)?ne.INNER_SHOW:ne.INNER_COVERED:ne.OUTER},e.prototype.isCircleable=function(){return this.proxy.target===this.proxy.origin&&(!!this.isDefinedContainer()||!("input"===this.name&&this.node instanceof HTMLInputElement&&"password"===this.node.type)&&(-1!==de.indexOf(this.name)||(T.isLeaf(this.node)?!this.isBigBlank():this.hasBackgroundImage()&&T.depthInside(this.node,4))))},e.prototype.isSimpleContainer=function(){return"select"===this.name||this.isDefaultContainer()&&(function(e,t){if(0===e.children.length)return!1;for(var n=0,r=h(e.children);n0)for(var n=0;nu>>1||o>s>>1)},e.prototype.hasBackgroundImage=function(){var e=this.computedStyle().backgroundImage;return!!e&&"none"!==e&&e.length>0},e.prototype.zLevel=function(){var e=this.computedStyle(),t=e.zIndex;if("auto"!==t)return Number(t||"0")+this.parentNodeDesc.zLevel;switch(e.position){case"relative":return this.parentNodeDesc.zLevel+2;case"sticky":return this.parentNodeDesc.zLevel+3;case"absolute":return this.parentNodeDesc.zLevel+4;case"fixed":return this.parentNodeDesc.zLevel+5;default:return this.parentNodeDesc.zLevel+1}},e.prototype.computeWindowRect=function(){if(this.rect)return this.rect;var e=this.node.getBoundingClientRect(),t=e.top,n=e.bottom,r=e.left,i=e.right-r,o=n-t;return 0>t?o=t+o:t+o>this.devicesInfo.winHeight&&(o=this.devicesInfo.winHeight-t),0>r?i=r+i:r+i>this.devicesInfo.winWidth&&(i=this.devicesInfo.winWidth-r),this.rect={top:t,left:r,width:i,height:o},this.rect},e.prototype.computedStyle=function(){return window.getComputedStyle(this.node)},e.prototype.getDeviceRect=function(e){var t=this.devicesInfo,n=t.scale,r=t.webviewTop,i=t.webviewLeft;return{top:e.top*n+r,left:e.left*n+i,width:e.width*n,height:e.height*n}},e}(),he=["DOMContentLoaded","onreadystatechange"],pe=["scroll","resize","load","beforeunload","popstate","hashchange","pagehide","unload"],ge=function(){function e(e){this.growingIO=e,this.addDomChangeListener()}return e.prototype.getDomTree=function(e,t,n,r,i,o){var a=function(e,t,n,r,i){var o=document.documentElement.clientWidth;return{winWidth:o,winHeight:document.documentElement.clientHeight,scale:n/o,webviewTop:t,webviewLeft:e,webviewWidth:n,webviewHeight:r,webviewZLevel:i}}(e,t,n,r,i),u=this.getElementsByParent(o||document.body,{isContainer:!1,zLevel:0},a),s=this.growingIO.dataStore.currentPage;return{page:{domain:s.domain,path:s.path,query:s.query,title:s.title},elements:u}},e.prototype.getElementsByParent=function(e,t,n){var r=this,i=[];return[].slice.call(e.childNodes,0).filter((function(e){return 1===e.nodeType})).forEach((function(e){var o=new ce(e,t,n);if(o.cssVisible()&&!o.isIgnore){switch(o.viewportStatus()){case ne.INNER_SHOW:o.isCircleable()&&i.push(o.info());break;case ne.INNER_COVERED:o.isDefaultContainer()&&i.push(o.info())}o.isSimpleContainer()||[].push.apply(i,r.getElementsByParent(e,o.desc(),n))}})),i},e.prototype.addDomChangeListener=function(){var e,t=function(t){return void 0===t&&(t=""),function(){var n;"beforeunload"===t&&e&&e.disconnect(),null===(n=window.GrowingWebViewJavascriptBridge)||void 0===n||n.onDomChanged()}};(e=new MutationObserver(t("mutation"))).observe(document.body,{attributes:!0,characterData:!0,childList:!0,subtree:!0}),he.forEach((function(e){v(document,e,t(e))})),pe.forEach((function(e){v(window,e,t(e))}))},e}(),ve=function(){function e(t){var n,r=this;this.growingIO=t,null===(n=this.growingIO.emitter)||void 0===n||n.on("SDK_INITIALIZED",(function(){if(window.GrowingWebViewJavascriptBridge){var t=r;window.GrowingWebViewJavascriptBridge.getDomTree=function(){if(arguments.length>=4)return e.bindGetDomTree(t.growingIO),e.domHelper.getDomTree.apply(e.domHelper,arguments)}}}))}return e.bindGetDomTree=function(e){this.domHelper||(this.domHelper=new ge(e),window.GrowingWebViewJavascriptBridge.getDomTree=this.domHelper.getDomTree.bind(this.domHelper))},e}();window.gioHybridCircle={name:"gioHybridCircle",method:ve}})); +!function(e){"function"==typeof define&&define.amd?define(e):e()}((function(){"use strict";var e=function(){return e=Object.assign||function(e){for(var t,n=1,r=arguments.length;r>n;n++)for(var i in t=arguments[n])({}).hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},e.apply(this,arguments)};"function"==typeof SuppressedError&&SuppressedError;var t,n,r,i,o,a,u,s="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},f="function"==typeof Array.from?Array.from:(n||(n=1,r=function(e){return"function"==typeof e},i=function(e){var t=function(e){var t=Number(e);return isNaN(t)?0:0!==t&&isFinite(t)?(t>0?1:-1)*Math.floor(Math.abs(t)):t}(e);return Math.min(Math.max(t,0),9007199254740991)},o=function(e){var t=e.next();return!t.done&&t},t=function(e){var t,n,a,u=this,s=arguments.length>1?arguments[1]:void 0;if(void 0!==s){if(!r(s))throw new TypeError("Array.from: when provided, the second argument must be a function");arguments.length>2&&(t=arguments[2])}var f=function(e,t){if(null!=e&&null!=t){var n=e[t];if(null==n)return;if(!r(n))throw new TypeError(n+" is not a function");return n}}(e,function(e){if(null!=e){if(["string","number","boolean","symbol"].indexOf(typeof e)>-1)return Symbol.iterator;if("undefined"!=typeof Symbol&&"iterator"in Symbol&&Symbol.iterator in e)return Symbol.iterator;if("@@iterator"in e)return"@@iterator"}}(e));if(void 0!==f){n=r(u)?Object(new u):[];var d,l,c=f.call(e);if(null==c)throw new TypeError("Array.from requires an array-like or iterable object");for(a=0;;){if(!(d=o(c)))return n.length=a,n;l=d.value,n[a]=s?s.call(t,l,a):l,a++}}else{var h=Object(e);if(null==e)throw new TypeError("Array.from requires an array-like object - not null or undefined");var p,g=i(h.length);for(n=r(u)?Object(new u(g)):Array(g),a=0;g>a;)p=h[a],n[a]=s?s.call(t,p,a):p,a++;n.length=g}return n}),t),d=function(e){return c(["undefined","null"],g(e))},l=function(e){return"object"===g(e)&&!d(e)},c=function(e,t){return("array"===g(e)||"string"===g(e))&&e.indexOf(t)>=0},h=f,p=function(e,t){if(!l(e))return!1;try{return"string"===g(t)?delete e[t]:"array"===g(t)?t.map((function(t){return delete e[t]})):(function(e){return"regexp"===g(e)}(t)&&function(e){return l(e)?Object.keys(e):[]}(e).forEach((function(n){t.test(n)&&p(e,n)})),!0)}catch(e){return!1}},g=function(e){return{}.toString.call(e).slice(8,-1).toLowerCase()},v=function(t,n,r,i){void 0===i&&(i={}),document.addEventListener?t.addEventListener(n,r,e(e({},{capture:!0}),i)):t.attachEvent?t.attachEvent("on"+n,r):t["on"+n]=r},m={},N={};a=N,u=s&&s.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;o>i;i++)!r&&i in t||(r||(r=[].slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||[].slice.call(t))},Object.defineProperty(a,"__esModule",{value:!0}),a.GROWING_TITLE_OLD=a.GROWING_TITLE=a.GROWING_GTITLE=a.GROWING_CDP_INDEX=a.GROWING_INDEX_OLD=a.GROWING_INDEX=a.GROWING_CONTAINER=a.GROWING_TRACK=a.GROWING_IGNORE=a.VALID_CLASS_SELECTOR=a.VALID_ID_SELECTOR=a.EXCLUDE_CLASS_RE=a.UNSUPPORTED_TAGS=a.TEXT_NODE=a.UNSUPPORTED_CLICK_TAGS=a.SUPPORTED_ICON_TAGS=a.SUPPORTED_CHANGE_TYPES=a.SUPPORTED_CLICK_INPUT_TYPES=a.SUPPORTED_CONTAINER_TAGS=a.LIST_TAGS=void 0,a.LIST_TAGS=["TR","LI","DL"],a.SUPPORTED_CONTAINER_TAGS=u(["A","BUTTON"],a.LIST_TAGS,!0),a.SUPPORTED_CLICK_INPUT_TYPES=["button","submit","reset"],a.SUPPORTED_CHANGE_TYPES=["radio","checkbox","search"],a.SUPPORTED_ICON_TAGS=["I","EM","svg","IMG"],a.UNSUPPORTED_CLICK_TAGS=["TEXTAREA","HTML","BODY"],a.TEXT_NODE=["I","SPAN","EM","B","STRONG"],a.UNSUPPORTED_TAGS=["tspan","text","g","rect","path","defs","clippath","desc","title","math","use"],a.EXCLUDE_CLASS_RE=/(^| |[^ ]+\-)(clear|clearfix|active|hover|enabled|current|selected|unselected|hidden|display|focus|disabled|undisabled|open|checked|unchecked|undefined|null|ng-|growing-)[^\. ]*/g,a.VALID_ID_SELECTOR=/^[a-zA-Z-\_][a-zA-Z\-\_0-9]+$/,a.VALID_CLASS_SELECTOR=/^([a-zA-Z\-\_0-9]+)$/,a.GROWING_IGNORE="data-growing-ignore",a.GROWING_TRACK="data-growing-track",a.GROWING_CONTAINER="data-growing-container",a.GROWING_INDEX="data-growing-index",a.GROWING_INDEX_OLD="data-growing-idx",a.GROWING_CDP_INDEX="data-index",a.GROWING_GTITLE="data-growing-title",a.GROWING_TITLE="data-title",a.GROWING_TITLE_OLD="growing-title";var T={},E={};Object.defineProperty(E,"__esModule",{value:!0}),E.lastFindIndex=E.findIndex=E.arrayEquals=E.rmBlank=E.normalizePath=E.splitNoEmpty=E.filterText=void 0,E.filterText=function(e,t){if(void 0===t&&(t=!0),e&&(null==(e=e.replace(/[\n \t]+/g," ").trim())?void 0:e.length))return e.slice(0,t?50:void 0)},E.splitNoEmpty=function(e,t){return e?e.split(t).filter((function(e){return!!e})):[]},E.normalizePath=function(e){var t=e.length;return t>1&&"/"===e.charAt(t-1)?e.slice(0,t-1):e},E.rmBlank=function(e){return e?e.replace(/[\n \t]+/g,""):""},E.arrayEquals=function(e,t){if(!e||!t)return!1;if(e.length!==t.length)return!1;for(var n=0,r=e.length;r>n;n++)if(e[n]!==t[n])return!1;return!0},E.findIndex=function(e,t){if(null==e||"function"!=typeof t)return-1;for(var n=0;n=0;n--){var r=e[n];if(t.call(void 0,r))return n}return-1},function(e){var t=s&&s.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;o>i;i++)!r&&i in t||(r||(r=[].slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||[].slice.call(t))},n=s&&s.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.removeDiffTagOnHeadAndTail=e.computeXpath=e.getMarkIndex=e.getEffectiveNode=e.isIgnore=e.depthInside=e.changeableInput=e.clickableInput=e.onlyContainsTextChildren=e.onlyContainsIconChildren=e.supportIconTag=e.isContainerTag=e.isListTag=e.isParentOfLeaf=e.isLeaf=e.getChildren=e.getDeepChildren=e.findParent=e.isRootNode=e.hasValidAttribute=void 0;var r=E,i=N,o=n(f);e.hasValidAttribute=function(e,t){return e instanceof Element&&e.hasAttribute(t)&&"false"!==e.getAttribute(t)},e.isRootNode=function(e){return!e||-1!==["BODY","HTML","#document"].indexOf(e.nodeName)},e.findParent=function(t,n){for(var r=t.parentNode;r&&!(0,e.isRootNode)(r);){if(n(r))return r;r=r.parentNode}},e.getDeepChildren=function(n){return(0,o.default)((null==n?void 0:n.childNodes)||[]).reduce((function(n,r){return r instanceof Element?t(t(t([],n,!0),[r],!1),(0,e.getDeepChildren)(r),!0):n}),[])},e.getChildren=function(e){return(0,o.default)((null==e?void 0:e.childNodes)||[]).filter((function(e){return e instanceof Element}))},e.isLeaf=function(t){return!t.hasChildNodes()||"svg"===t.nodeName||0===(0,e.getChildren)(t).length},e.isParentOfLeaf=function(t){return!(!t.hasChildNodes()||"svg"===t.nodeName)&&0===(0,o.default)(t.childNodes).filter((function(t){return!(0,e.isLeaf)(t)})).length},e.isListTag=function(e){return-1!==i.LIST_TAGS.indexOf(e.nodeName)},e.isContainerTag=function(t){return(0,e.hasValidAttribute)(t,i.GROWING_CONTAINER)||-1!==i.SUPPORTED_CONTAINER_TAGS.indexOf(t.nodeName)},e.supportIconTag=function(e){var t=e.nodeName;return-1!==i.SUPPORTED_ICON_TAGS.indexOf(t)},e.onlyContainsIconChildren=function(t){if(t.textContent)return!1;var n=(0,e.getChildren)(t);if(0===n.length)return!1;for(var r=0,i=n;rn)return!1;for(var i="svg"===t.tagName?[]:(0,e.getChildren)(t),o=0;o=r},e.isIgnore=function(t){if(!(t instanceof Element)||(0,e.hasValidAttribute)(t,i.GROWING_IGNORE))return!0;for(var n=t.parentNode;n&&!(0,e.isRootNode)(n);){if((0,e.hasValidAttribute)(n,i.GROWING_IGNORE))return!0;n=n.parentNode}return!1},e.getEffectiveNode=function(t){for(var n,r;t&&(r=void 0,!((n=t)instanceof Element&&-1===i.UNSUPPORTED_TAGS.indexOf(null===(r=n.tagName)||void 0===r?void 0:r.toLowerCase())))&&t.parentNode;)t=t.parentNode;var o,a=t.parentNode;return!(0,e.isRootNode)(a)&&((0,e.onlyContainsIconChildren)(a)||"BUTTON"===(o=a).tagName&&(0,e.onlyContainsTextChildren)(o))?a:t},e.getMarkIndex=function(e){if(e instanceof Element){var t=e.getAttribute(i.GROWING_INDEX)||e.getAttribute(i.GROWING_INDEX_OLD)||e.getAttribute(i.GROWING_CDP_INDEX);if(t){if(/^\d{1,10}$/.test(t)&&+t>=0&&2147483647>+t)return+t;window.console.error("[GioNode]:标记的index不符合规范(index必须是大于等于0且小于2147483647的整数字)。",t)}}},e.computeXpath=function(e){for(var t=e.parentPaths(!0),n=Math.min(t.length,+(t.length>=10)+4),r=["","",""],i=0;ii&&(r[1]=o+r[1])}return r},e.removeDiffTagOnHeadAndTail=function(e,t){var n=function(e){return e.nodeName===t.nodeName},i=(0,r.findIndex)(e,n),o=(0,r.lastFindIndex)(e,n);return-1===i||-1===o?[]:e.slice(i,o+1)}}(T);var I={},_={};Object.defineProperty(_,"__esModule",{value:!0});var O=N,y=E,b=T;function C(e){var t;if(e instanceof Element){var n=e.getAttribute("name");if(n)return[n];if(e.hasAttribute("class")){var r=null===(t=e.getAttribute("class"))||void 0===t?void 0:t.replace(O.EXCLUDE_CLASS_RE,"").trim();if(null==r?void 0:r.length)return r.split(/\s+/).filter((function(e){return O.VALID_CLASS_SELECTOR.test(e)&&!e.match(/[a-z][A-Z][a-z][A-Z]/)&&!e.match(/[0-9][0-9][0-9][0-9]/)})).sort()}}return[]}var L=function(){function e(e){var t;this.node=e,this.tagName=this.node.nodeName,this.name=this.tagName.toLowerCase(),this.id=(t=this.node).id&&O.VALID_ID_SELECTOR.test(t.id)?t.id:null,this.classList=C(this.node),this.guessListAndIndex()}return e.prototype.guessListAndIndex=function(){var e,t=this;this._tagList=(0,b.isListTag)(this.node);var n=(0,b.removeDiffTagOnHeadAndTail)((0,b.getChildren)(this.node.parentNode),this.node);if(this._tagList&&-1!==(o=n.filter((function(e){return e.tagName===t.tagName})).indexOf(this.node))&&(this._index=o+1),n.length>=3&&(null===(e=this.classList)||void 0===e?void 0:e.length)){for(var r=0,i=0,o=1;o<=n.length;o++){var a=n[o-1];if(a.tagName!==this.tagName){i=0;break}(0,y.arrayEquals)(this.classList,C(a))&&(i+=1),this.node===a&&(r=o)}3>i||(this._pseudoList=!0,this._index=this._index||r)}},Object.defineProperty(e.prototype,"path",{get:function(){var e;return this._path||(this._path="/".concat(this.name),this.id&&(this._path+="#".concat(this.id)),(null===(e=this.classList)||void 0===e?void 0:e.length)&&(this._path+=".".concat(this.classList.join(".")))),this._path},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pseudoList",{get:function(){return!!this._pseudoList},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"list",{get:function(){return!!this._tagList||!!this._pseudoList},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"index",{get:function(){var e;return null!==(e=(0,b.getMarkIndex)(this.node))&&void 0!==e?e:this._index},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"container",{get:function(){return(0,b.isContainerTag)(this.node)||this.list},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"parent",{get:function(){return this.node.parentNode?new e(this.node.parentNode):null},enumerable:!1,configurable:!0}),e.prototype.parentPaths=function(e){void 0===e&&(e=!1);for(var t=e?[this]:[],n=this.parent;n&&!(0,b.isRootNode)(n.node);)t.push(n),n=n.parent;return t},e}();_.default=L;var w={};Object.defineProperty(w,"__esModule",{value:!0}),w.getElementHref=w.getImgHref=w.getAnchorHref=void 0;var D=E;function P(e){if(e.hasAttribute("href")){var t=e.getAttribute("href");if(t&&0!==t.indexOf("javascript"))return(0,D.normalizePath)(t.slice(0,320))}}function x(e){if(e.src&&-1===e.src.indexOf("data:image"))return e.src}w.getAnchorHref=P,w.getImgHref=x,w.getElementHref=function(e){var t=e;if(t)switch(e.nodeName.toLowerCase()){case"a":return P(t);case"img":return x(t)}};var R={},A=s&&s.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(R,"__esModule",{value:!0}),R.getElementContent=R.getFormContent=void 0;var S=T,G=w,U=N,W=A(_),H=E,M=A(f),k=function(e){return e.htmlFor||e.getAttribute("for")},j=function(e){var t=e.getAttribute(U.GROWING_GTITLE)||e.getAttribute(U.GROWING_TITLE)||e.getAttribute(U.GROWING_TITLE_OLD)||e.getAttribute("title");return null==t?void 0:t.trim()};function B(e){var t=e.node;return e.list?X(t):(0,H.filterText)(t.textContent)||void 0}function X(e){for(var t=void 0,n=!1,r=0,i=(0,M.default)(e.childNodes);r-1?n.slice(0,r):n}}(t);case"svg":return function(e){for(var t=0,n=(0,M.default)(e.childNodes);t0)return n[n.length-1]}}(t);case"label":return B(a);case"input":return function(e){if((0,S.clickableInput)(e))return e.value;if("password"!==e.type&&(0,S.hasValidAttribute)(e,U.GROWING_TRACK))return e.value;if((0,S.changeableInput)(e)){var t=(0,S.findParent)(e,(function(e){return"LABEL"===e.nodeName}));if(!t&&e.id)for(var n=document.body.getElementsByTagName("label"),r=0;r0)return o+" ("+e.checked+")"}return e.value}}(t);case"select":return r=t,(0,M.default)(r.options).filter((function(e){return e.selected})).map((function(e){return e.label})).join(", ")||r.value;case"form":return V(t)}return(0,S.isLeaf)(t)?function(e){var t=(0,H.filterText)(e.textContent);if(t)return t}(t):(0,S.isParentOfLeaf)(t)&&!(0,S.onlyContainsIconChildren)(t)?function(e){for(var t="",n=0,r=(0,M.default)(e.childNodes);nn;n++)for(var i in t=arguments[n])({}).hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},ee.apply(this,arguments)},te=s&&s.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(m,"__esModule",{value:!0});var ne,re=N,ie=T,oe=te(I),ae=function(){function e(e,t,n){void 0===t&&(t=null),void 0===n&&(n=!0),this.origin=e,this.action=t,this.direct=n,this.target="self"===t?e:(0,ie.getEffectiveNode)(e),this.ignore=(0,ie.isIgnore)(this.target),this.vnode=new oe.default(this.target),this.tagName=this.vnode.tagName}return Object.defineProperty(e.prototype,"content",{get:function(){return this.vnode.content},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"href",{get:function(){return this.vnode.href},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"index",{get:function(){return this.vnode.index},enumerable:!1,configurable:!0}),e.prototype.inferParentIndex=function(){var t=this;return this.parentIndex||(0,ie.findParent)(this.target,(function(n){var r=new e(n,t.action,!1);r.traceable()&&r.index&&(t.parentIndex=r.index)})),this.parentIndex},Object.defineProperty(e.prototype,"xpath",{get:function(){return this.vnode.xpath},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fullXpath",{get:function(){return this.vnode.fullXpath},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"skeleton",{get:function(){return this.vnode.skeleton},enumerable:!1,configurable:!0}),e.prototype.info=function(e){return void 0===e&&(e=!0),e&&this.inferParentIndex(),{skeleton:this.skeleton,fullXpath:this.fullXpath,xpath:this.xpath,content:this.content,href:this.href,index:this.parentIndex||this.index}},e.prototype.traceable=function(){if(this.ignore)return!1;if(this.direct){if("click"===this.action||"hover"===this.action){if(-1!==re.UNSUPPORTED_CLICK_TAGS.indexOf(this.target.tagName))return!1;if("INPUT"===this.target.tagName&&!(0,ie.clickableInput)(this.target))return!1;if(!(0,ie.isContainerTag)(this.target)&&!(0,ie.depthInside)(this.target,5))return!1}return!0}return this.vnode.container},e.prototype.trackNodes=function(){if(!this.traceable())return[];var e=[this];if("submit"!==this.action)for(var t=this.parentElement;t;){if(t.ignore)return[];t.traceable()&&e.unshift(t),t=t.parentElement}var n=void 0;return e.map((function(e){var t=e.info(!1),r=t.index;return!n&&r&&(n=r),ee(ee({},t),{index:n||r})}))},Object.defineProperty(e.prototype,"parentElement",{get:function(){var t=this.target.parentNode;if(t&&t.nodeName&&!(0,ie.isRootNode)(t))return new e(t,this.action,!1)},enumerable:!1,configurable:!0}),e}(),ue=m.default=ae,se=["i","span","em","b","strong","svg"];!function(e){e[e.OUTER=0]="OUTER",e[e.INNER_COVERED=1]="INNER_COVERED",e[e.INNER_SHOW=2]="INNER_SHOW"}(ne||(ne={}));var fe=function(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;o>i;i++)!r&&i in t||(r||(r=[].slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||[].slice.call(t))}(["HR","BR","SCRIPT","NOSCRIPT","STYLE","HEAD","BASE","LINK","META","TITLE","BODY","HTML","TEMPLATE","CODE"],N.UNSUPPORTED_CLICK_TAGS,!0),de=["SELECT","A","BUTTON","INPUT","IMG","FORM"],le=function(e,t,n){return document.elementFromPoint(t,n)===e},ce=function(){function t(e,t,n){this.node=e,this.parentNodeDesc=t,this.devicesInfo=n,this.proxy=new ue(e),this.tagName=this.node.tagName,this.name=this.tagName.toLowerCase(),this.isIgnore=!!this.node.dataset.growingIgnore,this.isUnSupported=-1!==fe.indexOf(this.tagName),this.rect=this.computeWindowRect()}return t.prototype.info=function(){var t=this.desc();t.zLevel+=this.devicesInfo.webviewZLevel;var n=this.getDeviceRect(this.rect);return p(t,"isContainer"),e(e(e({},t),n),{parentXPath:this.parentNodeDesc.isContainer?this.parentNodeDesc.xpath:void 0,href:this.proxy.href,content:this.proxy.content,nodeType:this.nodeType()})},t.prototype.nodeType=function(){return"input"!==this.name||T.changeableInput(this.node)?this.node.tagName:"INPUT_BTN"},t.prototype.desc=function(){return{index:this.parentNodeDesc.index||this.proxy.index,zLevel:this.zLevel(),xpath:this.proxy.fullXpath,isContainer:this.isDefinedContainer()}},t.prototype.cssVisible=function(){var e=this.computedStyle();return Number(e.opacity)>0&&"visible"===e.visibility&&"none"!==e.display},t.prototype.viewportStatus=function(){var e=this.rect,t=e.top,n=e.left,r=e.width,i=e.height,o=this.devicesInfo,a=o.winWidth,u=o.winHeight;if(0>=r||0>=i)return ne.OUTER;var s=this.node;return u>t&&a>n&&r>0&&i>0?le(s,n+r/2,t+i/2)||le(s,n+1,t+1)||le(s,n+r-1,t+1)||le(s,n+1,t+i-1)||le(s,n+r-1,t+i-1)?ne.INNER_SHOW:ne.INNER_COVERED:ne.OUTER},t.prototype.isCircleable=function(){return this.proxy.target===this.proxy.origin&&(!!this.isDefinedContainer()||!("input"===this.name&&this.node instanceof HTMLInputElement&&"password"===this.node.type)&&(-1!==de.indexOf(this.name)||(T.isLeaf(this.node)?!this.isBigBlank():this.hasBackgroundImage()&&T.depthInside(this.node,4))))},t.prototype.isSimpleContainer=function(){return"select"===this.name||this.isDefaultContainer()&&(function(e,t){if(0===e.children.length)return!1;for(var n=0,r=h(e.children);n0)for(var n=0;nu>>1||o>s>>1)},t.prototype.hasBackgroundImage=function(){var e=this.computedStyle().backgroundImage;return!!e&&"none"!==e&&e.length>0},t.prototype.zLevel=function(){var e=this.computedStyle(),t=e.zIndex;if("auto"!==t)return Number(t||"0")+this.parentNodeDesc.zLevel;switch(e.position){case"relative":return this.parentNodeDesc.zLevel+2;case"sticky":return this.parentNodeDesc.zLevel+3;case"absolute":return this.parentNodeDesc.zLevel+4;case"fixed":return this.parentNodeDesc.zLevel+5;default:return this.parentNodeDesc.zLevel+1}},t.prototype.computeWindowRect=function(){if(this.rect)return this.rect;var e=this.node.getBoundingClientRect(),t=e.top,n=e.bottom,r=e.left,i=e.right-r,o=n-t;return 0>t?o=t+o:t+o>this.devicesInfo.winHeight&&(o=this.devicesInfo.winHeight-t),0>r?i=r+i:r+i>this.devicesInfo.winWidth&&(i=this.devicesInfo.winWidth-r),this.rect={top:t,left:r,width:i,height:o},this.rect},t.prototype.computedStyle=function(){return window.getComputedStyle(this.node)},t.prototype.getDeviceRect=function(e){var t=this.devicesInfo,n=t.scale,r=t.webviewTop,i=t.webviewLeft;return{top:e.top*n+r,left:e.left*n+i,width:e.width*n,height:e.height*n}},t}(),he=["DOMContentLoaded","onreadystatechange"],pe=["scroll","resize","load","beforeunload","popstate","hashchange","pagehide","unload"],ge=function(){function e(e){this.growingIO=e,this.addDomChangeListener()}return e.prototype.getDomTree=function(e,t,n,r,i,o){var a=function(e,t,n,r,i){var o=document.documentElement.clientWidth;return{winWidth:o,winHeight:document.documentElement.clientHeight,scale:n/o,webviewTop:t,webviewLeft:e,webviewWidth:n,webviewHeight:r,webviewZLevel:i}}(e,t,n,r,i),u=this.getElementsByParent(o||document.body,{isContainer:!1,zLevel:0},a),s=this.growingIO.dataStore.currentPage;return{page:{domain:s.domain,path:s.path,query:s.query,title:s.title},elements:u}},e.prototype.getElementsByParent=function(e,t,n){var r=this,i=[];return[].slice.call(e.childNodes,0).filter((function(e){return 1===e.nodeType})).forEach((function(e){var o=new ce(e,t,n);if(o.cssVisible()&&!o.isIgnore){switch(o.viewportStatus()){case ne.INNER_SHOW:o.isCircleable()&&i.push(o.info());break;case ne.INNER_COVERED:o.isDefaultContainer()&&i.push(o.info())}o.isSimpleContainer()||[].push.apply(i,r.getElementsByParent(e,o.desc(),n))}})),i},e.prototype.addDomChangeListener=function(){var e,t=function(t){return void 0===t&&(t=""),function(){var n;"beforeunload"===t&&e&&e.disconnect(),null===(n=window.GrowingWebViewJavascriptBridge)||void 0===n||n.onDomChanged()}};(e=new MutationObserver(t("mutation"))).observe(document.body,{attributes:!0,characterData:!0,childList:!0,subtree:!0}),he.forEach((function(e){v(document,e,t(e))})),pe.forEach((function(e){v(window,e,t(e))}))},e}(),ve=function(){function e(t){var n,r=this;this.growingIO=t,null===(n=this.growingIO.emitter)||void 0===n||n.on("SDK_INITIALIZED",(function(){if(window.GrowingWebViewJavascriptBridge){var t=r;window.GrowingWebViewJavascriptBridge.getDomTree=function(){if(arguments.length>=4)return e.bindGetDomTree(t.growingIO),e.domHelper.getDomTree.apply(e.domHelper,arguments)}}}))}return e.bindGetDomTree=function(e){this.domHelper||(this.domHelper=new ge(e),window.GrowingWebViewJavascriptBridge.getDomTree=this.domHelper.getDomTree.bind(this.domHelper))},e}();window.gioHybridCircle={name:"gioHybridCircle",method:ve}})); diff --git a/plugins/umd/gioImpressionTracking.js b/plugins/umd/gioImpressionTracking.js index 1dd6333..6aff278 100644 --- a/plugins/umd/gioImpressionTracking.js +++ b/plugins/umd/gioImpressionTracking.js @@ -1 +1 @@ -!function(t){"function"==typeof define&&define.amd?define(t):t()}((function(){"use strict";var t,e,r,n,i,o="function"==typeof Array.from?Array.from:(e||(e=1,r=function(t){return"function"==typeof t},n=function(t){var e=function(t){var e=Number(t);return isNaN(e)?0:0!==e&&isFinite(e)?(e>0?1:-1)*Math.floor(Math.abs(e)):e}(t);return Math.min(Math.max(e,0),9007199254740991)},i=function(t){var e=t.next();return!e.done&&e},t=function(t){var e,o,a,u=this,s=arguments.length>1?arguments[1]:void 0;if(void 0!==s){if(!r(s))throw new TypeError("Array.from: when provided, the second argument must be a function");arguments.length>2&&(e=arguments[2])}var c=function(t,e){if(null!=t&&null!=e){var n=t[e];if(null==n)return;if(!r(n))throw new TypeError(n+" is not a function");return n}}(t,function(t){if(null!=t){if(["string","number","boolean","symbol"].indexOf(typeof t)>-1)return Symbol.iterator;if("undefined"!=typeof Symbol&&"iterator"in Symbol&&Symbol.iterator in t)return Symbol.iterator;if("@@iterator"in t)return"@@iterator"}}(t));if(void 0!==c){o=r(u)?Object(new u):[];var l,f,v=c.call(t);if(null==v)throw new TypeError("Array.from requires an array-like or iterable object");for(a=0;;){if(!(l=i(v)))return o.length=a,o;f=l.value,o[a]=s?s.call(e,f,a):f,a++}}else{var d=Object(t);if(null==t)throw new TypeError("Array.from requires an array-like object - not null or undefined");var m,p=n(d.length);for(o=r(u)?Object(new u(p)):Array(p),a=0;p>a;)m=d[a],o[a]=s?s.call(e,m,a):m,a++;o.length=p}return o}),t),a=function(t){return l(["undefined","null"],b(t))},u=function(t){return"object"===b(t)&&!a(t)},s=function(t){return Array.isArray(t)&&"array"===b(t)},c=function(t){try{return f(t)[0]}catch(t){return}},l=function(t,e){return("array"===b(t)||"string"===b(t))&&t.indexOf(e)>=0},f=o,v=function(t){return a(t)?"":"".concat(t)},d=function(t){if("string"===b(t)){var e=function(t,e){return"string"==typeof t?t.split(""):t}(t);return"".concat(c(e).toLowerCase()).concat((r=e,void 0===n&&(n=1),s(r)&&function(t){return"number"===b(t)}(n)?r.slice(n>0?n:1,r.length):r).join(""))}var r,n;return t},m={}.hasOwnProperty,p=function(t,e){return!a(t)&&m.call(t,e)},g=function(t){return u(t)?Object.keys(t):[]},b=function(t){return{}.toString.call(t).slice(8,-1).toLowerCase()},I=function(){return I=Object.assign||function(t){for(var e,r=1,n=arguments.length;n>r;r++)for(var i in e=arguments[r])({}).hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},I.apply(this,arguments)},y=function(t){try{return t()}catch(t){return}},h=function(t){var e={};return u(t)&&function(t,r){g(t).forEach((function(r){return function(t,r){var n,i=v(r).slice(0,100);u(t)?e[i]=h(t):s(t)?(e[i]=t.slice(0,100),"cdp"===(null===(n=window.vds)||void 0===n?void 0:n.gioEnvironment)&&(e[i]=e[i].join("||").slice(0,1e3))):e[i]=a(t)?"":v(t).slice(0,1e3)}(t[r],r)}))}(t),e},O=function(t,e,r,n){void 0===n&&(n={}),document.addEventListener?t.addEventListener(e,r,I(I({},{capture:!0}),n)):t.attachEvent?t.attachEvent("on"+e,r):t["on"+e]=r};window.gioImpressionTracking={name:"gioImpressionTracking",method:function(t){var e,r=this;this.growingIO=t,this.documentReady=!1,this.main=function(t){"listener"===t?(r.documentReady=!0,r.growingIO.gioSDKInitialized&&r.initMutationObserver()):"emitter"===t&&r.documentReady&&r.initMutationObserver()},this.initIntersectionObserver=function(){r.intersectionObserver=new IntersectionObserver((function(t){var e;(s(e=t)?0===e.length:u(e)?0===g(e).length:!e)||t.map((function(t){var e=t.target,n=e.dataset,i=e.id;if(t.intersectionRatio>0){var o=r.getImpressionProperties(n),a=o.eventId,u=o.properties,s=o.items;if(i){if("once"===n.gioImpType&&p(r.sentImps,i))return;r.sentImps[i]={eventId:a,properties:u,items:s}}a&&r.growingIO.track(a,u,s)}}))}))},this.initMutationObserver=function(){var t;r.mutationObserver&&(null===(t=r.mutationObserver)||void 0===t||t.disconnect());var e=document.querySelectorAll("[data-gio-imp-track]");f(e).map((function(t){var e;null===(e=r.intersectionObserver)||void 0===e||e.observe(t)})),r.mutationObserver=new MutationObserver((function(t){t.map((function(t){var e,n;"attributes"===t.type&&(null===(e=t.target.dataset)||void 0===e?void 0:e.gioImpTrack)&&(null===(n=r.intersectionObserver)||void 0===n||n.observe(t.target))}))})),r.mutationObserver.observe(document.body,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0,attributeFilter:["data-gio-imp-track","data-gio-imp-attrs","data-gio-imp-items",/^data-gio-track-[a-z]+$/i]})},this.getImpressionProperties=function(t){var e={eventId:void 0,properties:{}};if(!(null==t?void 0:t.gioImpTrack))return e;if(e.eventId=t.gioImpTrack,p(t,"gioImpAttrs"))e.properties=y((function(){return u(t.gioImpAttrs)?t.gioImpAttrs:JSON.parse(t.gioImpAttrs)})),e.items=y((function(){return u(t.gioImpItems)?t.gioImpItems:JSON.parse(t.gioImpItems)}));else{var r=/^gioTrack(.+)/;for(var n in t){var i=void 0,o=n.match(r);o&&"track"!==(i=d(o[1]))&&(e.properties[i]=t[n])}}return e.properties=h(e.properties),e.items=h(e.items),/^\w+$/.test(e.eventId)&&!Number.isInteger(Number(c(e.eventId.split(""))))||(e.eventId=null,e={}),e},this.sentImps={},window.IntersectionObserver&&window.MutationObserver?(this.initIntersectionObserver(),O(document,"readystatechange",(function(){l(["interactive","complete"],document.readyState)&&r.main("listener")}),{once:!0}),null===(e=this.growingIO.emitter)||void 0===e||e.on("SDK_INITIALIZED",(function(){return r.main("emitter")})),O(window,"unload",(function(){var t,e;null===(t=r.intersectionObserver)||void 0===t||t.disconnect(),null===(e=r.mutationObserver)||void 0===e||e.disconnect()}))):("warn",console.log("%c [GrowingIO]:当前浏览器不支持半自动埋点,gioImpressionTracking已自动关闭!","color: #F59E0B;"))}}})); +!function(t){"function"==typeof define&&define.amd?define(t):t()}((function(){"use strict";var t,r,e,n,i,o="function"==typeof Array.from?Array.from:(r||(r=1,e=function(t){return"function"==typeof t},n=function(t){var r=function(t){var r=Number(t);return isNaN(r)?0:0!==r&&isFinite(r)?(r>0?1:-1)*Math.floor(Math.abs(r)):r}(t);return Math.min(Math.max(r,0),9007199254740991)},i=function(t){var r=t.next();return!r.done&&r},t=function(t){var r,o,a,u=this,s=arguments.length>1?arguments[1]:void 0;if(void 0!==s){if(!e(s))throw new TypeError("Array.from: when provided, the second argument must be a function");arguments.length>2&&(r=arguments[2])}var c=function(t,r){if(null!=t&&null!=r){var n=t[r];if(null==n)return;if(!e(n))throw new TypeError(n+" is not a function");return n}}(t,function(t){if(null!=t){if(["string","number","boolean","symbol"].indexOf(typeof t)>-1)return Symbol.iterator;if("undefined"!=typeof Symbol&&"iterator"in Symbol&&Symbol.iterator in t)return Symbol.iterator;if("@@iterator"in t)return"@@iterator"}}(t));if(void 0!==c){o=e(u)?Object(new u):[];var f,l,v=c.call(t);if(null==v)throw new TypeError("Array.from requires an array-like or iterable object");for(a=0;;){if(!(f=i(v)))return o.length=a,o;l=f.value,o[a]=s?s.call(r,l,a):l,a++}}else{var d=Object(t);if(null==t)throw new TypeError("Array.from requires an array-like object - not null or undefined");var m,p=n(d.length);for(o=e(u)?Object(new u(p)):Array(p),a=0;p>a;)m=d[a],o[a]=s?s.call(r,m,a):m,a++;o.length=p}return o}),t),a=function(t){return f(["undefined","null"],b(t))},u=function(t){return"object"===b(t)&&!a(t)},s=function(t){return Array.isArray(t)&&"array"===b(t)},c=function(t){try{return l(t)[0]}catch(t){return}},f=function(t,r){return("array"===b(t)||"string"===b(t))&&t.indexOf(r)>=0},l=o,v=function(t){return a(t)?"":"".concat(t)},d=function(t){if("string"===b(t)){var r=function(t,r){return"string"==typeof t?t.split(""):t}(t);return"".concat(c(r).toLowerCase()).concat((e=r,void 0===n&&(n=1),s(e)&&function(t){return"number"===b(t)}(n)?e.slice(n>0?n:1,e.length):e).join(""))}var e,n;return t},m={}.hasOwnProperty,p=function(t,r){return!a(t)&&m.call(t,r)},g=function(t){return u(t)?Object.keys(t):[]},b=function(t){return{}.toString.call(t).slice(8,-1).toLowerCase()},y=function(){return y=Object.assign||function(t){for(var r,e=1,n=arguments.length;n>e;e++)for(var i in r=arguments[e])({}).hasOwnProperty.call(r,i)&&(t[i]=r[i]);return t},y.apply(this,arguments)};"function"==typeof SuppressedError&&SuppressedError;var I=function(t){try{return t()}catch(t){return}},h=function(t){var r={};return u(t)&&function(t,e){g(t).forEach((function(e){return function(t,e){var n,i=v(e).slice(0,100);u(t)?r[i]=h(t):s(t)?(r[i]=t.slice(0,100),"cdp"===(null===(n=window.vds)||void 0===n?void 0:n.gioEnvironment)&&(r[i]=r[i].join("||").slice(0,1e3))):r[i]=a(t)?"":v(t).slice(0,1e3)}(t[e],e)}))}(t),r},O=function(t,r,e,n){void 0===n&&(n={}),document.addEventListener?t.addEventListener(r,e,y(y({},{capture:!0}),n)):t.attachEvent?t.attachEvent("on"+r,e):t["on"+r]=e};window.gioImpressionTracking={name:"gioImpressionTracking",method:function(t){var r,e=this;this.growingIO=t,this.documentReady=!1,this.main=function(t){"listener"===t?(e.documentReady=!0,e.growingIO.gioSDKInitialized&&e.initMutationObserver()):"emitter"===t&&e.documentReady&&e.initMutationObserver()},this.initIntersectionObserver=function(){e.intersectionObserver=new IntersectionObserver((function(t){var r;(s(r=t)?0===r.length:u(r)?0===g(r).length:!r)||t.map((function(t){var r=t.target,n=r.dataset,i=r.id;if(t.intersectionRatio>0){var o=e.getImpressionProperties(n),a=o.eventId,u=o.properties,s=o.items;if(i){if("once"===n.gioImpType&&p(e.sentImps,i))return;e.sentImps[i]={eventId:a,properties:u,items:s}}a&&e.growingIO.track(a,u,s)}}))}))},this.initMutationObserver=function(){var t;e.mutationObserver&&(null===(t=e.mutationObserver)||void 0===t||t.disconnect());var r=document.querySelectorAll("[data-gio-imp-track]");l(r).map((function(t){var r;null===(r=e.intersectionObserver)||void 0===r||r.observe(t)})),e.mutationObserver=new MutationObserver((function(t){t.map((function(t){var r,n;"attributes"===t.type&&(null===(r=t.target.dataset)||void 0===r?void 0:r.gioImpTrack)&&(null===(n=e.intersectionObserver)||void 0===n||n.observe(t.target))}))})),e.mutationObserver.observe(document.body,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0,attributeFilter:["data-gio-imp-track","data-gio-imp-attrs","data-gio-imp-items",/^data-gio-track-[a-z]+$/i]})},this.getImpressionProperties=function(t){var r={eventId:void 0,properties:{}};if(!(null==t?void 0:t.gioImpTrack))return r;if(r.eventId=t.gioImpTrack,p(t,"gioImpAttrs"))r.properties=I((function(){return u(t.gioImpAttrs)?t.gioImpAttrs:JSON.parse(t.gioImpAttrs)})),r.items=I((function(){return u(t.gioImpItems)?t.gioImpItems:JSON.parse(t.gioImpItems)}));else{var e=/^gioTrack(.+)/;for(var n in t){var i=void 0,o=n.match(e);o&&"track"!==(i=d(o[1]))&&(r.properties[i]=t[n])}}return r.properties=h(r.properties),r.items=h(r.items),/^\w+$/.test(r.eventId)&&!Number.isInteger(Number(c(r.eventId.split(""))))||(r.eventId=null,r={}),r},this.sentImps={},window.IntersectionObserver&&window.MutationObserver?(this.initIntersectionObserver(),O(document,"readystatechange",(function(){f(["interactive","complete"],document.readyState)&&e.main("listener")}),{once:!0}),null===(r=this.growingIO.emitter)||void 0===r||r.on("SDK_INITIALIZED",(function(){return e.main("emitter")})),O(window,"unload",(function(){var t,r;null===(t=e.intersectionObserver)||void 0===t||t.disconnect(),null===(r=e.mutationObserver)||void 0===r||r.disconnect()}))):("warn",console.log("%c [GrowingIO]:当前浏览器不支持半自动埋点,gioImpressionTracking已自动关闭!","color: #F59E0B;"))}}}));