hina-cloud-js-sdk 3.1.8 → 4.0.1
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 +27 -37
- package/readme.md +1 -0
- package/.eslintrc.js +0 -12
- package/.gitlab-ci.yml +0 -16
- package/.vscode/settings.json +0 -5
- package/build/hina.cjs.min.js +0 -1
- package/build/hina.esm.min.js +0 -1
- package/build/hina.min.js +0 -1
- package/build/hotAnalyse.min.js +0 -1
- package/packages/core/dist/index.cjs.js +0 -64
- package/packages/core/dist/index.cjs.js.map +0 -1
- package/packages/core/dist/index.d.ts +0 -45
- package/packages/core/dist/index.esm.js +0 -62
- package/packages/core/dist/index.esm.js.map +0 -1
- package/packages/core/dist/index.global.js +0 -1199
- package/packages/core/dist/index.global.js.map +0 -1
- package/packages/core/dist/index.js +0 -1200
- package/packages/core/dist/index.js.map +0 -1
- package/packages/monitor/dist/index.cjs.js +0 -150
- package/packages/monitor/dist/index.cjs.js.map +0 -1
- package/packages/monitor/dist/index.d.ts +0 -35
- package/packages/monitor/dist/index.esm.js +0 -145
- package/packages/monitor/dist/index.esm.js.map +0 -1
- package/packages/monitor/dist/index.global.js +0 -1343
- package/packages/monitor/dist/index.global.js.map +0 -1
- package/packages/monitor/dist/index.js +0 -1344
- package/packages/monitor/dist/index.js.map +0 -1
- package/packages/track/dist/index.cjs.js +0 -1930
- package/packages/track/dist/index.cjs.js.map +0 -1
- package/packages/track/dist/index.d.ts +0 -212
- package/packages/track/dist/index.esm.js +0 -1925
- package/packages/track/dist/index.esm.js.map +0 -1
- package/packages/track/dist/index.global.js +0 -4259
- package/packages/track/dist/index.global.js.map +0 -1
- package/packages/track/dist/index.js +0 -4260
- package/packages/track/dist/index.js.map +0 -1
- package/packages/types/dist/index.d.ts +0 -603
- package/packages/types/dist/index.esm.js +0 -25
- package/packages/types/dist/index.esm.js.map +0 -1
- package/packages/utils/dist/index.cjs.js +0 -1535
- package/packages/utils/dist/index.cjs.js.map +0 -1
- package/packages/utils/dist/index.d.ts +0 -394
- package/packages/utils/dist/index.esm.js +0 -1465
- package/packages/utils/dist/index.esm.js.map +0 -1
- package/packages/utils/dist/index.global.js +0 -2507
- package/packages/utils/dist/index.global.js.map +0 -1
- package/packages/utils/dist/index.js +0 -2508
- package/packages/utils/dist/index.js.map +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/build/hina.cjs.min.js
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
var t=require("mobile-detect"),n=require("raven-js");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=i(t),a=i(n);function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,g(i.key),i)}}function u(e,t,n){return t&&c(e.prototype,t),n&&c(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function l(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return o(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?o(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,r=function(){};return{s:r,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,c=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){c=!0,a=e},f:function(){try{s||null==n.return||n.return()}finally{if(c)throw a}}}}function h(e,t,n){return(t=g(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function d(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function f(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?d(Object(n),!0).forEach((function(t){h(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):d(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function g(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function p(e){return p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},p(e)}var v=5120,m=["utm_source","utm_medium","utm_campaign","utm_content","utm_term"],y=["www.baidu.","m.baidu.","m.sm.cn","so.com","sogou.com","youdao.com","google.","yahoo.com/","bing.com/","ask.com/"],k=["weibo.com","renren.com","kaixin001.com","douban.com","qzone.qq.com","zhihu.com","tieba.baidu.com","weixin.qq.com"],b={baidu:["wd","word","kw","keyword"],google:"q",bing:"q",yahoo:"p",sogou:["query","keyword"],so:"q",sm:"q"},S="hinasdk_domain_test",T=Array.prototype.slice,w=Object.prototype.toString,C=Array.prototype.forEach,H=Object.prototype.hasOwnProperty,E=window,I=E.location,A=E.screen,x=E.localStorage,P=E.history,O=E.navigator,L=function(){return u((function e(){s(this,e)}),null,[{key:"log",value:function(){if(!this.showLog)return!1;if("object"===("undefined"==typeof console?"undefined":p(console))&&console.log)try{return console.log.apply(console,arguments)}catch(e){console.log(arguments[0])}}},{key:"error",value:function(){if("object"===("undefined"==typeof console?"undefined":p(console))&&console.error)try{return console.error.apply(console,arguments)}catch(e){console.error(arguments[0])}}}])}(),U=function(){return u((function e(){s(this,e)}),null,[{key:"checkProtocolIsSame",value:function(e,t){try{if(D.URL(e).protocol!==D.URL(t).protocol)return!1}catch(e){return L.log("The _.URL method is not supported"),!1}return!0}},{key:"checkServerUrl",value:function(){return D.check.isString(this.serverUrl)&&""!==D.trim(this.serverUrl)?(D.check.isString(this.serverUrl)&&""!==this.serverUrl&&!this.checkProtocolIsSame(this.serverUrl,I.href)&&L.log("SDK 检测到您的数据发送地址和当前页面地址的协议不一致,建议您修改成一致的协议。\n因为:1、https 下面发送 http 的图片请求会失败。2、http 页面使用 https + ajax 方式发数据,在 ie9 及以下会丢失数据。"),!0):(L.log("当前 serverUrl 为空或不正确,只在控制台打印日志,network 中不会发数据,请配置正确的 serverUrl!"),!1)}},{key:"checkAjax",value:function(e){if(e===this.serverUrl)return!1;D.check.isString(e)&&""!==e&&!this.checkProtocolIsSame(e,I.href)&&L.log("SDK 检测到您的数据发送地址和当前页面地址的协议不一致,建议您修改成一致的协议。因为 http 页面使用 https + ajax 方式发数据,在 ie9 及以下会丢失数据。")}}])}(),D={MAX_REFERRER_STRING_LENGTH:2e3};D.MAX_STRING_LENGTH=v,D.PV_LIB_VERSION="3.1.8",D.EPM_LIB_VERSION="1.0.0",D.utmTypes=m,D.searchTypes=y,D.socialTypes=k,D.searchKeywords=b,D.each=function(e,t,n){if(null!==e)if(C&&e.forEach===C)e.forEach(t,n);else if(e.length===+e.length){for(var i=0,r=e.length;i<r;i++)if(i in e&&!1===t.call(n,e[i],i,e))return}else for(var a in e)if(H.call(e,a)&&!1===t.call(n,e[a],a,e))return},D.map=function(e,t){var n=[];return null==e?n:Array.prototype.map&&e.map===Array.prototype.map?e.map(t):(D.each(e,(function(e,i,r){n.push(t(e,i,r))})),n)},D.extend=function(e){return D.each(T.call(arguments,1),(function(t){for(var n in t)void 0!==t[n]&&((D.check.isString(t[n])||D.check.isDate(t[n]))&&D.transformUTCTime(t[n])?e[n]=D.transformUTCTime(t[n]):e[n]=t[n])})),e},D.transformUTCTime=function(e){if(D.check.isDate(e)||null!=e&&e.includes("GMT")||/^\d{4}-\d{2}-\d{2}(?: |T)\d{2}:\d{2}:\d{2}\.\d{3}Z$/.test(e)){var t=new Date(e);return isNaN(t)?(L.log("Invalid date string: "+e),e):(t.setHours(t.getHours()-t.getTimezoneOffset()/60),t.toISOString().replace("T"," ").replace("Z"," ").slice(0,-5))}return!1},D.indexOf=function(e,t){var n=e.indexOf;if(n)return n.call(e,t);for(var i=0;i<e.length;i++)if(t===e[i])return i;return-1},D.trim=function(e){return e.replace(/(^[\s\uFEFF\xA0]+)|([\s\uFEFF\xA0]+$)/g,"")},D.arrayify=function(e){return Array.isArray(e)?e:[e]},D.isNil=function(e){return null==e},D.formatDate=function(e){function t(e){return e<10?"0"+e:e}return e.getFullYear()+"-"+t(e.getMonth()+1)+"-"+t(e.getDate())+" "+t(e.getHours())+":"+t(e.getMinutes())+":"+t(e.getSeconds())+"."+function(e){return e<10?"00"+e:e<100?"0"+e:e}(e.getMilliseconds())},D.formatTimeZone=function(e,t){if("number"!=typeof t)return e;var n=e.getTime(),i=6e4*e.getTimezoneOffset();return new Date(n+i+36e5*t)},D.formatJsonString=function(e){try{return JSON.stringify(e,null,8)}catch(t){return JSON.stringify(e)}},D.searchObjDate=function(e,t){(D.check.isObject(e)||D.check.isArray(e))&&D.each(e,(function(n,i){D.check.isObject(n)||D.check.isArray(n)?D.searchObjDate(e[i],t):D.check.isDate(n)&&(e[i]=D.formatDate(D.formatTimeZone(n,t)))}))},D.paramType=function(e){return Object.prototype.toString.call(e).replace("[object ","").replace("]","")},D.check={cutString:function(e,t){return D.check.isString(e)&&e.length>t?e.substring(0,t):e},isUndefined:function(e){return void 0===e},isObject:function(e){return"[object Object]"===w.call(e)&&null!==e},isEmptyObject:function(e){if(D.check.isObject(e)){for(var t in e)if(H.call(e,t))return!1;return!0}return!1},isArray:function(e){return"[object Array]"===w.call(e)},isString:function(e){return"[object String]"===w.call(e)},isDate:function(e){return"[object Date]"===w.call(e)},isNumber:function(e){return"[object Number]"===w.call(e)},isBoolean:function(e){return"[object Boolean]"===w.call(e)},isFunction:function(e){if(!e)return!1;var t=Object.prototype.toString.call(e);return"[object Function]"===t||"[object AsyncFunction]"===t},isJSONString:function(e){try{JSON.parse(e)}catch(e){return!1}return!0},isElement:function(e){return!(!e||1!==e.nodeType)}},D.checkUrlIsRegexp=function(e,t){var n;try{n=D.URL(I.href)}catch(e){return console.error("URL 解析失败",e),!1}try{return(t?new RegExp(e,t):new RegExp(e)).test(n.href)}catch(e){return console.error("创建或执行正则表达式时发生异常",e),!1}},D.UUID=function(){var e=function(){for(var e=1*new Date,t=0;e===1*new Date;)t++;return e.toString(16)+t.toString(16)};return function(){var t=String(A.height*A.width);t=t&&/\d{5,}/.test(t)?t.toString(16):String(31242*Math.random()).replace(".","").slice(0,8);var n=e()+"-"+Math.random().toString(16).replace(".","")+"-"+function(){var e,t,n=O.userAgent,i=[],r=0;function a(e,t){var n,r=0;for(n=0;n<t.length;n++)r|=i[n]<<8*n;return e^r}for(e=0;e<n.length;e++)t=n.charCodeAt(e),i.unshift(255&t),i.length>=4&&(r=a(r,i),i=[]);return i.length>0&&(r=a(r,i)),r.toString(16)}()+"-"+t+"-"+e();return n||(String(Math.random())+String(Math.random())+String(Math.random())).slice(2,15)}}(),D.getReferrer=function(e){var t=e||document.referrer;return"string"!=typeof t?"referrer exception"+String(t):(0===t.indexOf("https://www.baidu.com/")&&(t=t.split("?")[0]),"string"==typeof(t=t.slice(0,2e3))?t:"")},D.getCookielDomain=function(e){e=e||I.hostname,D.check.isString(e)&&e.match(/^[a-zA-Z0-9\u4e00-\u9fa5\-\.]+$/)||(e="");var t=e.split(".");if(D.check.isArray(t)&&t.length>=2&&!/^(\d+\.)+\d+$/.test(e))for(var n="."+t.splice(t.length-1,1);t.length>0;)if(n="."+t.splice(t.length-1,1)+n,document.cookie=S+"=true; path=/; domain="+n,-1!==document.cookie.indexOf(S+"=true")){var i=new Date;return i.setTime(i.getTime()-1e3),document.cookie=S+"=true; expires="+i.toGMTString()+"; path=/; SameSite=Lax; domain="+n,n}return""},D.getCurrentDomain=function(e){var t=D.getCookielDomain();return""===e||""===t?"url解析失败":t},D.hashCode=function(e){if("string"!=typeof e)return 0;var t=0;if(0===e.length)return t;for(var n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return t},D.base64Decode=function(e){var t="";try{t=decodeURIComponent(escape(atob(e)))}catch(n){t=e}return t},D.base64Encode=function(e){try{return btoa(unescape(encodeURIComponent(e)))}catch(t){return e}},D.decodeURIComponent=function(e){var t="";try{t=decodeURIComponent(e)}catch(n){t=e}return t},D.encodeURIComponent=function(e){var t="";try{t=encodeURIComponent(e)}catch(n){t=e}return t},D.cookie={get:function(e){for(var t=e+"=",n=document.cookie.split(";"),i=0;i<n.length;i++){for(var r=n[i];" "===r.charAt(0);)r=r.substring(1,r.length);if(0===r.indexOf(t))return D.decodeURIComponent(r.substring(t.length,r.length))}return null},set:function(e,t,n,i,r,a,o){var s=o,c="",u="",l="";if(0!==(n=null==n?73e3:n)){var h=new Date;"s"===String(n).slice(-1)?h.setTime(h.getTime()+1e3*Number(String(n).slice(0,-1))):h.setTime(h.getTime()+24*n*60*60*1e3),c="; expires="+h.toGMTString()}function d(e){return!!e&&e.replace(/\r\n/g,"")}D.check.isString(r)&&""!==r&&(l="; SameSite="+r),a&&(u="; secure");var f="",g="",p="";e&&(f=d(e)),g=t&&D.check.isString(t)?d(t):t,s&&(p=d(s)),f&&g&&(document.cookie=f+"="+encodeURIComponent(g)+c+"; path=/"+p+l+u)},setDomain:function(e,t,n,i){var r="";if(i=!!D.check.isUndefined(i)||i){var a=D.getCurrentDomain(I.href);"url解析失败"===a&&(a=""),r=a?"; domain="+a:""}return this.set(e,t,n,i,null,null,r)},remove:function(e,t){this.set(e,"1",-1,t)},isSupport:function(e,t){e=e||"cookie_support_test",t=t||"1";var n=this;return O.cookieEnabled&&(n.set(e,t),n.get(e)===t&&(n.remove(e),!0))}},D.localStorage={get:function(e){return x.getItem(e)},parse:function(e){var t;try{t=JSON.parse(D.localStorage.get(e))||null}catch(e){L.log("parse localStorage failed")}return t},set:function(e,t){try{x.setItem(e,t)}catch(e){L.log("localStorage is not support")}},remove:function(e){x.removeItem(e)},isSupport:function(){var e=!0;try{var t="__localStorageSupport__",n="testIsSupportStorage";D.localStorage.set(t,n),D.localStorage.get(t)!==n&&(e=!1),D.localStorage.remove(t)}catch(t){e=!1}return e},key:function(e){return x.key(e)},length:x.length},D.memory={data:{},get:function(e){var t=this.data[e];return D.check.isUndefined(t)?null:D.check.isUndefined(t.expireTime)?t:t.expireTime<D.now()?null:t.value},set:function(e,t,n){if(n){var i,r=D.now();i="s"===String(n).slice(-1)?r+1e3*Number(String(n).slice(0,-1)):r+24*n*60*60*1e3,this.data[e]={value:t,expireTime:i}}this.data[e]=t},setDomain:function(e,t,n){this.set(e,t,n)}},D.now=function(){return Date.now&&D.check.isFunction(Date.now)?Date.now():(new Date).getTime()},D.getRandom=function(){return(new Date).getTime()+"_"+Math.floor(1e6*Math.random())},D.get32RandomString=function(){for(var e="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",t="",n=0;n<32;n++){t+=e[Math.floor(62*Math.random())]}return t},D.safeJSONParse=function(e){var t=null;try{t=JSON.parse(e)}catch(t){return e}return t},D.saveObjectVal=function(e,t,n){D.check.isString(t)||(t=JSON.stringify(t)),D.localStorage.set(e,t)},D.readObjectVal=function(e,t){var n=D.localStorage.get(e);return n?D.safeJSONParse(n):null},D.stripEmptyProperties=function(e){var t={};return D.each(e,(function(e,n){D.check.isString(e)&&e.length>0&&(t[n]=e)})),t},D.info={os:function(){var e=O.userAgent;return/Windows/i.test(e)?/Phone/.test(e)||/WPDesktop/.test(e)?"Windows Phone":"Windows":/(iPhone|iPad|iPod)/.test(e)&&!window.MSStream?"iOS":/Android/.test(e)?"Android":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":/Mac/i.test(e)?"Mac OS X":/Linux/.test(e)?"Linux":/CrOS/.test(e)?"Chrome OS":"取值异常"},browser:function(){var e={type:"",version:""};try{var t,n=null===(t=O.userAgent)||void 0===t?void 0:t.toLowerCase(),i=[];if(null!==n.match(/baidubrowser/)?(e.type="baidu",i.push(/baidubrowser\/([\d.]+)/)):null!==n.match(/bidubrowser/)?(e.type="baidu",i.push(/bidubrowser\/([\d.]+)/)):null!==n.match(/edg/)?(e.type="edge",i.push(/edg\/([\d.]+)/)):null!==n.match(/edgios/)?(e.type="edge",i.push(/edgios\/([\d.]+)/)):null!==n.match(/liebaofast/)?(e.type="liebao",i.push(/liebaofast\/([\d.]+)/)):null!==n.match(/sogoumobilebrowser/)?(e.type="sogou",i.push(/sogoumobilebrowser\/([\d.]+)/)):null!==n.match(/lbbrowser/)?(e.type="liebao",i.push(/lbbrowser\/([\d.]+)/)):null!==n.match(/crios/)?(e.type="chrome",i.push(/crios\/([\d.]+)/)):null!==n.match(/qihoobrowser/)?(e.type="360",i.push(/qihoobrowser\/([\d.]+)/)):null!==n.match(/mxios/)?(e.type="maxthon",i.push(/mxios\/([\d.]+)/)):null!==n.match(/fxios/)?(e.type="firefox",i.push(/fxios\/([\d.\w]+)/)):null!==n.match(/edge/)?(e.type="edge",i.push(/edge\/([\d.]+)/)):null!==n.match(/metasr/)?(e.type="sogou",i.push(/metasr ([\d.]+)/)):null!==n.match(/micromessenger/)?(e.type="micromessenger",i.push(/micromessenger\/([\d.]+)/)):null!==n.match(/mqqbrowser/)?(e.type="qq",i.push(/mqqbrowser\/([\d.]+)/)):null!==n.match(/qqbrowserlite/)?(e.type="qq",i.push(/qqbrowserlite\/([\d.]+)/)):null!==n.match(/tencenttraveler/)?(e.type="qq",i.push(/tencenttraveler\/([\d.]+)/)):null!==n.match(/qqbrowser/)?(e.type="qq",i.push(/qqbrowser\/([\d.]+)/)):null!==n.match(/maxthon/)?(e.type="maxthon",i.push(/maxthon\/([\d.]+)/)):null!==n.match(/ubrowser/)?(e.type="uc",i.push(/ubrowser\/([\d.]+)/)):null!==n.match(/ucbrowser/)?(e.type="uc",i.push(/ucbrowser\/([\d.]+)/)):null!==n.match(/firefox/)?(e.type="firefox",i.push(/firefox\/([\d.]+)/)):null!==n.match(/opera/)?(e.type="opera",i.push(/opera\/([\d.]+)/)):null!==n.match(/opr/)?(e.type="opera",i.push(/opr\/([\d.]+)/)):null!==n.match(/chrome/)?(e.type="chrome",i.push(/chrome\/([\d.]+)/)):null!==n.match(/safari/)?(e.type="safari",i.push(/version\/([\d.]+)/)):null===n.match(/trident/)&&null===n.match(/msie/)||(e.type="ie"),"ie"===e.type){var r=n.match(/trident\/([\d.]+)/)?n.match(/trident\/([\d.]+)/)[1]:"",a=n.match(/msie ([\d.]+)/)?n.match(/msie ([\d.]+)/)[1]:"";""!==r?e.version=String(parseInt(r)+4):""!==a&&(e.version=a)}else i&&(e.version=n.match(i[0])?n.match(i[0])[1]:"")}catch(t){e.type="取值异常",L.log("getting browser info failed due to ",t)}return e},modelInfo:function(){var e=new r.default(O.userAgent),t=e.os();if("iOS"===t)return e.mobile();if("AndroidOS"===t)return e.mobile();var n=O.userAgent.match(/Mac/);if(n)return n[0];var i=O.userAgent.match(/Windows/);if(i)return i[0];var a=O.userAgent.match(/Linux/);return a?a[0]:"取值异常"},osVersion:function(){var e=O.userAgent;if(/Windows/i.test(e)){var t=/Windows NT ([\d.]+)/;return e.match(t)?e.match(t)[1]:""}if(/(iPhone|iPad|iPod)/.test(e)&&!window.MSStream){var n=/OS ([\d_]+)/;return e.match(n)?e.match(n)[1].replace(/_/g,"."):""}if(/Android/.test(e)){var i=/Android ([\d.]+)/;return e.match(i)?e.match(i)[1]:""}if(/Mac/i.test(e)){var r=/Mac OS X ([\d_]+)/;return e.match(r)?e.match(r)[1].replace(/_/g,"."):""}return""},properties:function(e){var t,n=D.info.browser();return D.extend({H_os:D.info.os(),H_os_version:D.info.osVersion(),H_lib_version:D.PV_LIB_VERSION,H_lib:"js",H_lib_method:"code",H_screen_height:Number(A.height)||0,H_screen_width:Number(A.width)||0,H_browser:n.type,H_browser_version:n.version,H_network_type:D.info.networkType(),H_language:D.check.isString(O.language)?null===(t=O.language)||void 0===t?void 0:t.toLowerCase():"取值异常",H_model:D.info.modelInfo()},e)},epmProperties:function(){return this.properties({H_lib_version:D.EPM_LIB_VERSION,H_url:I.href,H_title:document.title})},pageProperties:function(){var e=D.getReferrer(),t=D.getCurrentDomain(I.href);return D.stripEmptyProperties({H_referrer:e,H_referrer_host:e?D.getHostname(e):"",H_url:I.href,H_url_host:D.getHostname(I.href,"url_host取值异常"),H_url_domain:t,H_url_path:I.pathname,H_url_hash:I.hash,H_title:document.title})},getElementInfo:function(e,t){var n;if(!D.check.isElement(e))return{};var i=null===(n=e.tagName)||void 0===n?void 0:n.toLowerCase(),r={H_element_type:i,H_element_name:e.getAttribute("name"),H_element_id:e.getAttribute("id"),H_element_target_url:e.getAttribute("href"),H_element_class_name:D.check.isString(e.className)?e.className:null,H_element_content:D.getElementContent(e,i,t)};return D.stripEmptyProperties(r)},networkType:function(){if(void 0===O.connection)return"unknown";var e=O.connection;return e.effectiveType?e.effectiveType:e.type?e.type:"取值异常"}},D.getElementContent=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if("input"===t)return(["button","submit"].includes(e.type)||n)&&e.value||"";var i="";return e.textContent?i=D.trim(e.textContent):e.innerText&&(i=D.trim(e.innerText)),i&&(i=i.replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)),i||""},D.getHostname=function(e,t){if(t&&"string"==typeof t||(t="hostname解析异常"),!e)return t;var n=null;try{n=D.URL(e).hostname}catch(e){L.log("getHostname传入的url参数不合法!")}return n||t},D.isReferralTraffic=function(e){return""===(e=e||document.referrer)||D.getCookielDomain(D.getHostname(e))!==D.getCookielDomain()},D.getUtm=function(){var e={};return D.each(m,(function(t){var n=D.getQueryParam(I.href,t);n.length&&(e[t]=n)})),e},D.getQueryParam=function(e,t){t=t.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]"),e=D.decodeURIComponent(e);var n=new RegExp("[\\?&]"+t+"=([^&#]*)").exec(e);return null===n||n&&"string"!=typeof n[1]&&n[1].length?"":D.decodeURIComponent(n[1])};var N=function(){return u((function e(t){s(this,e),this.ele=t}),[{key:"addClass",value:function(e){return-1===(" "+this.ele.className+" ").indexOf(" "+e+" ")&&(this.ele.className=this.ele.className+(""===this.ele.className?"":" ")+e),this}},{key:"removeClass",value:function(e){var t=" "+this.ele.className+" ";return-1!==t.indexOf(" "+e+" ")&&(this.ele.className=t.replace(" "+e+" "," ").slice(1,-1)),this}},{key:"hasClass",value:function(e){return-1!==(" "+this.ele.className+" ").indexOf(" "+e+" ")}},{key:"attr",value:function(e,t){return"string"==typeof e&&D.check.isUndefined(t)?this.ele.getAttribute(e):("string"==typeof e&&(t=String(t),this.ele.setAttribute(e,t)),this)}},{key:"offset",value:function(){var e=this.ele.getBoundingClientRect();if(e.width||e.height){var t=this.ele.ownerDocument.documentElement;return{top:e.top+window.pageYOffset-t.clientTop,left:e.left+window.pageXOffset-t.clientLeft}}return{top:0,left:0}}},{key:"getSize",value:function(){if(!window.getComputedStyle)return{width:this.ele.offsetWidth,height:this.ele.offsetHeight};try{var e=this.ele.getBoundingClientRect();return{width:e.width,height:e.height}}catch(e){return{width:0,height:0}}}},{key:"getStyle",value:function(e){return this.ele.currentStyle?this.ele.currentStyle[e]:this.ele.ownerDocument.defaultView.getComputedStyle(this.ele,null).getPropertyValue(e)}},{key:"wrap",value:function(e){var t=document.createElement(e);return this.ele.parentNode.insertBefore(t,this.ele),t.appendChild(this.ele),D.getDomElementInfo(t)}},{key:"getCssStyle",value:function(e){var t=this.ele.style.getPropertyValue(e);if(t)return t;var n=null;if("function"==typeof window.getMatchedCSSRules&&(n=window.getMatchedCSSRules(this.ele)),!n||!D.check.isArray(n))return null;for(var i=n.length-1;i>=0;i--){if(t=n[i].style.getPropertyValue(e))return t}}},{key:"sibling",value:function(e,t){for(;(e=e[t])&&1!==e.nodeType;);return e}},{key:"next",value:function(){return this.sibling(this.ele,"nextSibling")}},{key:"prev",value:function(){return this.sibling(this.ele,"previousSibling")}},{key:"siblingsFn",value:function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n}},{key:"siblings",value:function(){return this.siblingsFn((this.ele.parentNode||{}).firstChild,this.ele)}},{key:"children",value:function(){return this.siblingsFn(this.ele.firstChild)}},{key:"parent",value:function(){var e=this.ele.parentNode;return e=e&&11!==e.nodeType?e:null,D.getDomElementInfo(e)}},{key:"previousElementSibling",value:function(){var e=this.ele;if("previousElementSibling"in document.documentElement)return D.getDomElementInfo(e.previousElementSibling);for(;e=e.previousSibling;)if(1===e.nodeType)return D.getDomElementInfo(e);return D.getDomElementInfo(null)}},{key:"getSameTypeSiblings",value:function(){for(var e,t=this.ele,n=t.parentNode,i=null===(e=t.tagName)||void 0===e?void 0:e.toLowerCase(),r=[],a=0;a<n.children.length;a++){var o,s=n.children[a];1===s.nodeType&&(null===(o=s.tagName)||void 0===o?void 0:o.toLowerCase())===i&&r.push(n.children[a])}return r}},{key:"getParents",value:function(){try{var e=this.ele;if(!D.check.isElement(e))return[];var t=[e];if(null===e||null===e.parentElement)return[];for(;null!==e.parentElement;)e=e.parentElement,t.push(e);return t}catch(e){return[]}}}])}();D.getDomElementInfo=function(e){return new N(e)},D.addEvent=function(e,t,n,i){function r(e){return e&&(e.preventDefault=r.preventDefault,e.stopPropagation=r.stopPropagation,e._getPath=r._getPath),e}r._getPath=function(){return this.path||D.getDomElementInfo(this.target).getParents()},r.preventDefault=function(){this.returnValue=!1},r.stopPropagation=function(){this.cancelBubble=!0};(function(e,t,n){if(void 0===i&&"click"===t&&(i=!0),e&&e.addEventListener)e.addEventListener(t,(function(e){e._getPath=r._getPath,n.call(this,e)}),i);else{var a="on"+t,o=e[a];e[a]=function(e,t,n,i){var a=function(a){if(a=a||r(window.event)){a.target=a.srcElement;var o,s,c=!0;return"function"==typeof n&&(o=n(a)),s=t.call(e,a),"beforeunload"!==i?(!1!==o&&!1!==s||(c=!1),c):void 0}};return a}(e,n,o,t)}}).apply(null,arguments)},D.addCaptureEvent=function(e,t,n){return this.addEvent(e,t,n,"click"===t)},D.hasCircularReference=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Set;if("object"!==p(e)||null===e)return!1;if(t.has(e))return!0;for(var n in t.add(e),e)if(D.hasCircularReference(e[n],t))return!0;return t.delete(e),!1},D.parseSuperProperties=function(e){var t=e.properties||{},n=JSON.parse(JSON.stringify(e));D.check.isObject(t)&&D.each(t,(function(e,i){if(D.check.isFunction(e))try{t[i]=e(n),D.check.isFunction(t[i])&&(L.log("属性--"+i+" 格式不满足要求, 已被删除"),delete t[i])}catch(e){delete t[i],L.log("属性--"+i+" 格式不满足要求, 已被删除")}}))},D.checkMaxProperties=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1024,n=e.properties||{};D.check.isObject(n)&&D.each(n,(function(e,i){if(D.check.isString(e))try{t>v&&(t=v),e.length>t&&(n[i]=D.check.cutString(e,t),L.log("属性--"+i+" 内容过长,已被截断:"+n[i]))}catch(e){}}))},D.getURLSearchParams=function(e){for(var t={},n=(e=e||"").substring(1).split("&"),i=0;i<n.length;i++){var r=n[i].indexOf("=");if(-1!==r){var a=n[i].substring(0,r),o=n[i].substring(r+1);a=D.decodeURIComponent(a),o=D.decodeURIComponent(o),t[a]=o}}return t},D.urlParse=function(e){var t=function(e){this._fields={Username:4,Password:5,Port:7,Protocol:2,Host:6,Path:8,URL:0,QueryString:9,Fragment:10},this._values={},this._regex=/^((\w+):\/\/)?((\w+):?(\w+)?@)?([^\/\?:]+):?(\d+)?(\/?[^\?#]+)?\??([^#]+)?#?(\w*)/,void 0!==e&&this._parse(e)};return t.prototype.setUrl=function(e){this._parse(e)},t.prototype._initValues=function(){for(var e in this._fields)this._values[e]=""},t.prototype.addQueryString=function(e){if("object"!==p(e))return!1;var t=this._values.QueryString||"";for(var n in e)t=new RegExp(n+"[^&]+").test(t)?t.replace(new RegExp(n+"[^&]+"),n+"="+e[n]):"&"===t.slice(-1)?t+n+"="+e[n]:""===t?n+"="+e[n]:t+"&"+n+"="+e[n];this._values.QueryString=t},t.prototype.getUrl=function(){var e="";return e+=this._values.Origin,e+=this._values.Port?":"+this._values.Port:"",e+=this._values.Path,e+=this._values.QueryString?"?"+this._values.QueryString:"",e+=this._values.Fragment?"#"+this._values.Fragment:""},t.prototype._parse=function(e){this._initValues();var t=this._regex.exec(e);t||L.i("URLParser::_parse -> Invalid URL");var n=e.split("#"),i=n[0],r=n.slice(1).join("#");for(var a in t=this._regex.exec(i),this._fields)void 0!==t[this._fields[a]]&&(this._values[a]=t[this._fields[a]]);this._values.Hostname=this._values.Host.replace(/:\d+$/,""),this._values.Origin=this._values.Protocol+"://"+this._values.Hostname,this._values.Fragment=r},new t(e)},D.URL=function(e){var t,n={};if("function"==typeof window.URL&&function(){try{return"http://modernizr.com/"===new URL("http://modernizr.com/").href}catch(e){return!1}}())(n=new URL(e)).searchParams||(n.searchParams=(t=D.getURLSearchParams(n.search),{get:function(e){return t[e]}}));else{D.check.isString(e)||(e=String(e)),e=D.trim(e);if(!1===/^https?:\/\/.+/.test(e))return void L.log("Invalid URL");var i=D.urlParse(e);n.hash=i._values.Fragment,n.host=i._values.Host?i._values.Host+(i._values.Port?":"+i._values.Port:""):"",n.href=i._values.URL,n.password=i._values.Password,n.pathname=i._values.Path,n.port=i._values.Port,n.search=i._values.QueryString?"?"+i._values.QueryString:"",n.username=i._values.Username,n.hostname=i._values.Hostname,n.protocol=i._values.Protocol?i._values.Protocol+":":"",n.origin=i._values.Origin?i._values.Origin+(i._values.Port?":"+i._values.Port:""):"",n.searchParams=function(){var e=D.getURLSearchParams("?"+i._values.QueryString);return{get:function(t){return e[t]}}}()}return n};var R=function(){return u((function e(){s(this,e)}),null,[{key:"getSourceFromReferrer",value:function(){function e(e,t){for(var n=0;n<e.length;n++)if(-1!==t.split("?")[0].indexOf(e[n]))return!0}var t="("+m.join("|")+")\\=[^&]+",n=document.referrer||"",i=I.href;if(i){var r=i.match(new RegExp(t));return r&&r[0]?"付费广告流量":e(y,n)?"自然搜索流量":e(k,n)?"社交网站流量":""===n?"直接流量":"引荐流量"}return"获取url异常"}},{key:"getReferSearchEngine",value:function(e){var t=D.getHostname(e);if(!t||"hostname解析异常"===t)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$/]},i={};for(var r in n)i[r]=n[r].map((function(e){return new RegExp(e)}));for(var a in i){var o,s=l(i[a]);try{for(s.s();!(o=s.n()).done;){if(o.value.test(t))return a}}catch(e){s.e(e)}finally{s.f()}}return"未知搜索引擎"}},{key:"getKeywordFromReferrer",value:function(e,t){if(e=e||document.referrer,document&&D.check.isString(e)){if(0===e.indexOf("http")){var n=this.getReferSearchEngine(e),i=D.getURLSearchParams(e);if(D.check.isEmptyObject(i))return"未取到值";var r=null;for(var a in b)if(n===a&&D.check.isObject(i))if(r=b[a],D.check.isArray(r))for(a=0;a<r.length;a++){var o=i[r[a]];if(o)return t?{active:o}:o}else if(i[r])return t?{active:i[r]}:i[r];return"未取到值"}return""===e?"未取到值_直接打开":"未取到值_非http的url"}return"取值异常_referrer异常_"+String(e)}}])}();function j(e){return!!D.check.isFunction(e)||!(!e||!D.check.isObject(e))&&j(e.callback)}var B=function(){return u((function e(){return s(this,e),e.instance||(e.instance=this,this.events={}),e.instance}),[{key:"on",value:function(e,t){if(!e||!t)return!1;if(!j(t))throw new Error("callback must be a function");return this.events[e]=this.events[e]||[],D.check.isObject(t)?this.events[e].push(t):this.events[e].push({callback:t,once:!1}),this}},{key:"prepend",value:function(e,t){if(!e||!t)return!1;if(!j(t))throw new Error("callback must be a fcuntion");return this.events[e]=this.events[e]||[],D.check.isObject(t)?this.events[e].unshift(t):this.events[e].unshift({callback:t,once:!1}),this}},{key:"prependOnce",value:function(e,t){return this.prepend(e,{callback:t,once:!0})}},{key:"once",value:function(e,t){return this.on(e,{callback:t,once:!0})}},{key:"off",value:function(e,t){var n=this.events[e];if(!n)return!1;if(D.check.isNumber(t))n.splice(t,1);else if(D.check.isFunction(t))for(var i=0;i<n.length;i++)n[i]&&n[i].callback===t&&n.splice(i,1);return this}},{key:"emit",value:function(e,t){var n=this.events[e];if(!n)return!1;var i,r=l(n);try{for(r.s();!(i=r.n()).done;){var a=i.value;D.check.isObject(a)&&(a.callback.call(this,t||{}),a.once&&this.off(e,a.callback))}}catch(e){r.e(e)}finally{r.f()}return this}},{key:"clear",value:function(e){e&&this.events(e)?this.events[e]=[]:this.events={}}},{key:"getEvent",value:function(e){return e&&this.events[e]?this.events[e]:this.events}}])}();D.mitt=new B,D.initUrlChange=function(){var e=I.href,t=P.pushState,n=P.replaceState;D.check.isFunction(t)&&(P.pushState=function(){t.apply(P,arguments),D.mitt.emit("urlChange",e),e=I.href}),D.check.isFunction(n)&&(P.replaceState=function(){n.apply(P,arguments),D.mitt.emit("urlChange",e),e=I.href});var i=t?"popstate":"hashchange";D.addEvent(window,i,(function(){D.mitt.emit("urlChange",e),e=I.href}))},D.listenPageState=function(e){({visibleHandler:D.check.isFunction(e.visible)?e.visible:function(){},hiddenHandler:D.check.isFunction(e.hidden)?e.hidden:function(){},visibilityChange:null,hidden:null,isSupport:function(){return!D.check.isUndefined(document[this.hidden])},init:function(){D.check.isUndefined(document.hidden)?D.check.isUndefined(document.msHidden)?D.check.isUndefined(document.webkitHidden)?D.check.isUndefined(document.mozHidden)||(this.hidden="mozHidden",this.visibilityChange="mozvisibilitychange"):(this.hidden="webkitHidden",this.visibilityChange="webkitvisibilitychange"):(this.hidden="msHidden",this.visibilityChange="msvisibilitychange"):(this.hidden="hidden",this.visibilityChange="visibilitychange"),this.listen()},listen:function(){var e=this;this.isSupport()?D.addEvent(document,this.visibilityChange,(function(){document[e.hidden]?e.hiddenHandler():e.visibleHandler()})):(D.addEvent(window,"focus",this.visibleHandler),D.addEvent(window,"blur",this.hiddenHandler))}}).init()},D.hash=function(e){for(var t=5381,n=e.length;n;)t=33*t^e.charCodeAt(--n);return t>>>0},D.getDomBySelector=function(e){if("string"!=typeof e)return console.error("Selector must be a string"),null;var t=document.querySelector(e);return t||(console.warn("No element found for selector:",e),null)},D.getUA=function(){var e=O.userAgent;return{ie:e.indexOf("MSIE ")>-1&&parseInt(e.split("MSIE ")[1])}},D.encodeSelector=function(e){return D.base64Encode(e).replace(/[+\/=]/g,(function(e){return"_"}))},D.loadScript=function(e){var t={success:function(){},error:function(){},appendCall:function(e){document.head.appendChild(e)}},n=f(f({},t),e),i=null;"css"===n.type?((i=document.createElement("link")).rel="stylesheet",i.href=n.url):"js"===n.type&&((i=document.createElement("script")).async=!0,i.charset="UTF-8",i.src=n.url,i.type="text/javascript"),i.onload=i.onreadystatechange=function(){i.readyState&&"loaded"!==i.readyState&&"complete"!==i.readyState||(n.success(),i.onload=i.onreadystatechange=null)},i.onerror=function(){n.error(),i.onerror=null},n.appendCall(i)},D.checkUrlIsMatch=function(e,t){try{var n=D.URL(I.href),i=D.URL(e);switch(t){case"STRICT":return I.href===i.href;case"FUZZY":return n.host===i.host&&n.pathname===i.pathname;default:return console.error("link_match_type 字段异常",t),!1}}catch(e){return console.error("URL 解析失败",e),!1}},D.secCheck={isHttpUrl:function(e){if("string"!=typeof e)return!1;var t=/^https?:\/\/.+/.test(e);return t||console.log("Invalid URL"),t},removeScriptProtocol:function(e){if("string"!=typeof e)return"";for(var t=/^\s*javascript/i;t.test(e);)e=e.replace(t,"");return e}},D.dfMapping=function(e){for(var t="t6KJCZa5pDdQ9khoEM3Tj70fbP2eLSyc4BrsYugARqFIw1mzlGNVXOHiWvxUn8",n={},i=0;i<62;i++){var r=t.charAt(i),a=t.charAt(61-i);n[r]=a}for(var o="",s=0;s<input.length;s++){var c=input.charAt(s);o+=c in n?n[c]:c}return o},D.rot13obfs=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:13;return String(e).split("").map((function(e){var n=e.charCodeAt(0);if(n<126){var i=(n+t)%126;return i<32&&(i+=32),String.fromCharCode(i)}return e})).join("")};var F={dataEnc:"data:enc;",userEncrypt:function(e){return"dfm-enc-"+D.dfMapping(e)},userDecrypt:function(e){return 0===e.indexOf(dataEnc)?(e=e.substring(dataEnc.length),e=D.rot13obfs(e=String(e),113)):0===e.indexOf("dfm-enc-")&&(e=e.substring(8),e=D.dfMapping(e)),e},userDecryptIfNeeded:function(e){if(D.check.isString(e)||""===e)return e;if(0!==e.indexOf("dfm-enc-")&&0!==e.indexOf(dataEnc))return e;var t=userDecrypt(e);return t||e}};function M(e){U.checkAjax(e.url),e.timeout=e.timeout||2e4;var t=void 0!==window.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest?new XMLHttpRequest:void 0!==window.XDomainRequest?new(0,window.XDomainRequest):null;if(!t)return!1;var n,i=(e=D.extend({success:function(){},error:function(){}},e)).success,r=e.error,a=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];n&&(clearTimeout(n),n=null,e&&(t.onreadystatechange=null,t.onload=null,t.onerror=null))};e.success=function(e){i(e),a()},e.error=function(e){r(e),a()},n=setTimeout((function(){try{t&&D.check.isObject(t)&&t.abort&&t.abort()}catch(e){L.log(e)}a(!0)}),e.timeout);var o=function(e){return e?D.safeJSONParse(e):""};"undefined"!=typeof XDomainRequest&&t instanceof window.XDomainRequest&&(t.onload=function(){e.success&&e.success(o(t.responseText)),t.onreadystatechange=null,t.onload=null,t.onerror=null},t.onerror=function(){e.error&&e.error(o(t.responseText),t.status),t.onreadystatechange=null,t.onerror=null,t.onload=null}),t.open("post",e.url,!0),e.credentials&&(t.withCredentials=!0),t.setRequestHeader&&(t.setRequestHeader("Content-type",e.contentType||"application/x-www-form-urlencoded"),e.projectKey&&t.setRequestHeader("project-key",e.projectKey)),t.onreadystatechange=function(){try{4===t.readyState&&(t.status>=200&&t.status<300||304===t.status?e.success(o(t.responseText)):e.error("网络异常, 请求失败",t.status),t.onreadystatechange=null,t.onload=null)}catch(e){t.onreadystatechange=null,t.onload=null}},t.send(e.data||null)}D.kit=F,D.checkUrlIsMatch=function(e,t){var n;try{n=D.URL(e)}catch(e){return L.log("Failed to parse control URL",e),!1}if("STRICT"===t)return I.href===n.href;if("FUZZY"===t){var i;try{i=D.URL(I.href)}catch(e){return L.log("Failed to parse current URL",e),!1}return i.host===n.host&&i.pathname===n.pathname}return L.log("Invalid link_match_type",t),!1},D.getStorageData=function(e){if(!D.localStorage.isSupport())return L.log("A/B Testing 初始化失败,浏览器不支持 localStorage"),!1;var t=D.localStorage.get(e);D.check.isString(t)&&(t=D.kit.userDecryptIfNeeded(t));try{t=JSON.parse(t)}catch(e){L.log("A/B Testing 初始化失败,无法解析存储数据",e)}return t},D.storeData=function(e,t,n){var i=JSON.stringify(e);n&&(i=D.userEncrypt(i)),D.localStorage.set(t,i)};var q=function(){return u((function e(t){s(this,e),this.callback=t.callback,this.serverUrl=t.serverUrl,this.data=t.data,this.dataSendTimeout=t.dataSendTimeout}),[{key:"run",value:function(){var e=this;M({url:this.serverUrl,data:this.data,timeout:this.dataSendTimeout,success:function(){return e.cb("success")},error:function(t){return e.cb("fail",t)}})}},{key:"cb",value:function(e,t){if(this.callback){if(!D.check.isFunction(this.callback))return void L.log("sdk callback is not a function");var n=new URLSearchParams(this.data).get("data"),i=D.base64Decode(n);if("track"===i.type&&"H_WebPageLeave"===i.event)return;this.callback(this.serverUrl,i,e,t)}}}])}(),V=function(){return u((function e(t){s(this,e),this.callback=t.callback,this.serverUrl=t.serverUrl,this.data=t.data,this.dataSendTimeout=t.dataSendTimeout,this.img=document.createElement("img"),this.img.width=1,this.img.height=1,t.imgUseCrossOrigin&&(this.img.crossOrigin="anonymous")}),[{key:"run",value:function(){var e=this,t=function(t,n){e.img&&!e.img.complete&&(e.img.complete=!0,setTimeout((function(){var t=D.info.browser().type;e.img.src="ie"===t?"about:blank":""}),e.dataSendTimeout)),e.cb(t,n)};-1!==this.serverUrl.indexOf("?")?this.img.src=this.serverUrl+"&"+this.data:this.img.src=this.serverUrl+"?"+this.data,this.img.onload=function(){this.onload=null,t("success")},this.img.onerror=function(){this.onerror=null,t("error")},this.img.onabort=function(){this.onabort=null,t("abort")}}},{key:"cb",value:function(e){if(this.callback){if(!D.check.isFunction(this.callback))return void L.log("sdk callback is not a function");var t=new URLSearchParams(this.data).get("data");this.callback(this.serverUrl,D.base64Decode(t),e)}}}])}(),z=function(){return u((function e(t){s(this,e),this.callback=t.callback,this.serverUrl=t.serverUrl,this.data=t.data}),[{key:"run",value:function(){var e=this;if(D.check.isObject(navigator)&&D.check.isFunction(navigator.sendBeacon)){var t=new FormData;t.append("data",D.base64Encode(this.data)),navigator.sendBeacon(this.serverUrl,t)}setTimeout((function(){e.cb()}))}},{key:"cb",value:function(){if(this.callback){if(!D.check.isFunction(this.callback))return void L.log("sdk callback is not a function");this.callback()}}}])}(),J="hinasdk_data_",K=function(){return u((function e(t){s(this,e),this.timer=null,this.sendTimeStamp=0,this.batchConfig=D.extend({dataSendTimeout:6e3,sendInterval:6e3,storageLimit:200},t.batchSend),this.tabKey="hinasdk_tab",this.config=t}),[{key:"batchInterval",value:function(){var e=this;this.timer=setTimeout((function(){e.recycle(),e.send(),clearTimeout(e.timer),e.batchInterval()}),this.batchConfig.sendInterval)}},{key:"request",value:function(e,t){var n=this;0!=(e=e.filter((function(e){return null!=e}))).length&&M({url:this.config.serverUrl,data:"data_list="+encodeURIComponent(D.base64Encode(JSON.stringify(e))),timeout:this.batchConfig.dataSendTimeout,success:function(){n.remove(t),n.sendTimeStamp=0},error:function(){n.sendTimeStamp=0}})}},{key:"send",value:function(){if(!(this.sendTimeStamp&&D.now()-this.sendTimeStamp<this.batchConfig.dataSendTimeout)){var e=D.localStorage.get(this.tabKey);if(e){this.sendTimeStamp=D.now();var t=D.safeJSONParse(e)||[];if(t.length){for(var n=[],i=[],r=t.length<this.batchConfig.storageLimit?t.length:this.batchConfig.storageLimit,a=0;a<r;a++){var o=D.readObjectVal(t[a].dataKey);i.push(t[a].dataKey),n.push(o)}this.request(n,i)}}}}},{key:"remove",value:function(e){var t=D.localStorage.get(this.tabKey);if(t){for(var n=D.safeJSONParse(t)||[],i=null==n?void 0:n.map((function(e){return e.dataKey})),r=0;r<e.length;r++){var a=D.indexOf(i,e[r]);a>-1&&(n.splice(a,1),D.localStorage.remove(e[r]))}D.localStorage.set(this.tabKey,JSON.stringify(n))}}},{key:"add",value:function(e){var t=J+D.getRandom(),n=D.localStorage.get(this.tabKey);if((n=null==n?[]:D.safeJSONParse(n)||[]).push({dataKey:t,expireTime:D.now()+2*this.batchConfig.sendInterval}),D.localStorage.set(this.tabKey,JSON.stringify(n)),D.saveObjectVal(t,e),n.length>this.batchConfig.storageLimit){for(var i=n.slice(0,20),r=[],a=0;a<i.length;a++){var o=D.readObjectVal(i[a].dataKey);r.push(o)}this.request(r,i.map((function(e){return e.dataKey})))}"track_signup"!==e.type&&"H_pageview"!==e.event||this.send()}},{key:"recycle",value:function(){var e=D.localStorage.get(this.tabKey);if(e){var t=D.safeJSONParse(e)||[];if(t.length){for(var n=[],i=0;i<t.length;i++)D.now()>t[i].expireTime&&n.push(t[i].dataKey);this.remove(n)}else{for(var r=[],a=0;a<D.localStorage.length;a++){var o=D.localStorage.key(a);0===(null==o?void 0:o.indexOf(J))&&r.push({dataKey:o,expireTime:D.now()+2*this.batchConfig.sendInterval})}r.length>0&&D.localStorage.set(this.tabKey,JSON.stringify(r))}}}}])}();function $(){return D.cookie.isSupport()?null!=D.cookie.get("hinasdk_isNewUser"):null!=D.memory.get("hinasdk_isNewUser")}var W={name:"hinasdk_crossdata",state:{deviceId:null,accountId:null,firstId:null,sessionId:null,firstVisitTime:D.now(),props:{},sessionIdUpdateTime:null},isFirstTime:!1,isFirstDay:$(),isFirstVisit:!0,isSetFirstVisit:!0,load:function(){var e=null,t=null;if(D.cookie.isSupport()?this.storage=D.cookie:(L.log("Cookie storage is not supported, SDK internal cache has been enabled"),this.storage=D.memory),D.localStorage.isSupport()?this.storageLocal=D.localStorage:L.log("localStorage is not supported, SDK internal cache has been enabled"),e||(e=this.storage.get(this.name)),t||(t=this.storageLocal.get(this.name)),e&&D.check.isJSONString(e)&&(this.state=D.extend({},JSON.parse(e))),t&&D.check.isJSONString(t)&&(this.state=D.extend({},JSON.parse(t))),e||t?(this.save(),this.isSetFirstVisit=!1,this.isFirstVisit=!1):(this.isSetFirstVisit=!0,this.isFirstVisit=!0),this.isFirstVisit){var n=new Date,i={h:23-n.getHours(),m:59-n.getMinutes(),s:59-n.getSeconds()};this.storage.set("hinasdk_isNewUser",!0,3600*i.h+60*i.m+i.s+"s"),this.isFirstDay=!0,this.isFirstTime=!0}else this.checkIsFirstTime=function(e){"track"===e.type&&"H_pageview"===e.event&&(e.properties.H_is_first_time=!1)};if(!this.getAccountId()){var r=D.UUID();this.setDeviceId(r)}},checkIsFirstTime:function(e){"track"===e.type&&"H_pageview"===e.event&&($()&&this.isFirstTime?(e.properties.H_is_first_time=!0,this.isFirstTime=!1):e.properties.H_is_first_time=!1)},checkIsFirstSign:function(e){"track"===e.type&&($()&&this.isFirstDay?e.properties.H_is_first_day=!0:(this.isFirstDay=!1,e.properties.H_is_first_day=!1))},setDeviceId:function(e){this.state.deviceId?L.log("Current deviceId is "+this.getDeviceId()+", it has been set"):this.set("deviceId",e)},setAccountId:function(e){e&&""!==e&&this.set("accountId",e)},getDeviceId:function(){return this.state.deviceId},getAccountId:function(){return this.state.__accountId||this.state.accountId},getCookie:function(){return this.storage.get(this.name)},setProps:function(e,t){var n={};for(var i in n=t?e:D.extend(this.state.props||{},e))"string"==typeof n[i]&&(n[i]=n[i].slice(0,D.MAX_REFERRER_STRING_LENGTH));this.set("props",n)},getFirstId:function(){return this.state.__firstId||this.state.firstId},getSessionId:function(){return this.state.sessionId},getSessionIdUpdateTime:function(){return this.state.sessionIdUpdateTime||this.getSessionId().split("_")[0]},setSessionId:function(e){this.set("sessionId",e)},getAnonymousId:function(){var e=this.getAccountId(),t=this.getFirstId();return e&&t?t:this.getDeviceId()},getOriginUnionId:function(e){var t,n={};t=e?e.first_id:this.getFirstId();var i=e.account_id||this.getAccountId();return t&&i?(n.login_id=i,n.anonymous_id=t):n.anonymous_id=t||this.getFirstId(),n},getUnionId:function(e){return this.getOriginUnionId(e)},change:function(e,t){this.state["__"+e]=t},set:function(e,t){this.state=this.state||{},["accountId","firstId"].indexOf(e)>-1&&delete this.state["__"+e],this.state[e]=t,this.save()},save:function(){this.storage.setDomain(this.name,JSON.stringify(this.state),null,!0),this.storageLocal.set(this.name,JSON.stringify(this.state))},clear:function(){this.state={},this.save()}},X={pageProp:{},currentProps:{},register:function(e){D.extend(X.currentProps,e)},getPresetProperties:function(){var e=window.innerHeight||document.documentElement.clientHeight||document.body&&document.body.clientHeight||0,t=window.innerWidth||document.documentElement.clientWidth||document.body&&document.body.clientWidth||0,n={H_timezone_offset:(new Date).getTimezoneOffset(),H_viewport_height:e,H_viewport_width:t};return D.extend(n,D.info.properties()),n},getPageProperties:function(){return D.extend(this.pageProp,D.info.pageProperties()),this.pageProp},getUmtsParams:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=D.getUtm(),i={},r={};return D.each(n,(function(n,a,o){D.utmTypes.includes(a)?i[e+a]=o[a]:r[t+a]=o[a]})),W.state.props&&W.state.props.H_latest_utm_source&&D.extend(W.state.props,i),{allUtms:i,otherUtms:r}},clearPageRegister:function(e){if(Array.isArray(e)&&e.length>0)e.forEach((function(e){"string"==typeof e&&e in X.currentProps&&delete X.currentProps[e]}));else if(!0===e)for(var t in X.currentProps)delete X.currentProps[t]}};function Z(e){var t=W.state.props||{};if(D.each(e.presetProperties,(function(e,n){if(-1===n.indexOf("latest_"))return!1;if(n=n.slice(7),e){var i=D.getCurrentDomain(window.location.href);if("utm"!==n&&"url解析失败"===i)t["H_latest_"+n]="url的domain解析失败";else if(D.isReferralTraffic(document.referrer))switch(n){case"traffic_source_type":t.H_latest_traffic_source_type=R.getSourceFromReferrer();break;case"referrer":t.H_latest_referrer=X.pageProp.referrer||"";break;case"search_keyword":R.getKeywordFromReferrer()&&(t.H_latest_search_keyword=R.getKeywordFromReferrer())}}})),e.presetProperties.latest_utm){var n=X.getUmtsParams("H_latest_",""),i=n.allUtms,r=n.otherUtms;D.check.isEmptyObject(i)||D.extend(t,i),D.check.isEmptyObject(r)||D.extend(t,r)}X.register(t),W.setProps(t)}function G(e,t,n){if(W.isSetFirstVisit){var i,r=X.getUmtsParams("H_","").allUtms,a=D.getReferrer(null,t);e.call(n,D.extend(f({H_first_visit_time:D.now(),H_first_referrer:a,H_first_host:a?D.getHostname(a,"取值异常"):"",H_first_browser_language:D.check.isString(navigator.languages[1])?null===(i=navigator.languages[1])||void 0===i?void 0:i.toLowerCase():"取值异常",H_first_traffic_source_type:R.getSourceFromReferrer(),H_first_search_keyword:R.getKeywordFromReferrer()},r))),W.isSetFirstVisit=!1}}function Y(e,t){var n=X.getUmtsParams("H_",""),i=n.allUtms,r=n.otherUtms,a={anonymous_id:W.getAnonymousId(),properties:f({device_id:W.getDeviceId()},X.currentProps),type:e.type,event:e.event,time:D.now(),_track_id:Number(String(D.getRandom()).slice(2,5)+String(D.getRandom()).slice(2,4)+String(D.now()).slice(-4))};return W.getAccountId()!==W.getAnonymousId()&&W.getAccountId()&&(a.account_id=W.getAccountId()),e.type&&"user"===e.type.slice(0,4)?a.properties=D.extend(a.properties,e.properties):a.properties=D.extend(a.properties,i,r,X.currentProps,X.getPageProperties(),X.getPresetProperties(),e.properties),D.parseSuperProperties(a),D.checkMaxProperties(a,t.config.maxStringLength),W.checkIsFirstSign(a),W.checkIsFirstTime(a),a}var Q=window.location,ee=["mark","/mark","strong","b","em","i","u","abbr","ins","del","s","sup"],te=["a","div","input","button","textarea"],ne=function(){return u((function e(t,n,i){s(this,e),this.autoTrackIsUsed=!1,this.otherTag=[],this.isTrackList={a:!0,button:!0},this.autoTrackConfig=D.extend({clickAutoTrack:!0,stayAutoTrack:!0,isCollectUrl:function(){return!0},isCollectElement:function(){return!0},isCollectInput:function(){return!1},addCustomProperty:function(){},stayDelayTime:4e3,maxStayPageDuration:18e3,maxStringLength:1024,collectTags:{div:!1},trackAttr:[]},t),this.stayAutoTrackConfig=D.extend({isCollectUrl:function(){return!0}},n),this.ctx=i,this.load(t)}),[{key:"load",value:function(e){var t=this;if(D.check.isArray(e.trackAttr)?(this.autoTrackConfig.trackAttr=e.trackAttr.filter((function(e){return D.check.isString(e)})),this.autoTrackConfig.trackAttr.push("hn-click")):this.autoTrackConfig.trackAttr=["hn-click"],D.check.isObject(e.collectTags)){if(!0===e.collectTags.div)this.autoTrackConfig.collectTags.div={ignoreTags:ee,maxLevel:1};else if(D.check.isObject(e.collectTags.div))if(this.autoTrackConfig.collectTags.div.ignoreTags=ee,D.check.isNumber(e.collectTags.div.maxLevel)){[1,2,3].includes(e.collectTags.div.maxLevel)||(this.autoTrackConfig.collectTags.div.maxLevel=1)}else this.autoTrackConfig.collectTags.div.maxLevel=1;else this.autoTrackConfig.collectTags.div=!1;D.each(e.collectTags,(function(e,n){"div"!==n&&e&&t.otherTag.push(n)})),!0===this.autoTrackConfig.clickAutoTrack&&D.each(this.otherTag,(function(e){e in t.isTrackList&&(t.isTrackList[e]=!0)}))}else this.autoTrackConfig.collectTags={div:!1}}},{key:"autoTrack",value:function(e,t){this.ctx.track("H_pageview",D.extend({H_referrer:D.getReferrer(null,!0),H_url:Q.href,H_url_path:Q.pathname,H_url_hash:Q.hash,H_title:document.title},e||{}),t),G(this.ctx.userSetOnce,!0,this.ctx),this.autoTrackIsUsed=!0}},{key:"autoTrackSinglePage",value:function(e,t){var n;n=this.autoTrackIsUsed?Q.href:D.getReferrer(),this.ctx.track("H_pageview",D.extend({H_referrer:n,url:Q.href,H_url_path:Q.pathname,H_url_hash:Q.hash,H_title:document.title},e||{}),t),G(this.ctx.userSetOnce,!1,this.ctx)}},{key:"listenSinglePage",value:function(){var e=this,t=this.ctx.getConfig("isSinglePage");t&&D.mitt.on("hasInit",(function(){e.onUrlChange((function(n){var i=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(n!==Q.href){X.pageProp.H_referrer=n;var i=D.extend({H_url:Q.href,H_referrer:n},t);e.autoTrack(i)}};if(D.check.isBoolean(t))i();else if(D.check.isFunction(t)){var r=t();D.check.isObject(r)?i(r):!0===r&&i()}}))}))}},{key:"initWebClick",value:function(){var e=this;if(!0===this.autoTrackConfig.clickAutoTrack){var t=!0;D.check.isFunction(this.autoTrackConfig.isCollectUrl)&&this.onUrlChange((function(){t=!!e.autoTrackConfig.isCollectUrl()})),D.addCaptureEvent(document,"click",(function(n){if(t){var i=n||window.event;if(i){var r=i.target||i.srcElement,a=e.getTargetElement(r,i);a&&e.emitClick(i,a)}}}))}}},{key:"emitClick",value:function(e,t,n,i){if(D.check.isFunction(this.autoTrackConfig.isCollectElement)&&!this.autoTrackConfig.isCollectElement(t))return!1;var r=this.getClickElementInfo(t);if(D.check.isFunction(this.autoTrackConfig.addCustomProperty)){var a=this.autoTrackConfig.addCustomProperty(t);D.check.isObject(a)&&(r=D.extend(r,a))}r=D.extend(r,this.getPageXYInfo(e,t),n||{}),this.ctx.track("H_WebClick",r,i)}},{key:"initWebStay",value:function(){var e=this;if(!0===this.autoTrackConfig.stayAutoTrack){var t=!0;D.check.isFunction(this.stayAutoTrackConfig.isCollectUrl)&&this.onUrlChange((function(){t=!!e.stayAutoTrackConfig.isCollectUrl()}));var n,i=this.autoTrackConfig.stayDelayTime,r=this.autoTrackConfig.maxStayPageDuration,a=this.ctx,o=(n={timer:null,timeout:1e3,callback:function(e,t){var n,o=(null===(n=document.documentElement)||void 0===n?void 0:n.scrollTop)||window.pageYOffset||document.body.scrollTop||0,s=e.H_viewport_position,c=new Date,u=c-this.nowTime;(u>i&&o-s!=0||t)&&(D.extend(e,{event_duration:Math.min(parseInt(u)/1e3,r)},D.info.pageProperties()),a.track("H_WebStay",e)),this.nowTime=c},run:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t={};if(!n.timer){var i,r=(null===(i=document.documentElement)||void 0===i?void 0:i.scrollTop)||window.pageYOffset||document.body.scrollTop||0;t.H_viewport_position=Math.round(r)||0,e?(n.callback(t,!0),n.timer=null):n.timer=setTimeout((function(){n.callback(t,!1),n.timer=null}),n.timeout)}}},n);o.nowTime=new Date,D.addCaptureEvent(window,"scroll",(function(){t&&o.run()})),D.addCaptureEvent(window,"unload",(function(){t&&o.run(!0)}))}}},{key:"onUrlChange",value:function(e){D.check.isFunction(e)&&(e(),D.mitt.on("urlChange",e))}},{key:"getTargetElement",value:function(e,t){var n;if(!D.check.isElement(e))return null;if(!D.check.isString(e.tagName))return null;var i,r,a=null===(n=e.tagName)||void 0===n?void 0:n.toLowerCase();if(["body","html"].includes(a))return null;if(["a","button","input","textarea"].concat(this.otherTag).includes(a))return e;if("div"===a&&this.autoTrackConfig.collectTags.div&&this.isDivLevelValid(e)&&(((null===(i=this.autoTrackConfig.collectTags)||void 0===i||null===(r=i.div)||void 0===r?void 0:r.maxLevel)||1)>1||this.isCollectableDiv(e)))return e;if(this.isStyleTag(a)&&this.autoTrackConfig.collectTags.div){var o=this.getCollectableParent(e);if(o&&this.isDivLevelValid(o))return o}return this.hasElement({event:(null==t?void 0:t.originalEvent)||t,element:e})||null}},{key:"isDivLevelValid",value:function(e){for(var t,n,i=(null===(t=this.autoTrackConfig.collectTags)||void 0===t||null===(n=t.div)||void 0===n?void 0:n.maxLevel)||1,r=e.getElementsByTagName("div"),a=r.length-1;a>=0;a--)if(this.getDivLevel(r[a],e)>i)return!1;return!0}},{key:"getDivLevel",value:function(e,t){var n=this.getElementPath(e,!0,t).split(" > "),i=0;return n.forEach((function(e){"div"===e&&i++})),i}},{key:"getElementPath",value:function(e,t,n){for(var i=[];e.parentNode&&D.check.isElement(e);){if(e.id&&!t&&/^[A-Za-z][-A-Za-z0-9_:.]*$/.test(e.id)){var r;i.unshift((null===(r=e.tagName)||void 0===r?void 0:r.toLowerCase())+"#"+e.id);break}if(n&&e===n){var a;i.unshift(null===(a=e.tagName)||void 0===a?void 0:a.toLowerCase());break}if(e===document.body){i.unshift("body");break}var o;i.unshift(null===(o=e.tagName)||void 0===o?void 0:o.toLowerCase()),e=e.parentNode}return i.join(" > ")}},{key:"isCollectableDiv",value:function(e){try{var t=e.children||[];if(0===(null==t?void 0:t.length))return!0;for(var n=0;n<t.length;n++){var i,r,a;if(1===t[n].nodeType){var o=null===(i=t[n].tagName)||void 0===i?void 0:i.toLowerCase(),s=(null===(r=this.autoTrackConfig.collectTags)||void 0===r||null===(a=r.div)||void 0===a?void 0:a.maxLevel)||1;if(!("div"===o&&s>1||this.isStyleTag(o)))return!1;if(!this.isCollectableDiv(t[n]))return!1}}return!0}catch(e){L.log(e)}return!1}},{key:"getCollectableParent",value:function(e){try{var t,n,i,r=e.parentNode,a=r?null===(t=r.tagName)||void 0===t?void 0:t.toLowerCase():"";if("body"===a)return!1;var o=(null===(n=this.autoTrackConfig.collectTags)||void 0===n||null===(i=n.div)||void 0===i?void 0:i.maxLevel)||1;if("div"===a&&(o>1||this.isCollectableDiv(r)))return r;if(r&&this.isStyleTag(a))return this.getCollectableParent(r)}catch(e){L.log(e)}return!1}},{key:"isStyleTag",value:function(e){var t,n,i;return!te.includes(e)&&!(null===(t=this.autoTrackConfig.collectTags)||void 0===t||null===(n=t.div)||void 0===n||null===(i=n.ignoreTags)||void 0===i||!i.includes(e))}},{key:"hasElement",value:function(e){var t;if(e.event){var n=e.event;t=n.path||(null==n?void 0:n._getPath())}else e.element&&(t=D.getDomElementInfo(e.element).getParents());var i=this.autoTrackConfig.trackAttr;if(D.check.isArray(t)&&t.length>0){var r,a=l(t);try{for(a.s();!(r=a.n()).done;){var o,s=r.value,c=s.tagName&&(null===(o=s.tagName)||void 0===o?void 0:o.toLowerCase());if(D.check.isElement(s)&&1===s.nodeType&&(this.isTrackList[c]||this.hasAttributes(s,i)))return s}}catch(e){a.e(e)}finally{a.f()}}}},{key:"hasAttribute",value:function(e,t){return e.hasAttribute?e.hasAttribute(t):e.attributes?!(null===(n=e.attributes[t])||void 0===n||!n.value):void 0;var n}},{key:"hasAttributes",value:function(e,t){if(D.check.isArray(t)){for(var n=!1,i=0;i<t.length;i++){if(this.hasAttribute(e,t[i])){n=!0;break}}return n}}},{key:"getPageXYInfo",value:function(e,t){if(!e)return{};function n(){return{scrollLeft:document.body.scrollLeft||document.documentElement.scrollLeft||0,scrollTop:document.body.scrollTop||document.documentElement.scrollTop||0}}function i(){if(document.documentElement.getBoundingClientRect){var e=t.getBoundingClientRect();return{targetEleX:e.left+n().scrollLeft||0,targetEleY:e.top+n().scrollTop||0}}}function r(e){return Number(Number(e).toFixed(3))}return function(e){var t=e.pageX||e.clientX+n().scrollLeft||e.offsetX+i().targetEleX||0,a=e.pageY||e.clientY+n().scrollTop||e.offsetY+i().targetEleY||0;return{H_page_x:r(t),H_page_y:r(a)}}(e)}},{key:"getClickElementInfo",value:function(e){var t=this.autoTrackConfig.isCollectInput(),n=this.getDomSelector(e),i=D.info.getElementInfo(e,t);return i.H_element_selector=n||"",i.H_element_path=this.getElementPath(e,!1),i}},{key:"getDomSelector",value:function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if(!e||!e.parentNode||!e.parentNode.children)return!1;var i=null===(t=e.nodeName)||void 0===t?void 0:t.toLowerCase();return e&&"body"!==i&&1===e.nodeType?(n.unshift(this.getSelector(e)),null!=e&&e.getAttribute("id")&&/^[A-Za-z][-A-Za-z0-9_:.]*$/.test(e.getAttribute("id"))?n.join(" > "):this.getDomSelector(e.parentNode,n)):(n.unshift("body"),n.join(" > "))}},{key:"getSelector",value:function(e){var t,n,i=null===(t=e.tagName)||void 0===t?void 0:t.toLowerCase(),r=-1;return 9!==(null==e||null===(n=e.parentNode)||void 0===n?void 0:n.nodeType)&&(r=this.getDomIndex(e)),null!=e&&e.getAttribute("id")&&/^[A-Za-z][-A-Za-z0-9_:.]*$/.test(e.getAttribute("id"))?"#"+e.getAttribute("id"):i+(~r?":nth-of-type("+(r+1)+")":"")}},{key:"getDomIndex",value:function(e){var t;if(!e.parentNode)return-1;for(var n=0,i=null===(t=e.tagName)||void 0===t?void 0:t.toLowerCase(),r=e.parentNode.children,a=0;a<r.length;a++){var o,s;if((null===(o=r[a])||void 0===o||null===(s=o.tagName)||void 0===s?void 0:s.toLowerCase())===i){if(r[a]===e)return n;n++}}return-1}}])}(),ie=D.check,re=ie.isArray,ae=ie.isBoolean,oe=ie.isDate;ie.isElement;var se=ie.isEmptyObject;ie.isFunction,ie.isJSONString;var ce=ie.isNumber,ue=ie.isObject,le=ie.isString;ie.isUndefined;var he=function(){return u((function e(t){s(this,e),this.HinaABTest=t,this.valueTypeList=["Number","String","Object","Boolean"],this.regName=/^((?!^distinct_id$|^account_id$|^original_id$|^time$|^properties$|^id$|^first_id$|^second_id$|^users$|^events$|^event$|^user_id$|^date$|^datetime$|^user_tag.*|^user_group.*)[a-zA-Z_][a-zA-Z\d_]*)$/i}),[{key:"valueType",value:function(e,t){switch(t){case"Number":return ce(e);case"String":return le(e);case"Object":return ue(e);case"Boolean":return ae(e);default:return!1}}},{key:"para",value:function(e,t,n){var i=this,r={verify_success:!0,para:null};return D.each(n,(function(n,a){if("essential"===n)switch(a){case"abtestExperimentId":void 0===t.abtestExperimentId&&(L.log("".concat(e,"方法调用失败,abtestExperimentId参数未正确配置!abtestExperimentId: ").concat(t.abtestExperimentId)),r.verify_success=!1);break;case"paramName":le(t.paramName)&&0!==t.paramName.length||(L.log("".concat(e,"方法调用失败,paramName参数未正确配置!paramName: ").concat(t.paramName)),r.verify_success=!1);break;case"valueType":le(t.valueType)&&i.valueTypeList.includes(t.valueType)||(L.log("".concat(e,"方法调用失败,valueType配置错误: ").concat(t.valueType)),r.verify_success=!1);break;case"defaultValue":void 0===t.defaultValue?(L.log("".concat(e,"方法调用失败,defaultValue参数未配置")),r.verify_success=!1):i.valueType(t.defaultValue,t.valueType)||(L.log("".concat(e,"方法调用失败,defaultValue类型必须与valueType一致!"),t.defaultValue,t.valueType),r.verify_success=!1);break;case"callback":D.check.isFunction(t.callback)||(L.log("".concat(e,"方法调用失败,callback参数未正确配置")),r.verify_success=!1);break;default:r.verify_success=!1}else if("not_essential"===n)switch(a){case"timeoutMilliseconds":t.timeoutMilliseconds=t.timeoutMilliseconds||i.HinaABTest.para.timeoutMilliseconds||i.HinaABTest.defaultPara.timeoutMilliseconds,(!ce(t.timeoutMilliseconds)||t.timeoutMilliseconds<=0)&&(i.HinaABTest.log("timeoutMilliseconds 参数错误: ".concat(t.timeoutMilliseconds)),t.timeoutMilliseconds=i.HinaABTest.para.timeoutMilliseconds),t.timeoutMilliseconds<200&&(t.timeoutMilliseconds=200);break;case"properties":t.properties=ue(t.properties)?t.properties:{};break;default:r.verify_success=!1}})),r.para=t,r}},{key:"resolveCustomProperties",value:function(e){var t=this,n={verify_success:!0,para:null},i=e.custom_properties;return!ue(i)||se(i)?(delete e.custom_properties,n.para=e,n):(D.each(i,(function(e,r){if((!le(r)||!t.regName.test(r)||r.length>100)&&(t.HinaABTest.log("属性名 [".concat(r,"] 无效")),n.verify_success=!1),re(e)){var a=!0;D.each(e,(function(e){le(e)||(a=!1)})),a||(t.HinaABTest.log("属性值类型只能是数组,但是只允许包含字符串项。属性 [".concat(r,"] 的值 ").concat(JSON.stringify(e)," 无效")),n.verify_success=!1)}else le(e)||ce(e)||ae(e)||re(e)||oe(e)||(t.HinaABTest.log("属性 [".concat(r,"] 的值 [").concat(JSON.stringify(e),"] 无效")),n.verify_success=!1);oe(e)?i[r]=D.formatDate(e):le(e)?i[r]=e:i[r]=JSON.stringify(e)})),e.custom_properties=i,n.para=e,n)}}])}(),de=function(){return u((function e(t){s(this,e),this.HinaABTest=t}),[{key:"init",value:function(e,t){var n=this;this.HinaABTest.fetchData.init(e,t);!function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.visible,n=void 0===t?function(){}:t,i=e.hidden,r=void 0===i?function(){}:i,a=[{hidden:"hidden",change:"visibilitychange"},{hidden:"mozHidden",change:"mozvisibilitychange"},{hidden:"msHidden",change:"msvisibilitychange"},{hidden:"webkitHidden",change:"webkitvisibilitychange"}].find((function(e){return e.hidden in document}))||{},o=function(){document[a.hidden]?r():n()};a.hidden?document.addEventListener(a.change,o,!0):(window.addEventListener("focus",n,!0),window.addEventListener("blur",r,!0))}({visible:function(){L.log("页面显示"),n.HinaABTest.fetchData.start()},hiddenFun:function(){L.log("页面隐藏"),n.HinaABTest.fetchData.stop()}}),D.mitt.on("changeDistinctId",(function(){n.HinaABTest.fetchData.clearExpsCache(),n.HinaABTest.updateStorage(),n.HinaABTest.fetchData.getServerData()}))}}])}(),fe=D.check,ge=fe.isArray,pe=fe.isObject,ve=fe.isString;var me=function(){return u((function t(){s(this,t),h(this,"dealResponseData",(function(t,n){D.check.isObject(t)?"SUCCESS"===e.status?D.isArray(t.results)&&(this.fetchData.updateExpsCache(t),this.updateLocalData(n)):"FAILED"===t.status&&this.log("获取试验失败:error_type:".concat(t.error_type,",error:").concat(t.error)):this.log("试验数据解析失败,response:",t)})),this.libVersion="1.0.0",this.pluginVersion="1.0.0",this.pluginName="HinaABTest",this.isShowAccountId=!1,this.isInit=!1,this.para={},this.defaultPara={url:"",path:"",projectKey:"",timeoutMilliseconds:3e3,updateInterval:6e5,collectBridgeStatus:!0,encryptCookie:!1},this.state={platform:"",storage:{name:"hina_webjs_sdk_abtest",latestName:"hina_webjs_sdk_abtest_latest"}},this.bridgeState="",this.codeExpData={},this.results=[],this.outList=[],this.triggerList={},this.outTriggerList={},this.defaultTrackConfig={triggerSwitch:!0,propertySetSwitch:!1,triggerContentExt:["abtest_experiment_version","abtest_experiment_result_id"]},this.trackConfig={},this.updateTime=null,this.hd=null,this.normalStore=new ye(this),this.verifyStore=new he(this)}),[{key:"init",value:function(e,t){var n=this;if(this.isInit)return L.log("A/B Testing SDK 重复初始化!只有第一次初始化有效!"),!1;var i=D.getQueryParam(location.href,"showAccountId");if(!this.isShowAccountId&&"true"===i){var r=W.getAccountId();console.log("%cAccountId","color: #26bfa5;",r),this.isShowAccountId=!0}this.isInit=!0;n.initHinaABTest(e,t)}},{key:"initHinaABTest",value:function(e,t){return e?(this.hd=e,function(e){e._.extend(D,e._)}(e),D.check.isObject(t)?(D.localStorage.isSupport()||L.log("A/B Testing 初始化失败,浏览器不支持 localStorage"),this.abtestingPara=t,this.fetchData=new ke(this),this.store=new de(this),this.initTest(),!0):(L.log("A/B Testing SDK 初始化失败,请传入正确的初始化参数! para:",t),!1)):(console.error("A/B Testing 初始化失败,Web JS SDK 没有初始化完成"),!1)}},{key:"initTest",value:function(){this.normalStore.init(this.abtestingPara),this.registerProperty()}},{key:"asyncFetchABTest",value:function(){L.error("asyncFetchABTest 调用失败,A/B Testing 未初始化")}},{key:"fastFetchABTest",value:function(){L.error("fastFetchABTest 调用失败,A/B Testing 未初始化")}},{key:"fetchCacheABTest",value:function(){L.error("fetchCacheABTest 调用失败,A/B Testing 未初始化")}},{key:"searchLocalExp",value:function(e,t){return(this.codeExpData[e]||[]).find((function(e){return e.name===t}))}},{key:"getExpResult",value:function(e,t){var n=e.defaultValue,i=t||this.searchLocalExp(e.abtestExperimentId,e.paramName);return D.check.isObject(i)?D.check.isObject(i.jsConfig)&&(i.jsConfig.type===e.valueType?n=i.jsConfig.value:L.log("实验结果类型与代码期望类型不一致,paramName:".concat(e.paramName,",当前返回类型为:").concat(i.jsConfig.type,",代码期望类型为:").concat(e.valueType))):L.log("本地数据未查询到实验数据,实验参数名称:".concat(e.paramName)),this.trackOutTestTrigger("CODE",e),n}},{key:"trackOutTestTrigger",value:function(e,t){var n=this.outList,i=!1,r={},a=this;if(ge(n)&&n.length>0&&(D.each(n,(function(n){pe(n)&&!i&&("CODE"===e&&pe(n.variables)?D.each(n.variables,(function(e){var o=a.getRelativeValue(e.value,e.type);!i&&o&&pe(e)&&t.paramName===e.name&&o.type===t.valueType&&(i=!0,r=n)})):"LINK"===e&&ve(n.control_link)&&ve(n.link_match_type)?("REGEXP"===n.link_match_type?D.checkUrlIsRegexp(n.control_link,n.regexp_flags):D.checkUrlIsMatch(n.control_link,n.link_match_type))&&(i=!0,r=n):"VISUAL"===e&&ve(n.control_link)&&ve(n.link_match_type)&&D.checkUrlIsMatch(n.control_link,n.link_match_type)&&(i=!0,r=n))})),i)){var o=a.hd.store.getDistinctId();r.subject_id&&r.subject_name&&(o="".concat(r.subject_name).concat(r.subject_id)),a.sendTriggerEvent("outTriggerList",o,r,{})}}},{key:"registerProperty",value:function(){if(this.trackConfig.propertySetSwitch){var e=this.hd.store.getUnionId(),t=["USER".concat(e.login_id||e.anonymous_id),"DEVICE".concat(e.anonymous_id)],n=this.hd.bridge.is_verify_success?this.getLatestSubject():[],i=[],r=[];D.each(this.triggerList,(function(e,r){(t.includes(r)||n.includes(r))&&D.check.isArray(e)&&D.each(e,(function(e){e.result_id&&i.push(e.result_id)}))})),D.check.isArray(this.results)&&D.each(this.results,(function(e){e.abtest_experiment_result_id&&r.push(e.abtest_experiment_result_id)})),i.length>0&&this.hd.registerPage({abtest_result:i}),r.length>0&&this.hd.registerPage({abtest_dispatch_result:r})}else this.hd.clearPageRegister(["abtest_result","abtest_dispatch_result"])}},{key:"getRelativeValue",value:function(e,t){var n={},i={INTEGER:function(e){var t=parseFloat(e);isNaN(t)?L.log("原始数据 INTEGER 类型解析异常",e):(n.value=t,n.type="Number")},STRING:function(e){D.check.isString(e)?(n.value=e,n.type="String"):L.log("原始数据 STRING 类型解析异常",e)},JSON:function(e){function t(t){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(e){try{var t=JSON.parse(e);D.check.isObject(t)?(n.value=t,n.type="Object"):L.log("原始数据 JSON 类型解析异常",e)}catch(t){L.log("原始数据 JSON 类型解析异常",e)}})),BOOLEAN:function(e){"true"===e.toLocaleLowerCase()?(n.value=!0,n.type="Boolean"):"false"===e.toLocaleLowerCase()?(n.value=!1,n.type="Boolean"):L.log("原始数据 BOOLEAN 类型解析异常",e)}};try{i[t]?i[t](e):L.log("试验数据类型解析失败","".concat(t,", ").concat(e))}catch(n){L.log(n,e,t)}return n}},{key:"updateStorage",value:function(e){var t=(new Date).getTime(),n={result:this.results,updateTime:t,triggerList:this.triggerList,distinct_id:e||this.hd.store.getAccountId(),outTriggerList:this.outTriggerList,outList:this.outList,trackConfig:this.trackConfig},i=JSON.stringify(n);D.localStorage.set(this.state.storage.name,i)}},{key:"dealCodeExpResponseData",value:function(e,t){D.check.isObject(e)?"SUCCESS"===e.status?D.check.isArray(e.results)&&(this.fetchData.updateExpsCache(e),this.updateCodeExpLocalData(t)):"FAILED"===e.status&&L.log("获取实验失败:error_type: ".concat(e.error_ype,", error: ").concat(e.error)):L.log("实验数据解析失败,response: ".concat(e))}},{key:"updateCodeExpLocalData",value:function(e){this.analyzeCodeExpData(),this.updateStorage(e)}},{key:"analyzeCodeExpData",value:function(){D.check.isArray(this.results)&&(this.resolveVariables(),this.registerProperty())}},{key:"resolveVariables",value:function(){var e=this;this.codeExpData={};var t=D.check.isObject,n=D.check.isArray;this.results.forEach((function(i){t(i)&&i.variables&&n(i.variables)&&(e.codeExpData[i.abtest_experiment_id]=i.variables,i.variables.forEach((function(n){t(n)&&n.name&&n.value&&(n.jsConfig=e.getRelativeValue(n.value,n.type))})))}))}}])}(),ye=function(){return u((function e(t){s(this,e),this.HinaABTest=t,this.para=t.para}),[{key:"init",value:function(e){if(!this.setPara(e))return!1;this.bridgeState="ab_no_host_bridge";var t=navigator.userAgent;this.HinaABTest.state.platform=/Android|webOS|iPhone|iPod|BlackBerry/i.test(t)?"H5":"Web",L.log("A/B Testing SDK 初始化成功,试验 URL:",e.url),this.HinaABTest.store.init(this.getResultFromServer,this)}},{key:"setPara",value:function(e){var t=D.getQueryParam(e.url,"project-key");if(!t)return L.log("A/B Testing SDK 初始化失败,请使用正确的 URL(必须包含 project-key)!"),!1;e.projectKey=t;var n=this.HinaABTest.verifyStore.para("A/B Testing SDK 初始化",e,{timeoutMilliseconds:"not_essential"});return this.HinaABTest.para=f(f({},this.HinaABTest.defaultPara),n.para),D.check.isBoolean(this.HinaABTest.para.collectBridgeStatus)||(this.HinaABTest.para.collectBridgeStatus=!0),D.check.isNumber(this.HinaABTest.para.updateInterval)||(this.HinaABTest.para.updateInterval=6e5),this.HinaABTest.hd.config.encryptCookie&&(this.HinaABTest.para.encryptCookie=!0),this.HinaABTest.hd.config.sdkId&&(this.HinaABTest.state.storage.name+="_".concat(this.HinaABTest.hd.config.sdkId)),!0}},{key:"asyncFetch",value:function(e){var t=this,n=this;this.getCodeExpResultFromServer({para:e,suc:function(i){if(D.check.isObject(i)&&"SUCCESS"===i.status){var r=n.HinaABTest.getExpResult(e);e.callback(r)}else e.callback(e.defaultValue);t.sendHaData(e)},err:function(t){e.callback(e.defaultValue)}})}},{key:"createRequestData",value:function(e){var t=this.HinaABTest,n=t.hd.storeState,i="";D.check.isEmptyObject(n)||(i=W.getAnonymousId());var r={anonymous_id:i,platform:t.state.platform,abtest_lib_version:t.state.libVersion,properties:{H_is_first_day:$()}};return D.check.isObject(e.properties)&&(r.properties=f(f({},r.properties),e.properties)),D.check.isObject(e.custom_properties)&&(r.customProperties=f({},e.customProperties),r.paramName=e.paramName),W.getFirstId()&&(r.login_id=W.getAccountId()),r}},{key:"getCodeExpResultFromServer",value:function(e){this.getResultFromServer(e,!0)}},{key:"getResultFromServer",value:function(e,t){var n=this,i=D.check.isObject(e)&&e.para||{},r=e.suc,a=e.err,o=this.createRequestData(i);L.log("向服务器发起试验请求");var s=W.getAccountId();M({url:this.HinaABTest.abtestingPara.url,type:"POST",data:JSON.stringify(o),credentials:!1,contentType:"application/json",projectKey:this.HinaABTest.abtestingPara.projectKey,timeout:i.timeoutMilliseconds||this.HinaABTest.para.timeoutMilliseconds,cors:!0,success:function(e){t?n.HinaABTest.dealCodeExpResponseData(e,s):n.HinaABTest.dealResponseData(e,s),r&&r(e),n.HinaABTest.fetchData.setNextFetch()},error:function(e){L.log("服务器请求发送失败",e),a&&a(),n.HinaABTest.fetchData.setNextFetch()}})}},{key:"asyncFetchABTest",value:function(e){if(!D.check.isObject(e))return L.log("asyncFetchABTest 调用失败,参数未正确配置"),!1;var t=this.HinaABTest.verifyStore.para("asyncFetchABTest",e,{paramName:"essential",valueType:"essential",defaultValue:"essential",callback:"essential",timeoutMilliseconds:"not_essential",properties:"not_essential"});if(t.verify_success){e=t.para;var n=this.HinaABTest.verifyStore.resolveCustomProperties(e);n.verify_success?(e=n.para,this.HinaABTest.normalStore.asyncFetch(e)):e.callback(e.defaultValue)}else e.callback(e.defaultValue)}},{key:"fetchCacheABTest",value:function(e){if(D.check.isObject(e)){var t=this.HinaABTest.verifyStore.para("fetchCacheABTest",e,{paramName:"essential",valueType:"essential",defaultValue:"essential"});return t.verify_success?this.HinaABTest.getExpResult(t.para):void 0}L.log("fetchCacheABTest 调用失败,参数未正确配置")}},{key:"fastFetchABTest",value:function(e){if(!D.check.isObject(e))return L.log("fastFetchABTest 调用失败,参数未正确配置"),!1;var t=this.HinaABTest.verifyStore.para("fastFetchABTest",e,{abtestExperimentId:"essential",paramName:"essential",valueType:"essential",defaultValue:"essential",callback:"essential",timeoutMilliseconds:"not_essential",properties:"not_essential"});if(t.verify_success){e=t.para;var n=this.HinaABTest.searchLocalExp(e.abtestExperimentId,e.paramName);if(D.check.isObject(n)){var i=this.HinaABTest.getExpResult(e,n);e.callback(i),this.sendHaData(e)}else{var r=this.HinaABTest.verifyStore.resolveCustomProperties(e);r.verify_success?(e=r.para,L.log("fastFetchABTest 缓存中未读取到数据,发起请求"),this.HinaABTest.normalStore.asyncFetch(e)):(e.callback(e.defaultValue),this.sendHaData(e))}}}},{key:"sendHaData",value:function(e){var t=e.abtestExperimentId,n=this.HinaABTest.results.find((function(e){return e.abtest_experiment_id.toString()===t.toString()})).abtest_experiment_group_id||null;t&&n&&this.HinaABTest.hd.track("H_ABTestTrigger",{H_abtest_experiment_id:t,H_abtest_experiment_group_id:n})}}])}(),ke=function(){return u((function e(t){s(this,e),this.timer=null,this.method=null,this.context=null,this.HinaABTest=t}),[{key:"init",value:function(e,t){this.method=e,this.context=t,this.start(!0)}},{key:"updateExpsCache",value:function(e){var t=e.results,n=void 0===t?[]:t,i=e.triggerList,r=e.outList,a=e.outTriggerList,o=e.trackConfig,s=this.HinaABTest;s.results=n,D.check.isArray(r)&&(s.outList=r),D.check.isObject(i)&&(s.triggerList=i),D.check.isObject(a)&&(s.outTriggerList=a),n.forEach((function(e){pe(e)&&e.variables&&ge(e.variables)&&(s.codeExpData[e.abtest_experiment_id]=e.variables,e.variables.forEach((function(e){pe(e)&&e.name&&e.value&&(e.jsConfig=s.getRelativeValue(e.value,e.type))})))})),s.trackConfig=D.check.isObject(o)?o:s.defaultTrackConfig}},{key:"clearExpsCache",value:function(){var e=this.HinaABTest;e.codeExpData={},e.results=[],this.outList=[],this.trackConfig=e.defaultTrackConfig}},{key:"setNextFetch",value:function(e){var t=this,n=this.HinaABTest.para.updateInterval;this.clearFetchTimer(this.timer),this.timer=setTimeout((function(){t.getServerData(e)}),n)}},{key:"clearFetchTimer",value:function(){clearTimeout(this.timer),this.timer=null}},{key:"getServerData",value:function(e){var t=this.HinaABTest;this.method.call(this.context,{suc:function(n){e&&"ab_bridge_ok"===t.bridgeState&&(n=n.data)},err:function(){}})}},{key:"start",value:function(e){var t=Date.now(),n=D.getStorageData(this.HinaABTest.state.storage.name,this.HinaABTest.hd),i=this.HinaABTest.hd.store.getAccountId();if(n&&D.check.isObject(n)&&n.distinct_id===i){var r=n.updateTime;if(r&&D.check.isNumber(r)&&t-r>0&&t-r<this.HinaABTest.para.updateInterval){e&&this.updateExpsCache(n),L.log("数据未更新",r,t);var a=t-r,o=this.HinaABTest.para.updateInterval-a;this.setNextFetch(o)}else L.log("缓存数据超时",r,t),this.getServerData(e)}else{var s=this.HinaABTest.updateTime;s&&D.check.isNumber(s)&&t-s>0&&t-s<this.HinaABTest.para.updateInterval?L.log("数据未更新",s,t):this.getServerData(e)}}},{key:"stop",value:function(){L.log("清空拉取定时器"),this.clearFetchTimer()}}])}();window.MutationObserver||(window.MutationObserver=function(e){var t=this;this.callback=e,this.elements=[],this.observer=function(e){t.callback([{type:"childList",addedNodes:[e.target]}])}},MutationObserver.prototype.observe=function(e,t){this.elements.push(e),e.addEventListener("DOMNodeInserted",this.observer)},MutationObserver.prototype.disconnect=function(){var e=this;this.elements.forEach((function(t){t.removeEventListener("DOMNodeInserted",e.observer)}))});var _e=window.location,be=function(){return u((function e(){s(this,e),this.ctx={},this.option={},this.isInited=!1}),[{key:"init",value:function(e,t){this.ctx=e,this.option=t,this.isInited||(this.isInited=!0,D.check.isObject(t)&&D.check.isArray(t.linker)&&t.linker.length>0?(this.setRefferId(t),this.addClickListen(),this.option=function(e){for(var t=e.length,n=[],i=0;i<t;i++)/[A-Za-z0-9]+\./.test(e[i].part_url)&&D.check.isBoolean(e[i].after_hash)?n.push(e[i]):L.log("The configuration of linker "+(i+1)+" is not supported.Please check format");return n}(t.linker)):L.log("siteLinker plugin: Please configure the linker parameter"))}},{key:"getPartUrl",value:function(e){var t=this.option.length;if(t)for(var n=0;n<t;n++)if(e.indexOf(this.option[n].part_url)>-1)return!0;return!1}},{key:"getPartHash",value:function(e){var t=this.option.length;if(t)for(var n=0;n<t;n++)if(e.indexOf(this.option[n].part_url)>-1)return this.option[n].after_hash;return!1}},{key:"getCurrentId",value:function(){var e=this.ctx.store.getAccountId()||"",t=this.ctx.store.getFirstId()||""?"f"+e:"d"+e;return D.encodeURIComponent(t)}},{key:"rewriteUrl",value:function(e,t){var n=/([^?#]+)(\?[^#]*)?(#.*)?/.exec(e),i="";if(n){var r,a=n[1]||"",o=n[2]||"",s=n[3]||"",c="_hnsdk="+this.getCurrentId();if(this.getPartHash(e))r=s.indexOf("_hnsdk"),i=s.indexOf("?")>-1?r>-1?a+o+"#"+s.substring(1,r)+u(s.substring(r,s.length)):a+o+"#"+s.substring(1)+"&"+c:a+o+"#"+s.substring(1)+"?"+c;else r=o.indexOf("_hnsdk"),i=/^\?(\w)+/.test(o)?r>-1?a+"?"+u(o.substring(1))+s:a+"?"+o.substring(1)+"&"+c+s:a+"?"+o.substring(1)+c+s;return t&&(t.href=i),i}function u(e){var t=e.split("&"),n=[];return D.each(t,(function(e){e.indexOf("_hnsdk=")>-1?n.push(c):n.push(e)})),n.join("&")}}},{key:"getUrlId",value:function(){var e=_e.href.match(/_hnsdk=([aufd][^\?\#\&\=]+)/);return D.check.isArray(e)&&e[1]?D.decodeURIComponent(e[1]):""}},{key:"setRefferId",value:function(e){var t=this.ctx.store.getAccountId(),n=this.getUrlId();if(""===n)return!1;var i="d"===n.substring(0,1);(n=n.substring(1))!==t&&(i?(this.ctx.setDeviceUId(n,!0),this.ctx.store.getFirstId()&&this.ctx.sendRequest({anonymous_id:n,account_id:t,type:"track_signup",event:"H_SignUp",properties:{}})):this.ctx.store.getFirstId()&&!e.re_login||this.ctx.setUserUId(n))}},{key:"addClickListen",value:function(){var e=this,t=function(t){var n,i,r,a,o=t.target,s=null===(n=o.tagName)||void 0===n?void 0:n.toLowerCase(),c=o.parentNode,u=null==c||null===(i=c.tagName)||void 0===i?void 0:i.toLowerCase();if("a"===s&&o.href||"a"===u&&c.href){"a"===s&&o.href?(r=o.href,a=o):(r=c.href,a=c);var l=D.URL(r).protocol;"http:"!==l&&"https:"!==l||e.getPartUrl(r)&&e.rewriteUrl(r,a)}};D.addEvent(document,"mousedown",t),window.PointerEvent&&"maxTouchPoints"in window.navigator&&window.navigator.maxTouchPoints>=0&&D.addEvent(document,"pointerdown",t)}}])}(),Se=function(){return u((function e(){s(this,e),this.ctx={},this.option={},this.isInited=!1}),[{key:"init",value:function(e,t){var n=this;this.ctx=e,this.option=t;var i=function(){var e=0,t=window.performance||window.webkitPerformance||window.msPerformance||window.mozPerformance,r=window.location,a={H_url:r.href,H_title:document.title,H_url_path:r.pathname,H_url_hash:r.hash,H_referrer:D.getReferrer(null,!0)};if(t){if(e=n.getDuration(t)||n.getDurationCompatible(t),n.getPageSize(t,a),e>0){var o,s,c=1800;if(D.check.isObject(n.option)&&null!==(o=n.option)&&void 0!==o&&o.max_duration)c=null===(s=n.option)||void 0===s?void 0:s.max_duration;e=Number((e/1e3).toFixed(3)),(!D.check.isNumber(c)||c<=0||e<=c)&&(a.event_duration=e)}n.isInited||(n.ctx.track("H_WebPageLoad",a),n.isInited=!0),window.removeEventListener&&window.removeEventListener("load",i)}else L.log("your browser not support performance API")};"complete"===document.readyState?i():window.addEventListener&&window.addEventListener("load",i)}},{key:"getPageSize",value:function(e,t){if(e.getEntries&&D.check.isFunction(e.getEntries)){for(var n=e.getEntries(),i=0,r=0;r<n.length;r++)"transferSize"in n[r]&&(i+=n[r].transferSize);D.check.isNumber(i)&&i>=0&&i<10737418240&&(t.H_page_resource_size=Number((i/1024).toFixed(3)))}}},{key:"getDurationCompatible",value:function(e){var t=0;if(e.timing){var n=e.timing;0!==n.fetchStart&&D.check.isNumber(n.fetchStart)&&0!==n.domContentLoadedEventEnd&&D.check.isNumber(n.domContentLoadedEventEnd)?t=n.domContentLoadedEventEnd-n.fetchStart:L.log("performance data parsing exception")}return t}},{key:"getDuration",value:function(e){var t=0;D.check.isFunction(e.getEntriesByType)&&(t=((e.getEntriesByType("navigation")||[{}])[0]||{}).domContentLoadedEventEnd||0);return t}}])}(),Te=function(){return u((function e(){s(this,e),this.startTime=D.now(),this.currentPageUrl=document.referrer,this.url=_e.href,this.title=document.title||"",this.pageShowStatus=!0,this.pageHiddenStatus=!1,this.timer=null,this.heartbeatIntervalTime=5e3,this.heartbeatIntervalTimer=null,this.pageId=null,this.maxDuration=432e3,this.storageName="hinasdk_pageleave_"}),[{key:"init",value:function(e,t){if(this.ctx=e,t){this.option=t;var n=t.heartbeat_interval_time;n&&D.check.isNumber(1*n)&&1*n>0&&(this.heartbeatIntervalTime=1e3*n);var i=t.max_duration;i&&D.check.isNumber(1*i)&&1*i>0&&(this.maxDuration=i)}this.pageId=Number(String(D.getRandom()).slice(2,5)+String(D.getRandom()).slice(2,4)+String(D.now()).slice(-4)),this.addPageLeaveEventListener(),document.hidden?this.pageShowStatus=!1:this.addHeartBeatInterval()}},{key:"refreshPageEndTimer",value:function(){var e=this;this.timer&&(clearTimeout(this.timer),this.timer=null),this.timer=setTimeout((function(){e.pageHiddenStatus=!1}),5e3)}},{key:"hiddenStatusHandler",value:function(){clearTimeout(this.timer),this.timer=null,this.pageHiddenStatus=!1}},{key:"pageStartHandler",value:function(){this.startTime=D.now(),!0===document.hidden?this.pageShowStatus=!1:this.pageShowStatus=!0,this.url=_e.href,this.title=document.title}},{key:"pageEndHandler",value:function(){if(!this.pageHiddenStatus){var e=this.getPageLeaveProperties();this.pageShowStatus||delete e.event_duration,this.pageShowStatus=!1,this.pageHiddenStatus=!0,this.isCollectUrl(this.url)&&this.ctx.track("H_WebPageLeave",e),this.refreshPageEndTimer(),this.delHeartBeatData()}}},{key:"addPageLeaveEventListener",value:function(){this.addPageStartListener(),this.addPageSwitchListener(),this.addSinglePageListener(),this.addPageEndListener()}},{key:"addPageStartListener",value:function(){var e=this;"onpageshow"in window&&D.addEvent(window,"pageshow",(function(){e.pageStartHandler(),e.hiddenStatusHandler()}))}},{key:"addPageSwitchListener",value:function(){var e=this;D.listenPageState({visible:function(){e.pageStartHandler(),e.hiddenStatusHandler(),e.addHeartBeatInterval()},hidden:function(){e.url=_e.href,e.title=document.title,e.pageEndHandler(),e.stopHeartBeatInterval()}})}},{key:"addSinglePageListener",value:function(){var e=this;D.mitt.prepend("urlChange",(function(t){t!==_e.href&&(e.url=t,e.pageEndHandler(),e.stopHeartBeatInterval(),e.currentPageUrl=t,e.pageStartHandler(),e.hiddenStatusHandler(),e.addHeartBeatInterval())}))}},{key:"addPageEndListener",value:function(){var e=this;D.each(["pagehide","beforeunload","unload"],(function(t){"on"+t in window&&D.addEvent(window,t,(function(){e.pageEndHandler(),e.stopHeartBeatInterval()}))}))}},{key:"addHeartBeatInterval",value:function(){D.localStorage.isSupport()&&this.startHeartBeatInterval()}},{key:"startHeartBeatInterval",value:function(){var e=this;this.heartbeatIntervalTimer&&this.stopHeartBeatInterval();var t=!0;this.isCollectUrl(this.url)||(t=!1),t&&(this.heartbeatIntervalTimer=setInterval((function(){e.saveHeartBeatData()}),this.heartbeatIntervalTime),this.saveHeartBeatData("first")),this.reissueHeartBeatData()}},{key:"reissueHeartBeatData",value:function(){for(var e=D.localStorage.length-1;e>=0;e--){var t=D.localStorage.key(e);if(t&&t!==this.storageName+this.pageId&&t.indexOf(this.storageName)>-1){var n=D.readObjectVal(t);D.check.isObject(n)&&D.now()-n.time>n.heartbeat_interval_time+5e3&&(delete n.heartbeat_interval_time,this.ctx.sendRequest(n),this.delHeartBeatData(t))}}}},{key:"stopHeartBeatInterval",value:function(){this.heartbeatIntervalTimer&&clearInterval(this.heartbeatIntervalTimer),this.heartbeatIntervalTimer=null}},{key:"saveHeartBeatData",value:function(e){var t=this.getPageLeaveProperties();t.H_time=D.now(),"first"===e&&(t.event_duration=3);var n=Y({type:"track",event:"H_WebPageLeave",properties:t},this.ctx);n.heartbeat_interval_time=this.heartbeatIntervalTime,D.saveObjectVal(this.storageName+this.pageId,n)}},{key:"delHeartBeatData",value:function(e){D.localStorage.isSupport()&&D.localStorage.remove(e||this.storageName+this.pageId)}},{key:"isCollectUrl",value:function(e){var t,n;return!D.check.isFunction(null===(t=this.option)||void 0===t?void 0:t.isCollectUrl)||(!D.check.isString(e)||(null===(n=this.option)||void 0===n?void 0:n.isCollectUrl(e)))}},{key:"getPageLeaveProperties",value:function(){var e,t,n,i=(D.now()-this.startTime)/1e3;(!D.check.isNumber(i)||i<0||i>this.maxDuration)&&(i=0),i=Number(i.toFixed(3));var r=D.getReferrer(this.currentPageUrl),a=(null===(e=document.documentElement)||void 0===e?void 0:e.scrollTop)||window.pageYOffset||(null===(t=document.body)||void 0===t?void 0:t.scrollTop)||0;a=Math.round(a)||0;var o={H_title:this.title,H_url:this.url,H_url_path:D.URL(this.url).pathname,H_url_hash:D.URL(this.url).hash,H_referrer_host:r?D.getHostname(r):"",H_referrer:r,H_viewport_position:a};return i&&(o.event_duration=i),o=D.extend(o,null===(n=this.option)||void 0===n?void 0:n.custom_props)}}])}(),we={SiteLinker:be,PageLoad:Se,PageLeave:Te,HinaABTest:me},Ce={name:"",showLog:!1,autoTrackConfig:{clickAutoTrack:!1,stayAutoTrack:!1,pageviewAutoTrack:!1,pageLeaveAutoTrack:!1},stayAutoTrackConfig:{},imgUseCrossOrigin:!1,isSinglePage:!1,maxStringLength:1024,batchSend:!1,appJsBridge:!1,sendType:"image",dataSendTimeout:3e3,isTrackDeviceId:!1,presetProperties:{latest_utm:!0,latest_utm_source:!0,latest_traffic_source_type:!0,latest_search_keyword:!0,latest_referrer:!0,url:!0,title:!0}},He=function(){return u((function e(){return s(this,e),e.instance||(e.instance=this,this.config={},this.initialized=!1,this._=D),e.instance}),[{key:"setConfig",value:function(e){D.check.isObject(e)&&D.extend(this.config,e)}},{key:"getConfig",value:function(e){return this.config[e]}},{key:"init",value:function(e){if(D.check.isEmptyObject(this.config)){if(this.setConfig(D.extend({},Ce,e)),L.showLog=this.getConfig("showLog"),U.serverUrl=this.getConfig("serverUrl"),!U.checkServerUrl(this.getConfig.serverUrl))return;D.initUrlChange(),W.load(this.config),Z(this.config),this.store=W;var t=this.getConfig("sendType");["image","ajax","beacon"].includes(t)||this.setConfig({sendType:"image"}),(!0===this.getConfig("batchSend")||D.check.isObject(this.getConfig("batchSend")))&&(this.batchSender=new K(this.config),this.batchSender.batchInterval());var n=this.getConfig("autoTrackConfig"),i=this.getConfig("stayAutoTrackConfig"),r=n.pageviewAutoTrack,a=n.pageLeaveAutoTrack,o=new ne(n,i,this);this.autoTrackInstance=o,o.initWebClick(),o.initWebStay(),"auto"===r?o.autoTrack():("singlePage"===r||this.getConfig("isSinglePage"))&&(this.config.isSinglePage=!0,o.listenSinglePage()),a&&(D.check.isObject(a)?this.use("PageLeave",a):this.use("PageLeave")),this.initialized=!0,L.log("hinaSDK initialized successfully"),D.mitt.emit("hasInit")}else L.log("hinaSDK has been initialized")}},{key:"sendRequest",value:function(e,t){if((e=Y(e,this)).send_time=D.now(),L.log(e),this.getConfig("appJsBridge")){var n=window.Hina_Cloud_H5_Bridge||{};if(D.check.isObject(n)&&n.track)return n.track(e.event,e.type,JSON.stringify(e)),D.check.isFunction(t)&&t(),void L.log("The data has been sent to the Android side");if("iOS"===D.info.os()){var i,r,a=null===(i=window.webkit)||void 0===i||null===(r=i.messageHandlers)||void 0===r?void 0:r.hinaNativeTracker;if(null!=a&&a.postMessage){var o=JSON.stringify({eventName:e.event,eventType:e.type,properties:e});return a.postMessage(o),D.check.isFunction(t)&&t(),void L.log("The data has been sent to the iOS side")}}L.log("The app JSBridge data transmission has failed.")}if(this.getConfig("batchSend"))new K(this.config).add(e);else{D.check.isString(e)||(e=JSON.stringify(e));var s=D.base64Encode(e),c="crc="+D.hashCode(s),u="data="+D.encodeURIComponent(s)+"&ext="+D.encodeURIComponent(c),l=this.getConfig("sendType"),h={callback:this.getConfig("globalCallback"),data:u,serverUrl:this.getConfig("serverUrl"),dataSendTimeout:this.getConfig("dataSendTimeout")};switch(l){case"ajax":new q(h).run();break;case"beacon":new z(h).run();break;default:new V(D.extend(h,{imgUseCrossOrigin:this.getConfig("imgUseCrossOrigin")})).run()}}}},{key:"quick",value:function(e){for(var t={autoTrack:this.autoTrackInstance.autoTrack,autoTrackSinglePage:this.autoTrackInstance.autoTrackSinglePage},n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];return t[e].call(this.autoTrackInstance,i)}},{key:"track",value:function(e,t,n){var i=D.check.isFunction(n)?n:function(){};D.check.isString(e)&&(D.check.isObject(t)||D.check.isUndefined(t))?this.sendRequest({type:"track",event:e,properties:t},i):L.log("eventName must be a sting and properties must be an object")}},{key:"setUserUId",value:function(e,t){if(e&&""!==e)if(D.check.isNumber(e)||D.check.isString(e)){e=String(e);var n=this.store.getFirstId(),i=this.store.getAccountId(),r=this.store.getAnonymousId(),a=this.store.getDeviceId();e!==i?(n||this.store.set("firstId",r||a),this.store.setAccountId(e),this.sendRequest({account_id:this.store.getAccountId(),type:"track_signup",event:"H_SignUp",properties:{}},t)):console.log("setUserUId: uid is equal to account_id, , failed to execute setUserUId")}else L.log("setUserUId: uid must be string or number");else L.log("setUserUId: uid is empty")}},{key:"getDeviceUId",value:function(){return this.store.getAnonymousId()}},{key:"setDeviceUId",value:function(e,t){var n=this.store.getFirstId();if(D.check.isUndefined(e)){var i=D.UUID();n?this.store.set("firstId",i):this.store.setAccountId(i)}else(D.check.isNumber(e)||D.check.isString(e))&&(e=String(e),!0===t?n?this.store.set("firstId",e):this.store.set("accountId",e):n?this.store.change("firstId",e):this.store.change("accountId",e))}},{key:"userSet",value:function(e,t){D.check.isObject(e)&&!D.check.isEmptyObject(e)&&this.sendRequest({type:"user_set",properties:e},t)}},{key:"userSetOnce",value:function(e,t){D.check.isObject(e)&&!D.check.isEmptyObject(e)&&this.sendRequest({type:"user_setOnce",properties:e},t)}},{key:"userAdd",value:function(e,t){D.check.isString(e)&&(e=h({},e,1));D.check.isObject(e)&&!D.check.isEmptyObject(e)&&function(e){for(var t in e)if(t in e&&!/-*\d+/.test(String(e[t])))return L.log("userAdd: value is must be number"),!1;return!0}(e)&&this.sendRequest({type:"user_add",properties:e},t)}},{key:"userUnset",value:function(e,t){var n={};D.check.isString(e)&&(e=[e]);D.check.isArray(e)?(D.each(e,(function(e){D.check.isString(e)?n[e]=!0:L.log("userUnset: value inside the array must be string and have already been filtered out",e)})),this.sendRequest({type:"user_unset",properties:n},t)):L.log("userUnset: param must be an array or string")}},{key:"userDelete",value:function(e){this.sendRequest({type:"user_delete"},e),this.store.setAccountId(null),this.store.set("firstId","")}},{key:"registerCommonProperties",value:function(e){D.extend(X.currentProps,e)}},{key:"getPresetProperties",value:function(){return e=X.getUmtsParams("H_",""),t=e.allUtms,n=e.otherUtms,i={H_is_first_day:W.isFirstDay,H_is_first_time:W.isFirstTime,device_id:W.getDeviceId(),anonymous_id:W.getAnonymousId(),account_id:W.getAccountId(),properties:f({},X.currentProps)},D.extend(i.properties,t,n,X.getPresetProperties(),X.getPageProperties()),i;var e,t,n,i}},{key:"clearPageRegister",value:function(e){return X.clearPageRegister(e)}},{key:"use",value:function(e,t){if(D.check.isString(e)||D.check.isObject(e)){var n,i;if(D.check.isObject(e)&&(n=e,i=e.name),D.check.isString(e)){if(!(e in we))return void L.log("pluginName not found");n=we[e],i=e}n=new n,window[i]=n,n.init&&D.check.isFunction(n.init)&&n.init(this,t)}else L.log("pluginName must be string or object")}}])}(),Ee=new Proxy(new He,{get:function(e,t){return D.check.isFunction(e[t])?function(){if(e.initialized||"init"===t){for(var n=arguments.length,i=new Array(n),r=0;r<n;r++)i[r]=arguments[r];return e[t].apply(e,i)}console.log("sdk not yet initialized!")}:e[t]}});window.hinaDataStatistic=Ee;var Ie,Ae,xe,Pe,Oe=-1,Le=function(e){addEventListener("pageshow",(function(t){t.persisted&&(Oe=t.timeStamp,e(t))}),!0)},Ue=function(){return window.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0]},De=function(){var e=Ue();return e&&e.activationStart||0},Ne=function(e,t){var n=Ue(),i="navigate";return Oe>=0?i="back-forward-cache":n&&(document.prerendering||De()>0?i="prerender":document.wasDiscarded?i="restore":n.type&&(i=n.type.replace(/_/g,"-"))),{name:e,value:void 0===t?-1:t,rating:"good",delta:0,entries:[],id:"v3-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:i}},Re=function(e,t,n){try{if(PerformanceObserver.supportedEntryTypes.includes(e)){var i=new PerformanceObserver((function(e){Promise.resolve().then((function(){t(e.getEntries())}))}));return i.observe(Object.assign({type:e,buffered:!0},n||{})),i}}catch(e){}},je=function(e,t,n,i){var r,a;return function(o){t.value>=0&&(o||i)&&((a=t.value-(r||0))||void 0===r)&&(r=t.value,t.delta=a,t.rating=function(e,t){return e>t[1]?"poor":e>t[0]?"needs-improvement":"good"}(t.value,n),e(t))}},Be=function(e){requestAnimationFrame((function(){return requestAnimationFrame((function(){return e()}))}))},Fe=function(e){var t=function(t){"pagehide"!==t.type&&"hidden"!==document.visibilityState||e(t)};addEventListener("visibilitychange",t,!0),addEventListener("pagehide",t,!0)},Me=function(e){var t=!1;return function(n){t||(e(n),t=!0)}},qe=-1,Ve=function(){return"hidden"!==document.visibilityState||document.prerendering?1/0:0},ze=function(e){"hidden"===document.visibilityState&&qe>-1&&(qe="visibilitychange"===e.type?e.timeStamp:0,Ke())},Je=function(){addEventListener("visibilitychange",ze,!0),addEventListener("prerenderingchange",ze,!0)},Ke=function(){removeEventListener("visibilitychange",ze,!0),removeEventListener("prerenderingchange",ze,!0)},$e=function(){return qe<0&&(qe=Ve(),Je(),Le((function(){setTimeout((function(){qe=Ve(),Je()}),0)}))),{get firstHiddenTime(){return qe}}},We=function(e){document.prerendering?addEventListener("prerenderingchange",(function(){return e()}),!0):e()},Xe=[1800,3e3],Ze=function(e,t){t=t||{},We((function(){var n,i=$e(),r=Ne("FCP"),a=Re("paint",(function(e){e.forEach((function(e){"first-contentful-paint"===e.name&&(a.disconnect(),e.startTime<i.firstHiddenTime&&(r.value=Math.max(e.startTime-De(),0),r.entries.push(e),n(!0)))}))}));a&&(n=je(e,r,Xe,t.reportAllChanges),Le((function(i){r=Ne("FCP"),n=je(e,r,Xe,t.reportAllChanges),Be((function(){r.value=performance.now()-i.timeStamp,n(!0)}))})))}))},Ge=[.1,.25],Ye=[1800,3e3],Qe={passive:!0,capture:!0},et=new Date,tt=function(e,t){Ie||(Ie=t,Ae=e,xe=new Date,rt(removeEventListener),nt())},nt=function(){if(Ae>=0&&Ae<xe-et){var e={entryType:"first-input",name:Ie.type,target:Ie.target,cancelable:Ie.cancelable,startTime:Ie.timeStamp,processingStart:Ie.timeStamp+Ae};Pe.forEach((function(t){t(e)})),Pe=[]}},it=function(e){if(e.cancelable){var t=(e.timeStamp>1e12?new Date:performance.now())-e.timeStamp;"pointerdown"==e.type?function(e,t){var n=function(){tt(e,t),r()},i=function(){r()},r=function(){removeEventListener("pointerup",n,Qe),removeEventListener("pointercancel",i,Qe)};addEventListener("pointerup",n,Qe),addEventListener("pointercancel",i,Qe)}(t,e):tt(t,e)}},rt=function(e){["mousedown","keydown","touchstart","pointerdown"].forEach((function(t){return e(t,it,Qe)}))},at=[100,300],ot=[2500,4e3],st={},ct=window,ut=ct.PerformanceObserver,lt=ct.performance,ht=function(){return u((function e(t,n){s(this,e),this.config=t,this.ctx=n,this.submitData={},this.performanceCallback=this.performanceCallback.bind(this)}),[{key:"init",value:function(){this.initVitails()}},{key:"setSubmitData",value:function(e,t){"string"==typeof e?this.submitData[e]=t:"object"===p(e)&&(this.submitData=_.extend(this.config,e))}},{key:"getConfig",value:function(e){return this.config[e]}},{key:"onLongTask",value:function(e){ut.supportedEntryTypes.includes("longtask")&&new ut((function(t){var n=t.getEntries(),i=n.length,r=0;n.forEach((function(e){r+=Math.round(e.duration)})),e({H_long_task_time:r,H_long_task:i})})).observe({entryTypes:["longtask"]})}},{key:"onPageLoad",value:function(){var e=this;Re("navigation",(function(t){t.forEach((function(t){var n={H_page_load_time:Math.round(t.loadEventEnd-t.startTime)};if(0!==n.H_page_load_time){e.ctx.sendRequest("track","H_performance_page",n);var i={H_url:t.name,H_first_byte_time:Math.round(t.responseStart-t.startTime),H_unload_time:Math.round(t.unloadEventEnd-t.unloadEventStart),H_redirect_time:Math.round(t.redirectEnd-t.redirectStart),H_cache_check_time:Math.round(t.domainLookupStart-t.fetchStart),H_dns_time:Math.round(t.domainLookupEnd-t.domainLookupStart),H_tcp_time:Math.round(t.connectEnd-t.connectStart),H_ssl_time:t.secureConnectionStart>0?Math.round(t.connectEnd-t.secureConnectionStart):0,H_first_byte_response_time:Math.round(t.responseStart-t.requestStart),H_dom_ready_time:Math.round(t.domContentLoadedEventEnd-t.fetchStart),H_content_transfer_time:Math.round(t.responseEnd-t.responseStart),H_dom_parsing_time:Math.round(t.domInteractive-t.responseEnd),H_page_load_time:Math.round(t.loadEventEnd-t.startTime),H_resource_load_time:Math.round(t.responseEnd-t.startTime),H_load_event_time:Math.round(t.loadEventEnd-t.startTime)};e.ctx.sendRequest("track","H_performance_loading",i)}}))}))}},{key:"onPageUnlaod",value:function(){window.addEventListener("beforeunload",(function(){W.setSessionId("")}))}},{key:"initVitails",value:function(){!function(e,t){t=t||{},We((function(){var n,i=$e(),r=Ne("FP"),a=Re("paint",(function(e){e.forEach((function(e){"first-paint"===e.name&&(a.disconnect(),e.startTime<i.firstHiddenTime&&(r.value=Math.max(e.startTime-De(),0),r.entries.push(e),n(!0)))}))}));a&&(n=je(e,r,Ye,t.reportAllChanges),Le((function(i){r=Ne("FP"),n=je(e,r,Ye,t.reportAllChanges),Be((function(){r.value=performance.now()-i.timeStamp,n(!0)}))})))}))}(this.performanceCallback),Ze(this.performanceCallback),function(e,t){t=t||{},Ze(Me((function(){var n,i=Ne("CLS",0),r=0,a=[],o=function(e){e.forEach((function(e){if(!e.hadRecentInput){var t=a[0],n=a[a.length-1];r&&e.startTime-n.startTime<1e3&&e.startTime-t.startTime<5e3?(r+=e.value,a.push(e)):(r=e.value,a=[e])}})),r>i.value&&(i.value=r,i.entries=a,n())},s=Re("layout-shift",o);s&&(n=je(e,i,Ge,t.reportAllChanges),Fe((function(){o(s.takeRecords()),n(!0)})),Le((function(){r=0,i=Ne("CLS",0),n=je(e,i,Ge,t.reportAllChanges),Be((function(){return n()}))})),setTimeout(n,0))})))}(this.performanceCallback),function(e,t){t=t||{},We((function(){var n,i=$e(),r=Ne("FID"),a=function(e){e.startTime<i.firstHiddenTime&&(r.value=e.processingStart-e.startTime,r.entries.push(e),n(!0))},o=function(e){e.forEach(a)},s=Re("first-input",o);n=je(e,r,at,t.reportAllChanges),s&&Fe(Me((function(){o(s.takeRecords()),s.disconnect()}))),s&&Le((function(){var i;r=Ne("FID"),n=je(e,r,at,t.reportAllChanges),Pe=[],Ae=-1,Ie=null,rt(addEventListener),i=a,Pe.push(i),nt()}))}))}(this.performanceCallback),this.onLongTask(this.performanceCallback),this.onPageLoad(this.performanceCallback),this.onPageUnlaod(),function(e,t){t=t||{},We((function(){var n,i=$e(),r=Ne("LCP"),a=function(e){var t=e[e.length-1];t&&t.startTime<i.firstHiddenTime&&(r.value=Math.max(t.startTime-De(),0),r.entries=[t],n())},o=Re("largest-contentful-paint",a);if(o){n=je(e,r,ot,t.reportAllChanges);var s=Me((function(){st[r.id]||(a(o.takeRecords()),o.disconnect(),st[r.id]=!0,n(!0))}));["keydown","click"].forEach((function(e){addEventListener(e,s,!0)})),Fe(s),Le((function(i){r=Ne("LCP"),n=je(e,r,ot,t.reportAllChanges),Be((function(){r.value=performance.now()-i.timeStamp,st[r.id]=!0,n(!0)}))}))}}))}(this.performanceCallback)}},{key:"getMetricTime",value:function(){if(lt&<.timing)return new Promise((function(e){if(ut.supportedEntryTypes.includes("navigation"))Re("navigation",(function(t){t.forEach((function(t){var n={H_url:t.name,H_first_byte_time:Math.round(t.responseStart-t.startTime),H_unload_time:Math.round(t.unloadEventEnd-t.unloadEventStart),H_redirect_time:Math.round(t.redirectEnd-t.redirectStart),H_cache_check_time:Math.round(t.domainLookupStart-t.fetchStart),H_dns_time:Math.round(t.domainLookupEnd-t.domainLookupStart),H_tcp_time:Math.round(t.connectEnd-t.connectStart),H_ssl_time:t.secureConnectionStart>0?Math.round(t.connectEnd-t.secureConnectionStart):0,H_first_byte_response_time:Math.round(t.responseStart-t.requestStart),H_dom_ready_time:Math.round(t.domContentLoadedEventEnd-t.fetchStart),H_content_transfer_time:Math.round(t.responseEnd-t.responseStart),H_dom_parsing_time:Math.round(t.domInteractive-t.responseEnd),H_page_load_time:Math.round(t.loadEventEnd-t.startTime),H_resource_load_time:Math.round(t.responseEnd-t.startTime),H_load_event_time:Math.round(t.loadEventEnd-t.startTime)};e(n)}))}));else{var t=lt.timing,n={H_url:location.href,H_first_byte_time:Math.round(t.responseStart-t.startTime),H_unload_time:Math.round(t.unloadEventEnd-t.unloadEventStart),H_redirect_time:Math.round(t.redirectEnd-t.redirectStart),H_cache_check_time:Math.round(t.domainLookupStart-t.fetchStart),H_dns_time:Math.round(t.domainLookupEnd-t.domainLookupStart),H_tcp_time:Math.round(t.connectEnd-t.connectStart),H_ssl_time:t.secureConnectionStart>0?Math.round(t.connectEnd-t.secureConnectionStart):0,H_first_byte_response_time:Math.round(t.responseStart-t.requestStart),H_dom_ready_time:Math.round(t.domContentLoadedEventEnd-t.fetchStart),H_content_transfer_time:Math.round(t.responseEnd-t.responseStart),H_dom_parsing_time:Math.round(t.domInteractive-t.responseEnd),H_page_load_time:Math.round(t.loadEventEnd-t.fetchStart),H_resource_load_time:Math.round(t.responseEnd-t.startTime),H_load_event_time:Math.round(t.loadEventEnd-t.startTime)};e(n)}}));console.log("performance api is not supported in your browser")}},{key:"getSourceTime",value:function(){if(lt&<.getEntries)return new Promise((function(e){var t=lt.getEntries(),n=[];t&&0!==(null==t?void 0:t.length)||e(n),t.forEach((function(e){var t={};"resource"===e.entryType&&(t.name=e.name,t.initiatorType=e.initiatorType,t.nextHopProtocol=e.nextHopProtocol,t.redirectTime=(e.redirectEnd-e.redirectStart).toFixed(2),t.dnsTime=(e.domainLookupEnd-e.domainLookupStart).toFixed(2),t.tcpTime=(e.connectEnd-e.connectStart).toFixed(2),t.firstByteResponseTime=(e.responseStart-e.requestStart).toFixed(2),t.totalResponseTime=(e.responseEnd-e.requestStart).toFixed(2),n.push(t))})),e(n)}));console.log("performance.getEntries api is not supported in your browser")}},{key:"performanceCallback",value:function(e){var t=e.name,n=e.value,i=Math.round(n),r={};r="FP"===t?{H_first_paint_time:i}:"FCP"===t?{H_first_contentful_paint_time:i}:"LCP"===t?{H_largest_contentful_paint_time:i}:"FID"===t?{H_first_input_delay:i}:"CLS"===t?{H_cumulative_layout_shift:n}:e,this.ctx.sendRequest("track","H_performance_page",r)}}])}(),dt=function(){return u((function e(t,n){return s(this,e),e.instance||(e.instance=this,this.config=t,this.ctx=n,this.initialized=!1),e.instance}),[{key:"setConfig",value:function(e){D.check.isObject(e)&&D.extend(this.config,e)}},{key:"getConfig",value:function(e){return this.config[e]}},{key:"init",value:function(){var e=this.getConfig("serverUrl");D.check.isString(e)&&""!==D.trim(e)?(this.initCommon(),this.initialized=!0,L.log("hinaEpmSDK initialized successfully")):L.log("当前 serverUrl 为空或不正确,请配置正确的 serverUrl!")}},{key:"initCommon",value:function(){this.ravenInit()}},{key:"ravenInit",value:function(){var e=this,t=this.config,n=t.sourcemapVersion,i=t.serverUrl;n||(n="1.0.0"),a.default.config(i).install(),a.default.setTransport((function(t){var i,r,a,o,s=t.data.exception,c={H_js_error_type:(null==s||null===(i=s.values)||void 0===i||null===(r=i[0])||void 0===r?void 0:r.type)||"",H_js_error_summary:(null==s||null===(a=s.values)||void 0===a||null===(o=a[0])||void 0===o?void 0:o.value)||"",H_js_error_id:s?D.hash(JSON.stringify(s)):"",H_js_error_content:s?JSON.stringify(s):"",H_js_sourcemap_version:n};e.ctx.sendRequest("track","H_performance_js",c),t.onSuccess()}))}},{key:"vueInit",value:function(e,t){var n=this,i=e.config.errorHandler;e.config.errorHandler=function(r,a,o){n.captureVueError(r,a,o),"function"==typeof i&&i.call(e,r,a,o),t.showVueError&&console.error(r)}}},{key:"ReactInit",value:function(e,t){var n=this;e.errorHandler=function(e,i,r){n.captureReactError(e,i,r),t.showError&&console.error(e)}}},{key:"captureVueError",value:function(e,t,n){var i={componentName:this.formatComponentName(t),lifecycleHook:n};t&&(t.$options&&t.$options.propsData?i.propsData=t.$options.propsData:t.$props&&(i.propsData=t.$props)),setTimeout((function(){a.default.captureException(e,{extra:i})})),L.log(e,n)}},{key:"captureReactError",value:function(e,t,n){formatComponentName(t),t&&t.props&&t.props,setTimeout((function(){a.default.captureException(e,{extra:info})}))}},{key:"formatComponentName",value:function(e){if(!e)return"<Anonymous>";if(e.$root===e)return"<Root>";if(!e.$options)return"<Anonymous>";var t=e.$options,n=t.name||t._componentTag,i=t.__file;if(!n&&i){var r=i.match(/([^/\\]+)\.vue$/);r&&(n=r[1])}return(n?"<".concat(n.replace(/(?:^|[-_])(\w)/g,(function(e){return e.toUpperCase()})).replace(/[-_]/g,""),">"):"<Anonymous>")+(i?" at ".concat(i):"")}},{key:"captureError",value:function(){return a.default.captureException.apply(a.default,arguments)}}])}(),ft=window.location,gt=function(){return u((function e(t,n){s(this,e),e.instance=this,this.config=t,this.ctx=n,this.initialized=!0,this.load(t)}),[{key:"load",value:function(e){this.initialized||(this.config=e,this.initialized=!0)}},{key:"autoTrack",value:function(e,t){this.ctx.track("H_pageview",D.extend(f(f({},e||{}),{},{H_referrer:D.getReferrer(null,!0),H_url:ft.href,H_url_path:ft.pathname,H_url_hash:ft.hash,H_title:document.title})),t)}},{key:"autoTrackSinglePage",value:function(e,t){var n;n=this.autoTrackIsUsed?ft.href:D.getReferrer(),this.ctx.track("H_pageview",D.extend(f(f({},e||{}),{},{H_referrer:n,url:ft.href,H_url_path:ft.pathname,H_url_hash:ft.hash,H_title:document.title})),t)}},{key:"listenSinglePage",value:function(){var e=this,t=this.ctx.getConfig("isSinglePage");t&&D.mitt.on("hasInitEpm",(function(){e.onUrlChange((function(n){var i=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(n!==ft.href){X.pageProp.H_referrer=n;var i=D.extend({H_url:ft.href,H_referrer:n},t);e.autoTrack(i)}};if(D.check.isBoolean(t))i();else if(D.check.isFunction(t)){var r=t();D.check.isObject(r)?i(r):!0===r&&i()}}))}))}},{key:"onUrlChange",value:function(e){D.check.isFunction(e)&&(e(),D.mitt.on("urlChange",e))}}])}(),pt={errorCapture:!0,performance:!0,presetProperties:{latest_utm:!0,latest_traffic_source_type:!0,latest_search_keyword:!0,latest_referrer:!0,url:!0,title:!0},autoTrack:{},isSinglePage:!1},vt=function(){return u((function e(){return s(this,e),e.instance||(e.instance=this,this.config={},this.initialized=!1,this._=D),e.instance}),[{key:"setConfig",value:function(e){D.check.isObject(e)&&D.extend(this.config,e)}},{key:"getConfig",value:function(e){return this.config[e]}},{key:"sendRequest",value:function(e,t,n){var i={properties:f(f({},D.info.epmProperties()),n),type:e,event:t,time:D.now(),_track_id:Number(String(D.getRandom()).slice(2,5)+String(D.getRandom()).slice(2,4)+String(D.now()).slice(-4))};if(W.getAnonymousId()&&(i.anonymous_id=W.getAnonymousId()),W.getSessionId())if(D.now()-W.getSessionIdUpdateTime()>18e5){var r=D.getRandom();i.properties.H_session_id=r,W.setSessionId(r)}else i.properties.H_session_id=W.getSessionId();else i.properties.H_session_id=D.getRandom(),W.setSessionId(i.properties.H_session_id);W.getAccountId()!==W.getAnonymousId()&&W.getAccountId()&&(i.account_id=W.getAccountId()),i.send_time=D.now(),L.log(i),D.check.isString(i)||(i=JSON.stringify(i));var a=D.base64Encode(i),o="crc="+D.hashCode(a),s="data="+D.encodeURIComponent(a)+"&ext="+D.encodeURIComponent(o),c={callback:this.getConfig("globalCallback"),data:s,serverUrl:this.getConfig("serverUrl"),dataSendTimeout:this.getConfig("dataSendTimeout")};new q(c).run()}},{key:"track",value:function(e,t,n){var i=D.check.isFunction(n)?n:function(){};D.check.isString(e)&&(D.check.isObject(t)||D.check.isUndefined(t))?this.sendRequest("track",e,t,i):L.log("eventName must be a sting and properties must be an object")}},{key:"quick",value:function(e){for(var t={autoTrack:this.autoTrack.autoTrack,autoTrackSinglePage:this.autoTrack.autoTrackSinglePage},n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];return t[e].call(this.autoTrack,i)}},{key:"init",value:function(e){if(D.check.isEmptyObject(this.config)){if(this.setConfig(D.extend(pt,e)),L.showLog=this.getConfig("showLog"),U.serverUrl=this.getConfig("serverUrl"),this.isSinglePage=this.getConfig("isSinglePage"),!U.checkServerUrl(this.getConfig("serverUrl")))return;if(W.load(this.config),Z(this.config),this.store=W,this.config.performance)new ht(this.config,this).init();if(this.config.errorCapture&&new dt(this.config,this).init(),this.initialized=!0,!this.config.autoTrackConfig){D.initUrlChange();var t=new gt(this.config,this);this.autoTrack=t,t.listenSinglePage(),D.mitt.emit("hasInitEpm")}}else L.log("EmpMonitor has been initialized")}}])}(),mt=new Proxy(new vt,{get:function(e,t){return D.check.isFunction(e[t])?function(){if(e.initialized||"init"===t){for(var n=arguments.length,i=new Array(n),r=0;r<n;r++)i[r]=arguments[r];return e[t].apply(e,i)}console.log("performanceErrorSdk not yet initialized!")}:e[t]}});window.hinaEpmStatistic=mt;var yt=["serverUrl"],kt={init:function(e){var t=e.name,n=e.serverUrl,i=e.showLog,r=e.autoTrackConfig,a=e.performanceErrorConfig,o=e.globalCallback,s=e.dataSendTimeout,c=e.isSinglePage;if(r&&Ee.init(e),a){var u=a.serverUrl,l=function(e,t){if(null==e)return{};var n,i,r=function(e,t){if(null==e)return{};var n={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(t.includes(i))continue;n[i]=e[i]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)n=a[i],t.includes(n)||{}.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}(a,yt);mt.init(f({name:t,isSinglePage:c,serverUrl:u||n,showLog:i,autoTrackConfig:r,globalCallback:o,dataSendTimeout:s},l))}}},_t=new Proxy(kt,{get:function(e,t){return"init"!==t?Ee.initialized?Ee[t]:mt.initialized&&mt[t]?mt[t]:(console.log("sdk not yet initialized!"),function(){}):e[t]}});module.exports=_t;
|