hina-cloud-js-sdk 3.1.7 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/hina.cjs.js +1 -0
- package/dist/hina.esm.full.js +1 -0
- package/dist/hina.esm.js +1 -0
- package/dist/hina.full.js +1 -0
- package/dist/hina.iife.js +1 -0
- package/dist/index.d.ts +411 -0
- package/package.json +28 -43
- package/readme.md +1 -0
- package/.eslintrc.js +0 -12
- package/.gitlab-ci.yml +0 -20
- package/.vscode/settings.json +0 -5
- package/build/hina.esm.min.js +0 -1
- package/build/hina.min.js +0 -4
- package/build/hotAnalyse.min.js +0 -1
- package/report.json +0 -101
- package/rollup.config.epm.js +0 -42
- package/rollup.config.sdk.js +0 -42
- package/sonar-project.properties +0 -3
package/dist/hina.cjs.js
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("hina-cloud-core"),e=require("hina-cloud-types"),i=require("hina-cloud-utils"),r=require("hina-cloud-monitor"),o=function(t,e){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},o(t,e)};function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function i(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}var s=function(){return s=Object.assign||function(t){for(var e,i=1,r=arguments.length;i<r;i++)for(var o in e=arguments[i])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},s.apply(this,arguments)};function a(t){var e="function"==typeof Symbol&&Symbol.iterator,i=e&&t[e],r=0;if(i)return i.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function c(t,e){var i="function"==typeof Symbol&&t[Symbol.iterator];if(!i)return t;var r,o,n=i.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(r=n.next()).done;)s.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(i=n.return)&&i.call(n)}finally{if(o)throw o.error}}return s}function l(t,e,i){if(i||2===arguments.length)for(var r,o=0,n=e.length;o<n;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))}"function"==typeof SuppressedError&&SuppressedError;var u=["mark","/mark","strong","b","em","i","u","abbr","ins","del","s","sup"],p=["a","input","button","textarea"],h=["abtestExperimentId","paramName","valueType","defaultValue","callback","timeoutMilliseconds","customProperties","customIds"],f=function(t){function r(e,i){var r=t.call(this,e,i)||this;return r.options=e,r.context=i,r.name="ClickTrackPlugin",r.isReady=!1,r.isTrackList={a:!0,button:!0},r}return n(r,t),r.prototype.init=function(t){var r=this,o=this.options.autoTrackConfig,n=o.clickAutoTrack,s=o.isCollectUrl,a=o.isCollectElement,c=o.addCustomProperty;!0===n&&(this.isReady?this.context.log("ClickTrack plugin:插件已经运行,无需重复执行",e.ConsoleTypes.WARN):(this.isReady=!0,document.addEventListener("click",(function(e){if(s()){var o=e||window.event;if(o){var n=o.target||o.srcElement,l=r.getTargetElement(n);if(l){if(i.isFunction(a)&&!a(l))return!1;var u=r.getClickElementInfo(l),p=i.getPageXYInfo(o,l),h=p.H_page_x,f=p.H_page_y;if(u.H_page_x=h,u.H_page_y=f,i.isFunction(c)){var g=c(l);i.isObject(g)&&(u=i.merge(u,g))}t(u)}}}}),!0)))},r.prototype.transform=function(t){return this.context.getReportData("track","H_WebClick",t)},r.prototype.hasAttribute=function(t,e){var i;return t.hasAttribute?t.hasAttribute(e):t.attributes?!!(null===(i=t.attributes[e])||void 0===i?void 0:i.value):void 0},r.prototype.hasAttributes=function(t,e){if(i.isArray(e))for(var r=0;r<e.length;r++)if(this.hasAttribute(t,e[r]))return!0;return!1},r.prototype.hasElement=function(t){var e,r,o,n=i.getElementParents(t),s=this.options.autoTrackConfig.trackAttr||[];if(i.isArray(n)&&n.length>0)try{for(var c=a(n),l=c.next();!l.done;l=c.next()){var u=l.value,p=u.tagName&&(null===(o=u.tagName)||void 0===o?void 0:o.toLowerCase());if(i.isElement(u)&&(this.isTrackList[p]||this.hasAttributes(u,s)))return u}}catch(t){e={error:t}}finally{try{l&&!l.done&&(r=c.return)&&r.call(c)}finally{if(e)throw e.error}}},r.prototype.getDivMaxLevel=function(){var t;return(null===(t=this.options.autoTrackConfig.collectTags.div)||void 0===t?void 0:t.maxLevel)||1},r.prototype.isStyleTag=function(t){var e,i=(null===(e=this.options.autoTrackConfig.collectTags.div)||void 0===e?void 0:e.ignoreTags)||[];return null==i?void 0:i.includes(t)},r.prototype.getCollectableParent=function(t){var i;try{var r=t.parentNode,o=r?null===(i=r.tagName)||void 0===i?void 0:i.toLowerCase():"";if("body"===o)return!1;var n=this.getDivMaxLevel();if("div"===o&&(n>1||this.isCollectableDiv(r)))return r;if(r&&this.isStyleTag(o))return this.getCollectableParent(r)}catch(t){this.context.log(t,e.ConsoleTypes.ERROR)}return!1},r.prototype.isCollectableDiv=function(t){var r;try{var o=t.children||[];if(0===o.length)return!0;for(var n=0;n<o.length;n++){var s=o[n];if(i.isElement(s)){var a=null===(r=s.tagName)||void 0===r?void 0:r.toLowerCase(),c=this.getDivMaxLevel();if(!("div"===a&&c>1||this.isStyleTag(a)))return!1;if(!this.isCollectableDiv(s))return!1}}return!0}catch(t){this.context.log(t,e.ConsoleTypes.ERROR)}return!1},r.prototype.isDivLevelValid=function(t){for(var e=this.getDivMaxLevel(),i=t.getElementsByTagName("div"),r=i.length-1;r>=0;r--)if(this.getDivLevels(i[r],t)>e)return!1;return!0},r.prototype.getElementPath=function(t,e,r){for(var o,n,s=[];i.isElement(t)&&t.parentNode;){if(t.id&&!e&&/^[A-Za-z][-A-Za-z0-9_:.]*$/.test(t.id)){var a=t.tagName||"";s.unshift("".concat(a.toLowerCase(),"#").concat(t.id));break}if(r&&t===r){s.unshift(null===(o=t.tagName)||void 0===o?void 0:o.toLowerCase());break}if(t===document.body){s.unshift("body");break}s.unshift(null===(n=t.tagName)||void 0===n?void 0:n.toLowerCase()),t=t.parentNode}return s.join(" > ")},r.prototype.getDivLevels=function(t,e){var i=this.getElementPath(t,!0,e).split(" > "),r=0;return i.forEach((function(t){"div"===t&&r++})),r},r.prototype.getTargetElement=function(t){var e;if(!i.isElement(t))return null;var r=null===(e=t.tagName)||void 0===e?void 0:e.toLowerCase();if(!i.isString(r))return null;if(["body","html"].includes(r))return null;if(this.context.trackTags.includes(r)&&"div"!==r)return t;if("div"===r&&this.options.autoTrackConfig.collectTags.div&&(this.isDivLevelValid(t)&&(this.getDivMaxLevel()>1||this.isCollectableDiv(t))))return t;if(this.options.autoTrackConfig.collectTags.div&&this.isStyleTag(r)){var o=this.getCollectableParent(t);if(o&&this.isDivLevelValid(o))return o}return this.hasElement(t)||null},r.prototype.getClickElementInfo=function(t){var e=this.options.autoTrackConfig.isCollectInput,r=!1;i.isFunction(e)&&(r=e(t));var o=this.getDomSelector(t),n=i.getElementProperties(t,r);return n.H_element_selector=o,n.H_element_path=this.getElementPath(t,!1),n},r.prototype.getDomSelector=function(t){for(var e,r=[];t;){if("body"===(null===(e=t.tagName)||void 0===e?void 0:e.toLowerCase())||!i.isElement(t)){r.unshift("body");break}if(r.unshift(this.getSelector(t)),(null==t?void 0:t.getAttribute("id"))&&/^[A-Za-z][-A-Za-z0-9_:.]*$/.test(t.getAttribute("id")))break;t=t.parentNode}return r.join(" > ")},r.prototype.getSelector=function(t){var e,i,r=null===(e=t.tagName)||void 0===e?void 0:e.toLowerCase(),o=-1;9!==(null===(i=t.parentNode)||void 0===i?void 0:i.nodeType)&&(o=this.getDomIndex(t));var n=t.getAttribute("id");return n&&/^[A-Za-z][-A-Za-z0-9_:.]*$/.test(n)?"#".concat(n):r+(o>-1?":nth-of-type(".concat(o+1,")"):"")},r.prototype.getDomIndex=function(t){var e,i;if(t.parentNode)for(var r=0,o=null===(e=t.tagName)||void 0===e?void 0:e.toLowerCase(),n=t.parentNode.children,s=0;s<n.length;s++){var a=n[s];if((null===(i=a.tagName)||void 0===i?void 0:i.toLowerCase())===o){if(a===t)return r;r++}}return-1},r}(e.PluginBase),g=function(t){function r(e,r){var o=t.call(this,e,r)||this;return o.options=e,o.context=r,o.name="StayTrackPlugin",o.isReady=!1,o.timer=null,o.previousTime=i.nowStamp(),o.previousOffsetTop=0,o}return n(r,t),r.prototype.init=function(t){var r=this,o=this.options,n=o.autoTrackConfig,s=o.stayAutoTrackConfig;if(!0===n.stayAutoTrack)if(this.isReady)this.context.log("StayTrack plugin:插件已经运行,无需重复执行",e.ConsoleTypes.WARN);else{this.isReady=!0;var a=s.isCollectUrl;i.isFunction(a)||(a=function(){return!0}),this.timer&&(clearTimeout(this.timer),this.timer=null),this.previousTime=i.nowStamp(),window.addEventListener("load",(function(){r.previousOffsetTop=i.getScrollTop()})),window.addEventListener("scroll",(function(){a()&&(r.timer||(r.timer=setTimeout((function(){r.run(t),clearTimeout(r.timer),r.timer=null}),1e3)))})),window.addEventListener("unload",(function(){a()&&r.run(t,!0)}))}},r.prototype.transform=function(t){return this.context.getReportData("track","H_WebStay",t)},r.prototype.run=function(t,e){void 0===e&&(e=!1);var r=this.options.autoTrackConfig,o=r.stayDelayTime,n=r.maxStayPageDuration,s=i.getScrollTop(),a=i.nowStamp(),c=a-this.previousTime;(e||c>o&&s!==this.previousOffsetTop)&&t({H_viewport_position:this.previousOffsetTop,event_duration:Math.min(c/1e3,n)});this.previousTime=a,this.previousOffsetTop=s},r}(e.PluginBase),d=function(t){function r(e,r){var o=t.call(this,e,r)||this;return o.options=e,o.context=r,o.name="PageLeave",o.isReady=!1,o.pageId=i.generatorTrackId(),o.storageName="hinasdk_pageleave_",o.heartbeatIntervalTime=5e3,o.maxDuration=432e3,o.heartbeatIntervalTimer=null,o.startTime=i.nowStamp(),o.url=window.location.href,o.pageShowStatus=!0,o}return n(r,t),r.prototype.init=function(){if(this.options.autoTrackConfig.pageLeaveAutoTrack)if(this.context.store.localStorage)if(this.isReady)this.context.log("PageLeave plugin:插件已经运行,无需重复执行",e.ConsoleTypes.WARN);else{this.isReady=!0;var t=this.normalizePageLeaveAutoTrack(),r=t.heartbeat_interval_time,o=t.max_duration;r&&r>0&&(this.heartbeatIntervalTime=1e3*r),o&&o>0&&(this.maxDuration=Number(o)),this.startTime=i.nowStamp(),this.addPageLeaveEventListener(),document.hidden?this.pageShowStatus=!1:this.startHeartBeatInterval()}else this.context.log("PageLeave plugin需要使用localstorage存储数据,但是您的浏览器不支持localstorage,所以不能使用该功能",e.ConsoleTypes.WARN)},r.prototype.transform=function(){},r.prototype.normalizePageLeaveAutoTrack=function(){var t=this.options.autoTrackConfig.pageLeaveAutoTrack;return i.isObject(t)?t:{}},r.prototype.addPageLeaveEventListener=function(){this.addPageStartListener(),this.addPageSwitchListener(),this.addSinglePageListener(),this.addPageEndListener()},r.prototype.addPageStartListener=function(){var t=this;"onpageshow"in window&&window.addEventListener("pageshow",(function(){t.pageStartHandler()}))},r.prototype.addPageSwitchListener=function(){var t=this;new i.ListenPageState({visible:function(){t.pageStartHandler(),t.startHeartBeatInterval()},hidden:function(){t.url=window.location.href,t.pageEndHandler(),t.stopHeartBeatInterval()}})},r.prototype.addSinglePageListener=function(){var t=this;i.mitt.on("urlChange",(function(e){var i=e.fromHref;i!==e.toHref&&(t.url=i,t.pageEndHandler(),t.stopHeartBeatInterval(),t.pageStartHandler(),t.startHeartBeatInterval())}))},r.prototype.addPageEndListener=function(){var t=this,e=["pagehide","beforeunload","unload"];e.forEach((function(i){"on".concat(e)in window&&window.addEventListener(i,(function(){t.pageEndHandler(),t.stopHeartBeatInterval()}))}))},r.prototype.pageStartHandler=function(){this.startTime=i.nowStamp(),this.pageShowStatus=!document.hidden,this.url=window.location.href},r.prototype.pageEndHandler=function(){if(this.pageShowStatus){if(this.pageShowStatus=!1,this.isCollectUrl()){var t=this.getPageLeaveProperties(),e=this.context.getReportData("track","H_WebPageLeave",t);this.context.report(e)}this.delHeartBeatData()}},r.prototype.startHeartBeatInterval=function(){var t=this;this.heartbeatIntervalTimer&&this.stopHeartBeatInterval(),this.isCollectUrl()&&(this.heartbeatIntervalTimer=setInterval((function(){t.saveHeartBeatData()}),this.heartbeatIntervalTime),this.saveHeartBeatData("first_heartbeat")),this.reissueHeartBeatData()},r.prototype.reissueHeartBeatData=function(){for(var t=this.context.store.localStorage,e=t.length(),r=0;r<e;r++){var o=t.key(r);if(o&&o!==this.storageName+this.pageId&&o.includes(this.storageName)){var n=t.get(o),s=i.safeJSONParse(n);i.isObject(s)&&i.nowStamp()-s.time>s.heartbeat_interval_time+5e3&&(delete s.heartbeat_interval_time,this.context.report(s)),this.delHeartBeatData(o)}}},r.prototype.stopHeartBeatInterval=function(){this.heartbeatIntervalTimer&&(clearInterval(this.heartbeatIntervalTimer),this.heartbeatIntervalTimer=null)},r.prototype.delHeartBeatData=function(t){this.context.store.localStorage.remove(t||this.storageName+this.pageId)},r.prototype.isCollectUrl=function(){var t=this.normalizePageLeaveAutoTrack().isCollectUrl;return!i.isFunction(t)||t(this.url)},r.prototype.saveHeartBeatData=function(t){var e=this.getPageLeaveProperties();e.H_time=i.nowStamp(),"first_heartbeat"===t&&(e.event_duration=3);var r=this.context.getReportData("track","H_WebPageLeave",e);r.heartbeat_interval_time=this.heartbeatIntervalTime,this.context.store.localStorage.set(this.storageName+this.pageId,JSON.stringify(r))},r.prototype.getPageLeaveProperties=function(){var t=(i.nowStamp()-this.startTime)/1e3;t=t<=0||t>this.maxDuration?0:i.formatDecimal(t,3);var e=i.getURL(this.url),r=e.pathname,o=e.hash,n={H_url:this.url,H_url_path:r,H_url_hash:o};t&&(n.event_duration=t);var a=this.normalizePageLeaveAutoTrack().custom_props;return i.isObject(a)&&(n=s(s({},n),a||{})),n},r}(e.PluginBase),v=function(t){function r(e,i){var r=t.call(this,e,i)||this;return r.options=e,r.context=i,r.name="SiteLinker",r.isReady=!1,r.linker=[],r}return n(r,t),r.prototype.init=function(){if(this.options.siteLinkerConfig){var t=this.getLinkerConfig().linker;i.isArray(t)&&t.length>0?this.isReady?this.context.log("SiteLinker plugin:插件已经运行,无需重复执行",e.ConsoleTypes.WARN):(this.isReady=!0,this.resolveOption(),this.setRefferId(),this.addClickListen()):this.context.log("siteLinker plugin: 请配置正确的linker参数",e.ConsoleTypes.WARN)}},r.prototype.transform=function(){},r.prototype.getLinkerConfig=function(){var t=this.options.siteLinkerConfig||{},e=t.linker;return{linker:(void 0===e?[]:e)||[],re_login:t.re_login}},r.prototype.resolveOption=function(){for(var t=this.getLinkerConfig().linker,r=t.length,o=[],n=0;n<r;n++){var s=t[n],a=s.part_url,c=s.after_hash;/[A-Za-z0-9]+\./.test(a)&&i.isBoolean(c)?o.push({part_url:a,after_hash:c}):this.context.log("The configuration of linker ".concat(n+1," is not supported.Please check format"),e.ConsoleTypes.WARN)}this.linker=o},r.prototype.setRefferId=function(){var t=this.getLinkerConfig().re_login,e=this.getUrlId(),i=e.startsWith("a");if(""!==(e=e.substring(1))){var r=this.context.store.getAnonymousId(),o=this.context.store.getAccountId();if(i){if(e!==r&&(this.context.store.state.anonymousId=e,this.context.store.save()),o){var n=this.context.getReportData("track_signup","H_SignUp",{});this.context.report(n)}}else(!o||t&&o!==e)&&this.context.setUserUId(e)}},r.prototype.getUrlId=function(){var t=window.location.href.match(/_hnsdk=([au][^\?\#\&\=]+)/);return i.isArray(t)&&t[1]?i.handleDecodeURLComponent(t[1]):""},r.prototype.getPartUrl=function(t){for(var e=this.linker.length,i=0;i<e;i++)if(t.includes(this.linker[i].part_url))return!0;return!1},r.prototype.getPartHash=function(t){for(var e=this.linker.length,i=0;i<e;i++)if(t.includes(this.linker[i].part_url))return this.linker[i].after_hash;return!1},r.prototype.getCurrentId=function(){var t=this.context.store.getAccountId(),e=this.context.store.getAnonymousId(),r=t?"u".concat(t):"a".concat(e);return i.handleEncodeURLComponent(r)},r.prototype.rewriteUrl=function(t,e){var i=/([^?#]+)(\?[^#]*)?(#.*)?/.exec(t),r="";if(i){var o=i[1]||"",n=i[2]||"",s=i[3]||"",a="_hnsdk=".concat(this.getCurrentId()),c=function(t){var e=t.split("&"),i=[];return e.forEach((function(t){t.includes("_hnsdk")?i.push(a):i.push(t)})),i.join("&")};if(this.getPartHash(t)){var l=s.includes("?"),u=s.indexOf("_hnsdk");r=l?u>=0?"".concat(o).concat(n,"#").concat(s.substring(1,u)).concat(c(s.substring(u,s.length))):"".concat(o).concat(n,"#").concat(s.substring(1),"&").concat(a):"".concat(o).concat(n,"#").concat(s.substring(1),"?").concat(a)}else{r=(l=/^\?(\w)+/.test(n))?n.includes("_hnsdk")?"".concat(o,"?").concat(c(n.substring(1))).concat(s):"".concat(o).concat(n,"&").concat(a).concat(s):"".concat(o,"?").concat(a).concat(s)}return e&&(e.href=r),r}},r.prototype.addClickListen=function(){var t=this,e=function(e){var r,o,n=e.target;if(n){var s=null===(r=n.tagName)||void 0===r?void 0:r.toLowerCase(),a=n.parentNode,c=null===(o=null==a?void 0:a.tagName)||void 0===o?void 0:o.toLowerCase();if("a"===s&&n.href||"a"===c&&a.href){var l=void 0,u=void 0;"a"===s&&n.href?(l=n.href,u=n):(l=a.href,u=a);var p=i.getURL(l).protocol;"http:"!==p&&"https:"!==p||t.getPartUrl(l)&&t.rewriteUrl(l,u)}}};"PointerEvent"in window?document.addEventListener("pointerdown",e):document.addEventListener("mousedown",e)},r}(e.PluginBase),y=function(t){function r(e,i){var r=t.call(this,e,i)||this;return r.options=e,r.context=i,r.name="HistoryPlugin",r.isReady=!1,r.lastHref=window.location.href,r.lastPath=window.location.pathname,r}return n(r,t),r.prototype.init=function(){if(i.supportHistory())if(this.isReady)this.context.log("History plugin:插件已经运行,无需重复执行",e.ConsoleTypes.WARN);else{this.isReady=!0;var t=this,r=window.onpopstate,o=function(e,r){var o={fromPath:t.lastPath,fromHref:t.lastHref,toPath:e,toHref:r};t.lastPath=e,t.lastHref=r,i.mitt.emit("urlChange",s(s({},o),{mode:"history"}))};window.onpopstate=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var i=window.location.pathname,n=window.location.href;o(i,n),r&&r.apply(this,t)},i.replaceOld(window.history,"pushState",n),i.replaceOld(window.history,"replaceState",n)}function n(t){return function(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];t.apply(this,e);var r=window.location.pathname,n=window.location.href;o(r,n)}}},r.prototype.transform=function(){},r}(e.PluginBase),m=function(t){function r(e,i){var r=t.call(this,e,i)||this;return r.options=e,r.context=i,r.name="HashPlugin",r.isReady=!1,r.lastHref=window.location.href,r.lastPath=window.location.hash,r}return n(r,t),r.prototype.init=function(){var t=this;this.isReady?this.context.log("Hash plugin:插件已经运行,无需重复执行",e.ConsoleTypes.WARN):(this.isReady=!0,window.addEventListener("hashchange",(function(e){var r=e.newURL,o=i.getURL(r).hash,n={fromPath:t.lastPath,fromHref:t.lastHref,toPath:o,toHref:r};t.lastHref=r,t.lastPath=o,i.mitt.emit("urlChange",s(s({},n),{mode:"hash"}))})))},r.prototype.transform=function(){},r}(e.PluginBase),T="4.0.0",b=function(t){function r(e,r){var o=t.call(this,e,r)||this;return o.options=e,o.context=r,o.name="HinaABTest",o.isReady=!1,o.platform=i.getPlatform(),o.projectKey="",o.storageName="hina_webjs_sdk_abtest",o}return n(r,t),r.prototype.init=function(){var t=this;if(this.context.store.localStorage){var r=this.options.abTestingPluginConfig,o=null==r?void 0:r.url;if(i.isString(o)){var n=i.getQueryParam(o,"project-key");if(n){this.projectKey=n;var s=i.getURL(o).protocol,a=i.getURL(window.location.href).protocol;if(s&&s!==a)this.context.log("A/B Testing 初始化失败,".concat(a," 页面必须使用 ").concat(a," 的 URL"),e.ConsoleTypes.WARN);else if(this.isReady)this.context.log("A/B Testing 插件已经运行,无需重复执行",e.ConsoleTypes.WARN);else{var c=this.context.getUserUid();this.context.log("当前accountId为:".concat(c),e.ConsoleTypes.INFO),i.mitt.on("changeAccountId",(function(){t.context.store.localStorage.set(t.storageName,"")})),this.isReady=!0}}else this.context.log("A/B Testing 初始化失败,请使用正确的 URL(必须包含 project-key)")}else this.context.log("A/B Testing 初始化失败,请使用正确的 URL!",e.ConsoleTypes.WARN)}else this.context.log("A/B Testing 初始化失败,浏览器不支持localStorage",e.ConsoleTypes.WARN)},r.prototype.transform=function(){},r.prototype.valueMatchType=function(t,r){switch(r){case e.VariablesTypes.INTEGER:return i.isNumber(t);case e.VariablesTypes.STRING:return i.isString(t);case e.VariablesTypes.BOOLEAN:return i.isBoolean(t);default:return!1}},r.prototype.normalizeParams=function(t,r,o){var n,s;void 0===o&&(o=h);var c={verify_success:!0,para:r};try{for(var l=a(o),u=l.next();!u.done;u=l.next()){var p=u.value;if(!c.verify_success)break;var f=r.customIds||{},g={};switch(p){case"abtestExperimentId":i.isString(r.abtestExperimentId)&&r.abtestExperimentId.trim()||(this.context.log("".concat(t,"方法调用失败,").concat(p,"参数未正确配置!").concat(p,": ").concat(r.abtestExperimentId),e.ConsoleTypes.WARN),c.verify_success=!1);break;case"paramName":i.isString(r.paramName)&&r.paramName.trim()||(this.context.log("".concat(t,"方法调用失败,").concat(p,"参数未正确配置!").concat(p,": ").concat(r.paramName),e.ConsoleTypes.WARN),c.verify_success=!1);break;case"valueType":[e.VariablesTypes.BOOLEAN,e.VariablesTypes.INTEGER,e.VariablesTypes.STRING].includes(r.valueType)||(this.context.log("".concat(t,"方法调用失败,").concat(p,"参数未正确配置!").concat(p,": ").concat(r.valueType),e.ConsoleTypes.WARN),c.verify_success=!1);break;case"defaultValue":this.valueMatchType(r.defaultValue,r.valueType)||(this.context.log("".concat(t,"方法调用失败,").concat(p,"类型必须与valueType一致!"),e.ConsoleTypes.WARN),c.verify_success=!1);break;case"callback":i.isFunction(r.callback)||(this.context.log("".concat(t,"方法调用失败,").concat(p,"参数未正确配置")),r.callback=i.noop,c.verify_success=!1);break;case"timeoutMilliseconds":(!i.isNumber(r.timeoutMilliseconds)||r.timeoutMilliseconds<=0)&&(this.context.log("".concat(p,"参数错误:").concat(r.timeoutMilliseconds),e.ConsoleTypes.WARN),r.timeoutMilliseconds=3e3),r.timeoutMilliseconds<200&&(r.timeoutMilliseconds=200);break;case"customProperties":r.customProperties=i.isObject(r.customProperties)?r.customProperties:{};break;case"customIds":for(var d in f)(i.isString(f[d])||i.isNumber(f[d]))&&(g[d]=f[d]);r.customIds=g}}}catch(t){n={error:t}}finally{try{u&&!u.done&&(s=l.return)&&s.call(l)}finally{if(n)throw n.error}}return c},r.prototype.sendTriggerEvent=function(t){var e=t.abtest_experiment_group_id,i=t.abtest_experiment_id;this.context.track("H_ABTestTrigger",{H_abtest_experiment_id:i,H_abtest_experiment_group_id:e})},r.prototype.getExpResult=function(t,e){var r,o;void 0===e&&(e=[]);var n,s=t.abtestExperimentId,c=t.paramName,l=t.valueType;if(0===e.length){var u=this.getStorageData();i.isObject(u)&&(e=u.result||[])}try{for(var p=a(e),h=p.next();!h.done;h=p.next()){var f=h.value,g=f.abtest_experiment_id,d=f.abtest_experiment_group_id,v=f.is_white_list,y=f.variables;if(g===s){var m=y.find((function(t){return t.name===c&&t.type===l}));if(m){v||this.sendTriggerEvent({abtest_experiment_id:g,abtest_experiment_group_id:d}),n=m.value;break}}}}catch(t){r={error:t}}finally{try{h&&!h.done&&(o=p.return)&&o.call(p)}finally{if(r)throw r.error}}return n},r.prototype.getStorageData=function(){var t=this.context.store.localStorage.get(this.storageName);return i.isValid(t)?i.safeJSONParse(t):null},r.prototype.saveResponseData=function(t){var e=this.getStorageData(),r={updateTime:i.nowStamp()};if(e&&i.isObject(e)){var o=[],n=e.result||[];t.forEach((function(t){var e=t.abtest_experiment_group_id,i=t.abtest_experiment_id,r=t.variables,s=n.find((function(t){return t.abtest_experiment_id===i&&t.abtest_experiment_group_id===e}));if(s){var a=[];r.forEach((function(t){var e=t.name,i=t.type,r=s.variables.findIndex((function(t){return t.name===e&&t.type===i}));r>=0?s.variables[r]=t:a.push(t)})),s.variables=l(l([],c(s.variables),!1),c(a),!1)}else o.push(t)})),r.result=l(l([],c(n),!1),c(o),!1)}else r.result=t;this.context.store.localStorage.set(this.storageName,JSON.stringify(r))},r.prototype.createRequestData=function(t){var e=t.paramName,r=t.customProperties,o=t.customIds,n={anonymous_id:this.context.store.getAnonymousId(),platform:this.platform,abtest_lib_version:T,param_name:e,properties:this.context.getPresetProperties()};return i.isObject(r)&&!i.isEmptyObject(r)&&(n.custom_properties=r),i.isObject(o)&&!i.isEmptyObject(o)&&(n.custom_ids=o),this.context.getUserUid()&&(n.login_id=this.context.getUserUid()),n},r.prototype.getResultFromServer=function(t){var e=this;return new Promise((function(r,o){var n=e.createRequestData(t);new i.AjaxRequest({url:e.options.abTestingPluginConfig.url,data:JSON.stringify(n),contentType:"application/json",customHeaders:{"project-key":e.projectKey},timeout:t.timeoutMilliseconds}).run().then((function(t){var i=t.data;"SUCCESS"===(null==i?void 0:i.status)?(e.saveResponseData(i.results),r(i)):o()}))}))},r.prototype.asyncFetch=function(t){var e=this;return new Promise((function(i){e.getResultFromServer(t).then((function(t){i(t)})).catch((function(){t.callback(t.defaultValue)}))}))},r.prototype.preFetch=function(t,r){return this.isReady?!!i.isObject(r)||(this.context.log("".concat(t," 方法参数必须是对象"),e.ConsoleTypes.WARN),!1):(this.context.log("A/B Testing 插件尚未运行,请先执行该插件",e.ConsoleTypes.WARN),!1)},r.prototype.asyncFetchABTest=function(t){var e=this;if(this.preFetch("asyncFetchABTest",t)){var i=this.normalizeParams("asyncFetchABTest",t),r=i.verify_success,o=i.para;r?this.asyncFetch(o).then((function(t){var i=e.getExpResult(o,t.results);o.callback(i||o.defaultValue)})):o.callback(o.defaultValue)}},r.prototype.fetchCacheABTest=function(t){if(this.preFetch("fetchCacheABTest",t)){var e=this.normalizeParams("fetchCacheABTest",t),i=e.verify_success,r=e.para;if(i){var o=this.getExpResult(r);r.callback(o||r.defaultValue)}else r.callback(r.defaultValue)}},r.prototype.fastFetchABTest=function(t){var e=this;if(this.preFetch("fastFetchABTest",t)){var r=this.normalizeParams("fastFetchABTest",t),o=r.verify_success,n=r.para;if(o){var s=this.getExpResult(n);i.isValid(s)?n.callback(s):this.asyncFetch(n).then((function(){var t=e.getExpResult(n);n.callback(t||n.defaultValue)}))}else n.callback(n.defaultValue)}},r}(e.PluginBase),_=function(t){function o(e,i){void 0===i&&(i=!0);var r=t.call(this,e,i)||this;return r.consolePrefix="埋点SDK",r.trackTags=p,r.presetProps={},r.useInstancing&&r.init(e),r}return n(o,t),o.prototype.init=function(t){if(this.isReady)this.log("hinaSDK has been initialized",e.ConsoleTypes.ERROR);else{var r={name:"",serverUrl:"",showLog:!1,autoTrackConfig:{clickAutoTrack:!0,stayAutoTrack:!0,isCollectUrl:function(){return!0},isCollectElement:function(){return!0},isCollectInput:function(){return!1},addCustomProperty:function(){},stayDelayTime:4e3,maxStayPageDuration:18e3,collectTags:{div:!1},trackAttr:["hn-click"],pageviewAutoTrack:!1,pageLeaveAutoTrack:!1},stayAutoTrackConfig:{isCollectUrl:function(){return!0}},maxStringLength:1024,imgUseCrossOrigin:!1,isSinglePage:!1,batchSend:!1,appJsBridge:!1,sendType:e.ReportTypes.BEACON,customHeaders:{},credentials:!1,dataSendTimeout:3e3,presetProperties:{latest_utm:!0,latest_traffic_source_type:!0,latest_search_keyword:!0,latest_referrer:!0,url:!0,title:!0},sourceChannel:[],plugins:[]},o=t.performanceErrorConfig,n=function(t,e){var i={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(i[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(i[r[o]]=t[r[o]])}return i}(t,["performanceErrorConfig"]);this.options=i.merge(r,n),this.options=s(s({},this.options),{performanceErrorConfig:o}),this.initState(),this.normalizeConfig(),this.initAdvProps(),this.initPlugins(),this.isReady=!0}},o.prototype.initState=function(){this.store=new i.State(this.options),this.store.init()},o.prototype.normalizeConfig=function(){var t=this,r=this.options,o=r.serverUrl,n=r.sendType,a=r.batchSend,c=r.maxStringLength,l=r.isSinglePage,p=r.autoTrackConfig,h=void 0===p?{}:p,f=h.trackAttr,g=void 0===f?[]:f,d=h.collectTags,v=h.pageLeaveAutoTrack,y=h.pageviewAutoTrack;if(""===(o=(o=o||"").trim()))this.log("当前 serverUrl 为空,network 中不会发数据,请配置正确的 serverUrl!",e.ConsoleTypes.WARN);else{var m=window.location.href,T=i.getURL(m).protocol||"";(i.getURL(o).protocol||"")!==T&&this.log("SDK 检测到您的数据发送地址和当前页面地址的协议不一致,建议您修改成一致的协议。因为:https 下面发送 http 的图片请求会失败。",e.ConsoleTypes.WARN)}[e.ReportTypes.IMAGE,e.ReportTypes.AJAX,e.ReportTypes.BEACON].includes(n)||this.setConfig({sendType:e.ReportTypes.AJAX});var b=c;if(!i.isNumber(c)||c<0?b=1024:c>5120&&(b=5120),this.options.maxStringLength=b,(!0===v||i.isObject(v)&&i.isEmptyObject(v))&&(this.options.autoTrackConfig.pageLeaveAutoTrack={heartbeat_interval_time:5e3,max_duration:432e3}),i.isArray(g)?(g=g.filter((function(t){return i.isString(t)}))).includes("hn-click")||g.push("hn-click"):g=["hn-click"],this.options.autoTrackConfig.trackAttr=g,i.isObject(d))if(!0===d.div)this.options.autoTrackConfig.collectTags.div={ignoreTags:u,maxLevel:1};else if(i.isObject(d.div)){var _=1,k=d.div;i.isNumber(k.maxLevel)&&[1,2,3].includes(k.maxLevel)&&(_=k.maxLevel),this.options.autoTrackConfig.collectTags.div={ignoreTags:u,maxLevel:_}}else this.options.autoTrackConfig.collectTags.div=!1;else this.options.autoTrackConfig.collectTags={div:!1};this.updateTrackTags(),(!0===a||i.isObject(a)&&!i.isEmptyObject(a))&&(this.options.batchSend=s({dataSendTimeout:6e3,sendInterval:6e3,storageLimit:200},a),this.batchSender=new i.BatchSend(this.options,e.PlatformTypes.WEB,"hinasdk_tab","hinasdk_data_")),"auto"===y?this.autoTrack():("singlePage"===y||l)&&(this.autoTrack(),i.mitt.on("urlChange",(function(e){var r=e.fromHref;if(r!==e.toHref){if(i.isFunction(l)){var o=l();i.isObject(o)&&(e=s(s({},e),o))}t.autoTrack(s(s({},e),{H_referrer:r}))}})))},o.prototype.updateTrackTags=function(){var t=this.options.autoTrackConfig.collectTags,e=l([],c(p),!1);Object.keys(t||{}).forEach((function(r){var o=t[r];!0!==o&&!i.isObject(o)||e.includes(r)||e.push(r)})),this.trackTags=e},o.prototype.initAdvProps=function(){var t={},e=this.options,r=e.presetProperties,o=e.sourceChannel;Object.keys(r||{}).forEach((function(e){var o=r[e];if(e.includes("latest_")&&(e=e.slice(7),o)){var n=i.getCurrentDomain();if("utm"!==e&&"url解析失败"===n)t["H_latest_".concat(e)]="url的domain解析失败";else if(i.isReferralTraffic())switch(e){case"traffic_source_type":t.H_latest_traffic_source_type=i.SearchKeyword.getSourceFromReferrer();break;case"search_keyword":var s=i.SearchKeyword.getKeywordFromReferrer();s&&(t.H_latest_search_keyword=s);break;case"referrer":t.H_latest_referrer=i.getReferrer()}}}));var n=this.store.state.props||{},a={};r.latest_utm&&(a=i.getUmtsParams("H_latest_"));var c={};n.H_utm_source||(c=i.getUmtsParams("H_"));var l={},u={};if(i.isArray(o)&&o.length>0){var p=o.filter((function(t){return!i.utmTypes.includes(t)}));p.length>0&&(n["H_".concat(p[0])]||(u=i.getCustomUmtsParams("H_",p)),l=i.getCustomUmtsParams("H_latest_",p))}this.store.state.props=s(s(s(s(s(s({},this.store.state.props),t),a),l),u),c),this.store.setProps(this.store.state.props)},o.prototype.initPlugins=function(){var t=this,e=this.options,o=e.serverUrl,n=e.name,a=e.showLog,c=e.sendType,l=e.customHeaders,u=e.credentials,p=e.dataSendTimeout,h=e.batchSend,T=e.imgUseCrossOrigin,_=e.globalCallback,k=e.plugins,w=void 0===k?[]:k,C=e.performanceErrorConfig,S=e.autoTrackConfig,P=e.siteLinkerConfig,A=e.abTestingPluginConfig;w=w||[];var x=S.pageLeaveAutoTrack,R=new f(this.options,this),L=new g(this.options,this),O=new y(this.options,this),E=new m(this.options,this);if(this.plugins=[R,L,O,E],i.isObject(x)&&!i.isEmptyObject(x)){var H=new d(this.options,this);this.plugins.push(H)}var N=(P||{}).linker;if(i.isArray(N)&&N.length>0){var I=new v(this.options,this);this.plugins.push(I)}if(i.isObject(A)&&!i.isEmptyObject(A)){var j=new b(this.options,this);this.plugins.push(j)}if(w.forEach((function(e){var i=new e(t.options,t);t.plugins.push(i)})),i.isObject(C)&&!i.isEmptyObject(C)){var D=s({serverUrl:o,name:n,showLog:a,sendType:c,customHeaders:l,credentials:u,dataSendTimeout:p,batchSend:h,imgUseCrossOrigin:T,globalCallback:_},C);this.epmInstance=new r.Monitor(D,!0)}this.runPlugins(this.plugins)},o.prototype.use=function(t,r){var o=this,n=this.options,s=n.autoTrackConfig,a=n.siteLinkerConfig,c=n.abTestingPluginConfig,l=s.pageLeaveAutoTrack,u=function(t){var e=new t(o.options,o);o.plugins.push(e),e.init()};if(this.isReady){if(i.isObject(r))return"PageLeave"===t?i.isObject(l)&&!i.isEmptyObject(l)?this.log("PageLeave插件已运行,无需重复执行",e.ConsoleTypes.WARN):(this.options.autoTrackConfig.pageLeaveAutoTrack=r,u(d)):"SiteLinker"===t?i.isObject(a)&&!i.isEmptyObject(a)?this.log("SiteLinker插件已插件已运行,无需重复执行",e.ConsoleTypes.WARN):(this.options.siteLinkerConfig=r,u(v)):"HinaABTest"===t&&(i.isObject(c)&&!i.isEmptyObject(c)?this.log("HinaABTest插件已运行,无需重复执行",e.ConsoleTypes.WARN):(this.options.abTestingPluginConfig=r,u(b))),this.getPluginInstance(t);this.log("".concat(t,"插件配置项必须是一个对象类型"),e.ConsoleTypes.WARN)}else this.log("请先初始化埋点SDK",e.ConsoleTypes.WARN)},o.prototype.getPluginInstance=function(t){return this.plugins.find((function(e){return e.name===t}))},o.prototype.setConfig=function(t){this.options=i.merge(this.options,t),this.normalizeConfig()},o.prototype.getConfig=function(t){return t?this.options[t]:this.options},o.prototype.setUserUId=function(t,r){if(t=null!=t?t:"",i.isNumber(t)||i.isString(t))if(t=String(t).trim(),this.store.getAccountId()!==t){this.store.setAccountId(t);var o=this.getReportData("track_signup","H_SignUp",{});this.report(o,r),i.mitt.emit("changeAccountId")}else this.log("setUserUId: uid is equal to account_id, , failed to execute setUserUId",e.ConsoleTypes.WARN);else this.log("setUserUId: uid must be string or number",e.ConsoleTypes.WARN)},o.prototype.getUserUid=function(){return this.store.state.accountId},o.prototype.setDeviceUId=function(t){this.store.setDeviceId(t)},o.prototype.getDeviceUId=function(){return this.store.getDeviceId()},o.prototype.userSet=function(t,e){if(i.isObject(t)&&!i.isEmptyObject(t)){var r=this.getReportData("user_set","",t);this.report(r,e)}},o.prototype.userSetOnce=function(t,e){if(i.isObject(t)&&!i.isEmptyObject(t)){var r=this.getReportData("user_setOnce","",t);this.report(r,e)}},o.prototype.userAdd=function(t,r){var o,n=this;i.isString(t)&&((o={})[t]=1,t=o);if(i.isObject(t)&&!i.isEmptyObject(t)&&function(t){for(var i in t)if(!/-*\d+/.test(String(t[i])))return n.log("userAdd属性的值只能是数字",e.ConsoleTypes.WARN),!1;return!0}(t)){var s=this.getReportData("user_add","",t);this.report(s,r)}},o.prototype.userAppend=function(t,e){var r={};if(i.isObject(t)&&(Object.keys(t).forEach((function(e){var o=t[e];i.isArray(o)?r[e]=o:r[e]=[o]})),!i.isEmptyObject(r))){var o=this.getReportData("user_append","",r);this.report(o,e)}},o.prototype.userUnset=function(t,r){var o=this,n={};if(i.isString(t)&&(t=[t]),i.isArray(t)){if(t.forEach((function(t){i.isString(t)?n[t]=!0:o.log("userUnset参数数组里面的值必须时string,已经过滤掉".concat(t),e.ConsoleTypes.WARN)})),!i.isEmptyObject(n)){var s=this.getReportData("user_unset","",n);this.report(s,r)}}else this.log("userUnset参数必须是数组或字符串",e.ConsoleTypes.WARN)},o.prototype.userDelete=function(t){var e=this.getReportData("user_delete","",{});this.report(e,t),this.store.setAccountId("")},o.prototype.registerCommonProperties=function(t){this.presetProps=i.merge(this.presetProps,t)},o.prototype.getPresetProperties=function(){return{H_is_first_day:this.store.isFirstDay,H_is_first_time:this.store.isFirstTime,device_id:this.store.getDeviceId(),anonymous_id:this.store.getAnonymousId(),account_id:this.store.getAccountId(),properties:s(s(s({},this.presetProps),i.getPageProperties()),i.getBrowserInfo(T))}},o.prototype.clearPageRegister=function(t){var e=this;void 0===t&&(t=!0),!0===t?this.presetProps={}:i.isArray(t)&&t.forEach((function(t){t in e.presetProps&&delete e.presetProps[t]}))},o.prototype.checkReportProperties=function(t){var e=this,r=this.options.maxStringLength;Object.keys(t).forEach((function(o){var n=t[o];if(i.isString(n)&&n.length>r)e.log("属性 ".concat(o," 已经做截取")),t[o]=n.slice(0,r);else if(i.isObject(n))e.checkReportProperties(n);else if(i.isFunction(n))try{t[o]=n(t),i.isFunction(t[o])?(e.log("属性--".concat(o," 格式不满足要求, 已被删除")),delete t[o]):i.isObject(t[o])?e.checkReportProperties(t[o]):i.isString(t[o])&&t[o].length>r&&(t[o]=t[o].slice(0,r))}catch(i){e.log("属性--".concat(o," 格式不满足要求, 已被删除")),delete t[o]}}))},o.prototype.track=function(t,r,o){if(o=o||function(){},i.isString(t)){r=i.isObject(r)?r:{};var n=this.getReportData("track",t,r);this.report(n,o)}else this.log("track事件名必须是字符串,属性必须是是一个对象",e.ConsoleTypes.WARN)},o.prototype.quick=function(t,e,r){var o={};r=i.isFunction(r)?r:i.noop,i.isObject(e)?o=e:i.isFunction(e)&&(r=e),this.autoTrack(o,r)},o.prototype.autoTrack=function(t,e){void 0===t&&(t={}),void 0===e&&(e=i.noop);var r=this.getReportData("track","H_pageview",t);if(this.report(r,e),this.store.isSetFirstVisit){this.store.isSetFirstVisit=!1;var o=i.getReferrer();this.userSetOnce({H_first_referrer:o,H_first_referrer_host:o?i.getHostname(o,"取值异常"):"",H_first_traffic_source_type:i.SearchKeyword.getSourceFromReferrer(),H_first_search_keyword:i.SearchKeyword.getKeywordFromReferrer(),H_first_visit_time:i.nowStamp(),H_first_browser_language:i.isString(navigator.language)?navigator.language.toLowerCase():"取值异常"})}},o.prototype.report=function(t,r,o){var n,s,a=this.options,c=a.appJsBridge,l=a.serverUrl;if(this.log(t),c){var u=!0,p=null===window||void 0===window?void 0:window.Hina_Cloud_H5_Bridge;if(i.isObject(p)&&p.track)u=!1,p.track(t.event,t.type,JSON.stringify(t));else{var h=null===(s=null===(n=null===window||void 0===window?void 0:window.webkit)||void 0===n?void 0:n.messageHandlers)||void 0===s?void 0:s.hinaNativeTracker;if(null==h?void 0:h.postMessage){u=!1;var f=JSON.stringify({eventName:t.event,eventType:t.type,properties:t});h.postMessage(f)}}if(u)return void this.log("JSBridge 发送数据失败",e.ConsoleTypes.WARN);i.isFunction(r)&&r(l,t)}else this.sendReportData(t,r,o)},o.prototype.getReportData=function(t,e,r){var o=this.store.getAnonymousId(),n=this.store.getAccountId(),a=i.nowStamp(),c=this.getReportProperties(t,e),l=s(s({},c),r||{});this.checkReportProperties(l);var u={anonymous_id:o,type:t,event:e,time:a,_track_id:i.generatorTrackId(),properties:l};return n&&(u.account_id=n),u.send_time=i.nowStamp(),u},o.prototype.getReportProperties=function(t,e){void 0===t&&(t=""),void 0===e&&(e="");var r=i.merge(this.presetProps),o=s(s({device_id:this.store.getDeviceId()},this.store.state.props),r);return t&&"user"===t.slice(0,4)||(o=s(s(s({},o),i.getPageProperties()),i.getBrowserInfo(T))),"track"===t&&(o.H_is_first_day=this.store.isFirstDay,this.store.isFirstDay=!1,"H_pageview"===e&&(o.H_is_first_time=this.store.isFirstTime,this.store.isFirstTime=!1)),o},o}(t.WebClient);var k=new _({},!1);exports.HinaTrack=_,exports.default=k,Object.keys(e).forEach((function(t){"default"===t||Object.prototype.hasOwnProperty.call(exports,t)||Object.defineProperty(exports,t,{enumerable:!0,get:function(){return e[t]}})}));
|
@@ -0,0 +1 @@
|
|
1
|
+
var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};function e(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}var i,r,n,o,a,s,c=function(){return c=Object.assign||function(t){for(var e,i=1,r=arguments.length;i<r;i++)for(var n in e=arguments[i])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t},c.apply(this,arguments)};function u(t){var e="function"==typeof Symbol&&Symbol.iterator,i=e&&t[e],r=0;if(i)return i.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function l(t,e){var i="function"==typeof Symbol&&t[Symbol.iterator];if(!i)return t;var r,n,o=i.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(t){n={error:t}}finally{try{r&&!r.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}return a}function p(t,e,i){if(i||2===arguments.length)for(var r,n=0,o=e.length;n<o;n++)!r&&n in e||(r||(r=Array.prototype.slice.call(e,0,n)),r[n]=e[n]);return t.concat(r||Array.prototype.slice.call(e))}"function"==typeof SuppressedError&&SuppressedError,function(t){t.LOG="log",t.INFO="info",t.WARN="warn",t.ERROR="error",t.ASSERT="assert"}(i||(i={})),function(t){t.BEACON="beacon",t.IMAGE="image",t.AJAX="ajax"}(r||(r={})),function(t){t.WEB="web",t.MINI_APP="mini_app"}(n||(n={})),function(t){t.JS_ERROR="JsError",t.RESOURCE_ERROR="ResourceError",t.FETCH_ERROR="FetchError",t.AJAX_ERROR="AjaxError",t.PROMISE_ERROR="PromiseError",t.WHITE_SCREEN_ERROR="WhiteScreenError",t.VUE_ERROR="VueError",t.REACT_ERROR="ReactError",t.CAPTURE_EVENT="CaptureEvent",t.CAPTURE_EXCEPTION="CaptureException"}(o||(o={})),function(t){t.BASIC="basic",t.VITALS="vitals",t.RESOURCE="resource",t.LONG_TASK="longtask"}(a||(a={})),function(t){t.INTEGER="INTEGER",t.STRING="STRING",t.BOOLEAN="BOOLEAN"}(s||(s={}));var d=function(t,e){this.options=t,this.context=e},f=["utm_source","utm_medium","utm_campaign","utm_content","utm_term"],h=["www.baidu.","m.baidu.","m.sm.cn","so.com","sogou.com","youdao.com","google.","yahoo.com/","bing.com/","ask.com/"],g=["weibo.com","renren.com","kaixin001.com","douban.com","qzone.qq.com","zhihu.com","tieba.baidu.com","weixin.qq.com"],v={baidu:["wd","word","kw","keyword"],google:"q",bing:"q",yahoo:"p",sogou:["query","keyword"],so:"q",sm:"q"},m="hinasdk_domain_test",_=Object.prototype.toString;function y(t){return"[object Object]"===_.call(t)}function w(t){return null!=t}function b(t){return Array.isArray(t)}function k(t){return"function"==typeof t}function S(t){return"string"==typeof t}function H(t){return"number"==typeof t}function R(t){return"boolean"==typeof t}function x(t){var e="";if(S(t))return t;if(null==t?void 0:t.stack)e=y(t.stack)?JSON.stringify(t.stack):t.stack;else{if(!t)return"未知js错误";e=y(t)?JSON.stringify(t):t.toString()}return e}function T(){}function E(t){try{return JSON.parse(t)}catch(t){}return t}function C(t){try{return JSON.stringify(t)}catch(e){return t}}function A(t){return 0===Object.keys(t).length}function P(){return Date.now&&k(Date.now)?Date.now():(new Date).getTime()}function L(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var i=Object.create(null);return t.forEach((function(t){t&&Object.keys(t).forEach((function(e){var r=t[e];y(r)?y(i[e])?i[e]=L(i[e],r):i[e]=L(r):i[e]=r}))})),i}function I(t){return Object.keys(t).reduce((function(e,i){return w(t[i])&&""!==t[i]&&(e[i]=t[i]),e}),{})}function N(t){var e={};try{e=new URL(t)}catch(t){}return e}function O(t,e){if(void 0===e&&(e=3),!t)return t;var i=t.toString(),r=i.indexOf(".");return i=-1!==r?i.substring(0,r+e+1):i.substring(0),parseFloat(i)}function D(t){t=t||window.location.hostname,/^[a-zA-Z0-9\u4e00-\u9fa5\-\\.]+$/.exec(t)||(t="");var e=t.split(".");if(e.length>=2&&!/^(\d+\.)+\d+$/.test(t))for(var i=".".concat(e.splice(e.length-1,1));e.length>0;)if(i=".".concat(e.splice(e.length-1,1)).concat(i),document.cookie="".concat(m,"=true; path=/; domain=").concat(i),-1!==document.cookie.indexOf("".concat(m,"=true")))return document.cookie="".concat(m,"=true; path=/; domain=").concat(i,"; max-age=0"),i;return""}function U(){var t=D();return""===t?"url解析失败":t}function q(t){var e=t||document.referrer;return"string"!=typeof e?"referrer exception".concat(String(e)):(e.startsWith("https://www.baidu.com/")&&(e=e.split("?")[0]),"string"==typeof(e=e.slice(0,200))?e:"")}function B(t,e){return e&&"string"==typeof e||(e="hostname解析异常"),t&&(N(t).hostname||"")||e}function j(){var t=P(),e=Math.floor(1e6*Math.random());return"".concat(t,"_").concat(e)}function M(){var t=P(),e=Math.floor(1e6*Math.random());return Number(String(t).slice(-5)+String(e).slice(0,4))}function W(t){for(var e=5381,i=t.length;i;)e=33*e^t.charCodeAt(--i);return e>>>0}function F(t,e){e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]"),t=decodeURIComponent(t);var i=new RegExp("[\\?&]".concat(e,"=([^&#]*)")).exec(t);return null===i||i&&"string"!=typeof i[1]&&i[1].length?"":decodeURIComponent(i[1])}function z(t){try{return btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,(function(t,e){return String.fromCharCode(Number("0x".concat(e)))})))}catch(e){return t}}function V(t,e,i,r){if(void 0!==t&&(e in t||r)){var n=i(t[e]);k(n)&&(t[e]=n)}}function J(t){if(!t)return"";var e=t.match(/\/([^/]+)$/);return e?e[1]:""}function K(t){if(void 0===(null==t?void 0:t.stack)||!(null==t?void 0:t.stack))return[];for(var e,i=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,r=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:[-a-z]+):.*?):(\d+)(?::(\d+))?\)?\s*$/i,n=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,o=/ line (\d+), column (\d+)\s*(?:in (?:<anonymous function: ([^>]+)>|([^)]+))\(.*\))? in (.*):\s*$/i,a=t.stack.split("\n"),s=[],c=0;c<a.length;c++){var u=a[c];(e=i.exec(u))||(e=r.exec(u))?s.push({source:e[2],filename:J(e[2]),lineno:e[3]?+e[3]:null,colno:e[4]?+e[4]:null}):(e=n.exec(u))?s.push({source:e[3],filename:J(e[3]),lineno:e[4]?+e[4]:null,colno:e[5]?+e[5]:null}):(e=o.exec(u))&&s.push({source:e[5],filename:J(e[5]),lineno:e[1]?+e[1]:null,colno:e[2]?+e[2]:null})}return s.length>0?[s[0]]:s}var G=function(){function t(){this.name="CookieStorage"}return t.prototype.isSupport=function(t,e){var i=this;void 0===t&&(t="cookie_support_test"),void 0===e&&(e="1");return navigator.cookieEnabled&&(i.set(t,e),i.get(t)===e&&(i.remove(t),!0))},t.prototype.get=function(t){var e,i,r=document.cookie.split(";");try{for(var n=u(r),o=n.next();!o.done;o=n.next()){var a=o.value.split("=");if(a[0].trim()===t)return decodeURIComponent(a[1])}}catch(t){e={error:t}}finally{try{o&&!o.done&&(i=n.return)&&i.call(n)}finally{if(e)throw e.error}}return null},t.prototype.set=function(t,e,i,r,n,o,a){r=r||"/",t=t.trim(),e=e.trim();var s="".concat(t,"=").concat(encodeURIComponent(e),"; path=").concat(r,";");i=w(i)?i:63072e8,s+=" max-age=".concat(i,";"),a&&(s+=" secure;"),n&&(s+=" domain=".concat(n,";")),["Strict","Lax","None"].includes(o)&&(s+=" SameSite=".concat(o,";")),document.cookie=s},t.prototype.remove=function(t,e){void 0===e&&(e="/"),this.set(t,"1",0,e)},t.prototype.setDomain=function(t,e,i){var r=U();"url解析失败"===r&&(r=""),this.set(t,e,i,"/",r)},t}(),$=function(){function t(){this.name="LocalStorage"}return t.prototype.isSupport=function(){var t=!0;try{var e="__localStorageSupport__",i="testIsSupportStorage";this.set(e,i),this.get(e)!==i&&(t=!1),this.remove(e)}catch(e){t=!1}return t},t.prototype.key=function(t){return window.localStorage.key(t)},t.prototype.get=function(t){return window.localStorage.getItem(t)},t.prototype.length=function(){return window.localStorage.length},t.prototype.set=function(t,e){try{window.localStorage.setItem(t,e)}catch(t){}},t.prototype.remove=function(t){window.localStorage.removeItem(t)},t.prototype.parse=function(t){var e=this.get(t);try{e=JSON.parse(e)}catch(t){e=""}return e},t}(),X=function(){function t(){this.name="MemoryStorage",this.data={}}return t.prototype.get=function(t){var e=this.data[t];return w(null==e?void 0:e.expireTime)?e.expireTime<P()?null:e.value:null==e?void 0:e.value},t.prototype.set=function(t,e,i){if(w(i)){var r=P()+1e3*i;this.data[t]={value:e,expireTime:r}}this.data[t]={value:e}},t.prototype.setDomain=function(t,e,i){this.set(t,e,i)},t}(),Z="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Y(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Q={exports:{}};!function(t,e){!function(i,r){var n="function",o="undefined",a="object",s="string",c="major",u="model",l="name",p="type",d="vendor",f="version",h="architecture",g="console",v="mobile",m="tablet",_="smarttv",y="wearable",w="embedded",b="Amazon",k="Apple",S="ASUS",H="BlackBerry",R="Browser",x="Chrome",T="Firefox",E="Google",C="Huawei",A="LG",P="Microsoft",L="Motorola",I="Opera",N="Samsung",O="Sharp",D="Sony",U="Xiaomi",q="Zebra",B="Facebook",j="Chromium OS",M="Mac OS",W=" Browser",F=function(t){for(var e={},i=0;i<t.length;i++)e[t[i].toUpperCase()]=t[i];return e},z=function(t,e){return typeof t===s&&-1!==V(e).indexOf(V(t))},V=function(t){return t.toLowerCase()},J=function(t,e){if(typeof t===s)return t=t.replace(/^\s\s*/,""),typeof e===o?t:t.substring(0,500)},K=function(t,e){for(var i,o,s,c,u,l,p=0;p<e.length&&!u;){var d=e[p],f=e[p+1];for(i=o=0;i<d.length&&!u&&d[i];)if(u=d[i++].exec(t))for(s=0;s<f.length;s++)l=u[++o],typeof(c=f[s])===a&&c.length>0?2===c.length?typeof c[1]==n?this[c[0]]=c[1].call(this,l):this[c[0]]=c[1]:3===c.length?typeof c[1]!==n||c[1].exec&&c[1].test?this[c[0]]=l?l.replace(c[1],c[2]):r:this[c[0]]=l?c[1].call(this,l,c[2]):r:4===c.length&&(this[c[0]]=l?c[3].call(this,l.replace(c[1],c[2])):r):this[c]=l||r;p+=2}},G=function(t,e){for(var i in e)if(typeof e[i]===a&&e[i].length>0){for(var n=0;n<e[i].length;n++)if(z(e[i][n],t))return"?"===i?r:i}else if(z(e[i],t))return"?"===i?r:i;return e.hasOwnProperty("*")?e["*"]:t},$={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},X={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[f,[l,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[f,[l,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[l,f],[/opios[\/ ]+([\w\.]+)/i],[f,[l,I+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[f,[l,I+" GX"]],[/\bopr\/([\w\.]+)/i],[f,[l,I]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[f,[l,"Baidu"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim)\s?(?:browser)?[\/ ]?([\w\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio)\/([-\w\.]+)/i,/(heytap|ovi)browser\/([\d\.]+)/i,/(weibo)__([\d\.]+)/i],[l,f],[/quark(?:pc)?\/([-\w\.]+)/i],[f,[l,"Quark"]],[/\bddg\/([\w\.]+)/i],[f,[l,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[f,[l,"UC"+R]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[f,[l,"WeChat"]],[/konqueror\/([\w\.]+)/i],[f,[l,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[f,[l,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[f,[l,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[f,[l,"Smart Lenovo "+R]],[/(avast|avg)\/([\w\.]+)/i],[[l,/(.+)/,"$1 Secure "+R],f],[/\bfocus\/([\w\.]+)/i],[f,[l,T+" Focus"]],[/\bopt\/([\w\.]+)/i],[f,[l,I+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[f,[l,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[f,[l,"Dolphin"]],[/coast\/([\w\.]+)/i],[f,[l,I+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[f,[l,"MIUI "+R]],[/fxios\/([-\w\.]+)/i],[f,[l,T]],[/\bqihu|(qi?ho?o?|360)browser/i],[[l,"360"+W]],[/\b(qq)\/([\w\.]+)/i],[[l,/(.+)/,"$1Browser"],f],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[l,/(.+)/,"$1"+W],f],[/samsungbrowser\/([\w\.]+)/i],[f,[l,N+" Internet"]],[/(comodo_dragon)\/([\w\.]+)/i],[[l,/_/g," "],f],[/metasr[\/ ]?([\d\.]+)/i],[f,[l,"Sogou Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[l,"Sogou Mobile"],f],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345Explorer)[\/ ]?([\w\.]+)/i],[l,f],[/(lbbrowser|rekonq)/i,/\[(linkedin)app\]/i],[l],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[l,B],f],[/(Klarna)\/([\w\.]+)/i,/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(twitter)(?:and| f.+e\/([\w\.]+))/i,/(chromium|instagram|snapchat)[\/ ]([-\w\.]+)/i],[l,f],[/\bgsa\/([\w\.]+) .*safari\//i],[f,[l,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[f,[l,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[f,[l,x+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[l,x+" WebView"],f],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[f,[l,"Android "+R]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[l,f],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[f,[l,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[f,l],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[l,[f,G,{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}]],[/(webkit|khtml)\/([\w\.]+)/i],[l,f],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[l,"Netscape"],f],[/(wolvic)\/([\w\.]+)/i],[l,f],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[f,[l,T+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i],[l,[f,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[l,[f,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[h,"amd64"]],[/(ia32(?=;))/i],[[h,V]],[/((?:i[346]|x)86)[;\)]/i],[[h,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[h,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[h,"armhf"]],[/windows (ce|mobile); ppc;/i],[[h,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[h,/ower/,"",V]],[/(sun4\w)[;\)]/i],[[h,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[h,V]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[u,[d,N],[p,m]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr])[-\w]+)/i,/sec-(sgh\w+)/i],[u,[d,N],[p,v]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[u,[d,k],[p,v]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[u,[d,k],[p,m]],[/(macintosh);/i],[u,[d,k]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[u,[d,O],[p,v]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[u,[d,C],[p,m]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[u,[d,C],[p,v]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite|pro)?)(?: bui|\))/i],[[u,/_/g," "],[d,U],[p,v]],[/oid[^\)]+; (2\d{4}(283|rpbf)[cgl])( bui|\))/i,/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[u,/_/g," "],[d,U],[p,m]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[u,[d,"OPPO"],[p,v]],[/\b(opd2\d{3}a?) bui/i],[u,[d,"OPPO"],[p,m]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[u,[d,"Vivo"],[p,v]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[u,[d,"Realme"],[p,v]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[u,[d,L],[p,v]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[u,[d,L],[p,m]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[u,[d,A],[p,m]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[u,[d,A],[p,v]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[u,[d,"Lenovo"],[p,m]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[u,/_/g," "],[d,"Nokia"],[p,v]],[/(pixel c)\b/i],[u,[d,E],[p,m]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[u,[d,E],[p,v]],[/droid.+ (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[u,[d,D],[p,v]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[u,"Xperia Tablet"],[d,D],[p,m]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[u,[d,"OnePlus"],[p,v]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[u,[d,b],[p,m]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[u,/(.+)/g,"Fire Phone $1"],[d,b],[p,v]],[/(playbook);[-\w\),; ]+(rim)/i],[u,d,[p,m]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[u,[d,H],[p,v]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[u,[d,S],[p,m]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[u,[d,S],[p,v]],[/(nexus 9)/i],[u,[d,"HTC"],[p,m]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[d,[u,/_/g," "],[p,v]],[/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])\w*(\)| bui)/i],[u,[d,"TCL"],[p,m]],[/(itel) ((\w+))/i],[[d,V],u,[p,G,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[u,[d,"Acer"],[p,m]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[u,[d,"Meizu"],[p,v]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[u,[d,"Ulefone"],[p,v]],[/droid.+; (a(?:015|06[35]|142p?))/i],[u,[d,"Nothing"],[p,v]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron|infinix|tecno)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[d,u,[p,v]],[/(kobo)\s(ereader|touch)/i,/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[d,u,[p,m]],[/(surface duo)/i],[u,[d,P],[p,m]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[u,[d,"Fairphone"],[p,v]],[/(u304aa)/i],[u,[d,"AT&T"],[p,v]],[/\bsie-(\w*)/i],[u,[d,"Siemens"],[p,v]],[/\b(rct\w+) b/i],[u,[d,"RCA"],[p,m]],[/\b(venue[\d ]{2,7}) b/i],[u,[d,"Dell"],[p,m]],[/\b(q(?:mv|ta)\w+) b/i],[u,[d,"Verizon"],[p,m]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[u,[d,"Barnes & Noble"],[p,m]],[/\b(tm\d{3}\w+) b/i],[u,[d,"NuVision"],[p,m]],[/\b(k88) b/i],[u,[d,"ZTE"],[p,m]],[/\b(nx\d{3}j) b/i],[u,[d,"ZTE"],[p,v]],[/\b(gen\d{3}) b.+49h/i],[u,[d,"Swiss"],[p,v]],[/\b(zur\d{3}) b/i],[u,[d,"Swiss"],[p,m]],[/\b((zeki)?tb.*\b) b/i],[u,[d,"Zeki"],[p,m]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[d,"Dragon Touch"],u,[p,m]],[/\b(ns-?\w{0,9}) b/i],[u,[d,"Insignia"],[p,m]],[/\b((nxa|next)-?\w{0,9}) b/i],[u,[d,"NextBook"],[p,m]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[d,"Voice"],u,[p,v]],[/\b(lvtel\-)?(v1[12]) b/i],[[d,"LvTel"],u,[p,v]],[/\b(ph-1) /i],[u,[d,"Essential"],[p,v]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[u,[d,"Envizen"],[p,m]],[/\b(trio[-\w\. ]+) b/i],[u,[d,"MachSpeed"],[p,m]],[/\btu_(1491) b/i],[u,[d,"Rotor"],[p,m]],[/(shield[\w ]+) b/i],[u,[d,"Nvidia"],[p,m]],[/(sprint) (\w+)/i],[d,u,[p,v]],[/(kin\.[onetw]{3})/i],[[u,/\./g," "],[d,P],[p,v]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[u,[d,q],[p,m]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[u,[d,q],[p,v]],[/smart-tv.+(samsung)/i],[d,[p,_]],[/hbbtv.+maple;(\d+)/i],[[u,/^/,"SmartTV"],[d,N],[p,_]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[d,A],[p,_]],[/(apple) ?tv/i],[d,[u,k+" TV"],[p,_]],[/crkey/i],[[u,x+"cast"],[d,E],[p,_]],[/droid.+aft(\w+)( bui|\))/i],[u,[d,b],[p,_]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[u,[d,O],[p,_]],[/(bravia[\w ]+)( bui|\))/i],[u,[d,D],[p,_]],[/(mitv-\w{5}) bui/i],[u,[d,U],[p,_]],[/Hbbtv.*(technisat) (.*);/i],[d,u,[p,_]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[d,J],[u,J],[p,_]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[p,_]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[d,u,[p,g]],[/droid.+; (shield) bui/i],[u,[d,"Nvidia"],[p,g]],[/(playstation [345portablevi]+)/i],[u,[d,D],[p,g]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[u,[d,P],[p,g]],[/\b(sm-[lr]\d\d[05][fnuw]?s?)\b/i],[u,[d,N],[p,y]],[/((pebble))app/i],[d,u,[p,y]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[u,[d,k],[p,y]],[/droid.+; (glass) \d/i],[u,[d,E],[p,y]],[/droid.+; (wt63?0{2,3})\)/i],[u,[d,q],[p,y]],[/(quest( \d| pro)?)/i],[u,[d,B],[p,y]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[d,[p,w]],[/(aeobc)\b/i],[u,[d,b],[p,w]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i],[u,[p,v]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[u,[p,m]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[p,m]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[p,v]],[/(android[-\w\. ]{0,9});.+buil/i],[u,[d,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[f,[l,"EdgeHTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[f,[l,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[l,f],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[f,l]],os:[[/microsoft (windows) (vista|xp)/i],[l,f],[/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i],[l,[f,G,$]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[f,G,$],[l,"Windows"]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[f,/_/g,"."],[l,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[l,M],[f,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[f,l],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[l,f],[/\(bb(10);/i],[f,[l,H]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[f,[l,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[f,[l,T+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[f,[l,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[f,[l,"watchOS"]],[/crkey\/([\d\.]+)/i],[f,[l,x+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[l,j],f],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[l,f],[/(sunos) ?([\w\.\d]*)/i],[[l,"Solaris"],f],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[l,f]]},Z=function(t,e){if(typeof t===a&&(e=t,t=r),!(this instanceof Z))return new Z(t,e).getResult();var g=typeof i!==o&&i.navigator?i.navigator:r,_=t||(g&&g.userAgent?g.userAgent:""),y=g&&g.userAgentData?g.userAgentData:r,w=e?function(t,e){var i={};for(var r in t)e[r]&&e[r].length%2==0?i[r]=e[r].concat(t[r]):i[r]=t[r];return i}(X,e):X,b=g&&g.userAgent==_;return this.getBrowser=function(){var t={};return t[l]=r,t[f]=r,K.call(t,_,w.browser),t[c]=function(t){return typeof t===s?t.replace(/[^\d\.]/g,"").split(".")[0]:r}(t[f]),b&&g&&g.brave&&typeof g.brave.isBrave==n&&(t[l]="Brave"),t},this.getCPU=function(){var t={};return t[h]=r,K.call(t,_,w.cpu),t},this.getDevice=function(){var t={};return t[d]=r,t[u]=r,t[p]=r,K.call(t,_,w.device),b&&!t[p]&&y&&y.mobile&&(t[p]=v),b&&"Macintosh"==t[u]&&g&&typeof g.standalone!==o&&g.maxTouchPoints&&g.maxTouchPoints>2&&(t[u]="iPad",t[p]=m),t},this.getEngine=function(){var t={};return t[l]=r,t[f]=r,K.call(t,_,w.engine),t},this.getOS=function(){var t={};return t[l]=r,t[f]=r,K.call(t,_,w.os),b&&!t[l]&&y&&y.platform&&"Unknown"!=y.platform&&(t[l]=y.platform.replace(/chrome os/i,j).replace(/macos/i,M)),t},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return _},this.setUA=function(t){return _=typeof t===s&&t.length>500?J(t,500):t,this},this.setUA(_),this};Z.VERSION="1.0.39",Z.BROWSER=F([l,f,c]),Z.CPU=F([h]),Z.DEVICE=F([u,d,p,g,v,_,m,y,w]),Z.ENGINE=Z.OS=F([l,f]),t.exports&&(e=t.exports=Z),e.UAParser=Z;var Y=typeof i!==o&&(i.jQuery||i.Zepto);if(Y&&!Y.ua){var Q=new Z;Y.ua=Q.getResult(),Y.ua.get=function(){return Q.getUA()},Y.ua.set=function(t){Q.setUA(t);var e=Q.getResult();for(var i in e)Y.ua[i]=e[i]}}}("object"==typeof window?window:Z)}(Q,Q.exports);var tt=new(Y(Q.exports));function et(t){var e=tt.getResult(),i=e.browser,r=e.device,n=e.os,o=e.ua,a={H_timezone_offset:(new Date).getTimezoneOffset(),H_viewport_width:window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth||0,H_viewport_height:window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight||0,H_screen_width:window.screen.width,H_screen_height:window.screen.height,H_lib_version:t,H_lib:"js",H_lib_method:"code",H_browser:i.name.toLowerCase(),H_browser_version:i.version,H_os:n.name,H_os_version:n.version,H_browser_user_agent:o,H_language:S(navigator.language)?navigator.language.toLowerCase():"取值异常",H_network_type:rt()};return"mobile"===r.type?a.H_model=r.vendor?r.model:"UnknownPhone":a.H_model=r.model,a}function it(){return document.documentElement.scrollTop||document.body.scrollTop||0}function rt(){if(void 0===navigator.connection)return"unknown";var t=navigator.connection;return t.effectiveType?t.effectiveType:t.type?t.type:"取值异常"}var nt=function(){function t(t){this.visibleHandler=function(){},this.hiddenHandler=function(){};var e=t.visible,i=t.hidden;k(e)&&(this.visibleHandler=e),k(i)&&(this.hiddenHandler=i),this.init()}return t.prototype.isSupport=function(){return void 0!==document.hidden},t.prototype.init=function(){var t=this;this.isSupport()?document.addEventListener("visibilitychange",(function(){document.hidden?t.hiddenHandler():t.visibleHandler()})):(window.addEventListener("focus",this.visibleHandler),window.addEventListener("blur",this.hiddenHandler))},t}();function ot(){return"undefined"!=typeof console}function at(t){return 1===(null==t?void 0:t.nodeType)}function st(t,e){var i;if("input"===(null===(i=t.tagName)||void 0===i?void 0:i.toLowerCase()))return(["button","submit"].includes(t.type)||e)&&t.value||"";var r="";return t.textContent?r=t.textContent.trim():t.innerText&&(r=t.innerText.trim()),r&&(r=r.replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)),r||""}function ct(){var t=q(),e=U(),i=Math.round(it());return I({H_referrer:t,H_referrer_host:t?B(t):"",H_url:window.location.href,H_url_host:B(window.location.href,"url_host取值异常"),H_url_domain:e,H_url_path:window.location.pathname,H_url_hash:window.location.hash,H_title:document.title,H_viewport_position:i})}function ut(t,e){if(!t)return{};var i=document.documentElement.scrollLeft||document.body.scrollLeft||0,r=it(),n=e.getBoundingClientRect(),o=t.pageX||t.clientX+i||t.offsetX+((null==n?void 0:n.left)||0)+i,a=t.pageY||t.clientY+r||t.offsetY+((null==n?void 0:n.top)||0)+r;return{H_page_x:O(o,3),H_page_y:O(a,3)}}var lt=function(){function t(){}return t.getSourceFromReferrer=function(){var t=function(t,e){for(var i=0;i<t.length;i++)if(-1!==e.split("?")[0].indexOf(t[i]))return!0},e="(".concat(f.join("|"),")\\=[^&]+"),i=document.referrer||"",r=window.location.href;if(r){var n=r.match(new RegExp(e));return n&&n[0]?"付费广告流量":t(h,i)?"自然搜索流量":t(g,i)?"社交网站流量":""===i?"直接流量":"引荐流量"}return"获取url异常"},t.getReferSearchEngine=function(t){var e,i,r=B(t);if(!r||"hostname解析异常"===r)return"";var n={baidu:[/^.*\.baidu\.com$/],bing:[/^.*\.bing\.com$/],google:[/^www\.google\.com$/,/^www\.google\.com\.[a-z]{2}$/,/^www\.google\.[a-z]{2}$/],sm:[/^m\.sm\.cn$/],so:[/^.+\.so\.com$/],sogou:[/^.*\.sogou\.com$/],yahoo:[/^.*\.yahoo\.com$/]};for(var o in n){var a=n[o];try{for(var s=(e=void 0,u(a)),c=s.next();!c.done;c=s.next()){if(c.value.test(r))return o}}catch(t){e={error:t}}finally{try{c&&!c.done&&(i=s.return)&&i.call(s)}finally{if(e)throw e.error}}}return"未知搜索引擎"},t.getKeywordFromReferrer=function(){var t=document.referrer||"";if(0===t.indexOf("http")){var e=this.getReferSearchEngine(t),i=function(t){t=t||"";var e={};return new URLSearchParams(t).forEach((function(t,i){e[i]=t})),e}(N(t).search);if(A(i))return"未取到值";for(var r in v){var n=v[r];if(r===e)if(b(n))for(var o=0;o<n.length;o++){var a=i[n[o]];if(a)return a}else if(i[n])return i[n]}return"未取到值"}return""===t?"未取到值_直接打开":"未取到值_非http的url"},t}();function pt(t){void 0===t&&(t="");var e,i=(e={},f.forEach((function(t){var i=F(window.location.href,t);i.length&&(e[t]=i)})),e),r={};return Object.keys(i).forEach((function(e){r[t+e]=i[e]})),r}function dt(t,e){void 0===t&&(t=""),void 0===e&&(e=[]);var i={};return e.forEach((function(e){var r=F(window.location.href,e);r&&(i[e]=r,i["".concat(t).concat(e)]=r)})),i}var ft=function(t){this.options=t},ht=function(t){function i(e){var i=t.call(this,e)||this;return i.options=e,i}return e(i,t),i.prototype.run=function(){var t=this;return new Promise((function(e){var i=t.options,r=i.imgUseCrossOrigin,n=i.url,o=i.data,a=new Image;r&&(a.crossOrigin="anonymous");var s=-1===n.indexOf("?")?"?":"&";a.src="".concat(n).concat(s).concat(o);var c=function(t){a=null,e({type:t})};a.onload=function(){c("success")},a.onerror=function(){c("success")}}))},i}(ft),gt=function(t){function i(e){var i=t.call(this,e)||this;return i.options=e,i}return e(i,t),i.prototype.run=function(){var t=this;return new Promise((function(e){var i=t.options,r=i.url,n=i.data,o=i.timeout,a=i.credentials,s=i.contentType,c=i.customHeaders,u=void 0===c?{}:c,l=new XMLHttpRequest;l.open("POST",r,!0),l.timeout=o||2e4,l.isMonitor=!0,a&&(l.withCredentials=!0),l.setRequestHeader("Content-Type",s||"application/x-www-form-urlencoded"),y(u)&&!A(u)&&Object.keys(u).forEach((function(t){l.setRequestHeader(t,u[t])})),l.send(n||null),l.ontimeout=function(){l.abort()},l.onreadystatechange=function(){4===l.readyState&&(l.status>=200&&l.status<300||304===l.status?e({data:JSON.parse(l.responseText)||{},type:"success"}):e({type:"fail",msg:"网络异常, 请求失败,状态码=".concat(l.status)}))}}))},i}(ft),vt=function(t){function i(e){var i=t.call(this,e)||this;return i.options=e,i}return e(i,t),i.prototype.run=function(){var t=this;return new Promise((function(e){var i=t.options,r=i.url,n=i.data;navigator.sendBeacon&&e(navigator.sendBeacon(r,n)?{type:"success"}:{type:"fail",msg:"sendBeacon 请求失败"})}))},i}(ft);var mt,_t={all:mt=mt||new Map,on:function(t,e){var i=mt.get(t);i?i.push(e):mt.set(t,[e])},emit:function(t,e){var i=mt.get(t);i&&i.forEach((function(t){t(e)}))},off:function(t,e){var i=mt.get(t);if(i)if(e){var r=i.indexOf(e);r>=0&&i.splice(r,1)}else mt.set(t,[])}};function yt(t,e){void 0===e&&(e=i.LOG);var r=console[e]||console.log;"function"==typeof r&&r(t)}var wt=function(){function t(t){this.options=t,this.storeName="hinasdk_crossdata",this.state=this.getDefaultState(),this.isFirstTime=!1,this.isFirstDay=!1,this.isSetFirstVisit=!0}return t.prototype.getDefaultState=function(){return{accountId:null,deviceId:null,anonymousId:null,sessionId:null,firstVisitTime:P(),props:{}}},t.prototype.log=function(t,e){void 0===e&&(e=i.LOG);var r=this.options.showLog;ot()&&r&&yt(t,e)},t.prototype.init=function(){var t,e=new G,r=new X,n=new $;e.isSupport()?this.storage=e:(this.log("Cookie storage is not supported, SDK internal cache has been enabled",i.WARN),this.storage=r),n.isSupport()?this.localStorage=n:this.log("localStorage is not supported, SDK internal cache has been enabled",i.WARN),!(t=this.storage.get(this.storeName))&&this.localStorage&&(t=this.localStorage.get(this.storeName)),t&&function(t){try{JSON.parse(t)}catch(t){return!1}return!0}(t)&&(this.state=E(t)),t?(this.isSetFirstVisit=!1,this.save()):(this.isFirstDay=!0,this.isFirstTime=!0);var o=function(){var t=function(){for(var t=P(),e=0;t===P();)e++;return t.toString(16)+e.toString(16)},e=String(window.screen.height*window.screen.width);e=e&&/\d{5,}/.test(e)?e.toString(16):String(31242*Math.random()).replace(".","").slice(0,8);var i="".concat(t(),"-").concat(Math.random().toString(16).replace(".",""),"-").concat(function(){var t,e,i=navigator.userAgent,r=[],n=0;function o(t,e){var i,n=0;for(i=0;i<e.length;i++)n|=r[i]<<8*i;return t^n}for(t=0;t<i.length;t++)e=i.charCodeAt(t),r.unshift(255&e),r.length>=4&&(n=o(n,r),r=[]);return r.length>0&&(n=o(n,r)),n.toString(16)}(),"-").concat(e,"-").concat(t());return i||(String(Math.random())+String(Math.random())+String(Math.random())).slice(2,15)}();this.getAnonymousId()||this.setAnonymousId(o),this.getDeviceId()||this.setDeviceId(o)},t.prototype.clear=function(){this.state={},this.save()},t.prototype.save=function(){this.storage.setDomain(this.storeName,JSON.stringify(this.state)),this.localStorage&&this.localStorage.set(this.storeName,JSON.stringify(this.state))},t.prototype.set=function(t,e){this.state[t]=e,this.save()},t.prototype.checkSetValue=function(t,e){return!(!H(e=null!=e?e:"")&&!S(e))||(this.log("".concat(t,": id must be string or number"),i.WARN),!1)},t.prototype.setDeviceId=function(t){void 0===t&&(t=""),this.checkSetValue("deviceId",t)&&this.set("deviceId",t)},t.prototype.setAccountId=function(t){void 0===t&&(t=""),this.checkSetValue("accountId",t)&&this.set("accountId",t)},t.prototype.setAnonymousId=function(t){this.state.anonymousId?this.log("Current anonymousId is ".concat(this.getAnonymousId(),", it has been set"),i.WARN):this.checkSetValue("anonymousId",t)&&this.set("anonymousId",t)},t.prototype.setSessionId=function(t){this.set("sessionId",t)},t.prototype.setProps=function(t){var e=L(this.state.props||{},t);for(var i in e)"string"==typeof e[i]&&(e[i]=e[i].slice(0,200));this.set("props",e)},t.prototype.getAnonymousId=function(){return this.state.anonymousId},t.prototype.getDeviceId=function(){return this.state.deviceId},t.prototype.getAccountId=function(){return this.state.accountId},t.prototype.getSessionId=function(){return this.state.sessionId||""},t.prototype.getSessionIdCreateTime=function(){var t=this.getSessionId().split("_")[0],e=Number(t);return Number.isNaN(e)?0:e},t.prototype.getCookie=function(){return this.storage.get(this.storeName)},t}(),bt=function(){function t(t,e,i,r){void 0===i&&(i="hinasdk_tab"),void 0===r&&(r="hinasdk_data_"),this.options=t,this.platform=e,this.batchKey=i,this.batchDataKey=r,this.init()}return t.prototype.log=function(t,e){void 0===e&&(e=i.LOG);var r=this.options.showLog;ot()&&r&&yt(t,e)},t.prototype.init=function(){var t=new $;t.isSupport()?(this.localStorage=t,this.isSupport=!0):(this.isSupport=!1,this.log("批量发送功能需要使用localstorage存储数据,但是您的浏览器不支持localstorage,所以不能使用该功能",i.WARN)),this.batchInterval()},t.prototype.getBatchConfig=function(){return this.options.batchSend},t.prototype.getStorageList=function(){if(!this.isSupport)return[];var t=[],e=this.localStorage.get(this.batchKey);return e&&(b(t=E(e))||(t=[])),t},t.prototype.batchInterval=function(){var t=this;if(this.isSupport){var e=this.getBatchConfig().sendInterval;setTimeout((function(){t.send().then((function(){t.batchInterval()}))}),e)}},t.prototype.send=function(){var t=this;return new Promise((function(e){var i=t.getStorageList();if(i.length>0&&t.isSupport){for(var r=t.getBatchConfig(),n=r.storageLimit,o=r.dataSendTimeout,a=P(),s=[],c={},u=i.length,l=0;l<u;l++){var p=i[l],d=p.dataKey,f=p.expireTime;if(f>=a)c[d]={dataKey:d,expireTime:f},(w=t.localStorage.get(d))&&s.push(E(w));else t.localStorage.remove(d),i.splice(l,1),u--,l--}if(t.localStorage.set(t.batchKey,JSON.stringify(i)),(s=s.filter(Boolean)).length>n&&(s=s.slice(0,n)),0===s.length)e();else{var h=t.options,g=h.serverUrl,v=h.customHeaders,m=h.credentials,_=h.globalCallback,y=JSON.stringify(s),w=encodeURIComponent(z(y));new gt({url:g,data:"data_list=".concat(w),timeout:o,credentials:m,customHeaders:v}).run().then((function(i){k(_)&&_(g,s,i.type,i.msg||""),"success"===i.type&&t.remove(c),e()}))}}else e()}))},t.prototype.remove=function(t){var e=this;if(this.isSupport){var i=this.getStorageList(),r=Object.keys(t);if(r.forEach((function(t){e.localStorage.remove(t)})),i.length===r.length)this.localStorage.set(this.batchKey,JSON.stringify([]));else{var n=i.filter((function(e){return!t[e.dataKey]}));this.localStorage.set(this.batchKey,JSON.stringify(n))}}},t.prototype.add=function(t){if(this.isSupport){var e=this.getBatchConfig(),i=e.sendInterval,r=e.storageLimit,n=this.batchDataKey+j(),o=this.getStorageList();o.unshift({dataKey:n,expireTime:P()+2*i}),this.localStorage.set(this.batchKey,JSON.stringify(o)),this.localStorage.set(n,JSON.stringify(t)),(o.length>r||"track_signup"===t.type||"H_pageview"===t.event)&&this.send()}},t}(),kt=function(){function t(t,e){void 0===e&&(e=!0),this.isReady=!1,this.consolePrefix="",this.useInstancing=!0,this.plugins=[],this.options=t,this.useInstancing=e}return t.prototype.log=function(t,e){void 0===e&&(e=i.LOG);var r=this.options.showLog;ot()&&r&&("string"==typeof t&&this.consolePrefix&&(t="".concat(this.consolePrefix,":").concat(t)),yt(t,e))},t.prototype.runPlugins=function(t){for(var e=this,i=function(i){var r=t[i];r.init((function(t){if(r.transform){var i=r.transform(t);i&&e.report(i)}}))},r=0;r<t.length;r++)i(r)},t.prototype.applyPlugins=function(t){var e=this;if(this.isReady){b(t)||(t=[t]);var r=[];t.forEach((function(t){var i=new t(e.options,e);e.plugins.push(i),r.push(i)})),this.runPlugins(r)}else this.log("请先初始化SDK实例",i.WARN)},t}(),St=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),n.prototype.sendReportData=function(t,e,n){var o=this.options,a=o.batchSend,s=o.globalCallback,c=o.serverUrl,u=o.dataSendTimeout,l=o.sendType,p=o.customHeaders,d=o.credentials,f=o.imgUseCrossOrigin;if(l=n||l,c){if(y(t)&&!A(t))if(a)this.batchSender.add(t);else{var h=t;S(t)||(h=C(t));var g=z(h),v={data:"data=".concat(encodeURIComponent(g)),url:c,timeout:u,imgUseCrossOrigin:f,customHeaders:p,credentials:d};(l===r.BEACON&&navigator.sendBeacon?new vt(v):l===r.IMAGE&&v.data.length<2048?new ht(v):new gt(v)).run().then((function(i){return k(s)&&s(c,t,i.type,i.msg||""),k(e)&&e(c,t,i.type,i.msg||""),i}))}}else this.log("当前 serverUrl 为空,network 中不会发数据,请配置正确的 serverUrl!",i.WARN)},n}(kt),Ht=function(t){function i(e,i){var r=t.call(this,e,i)||this;return r.options=e,r.context=i,r.name="JsErrorPlugin",r.isReady=!1,r}return e(i,t),i.prototype.init=function(t){this.isReady||(this.isReady=!0,window.onerror=function(e,i,r,n,a){if("ResizeObserver loop limit exceeded"!==e.toString()){var s=x(a);t({H_js_error_id:W(s),H_error_category:o.JS_ERROR,H_error_type:a.name||o.JS_ERROR,H_error_message:a.message,H_error_stack:JSON.stringify({details:K(a),errorStack:s})})}})},i.prototype.transform=function(t){return this.context.getReportData("H_performance_js",t)},i}(d),Rt=function(t){function i(e,i){var r=t.call(this,e,i)||this;return r.options=e,r.context=i,r.name="DomErrorPlugin",r.isReady=!1,r}return e(i,t),i.prototype.init=function(t){this.isReady||(this.isReady=!0,window.addEventListener("error",(function(e){if(e.target!==window){var i=e.target,r=i.src||i.href,n=(s=(a=i).tagName.toLowerCase(),c=a.getAttributeNames(),u="",c.forEach((function(t){u+=" ".concat(t,"='").concat(a.getAttribute(t),"'")})),"<".concat(s).concat(u,">"));t({H_js_error_id:W(n),H_error_category:o.RESOURCE_ERROR,H_error_type:o.RESOURCE_ERROR,H_error_message:n,H_source_element:n,H_source_src:r})}var a,s,c,u}),!0))},i.prototype.transform=function(t){return this.context.getReportData("H_performance_js",t)},i}(d);function xt(){if(void 0!==window.performance&&"function"==typeof window.performance.getEntriesByType){var t=performance.getEntriesByType("navigation")[0],e=t.startTime,i=t.redirectStart,r=t.redirectEnd,n=t.fetchStart,o=t.domainLookupStart,a=t.domainLookupEnd,s=t.connectStart,c=t.secureConnectionStart,u=t.connectEnd,l=t.requestStart,p=t.responseStart,d=t.responseEnd,f=t.domInteractive,h=t.domContentLoadedEventEnd,g=t.loadEventStart,v=t.loadEventEnd,m=t.redirectCount,_=t.duration,y=t.unloadEventEnd,w=t.unloadEventStart;return{H_first_byte_time:O(p-e),H_unload_time:O(y-w),H_redirect_time:O(r-i),H_redirect_count:m,H_cache_check_time:O(o-n),H_dns_time:O(a-o),H_tcp_time:O(u-s),H_ssl_time:O(u-c),H_first_byte_response_time:O(p-i),H_dom_ready_time:O(h-n),H_request_time:O(p-l),H_content_transfer_time:O(d-p),H_dom_parsing_time:O(f-d),H_page_load_time:O(v-e),H_resource_load_time:O(g-h),H_resource_duration:_,H_load_event_time:O(v-g)}}var b=performance.timing,k=b.navigationStart,S=b.responseStart,H=b.unloadEventEnd,R=b.unloadEventStart,x=b.requestStart,T=b.responseEnd,E=b.redirectStart,C=b.redirectEnd,A=b.domainLookupStart,P=b.fetchStart,L=b.domainLookupEnd,I=b.connectStart,N=b.connectEnd,D=b.secureConnectionStart,U=b.domContentLoadedEventEnd,q=b.domInteractive,B=b.loadEventStart,j=b.loadEventEnd;return{H_first_byte_time:O(S-k),H_unload_time:O(H-R),H_redirect_time:O(C-E),H_cache_check_time:O(A-P),H_dns_time:O(L-A),H_tcp_time:O(N-I),H_ssl_time:O(N-D),H_first_byte_response_time:O(S-E),H_dom_ready_time:O(U-P),H_request_time:O(S-x),H_content_transfer_time:O(T-S),H_dom_parsing_time:O(q-T),H_page_load_time:O(j-k),H_resource_load_time:O(B-U),H_load_event_time:O(j-B)}}var Tt,Et,Ct,At,Pt=-1,Lt=function(t){addEventListener("pageshow",(function(e){e.persisted&&(Pt=e.timeStamp,t(e))}),!0)},It=function(){var t=self.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0];if(t&&t.responseStart>0&&t.responseStart<performance.now())return t},Nt=function(){var t=It();return t&&t.activationStart||0},Ot=function(t,e){var i=It(),r="navigate";return Pt>=0?r="back-forward-cache":i&&(document.prerendering||Nt()>0?r="prerender":document.wasDiscarded?r="restore":i.type&&(r=i.type.replace(/_/g,"-"))),{name:t,value:void 0===e?-1:e,rating:"good",delta:0,entries:[],id:"v4-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:r}},Dt=function(t,e,i){try{if(PerformanceObserver.supportedEntryTypes.includes(t)){var r=new PerformanceObserver((function(t){Promise.resolve().then((function(){e(t.getEntries())}))}));return r.observe(Object.assign({type:t,buffered:!0},i||{})),r}}catch(t){}},Ut=function(t,e,i,r){var n,o;return function(a){e.value>=0&&(a||r)&&((o=e.value-(n||0))||void 0===n)&&(n=e.value,e.delta=o,e.rating=function(t,e){return t>e[1]?"poor":t>e[0]?"needs-improvement":"good"}(e.value,i),t(e))}},qt=function(t){requestAnimationFrame((function(){return requestAnimationFrame((function(){return t()}))}))},Bt=function(t){document.addEventListener("visibilitychange",(function(){"hidden"===document.visibilityState&&t()}))},jt=function(t){var e=!1;return function(){e||(t(),e=!0)}},Mt=-1,Wt=function(){return"hidden"!==document.visibilityState||document.prerendering?1/0:0},Ft=function(t){"hidden"===document.visibilityState&&Mt>-1&&(Mt="visibilitychange"===t.type?t.timeStamp:0,Vt())},zt=function(){addEventListener("visibilitychange",Ft,!0),addEventListener("prerenderingchange",Ft,!0)},Vt=function(){removeEventListener("visibilitychange",Ft,!0),removeEventListener("prerenderingchange",Ft,!0)},Jt=function(){return Mt<0&&(Mt=Wt(),zt(),Lt((function(){setTimeout((function(){Mt=Wt(),zt()}),0)}))),{get firstHiddenTime(){return Mt}}},Kt=function(t){document.prerendering?addEventListener("prerenderingchange",(function(){return t()}),!0):t()},Gt=[1800,3e3],$t=function(t,e){e=e||{},Kt((function(){var i,r=Jt(),n=Ot("FCP"),o=Dt("paint",(function(t){t.forEach((function(t){"first-contentful-paint"===t.name&&(o.disconnect(),t.startTime<r.firstHiddenTime&&(n.value=Math.max(t.startTime-Nt(),0),n.entries.push(t),i(!0)))}))}));o&&(i=Ut(t,n,Gt,e.reportAllChanges),Lt((function(r){n=Ot("FCP"),i=Ut(t,n,Gt,e.reportAllChanges),qt((function(){n.value=performance.now()-r.timeStamp,i(!0)}))})))}))},Xt=[.1,.25],Zt=[2500,4e3],Yt={},Qt=function(t,e){e=e||{},Kt((function(){var i,r=Jt(),n=Ot("LCP"),o=function(t){e.reportAllChanges||(t=t.slice(-1)),t.forEach((function(t){t.startTime<r.firstHiddenTime&&(n.value=Math.max(t.startTime-Nt(),0),n.entries=[t],i())}))},a=Dt("largest-contentful-paint",o);if(a){i=Ut(t,n,Zt,e.reportAllChanges);var s=jt((function(){Yt[n.id]||(o(a.takeRecords()),a.disconnect(),Yt[n.id]=!0,i(!0))}));["keydown","click"].forEach((function(t){addEventListener(t,(function(){return function(t){var e=self.requestIdleCallback||self.setTimeout,i=-1;return t=jt(t),"hidden"===document.visibilityState?t():(i=e(t),Bt(t)),i}(s)}),!0)})),Bt(s),Lt((function(r){n=Ot("LCP"),i=Ut(t,n,Zt,e.reportAllChanges),qt((function(){n.value=performance.now()-r.timeStamp,Yt[n.id]=!0,i(!0)}))}))}}))},te=[800,1800],ee=function t(e){document.prerendering?Kt((function(){return t(e)})):"complete"!==document.readyState?addEventListener("load",(function(){return t(e)}),!0):setTimeout(e,0)},ie=function(t,e){e=e||{};var i=Ot("TTFB"),r=Ut(t,i,te,e.reportAllChanges);ee((function(){var n=It();n&&(i.value=Math.max(n.responseStart-Nt(),0),i.entries=[n],r(!0),Lt((function(){i=Ot("TTFB",0),(r=Ut(t,i,te,e.reportAllChanges))(!0)})))}))},re={passive:!0,capture:!0},ne=new Date,oe=function(t,e){Tt||(Tt=e,Et=t,Ct=new Date,ce(removeEventListener),ae())},ae=function(){if(Et>=0&&Et<Ct-ne){var t={entryType:"first-input",name:Tt.type,target:Tt.target,cancelable:Tt.cancelable,startTime:Tt.timeStamp,processingStart:Tt.timeStamp+Et};At.forEach((function(e){e(t)})),At=[]}},se=function(t){if(t.cancelable){var e=(t.timeStamp>1e12?new Date:performance.now())-t.timeStamp;"pointerdown"==t.type?function(t,e){var i=function(){oe(t,e),n()},r=function(){n()},n=function(){removeEventListener("pointerup",i,re),removeEventListener("pointercancel",r,re)};addEventListener("pointerup",i,re),addEventListener("pointercancel",r,re)}(e,t):oe(e,t)}},ce=function(t){["mousedown","keydown","touchstart","pointerdown"].forEach((function(e){return t(e,se,re)}))},ue=[100,300];function le(){return new Promise((function(t){!function(t,e){e=e||{},Kt((function(){var i,r=Jt(),n=Ot("FID"),o=function(t){t.startTime<r.firstHiddenTime&&(n.value=t.processingStart-t.startTime,n.entries.push(t),i(!0))},a=function(t){t.forEach(o)},s=Dt("first-input",a);i=Ut(t,n,ue,e.reportAllChanges),s&&(Bt(jt((function(){a(s.takeRecords()),s.disconnect()}))),Lt((function(){var r;n=Ot("FID"),i=Ut(t,n,ue,e.reportAllChanges),At=[],Et=-1,Tt=null,ce(addEventListener),r=o,At.push(r),ae()})))}))}((function(e){t(e.value)}))}))}function pe(){return new Promise((function(t){!function(t,e){e=e||{},$t(jt((function(){var i,r=Ot("CLS",0),n=0,o=[],a=function(t){t.forEach((function(t){if(!t.hadRecentInput){var e=o[0],i=o[o.length-1];n&&t.startTime-i.startTime<1e3&&t.startTime-e.startTime<5e3?(n+=t.value,o.push(t)):(n=t.value,o=[t])}})),n>r.value&&(r.value=n,r.entries=o,i())},s=Dt("layout-shift",a);s&&(i=Ut(t,r,Xt,e.reportAllChanges),Bt((function(){a(s.takeRecords()),i(!0)})),Lt((function(){n=0,r=Ot("CLS",0),i=Ut(t,r,Xt,e.reportAllChanges),qt((function(){return i()}))})),setTimeout(i,0))})))}((function(e){t(e.value)}),{reportAllChanges:!0})}))}var de=function(t){function i(e,i){var r=t.call(this,e,i)||this;return r.options=e,r.context=i,r.name="PerformancePlugin",r.isReady=!1,r}return e(i,t),i.prototype.init=function(t){if(!this.isReady){this.isReady=!0;var e=this.options.performanceOff;e.includes(a.VITALS)||Promise.all([new Promise((function(t){Qt((function(e){t(e.value)}))})),le(),pe(),new Promise((function(t){ie((function(e){t(e.value)}))})),new Promise((function(t){$t((function(e){t(e.value)}))})),new Promise((function(t){"PerformanceObserver"in window?new PerformanceObserver((function(e){var i,r,n=e.getEntries();try{for(var o=u(n),a=o.next();!a.done;a=o.next()){var s=a.value;"first-paint"===s.name&&t(s.startTime)}}catch(t){i={error:t}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}})).observe({entryTypes:["paint"]}):t(0)}))]).then((function(t){var e=l(t,6),i=e[0],r=e[1],n=e[2],o=e[3],a=e[4];return{H_first_paint_time:O(e[5]),H_first_contentful_paint_time:O(a),H_largest_contentful_paint_time:O(i),H_time_to_first_byte:O(o),H_first_input_delay:O(r),H_cumulative_layout_shift:O(n)}})).then((function(e){t(c({event:"H_performance_page",H_category:a.VITALS},e))})),e.includes(a.LONG_TASK)||function(t){if("PerformanceObserver"in window){var e=new PerformanceObserver((function(e){var i=e.getEntries(),r=0,n=[];i.forEach((function(t){var e=t.duration,i=t.name,o=t.startTime;r+=e,n.push({duration:O(e),startTime:O(o),name:i})})),t({H_long_task_time:O(r),H_long_task:i.length,H_long_task_list:n})}));e.observe({entryTypes:["longtask"]})}}((function(e){t(c({event:"H_performance_page",H_category:a.LONG_TASK,H_url:window.location.href},e))})),window.addEventListener("load",(function(){e.includes(a.BASIC)||t(c({event:"H_performance_loading",H_category:a.BASIC},xt()))}))}},i.prototype.transform=function(t){return this.context.getReportData(t.event,t)},i}(d),fe=function(t){function i(e,i){var r=t.call(this,e,i)||this;return r.options=e,r.context=i,r.name="FetchPlugin",r.isReady=!1,r}return e(i,t),i.prototype.init=function(t){if(window.fetch&&!this.isReady){this.isReady=!0;var e=this;V(window,"fetch",(function(i){return function(r,n){void 0===n&&(n={});var a=P(),s=n||{},u=s.headers,l=s.signal,p=s.method;return i(r,n).then((function(i){if(!i.ok){var s=c(c({},e.context.getRequestHeaders()),u||{}),l=P();i.clone().text().then((function(e){t({H_js_error_id:W("url=".concat(r,"&method=").concat(p)),H_error_category:o.FETCH_ERROR,H_error_type:o.FETCH_ERROR,H_error_message:r,H_request_url:r,H_request_headers:C(s),H_request_method:n.method.toLowerCase(),H_request_params:S(n.body)?n.body:"",H_response_status:i.status,H_response_status_text:i.statusText,H_request_time:a,H_response_time:l,H_response_data:e})}))}return i})).catch((function(i){if(l&&l.aborted)throw i;var s="";s=(s=i instanceof Error?null==i?void 0:i.message:C(i))||"网络错误,或者无法连接";var d=c(c({},e.context.getRequestHeaders()),u||{});throw t({H_js_error_id:W("url=".concat(r,"&method=").concat(p)),H_error_category:o.FETCH_ERROR,H_error_type:o.FETCH_ERROR,H_error_message:r,H_request_url:r,H_request_headers:C(d),H_request_method:n.method.toLowerCase(),H_request_params:S(n.body)?n.body:"",H_response_status:0,H_response_status_text:s,H_request_time:a,H_response_time:P(),H_response_data:s}),i}))}}))}},i.prototype.transform=function(t){return this.context.getReportData("H_performance_js",t)},i}(d),he=function(t){function i(e,i){var r=t.call(this,e,i)||this;return r.options=e,r.context=i,r.name="XhrPlugin",r.isReady=!1,r}return e(i,t),i.prototype.init=function(t){if(!this.isReady){this.isReady=!0;var e=this,i=XMLHttpRequest.prototype.open,r=XMLHttpRequest.prototype.send;XMLHttpRequest.prototype.open=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this.H_request_method=t[0],this.H_request_url=t[1],this.H_request_time=P(),i.apply(this,t)},XMLHttpRequest.prototype.send=function(i){var n=this;this.addEventListener("abort",(function(){n.H_response_status_text="abort"})),this.addEventListener("error",(function(){n.H_response_status_text="error"})),this.addEventListener("timeout",(function(){n.H_response_status_text="timeout"})),this.addEventListener("loadend",(function(){var r=n,a=r.status,s=r.statusText,c=r.responseType,u=r.responseText,l=r.response,p=r.H_request_method,d=r.H_request_url,f=r.H_request_time,h=r.H_response_status_text;if(!(a>=200&&a<300)&&"abort"!==h&&!n.isMonitor){var g=c&&"text"!==c?l:u,v=h||s;"error"===h?v="网络错误,或者无法连接":"timeout"===h&&(v="请求超时"),t({H_js_error_id:W("url=".concat(d,"&method=").concat(p)),H_error_category:o.AJAX_ERROR,H_error_type:o.AJAX_ERROR,H_error_message:d,H_request_url:d,H_request_headers:C(e.context.getRequestHeaders()),H_request_method:p,H_request_params:y(i)?C(i):S(i)?i:"",H_response_status:a,H_response_status_text:v,H_request_time:f,H_response_time:P(),H_response_data:g&&C(g)})}delete n.H_request_method,delete n.H_request_url,delete n.H_request_time,delete n.H_response_status_text}));try{r.call(this,i)}catch(t){}}}},i.prototype.transform=function(t){return this.context.getReportData("H_performance_js",t)},i}(d),ge=function(t){function i(e,i){var r=t.call(this,e,i)||this;return r.options=e,r.context=i,r.name="PromiseErrorPlugin",r.isReady=!1,r}return e(i,t),i.prototype.init=function(t){this.isReady||(this.isReady=!0,window.addEventListener("unhandledrejection",(function(e){var i=e.reason,r=o.PROMISE_ERROR,n="",a="";S(i)?n=i:void 0===i?n="undefined":(null==i?void 0:i.stack)?(r=i.name,n=i.message,a=JSON.stringify({errorStack:x(i),details:K(i)})):n=C(i);["axioserror","cancelederror","aborterror"].includes(r.toLowerCase())||t({H_js_error_id:W("message=".concat(n,"&stack=").concat(a)),H_error_category:o.PROMISE_ERROR,H_error_type:r||o.PROMISE_ERROR,H_error_message:n,H_error_stack:a})})))},i.prototype.transform=function(t){return this.context.getReportData("H_performance_js",t)},i}(d),ve="4.0.0",me=function(t){function a(e,i){void 0===i&&(i=!0);var r=t.call(this,e,i)||this;return r.consolePrefix="性能监控SDK",r.presetProps={},r.requestHeaders={},r.useInstancing&&r.init(e),r}return e(a,t),a.prototype.init=function(t){var e=this;if(this.isReady)this.log("Monitor has been initialized",i.ERROR);else{var n={serverUrl:"",name:"",showLog:!1,errorCapture:!0,performance:!0,openPromiseCapture:!1,sendType:r.BEACON,customHeaders:{},credentials:!1,dataSendTimeout:3e3,batchSend:!1,imgUseCrossOrigin:!1,performanceOff:[],plugins:[]};this.options=c(c({},n),t),this.initState(),this.normalizeConfig(),this.initPlugins(),this.isReady=!0,window.addEventListener("beforeunload",(function(){e.store.setSessionId("")}))}},a.prototype.initState=function(){this.store=new wt(this.options),this.store.init()},a.prototype.normalizeConfig=function(){var t=this.options,e=t.serverUrl,r=t.batchSend;""===(e=(e=e||"").trim())&&this.log("当前 serverUrl 为空,network 中不会发数据,请配置正确的 serverUrl!",i.WARN),(!0===r||y(r)&&!A(r))&&(this.options.batchSend=c({dataSendTimeout:6e3,sendInterval:6e3,storageLimit:200},r),this.batchSender=new bt(this.options,n.WEB,"hinaepm_tab","hinaepm_data_"))},a.prototype.initPlugins=function(){var t=this,e=this.options,i=e.errorCapture,r=e.performance,n=e.openPromiseCapture,o=e.plugins,a=void 0===o?[]:o;a=a||[];var s=[],c=[];if(i&&(s=[new Ht(this.options,this),new Rt(this.options,this),new fe(this.options,this),new he(this.options,this)],!0===n)){var u=new ge(this.options,this);s.push(u)}r&&(c=[new de(this.options,this)]);this.plugins=p(p([],l(s),!1),l(c),!1),a.forEach((function(e){var i=new e(t.options,t);t.plugins.push(i)})),this.runPlugins(this.plugins)},a.prototype.report=function(t,e,i){var r=this.options.beforeSend,n=t;k(r)&&(n=r(n)),this.log(n),this.sendReportData(n,e,i)},a.prototype.getReportData=function(t,e){var i=this.options.sourcemapVersion;i||(i="1.0.0");var r=this.store.getAnonymousId(),n=this.store.getAccountId(),o=this.store.getSessionId(),a=P(),s=c(c(c({},this.getReportProperties()),{H_js_sourcemap_version:i}),e||{}),u={anonymous_id:r,type:"track",event:t,time:a,_track_id:M(),properties:s};(n&&(u.account_id=n),o)?P()-this.store.getSessionIdCreateTime()>18e5&&(o=j(),this.store.setSessionId(o)):(o=j(),this.store.setSessionId(o));return s.H_session_id=o,u.send_time=P(),u},a.prototype.getReportProperties=function(){return c(c(c({},et(ve)),this.getCommonProperties()),{H_url:window.location.href,H_title:document.title})},a.prototype.captureException=function(t,e,i){t instanceof Error||(t=new Error(t)),y(e)||(e={});var r=x(t),n=this.getReportData("H_performance_js",{H_js_error_id:W(r),H_error_category:o.CAPTURE_EXCEPTION,H_error_type:o.CAPTURE_EXCEPTION,H_error_message:t.message,H_error_stack:JSON.stringify({details:K(t),errorStack:r}),H_capture_extra:JSON.stringify(e)});this.report(n,i)},a.prototype.captureEvent=function(t,e){if(y(t)){var i=t.message,r=t.extra;y(r)||(r={});var n=this.getReportData("H_performance_js",{H_js_error_id:W(i||""),H_error_category:o.CAPTURE_EVENT,H_error_type:o.CAPTURE_EVENT,H_error_message:i||"",H_capture_message:i||"",H_capture_extra:JSON.stringify(r)});this.report(n,e)}else this.log("captureEvent event参数错误:event必须是一个对象")},a.prototype.setCommonProperties=function(t){y(t)&&!A(t)&&(this.presetProps=L(this.presetProps,t))},a.prototype.getCommonProperties=function(){return this.presetProps},a.prototype.clearCommonProperties=function(t){var e=this;void 0===t&&(t=!0),!0===t?this.presetProps={}:b(t)&&t.forEach((function(t){t in e.presetProps&&delete e.presetProps[t]}))},a.prototype.setRequestHeaders=function(t){void 0===t&&(t={}),y(t)&&!A(t)&&(this.requestHeaders=L(this.requestHeaders,t))},a.prototype.getRequestHeaders=function(){return this.requestHeaders},a.prototype.clearRequestHeaders=function(t){void 0===t&&(t=!0),!0===t?this.requestHeaders={}:b(t)&&t.forEach((function(t){}))},a}(St);new me({},!1);var _e=["mark","/mark","strong","b","em","i","u","abbr","ins","del","s","sup"],ye=["a","input","button","textarea"],we=["abtestExperimentId","paramName","valueType","defaultValue","callback","timeoutMilliseconds","customProperties","customIds"],be=function(t){function r(e,i){var r=t.call(this,e,i)||this;return r.options=e,r.context=i,r.name="ClickTrackPlugin",r.isReady=!1,r.isTrackList={a:!0,button:!0},r}return e(r,t),r.prototype.init=function(t){var e=this,r=this.options.autoTrackConfig,n=r.clickAutoTrack,o=r.isCollectUrl,a=r.isCollectElement,s=r.addCustomProperty;!0===n&&(this.isReady?this.context.log("ClickTrack plugin:插件已经运行,无需重复执行",i.WARN):(this.isReady=!0,document.addEventListener("click",(function(i){if(o()){var r=i||window.event;if(r){var n=r.target||r.srcElement,c=e.getTargetElement(n);if(c){if(k(a)&&!a(c))return!1;var u=e.getClickElementInfo(c),l=ut(r,c),p=l.H_page_x,d=l.H_page_y;if(u.H_page_x=p,u.H_page_y=d,k(s)){var f=s(c);y(f)&&(u=L(u,f))}t(u)}}}}),!0)))},r.prototype.transform=function(t){return this.context.getReportData("track","H_WebClick",t)},r.prototype.hasAttribute=function(t,e){var i;return t.hasAttribute?t.hasAttribute(e):t.attributes?!!(null===(i=t.attributes[e])||void 0===i?void 0:i.value):void 0},r.prototype.hasAttributes=function(t,e){if(b(e))for(var i=0;i<e.length;i++)if(this.hasAttribute(t,e[i]))return!0;return!1},r.prototype.hasElement=function(t){var e,i,r,n=function(t){var e=[t];try{if(!at(t))return e;if(null===t||null===t.parentElement)return e;for(;null!==t.parentElement;)t=t.parentElement,e.push(t);return e}catch(t){}return e}(t),o=this.options.autoTrackConfig.trackAttr||[];if(b(n)&&n.length>0)try{for(var a=u(n),s=a.next();!s.done;s=a.next()){var c=s.value,l=c.tagName&&(null===(r=c.tagName)||void 0===r?void 0:r.toLowerCase());if(at(c)&&(this.isTrackList[l]||this.hasAttributes(c,o)))return c}}catch(t){e={error:t}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(e)throw e.error}}},r.prototype.getDivMaxLevel=function(){var t;return(null===(t=this.options.autoTrackConfig.collectTags.div)||void 0===t?void 0:t.maxLevel)||1},r.prototype.isStyleTag=function(t){var e,i=(null===(e=this.options.autoTrackConfig.collectTags.div)||void 0===e?void 0:e.ignoreTags)||[];return null==i?void 0:i.includes(t)},r.prototype.getCollectableParent=function(t){var e;try{var r=t.parentNode,n=r?null===(e=r.tagName)||void 0===e?void 0:e.toLowerCase():"";if("body"===n)return!1;var o=this.getDivMaxLevel();if("div"===n&&(o>1||this.isCollectableDiv(r)))return r;if(r&&this.isStyleTag(n))return this.getCollectableParent(r)}catch(t){this.context.log(t,i.ERROR)}return!1},r.prototype.isCollectableDiv=function(t){var e;try{var r=t.children||[];if(0===r.length)return!0;for(var n=0;n<r.length;n++){var o=r[n];if(at(o)){var a=null===(e=o.tagName)||void 0===e?void 0:e.toLowerCase(),s=this.getDivMaxLevel();if(!("div"===a&&s>1||this.isStyleTag(a)))return!1;if(!this.isCollectableDiv(o))return!1}}return!0}catch(t){this.context.log(t,i.ERROR)}return!1},r.prototype.isDivLevelValid=function(t){for(var e=this.getDivMaxLevel(),i=t.getElementsByTagName("div"),r=i.length-1;r>=0;r--)if(this.getDivLevels(i[r],t)>e)return!1;return!0},r.prototype.getElementPath=function(t,e,i){for(var r,n,o=[];at(t)&&t.parentNode;){if(t.id&&!e&&/^[A-Za-z][-A-Za-z0-9_:.]*$/.test(t.id)){var a=t.tagName||"";o.unshift("".concat(a.toLowerCase(),"#").concat(t.id));break}if(i&&t===i){o.unshift(null===(r=t.tagName)||void 0===r?void 0:r.toLowerCase());break}if(t===document.body){o.unshift("body");break}o.unshift(null===(n=t.tagName)||void 0===n?void 0:n.toLowerCase()),t=t.parentNode}return o.join(" > ")},r.prototype.getDivLevels=function(t,e){var i=this.getElementPath(t,!0,e).split(" > "),r=0;return i.forEach((function(t){"div"===t&&r++})),r},r.prototype.getTargetElement=function(t){var e;if(!at(t))return null;var i=null===(e=t.tagName)||void 0===e?void 0:e.toLowerCase();if(!S(i))return null;if(["body","html"].includes(i))return null;if(this.context.trackTags.includes(i)&&"div"!==i)return t;if("div"===i&&this.options.autoTrackConfig.collectTags.div&&(this.isDivLevelValid(t)&&(this.getDivMaxLevel()>1||this.isCollectableDiv(t))))return t;if(this.options.autoTrackConfig.collectTags.div&&this.isStyleTag(i)){var r=this.getCollectableParent(t);if(r&&this.isDivLevelValid(r))return r}return this.hasElement(t)||null},r.prototype.getClickElementInfo=function(t){var e=this.options.autoTrackConfig.isCollectInput,i=!1;k(e)&&(i=e(t));var r=this.getDomSelector(t),n=function(t,e){var i;return at(t)?I({H_element_type:null===(i=t.tagName)||void 0===i?void 0:i.toLowerCase(),H_element_name:t.getAttribute("name"),H_element_id:t.getAttribute("id"),H_element_target_url:t.getAttribute("href"),H_element_class_name:t.getAttribute("className"),H_element_content:st(t,e)}):{}}(t,i);return n.H_element_selector=r,n.H_element_path=this.getElementPath(t,!1),n},r.prototype.getDomSelector=function(t){for(var e,i=[];t;){if("body"===(null===(e=t.tagName)||void 0===e?void 0:e.toLowerCase())||!at(t)){i.unshift("body");break}if(i.unshift(this.getSelector(t)),(null==t?void 0:t.getAttribute("id"))&&/^[A-Za-z][-A-Za-z0-9_:.]*$/.test(t.getAttribute("id")))break;t=t.parentNode}return i.join(" > ")},r.prototype.getSelector=function(t){var e,i,r=null===(e=t.tagName)||void 0===e?void 0:e.toLowerCase(),n=-1;9!==(null===(i=t.parentNode)||void 0===i?void 0:i.nodeType)&&(n=this.getDomIndex(t));var o=t.getAttribute("id");return o&&/^[A-Za-z][-A-Za-z0-9_:.]*$/.test(o)?"#".concat(o):r+(n>-1?":nth-of-type(".concat(n+1,")"):"")},r.prototype.getDomIndex=function(t){var e,i;if(t.parentNode)for(var r=0,n=null===(e=t.tagName)||void 0===e?void 0:e.toLowerCase(),o=t.parentNode.children,a=0;a<o.length;a++){var s=o[a];if((null===(i=s.tagName)||void 0===i?void 0:i.toLowerCase())===n){if(s===t)return r;r++}}return-1},r}(d),ke=function(t){function r(e,i){var r=t.call(this,e,i)||this;return r.options=e,r.context=i,r.name="StayTrackPlugin",r.isReady=!1,r.timer=null,r.previousTime=P(),r.previousOffsetTop=0,r}return e(r,t),r.prototype.init=function(t){var e=this,r=this.options,n=r.autoTrackConfig,o=r.stayAutoTrackConfig;if(!0===n.stayAutoTrack)if(this.isReady)this.context.log("StayTrack plugin:插件已经运行,无需重复执行",i.WARN);else{this.isReady=!0;var a=o.isCollectUrl;k(a)||(a=function(){return!0}),this.timer&&(clearTimeout(this.timer),this.timer=null),this.previousTime=P(),window.addEventListener("load",(function(){e.previousOffsetTop=it()})),window.addEventListener("scroll",(function(){a()&&(e.timer||(e.timer=setTimeout((function(){e.run(t),clearTimeout(e.timer),e.timer=null}),1e3)))})),window.addEventListener("unload",(function(){a()&&e.run(t,!0)}))}},r.prototype.transform=function(t){return this.context.getReportData("track","H_WebStay",t)},r.prototype.run=function(t,e){void 0===e&&(e=!1);var i=this.options.autoTrackConfig,r=i.stayDelayTime,n=i.maxStayPageDuration,o=it(),a=P(),s=a-this.previousTime;(e||s>r&&o!==this.previousOffsetTop)&&t({H_viewport_position:this.previousOffsetTop,event_duration:Math.min(s/1e3,n)});this.previousTime=a,this.previousOffsetTop=o},r}(d),Se=function(t){function r(e,i){var r=t.call(this,e,i)||this;return r.options=e,r.context=i,r.name="PageLeave",r.isReady=!1,r.pageId=M(),r.storageName="hinasdk_pageleave_",r.heartbeatIntervalTime=5e3,r.maxDuration=432e3,r.heartbeatIntervalTimer=null,r.startTime=P(),r.url=window.location.href,r.pageShowStatus=!0,r}return e(r,t),r.prototype.init=function(){if(this.options.autoTrackConfig.pageLeaveAutoTrack)if(this.context.store.localStorage)if(this.isReady)this.context.log("PageLeave plugin:插件已经运行,无需重复执行",i.WARN);else{this.isReady=!0;var t=this.normalizePageLeaveAutoTrack(),e=t.heartbeat_interval_time,r=t.max_duration;e&&e>0&&(this.heartbeatIntervalTime=1e3*e),r&&r>0&&(this.maxDuration=Number(r)),this.startTime=P(),this.addPageLeaveEventListener(),document.hidden?this.pageShowStatus=!1:this.startHeartBeatInterval()}else this.context.log("PageLeave plugin需要使用localstorage存储数据,但是您的浏览器不支持localstorage,所以不能使用该功能",i.WARN)},r.prototype.transform=function(){},r.prototype.normalizePageLeaveAutoTrack=function(){var t=this.options.autoTrackConfig.pageLeaveAutoTrack;return y(t)?t:{}},r.prototype.addPageLeaveEventListener=function(){this.addPageStartListener(),this.addPageSwitchListener(),this.addSinglePageListener(),this.addPageEndListener()},r.prototype.addPageStartListener=function(){var t=this;"onpageshow"in window&&window.addEventListener("pageshow",(function(){t.pageStartHandler()}))},r.prototype.addPageSwitchListener=function(){var t=this;new nt({visible:function(){t.pageStartHandler(),t.startHeartBeatInterval()},hidden:function(){t.url=window.location.href,t.pageEndHandler(),t.stopHeartBeatInterval()}})},r.prototype.addSinglePageListener=function(){var t=this;_t.on("urlChange",(function(e){var i=e.fromHref;i!==e.toHref&&(t.url=i,t.pageEndHandler(),t.stopHeartBeatInterval(),t.pageStartHandler(),t.startHeartBeatInterval())}))},r.prototype.addPageEndListener=function(){var t=this,e=["pagehide","beforeunload","unload"];e.forEach((function(i){"on".concat(e)in window&&window.addEventListener(i,(function(){t.pageEndHandler(),t.stopHeartBeatInterval()}))}))},r.prototype.pageStartHandler=function(){this.startTime=P(),this.pageShowStatus=!document.hidden,this.url=window.location.href},r.prototype.pageEndHandler=function(){if(this.pageShowStatus){if(this.pageShowStatus=!1,this.isCollectUrl()){var t=this.getPageLeaveProperties(),e=this.context.getReportData("track","H_WebPageLeave",t);this.context.report(e)}this.delHeartBeatData()}},r.prototype.startHeartBeatInterval=function(){var t=this;this.heartbeatIntervalTimer&&this.stopHeartBeatInterval(),this.isCollectUrl()&&(this.heartbeatIntervalTimer=setInterval((function(){t.saveHeartBeatData()}),this.heartbeatIntervalTime),this.saveHeartBeatData("first_heartbeat")),this.reissueHeartBeatData()},r.prototype.reissueHeartBeatData=function(){for(var t=this.context.store.localStorage,e=t.length(),i=0;i<e;i++){var r=t.key(i);if(r&&r!==this.storageName+this.pageId&&r.includes(this.storageName)){var n=E(t.get(r));y(n)&&P()-n.time>n.heartbeat_interval_time+5e3&&(delete n.heartbeat_interval_time,this.context.report(n)),this.delHeartBeatData(r)}}},r.prototype.stopHeartBeatInterval=function(){this.heartbeatIntervalTimer&&(clearInterval(this.heartbeatIntervalTimer),this.heartbeatIntervalTimer=null)},r.prototype.delHeartBeatData=function(t){this.context.store.localStorage.remove(t||this.storageName+this.pageId)},r.prototype.isCollectUrl=function(){var t=this.normalizePageLeaveAutoTrack().isCollectUrl;return!k(t)||t(this.url)},r.prototype.saveHeartBeatData=function(t){var e=this.getPageLeaveProperties();e.H_time=P(),"first_heartbeat"===t&&(e.event_duration=3);var i=this.context.getReportData("track","H_WebPageLeave",e);i.heartbeat_interval_time=this.heartbeatIntervalTime,this.context.store.localStorage.set(this.storageName+this.pageId,JSON.stringify(i))},r.prototype.getPageLeaveProperties=function(){var t=(P()-this.startTime)/1e3;t=t<=0||t>this.maxDuration?0:O(t,3);var e=N(this.url),i=e.pathname,r=e.hash,n={H_url:this.url,H_url_path:i,H_url_hash:r};t&&(n.event_duration=t);var o=this.normalizePageLeaveAutoTrack().custom_props;return y(o)&&(n=c(c({},n),o||{})),n},r}(d),He=function(t){function r(e,i){var r=t.call(this,e,i)||this;return r.options=e,r.context=i,r.name="SiteLinker",r.isReady=!1,r.linker=[],r}return e(r,t),r.prototype.init=function(){if(this.options.siteLinkerConfig){var t=this.getLinkerConfig().linker;b(t)&&t.length>0?this.isReady?this.context.log("SiteLinker plugin:插件已经运行,无需重复执行",i.WARN):(this.isReady=!0,this.resolveOption(),this.setRefferId(),this.addClickListen()):this.context.log("siteLinker plugin: 请配置正确的linker参数",i.WARN)}},r.prototype.transform=function(){},r.prototype.getLinkerConfig=function(){var t=this.options.siteLinkerConfig||{},e=t.linker;return{linker:(void 0===e?[]:e)||[],re_login:t.re_login}},r.prototype.resolveOption=function(){for(var t=this.getLinkerConfig().linker,e=t.length,r=[],n=0;n<e;n++){var o=t[n],a=o.part_url,s=o.after_hash;/[A-Za-z0-9]+\./.test(a)&&R(s)?r.push({part_url:a,after_hash:s}):this.context.log("The configuration of linker ".concat(n+1," is not supported.Please check format"),i.WARN)}this.linker=r},r.prototype.setRefferId=function(){var t=this.getLinkerConfig().re_login,e=this.getUrlId(),i=e.startsWith("a");if(""!==(e=e.substring(1))){var r=this.context.store.getAnonymousId(),n=this.context.store.getAccountId();if(i){if(e!==r&&(this.context.store.state.anonymousId=e,this.context.store.save()),n){var o=this.context.getReportData("track_signup","H_SignUp",{});this.context.report(o)}}else(!n||t&&n!==e)&&this.context.setUserUId(e)}},r.prototype.getUrlId=function(){var t=window.location.href.match(/_hnsdk=([au][^\?\#\&\=]+)/);return b(t)&&t[1]?function(t){var e=t;try{e=decodeURIComponent(t)}catch(t){}return e}(t[1]):""},r.prototype.getPartUrl=function(t){for(var e=this.linker.length,i=0;i<e;i++)if(t.includes(this.linker[i].part_url))return!0;return!1},r.prototype.getPartHash=function(t){for(var e=this.linker.length,i=0;i<e;i++)if(t.includes(this.linker[i].part_url))return this.linker[i].after_hash;return!1},r.prototype.getCurrentId=function(){var t=this.context.store.getAccountId(),e=this.context.store.getAnonymousId();return function(t){var e=t;try{e=encodeURIComponent(t)}catch(t){}return e}(t?"u".concat(t):"a".concat(e))},r.prototype.rewriteUrl=function(t,e){var i=/([^?#]+)(\?[^#]*)?(#.*)?/.exec(t),r="";if(i){var n=i[1]||"",o=i[2]||"",a=i[3]||"",s="_hnsdk=".concat(this.getCurrentId()),c=function(t){var e=t.split("&"),i=[];return e.forEach((function(t){t.includes("_hnsdk")?i.push(s):i.push(t)})),i.join("&")};if(this.getPartHash(t)){var u=a.includes("?"),l=a.indexOf("_hnsdk");r=u?l>=0?"".concat(n).concat(o,"#").concat(a.substring(1,l)).concat(c(a.substring(l,a.length))):"".concat(n).concat(o,"#").concat(a.substring(1),"&").concat(s):"".concat(n).concat(o,"#").concat(a.substring(1),"?").concat(s)}else{r=(u=/^\?(\w)+/.test(o))?o.includes("_hnsdk")?"".concat(n,"?").concat(c(o.substring(1))).concat(a):"".concat(n).concat(o,"&").concat(s).concat(a):"".concat(n,"?").concat(s).concat(a)}return e&&(e.href=r),r}},r.prototype.addClickListen=function(){var t=this,e=function(e){var i,r,n=e.target;if(n){var o=null===(i=n.tagName)||void 0===i?void 0:i.toLowerCase(),a=n.parentNode,s=null===(r=null==a?void 0:a.tagName)||void 0===r?void 0:r.toLowerCase();if("a"===o&&n.href||"a"===s&&a.href){var c=void 0,u=void 0;"a"===o&&n.href?(c=n.href,u=n):(c=a.href,u=a);var l=N(c).protocol;"http:"!==l&&"https:"!==l||t.getPartUrl(c)&&t.rewriteUrl(c,u)}}};"PointerEvent"in window?document.addEventListener("pointerdown",e):document.addEventListener("mousedown",e)},r}(d),Re=function(t){function r(e,i){var r=t.call(this,e,i)||this;return r.options=e,r.context=i,r.name="HistoryPlugin",r.isReady=!1,r.lastHref=window.location.href,r.lastPath=window.location.pathname,r}return e(r,t),r.prototype.init=function(){if(window&&window.history.pushState&&window.history.replaceState)if(this.isReady)this.context.log("History plugin:插件已经运行,无需重复执行",i.WARN);else{this.isReady=!0;var t=this,e=window.onpopstate,r=function(e,i){var r={fromPath:t.lastPath,fromHref:t.lastHref,toPath:e,toHref:i};t.lastPath=e,t.lastHref=i,_t.emit("urlChange",c(c({},r),{mode:"history"}))};window.onpopstate=function(){for(var t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];var n=window.location.pathname,o=window.location.href;r(n,o),e&&e.apply(this,t)},V(window.history,"pushState",n),V(window.history,"replaceState",n)}function n(t){return function(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];t.apply(this,e);var n=window.location.pathname,o=window.location.href;r(n,o)}}},r.prototype.transform=function(){},r}(d),xe=function(t){function r(e,i){var r=t.call(this,e,i)||this;return r.options=e,r.context=i,r.name="HashPlugin",r.isReady=!1,r.lastHref=window.location.href,r.lastPath=window.location.hash,r}return e(r,t),r.prototype.init=function(){var t=this;this.isReady?this.context.log("Hash plugin:插件已经运行,无需重复执行",i.WARN):(this.isReady=!0,window.addEventListener("hashchange",(function(e){var i=e.newURL,r=N(i).hash,n={fromPath:t.lastPath,fromHref:t.lastHref,toPath:r,toHref:i};t.lastHref=i,t.lastPath=r,_t.emit("urlChange",c(c({},n),{mode:"hash"}))})))},r.prototype.transform=function(){},r}(d),Te="4.0.0",Ee=function(t){function r(e,i){var r,n,o=t.call(this,e,i)||this;return o.options=e,o.context=i,o.name="HinaABTest",o.isReady=!1,o.platform=(n=null===(r=tt.getUA())||void 0===r?void 0:r.toLowerCase(),/android|webos|iphone|ipod|blackberry/i.test(n)?"H5":"Web"),o.projectKey="",o.storageName="hina_webjs_sdk_abtest",o}return e(r,t),r.prototype.init=function(){var t=this;if(this.context.store.localStorage){var e=this.options.abTestingPluginConfig,r=null==e?void 0:e.url;if(S(r)){var n=F(r,"project-key");if(n){this.projectKey=n;var o=N(r).protocol,a=N(window.location.href).protocol;if(o&&o!==a)this.context.log("A/B Testing 初始化失败,".concat(a," 页面必须使用 ").concat(a," 的 URL"),i.WARN);else if(this.isReady)this.context.log("A/B Testing 插件已经运行,无需重复执行",i.WARN);else{var s=this.context.getUserUid();this.context.log("当前accountId为:".concat(s),i.INFO),_t.on("changeAccountId",(function(){t.context.store.localStorage.set(t.storageName,"")})),this.isReady=!0}}else this.context.log("A/B Testing 初始化失败,请使用正确的 URL(必须包含 project-key)")}else this.context.log("A/B Testing 初始化失败,请使用正确的 URL!",i.WARN)}else this.context.log("A/B Testing 初始化失败,浏览器不支持localStorage",i.WARN)},r.prototype.transform=function(){},r.prototype.valueMatchType=function(t,e){switch(e){case s.INTEGER:return H(t);case s.STRING:return S(t);case s.BOOLEAN:return R(t);default:return!1}},r.prototype.normalizeParams=function(t,e,r){var n,o;void 0===r&&(r=we);var a={verify_success:!0,para:e};try{for(var c=u(r),l=c.next();!l.done;l=c.next()){var p=l.value;if(!a.verify_success)break;var d=e.customIds||{},f={};switch(p){case"abtestExperimentId":S(e.abtestExperimentId)&&e.abtestExperimentId.trim()||(this.context.log("".concat(t,"方法调用失败,").concat(p,"参数未正确配置!").concat(p,": ").concat(e.abtestExperimentId),i.WARN),a.verify_success=!1);break;case"paramName":S(e.paramName)&&e.paramName.trim()||(this.context.log("".concat(t,"方法调用失败,").concat(p,"参数未正确配置!").concat(p,": ").concat(e.paramName),i.WARN),a.verify_success=!1);break;case"valueType":[s.BOOLEAN,s.INTEGER,s.STRING].includes(e.valueType)||(this.context.log("".concat(t,"方法调用失败,").concat(p,"参数未正确配置!").concat(p,": ").concat(e.valueType),i.WARN),a.verify_success=!1);break;case"defaultValue":this.valueMatchType(e.defaultValue,e.valueType)||(this.context.log("".concat(t,"方法调用失败,").concat(p,"类型必须与valueType一致!"),i.WARN),a.verify_success=!1);break;case"callback":k(e.callback)||(this.context.log("".concat(t,"方法调用失败,").concat(p,"参数未正确配置")),e.callback=T,a.verify_success=!1);break;case"timeoutMilliseconds":(!H(e.timeoutMilliseconds)||e.timeoutMilliseconds<=0)&&(this.context.log("".concat(p,"参数错误:").concat(e.timeoutMilliseconds),i.WARN),e.timeoutMilliseconds=3e3),e.timeoutMilliseconds<200&&(e.timeoutMilliseconds=200);break;case"customProperties":e.customProperties=y(e.customProperties)?e.customProperties:{};break;case"customIds":for(var h in d)(S(d[h])||H(d[h]))&&(f[h]=d[h]);e.customIds=f}}}catch(t){n={error:t}}finally{try{l&&!l.done&&(o=c.return)&&o.call(c)}finally{if(n)throw n.error}}return a},r.prototype.sendTriggerEvent=function(t){var e=t.abtest_experiment_group_id,i=t.abtest_experiment_id;this.context.track("H_ABTestTrigger",{H_abtest_experiment_id:i,H_abtest_experiment_group_id:e})},r.prototype.getExpResult=function(t,e){var i,r;void 0===e&&(e=[]);var n,o=t.abtestExperimentId,a=t.paramName,s=t.valueType;if(0===e.length){var c=this.getStorageData();y(c)&&(e=c.result||[])}try{for(var l=u(e),p=l.next();!p.done;p=l.next()){var d=p.value,f=d.abtest_experiment_id,h=d.abtest_experiment_group_id,g=d.is_white_list,v=d.variables;if(f===o){var m=v.find((function(t){return t.name===a&&t.type===s}));if(m){g||this.sendTriggerEvent({abtest_experiment_id:f,abtest_experiment_group_id:h}),n=m.value;break}}}}catch(t){i={error:t}}finally{try{p&&!p.done&&(r=l.return)&&r.call(l)}finally{if(i)throw i.error}}return n},r.prototype.getStorageData=function(){var t=this.context.store.localStorage.get(this.storageName);return w(t)?E(t):null},r.prototype.saveResponseData=function(t){var e=this.getStorageData(),i={updateTime:P()};if(e&&y(e)){var r=[],n=e.result||[];t.forEach((function(t){var e=t.abtest_experiment_group_id,i=t.abtest_experiment_id,o=t.variables,a=n.find((function(t){return t.abtest_experiment_id===i&&t.abtest_experiment_group_id===e}));if(a){var s=[];o.forEach((function(t){var e=t.name,i=t.type,r=a.variables.findIndex((function(t){return t.name===e&&t.type===i}));r>=0?a.variables[r]=t:s.push(t)})),a.variables=p(p([],l(a.variables),!1),l(s),!1)}else r.push(t)})),i.result=p(p([],l(n),!1),l(r),!1)}else i.result=t;this.context.store.localStorage.set(this.storageName,JSON.stringify(i))},r.prototype.createRequestData=function(t){var e=t.paramName,i=t.customProperties,r=t.customIds,n={anonymous_id:this.context.store.getAnonymousId(),platform:this.platform,abtest_lib_version:Te,param_name:e,properties:this.context.getPresetProperties()};return y(i)&&!A(i)&&(n.custom_properties=i),y(r)&&!A(r)&&(n.custom_ids=r),this.context.getUserUid()&&(n.login_id=this.context.getUserUid()),n},r.prototype.getResultFromServer=function(t){var e=this;return new Promise((function(i,r){var n=e.createRequestData(t);new gt({url:e.options.abTestingPluginConfig.url,data:JSON.stringify(n),contentType:"application/json",customHeaders:{"project-key":e.projectKey},timeout:t.timeoutMilliseconds}).run().then((function(t){var n=t.data;"SUCCESS"===(null==n?void 0:n.status)?(e.saveResponseData(n.results),i(n)):r()}))}))},r.prototype.asyncFetch=function(t){var e=this;return new Promise((function(i){e.getResultFromServer(t).then((function(t){i(t)})).catch((function(){t.callback(t.defaultValue)}))}))},r.prototype.preFetch=function(t,e){return this.isReady?!!y(e)||(this.context.log("".concat(t," 方法参数必须是对象"),i.WARN),!1):(this.context.log("A/B Testing 插件尚未运行,请先执行该插件",i.WARN),!1)},r.prototype.asyncFetchABTest=function(t){var e=this;if(this.preFetch("asyncFetchABTest",t)){var i=this.normalizeParams("asyncFetchABTest",t),r=i.verify_success,n=i.para;r?this.asyncFetch(n).then((function(t){var i=e.getExpResult(n,t.results);n.callback(i||n.defaultValue)})):n.callback(n.defaultValue)}},r.prototype.fetchCacheABTest=function(t){if(this.preFetch("fetchCacheABTest",t)){var e=this.normalizeParams("fetchCacheABTest",t),i=e.verify_success,r=e.para;if(i){var n=this.getExpResult(r);r.callback(n||r.defaultValue)}else r.callback(r.defaultValue)}},r.prototype.fastFetchABTest=function(t){var e=this;if(this.preFetch("fastFetchABTest",t)){var i=this.normalizeParams("fastFetchABTest",t),r=i.verify_success,n=i.para;if(r){var o=this.getExpResult(n);w(o)?n.callback(o):this.asyncFetch(n).then((function(){var t=e.getExpResult(n);n.callback(t||n.defaultValue)}))}else n.callback(n.defaultValue)}},r}(d),Ce=function(t){function o(e,i){void 0===i&&(i=!0);var r=t.call(this,e,i)||this;return r.consolePrefix="埋点SDK",r.trackTags=ye,r.presetProps={},r.useInstancing&&r.init(e),r}return e(o,t),o.prototype.init=function(t){if(this.isReady)this.log("hinaSDK has been initialized",i.ERROR);else{var e={name:"",serverUrl:"",showLog:!1,autoTrackConfig:{clickAutoTrack:!0,stayAutoTrack:!0,isCollectUrl:function(){return!0},isCollectElement:function(){return!0},isCollectInput:function(){return!1},addCustomProperty:function(){},stayDelayTime:4e3,maxStayPageDuration:18e3,collectTags:{div:!1},trackAttr:["hn-click"],pageviewAutoTrack:!1,pageLeaveAutoTrack:!1},stayAutoTrackConfig:{isCollectUrl:function(){return!0}},maxStringLength:1024,imgUseCrossOrigin:!1,isSinglePage:!1,batchSend:!1,appJsBridge:!1,sendType:r.BEACON,customHeaders:{},credentials:!1,dataSendTimeout:3e3,presetProperties:{latest_utm:!0,latest_traffic_source_type:!0,latest_search_keyword:!0,latest_referrer:!0,url:!0,title:!0},sourceChannel:[],plugins:[]},n=t.performanceErrorConfig,o=function(t,e){var i={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(i[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(t);n<r.length;n++)e.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(t,r[n])&&(i[r[n]]=t[r[n]])}return i}(t,["performanceErrorConfig"]);this.options=L(e,o),this.options=c(c({},this.options),{performanceErrorConfig:n}),this.initState(),this.normalizeConfig(),this.initAdvProps(),this.initPlugins(),this.isReady=!0}},o.prototype.initState=function(){this.store=new wt(this.options),this.store.init()},o.prototype.normalizeConfig=function(){var t=this,e=this.options,o=e.serverUrl,a=e.sendType,s=e.batchSend,u=e.maxStringLength,l=e.isSinglePage,p=e.autoTrackConfig,d=void 0===p?{}:p,f=d.trackAttr,h=void 0===f?[]:f,g=d.collectTags,v=d.pageLeaveAutoTrack,m=d.pageviewAutoTrack;if(""===(o=(o=o||"").trim()))this.log("当前 serverUrl 为空,network 中不会发数据,请配置正确的 serverUrl!",i.WARN);else{var _=N(window.location.href).protocol||"";(N(o).protocol||"")!==_&&this.log("SDK 检测到您的数据发送地址和当前页面地址的协议不一致,建议您修改成一致的协议。因为:https 下面发送 http 的图片请求会失败。",i.WARN)}[r.IMAGE,r.AJAX,r.BEACON].includes(a)||this.setConfig({sendType:r.AJAX});var w=u;if(!H(u)||u<0?w=1024:u>5120&&(w=5120),this.options.maxStringLength=w,(!0===v||y(v)&&A(v))&&(this.options.autoTrackConfig.pageLeaveAutoTrack={heartbeat_interval_time:5e3,max_duration:432e3}),b(h)?(h=h.filter((function(t){return S(t)})),h.includes("hn-click")||h.push("hn-click")):h=["hn-click"],this.options.autoTrackConfig.trackAttr=h,y(g))if(!0===g.div)this.options.autoTrackConfig.collectTags.div={ignoreTags:_e,maxLevel:1};else if(y(g.div)){var R=1,x=g.div;H(x.maxLevel)&&[1,2,3].includes(x.maxLevel)&&(R=x.maxLevel),this.options.autoTrackConfig.collectTags.div={ignoreTags:_e,maxLevel:R}}else this.options.autoTrackConfig.collectTags.div=!1;else this.options.autoTrackConfig.collectTags={div:!1};this.updateTrackTags(),(!0===s||y(s)&&!A(s))&&(this.options.batchSend=c({dataSendTimeout:6e3,sendInterval:6e3,storageLimit:200},s),this.batchSender=new bt(this.options,n.WEB,"hinasdk_tab","hinasdk_data_")),"auto"===m?this.autoTrack():("singlePage"===m||l)&&(this.autoTrack(),_t.on("urlChange",(function(e){var i=e.fromHref;if(i!==e.toHref){if(k(l)){var r=l();y(r)&&(e=c(c({},e),r))}t.autoTrack(c(c({},e),{H_referrer:i}))}})))},o.prototype.updateTrackTags=function(){var t=this.options.autoTrackConfig.collectTags,e=p([],l(ye),!1);Object.keys(t||{}).forEach((function(i){var r=t[i];!0!==r&&!y(r)||e.includes(i)||e.push(i)})),this.trackTags=e},o.prototype.initAdvProps=function(){var t={},e=this.options,i=e.presetProperties,r=e.sourceChannel;Object.keys(i||{}).forEach((function(e){var r,n=i[e];if(e.includes("latest_")&&(e=e.slice(7),n)){var o=U();if("utm"!==e&&"url解析失败"===o)t["H_latest_".concat(e)]="url的domain解析失败";else if(""===(r=r||document.referrer)||D(B(r))!==D())switch(e){case"traffic_source_type":t.H_latest_traffic_source_type=lt.getSourceFromReferrer();break;case"search_keyword":var a=lt.getKeywordFromReferrer();a&&(t.H_latest_search_keyword=a);break;case"referrer":t.H_latest_referrer=q()}}}));var n=this.store.state.props||{},o={};i.latest_utm&&(o=pt("H_latest_"));var a={};n.H_utm_source||(a=pt("H_"));var s={},u={};if(b(r)&&r.length>0){var l=r.filter((function(t){return!f.includes(t)}));l.length>0&&(n["H_".concat(l[0])]||(u=dt("H_",l)),s=dt("H_latest_",l))}this.store.state.props=c(c(c(c(c(c({},this.store.state.props),t),o),s),u),a),this.store.setProps(this.store.state.props)},o.prototype.initPlugins=function(){var t=this,e=this.options,i=e.serverUrl,r=e.name,n=e.showLog,o=e.sendType,a=e.customHeaders,s=e.credentials,u=e.dataSendTimeout,l=e.batchSend,p=e.imgUseCrossOrigin,d=e.globalCallback,f=e.plugins,h=void 0===f?[]:f,g=e.performanceErrorConfig,v=e.autoTrackConfig,m=e.siteLinkerConfig,_=e.abTestingPluginConfig;h=h||[];var w=v.pageLeaveAutoTrack,k=new be(this.options,this),S=new ke(this.options,this),H=new Re(this.options,this),R=new xe(this.options,this);if(this.plugins=[k,S,H,R],y(w)&&!A(w)){var x=new Se(this.options,this);this.plugins.push(x)}var T=(m||{}).linker;if(b(T)&&T.length>0){var E=new He(this.options,this);this.plugins.push(E)}if(y(_)&&!A(_)){var C=new Ee(this.options,this);this.plugins.push(C)}if(h.forEach((function(e){var i=new e(t.options,t);t.plugins.push(i)})),y(g)&&!A(g)){var P=c({serverUrl:i,name:r,showLog:n,sendType:o,customHeaders:a,credentials:s,dataSendTimeout:u,batchSend:l,imgUseCrossOrigin:p,globalCallback:d},g);this.epmInstance=new me(P,!0)}this.runPlugins(this.plugins)},o.prototype.use=function(t,e){var r=this,n=this.options,o=n.autoTrackConfig,a=n.siteLinkerConfig,s=n.abTestingPluginConfig,c=o.pageLeaveAutoTrack,u=function(t){var e=new t(r.options,r);r.plugins.push(e),e.init()};if(this.isReady){if(y(e))return"PageLeave"===t?y(c)&&!A(c)?this.log("PageLeave插件已运行,无需重复执行",i.WARN):(this.options.autoTrackConfig.pageLeaveAutoTrack=e,u(Se)):"SiteLinker"===t?y(a)&&!A(a)?this.log("SiteLinker插件已插件已运行,无需重复执行",i.WARN):(this.options.siteLinkerConfig=e,u(He)):"HinaABTest"===t&&(y(s)&&!A(s)?this.log("HinaABTest插件已运行,无需重复执行",i.WARN):(this.options.abTestingPluginConfig=e,u(Ee))),this.getPluginInstance(t);this.log("".concat(t,"插件配置项必须是一个对象类型"),i.WARN)}else this.log("请先初始化埋点SDK",i.WARN)},o.prototype.getPluginInstance=function(t){return this.plugins.find((function(e){return e.name===t}))},o.prototype.setConfig=function(t){this.options=L(this.options,t),this.normalizeConfig()},o.prototype.getConfig=function(t){return t?this.options[t]:this.options},o.prototype.setUserUId=function(t,e){if(H(t=null!=t?t:"")||S(t))if(t=String(t).trim(),this.store.getAccountId()!==t){this.store.setAccountId(t);var r=this.getReportData("track_signup","H_SignUp",{});this.report(r,e),_t.emit("changeAccountId")}else this.log("setUserUId: uid is equal to account_id, , failed to execute setUserUId",i.WARN);else this.log("setUserUId: uid must be string or number",i.WARN)},o.prototype.getUserUid=function(){return this.store.state.accountId},o.prototype.setDeviceUId=function(t){this.store.setDeviceId(t)},o.prototype.getDeviceUId=function(){return this.store.getDeviceId()},o.prototype.userSet=function(t,e){if(y(t)&&!A(t)){var i=this.getReportData("user_set","",t);this.report(i,e)}},o.prototype.userSetOnce=function(t,e){if(y(t)&&!A(t)){var i=this.getReportData("user_setOnce","",t);this.report(i,e)}},o.prototype.userAdd=function(t,e){var r,n=this;S(t)&&((r={})[t]=1,t=r);if(y(t)&&!A(t)&&function(t){for(var e in t)if(!/-*\d+/.test(String(t[e])))return n.log("userAdd属性的值只能是数字",i.WARN),!1;return!0}(t)){var o=this.getReportData("user_add","",t);this.report(o,e)}},o.prototype.userAppend=function(t,e){var i={};if(y(t)&&(Object.keys(t).forEach((function(e){var r=t[e];b(r)?i[e]=r:i[e]=[r]})),!A(i))){var r=this.getReportData("user_append","",i);this.report(r,e)}},o.prototype.userUnset=function(t,e){var r=this,n={};if(S(t)&&(t=[t]),b(t)){if(t.forEach((function(t){S(t)?n[t]=!0:r.log("userUnset参数数组里面的值必须时string,已经过滤掉".concat(t),i.WARN)})),!A(n)){var o=this.getReportData("user_unset","",n);this.report(o,e)}}else this.log("userUnset参数必须是数组或字符串",i.WARN)},o.prototype.userDelete=function(t){var e=this.getReportData("user_delete","",{});this.report(e,t),this.store.setAccountId("")},o.prototype.registerCommonProperties=function(t){this.presetProps=L(this.presetProps,t)},o.prototype.getPresetProperties=function(){return{H_is_first_day:this.store.isFirstDay,H_is_first_time:this.store.isFirstTime,device_id:this.store.getDeviceId(),anonymous_id:this.store.getAnonymousId(),account_id:this.store.getAccountId(),properties:c(c(c({},this.presetProps),ct()),et(Te))}},o.prototype.clearPageRegister=function(t){var e=this;void 0===t&&(t=!0),!0===t?this.presetProps={}:b(t)&&t.forEach((function(t){t in e.presetProps&&delete e.presetProps[t]}))},o.prototype.checkReportProperties=function(t){var e=this,i=this.options.maxStringLength;Object.keys(t).forEach((function(r){var n=t[r];if(S(n)&&n.length>i)e.log("属性 ".concat(r," 已经做截取")),t[r]=n.slice(0,i);else if(y(n))e.checkReportProperties(n);else if(k(n))try{t[r]=n(t),k(t[r])?(e.log("属性--".concat(r," 格式不满足要求, 已被删除")),delete t[r]):y(t[r])?e.checkReportProperties(t[r]):S(t[r])&&t[r].length>i&&(t[r]=t[r].slice(0,i))}catch(i){e.log("属性--".concat(r," 格式不满足要求, 已被删除")),delete t[r]}}))},o.prototype.track=function(t,e,r){if(r=r||function(){},S(t)){e=y(e)?e:{};var n=this.getReportData("track",t,e);this.report(n,r)}else this.log("track事件名必须是字符串,属性必须是是一个对象",i.WARN)},o.prototype.quick=function(t,e,i){var r={};i=k(i)?i:T,y(e)?r=e:k(e)&&(i=e),this.autoTrack(r,i)},o.prototype.autoTrack=function(t,e){void 0===t&&(t={}),void 0===e&&(e=T);var i=this.getReportData("track","H_pageview",t);if(this.report(i,e),this.store.isSetFirstVisit){this.store.isSetFirstVisit=!1;var r=q();this.userSetOnce({H_first_referrer:r,H_first_referrer_host:r?B(r,"取值异常"):"",H_first_traffic_source_type:lt.getSourceFromReferrer(),H_first_search_keyword:lt.getKeywordFromReferrer(),H_first_visit_time:P(),H_first_browser_language:S(navigator.language)?navigator.language.toLowerCase():"取值异常"})}},o.prototype.report=function(t,e,r){var n,o,a=this.options,s=a.appJsBridge,c=a.serverUrl;if(this.log(t),s){var u=!0,l=null===window||void 0===window?void 0:window.Hina_Cloud_H5_Bridge;if(y(l)&&l.track)u=!1,l.track(t.event,t.type,JSON.stringify(t));else{var p=null===(o=null===(n=null===window||void 0===window?void 0:window.webkit)||void 0===n?void 0:n.messageHandlers)||void 0===o?void 0:o.hinaNativeTracker;if(null==p?void 0:p.postMessage){u=!1;var d=JSON.stringify({eventName:t.event,eventType:t.type,properties:t});p.postMessage(d)}}if(u)return void this.log("JSBridge 发送数据失败",i.WARN);k(e)&&e(c,t)}else this.sendReportData(t,e,r)},o.prototype.getReportData=function(t,e,i){var r=this.store.getAnonymousId(),n=this.store.getAccountId(),o=P(),a=this.getReportProperties(t,e),s=c(c({},a),i||{});this.checkReportProperties(s);var u={anonymous_id:r,type:t,event:e,time:o,_track_id:M(),properties:s};return n&&(u.account_id=n),u.send_time=P(),u},o.prototype.getReportProperties=function(t,e){void 0===t&&(t=""),void 0===e&&(e="");var i=L(this.presetProps),r=c(c({device_id:this.store.getDeviceId()},this.store.state.props),i);return t&&"user"===t.slice(0,4)||(r=c(c(c({},r),ct()),et(Te))),"track"===t&&(r.H_is_first_day=this.store.isFirstDay,this.store.isFirstDay=!1,"H_pageview"===e&&(r.H_is_first_time=this.store.isFirstTime,this.store.isFirstTime=!1)),r},o}(St);var Ae=function(t){return new Ce(t,!1)}({});export{i as ConsoleTypes,o as ErrorTypes,Ce as HinaTrack,a as PerformanceFeat,n as PlatformTypes,d as PluginBase,r as ReportTypes,s as VariablesTypes,Ae as default};
|
package/dist/hina.esm.js
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
import{WebClient as t}from"hina-cloud-core";import{ReportTypes as e,ConsoleTypes as r,PluginBase as i,VariablesTypes as o,PlatformTypes as n}from"hina-cloud-types";export*from"hina-cloud-types";import{isFunction as a,getPageXYInfo as s,isObject as c,merge as l,isArray as u,getElementParents as p,isElement as h,isString as f,getElementProperties as g,nowStamp as d,getScrollTop as v,generatorTrackId as m,ListenPageState as y,mitt as _,safeJSONParse as k,formatDecimal as T,getURL as b,isBoolean as w,handleDecodeURLComponent as x,handleEncodeURLComponent as A,supportHistory as R,replaceOld as C,getPlatform as P,getQueryParam as S,isNumber as L,noop as H,isValid as N,isEmptyObject as I,AjaxRequest as E,State as D,BatchSend as U,getCurrentDomain as O,isReferralTraffic as B,getReferrer as W,SearchKeyword as F,getUmtsParams as j,utmTypes as M,getCustomUmtsParams as z,getPageProperties as V,getBrowserInfo as J,getHostname as K}from"hina-cloud-utils";import{Monitor as Z}from"hina-cloud-monitor";var G=function(t,e){return G=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},G(t,e)};function q(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}G(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var $=function(){return $=Object.assign||function(t){for(var e,r=1,i=arguments.length;r<i;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},$.apply(this,arguments)};function X(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],i=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Q(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var i,o,n=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(i=n.next()).done;)a.push(i.value)}catch(t){o={error:t}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return a}function Y(t,e,r){if(r||2===arguments.length)for(var i,o=0,n=e.length;o<n;o++)!i&&o in e||(i||(i=Array.prototype.slice.call(e,0,o)),i[o]=e[o]);return t.concat(i||Array.prototype.slice.call(e))}"function"==typeof SuppressedError&&SuppressedError;var tt=["mark","/mark","strong","b","em","i","u","abbr","ins","del","s","sup"],et=["a","input","button","textarea"],rt=["abtestExperimentId","paramName","valueType","defaultValue","callback","timeoutMilliseconds","customProperties","customIds"],it=function(t){function e(e,r){var i=t.call(this,e,r)||this;return i.options=e,i.context=r,i.name="ClickTrackPlugin",i.isReady=!1,i.isTrackList={a:!0,button:!0},i}return q(e,t),e.prototype.init=function(t){var e=this,i=this.options.autoTrackConfig,o=i.clickAutoTrack,n=i.isCollectUrl,u=i.isCollectElement,p=i.addCustomProperty;!0===o&&(this.isReady?this.context.log("ClickTrack plugin:插件已经运行,无需重复执行",r.WARN):(this.isReady=!0,document.addEventListener("click",(function(r){if(n()){var i=r||window.event;if(i){var o=i.target||i.srcElement,h=e.getTargetElement(o);if(h){if(a(u)&&!u(h))return!1;var f=e.getClickElementInfo(h),g=s(i,h),d=g.H_page_x,v=g.H_page_y;if(f.H_page_x=d,f.H_page_y=v,a(p)){var m=p(h);c(m)&&(f=l(f,m))}t(f)}}}}),!0)))},e.prototype.transform=function(t){return this.context.getReportData("track","H_WebClick",t)},e.prototype.hasAttribute=function(t,e){var r;return t.hasAttribute?t.hasAttribute(e):t.attributes?!!(null===(r=t.attributes[e])||void 0===r?void 0:r.value):void 0},e.prototype.hasAttributes=function(t,e){if(u(e))for(var r=0;r<e.length;r++)if(this.hasAttribute(t,e[r]))return!0;return!1},e.prototype.hasElement=function(t){var e,r,i,o=p(t),n=this.options.autoTrackConfig.trackAttr||[];if(u(o)&&o.length>0)try{for(var a=X(o),s=a.next();!s.done;s=a.next()){var c=s.value,l=c.tagName&&(null===(i=c.tagName)||void 0===i?void 0:i.toLowerCase());if(h(c)&&(this.isTrackList[l]||this.hasAttributes(c,n)))return c}}catch(t){e={error:t}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(e)throw e.error}}},e.prototype.getDivMaxLevel=function(){var t;return(null===(t=this.options.autoTrackConfig.collectTags.div)||void 0===t?void 0:t.maxLevel)||1},e.prototype.isStyleTag=function(t){var e,r=(null===(e=this.options.autoTrackConfig.collectTags.div)||void 0===e?void 0:e.ignoreTags)||[];return null==r?void 0:r.includes(t)},e.prototype.getCollectableParent=function(t){var e;try{var i=t.parentNode,o=i?null===(e=i.tagName)||void 0===e?void 0:e.toLowerCase():"";if("body"===o)return!1;var n=this.getDivMaxLevel();if("div"===o&&(n>1||this.isCollectableDiv(i)))return i;if(i&&this.isStyleTag(o))return this.getCollectableParent(i)}catch(t){this.context.log(t,r.ERROR)}return!1},e.prototype.isCollectableDiv=function(t){var e;try{var i=t.children||[];if(0===i.length)return!0;for(var o=0;o<i.length;o++){var n=i[o];if(h(n)){var a=null===(e=n.tagName)||void 0===e?void 0:e.toLowerCase(),s=this.getDivMaxLevel();if(!("div"===a&&s>1||this.isStyleTag(a)))return!1;if(!this.isCollectableDiv(n))return!1}}return!0}catch(t){this.context.log(t,r.ERROR)}return!1},e.prototype.isDivLevelValid=function(t){for(var e=this.getDivMaxLevel(),r=t.getElementsByTagName("div"),i=r.length-1;i>=0;i--)if(this.getDivLevels(r[i],t)>e)return!1;return!0},e.prototype.getElementPath=function(t,e,r){for(var i,o,n=[];h(t)&&t.parentNode;){if(t.id&&!e&&/^[A-Za-z][-A-Za-z0-9_:.]*$/.test(t.id)){var a=t.tagName||"";n.unshift("".concat(a.toLowerCase(),"#").concat(t.id));break}if(r&&t===r){n.unshift(null===(i=t.tagName)||void 0===i?void 0:i.toLowerCase());break}if(t===document.body){n.unshift("body");break}n.unshift(null===(o=t.tagName)||void 0===o?void 0:o.toLowerCase()),t=t.parentNode}return n.join(" > ")},e.prototype.getDivLevels=function(t,e){var r=this.getElementPath(t,!0,e).split(" > "),i=0;return r.forEach((function(t){"div"===t&&i++})),i},e.prototype.getTargetElement=function(t){var e;if(!h(t))return null;var r=null===(e=t.tagName)||void 0===e?void 0:e.toLowerCase();if(!f(r))return null;if(["body","html"].includes(r))return null;if(this.context.trackTags.includes(r)&&"div"!==r)return t;if("div"===r&&this.options.autoTrackConfig.collectTags.div&&(this.isDivLevelValid(t)&&(this.getDivMaxLevel()>1||this.isCollectableDiv(t))))return t;if(this.options.autoTrackConfig.collectTags.div&&this.isStyleTag(r)){var i=this.getCollectableParent(t);if(i&&this.isDivLevelValid(i))return i}return this.hasElement(t)||null},e.prototype.getClickElementInfo=function(t){var e=this.options.autoTrackConfig.isCollectInput,r=!1;a(e)&&(r=e(t));var i=this.getDomSelector(t),o=g(t,r);return o.H_element_selector=i,o.H_element_path=this.getElementPath(t,!1),o},e.prototype.getDomSelector=function(t){for(var e,r=[];t;){if("body"===(null===(e=t.tagName)||void 0===e?void 0:e.toLowerCase())||!h(t)){r.unshift("body");break}if(r.unshift(this.getSelector(t)),(null==t?void 0:t.getAttribute("id"))&&/^[A-Za-z][-A-Za-z0-9_:.]*$/.test(t.getAttribute("id")))break;t=t.parentNode}return r.join(" > ")},e.prototype.getSelector=function(t){var e,r,i=null===(e=t.tagName)||void 0===e?void 0:e.toLowerCase(),o=-1;9!==(null===(r=t.parentNode)||void 0===r?void 0:r.nodeType)&&(o=this.getDomIndex(t));var n=t.getAttribute("id");return n&&/^[A-Za-z][-A-Za-z0-9_:.]*$/.test(n)?"#".concat(n):i+(o>-1?":nth-of-type(".concat(o+1,")"):"")},e.prototype.getDomIndex=function(t){var e,r;if(t.parentNode)for(var i=0,o=null===(e=t.tagName)||void 0===e?void 0:e.toLowerCase(),n=t.parentNode.children,a=0;a<n.length;a++){var s=n[a];if((null===(r=s.tagName)||void 0===r?void 0:r.toLowerCase())===o){if(s===t)return i;i++}}return-1},e}(i),ot=function(t){function e(e,r){var i=t.call(this,e,r)||this;return i.options=e,i.context=r,i.name="StayTrackPlugin",i.isReady=!1,i.timer=null,i.previousTime=d(),i.previousOffsetTop=0,i}return q(e,t),e.prototype.init=function(t){var e=this,i=this.options,o=i.autoTrackConfig,n=i.stayAutoTrackConfig;if(!0===o.stayAutoTrack)if(this.isReady)this.context.log("StayTrack plugin:插件已经运行,无需重复执行",r.WARN);else{this.isReady=!0;var s=n.isCollectUrl;a(s)||(s=function(){return!0}),this.timer&&(clearTimeout(this.timer),this.timer=null),this.previousTime=d(),window.addEventListener("load",(function(){e.previousOffsetTop=v()})),window.addEventListener("scroll",(function(){s()&&(e.timer||(e.timer=setTimeout((function(){e.run(t),clearTimeout(e.timer),e.timer=null}),1e3)))})),window.addEventListener("unload",(function(){s()&&e.run(t,!0)}))}},e.prototype.transform=function(t){return this.context.getReportData("track","H_WebStay",t)},e.prototype.run=function(t,e){void 0===e&&(e=!1);var r=this.options.autoTrackConfig,i=r.stayDelayTime,o=r.maxStayPageDuration,n=v(),a=d(),s=a-this.previousTime;(e||s>i&&n!==this.previousOffsetTop)&&t({H_viewport_position:this.previousOffsetTop,event_duration:Math.min(s/1e3,o)});this.previousTime=a,this.previousOffsetTop=n},e}(i),nt=function(t){function e(e,r){var i=t.call(this,e,r)||this;return i.options=e,i.context=r,i.name="PageLeave",i.isReady=!1,i.pageId=m(),i.storageName="hinasdk_pageleave_",i.heartbeatIntervalTime=5e3,i.maxDuration=432e3,i.heartbeatIntervalTimer=null,i.startTime=d(),i.url=window.location.href,i.pageShowStatus=!0,i}return q(e,t),e.prototype.init=function(){if(this.options.autoTrackConfig.pageLeaveAutoTrack)if(this.context.store.localStorage)if(this.isReady)this.context.log("PageLeave plugin:插件已经运行,无需重复执行",r.WARN);else{this.isReady=!0;var t=this.normalizePageLeaveAutoTrack(),e=t.heartbeat_interval_time,i=t.max_duration;e&&e>0&&(this.heartbeatIntervalTime=1e3*e),i&&i>0&&(this.maxDuration=Number(i)),this.startTime=d(),this.addPageLeaveEventListener(),document.hidden?this.pageShowStatus=!1:this.startHeartBeatInterval()}else this.context.log("PageLeave plugin需要使用localstorage存储数据,但是您的浏览器不支持localstorage,所以不能使用该功能",r.WARN)},e.prototype.transform=function(){},e.prototype.normalizePageLeaveAutoTrack=function(){var t=this.options.autoTrackConfig.pageLeaveAutoTrack;return c(t)?t:{}},e.prototype.addPageLeaveEventListener=function(){this.addPageStartListener(),this.addPageSwitchListener(),this.addSinglePageListener(),this.addPageEndListener()},e.prototype.addPageStartListener=function(){var t=this;"onpageshow"in window&&window.addEventListener("pageshow",(function(){t.pageStartHandler()}))},e.prototype.addPageSwitchListener=function(){var t=this;new y({visible:function(){t.pageStartHandler(),t.startHeartBeatInterval()},hidden:function(){t.url=window.location.href,t.pageEndHandler(),t.stopHeartBeatInterval()}})},e.prototype.addSinglePageListener=function(){var t=this;_.on("urlChange",(function(e){var r=e.fromHref;r!==e.toHref&&(t.url=r,t.pageEndHandler(),t.stopHeartBeatInterval(),t.pageStartHandler(),t.startHeartBeatInterval())}))},e.prototype.addPageEndListener=function(){var t=this,e=["pagehide","beforeunload","unload"];e.forEach((function(r){"on".concat(e)in window&&window.addEventListener(r,(function(){t.pageEndHandler(),t.stopHeartBeatInterval()}))}))},e.prototype.pageStartHandler=function(){this.startTime=d(),this.pageShowStatus=!document.hidden,this.url=window.location.href},e.prototype.pageEndHandler=function(){if(this.pageShowStatus){if(this.pageShowStatus=!1,this.isCollectUrl()){var t=this.getPageLeaveProperties(),e=this.context.getReportData("track","H_WebPageLeave",t);this.context.report(e)}this.delHeartBeatData()}},e.prototype.startHeartBeatInterval=function(){var t=this;this.heartbeatIntervalTimer&&this.stopHeartBeatInterval(),this.isCollectUrl()&&(this.heartbeatIntervalTimer=setInterval((function(){t.saveHeartBeatData()}),this.heartbeatIntervalTime),this.saveHeartBeatData("first_heartbeat")),this.reissueHeartBeatData()},e.prototype.reissueHeartBeatData=function(){for(var t=this.context.store.localStorage,e=t.length(),r=0;r<e;r++){var i=t.key(r);if(i&&i!==this.storageName+this.pageId&&i.includes(this.storageName)){var o=t.get(i),n=k(o);c(n)&&d()-n.time>n.heartbeat_interval_time+5e3&&(delete n.heartbeat_interval_time,this.context.report(n)),this.delHeartBeatData(i)}}},e.prototype.stopHeartBeatInterval=function(){this.heartbeatIntervalTimer&&(clearInterval(this.heartbeatIntervalTimer),this.heartbeatIntervalTimer=null)},e.prototype.delHeartBeatData=function(t){this.context.store.localStorage.remove(t||this.storageName+this.pageId)},e.prototype.isCollectUrl=function(){var t=this.normalizePageLeaveAutoTrack().isCollectUrl;return!a(t)||t(this.url)},e.prototype.saveHeartBeatData=function(t){var e=this.getPageLeaveProperties();e.H_time=d(),"first_heartbeat"===t&&(e.event_duration=3);var r=this.context.getReportData("track","H_WebPageLeave",e);r.heartbeat_interval_time=this.heartbeatIntervalTime,this.context.store.localStorage.set(this.storageName+this.pageId,JSON.stringify(r))},e.prototype.getPageLeaveProperties=function(){var t=(d()-this.startTime)/1e3;t=t<=0||t>this.maxDuration?0:T(t,3);var e=b(this.url),r=e.pathname,i=e.hash,o={H_url:this.url,H_url_path:r,H_url_hash:i};t&&(o.event_duration=t);var n=this.normalizePageLeaveAutoTrack().custom_props;return c(n)&&(o=$($({},o),n||{})),o},e}(i),at=function(t){function e(e,r){var i=t.call(this,e,r)||this;return i.options=e,i.context=r,i.name="SiteLinker",i.isReady=!1,i.linker=[],i}return q(e,t),e.prototype.init=function(){if(this.options.siteLinkerConfig){var t=this.getLinkerConfig().linker;u(t)&&t.length>0?this.isReady?this.context.log("SiteLinker plugin:插件已经运行,无需重复执行",r.WARN):(this.isReady=!0,this.resolveOption(),this.setRefferId(),this.addClickListen()):this.context.log("siteLinker plugin: 请配置正确的linker参数",r.WARN)}},e.prototype.transform=function(){},e.prototype.getLinkerConfig=function(){var t=this.options.siteLinkerConfig||{},e=t.linker;return{linker:(void 0===e?[]:e)||[],re_login:t.re_login}},e.prototype.resolveOption=function(){for(var t=this.getLinkerConfig().linker,e=t.length,i=[],o=0;o<e;o++){var n=t[o],a=n.part_url,s=n.after_hash;/[A-Za-z0-9]+\./.test(a)&&w(s)?i.push({part_url:a,after_hash:s}):this.context.log("The configuration of linker ".concat(o+1," is not supported.Please check format"),r.WARN)}this.linker=i},e.prototype.setRefferId=function(){var t=this.getLinkerConfig().re_login,e=this.getUrlId(),r=e.startsWith("a");if(""!==(e=e.substring(1))){var i=this.context.store.getAnonymousId(),o=this.context.store.getAccountId();if(r){if(e!==i&&(this.context.store.state.anonymousId=e,this.context.store.save()),o){var n=this.context.getReportData("track_signup","H_SignUp",{});this.context.report(n)}}else(!o||t&&o!==e)&&this.context.setUserUId(e)}},e.prototype.getUrlId=function(){var t=window.location.href.match(/_hnsdk=([au][^\?\#\&\=]+)/);return u(t)&&t[1]?x(t[1]):""},e.prototype.getPartUrl=function(t){for(var e=this.linker.length,r=0;r<e;r++)if(t.includes(this.linker[r].part_url))return!0;return!1},e.prototype.getPartHash=function(t){for(var e=this.linker.length,r=0;r<e;r++)if(t.includes(this.linker[r].part_url))return this.linker[r].after_hash;return!1},e.prototype.getCurrentId=function(){var t=this.context.store.getAccountId(),e=this.context.store.getAnonymousId(),r=t?"u".concat(t):"a".concat(e);return A(r)},e.prototype.rewriteUrl=function(t,e){var r=/([^?#]+)(\?[^#]*)?(#.*)?/.exec(t),i="";if(r){var o=r[1]||"",n=r[2]||"",a=r[3]||"",s="_hnsdk=".concat(this.getCurrentId()),c=function(t){var e=t.split("&"),r=[];return e.forEach((function(t){t.includes("_hnsdk")?r.push(s):r.push(t)})),r.join("&")};if(this.getPartHash(t)){var l=a.includes("?"),u=a.indexOf("_hnsdk");i=l?u>=0?"".concat(o).concat(n,"#").concat(a.substring(1,u)).concat(c(a.substring(u,a.length))):"".concat(o).concat(n,"#").concat(a.substring(1),"&").concat(s):"".concat(o).concat(n,"#").concat(a.substring(1),"?").concat(s)}else{i=(l=/^\?(\w)+/.test(n))?n.includes("_hnsdk")?"".concat(o,"?").concat(c(n.substring(1))).concat(a):"".concat(o).concat(n,"&").concat(s).concat(a):"".concat(o,"?").concat(s).concat(a)}return e&&(e.href=i),i}},e.prototype.addClickListen=function(){var t=this,e=function(e){var r,i,o=e.target;if(o){var n=null===(r=o.tagName)||void 0===r?void 0:r.toLowerCase(),a=o.parentNode,s=null===(i=null==a?void 0:a.tagName)||void 0===i?void 0:i.toLowerCase();if("a"===n&&o.href||"a"===s&&a.href){var c=void 0,l=void 0;"a"===n&&o.href?(c=o.href,l=o):(c=a.href,l=a);var u=b(c).protocol;"http:"!==u&&"https:"!==u||t.getPartUrl(c)&&t.rewriteUrl(c,l)}}};"PointerEvent"in window?document.addEventListener("pointerdown",e):document.addEventListener("mousedown",e)},e}(i),st=function(t){function e(e,r){var i=t.call(this,e,r)||this;return i.options=e,i.context=r,i.name="HistoryPlugin",i.isReady=!1,i.lastHref=window.location.href,i.lastPath=window.location.pathname,i}return q(e,t),e.prototype.init=function(){if(R())if(this.isReady)this.context.log("History plugin:插件已经运行,无需重复执行",r.WARN);else{this.isReady=!0;var t=this,e=window.onpopstate,i=function(e,r){var i={fromPath:t.lastPath,fromHref:t.lastHref,toPath:e,toHref:r};t.lastPath=e,t.lastHref=r,_.emit("urlChange",$($({},i),{mode:"history"}))};window.onpopstate=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var o=window.location.pathname,n=window.location.href;i(o,n),e&&e.apply(this,t)},C(window.history,"pushState",o),C(window.history,"replaceState",o)}function o(t){return function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];t.apply(this,e);var o=window.location.pathname,n=window.location.href;i(o,n)}}},e.prototype.transform=function(){},e}(i),ct=function(t){function e(e,r){var i=t.call(this,e,r)||this;return i.options=e,i.context=r,i.name="HashPlugin",i.isReady=!1,i.lastHref=window.location.href,i.lastPath=window.location.hash,i}return q(e,t),e.prototype.init=function(){var t=this;this.isReady?this.context.log("Hash plugin:插件已经运行,无需重复执行",r.WARN):(this.isReady=!0,window.addEventListener("hashchange",(function(e){var r=e.newURL,i=b(r).hash,o={fromPath:t.lastPath,fromHref:t.lastHref,toPath:i,toHref:r};t.lastHref=r,t.lastPath=i,_.emit("urlChange",$($({},o),{mode:"hash"}))})))},e.prototype.transform=function(){},e}(i),lt="4.0.0",ut=function(t){function e(e,r){var i=t.call(this,e,r)||this;return i.options=e,i.context=r,i.name="HinaABTest",i.isReady=!1,i.platform=P(),i.projectKey="",i.storageName="hina_webjs_sdk_abtest",i}return q(e,t),e.prototype.init=function(){var t=this;if(this.context.store.localStorage){var e=this.options.abTestingPluginConfig,i=null==e?void 0:e.url;if(f(i)){var o=S(i,"project-key");if(o){this.projectKey=o;var n=b(i).protocol,a=b(window.location.href).protocol;if(n&&n!==a)this.context.log("A/B Testing 初始化失败,".concat(a," 页面必须使用 ").concat(a," 的 URL"),r.WARN);else if(this.isReady)this.context.log("A/B Testing 插件已经运行,无需重复执行",r.WARN);else{var s=this.context.getUserUid();this.context.log("当前accountId为:".concat(s),r.INFO),_.on("changeAccountId",(function(){t.context.store.localStorage.set(t.storageName,"")})),this.isReady=!0}}else this.context.log("A/B Testing 初始化失败,请使用正确的 URL(必须包含 project-key)")}else this.context.log("A/B Testing 初始化失败,请使用正确的 URL!",r.WARN)}else this.context.log("A/B Testing 初始化失败,浏览器不支持localStorage",r.WARN)},e.prototype.transform=function(){},e.prototype.valueMatchType=function(t,e){switch(e){case o.INTEGER:return L(t);case o.STRING:return f(t);case o.BOOLEAN:return w(t);default:return!1}},e.prototype.normalizeParams=function(t,e,i){var n,s;void 0===i&&(i=rt);var l={verify_success:!0,para:e};try{for(var u=X(i),p=u.next();!p.done;p=u.next()){var h=p.value;if(!l.verify_success)break;var g=e.customIds||{},d={};switch(h){case"abtestExperimentId":f(e.abtestExperimentId)&&e.abtestExperimentId.trim()||(this.context.log("".concat(t,"方法调用失败,").concat(h,"参数未正确配置!").concat(h,": ").concat(e.abtestExperimentId),r.WARN),l.verify_success=!1);break;case"paramName":f(e.paramName)&&e.paramName.trim()||(this.context.log("".concat(t,"方法调用失败,").concat(h,"参数未正确配置!").concat(h,": ").concat(e.paramName),r.WARN),l.verify_success=!1);break;case"valueType":[o.BOOLEAN,o.INTEGER,o.STRING].includes(e.valueType)||(this.context.log("".concat(t,"方法调用失败,").concat(h,"参数未正确配置!").concat(h,": ").concat(e.valueType),r.WARN),l.verify_success=!1);break;case"defaultValue":this.valueMatchType(e.defaultValue,e.valueType)||(this.context.log("".concat(t,"方法调用失败,").concat(h,"类型必须与valueType一致!"),r.WARN),l.verify_success=!1);break;case"callback":a(e.callback)||(this.context.log("".concat(t,"方法调用失败,").concat(h,"参数未正确配置")),e.callback=H,l.verify_success=!1);break;case"timeoutMilliseconds":(!L(e.timeoutMilliseconds)||e.timeoutMilliseconds<=0)&&(this.context.log("".concat(h,"参数错误:").concat(e.timeoutMilliseconds),r.WARN),e.timeoutMilliseconds=3e3),e.timeoutMilliseconds<200&&(e.timeoutMilliseconds=200);break;case"customProperties":e.customProperties=c(e.customProperties)?e.customProperties:{};break;case"customIds":for(var v in g)(f(g[v])||L(g[v]))&&(d[v]=g[v]);e.customIds=d}}}catch(t){n={error:t}}finally{try{p&&!p.done&&(s=u.return)&&s.call(u)}finally{if(n)throw n.error}}return l},e.prototype.sendTriggerEvent=function(t){var e=t.abtest_experiment_group_id,r=t.abtest_experiment_id;this.context.track("H_ABTestTrigger",{H_abtest_experiment_id:r,H_abtest_experiment_group_id:e})},e.prototype.getExpResult=function(t,e){var r,i;void 0===e&&(e=[]);var o,n=t.abtestExperimentId,a=t.paramName,s=t.valueType;if(0===e.length){var l=this.getStorageData();c(l)&&(e=l.result||[])}try{for(var u=X(e),p=u.next();!p.done;p=u.next()){var h=p.value,f=h.abtest_experiment_id,g=h.abtest_experiment_group_id,d=h.is_white_list,v=h.variables;if(f===n){var m=v.find((function(t){return t.name===a&&t.type===s}));if(m){d||this.sendTriggerEvent({abtest_experiment_id:f,abtest_experiment_group_id:g}),o=m.value;break}}}}catch(t){r={error:t}}finally{try{p&&!p.done&&(i=u.return)&&i.call(u)}finally{if(r)throw r.error}}return o},e.prototype.getStorageData=function(){var t=this.context.store.localStorage.get(this.storageName);return N(t)?k(t):null},e.prototype.saveResponseData=function(t){var e=this.getStorageData(),r={updateTime:d()};if(e&&c(e)){var i=[],o=e.result||[];t.forEach((function(t){var e=t.abtest_experiment_group_id,r=t.abtest_experiment_id,n=t.variables,a=o.find((function(t){return t.abtest_experiment_id===r&&t.abtest_experiment_group_id===e}));if(a){var s=[];n.forEach((function(t){var e=t.name,r=t.type,i=a.variables.findIndex((function(t){return t.name===e&&t.type===r}));i>=0?a.variables[i]=t:s.push(t)})),a.variables=Y(Y([],Q(a.variables),!1),Q(s),!1)}else i.push(t)})),r.result=Y(Y([],Q(o),!1),Q(i),!1)}else r.result=t;this.context.store.localStorage.set(this.storageName,JSON.stringify(r))},e.prototype.createRequestData=function(t){var e=t.paramName,r=t.customProperties,i=t.customIds,o={anonymous_id:this.context.store.getAnonymousId(),platform:this.platform,abtest_lib_version:lt,param_name:e,properties:this.context.getPresetProperties()};return c(r)&&!I(r)&&(o.custom_properties=r),c(i)&&!I(i)&&(o.custom_ids=i),this.context.getUserUid()&&(o.login_id=this.context.getUserUid()),o},e.prototype.getResultFromServer=function(t){var e=this;return new Promise((function(r,i){var o=e.createRequestData(t);new E({url:e.options.abTestingPluginConfig.url,data:JSON.stringify(o),contentType:"application/json",customHeaders:{"project-key":e.projectKey},timeout:t.timeoutMilliseconds}).run().then((function(t){var o=t.data;"SUCCESS"===(null==o?void 0:o.status)?(e.saveResponseData(o.results),r(o)):i()}))}))},e.prototype.asyncFetch=function(t){var e=this;return new Promise((function(r){e.getResultFromServer(t).then((function(t){r(t)})).catch((function(){t.callback(t.defaultValue)}))}))},e.prototype.preFetch=function(t,e){return this.isReady?!!c(e)||(this.context.log("".concat(t," 方法参数必须是对象"),r.WARN),!1):(this.context.log("A/B Testing 插件尚未运行,请先执行该插件",r.WARN),!1)},e.prototype.asyncFetchABTest=function(t){var e=this;if(this.preFetch("asyncFetchABTest",t)){var r=this.normalizeParams("asyncFetchABTest",t),i=r.verify_success,o=r.para;i?this.asyncFetch(o).then((function(t){var r=e.getExpResult(o,t.results);o.callback(r||o.defaultValue)})):o.callback(o.defaultValue)}},e.prototype.fetchCacheABTest=function(t){if(this.preFetch("fetchCacheABTest",t)){var e=this.normalizeParams("fetchCacheABTest",t),r=e.verify_success,i=e.para;if(r){var o=this.getExpResult(i);i.callback(o||i.defaultValue)}else i.callback(i.defaultValue)}},e.prototype.fastFetchABTest=function(t){var e=this;if(this.preFetch("fastFetchABTest",t)){var r=this.normalizeParams("fastFetchABTest",t),i=r.verify_success,o=r.para;if(i){var n=this.getExpResult(o);N(n)?o.callback(n):this.asyncFetch(o).then((function(){var t=e.getExpResult(o);o.callback(t||o.defaultValue)}))}else o.callback(o.defaultValue)}},e}(i),pt=function(t){function i(e,r){void 0===r&&(r=!0);var i=t.call(this,e,r)||this;return i.consolePrefix="埋点SDK",i.trackTags=et,i.presetProps={},i.useInstancing&&i.init(e),i}return q(i,t),i.prototype.init=function(t){if(this.isReady)this.log("hinaSDK has been initialized",r.ERROR);else{var i={name:"",serverUrl:"",showLog:!1,autoTrackConfig:{clickAutoTrack:!0,stayAutoTrack:!0,isCollectUrl:function(){return!0},isCollectElement:function(){return!0},isCollectInput:function(){return!1},addCustomProperty:function(){},stayDelayTime:4e3,maxStayPageDuration:18e3,collectTags:{div:!1},trackAttr:["hn-click"],pageviewAutoTrack:!1,pageLeaveAutoTrack:!1},stayAutoTrackConfig:{isCollectUrl:function(){return!0}},maxStringLength:1024,imgUseCrossOrigin:!1,isSinglePage:!1,batchSend:!1,appJsBridge:!1,sendType:e.BEACON,customHeaders:{},credentials:!1,dataSendTimeout:3e3,presetProperties:{latest_utm:!0,latest_traffic_source_type:!0,latest_search_keyword:!0,latest_referrer:!0,url:!0,title:!0},sourceChannel:[],plugins:[]},o=t.performanceErrorConfig,n=function(t,e){var r={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(r[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(i=Object.getOwnPropertySymbols(t);o<i.length;o++)e.indexOf(i[o])<0&&Object.prototype.propertyIsEnumerable.call(t,i[o])&&(r[i[o]]=t[i[o]])}return r}(t,["performanceErrorConfig"]);this.options=l(i,n),this.options=$($({},this.options),{performanceErrorConfig:o}),this.initState(),this.normalizeConfig(),this.initAdvProps(),this.initPlugins(),this.isReady=!0}},i.prototype.initState=function(){this.store=new D(this.options),this.store.init()},i.prototype.normalizeConfig=function(){var t=this,i=this.options,o=i.serverUrl,s=i.sendType,l=i.batchSend,p=i.maxStringLength,h=i.isSinglePage,g=i.autoTrackConfig,d=void 0===g?{}:g,v=d.trackAttr,m=void 0===v?[]:v,y=d.collectTags,k=d.pageLeaveAutoTrack,T=d.pageviewAutoTrack;if(""===(o=(o=o||"").trim()))this.log("当前 serverUrl 为空,network 中不会发数据,请配置正确的 serverUrl!",r.WARN);else{var w=window.location.href,x=b(w).protocol||"";(b(o).protocol||"")!==x&&this.log("SDK 检测到您的数据发送地址和当前页面地址的协议不一致,建议您修改成一致的协议。因为:https 下面发送 http 的图片请求会失败。",r.WARN)}[e.IMAGE,e.AJAX,e.BEACON].includes(s)||this.setConfig({sendType:e.AJAX});var A=p;if(!L(p)||p<0?A=1024:p>5120&&(A=5120),this.options.maxStringLength=A,(!0===k||c(k)&&I(k))&&(this.options.autoTrackConfig.pageLeaveAutoTrack={heartbeat_interval_time:5e3,max_duration:432e3}),u(m)?(m=m.filter((function(t){return f(t)}))).includes("hn-click")||m.push("hn-click"):m=["hn-click"],this.options.autoTrackConfig.trackAttr=m,c(y))if(!0===y.div)this.options.autoTrackConfig.collectTags.div={ignoreTags:tt,maxLevel:1};else if(c(y.div)){var R=1,C=y.div;L(C.maxLevel)&&[1,2,3].includes(C.maxLevel)&&(R=C.maxLevel),this.options.autoTrackConfig.collectTags.div={ignoreTags:tt,maxLevel:R}}else this.options.autoTrackConfig.collectTags.div=!1;else this.options.autoTrackConfig.collectTags={div:!1};this.updateTrackTags(),(!0===l||c(l)&&!I(l))&&(this.options.batchSend=$({dataSendTimeout:6e3,sendInterval:6e3,storageLimit:200},l),this.batchSender=new U(this.options,n.WEB,"hinasdk_tab","hinasdk_data_")),"auto"===T?this.autoTrack():("singlePage"===T||h)&&(this.autoTrack(),_.on("urlChange",(function(e){var r=e.fromHref;if(r!==e.toHref){if(a(h)){var i=h();c(i)&&(e=$($({},e),i))}t.autoTrack($($({},e),{H_referrer:r}))}})))},i.prototype.updateTrackTags=function(){var t=this.options.autoTrackConfig.collectTags,e=Y([],Q(et),!1);Object.keys(t||{}).forEach((function(r){var i=t[r];!0!==i&&!c(i)||e.includes(r)||e.push(r)})),this.trackTags=e},i.prototype.initAdvProps=function(){var t={},e=this.options,r=e.presetProperties,i=e.sourceChannel;Object.keys(r||{}).forEach((function(e){var i=r[e];if(e.includes("latest_")&&(e=e.slice(7),i)){var o=O();if("utm"!==e&&"url解析失败"===o)t["H_latest_".concat(e)]="url的domain解析失败";else if(B())switch(e){case"traffic_source_type":t.H_latest_traffic_source_type=F.getSourceFromReferrer();break;case"search_keyword":var n=F.getKeywordFromReferrer();n&&(t.H_latest_search_keyword=n);break;case"referrer":t.H_latest_referrer=W()}}}));var o=this.store.state.props||{},n={};r.latest_utm&&(n=j("H_latest_"));var a={};o.H_utm_source||(a=j("H_"));var s={},c={};if(u(i)&&i.length>0){var l=i.filter((function(t){return!M.includes(t)}));l.length>0&&(o["H_".concat(l[0])]||(c=z("H_",l)),s=z("H_latest_",l))}this.store.state.props=$($($($($($({},this.store.state.props),t),n),s),c),a),this.store.setProps(this.store.state.props)},i.prototype.initPlugins=function(){var t=this,e=this.options,r=e.serverUrl,i=e.name,o=e.showLog,n=e.sendType,a=e.customHeaders,s=e.credentials,l=e.dataSendTimeout,p=e.batchSend,h=e.imgUseCrossOrigin,f=e.globalCallback,g=e.plugins,d=void 0===g?[]:g,v=e.performanceErrorConfig,m=e.autoTrackConfig,y=e.siteLinkerConfig,_=e.abTestingPluginConfig;d=d||[];var k=m.pageLeaveAutoTrack,T=new it(this.options,this),b=new ot(this.options,this),w=new st(this.options,this),x=new ct(this.options,this);if(this.plugins=[T,b,w,x],c(k)&&!I(k)){var A=new nt(this.options,this);this.plugins.push(A)}var R=(y||{}).linker;if(u(R)&&R.length>0){var C=new at(this.options,this);this.plugins.push(C)}if(c(_)&&!I(_)){var P=new ut(this.options,this);this.plugins.push(P)}if(d.forEach((function(e){var r=new e(t.options,t);t.plugins.push(r)})),c(v)&&!I(v)){var S=$({serverUrl:r,name:i,showLog:o,sendType:n,customHeaders:a,credentials:s,dataSendTimeout:l,batchSend:p,imgUseCrossOrigin:h,globalCallback:f},v);this.epmInstance=new Z(S,!0)}this.runPlugins(this.plugins)},i.prototype.use=function(t,e){var i=this,o=this.options,n=o.autoTrackConfig,a=o.siteLinkerConfig,s=o.abTestingPluginConfig,l=n.pageLeaveAutoTrack,u=function(t){var e=new t(i.options,i);i.plugins.push(e),e.init()};if(this.isReady){if(c(e))return"PageLeave"===t?c(l)&&!I(l)?this.log("PageLeave插件已运行,无需重复执行",r.WARN):(this.options.autoTrackConfig.pageLeaveAutoTrack=e,u(nt)):"SiteLinker"===t?c(a)&&!I(a)?this.log("SiteLinker插件已插件已运行,无需重复执行",r.WARN):(this.options.siteLinkerConfig=e,u(at)):"HinaABTest"===t&&(c(s)&&!I(s)?this.log("HinaABTest插件已运行,无需重复执行",r.WARN):(this.options.abTestingPluginConfig=e,u(ut))),this.getPluginInstance(t);this.log("".concat(t,"插件配置项必须是一个对象类型"),r.WARN)}else this.log("请先初始化埋点SDK",r.WARN)},i.prototype.getPluginInstance=function(t){return this.plugins.find((function(e){return e.name===t}))},i.prototype.setConfig=function(t){this.options=l(this.options,t),this.normalizeConfig()},i.prototype.getConfig=function(t){return t?this.options[t]:this.options},i.prototype.setUserUId=function(t,e){if(L(t=null!=t?t:"")||f(t))if(t=String(t).trim(),this.store.getAccountId()!==t){this.store.setAccountId(t);var i=this.getReportData("track_signup","H_SignUp",{});this.report(i,e),_.emit("changeAccountId")}else this.log("setUserUId: uid is equal to account_id, , failed to execute setUserUId",r.WARN);else this.log("setUserUId: uid must be string or number",r.WARN)},i.prototype.getUserUid=function(){return this.store.state.accountId},i.prototype.setDeviceUId=function(t){this.store.setDeviceId(t)},i.prototype.getDeviceUId=function(){return this.store.getDeviceId()},i.prototype.userSet=function(t,e){if(c(t)&&!I(t)){var r=this.getReportData("user_set","",t);this.report(r,e)}},i.prototype.userSetOnce=function(t,e){if(c(t)&&!I(t)){var r=this.getReportData("user_setOnce","",t);this.report(r,e)}},i.prototype.userAdd=function(t,e){var i,o=this;f(t)&&((i={})[t]=1,t=i);if(c(t)&&!I(t)&&function(t){for(var e in t)if(!/-*\d+/.test(String(t[e])))return o.log("userAdd属性的值只能是数字",r.WARN),!1;return!0}(t)){var n=this.getReportData("user_add","",t);this.report(n,e)}},i.prototype.userAppend=function(t,e){var r={};if(c(t)&&(Object.keys(t).forEach((function(e){var i=t[e];u(i)?r[e]=i:r[e]=[i]})),!I(r))){var i=this.getReportData("user_append","",r);this.report(i,e)}},i.prototype.userUnset=function(t,e){var i=this,o={};if(f(t)&&(t=[t]),u(t)){if(t.forEach((function(t){f(t)?o[t]=!0:i.log("userUnset参数数组里面的值必须时string,已经过滤掉".concat(t),r.WARN)})),!I(o)){var n=this.getReportData("user_unset","",o);this.report(n,e)}}else this.log("userUnset参数必须是数组或字符串",r.WARN)},i.prototype.userDelete=function(t){var e=this.getReportData("user_delete","",{});this.report(e,t),this.store.setAccountId("")},i.prototype.registerCommonProperties=function(t){this.presetProps=l(this.presetProps,t)},i.prototype.getPresetProperties=function(){return{H_is_first_day:this.store.isFirstDay,H_is_first_time:this.store.isFirstTime,device_id:this.store.getDeviceId(),anonymous_id:this.store.getAnonymousId(),account_id:this.store.getAccountId(),properties:$($($({},this.presetProps),V()),J(lt))}},i.prototype.clearPageRegister=function(t){var e=this;void 0===t&&(t=!0),!0===t?this.presetProps={}:u(t)&&t.forEach((function(t){t in e.presetProps&&delete e.presetProps[t]}))},i.prototype.checkReportProperties=function(t){var e=this,r=this.options.maxStringLength;Object.keys(t).forEach((function(i){var o=t[i];if(f(o)&&o.length>r)e.log("属性 ".concat(i," 已经做截取")),t[i]=o.slice(0,r);else if(c(o))e.checkReportProperties(o);else if(a(o))try{t[i]=o(t),a(t[i])?(e.log("属性--".concat(i," 格式不满足要求, 已被删除")),delete t[i]):c(t[i])?e.checkReportProperties(t[i]):f(t[i])&&t[i].length>r&&(t[i]=t[i].slice(0,r))}catch(r){e.log("属性--".concat(i," 格式不满足要求, 已被删除")),delete t[i]}}))},i.prototype.track=function(t,e,i){if(i=i||function(){},f(t)){e=c(e)?e:{};var o=this.getReportData("track",t,e);this.report(o,i)}else this.log("track事件名必须是字符串,属性必须是是一个对象",r.WARN)},i.prototype.quick=function(t,e,r){var i={};r=a(r)?r:H,c(e)?i=e:a(e)&&(r=e),this.autoTrack(i,r)},i.prototype.autoTrack=function(t,e){void 0===t&&(t={}),void 0===e&&(e=H);var r=this.getReportData("track","H_pageview",t);if(this.report(r,e),this.store.isSetFirstVisit){this.store.isSetFirstVisit=!1;var i=W();this.userSetOnce({H_first_referrer:i,H_first_referrer_host:i?K(i,"取值异常"):"",H_first_traffic_source_type:F.getSourceFromReferrer(),H_first_search_keyword:F.getKeywordFromReferrer(),H_first_visit_time:d(),H_first_browser_language:f(navigator.language)?navigator.language.toLowerCase():"取值异常"})}},i.prototype.report=function(t,e,i){var o,n,s=this.options,l=s.appJsBridge,u=s.serverUrl;if(this.log(t),l){var p=!0,h=null===window||void 0===window?void 0:window.Hina_Cloud_H5_Bridge;if(c(h)&&h.track)p=!1,h.track(t.event,t.type,JSON.stringify(t));else{var f=null===(n=null===(o=null===window||void 0===window?void 0:window.webkit)||void 0===o?void 0:o.messageHandlers)||void 0===n?void 0:n.hinaNativeTracker;if(null==f?void 0:f.postMessage){p=!1;var g=JSON.stringify({eventName:t.event,eventType:t.type,properties:t});f.postMessage(g)}}if(p)return void this.log("JSBridge 发送数据失败",r.WARN);a(e)&&e(u,t)}else this.sendReportData(t,e,i)},i.prototype.getReportData=function(t,e,r){var i=this.store.getAnonymousId(),o=this.store.getAccountId(),n=d(),a=this.getReportProperties(t,e),s=$($({},a),r||{});this.checkReportProperties(s);var c={anonymous_id:i,type:t,event:e,time:n,_track_id:m(),properties:s};return o&&(c.account_id=o),c.send_time=d(),c},i.prototype.getReportProperties=function(t,e){void 0===t&&(t=""),void 0===e&&(e="");var r=l(this.presetProps),i=$($({device_id:this.store.getDeviceId()},this.store.state.props),r);return t&&"user"===t.slice(0,4)||(i=$($($({},i),V()),J(lt))),"track"===t&&(i.H_is_first_day=this.store.isFirstDay,this.store.isFirstDay=!1,"H_pageview"===e&&(i.H_is_first_time=this.store.isFirstTime,this.store.isFirstTime=!1)),i},i}(t);var ht=new pt({},!1);export{pt as HinaTrack,ht as default};
|