Comparing version 0.2.7 to 0.2.8-beta1
@@ -1,3 +0,3 @@ | ||
/*! Mouselog Agent - v0.2.7 | 2020-3-25 | MIT */ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.mouselog=e():t.mouselog=e()}(window,function(){return r={},o.m=n=[function(t,e){t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}},function(t,e){function r(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}t.exports=function(t,e,n){return e&&r(t.prototype,e),n&&r(t,n),t}},function(t,e,n){var r,o,i;i=function(){return function(){return function(t){var e=[];if(0===t.length)return"";if("string"!=typeof t[0])throw new TypeError("Url must be a string. Received "+t[0]);if(t[0].match(/^[^/:]+:\/*$/)&&1<t.length){var n=t.shift();t[0]=n+t[0]}t[0].match(/^file:\/\/\//)?t[0]=t[0].replace(/^([^/:]+):\/*/,"$1:///"):t[0]=t[0].replace(/^([^/:]+):\/*/,"$1://");for(var r=0;r<t.length;r++){var o=t[r];if("string"!=typeof o)throw new TypeError("Url must be a string. Received "+o);""!==o&&(0<r&&(o=o.replace(/^[\/]+/,"")),o=r<t.length-1?o.replace(/[\/]+$/,""):o.replace(/[\/]+$/,"/"),e.push(o))}var i=e.join("/"),s=(i=i.replace(/\/(\?|&|#[^!])/g,"$1")).split("?");return i=s.shift()+(0<s.length?"?":"")+s.join("&")}("object"==typeof arguments[0]?arguments[0]:[].slice.call(arguments))}},t.exports?t.exports=i():void 0===(o="function"==typeof(r=i)?r.call(e,n,e,t):r)||(t.exports=o)},function(t,e,n){var s=n(13),a=n(14);t.exports=function(t,e,n){var r=e&&n||0;"string"==typeof t&&(e="binary"===t?new Array(16):null,t=null);var o=(t=t||{}).random||(t.rng||s)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,e)for(var i=0;i<16;++i)e[r+i]=o[i];return e||a(o)}},function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){function a(t,e,n){return t instanceof Array?(t.push(n),t[t.length-1]):t instanceof Object?(t[e]=n,t[e]):void 0}t.exports=function(t){if(/number|string|boolean/.test(typeof t))return t;if(t instanceof Date)return new Date(t.getTime());var e=t instanceof Array?[]:{};return function t(e,n){for(var r in e){var o=e[r];if(o instanceof Date){var i=new Date(o.getTime());a(n,r,i)}else if(o instanceof Function){var i=o;a(n,r,i)}else if(o instanceof Array){var i=[],s=a(n,r,i);t(o,s)}else if(o instanceof Object){var i={},s=a(n,r,i);t(o,s)}else{var i=o;a(n,r,i)}}}(t,e),e}},function(t,u,l){(function(o,i){var s;/*! http://mths.be/base64 v0.1.0 by @mathias | MIT license */!function(){var t=u,e=(o&&o.exports,"object"==typeof i&&i);e.global!==e&&e.window;function n(t){this.message=t}(n.prototype=new Error).name="InvalidCharacterError";function c(t){throw new n(t)}var f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=/[\t\n\f\r ]/g,r={encode:function(t){t=String(t),/[^\0-\xFF]/.test(t)&&c("The string to be encoded contains characters outside of the Latin1 range.");for(var e,n,r,o,i=t.length%3,s="",a=-1,u=t.length-i;++a<u;)e=t.charCodeAt(a)<<16,n=t.charCodeAt(++a)<<8,r=t.charCodeAt(++a),s+=f.charAt((o=e+n+r)>>18&63)+f.charAt(o>>12&63)+f.charAt(o>>6&63)+f.charAt(63&o);return 2==i?(e=t.charCodeAt(a)<<8,n=t.charCodeAt(++a),s+=f.charAt((o=e+n)>>10)+f.charAt(o>>4&63)+f.charAt(o<<2&63)+"="):1==i&&(o=t.charCodeAt(a),s+=f.charAt(o>>2)+f.charAt(o<<4&63)+"=="),s},decode:function(t){var e=(t=String(t).replace(a,"")).length;e%4==0&&(e=(t=t.replace(/==?$/,"")).length),e%4!=1&&!/[^+a-zA-Z0-9/]/.test(t)||c("Invalid character: the string to be decoded is not correctly encoded.");for(var n,r,o=0,i="",s=-1;++s<e;)r=f.indexOf(t.charAt(s)),n=o%4?64*n+r:r,o++%4&&(i+=String.fromCharCode(255&n>>(-2*o&6)));return i},version:"0.1.0"};void 0===(s=function(){return r}.call(u,l,u,o))||(o.exports=s)}()}).call(this,l(15)(t),l(4))},function(t,e,n){n(8),t.exports=n(16)},function(t,e,n){n(9),t.exports=self.fetch.bind(self)},function(t,e,n){"use strict";n.r(e),n.d(e,"Headers",function(){return c}),n.d(e,"Request",function(){return y}),n.d(e,"Response",function(){return g}),n.d(e,"DOMException",function(){return w}),n.d(e,"fetch",function(){return _});var a={searchParams:"URLSearchParams"in self,iterable:"Symbol"in self&&"iterator"in Symbol,blob:"FileReader"in self&&"Blob"in self&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in self,arrayBuffer:"ArrayBuffer"in self};if(a.arrayBuffer)var r=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],o=ArrayBuffer.isView||function(t){return t&&-1<r.indexOf(Object.prototype.toString.call(t))};function i(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function s(t){return"string"!=typeof t&&(t=String(t)),t}function u(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return a.iterable&&(t[Symbol.iterator]=function(){return t}),t}function c(e){this.map={},e instanceof c?e.forEach(function(t,e){this.append(e,t)},this):Array.isArray(e)?e.forEach(function(t){this.append(t[0],t[1])},this):e&&Object.getOwnPropertyNames(e).forEach(function(t){this.append(t,e[t])},this)}function f(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function l(n){return new Promise(function(t,e){n.onload=function(){t(n.result)},n.onerror=function(){e(n.error)}})}function h(t){var e=new FileReader,n=l(e);return e.readAsArrayBuffer(t),n}function d(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function p(){return this.bodyUsed=!1,this._initBody=function(t){var e;(this._bodyInit=t)?"string"==typeof t?this._bodyText=t:a.blob&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:a.formData&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:a.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():a.arrayBuffer&&a.blob&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=d(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):a.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(t)||o(t))?this._bodyArrayBuffer=d(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):a.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},a.blob&&(this.blob=function(){var t=f(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?f(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(h)}),this.text=function(){var t,e,n,r=f(this);if(r)return r;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,n=l(e),e.readAsText(t),n;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),n=new Array(e.length),r=0;r<e.length;r++)n[r]=String.fromCharCode(e[r]);return n.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},a.formData&&(this.formData=function(){return this.text().then(m)}),this.json=function(){return this.text().then(JSON.parse)},this}c.prototype.append=function(t,e){t=i(t),e=s(e);var n=this.map[t];this.map[t]=n?n+", "+e:e},c.prototype.delete=function(t){delete this.map[i(t)]},c.prototype.get=function(t){return t=i(t),this.has(t)?this.map[t]:null},c.prototype.has=function(t){return this.map.hasOwnProperty(i(t))},c.prototype.set=function(t,e){this.map[i(t)]=s(e)},c.prototype.forEach=function(t,e){for(var n in this.map)this.map.hasOwnProperty(n)&&t.call(e,this.map[n],n,this)},c.prototype.keys=function(){var n=[];return this.forEach(function(t,e){n.push(e)}),u(n)},c.prototype.values=function(){var e=[];return this.forEach(function(t){e.push(t)}),u(e)},c.prototype.entries=function(){var n=[];return this.forEach(function(t,e){n.push([e,t])}),u(n)},a.iterable&&(c.prototype[Symbol.iterator]=c.prototype.entries);var v=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function y(t,e){var n,r,o=(e=e||{}).body;if(t instanceof y){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new c(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,o||null==t._bodyInit||(o=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new c(e.headers)),this.method=(n=e.method||this.method||"GET",r=n.toUpperCase(),-1<v.indexOf(r)?r:n),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&o)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(o)}function m(t){var o=new FormData;return t.trim().split("&").forEach(function(t){if(t){var e=t.split("="),n=e.shift().replace(/\+/g," "),r=e.join("=").replace(/\+/g," ");o.append(decodeURIComponent(n),decodeURIComponent(r))}}),o}function g(t,e){e=e||{},this.type="default",this.status=void 0===e.status?200:e.status,this.ok=200<=this.status&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new c(e.headers),this.url=e.url||"",this._initBody(t)}y.prototype.clone=function(){return new y(this,{body:this._bodyInit})},p.call(y.prototype),p.call(g.prototype),g.prototype.clone=function(){return new g(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new c(this.headers),url:this.url})},g.error=function(){var t=new g(null,{status:0,statusText:""});return t.type="error",t};var b=[301,302,303,307,308];g.redirect=function(t,e){if(-1===b.indexOf(e))throw new RangeError("Invalid status code");return new g(null,{status:e,headers:{location:t}})};var w=self.DOMException;try{new w}catch(t){(w=function(t,e){this.message=t,this.name=e;var n=Error(t);this.stack=n.stack}).prototype=Object.create(Error.prototype),w.prototype.constructor=w}function _(o,s){return new Promise(function(r,t){var e=new y(o,s);if(e.signal&&e.signal.aborted)return t(new w("Aborted","AbortError"));var i=new XMLHttpRequest;function n(){i.abort()}i.onload=function(){var t,o,e={status:i.status,statusText:i.statusText,headers:(t=i.getAllResponseHeaders()||"",o=new c,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach(function(t){var e=t.split(":"),n=e.shift().trim();if(n){var r=e.join(":").trim();o.append(n,r)}}),o)};e.url="responseURL"in i?i.responseURL:e.headers.get("X-Request-URL");var n="response"in i?i.response:i.responseText;r(new g(n,e))},i.onerror=function(){t(new TypeError("Network request failed"))},i.ontimeout=function(){t(new TypeError("Network request failed"))},i.onabort=function(){t(new w("Aborted","AbortError"))},i.open(e.method,e.url,!0),"include"===e.credentials?i.withCredentials=!0:"omit"===e.credentials&&(i.withCredentials=!1),"responseType"in i&&a.blob&&(i.responseType="blob"),e.headers.forEach(function(t,e){i.setRequestHeader(e,t)}),e.signal&&(e.signal.addEventListener("abort",n),i.onreadystatechange=function(){4===i.readyState&&e.signal.removeEventListener("abort",n)}),i.send(void 0===e._bodyInit?null:e._bodyInit)})}_.polyfill=!0,self.fetch||(self.fetch=_,self.Headers=c,self.Request=y,self.Response=g)},function(t,e,n){"use strict";t.exports=n(11).polyfill()},function(t,e,n){(function(rt,ot){ | ||
/*! Mouselog Agent - v0.2.8-beta1 | 2020-4-5 | MIT */ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.mouselog=t():e.mouselog=t()}(window,function(){return d=[function(e,t,n){"use strict";n.d(t,"a",function(){return o}),n.d(t,"b",function(){return s});var r,i=!1;function o(e){i=!0,e&&(r=window.document.getElementById(e))}function s(e){if(i&&r){var t=document.createElement("p");t.style.display="block",t.style.fontSize="10px",t.style.margin="2px";var n=document.createTextNode(e);t.appendChild(n),r.appendChild(t)}}},function(e,t,n){"use strict";function r(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];for(var r=t[0],i=1;i<t.length;++i)r=r>t[i]?r:t[i];return r}function i(e){var t="number"==typeof e?e:Number(e);return Math.round(t)}function o(e){for(var t=e.length,n=e.length-1;0<=n;n--){var r=e.charCodeAt(n);127<r&&r<=2047?t++:2047<r&&r<=65535&&(t+=2),56320<=r&&r<=57343&&n--}return t}function s(){return window.mouselogUserId?window.mouselogUserId:""}function a(e,t){if(!e||!t||e.length!=t.length)return!1;for(var n=0;n<e.length;++n)if(e[n]!=t[n])return!1;return!0}n.d(t,"d",function(){return r}),n.d(t,"e",function(){return i}),n.d(t,"a",function(){return o}),n.d(t,"c",function(){return s}),n.d(t,"b",function(){return a})},function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t){function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}e.exports=function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}},function(e,t,n){var r,i,o;o=function(){return function(){return function(e){var t=[];if(0===e.length)return"";if("string"!=typeof e[0])throw new TypeError("Url must be a string. Received "+e[0]);if(e[0].match(/^[^/:]+:\/*$/)&&1<e.length){var n=e.shift();e[0]=n+e[0]}e[0].match(/^file:\/\/\//)?e[0]=e[0].replace(/^([^/:]+):\/*/,"$1:///"):e[0]=e[0].replace(/^([^/:]+):\/*/,"$1://");for(var r=0;r<e.length;r++){var i=e[r];if("string"!=typeof i)throw new TypeError("Url must be a string. Received "+i);""!==i&&(0<r&&(i=i.replace(/^[\/]+/,"")),i=r<e.length-1?i.replace(/[\/]+$/,""):i.replace(/[\/]+$/,"/"),t.push(i))}var o=t.join("/"),s=(o=o.replace(/\/(\?|&|#[^!])/g,"$1")).split("?");return o=s.shift()+(0<s.length?"?":"")+s.join("&")}("object"==typeof arguments[0]?arguments[0]:[].slice.call(arguments))}},e.exports?e.exports=o():void 0===(i="function"==typeof(r=o)?r.call(t,n,t,e):r)||(e.exports=i)},function(e,t,n){var s=n(19),a=n(20);e.exports=function(e,t,n){var r=t&&n||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var i=(e=e||{}).random||(e.rng||s)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,t)for(var o=0;o<16;++o)t[r+o]=i[o];return t||a(i)}},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(module,__webpack_exports__,__webpack_require__){"use strict";var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(2),_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default=__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__),_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(3),_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__),es6_promise_auto__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(16),es6_promise_auto__WEBPACK_IMPORTED_MODULE_2___default=__webpack_require__.n(es6_promise_auto__WEBPACK_IMPORTED_MODULE_2__),uuid_v4__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(5),uuid_v4__WEBPACK_IMPORTED_MODULE_3___default=__webpack_require__.n(uuid_v4__WEBPACK_IMPORTED_MODULE_3__),_uploader__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(8),_config__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(9),deep_copy__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__(10),deep_copy__WEBPACK_IMPORTED_MODULE_6___default=__webpack_require__.n(deep_copy__WEBPACK_IMPORTED_MODULE_6__),base_64__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__(11),base_64__WEBPACK_IMPORTED_MODULE_7___default=__webpack_require__.n(base_64__WEBPACK_IMPORTED_MODULE_7__),_debugger__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__(0),_utils__WEBPACK_IMPORTED_MODULE_9__=__webpack_require__(1),targetEvents=["mousemove","mousedown","mouseup","click","dblclick","contextmenu","wheel","touchstart","touchmove","touchend","resize"],pageLoadTime=new Date,isLocalStorageAvailable=function(){var e=uuid_v4__WEBPACK_IMPORTED_MODULE_3___default()();try{return localStorage.setItem(e,e),localStorage.removeItem(e),!0}catch(e){return!1}}(),hiddenProperty="hidden"in document?"hidden":"webkitHidden"in document?"webkitHidden":"mozHidden"in document?"mozHidden":null,visibilityChangeEvent=hiddenProperty?hiddenProperty.replace(/hidden/i,"visibilitychange"):null;function isIEBrowser(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:9,t=navigator.userAgent.toLowerCase().match(/msie ([\d]+)/);return t&&Object(_utils__WEBPACK_IMPORTED_MODULE_9__.e)(t[1])<=e}function getButton(e){return"2"===e?"Right":""}var Mouselog=function(){function Mouselog(){_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this,Mouselog),this.config=new _config__WEBPACK_IMPORTED_MODULE_5__.a,this.mouselogLoadTime=new Date,this.batchCount=0,this.packetCount=0,this.eventsList=[],this.lastEvtInfo,this.eventsCount=0,this.uploadInterval,this.uploadTimeout}return _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(Mouselog,[{key:"_initImpressionId",value:function _initImpressionId(){if(void 0===this.config.impIdVariable||null===this.config.impIdVariable)this.impressionId=uuid_v4__WEBPACK_IMPORTED_MODULE_3___default()();else try{this.impressionId=eval(this.config.impIdVariable),null!==this.impressionId&&void 0!==this.impressionId||(_debugger__WEBPACK_IMPORTED_MODULE_8__.b("Global varialbe impIdVariable: ".concat(this.config.impIdVariable," is ").concat(this.impressionId,". Use a randomly generated ID instead.")),this.impressionId="Err_".concat(this.config.impIdVariable,"_is_").concat(this.impressionId))}catch(e){_debugger__WEBPACK_IMPORTED_MODULE_8__.b("Fail to initialize Impression ID with a `impIdVariable`"),this.impressionId="Err_fail_to_get_".concat(this.config.impIdVariable)}}},{key:"_initSessionId",value:function _initSessionId(){if(!isLocalStorageAvailable||!this.config.enableSession)return"";if(void 0!==this.config.sessionIdVariable&&null!==this.config.sessionIdVariable)try{return this.sessionId=eval(this.config.sessionIdVariable),void(null!=this.sessionId&&null!=this.sessionId||(_debugger__WEBPACK_IMPORTED_MODULE_8__.b("Warning: the value of `".concat(this.config.sessionIdVariable,"` is undefined or null.")),this.sessionId="Err_".concat(this.config.sessionIdVariable,"_is_").concat(this.sessionId)))}catch(e){return _debugger__WEBPACK_IMPORTED_MODULE_8__.b("Fail to initialize Impression ID with a `sessionIdVariable`"),void(this.sessionId="Err_fail_to_get_".concat(this.config.impIdVariable))}this.sessionId=localStorage.getItem("mouselogSessionID"),null!==this.sessionId&&this.sessionId!==undefiend||(this.sessionId=uuid_v4__WEBPACK_IMPORTED_MODULE_3___default()(),localStorage.setItem("mouselogSessionID",this.sessionId))}},{key:"_clearBuffer",value:function(){this.eventsList=[]}},{key:"_newDataBatch",value:function(){var e={batchId:this.batchCount,packetId:0,url:window.location.hostname?window.location.hostname:"localhost",path:window.location.pathname,width:Object(_utils__WEBPACK_IMPORTED_MODULE_9__.d)(document.body.scrollWidth,window.innerWidth),height:Object(_utils__WEBPACK_IMPORTED_MODULE_9__.d)(document.body.scrollHeight,window.innerHeight),pageLoadTime:pageLoadTime,referrer:document.referrer,events:[]};return this.batchCount+=1,e}},{key:"_onVisibilityChange",value:function(){window.document[hiddenProperty]?this._pause():this._resume()}},{key:"_mouseHandler",value:function(e){if("contextmenu"!==e.type||0!==e.pageX||0!==e.pageY){var t=[this.eventsCount,targetEvents.indexOf(e.type),Math.floor(e.timeStamp)/1e3];switch(e.type){case"mousemove":var n=Object(_utils__WEBPACK_IMPORTED_MODULE_9__.e)(e.pageX),r=Object(_utils__WEBPACK_IMPORTED_MODULE_9__.e)(e.pageY);t.push(n,r);break;case"touchmove":case"touchstart":case"touchend":n=Object(_utils__WEBPACK_IMPORTED_MODULE_9__.e)(e.changedTouches[0].pageX),r=Object(_utils__WEBPACK_IMPORTED_MODULE_9__.e)(e.changedTouches[0].pageY),t.push(n,r);break;case"wheel":n=Object(_utils__WEBPACK_IMPORTED_MODULE_9__.e)(e.pageX),r=Object(_utils__WEBPACK_IMPORTED_MODULE_9__.e)(e.pageY);var i=Object(_utils__WEBPACK_IMPORTED_MODULE_9__.e)(e.deltaX),o=Object(_utils__WEBPACK_IMPORTED_MODULE_9__.e)(e.deltaY);t.push(n,r,i,o);break;case"mouseup":case"mousedown":case"click":case"dblclick":case"contextmenu":n=Object(_utils__WEBPACK_IMPORTED_MODULE_9__.e)(e.pageX),r=Object(_utils__WEBPACK_IMPORTED_MODULE_9__.e)(e.pageY);var s=getButton(e.buttono);t.push(n,r,s);break;case"resize":var a=e.target.innerWidth,u=e.target.innerHeight;t.push(a,u)}this.lastEvtInfo&&Object(_utils__WEBPACK_IMPORTED_MODULE_9__.b)(this.lastEvtInfo,t)||this.lastEvtInfo&&("mousemove"==targetEvents[t[1]]||"touchmove"==targetEvents[t[1]])&&this.lastEvtInfo[1]==t[1]&&Object(_utils__WEBPACK_IMPORTED_MODULE_9__.b)(this.lastEvtInfo.slice(3),t.slice(3))||(this.eventsList.push(t),this.lastEvtInfo=t,this.eventsCount+=1,"event-triggered"==this.config.uploadMode&&this.eventsList.length%this.config.frequency==0&&this._uploadData(),"mixed"==this.config.uploadMode&&this.eventsList.length%this.config.frequency==0&&(this._periodUploadTimeout(),this._uploadData()))}}},{key:"_encodeData",value:function(e){var t=JSON.stringify(e);return"base64"==this.config.encoder.toLowerCase()&&(t=base_64__WEBPACK_IMPORTED_MODULE_7__.encode(t)),t}},{key:"_binarySplitBigDataBlock",value:function(e){var t=this._encodeData(e),n=[];if(Object(_utils__WEBPACK_IMPORTED_MODULE_9__.a)(t)>=this.config.sizeLimit){var r=deep_copy__WEBPACK_IMPORTED_MODULE_6___default()(e);e.events.splice(e.events.length/2),r.events.splice(0,r.events.length/2),this._binarySplitBigDataBlock(e).forEach(function(e){n.push(e)}),this._binarySplitBigDataBlock(r).forEach(function(e){n.push(e)})}else n.push(e);return n}},{key:"_fetchConfigFromServer",value:function(){var e=this._newDataBatch();return e.packetId=this.packetCount,this.packetCount+=1,this.uploader.upload(e,this._encodeData(e),!0)}},{key:"_uploadData",value:function(){var n=this;if(!(this.config.uploadTimes&&this.batchCount>=this.config.uploadTimes+this.config.enableServerConfig)){var e=this._newDataBatch();e.events=this.eventsList,this.eventsList=[],this._binarySplitBigDataBlock(e).forEach(function(e){e.packetId=n.packetCount,n.packetCount+=1;var t=n._encodeData(e);n.uploader.upload(e,t)})}}},{key:"_periodUploadTimeout",value:function(){var e=this;clearTimeout(this.uploadTimeout),this.uploadTimeout=setTimeout(function(){(e.config.enableSendEmpty||0<e.eventsList.length)&&e._uploadData()},this.config.uploadPeriod)}},{key:"_periodUploadInterval",value:function(){var e=this;clearInterval(this.uploadInterval),this.uploadInterval=setInterval(function(){(e.config.enableSendEmpty||0<e.eventsList.length)&&e._uploadData()},this.config.uploadPeriod)}},{key:"_runCollector",value:function(){var t=this;targetEvents.forEach(function(e){t.config.scope.addEventListener(e,function(e){return t._mouseHandler(e)})}),"periodic"===this.config.uploadMode&&this._periodUploadInterval(),"mixed"===this.config.uploadMode&&this._periodUploadTimeout()}},{key:"_stopCollector",value:function(){var t=this;targetEvents.forEach(function(e){t.config.scope.removeEventListener(e,function(e){return t._mouseHandler(e)})}),clearInterval(this.uploadInterval),clearTimeout(this.uploadTimeout)}},{key:"_resetCollector",value:function(){this._stopCollector(),this._runCollector()}},{key:"_init",value:function(e){var t=this;return this._clearBuffer(),this.config.build(e)?(this._initImpressionId(),this._initSessionId(),this.uploader=new _uploader__WEBPACK_IMPORTED_MODULE_4__.a(this.impressionId,this.sessionId,this.config),this.config.enableServerConfig&&this._fetchConfigFromServer().then(function(e){if(1!=e.status)throw new Error("Fail to get config from server.");if(!t.config.update(e.config))throw new Error("Unable to update config with server config.");t._resetCollector(),t.uploader.setConfig(t.config),t.sessionId=t.config.enableSession?getSessionId():"",t.uploader.sessionId=t.sessionId,_debugger__WEBPACK_IMPORTED_MODULE_8__.b("Successfully update config from backend.")}).catch(function(e){_debugger__WEBPACK_IMPORTED_MODULE_8__.b(e)}),window.onunload=function(){0!=t.eventsList.length&&t._uploadData()},{status:0}):{status:-1,msg:"Invalid configuration."}}},{key:"_pause",value:function(){this._stopCollector()}},{key:"_resume",value:function(){this._runCollector()}},{key:"run",value:function(e){var t=this;if(isIEBrowser(9))_debugger__WEBPACK_IMPORTED_MODULE_8__.b("IE Browser version <= 9. Stop.");else{var n=this._init(e);0==n.status?(visibilityChangeEvent&&document.addEventListener(visibilityChangeEvent,function(e){return t._onVisibilityChange(e)}),this._runCollector(),this.uploader.start(this.impressionId),_debugger__WEBPACK_IMPORTED_MODULE_8__.b("Mouselog agent is activated!"),_debugger__WEBPACK_IMPORTED_MODULE_8__.b("Website ID: ".concat(this.config.websiteId)),_debugger__WEBPACK_IMPORTED_MODULE_8__.b("Session ID: ".concat(this.sessionId)),_debugger__WEBPACK_IMPORTED_MODULE_8__.b("Impression ID: ".concat(this.impressionId)),_debugger__WEBPACK_IMPORTED_MODULE_8__.b("User-Agent: ".concat(navigator.userAgent)),_debugger__WEBPACK_IMPORTED_MODULE_8__.b("User ID: ".concat(Object(_utils__WEBPACK_IMPORTED_MODULE_9__.c)())),_debugger__WEBPACK_IMPORTED_MODULE_8__.b("Page load time: ".concat(pageLoadTime))):(_debugger__WEBPACK_IMPORTED_MODULE_8__.b(n.msg),_debugger__WEBPACK_IMPORTED_MODULE_8__.b("Fail to initialize Mouselog agent."))}}},{key:"debug",value:function(e,t){_debugger__WEBPACK_IMPORTED_MODULE_8__.a(t),this.run(e)}},{key:"stop",value:function(){this.uploader.stop(),this._stopCollector(),this._clearBuffer(),_debugger__WEBPACK_IMPORTED_MODULE_8__.b("Mouselog agent ".concat(this.impressionId," is stopped!"))}}]),Mouselog}();__webpack_exports__.a=Mouselog},function(e,t,n){"use strict";var r=n(2),i=n.n(r),o=n(3),s=n.n(o),a=n(4),u=n.n(a),c=n(0),l=n(1),_=0,f=1,d=2,h=function(){function r(e,t,n){i()(this,r),this.impressionId=e,this.sessionId=t,this.config=n,this.resendQueue=[]}return s()(r,[{key:"start",value:function(){var e=this;this.resendInterval=setInterval(function(){e._resendFailedData.call(e)},this.config.resendInterval)}},{key:"stop",value:function(){clearInterval(this.resendInterval)}},{key:"upload",value:function(i,o,e){var s=this,a=2<arguments.length&&void 0!==e&&e;return new Promise(function(t){c.b("Uploading Pkg ".concat(i.packetId,", window size: ").concat(i.width,"*").concat(i.height,", events count: ").concat(i.events.length));for(var e=0;e<3&&e<i.events.length;++e)c.b(" ".concat(JSON.stringify(i.events[e])));var n,r=u()(s.config.absoluteUrl,"?websiteId=".concat(s.config.websiteId,"&sessionId=").concat(s.sessionId,"&impressionId=").concat(s.impressionId,"&userId=").concat(Object(l.c)()).concat(a?"&queryConfig=1":""));s._upload(o,r).then(function(e){if(n=e.status,c.b("Pkg ".concat(i.packetId,", status code: ").concat(n,", content type: ").concat(e.headers.get("Content-Type"))),200==n)return e.json();throw new Error("Response status code is not 200.")}).then(function(e){if(c.b("Pkg ".concat(i.packetId," response=").concat(JSON.stringify(e))),"ok"!==e.status)throw new Error("Response object status is not ok.");"config"==e.msg&&t({status:1,msg:"Get config from server",config:e.data}),t({status:0})}).catch(function(e){n&&"2"===n.toString()[0]?(c.b("Pkg ".concat(i.packetId," was successfully sent, but no expected response. Error message: ").concat(e.message)),t({status:-1,msg:"Pkg ".concat(i.packetId," get no expected response, ").concat(e.message)})):(c.b("Pkg ".concat(i.packetId," failed, wait for resending. Error message: ").concat(e.message)),s._appendFailedData(i,o),t({status:-1,msg:"Fail to upload data bunch #".concat(i.packetId,", ").concat(e.message)}))})})}},{key:"setConfig",value:function(e){this.stop(),this.config=e,this.start()}},{key:"_resendFailedData",value:function(){var e=this,n=0;0<this.resendQueue.length&&c.b("Resending data...");for(var t=function(){var t=e.resendQueue[n];t.status==d?e.resendQueue.splice(n,1):(n+=1,c.b("Resending Pkg ".concat(t.data.packetId)),t.status==_&&(t.status=f,e.upload(t.data,t.encodedData).then(function(e){t.status=e?d:_})))};n<this.resendQueue.length;)t()}},{key:"_upload",value:function(e,t){return this.config.enableGet?fetch("".concat(t,"&data=").concat(e),{method:"GET",keepalive:!0}):fetch(t,{method:"POST",body:e,keepalive:!0})}},{key:"_appendFailedData",value:function(e,t){this.resendQueue.push({status:_,data:e,encodedData:t})}}]),r}();t.a=h},function(e,t,n){"use strict";var r=n(2),i=n.n(r),o=n(3),s=n.n(o),a=n(4),u=n.n(a),c=n(0),l=function(){function e(){i()(this,e),this.uploadEndpoint="http://localhost:9000",this.websiteId="unknown",this.endpointType="absolute",this.uploadMode="mixed",this.uploadPeriod=5e3,this.frequency=50,this.uploadTimes=null,this.sizeLimit=65535,this.enableGet=!1,this.resendInterval=2e4,this.scope=window.document,this.encoder="",this.enableServerConfig=!0,this.enableSession=!0,this.enableSendEmpty=!1,this.impIdVariable=null,this.sessionIdVariable=null,this._requiredParams=["uploadEndpoint"],this._ignoredParams=["scope","impIdVariable","sessionIdVariable"]}return s()(e,[{key:"build",value:function(t,e){var n=this,r=1<arguments.length&&void 0!==e&&e;try{this._requiredParams.forEach(function(e){if(!Object.prototype.hasOwnProperty.call(t,e))throw new Error("Param ".concat(e," is required but not declared."))}),Object.keys(t).forEach(function(e){void 0!==n[e]&&0!==e.indexOf("_")&&"function"!=typeof n[e]&&(r&&e in n._ignoredParams||(n[e]=t[e]))}),this._formatUrl()}catch(e){return c.b(e),!1}return!0}},{key:"update",value:function(e){return this.build(e,!0)}},{key:"_formatUrl",value:function(){if("relative"==this.endpointType)this.absoluteUrl=u()(window.location.origin,this.uploadEndpoint);else{if("absolute"!=this.endpointType)throw new Error('`endpointType` can only be "absolute" or "relative"');this.absoluteUrl=this.uploadEndpoint}}}]),e}();t.a=l},function(e,t,n){function a(e,t,n){return e instanceof Array?(e.push(n),e[e.length-1]):e instanceof Object?(e[t]=n,e[t]):void 0}e.exports=function(e){if(/number|string|boolean/.test(typeof e))return e;if(e instanceof Date)return new Date(e.getTime());var t=e instanceof Array?[]:{};return function e(t,n){for(var r in t){var i=t[r];if(i instanceof Date){var o=new Date(i.getTime());a(n,r,o)}else if(i instanceof Function){var o=i;a(n,r,o)}else if(i instanceof Array){var o=[],s=a(n,r,o);e(i,s)}else if(i instanceof Object){var o={},s=a(n,r,o);e(i,s)}else{var o=i;a(n,r,o)}}}(e,t),t}},function(e,u,_){(function(i,o){var s;/*! http://mths.be/base64 v0.1.0 by @mathias | MIT license */!function(){var e=u,t=(i&&i.exports,"object"==typeof o&&o);t.global!==t&&t.window;function n(e){this.message=e}(n.prototype=new Error).name="InvalidCharacterError";function c(e){throw new n(e)}var l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=/[\t\n\f\r ]/g,r={encode:function(e){e=String(e),/[^\0-\xFF]/.test(e)&&c("The string to be encoded contains characters outside of the Latin1 range.");for(var t,n,r,i,o=e.length%3,s="",a=-1,u=e.length-o;++a<u;)t=e.charCodeAt(a)<<16,n=e.charCodeAt(++a)<<8,r=e.charCodeAt(++a),s+=l.charAt((i=t+n+r)>>18&63)+l.charAt(i>>12&63)+l.charAt(i>>6&63)+l.charAt(63&i);return 2==o?(t=e.charCodeAt(a)<<8,n=e.charCodeAt(++a),s+=l.charAt((i=t+n)>>10)+l.charAt(i>>4&63)+l.charAt(i<<2&63)+"="):1==o&&(i=e.charCodeAt(a),s+=l.charAt(i>>2)+l.charAt(i<<4&63)+"=="),s},decode:function(e){var t=(e=String(e).replace(a,"")).length;t%4==0&&(t=(e=e.replace(/==?$/,"")).length),t%4!=1&&!/[^+a-zA-Z0-9/]/.test(e)||c("Invalid character: the string to be decoded is not correctly encoded.");for(var n,r,i=0,o="",s=-1;++s<t;)r=l.indexOf(e.charAt(s)),n=i%4?64*n+r:r,i++%4&&(o+=String.fromCharCode(255&n>>(-2*i&6)));return o},version:"0.1.0"};void 0===(s=function(){return r}.call(u,_,u,i))||(i.exports=s)}()}).call(this,_(21)(e),_(6))},function(e,t,n){n(13),e.exports=n(15)},function(e,t,n){n(14),e.exports=self.fetch.bind(self)},function(e,t,n){"use strict";n.r(t),n.d(t,"Headers",function(){return c}),n.d(t,"Request",function(){return b}),n.d(t,"Response",function(){return y}),n.d(t,"DOMException",function(){return m}),n.d(t,"fetch",function(){return E});var a={searchParams:"URLSearchParams"in self,iterable:"Symbol"in self&&"iterator"in Symbol,blob:"FileReader"in self&&"Blob"in self&&function(){try{return new Blob,!0}catch(e){return!1}}(),formData:"FormData"in self,arrayBuffer:"ArrayBuffer"in self};if(a.arrayBuffer)var r=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],i=ArrayBuffer.isView||function(e){return e&&-1<r.indexOf(Object.prototype.toString.call(e))};function o(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function s(e){return"string"!=typeof e&&(e=String(e)),e}function u(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return a.iterable&&(e[Symbol.iterator]=function(){return e}),e}function c(t){this.map={},t instanceof c?t.forEach(function(e,t){this.append(t,e)},this):Array.isArray(t)?t.forEach(function(e){this.append(e[0],e[1])},this):t&&Object.getOwnPropertyNames(t).forEach(function(e){this.append(e,t[e])},this)}function l(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function _(n){return new Promise(function(e,t){n.onload=function(){e(n.result)},n.onerror=function(){t(n.error)}})}function f(e){var t=new FileReader,n=_(t);return t.readAsArrayBuffer(e),n}function d(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function h(){return this.bodyUsed=!1,this._initBody=function(e){var t;(this._bodyInit=e)?"string"==typeof e?this._bodyText=e:a.blob&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:a.formData&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:a.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():a.arrayBuffer&&a.blob&&((t=e)&&DataView.prototype.isPrototypeOf(t))?(this._bodyArrayBuffer=d(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):a.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(e)||i(e))?this._bodyArrayBuffer=d(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):a.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},a.blob&&(this.blob=function(){var e=l(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?l(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(f)}),this.text=function(){var e,t,n,r=l(this);if(r)return r;if(this._bodyBlob)return e=this._bodyBlob,t=new FileReader,n=_(t),t.readAsText(e),n;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),n=new Array(t.length),r=0;r<t.length;r++)n[r]=String.fromCharCode(t[r]);return n.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},a.formData&&(this.formData=function(){return this.text().then(v)}),this.json=function(){return this.text().then(JSON.parse)},this}c.prototype.append=function(e,t){e=o(e),t=s(t);var n=this.map[e];this.map[e]=n?n+", "+t:t},c.prototype.delete=function(e){delete this.map[o(e)]},c.prototype.get=function(e){return e=o(e),this.has(e)?this.map[e]:null},c.prototype.has=function(e){return this.map.hasOwnProperty(o(e))},c.prototype.set=function(e,t){this.map[o(e)]=s(t)},c.prototype.forEach=function(e,t){for(var n in this.map)this.map.hasOwnProperty(n)&&e.call(t,this.map[n],n,this)},c.prototype.keys=function(){var n=[];return this.forEach(function(e,t){n.push(t)}),u(n)},c.prototype.values=function(){var t=[];return this.forEach(function(e){t.push(e)}),u(t)},c.prototype.entries=function(){var n=[];return this.forEach(function(e,t){n.push([t,e])}),u(n)},a.iterable&&(c.prototype[Symbol.iterator]=c.prototype.entries);var p=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function b(e,t){var n,r,i=(t=t||{}).body;if(e instanceof b){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new c(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,i||null==e._bodyInit||(i=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",!t.headers&&this.headers||(this.headers=new c(t.headers)),this.method=(n=t.method||this.method||"GET",r=n.toUpperCase(),-1<p.indexOf(r)?r:n),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(i)}function v(e){var i=new FormData;return e.trim().split("&").forEach(function(e){if(e){var t=e.split("="),n=t.shift().replace(/\+/g," "),r=t.join("=").replace(/\+/g," ");i.append(decodeURIComponent(n),decodeURIComponent(r))}}),i}function y(e,t){t=t||{},this.type="default",this.status=void 0===t.status?200:t.status,this.ok=200<=this.status&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new c(t.headers),this.url=t.url||"",this._initBody(e)}b.prototype.clone=function(){return new b(this,{body:this._bodyInit})},h.call(b.prototype),h.call(y.prototype),y.prototype.clone=function(){return new y(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new c(this.headers),url:this.url})},y.error=function(){var e=new y(null,{status:0,statusText:""});return e.type="error",e};var g=[301,302,303,307,308];y.redirect=function(e,t){if(-1===g.indexOf(t))throw new RangeError("Invalid status code");return new y(null,{status:t,headers:{location:e}})};var m=self.DOMException;try{new m}catch(e){(m=function(e,t){this.message=e,this.name=t;var n=Error(e);this.stack=n.stack}).prototype=Object.create(Error.prototype),m.prototype.constructor=m}function E(i,s){return new Promise(function(r,e){var t=new b(i,s);if(t.signal&&t.signal.aborted)return e(new m("Aborted","AbortError"));var o=new XMLHttpRequest;function n(){o.abort()}o.onload=function(){var e,i,t={status:o.status,statusText:o.statusText,headers:(e=o.getAllResponseHeaders()||"",i=new c,e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach(function(e){var t=e.split(":"),n=t.shift().trim();if(n){var r=t.join(":").trim();i.append(n,r)}}),i)};t.url="responseURL"in o?o.responseURL:t.headers.get("X-Request-URL");var n="response"in o?o.response:o.responseText;r(new y(n,t))},o.onerror=function(){e(new TypeError("Network request failed"))},o.ontimeout=function(){e(new TypeError("Network request failed"))},o.onabort=function(){e(new m("Aborted","AbortError"))},o.open(t.method,t.url,!0),"include"===t.credentials?o.withCredentials=!0:"omit"===t.credentials&&(o.withCredentials=!1),"responseType"in o&&a.blob&&(o.responseType="blob"),t.headers.forEach(function(e,t){o.setRequestHeader(t,e)}),t.signal&&(t.signal.addEventListener("abort",n),o.onreadystatechange=function(){4===o.readyState&&t.signal.removeEventListener("abort",n)}),o.send(void 0===t._bodyInit?null:t._bodyInit)})}E.polyfill=!0,self.fetch||(self.fetch=E,self.Headers=c,self.Request=b,self.Response=y)},function(e,t,n){"use strict";n.r(t),n.d(t,"init",function(){return i});var r=n(7);function i(){return new r.a}},function(e,t,n){"use strict";e.exports=n(17).polyfill()},function(e,t,n){(function(re,ie){ | ||
/*! | ||
@@ -10,2 +10,2 @@ * @overview es6-promise - a tiny implementation of Promises/A+. | ||
*/ | ||
t.exports=function(){"use strict";function r(t){var e=typeof t;return t!==null&&(e==="object"||e==="function")}function u(t){return typeof t==="function"}var t=void 0;if(Array.isArray){t=Array.isArray}else{t=function(t){return Object.prototype.toString.call(t)==="[object Array]"}}var n=t,o=0,e=void 0,i=void 0,s=function t(e,n){w[o]=e;w[o+1]=n;o+=2;if(o===2){if(i){i(_)}else{T()}}};function a(t){i=t}function c(t){s=t}var f=typeof window!=="undefined"?window:undefined,l=f||{},h=l.MutationObserver||l.WebKitMutationObserver,d=typeof self==="undefined"&&typeof rt!=="undefined"&&{}.toString.call(rt)==="[object process]",p=typeof Uint8ClampedArray!=="undefined"&&typeof importScripts!=="undefined"&&typeof MessageChannel!=="undefined";function v(){return function(){return rt.nextTick(_)}}function y(){if(typeof e!=="undefined"){return function(){e(_)}}return b()}function m(){var t=0;var e=new h(_);var n=document.createTextNode("");e.observe(n,{characterData:true});return function(){n.data=t=++t%2}}function g(){var t=new MessageChannel;t.port1.onmessage=_;return function(){return t.port2.postMessage(0)}}function b(){var t=setTimeout;return function(){return t(_,1)}}var w=new Array(1e3);function _(){for(var t=0;t<o;t+=2){var e=w[t];var n=w[t+1];e(n);w[t]=undefined;w[t+1]=undefined}o=0}function E(){try{var t=Function("return this")().require("vertx");e=t.runOnLoop||t.runOnContext;return y()}catch(t){return b()}}var T=void 0;if(d){T=v()}else if(h){T=m()}else if(p){T=g()}else if(f===undefined&&"function"==="function"){T=E()}else{T=b()}function A(t,e){var n=this;var r=new this.constructor(x);if(r[k]===undefined){X(r)}var o=n._state;if(o){var i=arguments[o-1];s(function(){return N(o,r,i,n._result)})}else{q(n,r,t,e)}return r}function I(t){var e=this;if(t&&typeof t==="object"&&t.constructor===e){return t}var n=new e(x);F(n,t);return n}var k=Math.random().toString(36).substring(2);function x(){}var S=void 0,C=1,P=2;function j(){return new TypeError("You cannot resolve a promise with itself")}function D(){return new TypeError("A promises callback cannot return that same promise.")}function O(t,e,n,r){try{t.call(e,n,r)}catch(t){return t}}function B(t,r,o){s(function(e){var n=false;var t=O(o,r,function(t){if(n){return}n=true;if(r!==t){F(e,t)}else{M(e,t)}},function(t){if(n){return}n=true;H(e,t)},"Settle: "+(e._label||" unknown promise"));if(!n&&t){n=true;H(e,t)}},t)}function U(e,t){if(t._state===C){M(e,t._result)}else if(t._state===P){H(e,t._result)}else{q(t,undefined,function(t){return F(e,t)},function(t){return H(e,t)})}}function L(t,e,n){if(e.constructor===t.constructor&&n===A&&e.constructor.resolve===I){U(t,e)}else{if(n===undefined){M(t,e)}else if(u(n)){B(t,e,n)}else{M(t,e)}}}function F(e,t){if(e===t){H(e,j())}else if(r(t)){var n=void 0;try{n=t.then}catch(t){H(e,t);return}L(e,t,n)}else{M(e,t)}}function R(t){if(t._onerror){t._onerror(t._result)}z(t)}function M(t,e){if(t._state!==S){return}t._result=e;t._state=C;if(t._subscribers.length!==0){s(z,t)}}function H(t,e){if(t._state!==S){return}t._state=P;t._result=e;s(R,t)}function q(t,e,n,r){var o=t._subscribers;var i=o.length;t._onerror=null;o[i]=e;o[i+C]=n;o[i+P]=r;if(i===0&&t._state){s(z,t)}}function z(t){var e=t._subscribers;var n=t._state;if(e.length===0){return}var r=void 0,o=void 0,i=t._result;for(var s=0;s<e.length;s+=3){r=e[s];o=e[s+n];if(r){N(n,r,o,i)}else{o(i)}}t._subscribers.length=0}function N(t,e,n,r){var o=u(n),i=void 0,s=void 0,a=true;if(o){try{i=n(r)}catch(t){a=false;s=t}if(e===i){H(e,D());return}}else{i=r}if(e._state!==S){}else if(o&&a){F(e,i)}else if(a===false){H(e,s)}else if(t===C){M(e,i)}else if(t===P){H(e,i)}}function Y(n,t){try{t(function t(e){F(n,e)},function t(e){H(n,e)})}catch(t){H(n,t)}}var G=0;function V(){return G++}function X(t){t[k]=G++;t._state=undefined;t._result=undefined;t._subscribers=[]}function $(){return new Error("Array Methods must be provided an Array")}var Q=function(){function t(t,e){this._instanceConstructor=t;this.promise=new t(x);if(!this.promise[k]){X(this.promise)}if(n(e)){this.length=e.length;this._remaining=e.length;this._result=new Array(this.length);if(this.length===0){M(this.promise,this._result)}else{this.length=this.length||0;this._enumerate(e);if(this._remaining===0){M(this.promise,this._result)}}}else{H(this.promise,$())}}t.prototype._enumerate=function t(e){for(var n=0;this._state===S&&n<e.length;n++){this._eachEntry(e[n],n)}};t.prototype._eachEntry=function t(e,n){var r=this._instanceConstructor;var o=r.resolve;if(o===I){var i=void 0;var s=void 0;var a=false;try{i=e.then}catch(t){a=true;s=t}if(i===A&&e._state!==S){this._settledAt(e._state,n,e._result)}else if(typeof i!=="function"){this._remaining--;this._result[n]=e}else if(r===et){var u=new r(x);if(a){H(u,s)}else{L(u,e,i)}this._willSettleAt(u,n)}else{this._willSettleAt(new r(function(t){return t(e)}),n)}}else{this._willSettleAt(o(e),n)}};t.prototype._settledAt=function t(e,n,r){var o=this.promise;if(o._state===S){this._remaining--;if(e===P){H(o,r)}else{this._result[n]=r}}if(this._remaining===0){M(o,this._result)}};t.prototype._willSettleAt=function t(e,n){var r=this;q(e,undefined,function(t){return r._settledAt(C,n,t)},function(t){return r._settledAt(P,n,t)})};return t}();function W(t){return new Q(this,t).promise}function J(o){var i=this;if(n(o))return new i(function(t,e){for(var n=o.length,r=0;r<n;r++)i.resolve(o[r]).then(t,e)});else return new i(function(t,e){return e(new TypeError("You must pass an array to race."))})}function K(t){var e=new this(x);return H(e,t),e}function Z(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function tt(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}var et=function(){function e(t){this[k]=V();this._result=this._state=undefined;this._subscribers=[];if(x!==t){typeof t!=="function"&&Z();this instanceof e?Y(this,t):tt()}}e.prototype.catch=function t(e){return this.then(null,e)};e.prototype.finally=function t(e){var n=this;var r=n.constructor;if(u(e)){return n.then(function(t){return r.resolve(e()).then(function(){return t})},function(t){return r.resolve(e()).then(function(){throw t})})}return n.then(e,e)};return e}();function nt(){var t=void 0;if(void 0!==ot)t=ot;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var e=t.Promise;if(e){var n=null;try{n=Object.prototype.toString.call(e.resolve())}catch(t){}if("[object Promise]"===n&&!e.cast)return}t.Promise=et}return et.prototype.then=A,et.all=function(t){return new Q(this,t).promise},et.race=function(o){var i=this;return n(o)?new i(function(t,e){for(var n=o.length,r=0;r<n;r++)i.resolve(o[r]).then(t,e)}):new i(function(t,e){return e(new TypeError("You must pass an array to race."))})},et.resolve=I,et.reject=function(t){var e=new this(x);return H(e,t),e},et._setScheduler=function(t){i=t},et._setAsap=function(t){s=t},et._asap=s,et.polyfill=function(){var t=void 0;if(void 0!==ot)t=ot;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var e=t.Promise;if(e){var n=null;try{n=Object.prototype.toString.call(e.resolve())}catch(t){}if("[object Promise]"===n&&!e.cast)return}t.Promise=et},et.Promise=et}()}).call(this,n(12),n(4))},function(t,e){var n,r,o=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(e){if(n===setTimeout)return setTimeout(e,0);if((n===i||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:i}catch(t){n=i}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(t){r=s}}();var u,c=[],f=!1,l=-1;function h(){f&&u&&(f=!1,u.length?c=u.concat(c):l=-1,c.length&&d())}function d(){if(!f){var t=a(h);f=!0;for(var e=c.length;e;){for(u=c,c=[];++l<e;)u&&u[l].run();l=-1,e=c.length}u=null,f=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===s||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(t)}}function p(t,e){this.fun=t,this.array=e}function v(){}o.nextTick=function(t){var e=new Array(arguments.length-1);if(1<arguments.length)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];c.push(new p(t,e)),1!==c.length||f||a(d)},p.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=v,o.addListener=v,o.once=v,o.off=v,o.removeListener=v,o.removeAllListeners=v,o.emit=v,o.prependListener=v,o.prependOnceListener=v,o.listeners=function(t){return[]},o.binding=function(t){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(t){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(t,e){var n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(n){var r=new Uint8Array(16);t.exports=function(){return n(r),r}}else{var o=new Array(16);t.exports=function(){for(var t,e=0;e<16;e++)0==(3&e)&&(t=4294967296*Math.random()),o[e]=t>>>((3&e)<<3)&255;return o}}},function(t,e){for(var r=[],n=0;n<256;++n)r[n]=(n+256).toString(16).substr(1);t.exports=function(t,e){var n=e||0;return[r[t[n++]],r[t[n++]],r[t[n++]],r[t[n++]],"-",r[t[n++]],r[t[n++]],"-",r[t[n++]],r[t[n++]],"-",r[t[n++]],r[t[n++]],"-",r[t[n++]],r[t[n++]],r[t[n++]],r[t[n++]],r[t[n++]],r[t[n++]]].join("")}},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e,n){"use strict";n.r(e);var r,o=n(0),i=n.n(o),s=n(1),a=n.n(s),u=(n(10),n(3)),c=n.n(u),f=n(2),l=n.n(f),h=!1;function d(t){if(h&&r){var e=document.createElement("p");e.style.display="block",e.style.fontSize="10px",e.style.margin="2px";var n=document.createTextNode(t);e.appendChild(n),r.appendChild(e)}}function p(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];for(var r=e[0],o=1;o<e.length;++o)r=r>e[o]?r:e[o];return r}function v(t){var e="number"==typeof t?t:Number(t);return Math.round(e)}function y(){return window.mouselogUserId?window.mouselogUserId:""}function m(t,e){if(t&&e&&t.length==e.length){for(var n=0;n<t.length;++n)if(t[n]!=e[n])return;return 1}}var g=0,b=1,w=2,_=function(){function r(t,e,n){i()(this,r),this.impressionId=t,this.sessionId=e,this.config=n,this.resendQueue=[]}return a()(r,[{key:"start",value:function(){var t=this;this.resendInterval=setInterval(function(){t._resendFailedData.call(t)},this.config.resendInterval)}},{key:"stop",value:function(){clearInterval(this.resendInterval)}},{key:"upload",value:function(o,i,t){var s=this,a=2<arguments.length&&void 0!==t&&t;return new Promise(function(e){d("Uploading Pkg ".concat(o.packetId,", window size: ").concat(o.width,"*").concat(o.height,", events count: ").concat(o.events.length));for(var t=0;t<3&&t<o.events.length;++t)d(" ".concat(JSON.stringify(o.events[t])));var n,r=l()(s.config.absoluteUrl,"?websiteId=".concat(s.config.websiteId,"&sessionId=").concat(s.sessionId,"&impressionId=").concat(s.impressionId,"&userId=").concat(y()).concat(a?"&queryConfig=1":""));s._upload(i,r).then(function(t){if(n=t.status,d("Pkg ".concat(o.packetId,", status code: ").concat(n,", content type: ").concat(t.headers.get("Content-Type"))),200==n)return t.json();throw new Error("Response status code is not 200.")}).then(function(t){if(d("Pkg ".concat(o.packetId," response=").concat(JSON.stringify(t))),"ok"!==t.status)throw new Error("Response object status is not ok.");"config"==t.msg&&e({status:1,msg:"Get config from server",config:t.data}),e({status:0})}).catch(function(t){n&&"2"===n.toString()[0]?(d("Pkg ".concat(o.packetId," was successfully sent, but no expected response. Error message: ").concat(t.message)),e({status:-1,msg:"Pkg ".concat(o.packetId," get no expected response, ").concat(t.message)})):(d("Pkg ".concat(o.packetId," failed, wait for resending. Error message: ").concat(t.message)),s._appendFailedData(o,i),e({status:-1,msg:"Fail to upload data bunch #".concat(o.packetId,", ").concat(t.message)}))})})}},{key:"setConfig",value:function(t){this.stop(),this.config=t,this.start()}},{key:"_resendFailedData",value:function(){var t=this,n=0;0<this.resendQueue.length&&d("Resending data...");for(var e=function(){var e=t.resendQueue[n];e.status==w?t.resendQueue.splice(n,1):(n+=1,d("Resending Pkg ".concat(e.data.packetId)),e.status==g&&(e.status=b,t.upload(e.data,e.encodedData).then(function(t){e.status=t?w:g})))};n<this.resendQueue.length;)e()}},{key:"_upload",value:function(t,e){return this.config.enableGet?fetch("".concat(e,"&data=").concat(t),{method:"GET",keepalive:!0}):fetch(e,{method:"POST",body:t,keepalive:!0})}},{key:"_appendFailedData",value:function(t,e){this.resendQueue.push({status:g,data:t,encodedData:e})}}]),r}(),E=function(){function t(){i()(this,t),this.uploadEndpoint="http://localhost:9000",this.websiteId="unknown",this.endpointType="absolute",this.uploadMode="mixed",this.uploadPeriod=5e3,this.frequency=50,this.uploadTimes=null,this.sizeLimit=65535,this.enableGet=!1,this.resendInterval=2e4,this.scope=window.document,this.encoder="",this.enableServerConfig=!0,this.enableSession=!0,this.enableSendEmpty=!1,this._requiredParams=["uploadEndpoint"],this._ignoredParams=["scope"]}return a()(t,[{key:"build",value:function(e,t){var n=this,r=1<arguments.length&&void 0!==t&&t;try{this._requiredParams.forEach(function(t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new Error("Param ".concat(t," is required but not declared."))}),Object.keys(e).forEach(function(t){void 0!==n[t]&&0!==t.indexOf("_")&&"function"!=typeof n[t]&&(r&&t in n._ignoredParams||(n[t]=e[t]))}),this._formatUrl()}catch(t){return d(t),!1}return!0}},{key:"update",value:function(t){return this.build(t,!0)}},{key:"_formatUrl",value:function(){if("relative"==this.endpointType)this.absoluteUrl=l()(window.location.origin,this.uploadEndpoint);else{if("absolute"!=this.endpointType)throw new Error('`endpointType` can only be "absolute" or "relative"');this.absoluteUrl=this.uploadEndpoint}}}]),t}(),T=n(5),A=n.n(T),I=n(6),k=["mousemove","mousedown","mouseup","click","dblclick","contextmenu","wheel","touchstart","touchmove","touchend","resize"],x=new Date,S=function(){var t=c()();try{return localStorage.setItem(t,t),localStorage.removeItem(t),!0}catch(t){return!1}}(),C="hidden"in document?"hidden":"webkitHidden"in document?"webkitHidden":"mozHidden"in document?"mozHidden":null,P=C?C.replace(/hidden/i,"visibilitychange"):null;function j(){if(!S)return"";var t=localStorage.getItem("mouselogSessionID");return null==t&&(t=c()(),localStorage.setItem("mouselogSessionID",t)),t}var D=function(){function t(){i()(this,t),this.config=new E,this.impressionId=c()(),this.mouselogLoadTime=new Date,this.uploader=new _,this.batchCount=0,this.packetCount=0,this.eventsList=[],this.lastEvtInfo,this.eventsCount=0,this.uploadInterval,this.uploadTimeout}return a()(t,[{key:"_clearBuffer",value:function(){this.eventsList=[]}},{key:"_newDataBatch",value:function(){var t={batchId:this.batchCount,packetId:0,url:window.location.hostname?window.location.hostname:"localhost",path:window.location.pathname,width:p(document.body.scrollWidth,window.innerWidth),height:p(document.body.scrollHeight,window.innerHeight),pageLoadTime:x,referrer:document.referrer,events:[]};return this.batchCount+=1,t}},{key:"_onVisibilityChange",value:function(){window.document[C]?this._pause():this._resume()}},{key:"_mouseHandler",value:function(t){if("contextmenu"!==t.type||0!==t.pageX||0!==t.pageY){var e=[this.eventsCount,k.indexOf(t.type),Math.floor(t.timeStamp)/1e3];switch(t.type){case"mousemove":var n=v(t.pageX),r=v(t.pageY);e.push(n,r);break;case"touchmove":case"touchstart":case"touchend":n=v(t.changedTouches[0].pageX),r=v(t.changedTouches[0].pageY),e.push(n,r);break;case"wheel":n=v(t.pageX),r=v(t.pageY);var o=v(t.deltaX),i=v(t.deltaY);e.push(n,r,o,i);break;case"mouseup":case"mousedown":case"click":case"dblclick":case"contextmenu":n=v(t.pageX),r=v(t.pageY);var s="2"===t.buttono?"Right":"";e.push(n,r,s);break;case"resize":var a=t.target.innerWidth,u=t.target.innerHeight;e.push(a,u)}this.lastEvtInfo&&m(this.lastEvtInfo,e)||this.lastEvtInfo&&("mousemove"==k[e[1]]||"touchmove"==k[e[1]])&&this.lastEvtInfo[1]==e[1]&&m(this.lastEvtInfo.slice(3),e.slice(3))||(this.eventsList.push(e),this.lastEvtInfo=e,this.eventsCount+=1,"event-triggered"==this.config.uploadMode&&this.eventsList.length%this.config.frequency==0&&this._uploadData(),"mixed"==this.config.uploadMode&&this.eventsList.length%this.config.frequency==0&&(this._periodUploadTimeout(),this._uploadData()))}}},{key:"_encodeData",value:function(t){var e=JSON.stringify(t);return"base64"==this.config.encoder.toLowerCase()&&(e=I.encode(e)),e}},{key:"_binarySplitBigDataBlock",value:function(t){var e=this._encodeData(t),n=[];if(function(t){for(var e=t.length,n=t.length-1;0<=n;n--){var r=t.charCodeAt(n);127<r&&r<=2047?e++:2047<r&&r<=65535&&(e+=2),56320<=r&&r<=57343&&n--}return e}(e)>=this.config.sizeLimit){var r=A()(t);t.events.splice(t.events.length/2),r.events.splice(0,r.events.length/2),this._binarySplitBigDataBlock(t).forEach(function(t){n.push(t)}),this._binarySplitBigDataBlock(r).forEach(function(t){n.push(t)})}else n.push(t);return n}},{key:"_fetchConfigFromServer",value:function(){var t=this._newDataBatch();return t.packetId=this.packetCount,this.packetCount+=1,this.uploader.upload(t,this._encodeData(t),!0)}},{key:"_uploadData",value:function(){var n=this;if(!(this.config.uploadTimes&&this.batchCount>=this.config.uploadTimes+this.config.enableServerConfig)){var t=this._newDataBatch();t.events=this.eventsList,this.eventsList=[],this._binarySplitBigDataBlock(t).forEach(function(t){t.packetId=n.packetCount,n.packetCount+=1;var e=n._encodeData(t);n.uploader.upload(t,e)})}}},{key:"_periodUploadTimeout",value:function(){var t=this;clearTimeout(this.uploadTimeout),this.uploadTimeout=setTimeout(function(){(t.config.enableSendEmpty||0<t.eventsList.length)&&t._uploadData()},this.config.uploadPeriod)}},{key:"_periodUploadInterval",value:function(){var t=this;clearInterval(this.uploadInterval),this.uploadInterval=setInterval(function(){(t.config.enableSendEmpty||0<t.eventsList.length)&&t._uploadData()},this.config.uploadPeriod)}},{key:"_runCollector",value:function(){var e=this;k.forEach(function(t){e.config.scope.addEventListener(t,function(t){return e._mouseHandler(t)})}),"periodic"===this.config.uploadMode&&this._periodUploadInterval(),"mixed"===this.config.uploadMode&&this._periodUploadTimeout()}},{key:"_stopCollector",value:function(){var e=this;k.forEach(function(t){e.config.scope.removeEventListener(t,function(t){return e._mouseHandler(t)})}),clearInterval(this.uploadInterval),clearTimeout(this.uploadTimeout)}},{key:"_resetCollector",value:function(){this._stopCollector(),this._runCollector()}},{key:"_init",value:function(t){var e=this;return this._clearBuffer(),this.config.build(t)?(this.sessionId=this.config.enableSession?j():"",this.uploader=new _(this.impressionId,this.sessionId,this.config),this.config.enableServerConfig&&this._fetchConfigFromServer().then(function(t){if(1!=t.status)throw new Error("Fail to get config from server.");if(!e.config.update(t.config))throw new Error("Unable to update config with server config.");e._resetCollector(),e.uploader.setConfig(e.config),e.sessionId=e.config.enableSession?j():"",e.uploader.sessionId=e.sessionId,d("Successfully update config from backend.")}).catch(function(t){d(t)}),window.onunload=function(){0!=e.eventsList.length&&e._uploadData()},{status:0}):{status:-1,msg:"Invalid configuration."}}},{key:"_pause",value:function(){this._stopCollector()}},{key:"_resume",value:function(){this._runCollector()}},{key:"run",value:function(t){var e=this;if(function(t){var e=0<arguments.length&&void 0!==t?t:9,n=navigator.userAgent.toLowerCase().match(/msie ([\d]+)/);return n&&v(n[1])<=e}(9))d("IE Browser version <= 9. Stop.");else{var n=this._init(t);0==n.status?(P&&document.addEventListener(P,function(t){return e._onVisibilityChange(t)}),this._runCollector(),this.uploader.start(this.impressionId),d("Mouselog agent is activated!"),d("Website ID: ".concat(this.config.websiteId)),d("Session ID: ".concat(this.sessionId)),d("Impression ID: ".concat(this.impressionId)),d("User-Agent: ".concat(navigator.userAgent)),d("User ID: ".concat(y())),d("Page load time: ".concat(x))):(d(n.msg),d("Fail to initialize Mouselog agent."))}}},{key:"debug",value:function(t,e){var n;h=!0,(n=e)&&(r=window.document.getElementById(n)),this.run(t)}},{key:"stop",value:function(){this.uploader.stop(),this._stopCollector(),this._clearBuffer(),d("Mouselog agent ".concat(this.impressionId," is stopped!"))}}]),t}();function O(){return new D}n.d(e,"init",function(){return O})}],o.c=r,o.d=function(t,e,n){o.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},o.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)o.d(n,r,function(t){return e[t]}.bind(null,r));return n},o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,"a",e),e},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.p="",o(o.s=7);function o(t){if(r[t])return r[t].exports;var e=r[t]={i:t,l:!1,exports:{}};return n[t].call(e.exports,e,e.exports,o),e.l=!0,e.exports}var n,r}); | ||
e.exports=function(){"use strict";function r(e){var t=typeof e;return e!==null&&(t==="object"||t==="function")}function u(e){return typeof e==="function"}var e=void 0;if(Array.isArray){e=Array.isArray}else{e=function(e){return Object.prototype.toString.call(e)==="[object Array]"}}var n=e,i=0,t=void 0,o=void 0,s=function e(t,n){m[i]=t;m[i+1]=n;i+=2;if(i===2){if(o){o(E)}else{I()}}};function a(e){o=e}function c(e){s=e}var l=typeof window!=="undefined"?window:undefined,_=l||{},f=_.MutationObserver||_.WebKitMutationObserver,d=typeof self==="undefined"&&typeof re!=="undefined"&&{}.toString.call(re)==="[object process]",h=typeof Uint8ClampedArray!=="undefined"&&typeof importScripts!=="undefined"&&typeof MessageChannel!=="undefined";function p(){return function(){return re.nextTick(E)}}function b(){if(typeof t!=="undefined"){return function(){t(E)}}return g()}function v(){var e=0;var t=new f(E);var n=document.createTextNode("");t.observe(n,{characterData:true});return function(){n.data=e=++e%2}}function y(){var e=new MessageChannel;e.port1.onmessage=E;return function(){return e.port2.postMessage(0)}}function g(){var e=setTimeout;return function(){return e(E,1)}}var m=new Array(1e3);function E(){for(var e=0;e<i;e+=2){var t=m[e];var n=m[e+1];t(n);m[e]=undefined;m[e+1]=undefined}i=0}function w(){try{var e=Function("return this")().require("vertx");t=e.runOnLoop||e.runOnContext;return b()}catch(e){return g()}}var I=void 0;if(d){I=p()}else if(f){I=v()}else if(h){I=y()}else if(l===undefined&&"function"==="function"){I=w()}else{I=g()}function O(e,t){var n=this;var r=new this.constructor(M);if(r[D]===undefined){Y(r)}var i=n._state;if(i){var o=arguments[i-1];s(function(){return V(i,r,o,n._result)})}else{F(n,r,e,t)}return r}function P(e){var t=this;if(e&&typeof e==="object"&&e.constructor===t){return e}var n=new t(M);S(n,e);return n}var D=Math.random().toString(36).substring(2);function M(){}var T=void 0,A=1,C=2;function B(){return new TypeError("You cannot resolve a promise with itself")}function k(){return new TypeError("A promises callback cannot return that same promise.")}function U(e,t,n,r){try{e.call(t,n,r)}catch(e){return e}}function L(e,r,i){s(function(t){var n=false;var e=U(i,r,function(e){if(n){return}n=true;if(r!==e){S(t,e)}else{W(t,e)}},function(e){if(n){return}n=true;K(t,e)},"Settle: "+(t._label||" unknown promise"));if(!n&&e){n=true;K(t,e)}},e)}function R(t,e){if(e._state===A){W(t,e._result)}else if(e._state===C){K(t,e._result)}else{F(e,undefined,function(e){return S(t,e)},function(e){return K(t,e)})}}function x(e,t,n){if(t.constructor===e.constructor&&n===O&&t.constructor.resolve===P){R(e,t)}else{if(n===undefined){W(e,t)}else if(u(n)){L(e,t,n)}else{W(e,t)}}}function S(t,e){if(t===e){K(t,B())}else if(r(e)){var n=void 0;try{n=e.then}catch(e){K(t,e);return}x(t,e,n)}else{W(t,e)}}function j(e){if(e._onerror){e._onerror(e._result)}q(e)}function W(e,t){if(e._state!==T){return}e._result=t;e._state=A;if(e._subscribers.length!==0){s(q,e)}}function K(e,t){if(e._state!==T){return}e._state=C;e._result=t;s(j,e)}function F(e,t,n,r){var i=e._subscribers;var o=i.length;e._onerror=null;i[o]=t;i[o+A]=n;i[o+C]=r;if(o===0&&e._state){s(q,e)}}function q(e){var t=e._subscribers;var n=e._state;if(t.length===0){return}var r=void 0,i=void 0,o=e._result;for(var s=0;s<t.length;s+=3){r=t[s];i=t[s+n];if(r){V(n,r,i,o)}else{i(o)}}e._subscribers.length=0}function V(e,t,n,r){var i=u(n),o=void 0,s=void 0,a=true;if(i){try{o=n(r)}catch(e){a=false;s=e}if(t===o){K(t,k());return}}else{o=r}if(t._state!==T){}else if(i&&a){S(t,o)}else if(a===false){K(t,s)}else if(e===A){W(t,o)}else if(e===C){K(t,o)}}function H(n,e){try{e(function e(t){S(n,t)},function e(t){K(n,t)})}catch(e){K(n,e)}}var z=0;function N(){return z++}function Y(e){e[D]=z++;e._state=undefined;e._result=undefined;e._subscribers=[]}function G(){return new Error("Array Methods must be provided an Array")}var X=function(){function e(e,t){this._instanceConstructor=e;this.promise=new e(M);if(!this.promise[D]){Y(this.promise)}if(n(t)){this.length=t.length;this._remaining=t.length;this._result=new Array(this.length);if(this.length===0){W(this.promise,this._result)}else{this.length=this.length||0;this._enumerate(t);if(this._remaining===0){W(this.promise,this._result)}}}else{K(this.promise,G())}}e.prototype._enumerate=function e(t){for(var n=0;this._state===T&&n<t.length;n++){this._eachEntry(t[n],n)}};e.prototype._eachEntry=function e(t,n){var r=this._instanceConstructor;var i=r.resolve;if(i===P){var o=void 0;var s=void 0;var a=false;try{o=t.then}catch(e){a=true;s=e}if(o===O&&t._state!==T){this._settledAt(t._state,n,t._result)}else if(typeof o!=="function"){this._remaining--;this._result[n]=t}else if(r===te){var u=new r(M);if(a){K(u,s)}else{x(u,t,o)}this._willSettleAt(u,n)}else{this._willSettleAt(new r(function(e){return e(t)}),n)}}else{this._willSettleAt(i(t),n)}};e.prototype._settledAt=function e(t,n,r){var i=this.promise;if(i._state===T){this._remaining--;if(t===C){K(i,r)}else{this._result[n]=r}}if(this._remaining===0){W(i,this._result)}};e.prototype._willSettleAt=function e(t,n){var r=this;F(t,undefined,function(e){return r._settledAt(A,n,e)},function(e){return r._settledAt(C,n,e)})};return e}();function $(e){return new X(this,e).promise}function Q(i){var o=this;if(n(i))return new o(function(e,t){for(var n=i.length,r=0;r<n;r++)o.resolve(i[r]).then(e,t)});else return new o(function(e,t){return t(new TypeError("You must pass an array to race."))})}function J(e){var t=new this(M);return K(t,e),t}function Z(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function ee(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}var te=function(){function t(e){this[D]=N();this._result=this._state=undefined;this._subscribers=[];if(M!==e){typeof e!=="function"&&Z();this instanceof t?H(this,e):ee()}}t.prototype.catch=function e(t){return this.then(null,t)};t.prototype.finally=function e(t){var n=this;var r=n.constructor;if(u(t)){return n.then(function(e){return r.resolve(t()).then(function(){return e})},function(e){return r.resolve(t()).then(function(){throw e})})}return n.then(t,t)};return t}();function ne(){var e=void 0;if(void 0!==ie)e=ie;else if("undefined"!=typeof self)e=self;else try{e=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var t=e.Promise;if(t){var n=null;try{n=Object.prototype.toString.call(t.resolve())}catch(e){}if("[object Promise]"===n&&!t.cast)return}e.Promise=te}return te.prototype.then=O,te.all=function(e){return new X(this,e).promise},te.race=function(i){var o=this;return n(i)?new o(function(e,t){for(var n=i.length,r=0;r<n;r++)o.resolve(i[r]).then(e,t)}):new o(function(e,t){return t(new TypeError("You must pass an array to race."))})},te.resolve=P,te.reject=function(e){var t=new this(M);return K(t,e),t},te._setScheduler=function(e){o=e},te._setAsap=function(e){s=e},te._asap=s,te.polyfill=function(){var e=void 0;if(void 0!==ie)e=ie;else if("undefined"!=typeof self)e=self;else try{e=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var t=e.Promise;if(t){var n=null;try{n=Object.prototype.toString.call(t.resolve())}catch(e){}if("[object Promise]"===n&&!t.cast)return}e.Promise=te},te.Promise=te}()}).call(this,n(18),n(6))},function(e,t){var n,r,i=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(t){if(n===setTimeout)return setTimeout(t,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(e){n=o}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(e){r=s}}();var u,c=[],l=!1,_=-1;function f(){l&&u&&(l=!1,u.length?c=u.concat(c):_=-1,c.length&&d())}function d(){if(!l){var e=a(f);l=!0;for(var t=c.length;t;){for(u=c,c=[];++_<t;)u&&u[_].run();_=-1,t=c.length}u=null,l=!1,function(t){if(r===clearTimeout)return clearTimeout(t);if((r===s||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(t);try{r(t)}catch(e){try{return r.call(null,t)}catch(e){return r.call(this,t)}}}(e)}}function h(e,t){this.fun=e,this.array=t}function p(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(1<arguments.length)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];c.push(new h(e,t)),1!==c.length||l||a(d)},h.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=p,i.addListener=p,i.once=p,i.off=p,i.removeListener=p,i.removeAllListeners=p,i.emit=p,i.prependListener=p,i.prependOnceListener=p,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(e,t){var n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(n){var r=new Uint8Array(16);e.exports=function(){return n(r),r}}else{var i=new Array(16);e.exports=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),i[t]=e>>>((3&t)<<3)&255;return i}}},function(e,t){for(var r=[],n=0;n<256;++n)r[n]=(n+256).toString(16).substr(1);e.exports=function(e,t){var n=t||0;return[r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]]].join("")}},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}}],e={},f.m=d,f.c=e,f.d=function(e,t,n){f.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},f.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},f.t=function(t,e){if(1&e&&(t=f(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(f.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)f.d(n,r,function(e){return t[e]}.bind(null,r));return n},f.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return f.d(t,"a",t),t},f.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},f.p="",f(f.s=12);function f(t){if(e[t])return e[t].exports;var n=e[t]={i:t,l:!1,exports:{}};return d[t].call(n.exports,n,n.exports,f),n.l=!0,n.exports}var d,e}); |
{ | ||
"name": "mouselog", | ||
"version": "0.2.7", | ||
"version": "0.2.8-beta1", | ||
"description": "The mouse tracking agent for Mouselog.", | ||
@@ -5,0 +5,0 @@ "main": "./src/index.js", |
@@ -137,2 +137,13 @@ [](https://www.npmjs.com/package/mouselog) | ||
// Type: string | ||
// A global predefined variable for setting the impression ID. | ||
// When initializing the impression ID, mouselog will try to call `eval(this.impIdVariable)`. | ||
// Warning: Please don't set the same impression ID variable in two different mouselog instances. | ||
this.impIdVariable = null; | ||
// Type: string | ||
// A global predefined variable for setting the session ID. | ||
// When initializing the session ID, mouselog will try to call `eval(this.sessionIdVariable)`. | ||
this.sessionIdVariable = null; | ||
// Type: HTML DOM Element | ||
@@ -139,0 +150,0 @@ // Agent only listens and captures events in `config.scope` |
Sorry, the diff of this file is too big to display
154808
3091
170