From 1384e55648d68b64e8f84a04a78463c940e2e519 Mon Sep 17 00:00:00 2001 From: Adam Kasprowicz Date: Mon, 7 Jan 2019 11:05:14 +0100 Subject: [PATCH] 4.0.17 --- dist/keen-tracking.js | 2 +- dist/keen-tracking.min.js | 2 +- dist/keen-tracking.min.js.map | 2 +- dist/node/keen-tracking.js | 2 +- package-lock.json | 2 +- package.json | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/dist/keen-tracking.js b/dist/keen-tracking.js index 187b29e3..f43bc417 100644 --- a/dist/keen-tracking.js +++ b/dist/keen-tracking.js @@ -1240,7 +1240,7 @@ function getExtendedEventBody(result, queue) { /* 15 */ /***/ (function(module) { -module.exports = {"name":"keen-tracking","version":"4.0.16","description":"Track events - custom user actions, clicks, pageviews, purchases.","main":"dist/node/keen-tracking.js","browser":"dist/keen-tracking.js","repository":{"type":"git","url":"https://github.com/keen/keen-tracking.js.git"},"scripts":{"start":"NODE_ENV=development webpack-dev-server","test":"NODE_ENV=test jest && npm run test:node","test:node":"NODE_ENV=test TEST_ENV=node jest","test:watch":"NODE_ENV=test jest --watch","test:node:watch":"NODE_ENV=test TEST_ENV=node jest --watch","build":"NODE_ENV=production webpack -p && NODE_ENV=production OPTIMIZE_MINIMIZE=1 webpack -p && npm run build:node","build:node":"TARGET=node NODE_ENV=production webpack -p","profile":"webpack --profile --json > stats.json","analyze":"webpack-bundle-analyzer stats.json /dist","version":"npm run build && npm run test && git add .","postversion":"git push && git push --tags","demo":"node ./test/demo/index.node.js"},"bugs":"https://github.com/keen/keen-tracking.js/issues","author":"Keen IO (https://keen.io/)","homepage":"https://keen.io","keywords":["Tracking","Tracker","Event Tracker","Event tracking","Track events","Page tracking","User tracking","Analytics event tracking","Analytics events","Analytics tracking","Custom events","Analytics","Stats","Statistics","Monitoring","Metrics","Pageviews","Segmentation","Funnel","Conversion","Log","Logger","Logging","Javascript events","Universal tracking","Click analytics"],"contributors":["Dustin Larimer (https://github.com/dustinlarimer)","Eric Anderson (https://github.com/aroc)","Joe Wegner (http://www.wegnerdesign.com)","Alex Kleissner (https://github.com/hex337)","Adam Kasprowicz (https://github.com/adamkasprowicz)"],"license":"MIT","dependencies":{"component-emitter":"^1.2.0","js-cookie":"2.1.0","keen-core":"^0.1.3","promise-polyfill":"^8.0.0","whatwg-fetch":"^2.0.4"},"devDependencies":{"babel-core":"^6.26.3","babel-jest":"^23.0.1","babel-loader":"^7.1.5","babel-plugin-transform-es2015-modules-commonjs":"^6.26.2","babel-plugin-transform-object-rest-spread":"^6.26.0","babel-polyfill":"^6.26.0","babel-preset-env":"^1.7.0","babel-preset-es2015":"^6.24.1","babel-preset-stage-0":"^6.24.1","eslint":"^4.19.1","eslint-config-airbnb":"^16.1.0","eslint-loader":"^2.0.0","eslint-plugin-import":"^2.11.0","eslint-plugin-jsx-a11y":"^6.0.3","html-loader":"^0.5.5","html-webpack-plugin":"^3.2.0","jest":"^22.4.3","jest-fetch-mock":"^1.6.5","merge":"^1.2.1","nock":"^9.2.6","regenerator-runtime":"^0.11.1","replace-in-file":"^3.4.0","url-parse":"^1.4.3","webpack":"^4.5.0","webpack-bundle-analyzer":"^2.11.1","webpack-cli":"^2.0.13","webpack-dev-server":"^3.1.1","xhr-mock":"^2.3.2"}}; +module.exports = {"name":"keen-tracking","version":"4.0.17","description":"Track events - custom user actions, clicks, pageviews, purchases.","main":"dist/node/keen-tracking.js","browser":"dist/keen-tracking.js","repository":{"type":"git","url":"https://github.com/keen/keen-tracking.js.git"},"scripts":{"start":"NODE_ENV=development webpack-dev-server","test":"NODE_ENV=test jest && npm run test:node","test:node":"NODE_ENV=test TEST_ENV=node jest","test:watch":"NODE_ENV=test jest --watch","test:node:watch":"NODE_ENV=test TEST_ENV=node jest --watch","build":"NODE_ENV=production webpack -p && NODE_ENV=production OPTIMIZE_MINIMIZE=1 webpack -p && npm run build:node","build:node":"TARGET=node NODE_ENV=production webpack -p","profile":"webpack --profile --json > stats.json","analyze":"webpack-bundle-analyzer stats.json /dist","version":"npm run build && npm run test && git add .","postversion":"git push && git push --tags","demo":"node ./test/demo/index.node.js"},"bugs":"https://github.com/keen/keen-tracking.js/issues","author":"Keen IO (https://keen.io/)","homepage":"https://keen.io","keywords":["Tracking","Tracker","Event Tracker","Event tracking","Track events","Page tracking","User tracking","Analytics event tracking","Analytics events","Analytics tracking","Custom events","Analytics","Stats","Statistics","Monitoring","Metrics","Pageviews","Segmentation","Funnel","Conversion","Log","Logger","Logging","Javascript events","Universal tracking","Click analytics"],"contributors":["Dustin Larimer (https://github.com/dustinlarimer)","Eric Anderson (https://github.com/aroc)","Joe Wegner (http://www.wegnerdesign.com)","Alex Kleissner (https://github.com/hex337)","Adam Kasprowicz (https://github.com/adamkasprowicz)"],"license":"MIT","dependencies":{"component-emitter":"^1.2.0","js-cookie":"2.1.0","keen-core":"^0.1.3","promise-polyfill":"^8.0.0","whatwg-fetch":"^2.0.4"},"devDependencies":{"babel-core":"^6.26.3","babel-jest":"^23.0.1","babel-loader":"^7.1.5","babel-plugin-transform-es2015-modules-commonjs":"^6.26.2","babel-plugin-transform-object-rest-spread":"^6.26.0","babel-polyfill":"^6.26.0","babel-preset-env":"^1.7.0","babel-preset-es2015":"^6.24.1","babel-preset-stage-0":"^6.24.1","eslint":"^4.19.1","eslint-config-airbnb":"^16.1.0","eslint-loader":"^2.0.0","eslint-plugin-import":"^2.11.0","eslint-plugin-jsx-a11y":"^6.0.3","html-loader":"^0.5.5","html-webpack-plugin":"^3.2.0","jest":"^22.4.3","jest-fetch-mock":"^1.6.5","merge":"^1.2.1","nock":"^9.2.6","regenerator-runtime":"^0.11.1","replace-in-file":"^3.4.0","url-parse":"^1.4.3","webpack":"^4.5.0","webpack-bundle-analyzer":"^2.11.1","webpack-cli":"^2.0.13","webpack-dev-server":"^3.1.14","xhr-mock":"^2.3.2"}}; /***/ }), /* 16 */ diff --git a/dist/keen-tracking.min.js b/dist/keen-tracking.min.js index d82b2d9b..f6416d45 100644 --- a/dist/keen-tracking.min.js +++ b/dist/keen-tracking.min.js @@ -1,4 +1,4 @@ -!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}}(window,function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=43)}([function(e,t){e.exports=function(e,t,n){var r;if(!e)return 0;if(n=n||e,e instanceof Array){for(r=0;r-1};l.prototype.append=function(e,t){e=a(e),t=u(t);var n=this.map[e];this.map[e]=n?n+","+t:t},l.prototype.delete=function(e){delete this.map[a(e)]},l.prototype.get=function(e){return e=a(e),this.has(e)?this.map[e]:null},l.prototype.has=function(e){return this.map.hasOwnProperty(a(e))},l.prototype.set=function(e,t){this.map[a(e)]=u(t)},l.prototype.forEach=function(e,t){for(var n in this.map)this.map.hasOwnProperty(n)&&e.call(t,this.map[n],n,this)},l.prototype.keys=function(){var e=[];return this.forEach(function(t,n){e.push(n)}),c(e)},l.prototype.values=function(){var e=[];return this.forEach(function(t){e.push(t)}),c(e)},l.prototype.entries=function(){var e=[];return this.forEach(function(t,n){e.push([n,t])}),c(e)},t.iterable&&(l.prototype[Symbol.iterator]=l.prototype.entries);var i=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];m.prototype.clone=function(){return new m(this,{body:this._bodyInit})},y.call(m.prototype),y.call(g.prototype),g.prototype.clone=function(){return new g(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new l(this.headers),url:this.url})},g.error=function(){var e=new g(null,{status:0,statusText:""});return e.type="error",e};var s=[301,302,303,307,308];g.redirect=function(e,t){if(-1===s.indexOf(t))throw new RangeError("Invalid status code");return new g(null,{status:t,headers:{location:e}})},e.Headers=l,e.Request=m,e.Response=g,e.fetch=function(e,n){return new Promise(function(r,o){var i=new m(e,n),s=new XMLHttpRequest;s.onload=function(){var e,t,n={status:s.status,statusText:s.statusText,headers:(e=s.getAllResponseHeaders()||"",t=new l,e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach(function(e){var n=e.split(":"),r=n.shift().trim();if(r){var o=n.join(":").trim();t.append(r,o)}}),t)};n.url="responseURL"in s?s.responseURL:n.headers.get("X-Request-URL");var o="response"in s?s.response:s.responseText;r(new g(o,n))},s.onerror=function(){o(new TypeError("Network request failed"))},s.ontimeout=function(){o(new TypeError("Network request failed"))},s.open(i.method,i.url,!0),"include"===i.credentials?s.withCredentials=!0:"omit"===i.credentials&&(s.withCredentials=!1),"responseType"in s&&t.blob&&(s.responseType="blob"),i.headers.forEach(function(e,t){s.setRequestHeader(t,e)}),s.send(void 0===i._bodyInit?null:i._bodyInit)})},e.fetch.polyfill=!0}function a(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 u(e){return"string"!=typeof e&&(e=String(e)),e}function c(e){var n={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return t.iterable&&(n[Symbol.iterator]=function(){return n}),n}function l(e){this.map={},e instanceof l?e.forEach(function(e,t){this.append(t,e)},this):Array.isArray(e)?e.forEach(function(e){this.append(e[0],e[1])},this):e&&Object.getOwnPropertyNames(e).forEach(function(t){this.append(t,e[t])},this)}function f(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function d(e){return new Promise(function(t,n){e.onload=function(){t(e.result)},e.onerror=function(){n(e.error)}})}function h(e){var t=new FileReader,n=d(t);return t.readAsArrayBuffer(e),n}function p(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function y(){return this.bodyUsed=!1,this._initBody=function(e){if(this._bodyInit=e,e)if("string"==typeof e)this._bodyText=e;else if(t.blob&&Blob.prototype.isPrototypeOf(e))this._bodyBlob=e;else if(t.formData&&FormData.prototype.isPrototypeOf(e))this._bodyFormData=e;else if(t.searchParams&&URLSearchParams.prototype.isPrototypeOf(e))this._bodyText=e.toString();else if(t.arrayBuffer&&t.blob&&r(e))this._bodyArrayBuffer=p(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer]);else{if(!t.arrayBuffer||!ArrayBuffer.prototype.isPrototypeOf(e)&&!o(e))throw new Error("unsupported BodyInit type");this._bodyArrayBuffer=p(e)}else 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):t.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},t.blob&&(this.blob=function(){var e=f(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?f(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(h)}),this.text=function(){var e,t,n,r=f(this);if(r)return r;if(this._bodyBlob)return e=this._bodyBlob,t=new FileReader,n=d(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-1?r:n),this.mode=t.mode||this.mode||null,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 v(e){var t=new FormData;return e.trim().split("&").forEach(function(e){if(e){var n=e.split("="),r=n.shift().replace(/\+/g," "),o=n.join("=").replace(/\+/g," ");t.append(decodeURIComponent(r),decodeURIComponent(o))}}),t}function g(e,t){t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new l(t.headers),this.url=t.url||"",this._initBody(e)}}("undefined"!=typeof self?self:this)},function(e,t,n){function r(e){if(e)return function(e){for(var t in r.prototype)e[t]=r.prototype[t];return e}(e)}e.exports=r,r.prototype.on=r.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},r.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},r.prototype.off=r.prototype.removeListener=r.prototype.removeAllListeners=r.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,r=this._callbacks["$"+e];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var o=0;o1?t.unshift(e.nodeName.toLowerCase()+":eq("+r+")"):t.unshift(e.nodeName.toLowerCase()),e=e.parentNode}return t.slice(1).join(" > ")}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getWindowProfile=function(){var e,t,n;if("undefined"==typeof document)return{};e=document.body,t=document.documentElement,n={height:"innerHeight"in window?window.innerHeight:document.documentElement.offsetHeight,width:"innerWidth"in window?window.innerWidth:document.documentElement.offsetWidth,scrollHeight:Math.max(e.scrollHeight,e.offsetHeight,t.clientHeight,t.scrollHeight,t.offsetHeight)||null},window.screen&&(n.ratio={height:window.screen.availHeight?parseFloat((window.innerHeight/window.screen.availHeight).toFixed(2)):null,width:window.screen.availWidth?parseFloat((window.innerWidth/window.screen.availWidth).toFixed(2)):null});return n}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getScreenProfile=function(){var e,t;if("undefined"==typeof window||!window.screen)return{};e=["height","width","colorDepth","pixelDepth","availHeight","availWidth"],t={};for(var n=0;nwindow.innerHeight?"landscape":"portrait"},t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=t.MD5=function(e){return function(e){for(var t,n="0123456789ABCDEF",r="",o=0;o>>4&15)+n.charAt(15&t);return r}(function(e){for(var t="",n=0;n<32*e.length;n+=8)t+=String.fromCharCode(e[n>>5]>>>n%32&255);return t}(function(e,t){e[t>>5]|=128<>>9<<4)]=t;for(var n=1732584193,r=-271733879,o=-1732584194,l=271733878,f=0;f>2),n=0;n>5]|=(255&e.charCodeAt(n/8))<>>32-t}(c(c(t,e),c(r,i)),o),n)}function i(e,t,n,r,i,s,a){return o(t&n|~t&r,e,t,i,s,a)}function s(e,t,n,r,i,s,a){return o(t&r|n&~r,e,t,i,s,a)}function a(e,t,n,r,i,s,a){return o(t^n^r,e,t,i,s,a)}function u(e,t,n,r,i,s,a){return o(n^(t|~r),e,t,i,s,a)}function c(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r="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};t.deepExtend=function e(t){for(var n=1;n0&&(0,a.default)(t,function(t,n){var r="function"==typeof t?t():t;(0,i.deepExtend)(e,r)});return e};var o,i=n(13),s=n(0),a=(o=s)&&o.__esModule?o:{default:o};function u(e){this.emit("error","Event(s) not extended: "+e)}},function(e){e.exports={name:"keen-tracking",version:"4.0.16",description:"Track events - custom user actions, clicks, pageviews, purchases.",main:"dist/node/keen-tracking.js",browser:"dist/keen-tracking.js",repository:{type:"git",url:"https://github.com/keen/keen-tracking.js.git"},scripts:{start:"NODE_ENV=development webpack-dev-server",test:"NODE_ENV=test jest && npm run test:node","test:node":"NODE_ENV=test TEST_ENV=node jest","test:watch":"NODE_ENV=test jest --watch","test:node:watch":"NODE_ENV=test TEST_ENV=node jest --watch",build:"NODE_ENV=production webpack -p && NODE_ENV=production OPTIMIZE_MINIMIZE=1 webpack -p && npm run build:node","build:node":"TARGET=node NODE_ENV=production webpack -p",profile:"webpack --profile --json > stats.json",analyze:"webpack-bundle-analyzer stats.json /dist",version:"npm run build && npm run test && git add .",postversion:"git push && git push --tags",demo:"node ./test/demo/index.node.js"},bugs:"https://github.com/keen/keen-tracking.js/issues",author:"Keen IO (https://keen.io/)",homepage:"https://keen.io",keywords:["Tracking","Tracker","Event Tracker","Event tracking","Track events","Page tracking","User tracking","Analytics event tracking","Analytics events","Analytics tracking","Custom events","Analytics","Stats","Statistics","Monitoring","Metrics","Pageviews","Segmentation","Funnel","Conversion","Log","Logger","Logging","Javascript events","Universal tracking","Click analytics"],contributors:["Dustin Larimer (https://github.com/dustinlarimer)","Eric Anderson (https://github.com/aroc)","Joe Wegner (http://www.wegnerdesign.com)","Alex Kleissner (https://github.com/hex337)","Adam Kasprowicz (https://github.com/adamkasprowicz)"],license:"MIT",dependencies:{"component-emitter":"^1.2.0","js-cookie":"2.1.0","keen-core":"^0.1.3","promise-polyfill":"^8.0.0","whatwg-fetch":"^2.0.4"},devDependencies:{"babel-core":"^6.26.3","babel-jest":"^23.0.1","babel-loader":"^7.1.5","babel-plugin-transform-es2015-modules-commonjs":"^6.26.2","babel-plugin-transform-object-rest-spread":"^6.26.0","babel-polyfill":"^6.26.0","babel-preset-env":"^1.7.0","babel-preset-es2015":"^6.24.1","babel-preset-stage-0":"^6.24.1",eslint:"^4.19.1","eslint-config-airbnb":"^16.1.0","eslint-loader":"^2.0.0","eslint-plugin-import":"^2.11.0","eslint-plugin-jsx-a11y":"^6.0.3","html-loader":"^0.5.5","html-webpack-plugin":"^3.2.0",jest:"^22.4.3","jest-fetch-mock":"^1.6.5",merge:"^1.2.1",nock:"^9.2.6","regenerator-runtime":"^0.11.1","replace-in-file":"^3.4.0","url-parse":"^1.4.3",webpack:"^4.5.0","webpack-bundle-analyzer":"^2.11.1","webpack-cli":"^2.0.13","webpack-dev-server":"^3.1.1","xhr-mock":"^2.3.2"}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=Object.assign||function(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:{};return this instanceof a==!1?new a(e):(this.capacity=0,this.config=r({},i.default.queue,e),this.events={},this.interval=0,this.timer=null,this)}(0,o.default)(a.prototype),a.prototype.check=function(){return function(e){if(e.capacity>0&&e.interval>=e.config.interval)return!0;if(e.capacity>=e.config.capacity)return!0;return!1}(this)&&this.flush(),0!==this.config.interval&&0!==this.capacity||this.pause(),this},a.prototype.flush=function(){return this.emit("flush"),this.interval=0,this},a.prototype.pause=function(){return this.timer&&(clearInterval(this.timer),this.timer=null),this},a.prototype.start=function(){var e=this;return e.pause(),e.timer=setInterval(function(){e.interval++,e.check()},1e3),e}},function(e,t,n){"use strict";(function(e){var r=n(5),o=setTimeout;function i(){}function s(e){if(!(this instanceof s))throw new TypeError("Promises must be constructed via new");if("function"!=typeof e)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],f(e,this)}function a(e,t){for(;3===e._state;)e=e._value;0!==e._state?(e._handled=!0,s._immediateFn(function(){var n=1===e._state?t.onFulfilled:t.onRejected;if(null!==n){var r;try{r=n(e._value)}catch(e){return void c(t.promise,e)}u(t.promise,r)}else(1===e._state?u:c)(t.promise,e._value)})):e._deferreds.push(t)}function u(e,t){try{if(t===e)throw new TypeError("A promise cannot be resolved with itself.");if(t&&("object"==typeof t||"function"==typeof t)){var n=t.then;if(t instanceof s)return e._state=3,e._value=t,void l(e);if("function"==typeof n)return void f((r=n,o=t,function(){r.apply(o,arguments)}),e)}e._state=1,e._value=t,l(e)}catch(t){c(e,t)}var r,o}function c(e,t){e._state=2,e._value=t,l(e)}function l(e){2===e._state&&0===e._deferreds.length&&s._immediateFn(function(){e._handled||s._unhandledRejectionFn(e._value)});for(var t=0,n=e._deferreds.length;t-1)&&((t.disabled||!d.disabled)&&d.name&&i.test(d.nodeName)&&!o.test(d.type))){var h=d.name,p=d.value;if("checkbox"!==d.type&&"radio"!==d.type||d.checked||(p=void 0),t.empty){if("checkbox"!==d.type||d.checked||(p=""),"radio"===d.type&&(l[d.name]||d.checked?d.checked&&(l[d.name]=!0):l[d.name]=!1),void 0==p&&"radio"==d.type)continue}else if(!p)continue;if("select-multiple"!==d.type)n=s(n,h,p);else{p=[];for(var y=d.options,m=!1,v=0;v-1};l.prototype.append=function(e,t){e=a(e),t=u(t);var n=this.map[e];this.map[e]=n?n+","+t:t},l.prototype.delete=function(e){delete this.map[a(e)]},l.prototype.get=function(e){return e=a(e),this.has(e)?this.map[e]:null},l.prototype.has=function(e){return this.map.hasOwnProperty(a(e))},l.prototype.set=function(e,t){this.map[a(e)]=u(t)},l.prototype.forEach=function(e,t){for(var n in this.map)this.map.hasOwnProperty(n)&&e.call(t,this.map[n],n,this)},l.prototype.keys=function(){var e=[];return this.forEach(function(t,n){e.push(n)}),c(e)},l.prototype.values=function(){var e=[];return this.forEach(function(t){e.push(t)}),c(e)},l.prototype.entries=function(){var e=[];return this.forEach(function(t,n){e.push([n,t])}),c(e)},t.iterable&&(l.prototype[Symbol.iterator]=l.prototype.entries);var i=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];m.prototype.clone=function(){return new m(this,{body:this._bodyInit})},y.call(m.prototype),y.call(g.prototype),g.prototype.clone=function(){return new g(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new l(this.headers),url:this.url})},g.error=function(){var e=new g(null,{status:0,statusText:""});return e.type="error",e};var s=[301,302,303,307,308];g.redirect=function(e,t){if(-1===s.indexOf(t))throw new RangeError("Invalid status code");return new g(null,{status:t,headers:{location:e}})},e.Headers=l,e.Request=m,e.Response=g,e.fetch=function(e,n){return new Promise(function(r,o){var i=new m(e,n),s=new XMLHttpRequest;s.onload=function(){var e,t,n={status:s.status,statusText:s.statusText,headers:(e=s.getAllResponseHeaders()||"",t=new l,e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach(function(e){var n=e.split(":"),r=n.shift().trim();if(r){var o=n.join(":").trim();t.append(r,o)}}),t)};n.url="responseURL"in s?s.responseURL:n.headers.get("X-Request-URL");var o="response"in s?s.response:s.responseText;r(new g(o,n))},s.onerror=function(){o(new TypeError("Network request failed"))},s.ontimeout=function(){o(new TypeError("Network request failed"))},s.open(i.method,i.url,!0),"include"===i.credentials?s.withCredentials=!0:"omit"===i.credentials&&(s.withCredentials=!1),"responseType"in s&&t.blob&&(s.responseType="blob"),i.headers.forEach(function(e,t){s.setRequestHeader(t,e)}),s.send(void 0===i._bodyInit?null:i._bodyInit)})},e.fetch.polyfill=!0}function a(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 u(e){return"string"!=typeof e&&(e=String(e)),e}function c(e){var n={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return t.iterable&&(n[Symbol.iterator]=function(){return n}),n}function l(e){this.map={},e instanceof l?e.forEach(function(e,t){this.append(t,e)},this):Array.isArray(e)?e.forEach(function(e){this.append(e[0],e[1])},this):e&&Object.getOwnPropertyNames(e).forEach(function(t){this.append(t,e[t])},this)}function f(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function d(e){return new Promise(function(t,n){e.onload=function(){t(e.result)},e.onerror=function(){n(e.error)}})}function h(e){var t=new FileReader,n=d(t);return t.readAsArrayBuffer(e),n}function p(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function y(){return this.bodyUsed=!1,this._initBody=function(e){if(this._bodyInit=e,e)if("string"==typeof e)this._bodyText=e;else if(t.blob&&Blob.prototype.isPrototypeOf(e))this._bodyBlob=e;else if(t.formData&&FormData.prototype.isPrototypeOf(e))this._bodyFormData=e;else if(t.searchParams&&URLSearchParams.prototype.isPrototypeOf(e))this._bodyText=e.toString();else if(t.arrayBuffer&&t.blob&&r(e))this._bodyArrayBuffer=p(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer]);else{if(!t.arrayBuffer||!ArrayBuffer.prototype.isPrototypeOf(e)&&!o(e))throw new Error("unsupported BodyInit type");this._bodyArrayBuffer=p(e)}else 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):t.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},t.blob&&(this.blob=function(){var e=f(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?f(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(h)}),this.text=function(){var e,t,n,r=f(this);if(r)return r;if(this._bodyBlob)return e=this._bodyBlob,t=new FileReader,n=d(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-1?r:n),this.mode=t.mode||this.mode||null,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 v(e){var t=new FormData;return e.trim().split("&").forEach(function(e){if(e){var n=e.split("="),r=n.shift().replace(/\+/g," "),o=n.join("=").replace(/\+/g," ");t.append(decodeURIComponent(r),decodeURIComponent(o))}}),t}function g(e,t){t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new l(t.headers),this.url=t.url||"",this._initBody(e)}}("undefined"!=typeof self?self:this)},function(e,t,n){function r(e){if(e)return function(e){for(var t in r.prototype)e[t]=r.prototype[t];return e}(e)}e.exports=r,r.prototype.on=r.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},r.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},r.prototype.off=r.prototype.removeListener=r.prototype.removeAllListeners=r.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,r=this._callbacks["$"+e];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var o=0;o1?t.unshift(e.nodeName.toLowerCase()+":eq("+r+")"):t.unshift(e.nodeName.toLowerCase()),e=e.parentNode}return t.slice(1).join(" > ")}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getWindowProfile=function(){var e,t,n;if("undefined"==typeof document)return{};e=document.body,t=document.documentElement,n={height:"innerHeight"in window?window.innerHeight:document.documentElement.offsetHeight,width:"innerWidth"in window?window.innerWidth:document.documentElement.offsetWidth,scrollHeight:Math.max(e.scrollHeight,e.offsetHeight,t.clientHeight,t.scrollHeight,t.offsetHeight)||null},window.screen&&(n.ratio={height:window.screen.availHeight?parseFloat((window.innerHeight/window.screen.availHeight).toFixed(2)):null,width:window.screen.availWidth?parseFloat((window.innerWidth/window.screen.availWidth).toFixed(2)):null});return n}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getScreenProfile=function(){var e,t;if("undefined"==typeof window||!window.screen)return{};e=["height","width","colorDepth","pixelDepth","availHeight","availWidth"],t={};for(var n=0;nwindow.innerHeight?"landscape":"portrait"},t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=t.MD5=function(e){return function(e){for(var t,n="0123456789ABCDEF",r="",o=0;o>>4&15)+n.charAt(15&t);return r}(function(e){for(var t="",n=0;n<32*e.length;n+=8)t+=String.fromCharCode(e[n>>5]>>>n%32&255);return t}(function(e,t){e[t>>5]|=128<>>9<<4)]=t;for(var n=1732584193,r=-271733879,o=-1732584194,l=271733878,f=0;f>2),n=0;n>5]|=(255&e.charCodeAt(n/8))<>>32-t}(c(c(t,e),c(r,i)),o),n)}function i(e,t,n,r,i,s,a){return o(t&n|~t&r,e,t,i,s,a)}function s(e,t,n,r,i,s,a){return o(t&r|n&~r,e,t,i,s,a)}function a(e,t,n,r,i,s,a){return o(t^n^r,e,t,i,s,a)}function u(e,t,n,r,i,s,a){return o(n^(t|~r),e,t,i,s,a)}function c(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r="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};t.deepExtend=function e(t){for(var n=1;n0&&(0,a.default)(t,function(t,n){var r="function"==typeof t?t():t;(0,i.deepExtend)(e,r)});return e};var o,i=n(13),s=n(0),a=(o=s)&&o.__esModule?o:{default:o};function u(e){this.emit("error","Event(s) not extended: "+e)}},function(e){e.exports={name:"keen-tracking",version:"4.0.17",description:"Track events - custom user actions, clicks, pageviews, purchases.",main:"dist/node/keen-tracking.js",browser:"dist/keen-tracking.js",repository:{type:"git",url:"https://github.com/keen/keen-tracking.js.git"},scripts:{start:"NODE_ENV=development webpack-dev-server",test:"NODE_ENV=test jest && npm run test:node","test:node":"NODE_ENV=test TEST_ENV=node jest","test:watch":"NODE_ENV=test jest --watch","test:node:watch":"NODE_ENV=test TEST_ENV=node jest --watch",build:"NODE_ENV=production webpack -p && NODE_ENV=production OPTIMIZE_MINIMIZE=1 webpack -p && npm run build:node","build:node":"TARGET=node NODE_ENV=production webpack -p",profile:"webpack --profile --json > stats.json",analyze:"webpack-bundle-analyzer stats.json /dist",version:"npm run build && npm run test && git add .",postversion:"git push && git push --tags",demo:"node ./test/demo/index.node.js"},bugs:"https://github.com/keen/keen-tracking.js/issues",author:"Keen IO (https://keen.io/)",homepage:"https://keen.io",keywords:["Tracking","Tracker","Event Tracker","Event tracking","Track events","Page tracking","User tracking","Analytics event tracking","Analytics events","Analytics tracking","Custom events","Analytics","Stats","Statistics","Monitoring","Metrics","Pageviews","Segmentation","Funnel","Conversion","Log","Logger","Logging","Javascript events","Universal tracking","Click analytics"],contributors:["Dustin Larimer (https://github.com/dustinlarimer)","Eric Anderson (https://github.com/aroc)","Joe Wegner (http://www.wegnerdesign.com)","Alex Kleissner (https://github.com/hex337)","Adam Kasprowicz (https://github.com/adamkasprowicz)"],license:"MIT",dependencies:{"component-emitter":"^1.2.0","js-cookie":"2.1.0","keen-core":"^0.1.3","promise-polyfill":"^8.0.0","whatwg-fetch":"^2.0.4"},devDependencies:{"babel-core":"^6.26.3","babel-jest":"^23.0.1","babel-loader":"^7.1.5","babel-plugin-transform-es2015-modules-commonjs":"^6.26.2","babel-plugin-transform-object-rest-spread":"^6.26.0","babel-polyfill":"^6.26.0","babel-preset-env":"^1.7.0","babel-preset-es2015":"^6.24.1","babel-preset-stage-0":"^6.24.1",eslint:"^4.19.1","eslint-config-airbnb":"^16.1.0","eslint-loader":"^2.0.0","eslint-plugin-import":"^2.11.0","eslint-plugin-jsx-a11y":"^6.0.3","html-loader":"^0.5.5","html-webpack-plugin":"^3.2.0",jest:"^22.4.3","jest-fetch-mock":"^1.6.5",merge:"^1.2.1",nock:"^9.2.6","regenerator-runtime":"^0.11.1","replace-in-file":"^3.4.0","url-parse":"^1.4.3",webpack:"^4.5.0","webpack-bundle-analyzer":"^2.11.1","webpack-cli":"^2.0.13","webpack-dev-server":"^3.1.14","xhr-mock":"^2.3.2"}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=Object.assign||function(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:{};return this instanceof a==!1?new a(e):(this.capacity=0,this.config=r({},i.default.queue,e),this.events={},this.interval=0,this.timer=null,this)}(0,o.default)(a.prototype),a.prototype.check=function(){return function(e){if(e.capacity>0&&e.interval>=e.config.interval)return!0;if(e.capacity>=e.config.capacity)return!0;return!1}(this)&&this.flush(),0!==this.config.interval&&0!==this.capacity||this.pause(),this},a.prototype.flush=function(){return this.emit("flush"),this.interval=0,this},a.prototype.pause=function(){return this.timer&&(clearInterval(this.timer),this.timer=null),this},a.prototype.start=function(){var e=this;return e.pause(),e.timer=setInterval(function(){e.interval++,e.check()},1e3),e}},function(e,t,n){"use strict";(function(e){var r=n(5),o=setTimeout;function i(){}function s(e){if(!(this instanceof s))throw new TypeError("Promises must be constructed via new");if("function"!=typeof e)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],f(e,this)}function a(e,t){for(;3===e._state;)e=e._value;0!==e._state?(e._handled=!0,s._immediateFn(function(){var n=1===e._state?t.onFulfilled:t.onRejected;if(null!==n){var r;try{r=n(e._value)}catch(e){return void c(t.promise,e)}u(t.promise,r)}else(1===e._state?u:c)(t.promise,e._value)})):e._deferreds.push(t)}function u(e,t){try{if(t===e)throw new TypeError("A promise cannot be resolved with itself.");if(t&&("object"==typeof t||"function"==typeof t)){var n=t.then;if(t instanceof s)return e._state=3,e._value=t,void l(e);if("function"==typeof n)return void f((r=n,o=t,function(){r.apply(o,arguments)}),e)}e._state=1,e._value=t,l(e)}catch(t){c(e,t)}var r,o}function c(e,t){e._state=2,e._value=t,l(e)}function l(e){2===e._state&&0===e._deferreds.length&&s._immediateFn(function(){e._handled||s._unhandledRejectionFn(e._value)});for(var t=0,n=e._deferreds.length;t-1)&&((t.disabled||!d.disabled)&&d.name&&i.test(d.nodeName)&&!o.test(d.type))){var h=d.name,p=d.value;if("checkbox"!==d.type&&"radio"!==d.type||d.checked||(p=void 0),t.empty){if("checkbox"!==d.type||d.checked||(p=""),"radio"===d.type&&(l[d.name]||d.checked?d.checked&&(l[d.name]=!0):l[d.name]=!1),void 0==p&&"radio"==d.type)continue}else if(!p)continue;if("select-multiple"!==d.type)n=s(n,h,p);else{p=[];for(var y=d.options,m=!1,v=0;v -1\n }\n }\n\n function normalizeName(name) {\n if (typeof name !== 'string') {\n name = String(name)\n }\n if (/[^a-z0-9\\-#$%&'*+.\\^_`|~]/i.test(name)) {\n throw new TypeError('Invalid character in header field name')\n }\n return name.toLowerCase()\n }\n\n function normalizeValue(value) {\n if (typeof value !== 'string') {\n value = String(value)\n }\n return value\n }\n\n // Build a destructive iterator for the value list\n function iteratorFor(items) {\n var iterator = {\n next: function() {\n var value = items.shift()\n return {done: value === undefined, value: value}\n }\n }\n\n if (support.iterable) {\n iterator[Symbol.iterator] = function() {\n return iterator\n }\n }\n\n return iterator\n }\n\n function Headers(headers) {\n this.map = {}\n\n if (headers instanceof Headers) {\n headers.forEach(function(value, name) {\n this.append(name, value)\n }, this)\n } else if (Array.isArray(headers)) {\n headers.forEach(function(header) {\n this.append(header[0], header[1])\n }, this)\n } else if (headers) {\n Object.getOwnPropertyNames(headers).forEach(function(name) {\n this.append(name, headers[name])\n }, this)\n }\n }\n\n Headers.prototype.append = function(name, value) {\n name = normalizeName(name)\n value = normalizeValue(value)\n var oldValue = this.map[name]\n this.map[name] = oldValue ? oldValue+','+value : value\n }\n\n Headers.prototype['delete'] = function(name) {\n delete this.map[normalizeName(name)]\n }\n\n Headers.prototype.get = function(name) {\n name = normalizeName(name)\n return this.has(name) ? this.map[name] : null\n }\n\n Headers.prototype.has = function(name) {\n return this.map.hasOwnProperty(normalizeName(name))\n }\n\n Headers.prototype.set = function(name, value) {\n this.map[normalizeName(name)] = normalizeValue(value)\n }\n\n Headers.prototype.forEach = function(callback, thisArg) {\n for (var name in this.map) {\n if (this.map.hasOwnProperty(name)) {\n callback.call(thisArg, this.map[name], name, this)\n }\n }\n }\n\n Headers.prototype.keys = function() {\n var items = []\n this.forEach(function(value, name) { items.push(name) })\n return iteratorFor(items)\n }\n\n Headers.prototype.values = function() {\n var items = []\n this.forEach(function(value) { items.push(value) })\n return iteratorFor(items)\n }\n\n Headers.prototype.entries = function() {\n var items = []\n this.forEach(function(value, name) { items.push([name, value]) })\n return iteratorFor(items)\n }\n\n if (support.iterable) {\n Headers.prototype[Symbol.iterator] = Headers.prototype.entries\n }\n\n function consumed(body) {\n if (body.bodyUsed) {\n return Promise.reject(new TypeError('Already read'))\n }\n body.bodyUsed = true\n }\n\n function fileReaderReady(reader) {\n return new Promise(function(resolve, reject) {\n reader.onload = function() {\n resolve(reader.result)\n }\n reader.onerror = function() {\n reject(reader.error)\n }\n })\n }\n\n function readBlobAsArrayBuffer(blob) {\n var reader = new FileReader()\n var promise = fileReaderReady(reader)\n reader.readAsArrayBuffer(blob)\n return promise\n }\n\n function readBlobAsText(blob) {\n var reader = new FileReader()\n var promise = fileReaderReady(reader)\n reader.readAsText(blob)\n return promise\n }\n\n function readArrayBufferAsText(buf) {\n var view = new Uint8Array(buf)\n var chars = new Array(view.length)\n\n for (var i = 0; i < view.length; i++) {\n chars[i] = String.fromCharCode(view[i])\n }\n return chars.join('')\n }\n\n function bufferClone(buf) {\n if (buf.slice) {\n return buf.slice(0)\n } else {\n var view = new Uint8Array(buf.byteLength)\n view.set(new Uint8Array(buf))\n return view.buffer\n }\n }\n\n function Body() {\n this.bodyUsed = false\n\n this._initBody = function(body) {\n this._bodyInit = body\n if (!body) {\n this._bodyText = ''\n } else if (typeof body === 'string') {\n this._bodyText = body\n } else if (support.blob && Blob.prototype.isPrototypeOf(body)) {\n this._bodyBlob = body\n } else if (support.formData && FormData.prototype.isPrototypeOf(body)) {\n this._bodyFormData = body\n } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {\n this._bodyText = body.toString()\n } else if (support.arrayBuffer && support.blob && isDataView(body)) {\n this._bodyArrayBuffer = bufferClone(body.buffer)\n // IE 10-11 can't handle a DataView body.\n this._bodyInit = new Blob([this._bodyArrayBuffer])\n } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) {\n this._bodyArrayBuffer = bufferClone(body)\n } else {\n throw new Error('unsupported BodyInit type')\n }\n\n if (!this.headers.get('content-type')) {\n if (typeof body === 'string') {\n this.headers.set('content-type', 'text/plain;charset=UTF-8')\n } else if (this._bodyBlob && this._bodyBlob.type) {\n this.headers.set('content-type', this._bodyBlob.type)\n } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {\n this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8')\n }\n }\n }\n\n if (support.blob) {\n this.blob = function() {\n var rejected = consumed(this)\n if (rejected) {\n return rejected\n }\n\n if (this._bodyBlob) {\n return Promise.resolve(this._bodyBlob)\n } else if (this._bodyArrayBuffer) {\n return Promise.resolve(new Blob([this._bodyArrayBuffer]))\n } else if (this._bodyFormData) {\n throw new Error('could not read FormData body as blob')\n } else {\n return Promise.resolve(new Blob([this._bodyText]))\n }\n }\n\n this.arrayBuffer = function() {\n if (this._bodyArrayBuffer) {\n return consumed(this) || Promise.resolve(this._bodyArrayBuffer)\n } else {\n return this.blob().then(readBlobAsArrayBuffer)\n }\n }\n }\n\n this.text = function() {\n var rejected = consumed(this)\n if (rejected) {\n return rejected\n }\n\n if (this._bodyBlob) {\n return readBlobAsText(this._bodyBlob)\n } else if (this._bodyArrayBuffer) {\n return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer))\n } else if (this._bodyFormData) {\n throw new Error('could not read FormData body as text')\n } else {\n return Promise.resolve(this._bodyText)\n }\n }\n\n if (support.formData) {\n this.formData = function() {\n return this.text().then(decode)\n }\n }\n\n this.json = function() {\n return this.text().then(JSON.parse)\n }\n\n return this\n }\n\n // HTTP methods whose capitalization should be normalized\n var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT']\n\n function normalizeMethod(method) {\n var upcased = method.toUpperCase()\n return (methods.indexOf(upcased) > -1) ? upcased : method\n }\n\n function Request(input, options) {\n options = options || {}\n var body = options.body\n\n if (input instanceof Request) {\n if (input.bodyUsed) {\n throw new TypeError('Already read')\n }\n this.url = input.url\n this.credentials = input.credentials\n if (!options.headers) {\n this.headers = new Headers(input.headers)\n }\n this.method = input.method\n this.mode = input.mode\n if (!body && input._bodyInit != null) {\n body = input._bodyInit\n input.bodyUsed = true\n }\n } else {\n this.url = String(input)\n }\n\n this.credentials = options.credentials || this.credentials || 'omit'\n if (options.headers || !this.headers) {\n this.headers = new Headers(options.headers)\n }\n this.method = normalizeMethod(options.method || this.method || 'GET')\n this.mode = options.mode || this.mode || null\n this.referrer = null\n\n if ((this.method === 'GET' || this.method === 'HEAD') && body) {\n throw new TypeError('Body not allowed for GET or HEAD requests')\n }\n this._initBody(body)\n }\n\n Request.prototype.clone = function() {\n return new Request(this, { body: this._bodyInit })\n }\n\n function decode(body) {\n var form = new FormData()\n body.trim().split('&').forEach(function(bytes) {\n if (bytes) {\n var split = bytes.split('=')\n var name = split.shift().replace(/\\+/g, ' ')\n var value = split.join('=').replace(/\\+/g, ' ')\n form.append(decodeURIComponent(name), decodeURIComponent(value))\n }\n })\n return form\n }\n\n function parseHeaders(rawHeaders) {\n var headers = new Headers()\n // Replace instances of \\r\\n and \\n followed by at least one space or horizontal tab with a space\n // https://tools.ietf.org/html/rfc7230#section-3.2\n var preProcessedHeaders = rawHeaders.replace(/\\r?\\n[\\t ]+/g, ' ')\n preProcessedHeaders.split(/\\r?\\n/).forEach(function(line) {\n var parts = line.split(':')\n var key = parts.shift().trim()\n if (key) {\n var value = parts.join(':').trim()\n headers.append(key, value)\n }\n })\n return headers\n }\n\n Body.call(Request.prototype)\n\n function Response(bodyInit, options) {\n if (!options) {\n options = {}\n }\n\n this.type = 'default'\n this.status = options.status === undefined ? 200 : options.status\n this.ok = this.status >= 200 && this.status < 300\n this.statusText = 'statusText' in options ? options.statusText : 'OK'\n this.headers = new Headers(options.headers)\n this.url = options.url || ''\n this._initBody(bodyInit)\n }\n\n Body.call(Response.prototype)\n\n Response.prototype.clone = function() {\n return new Response(this._bodyInit, {\n status: this.status,\n statusText: this.statusText,\n headers: new Headers(this.headers),\n url: this.url\n })\n }\n\n Response.error = function() {\n var response = new Response(null, {status: 0, statusText: ''})\n response.type = 'error'\n return response\n }\n\n var redirectStatuses = [301, 302, 303, 307, 308]\n\n Response.redirect = function(url, status) {\n if (redirectStatuses.indexOf(status) === -1) {\n throw new RangeError('Invalid status code')\n }\n\n return new Response(null, {status: status, headers: {location: url}})\n }\n\n self.Headers = Headers\n self.Request = Request\n self.Response = Response\n\n self.fetch = function(input, init) {\n return new Promise(function(resolve, reject) {\n var request = new Request(input, init)\n var xhr = new XMLHttpRequest()\n\n xhr.onload = function() {\n var options = {\n status: xhr.status,\n statusText: xhr.statusText,\n headers: parseHeaders(xhr.getAllResponseHeaders() || '')\n }\n options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL')\n var body = 'response' in xhr ? xhr.response : xhr.responseText;\n\n resolve(new Response(body, options))\n }\n\n xhr.onerror = function() {\n reject(new TypeError('Network request failed'))\n }\n\n xhr.ontimeout = function() {\n reject(new TypeError('Network request failed'))\n }\n\n xhr.open(request.method, request.url, true)\n\n if (request.credentials === 'include') {\n xhr.withCredentials = true\n } else if (request.credentials === 'omit') {\n xhr.withCredentials = false\n }\n\n if ('responseType' in xhr && support.blob) {\n xhr.responseType = 'blob'\n }\n\n request.headers.forEach(function(value, name) {\n xhr.setRequestHeader(name, value)\n })\n\n xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit)\n })\n }\n self.fetch.polyfill = true\n})(typeof self !== 'undefined' ? self : this);\n","\r\n/**\r\n * Expose `Emitter`.\r\n */\r\n\r\nif (typeof module !== 'undefined') {\r\n module.exports = Emitter;\r\n}\r\n\r\n/**\r\n * Initialize a new `Emitter`.\r\n *\r\n * @api public\r\n */\r\n\r\nfunction Emitter(obj) {\r\n if (obj) return mixin(obj);\r\n};\r\n\r\n/**\r\n * Mixin the emitter properties.\r\n *\r\n * @param {Object} obj\r\n * @return {Object}\r\n * @api private\r\n */\r\n\r\nfunction mixin(obj) {\r\n for (var key in Emitter.prototype) {\r\n obj[key] = Emitter.prototype[key];\r\n }\r\n return obj;\r\n}\r\n\r\n/**\r\n * Listen on the given `event` with `fn`.\r\n *\r\n * @param {String} event\r\n * @param {Function} fn\r\n * @return {Emitter}\r\n * @api public\r\n */\r\n\r\nEmitter.prototype.on =\r\nEmitter.prototype.addEventListener = function(event, fn){\r\n this._callbacks = this._callbacks || {};\r\n (this._callbacks['$' + event] = this._callbacks['$' + event] || [])\r\n .push(fn);\r\n return this;\r\n};\r\n\r\n/**\r\n * Adds an `event` listener that will be invoked a single\r\n * time then automatically removed.\r\n *\r\n * @param {String} event\r\n * @param {Function} fn\r\n * @return {Emitter}\r\n * @api public\r\n */\r\n\r\nEmitter.prototype.once = function(event, fn){\r\n function on() {\r\n this.off(event, on);\r\n fn.apply(this, arguments);\r\n }\r\n\r\n on.fn = fn;\r\n this.on(event, on);\r\n return this;\r\n};\r\n\r\n/**\r\n * Remove the given callback for `event` or all\r\n * registered callbacks.\r\n *\r\n * @param {String} event\r\n * @param {Function} fn\r\n * @return {Emitter}\r\n * @api public\r\n */\r\n\r\nEmitter.prototype.off =\r\nEmitter.prototype.removeListener =\r\nEmitter.prototype.removeAllListeners =\r\nEmitter.prototype.removeEventListener = function(event, fn){\r\n this._callbacks = this._callbacks || {};\r\n\r\n // all\r\n if (0 == arguments.length) {\r\n this._callbacks = {};\r\n return this;\r\n }\r\n\r\n // specific event\r\n var callbacks = this._callbacks['$' + event];\r\n if (!callbacks) return this;\r\n\r\n // remove all handlers\r\n if (1 == arguments.length) {\r\n delete this._callbacks['$' + event];\r\n return this;\r\n }\r\n\r\n // remove specific handler\r\n var cb;\r\n for (var i = 0; i < callbacks.length; i++) {\r\n cb = callbacks[i];\r\n if (cb === fn || cb.fn === fn) {\r\n callbacks.splice(i, 1);\r\n break;\r\n }\r\n }\r\n return this;\r\n};\r\n\r\n/**\r\n * Emit `event` with the given args.\r\n *\r\n * @param {String} event\r\n * @param {Mixed} ...\r\n * @return {Emitter}\r\n */\r\n\r\nEmitter.prototype.emit = function(event){\r\n this._callbacks = this._callbacks || {};\r\n var args = [].slice.call(arguments, 1)\r\n , callbacks = this._callbacks['$' + event];\r\n\r\n if (callbacks) {\r\n callbacks = callbacks.slice(0);\r\n for (var i = 0, len = callbacks.length; i < len; ++i) {\r\n callbacks[i].apply(this, args);\r\n }\r\n }\r\n\r\n return this;\r\n};\r\n\r\n/**\r\n * Return array of callbacks for `event`.\r\n *\r\n * @param {String} event\r\n * @return {Array}\r\n * @api public\r\n */\r\n\r\nEmitter.prototype.listeners = function(event){\r\n this._callbacks = this._callbacks || {};\r\n return this._callbacks['$' + event] || [];\r\n};\r\n\r\n/**\r\n * Check if this emitter has `event` handlers.\r\n *\r\n * @param {String} event\r\n * @return {Boolean}\r\n * @api public\r\n */\r\n\r\nEmitter.prototype.hasListeners = function(event){\r\n return !! this.listeners(event).length;\r\n};\r\n","import KeenCore from 'keen-core';\nimport each from 'keen-core/lib/utils/each';\nimport extend from 'keen-core/lib/utils/extend';\nimport { queue } from'./utils/queue';\nimport pkg from '../package.json';\n\nKeenCore.helpers = KeenCore.helpers || {};\n\n// Install internal queue\nKeenCore.on('client', function(client){\n client.extensions = {\n events: [],\n collections: {}\n };\n client.queue = queue(client.config.queue);\n client.queue.on('flush', function(){\n client.recordDeferredEvents();\n });\n});\n\n// Accessors\nKeenCore.prototype.writeKey = function(str){\n if (!arguments.length) return this.config.writeKey;\n this.config.writeKey = (str ? String(str) : null);\n return this;\n};\n\nKeenCore.prototype.referrerPolicy = function(str){\n if (!arguments.length) return this.config.referrerPolicy;\n this.config.referrerPolicy = (str ? String(str) : null);\n return this;\n};\n\n// DEPRECATED\nKeenCore.prototype.setGlobalProperties = function(props){\n KeenCore.log('This method has been removed. Check out #extendEvents: https://github.com/keen/keen-tracking.js#extend-events');\n return this;\n};\n\nKeenCore.version = pkg.version;\n\nexport default KeenCore;\n","export function getDomNodePath(el){\n if (!el.nodeName) return '';\n\n var stack = [];\n while ( el.parentNode != null ) {\n // console.log(el.nodeName);\n var sibCount = 0;\n var sibIndex = 0;\n for ( var i = 0; i < el.parentNode.childNodes.length; i++ ) {\n var sib = el.parentNode.childNodes[i];\n if ( sib.nodeName == el.nodeName ) {\n if ( sib === el ) {\n sibIndex = sibCount;\n }\n sibCount++;\n }\n }\n if ( el.hasAttribute('id') && el.id != '' ) {\n stack.unshift(el.nodeName.toLowerCase() + '#' + el.id);\n } else if ( sibCount > 1 ) {\n stack.unshift(el.nodeName.toLowerCase() + ':eq(' + sibIndex + ')');\n } else {\n stack.unshift(el.nodeName.toLowerCase());\n }\n el = el.parentNode;\n }\n\n return stack.slice(1).join(' > ');\n}\n\n\n// via: http://stackoverflow.com/a/16742828/2511985\n","export function getWindowProfile(){\n var body, html, output;\n\n if ('undefined' == typeof document) return {};\n\n body = document.body;\n html = document.documentElement;\n\n output = {\n 'height': ('innerHeight' in window) ? window.innerHeight : document.documentElement.offsetHeight,\n 'width': ('innerWidth' in window) ? window.innerWidth : document.documentElement.offsetWidth,\n 'scrollHeight': Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ) || null\n };\n\n if (window.screen) {\n output.ratio = {\n 'height': (window.screen.availHeight) ? parseFloat( (window.innerHeight/window.screen.availHeight).toFixed(2) ) : null,\n 'width': (window.screen.availWidth) ? parseFloat( (window.innerWidth/window.screen.availWidth).toFixed(2) ) : null\n };\n }\n\n return output;\n}\n\n/*\n Notes:\n document.documentElement.offsetHeight/Width is a workaround for IE8 and below, where window.innerHeight/Width is undefined\n*/\n","export function getScreenProfile(){\n var keys, output;\n\n if ('undefined' == typeof window || !window.screen) return {};\n\n keys = ['height', 'width', 'colorDepth', 'pixelDepth', 'availHeight', 'availWidth'];\n output = {};\n\n for (var i = 0; i < keys.length; i++) {\n output[keys[i]] = window.screen[keys[i]] ? window.screen[keys[i]] : null;\n }\n\n output.orientation = {\n 'angle' : window.screen.orientation ? window.screen.orientation['angle'] : 0,\n 'type' : window.innerWidth > window.innerHeight ? 'landscape': 'portrait'\n };\n\n return output;\n}\n","export const MD5 = function(d){const result = M(V(Y(X(d),8*d.length)));return result.toLowerCase()};function M(d){for(var _,m=\"0123456789ABCDEF\",f=\"\",r=0;r>>4&15)+m.charAt(15&_);return f}function X(d){for(var _=Array(d.length>>2),m=0;m<_.length;m++)_[m]=0;for(m=0;m<8*d.length;m+=8)_[m>>5]|=(255&d.charCodeAt(m/8))<>5]>>>m%32&255);return _}function Y(d,_){d[_>>5]|=128<<_%32,d[14+(_+64>>>9<<4)]=_;for(var m=1732584193,f=-271733879,r=-1732584194,i=271733878,n=0;n>16)+(_>>16)+(m>>16)<<16|65535&m}function bit_rol(d,_){return d<<_|d>>>32-_}\n\nexport default MD5;\n","export const deepExtend = function(target){\n for (var i = 1; i < arguments.length; i++) {\n // Copy unique items from incoming array\n if (target instanceof Array && arguments[i] instanceof Array) {\n for (var j = 0; j < arguments[i].length; j++) {\n if (target.indexOf(arguments[i][j]) < 0) {\n target.push(arguments[i][j]);\n }\n }\n }\n // Blend objects\n else {\n for (var prop in arguments[i]){\n // Recurse when both contain objects of same name\n // and incoming is not a null object\n if (typeof target[prop] !== 'undefined'\n && typeof target[prop] === 'object'\n && typeof arguments[i][prop] === 'object'\n && arguments[i][prop] !== null) {\n deepExtend(target[prop], clone(arguments[i][prop]));\n }\n // Otherwise just copy it over...\n else if (\n arguments[i][prop] !== undefined &&\n typeof arguments[i][prop] !== 'function') {\n target[prop] = clone(arguments[i][prop]);\n }\n }\n }\n }\n return target;\n}\n\nfunction clone(input){\n return JSON.parse( JSON.stringify(input) );\n}\n","import { deepExtend } from './utils/deepExtend';\nimport each from 'keen-core/lib/utils/each';\n\nexport function extendEvent(eventCollection, eventModifier){\n if (arguments.length !== 2 || typeof eventCollection !== 'string'\n || ('object' !== typeof eventModifier && 'function' !== typeof eventModifier)) {\n handleValidationError.call(this, 'Incorrect arguments provided to #extendEvent method');\n return;\n }\n this.extensions.collections[eventCollection] = this.extensions.collections[eventCollection] || [];\n this.extensions.collections[eventCollection].push(eventModifier);\n this.emit('extendEvent', eventCollection, eventModifier);\n return this;\n}\n\nexport function extendEvents(eventsModifier){\n if (arguments.length !== 1 || ('object' !== typeof eventsModifier && 'function' !== typeof eventsModifier)) {\n handleValidationError.call(this, 'Incorrect arguments provided to #extendEvents method');\n return;\n }\n this.extensions.events.push(eventsModifier);\n this.emit('extendEvents', eventsModifier);\n return this;\n}\n\nfunction handleValidationError(message){\n this.emit('error', `Event(s) not extended: ${message}`);\n}\n\nexport function getExtendedEventBody(result, queue){\n if (queue && queue.length > 0) {\n each(queue, function(eventModifier, i){\n let modifierResult = (typeof eventModifier === 'function') ? eventModifier() : eventModifier;\n deepExtend(result, modifierResult);\n });\n }\n return result;\n}\n","import Emitter from 'component-emitter';\n\nimport configDefault from '../config-default.js';\n\nexport function queue(configQueue = {}) {\n if (this instanceof queue === false) {\n return new queue(configQueue);\n }\n this.capacity = 0;\n this.config = {\n ...configDefault.queue,\n ...configQueue\n };\n this.events = {\n // \"collection-1\": [],\n // \"collection-2\": []\n };\n this.interval = 0;\n this.timer = null;\n return this;\n}\n\nEmitter(queue.prototype);\n\nqueue.prototype.check = function() {\n if (shouldFlushQueue(this)) {\n this.flush();\n }\n if (this.config.interval === 0 || this.capacity === 0) {\n this.pause();\n }\n return this;\n};\n\nqueue.prototype.flush = function() {\n this.emit('flush');\n this.interval = 0;\n return this;\n};\n\nqueue.prototype.pause = function() {\n if (this.timer) {\n clearInterval(this.timer);\n this.timer = null;\n }\n return this;\n};\n\nqueue.prototype.start = function() {\n var self = this;\n self.pause();\n self.timer = setInterval(function() {\n self.interval++;\n self.check();\n }, 1000);\n return self;\n};\n\nfunction shouldFlushQueue(props) {\n if (props.capacity > 0 && props.interval >= props.config.interval) {\n return true;\n }\n else if (props.capacity >= props.config.capacity) {\n return true;\n }\n return false;\n}\n","import promiseFinally from './finally';\n\n// Store setTimeout reference so promise-polyfill will be unaffected by\n// other code modifying setTimeout (like sinon.useFakeTimers())\nvar setTimeoutFunc = setTimeout;\n\nfunction noop() {}\n\n// Polyfill for Function.prototype.bind\nfunction bind(fn, thisArg) {\n return function() {\n fn.apply(thisArg, arguments);\n };\n}\n\nfunction Promise(fn) {\n if (!(this instanceof Promise))\n throw new TypeError('Promises must be constructed via new');\n if (typeof fn !== 'function') throw new TypeError('not a function');\n this._state = 0;\n this._handled = false;\n this._value = undefined;\n this._deferreds = [];\n\n doResolve(fn, this);\n}\n\nfunction handle(self, deferred) {\n while (self._state === 3) {\n self = self._value;\n }\n if (self._state === 0) {\n self._deferreds.push(deferred);\n return;\n }\n self._handled = true;\n Promise._immediateFn(function() {\n var cb = self._state === 1 ? deferred.onFulfilled : deferred.onRejected;\n if (cb === null) {\n (self._state === 1 ? resolve : reject)(deferred.promise, self._value);\n return;\n }\n var ret;\n try {\n ret = cb(self._value);\n } catch (e) {\n reject(deferred.promise, e);\n return;\n }\n resolve(deferred.promise, ret);\n });\n}\n\nfunction resolve(self, newValue) {\n try {\n // Promise Resolution Procedure: https://github.com/promises-aplus/promises-spec#the-promise-resolution-procedure\n if (newValue === self)\n throw new TypeError('A promise cannot be resolved with itself.');\n if (\n newValue &&\n (typeof newValue === 'object' || typeof newValue === 'function')\n ) {\n var then = newValue.then;\n if (newValue instanceof Promise) {\n self._state = 3;\n self._value = newValue;\n finale(self);\n return;\n } else if (typeof then === 'function') {\n doResolve(bind(then, newValue), self);\n return;\n }\n }\n self._state = 1;\n self._value = newValue;\n finale(self);\n } catch (e) {\n reject(self, e);\n }\n}\n\nfunction reject(self, newValue) {\n self._state = 2;\n self._value = newValue;\n finale(self);\n}\n\nfunction finale(self) {\n if (self._state === 2 && self._deferreds.length === 0) {\n Promise._immediateFn(function() {\n if (!self._handled) {\n Promise._unhandledRejectionFn(self._value);\n }\n });\n }\n\n for (var i = 0, len = self._deferreds.length; i < len; i++) {\n handle(self, self._deferreds[i]);\n }\n self._deferreds = null;\n}\n\nfunction Handler(onFulfilled, onRejected, promise) {\n this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null;\n this.onRejected = typeof onRejected === 'function' ? onRejected : null;\n this.promise = promise;\n}\n\n/**\n * Take a potentially misbehaving resolver function and make sure\n * onFulfilled and onRejected are only called once.\n *\n * Makes no guarantees about asynchrony.\n */\nfunction doResolve(fn, self) {\n var done = false;\n try {\n fn(\n function(value) {\n if (done) return;\n done = true;\n resolve(self, value);\n },\n function(reason) {\n if (done) return;\n done = true;\n reject(self, reason);\n }\n );\n } catch (ex) {\n if (done) return;\n done = true;\n reject(self, ex);\n }\n}\n\nPromise.prototype['catch'] = function(onRejected) {\n return this.then(null, onRejected);\n};\n\nPromise.prototype.then = function(onFulfilled, onRejected) {\n var prom = new this.constructor(noop);\n\n handle(this, new Handler(onFulfilled, onRejected, prom));\n return prom;\n};\n\nPromise.prototype['finally'] = promiseFinally;\n\nPromise.all = function(arr) {\n return new Promise(function(resolve, reject) {\n if (!arr || typeof arr.length === 'undefined')\n throw new TypeError('Promise.all accepts an array');\n var args = Array.prototype.slice.call(arr);\n if (args.length === 0) return resolve([]);\n var remaining = args.length;\n\n function res(i, val) {\n try {\n if (val && (typeof val === 'object' || typeof val === 'function')) {\n var then = val.then;\n if (typeof then === 'function') {\n then.call(\n val,\n function(val) {\n res(i, val);\n },\n reject\n );\n return;\n }\n }\n args[i] = val;\n if (--remaining === 0) {\n resolve(args);\n }\n } catch (ex) {\n reject(ex);\n }\n }\n\n for (var i = 0; i < args.length; i++) {\n res(i, args[i]);\n }\n });\n};\n\nPromise.resolve = function(value) {\n if (value && typeof value === 'object' && value.constructor === Promise) {\n return value;\n }\n\n return new Promise(function(resolve) {\n resolve(value);\n });\n};\n\nPromise.reject = function(value) {\n return new Promise(function(resolve, reject) {\n reject(value);\n });\n};\n\nPromise.race = function(values) {\n return new Promise(function(resolve, reject) {\n for (var i = 0, len = values.length; i < len; i++) {\n values[i].then(resolve, reject);\n }\n });\n};\n\n// Use polyfill for setImmediate for performance gains\nPromise._immediateFn =\n (typeof setImmediate === 'function' &&\n function(fn) {\n setImmediate(fn);\n }) ||\n function(fn) {\n setTimeoutFunc(fn, 0);\n };\n\nPromise._unhandledRejectionFn = function _unhandledRejectionFn(err) {\n if (typeof console !== 'undefined' && console) {\n console.warn('Possible Unhandled Promise Rejection:', err); // eslint-disable-line no-console\n }\n};\n\nexport default Promise;\n","export function timer(num){\n if (this instanceof timer === false) {\n return new timer(num);\n }\n this.count = num || 0;\n return this;\n}\n\ntimer.prototype.start = function(){\n var self = this;\n this.pause();\n this.interval = setInterval(function(){\n self.count++;\n }, 1000);\n return this;\n};\n\ntimer.prototype.pause = function(){\n clearInterval(this.interval);\n return this;\n};\n\ntimer.prototype.value = function(){\n return this.count;\n};\n\ntimer.prototype.clear = function(){\n this.count = 0;\n return this;\n};\n","/*\n This is a modified copy of https://github.com/defunctzombie/form-serialize/ v0.7.1\n Includes a new configuration option:\n * ignoreTypes - Array, Default: [], Example: [ 'password' ]\n*/\n\n// types which indicate a submit action and are not successful controls\n// these will be ignored\nvar k_r_submitter = /^(?:submit|button|image|reset|file)$/i;\n\n// node names which could be successful controls\nvar k_r_success_contrls = /^(?:input|select|textarea|keygen)/i;\n\n// Matches bracket notation.\nvar brackets = /(\\[[^\\[\\]]*\\])/g;\n\n// serializes form fields\n// @param form MUST be an HTMLForm element\n// @param options is an optional argument to configure the serialization. Default output\n// with no options specified is a url encoded string\n// - hash: [true | false] Configure the output type. If true, the output will\n// be a js object.\n// - serializer: [function] Optional serializer function to override the default one.\n// The function takes 3 arguments (result, key, value) and should return new result\n// hash and url encoded str serializers are provided with this module\n// - disabled: [true | false]. If true serialize disabled fields.\n// - empty: [true | false]. If true serialize empty fields\nexport function serializeForm(form, options) {\n if (typeof options != 'object') {\n options = { hash: !!options };\n }\n else if (options.hash === undefined) {\n options.hash = true;\n }\n\n var result = (options.hash) ? {} : '';\n var serializer = options.serializer || ((options.hash) ? hash_serializer : str_serialize);\n\n var elements = form && form.elements ? form.elements : [];\n\n // Object store each radio and set if it's empty or not\n var radio_store = Object.create(null);\n\n for (var i=0 ; i -1) {\n continue;\n }\n // ingore disabled fields\n if ((!options.disabled && element.disabled) || !element.name) {\n continue;\n }\n // ignore anyhting that is not considered a success field\n if (!k_r_success_contrls.test(element.nodeName) ||\n k_r_submitter.test(element.type)) {\n continue;\n }\n\n var key = element.name;\n var val = element.value;\n\n // we can't just use element.value for checkboxes cause some browsers lie to us\n // they say \"on\" for value when the box isn't checked\n if ((element.type === 'checkbox' || element.type === 'radio') && !element.checked) {\n val = undefined;\n }\n\n // If we want empty elements\n if (options.empty) {\n if (element.type === 'checkbox' && !element.checked) {\n val = '';\n }\n\n // for radio\n if (element.type === 'radio') {\n if (!radio_store[element.name] && !element.checked) {\n radio_store[element.name] = false;\n }\n else if (element.checked) {\n radio_store[element.name] = true;\n }\n }\n\n // if options empty is true, continue only if its radio\n if (val == undefined && element.type == 'radio') {\n continue;\n }\n }\n else {\n // value-less fields are ignored unless options.empty is true\n if (!val) {\n continue;\n }\n }\n\n // multi select boxes\n if (element.type === 'select-multiple') {\n val = [];\n\n var selectOptions = element.options;\n var isSelectedOptions = false;\n for (var j=0 ; j 1) {\n\t\t\t\tattributes = extend({\n\t\t\t\t\tpath: '/'\n\t\t\t\t}, api.defaults, attributes);\n\n\t\t\t\tif (typeof attributes.expires === 'number') {\n\t\t\t\t\tvar expires = new Date();\n\t\t\t\t\texpires.setMilliseconds(expires.getMilliseconds() + attributes.expires * 864e+5);\n\t\t\t\t\tattributes.expires = expires;\n\t\t\t\t}\n\n\t\t\t\ttry {\n\t\t\t\t\tresult = JSON.stringify(value);\n\t\t\t\t\tif (/^[\\{\\[]/.test(result)) {\n\t\t\t\t\t\tvalue = result;\n\t\t\t\t\t}\n\t\t\t\t} catch (e) {}\n\n\t\t\t\tif (!converter.write) {\n\t\t\t\t\tvalue = encodeURIComponent(String(value))\n\t\t\t\t\t\t.replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent);\n\t\t\t\t} else {\n\t\t\t\t\tvalue = converter.write(value, key);\n\t\t\t\t}\n\n\t\t\t\tkey = encodeURIComponent(String(key));\n\t\t\t\tkey = key.replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent);\n\t\t\t\tkey = key.replace(/[\\(\\)]/g, escape);\n\n\t\t\t\treturn (document.cookie = [\n\t\t\t\t\tkey, '=', value,\n\t\t\t\t\tattributes.expires && '; expires=' + attributes.expires.toUTCString(), // use expires attribute, max-age is not supported by IE\n\t\t\t\t\tattributes.path && '; path=' + attributes.path,\n\t\t\t\t\tattributes.domain && '; domain=' + attributes.domain,\n\t\t\t\t\tattributes.secure ? '; secure' : ''\n\t\t\t\t].join(''));\n\t\t\t}\n\n\t\t\t// Read\n\n\t\t\tif (!key) {\n\t\t\t\tresult = {};\n\t\t\t}\n\n\t\t\t// To prevent the for loop in the first place assign an empty array\n\t\t\t// in case there are no cookies at all. Also prevents odd result when\n\t\t\t// calling \"get()\"\n\t\t\tvar cookies = document.cookie ? document.cookie.split('; ') : [];\n\t\t\tvar rdecode = /(%[0-9A-Z]{2})+/g;\n\t\t\tvar i = 0;\n\n\t\t\tfor (; i < cookies.length; i++) {\n\t\t\t\tvar parts = cookies[i].split('=');\n\t\t\t\tvar name = parts[0].replace(rdecode, decodeURIComponent);\n\t\t\t\tvar cookie = parts.slice(1).join('=');\n\n\t\t\t\tif (cookie.charAt(0) === '\"') {\n\t\t\t\t\tcookie = cookie.slice(1, -1);\n\t\t\t\t}\n\n\t\t\t\ttry {\n\t\t\t\t\tcookie = converter.read ?\n\t\t\t\t\t\tconverter.read(cookie, name) : converter(cookie, name) ||\n\t\t\t\t\t\tcookie.replace(rdecode, decodeURIComponent);\n\n\t\t\t\t\tif (this.json) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tcookie = JSON.parse(cookie);\n\t\t\t\t\t\t} catch (e) {}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (key === name) {\n\t\t\t\t\t\tresult = cookie;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!key) {\n\t\t\t\t\t\tresult[name] = cookie;\n\t\t\t\t\t}\n\t\t\t\t} catch (e) {}\n\t\t\t}\n\n\t\t\treturn result;\n\t\t}\n\n\t\tapi.get = api.set = api;\n\t\tapi.getJSON = function () {\n\t\t\treturn api.apply({\n\t\t\t\tjson: true\n\t\t\t}, [].slice.call(arguments));\n\t\t};\n\t\tapi.defaults = {};\n\n\t\tapi.remove = function (key, attributes) {\n\t\t\tapi(key, '', extend(attributes, {\n\t\t\t\texpires: -1\n\t\t\t}));\n\t\t};\n\n\t\tapi.withConverter = init;\n\n\t\treturn api;\n\t}\n\n\treturn init(function () {});\n}));\n","import Cookies from 'js-cookie';\nimport extend from 'keen-core/lib/utils/extend';\n\nexport const cookie = function(str){\n if (!arguments.length) return;\n if (this instanceof cookie === false) {\n return new cookie(str);\n }\n\n this.config = {\n key: str,\n options: {\n expires: 365\n }\n };\n this.data = this.get();\n return this;\n}\n\ncookie.prototype.get = function(str){\n var data = {};\n\n if (Cookies.get(this.config.key)) {\n data = Cookies.getJSON(this.config.key);\n }\n if (str && typeof data === 'object' && typeof data !== null) {\n return (typeof data[str] !== 'undefined') ? data[str] : null;\n }\n else {\n return data;\n }\n};\n\ncookie.prototype.set = function(str, value, options){\n if (!arguments.length || !this.enabled()) return this;\n if (typeof str === 'string' && arguments.length >= 2) {\n this.data[str] = value ? value : null;\n }\n else if (typeof str === 'object' && arguments.length === 1) {\n extend(this.data, str);\n }\n Cookies.set(\n this.config.key,\n this.data,\n extend(this.config.options, options || {})\n );\n return this;\n};\n\ncookie.prototype.expire = function(daysUntilExpire){\n if (daysUntilExpire) {\n Cookies.set(\n this.config.key,\n this.data,\n extend(this.config.options, { expires: daysUntilExpire })\n );\n } else {\n Cookies.remove(this.config.key);\n this.data = {};\n }\n return this;\n};\n\ncookie.prototype.options = function(obj){\n if (!arguments.length) return this.config.options;\n this.config.options = (typeof obj === 'object') ? obj : {};\n return this;\n};\n\ncookie.prototype.enabled = function(){\n return navigator.cookieEnabled;\n};\n","export function getUniqueId() {\n // uuidv4\n if (typeof crypto !== 'undefined' && crypto.getRandomValues) {\n // browser\n return ([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g, c =>\n (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)\n )\n } else {\n // node & older browsers\n let str = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx';\n return str.replace(/[xy]/g, function(c) {\n let r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8);\n return v.toString(16);\n });\n }\n}\n","import extend from 'keen-core/lib/utils/extend';\n\nexport function getScrollState(obj){\n var config = typeof obj === 'object' ? obj : {};\n var state = extend({\n pixel: 0,\n pixel_max: 0,\n ratio: null,\n ratio_max: null\n }, config);\n\n if (typeof window !== undefined || typeof document !== undefined) {\n state.pixel = getScrollOffset() + getWindowHeight();\n if (state.pixel > state.pixel_max) {\n state.pixel_max = state.pixel;\n }\n state.ratio = parseFloat(Number(state.pixel / getScrollableArea()).toFixed(2));\n state.ratio_max = parseFloat(Number(state.pixel_max / getScrollableArea()).toFixed(2));\n }\n\n return state;\n}\n\nfunction getScrollableArea() {\n var body = document.body;\n var html = document.documentElement;\n return Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ) || null;\n}\n\nfunction getScrollOffset() {\n return (window.pageYOffset !== undefined) ? window.pageYOffset : (document.documentElement || document.body.parentNode || document.body).scrollTop;\n}\n\nfunction getWindowHeight() {\n return window.innerHeight || document.documentElement.clientHeight;\n}\n","import { getDomNodePath } from './getDomNodePath';\n\nexport function getDomNodeProfile(el) {\n return {\n action: el.action,\n class: el.className,\n href: getElementProps(el, 'href'),\n id: getElementProps(el, 'id'),\n event_key: getElementProps(el, 'data-event-key'),\n method: el.method,\n name: el.name,\n node_name: el.nodeName,\n selector: getDomNodePath(el),\n text: getElementProps(el, 'text'),\n title: getElementProps(el, 'title'),\n type: el.type,\n x_position: el.offsetLeft || el.clientLeft || null,\n y_position: el.offsetTop || el.clientTop || null\n };\n}\n\nconst getElementProps = (el, prop) => {\n if (el[prop]) {\n return el[prop];\n }\n if (el.hasAttribute && el.hasAttribute(prop)) {\n return el.getAttribute(prop);\n }\n if (el.parentNode) {\n return getElementProps(el.parentNode, prop);\n }\n return null;\n};\n","function extractHostname(url) {\n var hostname;\n //find & remove protocol (http, ftp, etc.) and get hostname\n\n if (url.indexOf(\"://\") > -1) {\n hostname = url.split('/')[2];\n }\n else {\n hostname = url.split('/')[0];\n }\n\n //find & remove port number\n hostname = hostname.split(':')[0];\n //find & remove \"?\"\n hostname = hostname.split('?')[0];\n\n return hostname;\n}\n\n// To address those who want the \"root domain,\" use this function:\nexport function getDomainName(url) {\n var domain = extractHostname(url),\n splitArr = domain.split('.'),\n arrLen = splitArr.length;\n\n //extracting the root domain here\n //if there is a subdomain\n if (arrLen > 2) {\n domain = splitArr[arrLen - 2] + '.' + splitArr[arrLen - 1];\n //check to see if it's using a Country Code Top Level Domain (ccTLD) (i.e. \".me.uk\")\n if (splitArr[arrLen - 2].length == 2 && splitArr[arrLen - 1].length == 2) {\n //this is using a ccTLD\n domain = splitArr[arrLen - 3] + '.' + domain;\n }\n }\n return domain;\n}\n","export function getDatetimeIndex(input){\n var date = input || new Date();\n return {\n 'hour_of_day' : date.getHours(),\n 'day_of_week' : parseInt( 1 + date.getDay() ),\n 'day_of_month' : date.getDate(),\n 'month' : parseInt( 1 + date.getMonth() ),\n 'year' : date.getFullYear()\n };\n}\n","import { getScreenProfile } from './getScreenProfile';\nimport { getWindowProfile } from './getWindowProfile';\n\nexport function getBrowserProfile() {\n return {\n 'cookies' : ('undefined' !== typeof navigator.cookieEnabled) ? navigator.cookieEnabled : false,\n 'codeName' : navigator.appCodeName,\n 'description': getDocumentDescription(),\n 'language' : navigator.language,\n 'name' : navigator.appName,\n 'online' : navigator.onLine,\n 'platform' : navigator.platform,\n 'useragent' : navigator.userAgent,\n 'version' : navigator.appVersion,\n 'screen' : getScreenProfile(),\n 'window' : getWindowProfile()\n }\n}\n\nfunction getDocumentDescription() {\n var el;\n if (document && typeof document.querySelector === 'function') {\n el = document.querySelector('meta[name=\"description\"]');\n }\n return el ? el.content : '';\n}\n","import pkg from '../package.json';\n\nexport function initAutoTrackingCore(lib) {\n return function(obj) {\n const client = this;\n const helpers = lib.helpers;\n const utils = lib.utils;\n\n const options = utils.extend({\n ignoreDisabledFormFields: false,\n ignoreFormFieldTypes: ['password'],\n recordClicks: true,\n recordFormSubmits: true,\n recordPageViews: true,\n recordPageViewsOnExit: false,\n recordScrollState: true,\n shareUuidAcrossDomains: false,\n collectIpAddress: true,\n collectUuid: true,\n catchError: undefined // optional, function(someError) - error handler\n }, obj);\n\n if (client.config.requestType === 'beaconAPI' && options.catchError) {\n throw `You cannot use the BeaconAPI and catchError function in the same time, because BeaconAPI ignores errors. For requests with error handling - use requestType: 'fetch'`;\n return;\n }\n\n if (\n client.config.requestType === 'jsonp' // jsonp is deprecated, it's the default value from old keen's client\n ) {\n if (options.catchError) {\n client.config.requestType = 'fetch';\n } else {\n client.config.requestType = 'beaconAPI';\n }\n }\n\n const now = new Date();\n const cookie = new utils.cookie('keen');\n\n const domainName = helpers.getDomainName(window.location.hostname);\n const cookieDomain = domainName && options.shareUuidAcrossDomains ? {\n domain: '.' + domainName\n } : {};\n\n let uuid;\n if (options.collectUuid) {\n uuid = cookie.get('uuid');\n if (!uuid) {\n uuid = helpers.getUniqueId();\n cookie.set('uuid', uuid, cookieDomain);\n }\n }\n\n let initialReferrer = cookie.get('initialReferrer');\n if (!initialReferrer){\n initialReferrer = document && document.referrer || undefined;\n cookie.set('initialReferrer', initialReferrer, cookieDomain);\n }\n\n let scrollState = {};\n if (options.recordScrollState) {\n scrollState = helpers.getScrollState();\n utils.listener('window').on('scroll', () => {\n scrollState = helpers.getScrollState(scrollState);\n });\n }\n\n const addons = [\n {\n name: 'keen:ua_parser',\n input: {\n ua_string: 'user_agent'\n },\n output: 'tech'\n },\n {\n name: 'keen:url_parser',\n input: {\n url: 'url.full'\n },\n output: 'url.info'\n },\n {\n name: 'keen:url_parser',\n input: {\n url: 'referrer.full'\n },\n output: 'referrer.info'\n },\n {\n name: 'keen:date_time_parser',\n input: {\n date_time: 'keen.timestamp'\n },\n output: 'time.utc'\n },\n {\n name: 'keen:date_time_parser',\n input: {\n date_time: 'local_time_full'\n },\n output: 'time.local'\n }\n ];\n\n let ip_address = '${keen.ip}';\n addons.push({\n name: 'keen:ip_to_geo',\n input: {\n ip: 'ip_address',\n remove_ip_property: !options.collectIpAddress\n },\n output : 'geo'\n });\n\n client.extendEvents(function() {\n const browserProfile = helpers.getBrowserProfile();\n return {\n tracked_by: pkg.name + '-' + pkg.version,\n local_time_full: new Date().toISOString(),\n user: {\n uuid\n },\n page: {\n title: document ? document.title : null,\n description: browserProfile.description,\n scroll_state: scrollState,\n time_on_page: getSecondsSinceDate(now),\n time_on_page_ms: getMiliSecondsSinceDate(now)\n },\n\n ip_address,\n geo: { /* Enriched */ },\n\n user_agent: '${keen.user_agent}',\n tech: {\n profile: browserProfile\n /* Enriched */\n },\n\n url: {\n full: window ? window.location.href : '',\n info: { /* Enriched */ }\n },\n\n referrer: {\n initial: initialReferrer,\n full: document ? document.referrer : '',\n info: { /* Enriched */ }\n },\n\n time: {\n local: { /* Enriched */ },\n utc: { /* Enriched */ }\n },\n\n keen: {\n timestamp: new Date().toISOString(),\n addons,\n }\n };\n });\n\n if (options.recordClicks === true) {\n utils.listener('a, a *').on('click', function(e) {\n const el = e.target;\n const event = {\n element: helpers.getDomNodeProfile(el),\n local_time_full: new Date().toISOString()\n };\n\n if (options.catchError) {\n return client\n .recordEvent({\n collection: 'clicks',\n event\n }).catch(err => {\n options.catchError(err);\n });\n }\n\n return client\n .recordEvent({\n collection: 'clicks',\n event\n });\n });\n }\n\n if (options.recordFormSubmits === true) {\n utils.listener('form').on('submit', function(e) {\n const el = e.target;\n const serializerOptions = {\n disabled: options.ignoreDisabledFormFields,\n ignoreTypes: options.ignoreFormFieldTypes\n };\n const event = {\n form: {\n action: el.action,\n fields: utils.serializeForm(el, serializerOptions),\n method: el.method\n },\n element: helpers.getDomNodeProfile(el),\n local_time_full: new Date().toISOString()\n };\n\n if (options.catchError) {\n return client\n .recordEvent({\n collection: 'form_submissions',\n event\n })\n .catch(err => {\n options.catchError(err);\n });\n }\n\n return client.recordEvent({\n collection: 'form_submissions',\n event\n });\n });\n }\n\n if (options.recordPageViews === true && !options.recordPageViewsOnExit) {\n if (options.catchError) {\n client\n .recordEvent({\n collection: 'pageviews'\n })\n .catch(err => {\n options.catchError(err);\n });\n } else {\n client\n .recordEvent({\n collection: 'pageviews'\n });\n }\n }\n\n if (options.recordPageViewsOnExit && typeof window !== 'undefined') {\n window.addEventListener('beforeunload', () => {\n client.config.requestType = 'beaconAPI'; // you can run beforeunload only with beaconAPI\n client.recordEvent({\n collection: 'pageviews'\n });\n });\n }\n\n return client;\n };\n}\n\nfunction getSecondsSinceDate(date) {\n return Math.round(getMiliSecondsSinceDate(date) / 1000);\n}\n\nfunction getMiliSecondsSinceDate(date) {\n return new Date().getTime() - date.getTime();\n}\n","import Keen from './index';\nimport each from 'keen-core/lib/utils/each';\nimport { queue } from './utils/queue';\n\nexport function deferEvent(eventCollection, eventBody){\n\n if (arguments.length !== 2 || typeof eventCollection !== 'string') {\n handleValidationError.call(this, 'Incorrect arguments provided to #deferEvent method');\n return;\n }\n\n this.queue.events[eventCollection] = this.queue.events[eventCollection] || [];\n this.queue.events[eventCollection].push(eventBody);\n this.queue.capacity++;\n if (!this.queue.timer) {\n this.queue.start();\n }\n this.emit('deferEvent', eventCollection, eventBody);\n return this;\n}\n\nexport function deferEvents(eventsHash){\n var self = this;\n\n if (arguments.length !== 1 || typeof eventsHash !== 'object') {\n handleValidationError.call(this, 'Incorrect arguments provided to #deferEvents method');\n return;\n }\n\n each(eventsHash, function(eventList, eventCollection){\n self.queue.events[eventCollection] = self.queue.events[eventCollection] || [];\n self.queue.events[eventCollection] = self.queue.events[eventCollection].concat(eventList);\n self.queue.capacity = self.queue.capacity + eventList.length;\n if (!self.queue.timer) {\n self.queue.start();\n }\n });\n self.emit('deferEvents', eventsHash);\n return self;\n}\n\nexport function queueCapacity(num){\n if (!arguments.length) return this.queue.config.capacity;\n this.queue.config.capacity = num ? Number(num): 0;\n this.queue.check();\n return this;\n}\n\nexport function queueInterval(num){\n if (!arguments.length) return this.queue.config.interval;\n this.queue.config.interval = num ? Number(num): 0;\n this.queue.check();\n return this;\n}\n\nexport function recordDeferredEvents(){\n const self = this;\n\n if (self.queue.capacity > 0) {\n self.queue.pause();\n let clonedQueueConfig = { ...self.queue.config };\n let clonedQueueEvents = { ...self.queue.events };\n self.queue = queue();\n self.queue.config = clonedQueueConfig;\n self.queue.on('flush', function(){\n self.recordDeferredEvents();\n });\n self.emit('recordDeferredEvents', clonedQueueEvents);\n self.recordEvents(clonedQueueEvents, (err, res) => {\n if (err) {\n self.emit('recordDeferredEventsError', err, clonedQueueEvents);\n }\n });\n }\n return self;\n}\n\nfunction handleValidationError(message){\n this.emit('error', `Event(s) not deferred: ${message}`);\n}\n","import 'promise-polyfill/src/polyfill';\nimport 'whatwg-fetch';\n\nimport md5 from './md5';\n\nimport configDefault from '../config-default.js';\n\nif (typeof self === 'undefined') {\n console.log('IndexedDB is available only in Browser ENV');\n}\n\nconst indexedDBAvailable = typeof self !== 'undefined' && 'indexedDB' in self;\n\nlet cachingEnabled = true;\n\nif (!indexedDBAvailable) {\n // console.log(\"Your browser doesn't support a stable version of IndexedDB.\");\n cachingEnabled = false; // graceful degradation\n}\n\nlet db;\nlet cacheConfig = {\n ...configDefault.cache\n};\n\nfunction initializeIndexedDb(requestCacheConfig = {}){\n if (db) { return Promise.resolve(); }\n if (!cachingEnabled) { return Promise.resolve(); }\n cacheConfig = {\n ...cacheConfig,\n ...requestCacheConfig\n };\n return new Promise((resolve, reject) => {\n const dbConnectionRequest = self.indexedDB.open(cacheConfig.dbName);\n dbConnectionRequest.onerror = function(event) {\n cachingEnabled = false;\n resolve();\n };\n\n dbConnectionRequest.onupgradeneeded = function(event) {\n const db = event.target.result;\n const objectStore = db\n .createObjectStore(cacheConfig.dbCollectionName,\n { keyPath: cacheConfig.dbCollectionKey });\n objectStore.createIndex(\n cacheConfig.dbCollectionKey,\n cacheConfig.dbCollectionKey,\n { unique: true }\n );\n objectStore.createIndex('expiryTime', 'expiryTime', { unique: false });\n };\n\n dbConnectionRequest.onsuccess = function(event) {\n db = event.target.result;\n db.onerror = function(event) {\n cachingEnabled = false; // graceful degradation\n };\n resolve(db);\n };\n });\n}\n\nexport const saveToCache = (hash, configOptions = {}) => {\n return initializeIndexedDb(configOptions).then(() => {\n const transactionSave = db\n .transaction(cacheConfig.dbCollectionName, \"readwrite\")\n .objectStore(cacheConfig.dbCollectionName);\n const requestSave = transactionSave.add({\n hash,\n expiryTime: Date.now() + cacheConfig.maxAge\n });\n requestSave.onsuccess = function(event) {\n };\n requestSave.onerror = function(event) {\n cachingEnabled = false;\n };\n });\n}\n\nexport const getFromCache = (hash, configOptions = {}) => {\n return initializeIndexedDb(configOptions).then(() => {\n return new Promise((resolve, reject) => {\n if (!cachingEnabled) {\n return resolve(null);\n }\n\n const transactionCleanUp = db\n .transaction(cacheConfig.dbCollectionName, \"readwrite\")\n .objectStore(cacheConfig.dbCollectionName);\n const indexCleanUp = transactionCleanUp.index('expiryTime');\n const upperBoundOpenKeyRange = IDBKeyRange.upperBound(Date.now(), true);\n indexCleanUp.openCursor(upperBoundOpenKeyRange).onsuccess = function(event) {\n let cursor = event.target.result;\n if (cursor) {\n let transactionDelete = db\n .transaction(cacheConfig.dbCollectionName, \"readwrite\")\n .objectStore(cacheConfig.dbCollectionName)\n .delete(event.target.result.value[cacheConfig.dbCollectionKey]);\n cursor.continue();\n }\n };\n\n const transactionIndex = db\n .transaction(cacheConfig.dbCollectionName, \"readwrite\")\n .objectStore(cacheConfig.dbCollectionName);\n const index = transactionIndex.index(cacheConfig.dbCollectionKey);\n const responseFromCache = index.get(hash);\n responseFromCache.onsuccess = function(event) {\n if (!event.target.result ||\n event.target.result.expiryTime < Date.now()\n ) {\n if (event.target.result && event.target.result.expiryTime < Date.now()){\n const transactionDelete = db\n .transaction(cacheConfig.dbCollectionName, \"readwrite\")\n .objectStore(cacheConfig.dbCollectionName)\n .delete(event.target.result[cacheConfig.dbCollectionKey]);\n transactionDelete.onsuccess = (event) => {\n resolve(getFromCache(hash, configOptions));\n };\n transactionDelete.onerror = (event) => {\n cachingEnabled = false;\n resolve(getFromCache(hash, configOptions));\n };\n return resolve(null);\n }\n return resolve(null);\n } else {\n return resolve(event.target.result);\n }\n };\n responseFromCache.onerror = function(event) {\n cachingEnabled = false;\n resolve(getFromCache(hash, configOptions));\n };\n });\n });\n}\n","import 'promise-polyfill/src/polyfill';\n\nimport md5 from './md5';\nimport { getFromCache, saveToCache } from './cache-browser';\n\nimport configDefault from '../config-default.js';\n\nlet uniqueIds = [];\n\nexport const isUnique = (customCacheConfig, extendedEventBody) => {\n const configCache = { ...configDefault.cache, ...customCacheConfig.cache };\n const stringifiedEvent = JSON.stringify(extendedEventBody);\n const { hashingMethod } = configCache;\n const hash = hashingMethod && hashingMethod.toLowerCase() === 'md5'\n ? md5(stringifiedEvent) : stringifiedEvent;\n const expiryTime = configCache.maxAge ? (Date.now() + configCache.maxAge) : undefined;\n const item = {\n hash,\n expiryTime\n };\n if (expiryTime){\n const now = Date.now();\n uniqueIds = uniqueIds.filter(item => item.expiryTime > now);\n }\n\n const alreadySentEvent = uniqueIds.find(item => item.hash === hash);\n if (alreadySentEvent) {\n if (alreadySentEvent.expiryTime && alreadySentEvent.expiryTime < Date.now()) {\n uniqueIds = uniqueIds.filter(item => item.hash !== hash);\n } else {\n return Promise.resolve(false);\n }\n }\n uniqueIds.push(item);\n if (configCache.storage && configCache.storage.toLowerCase() === 'indexeddb') {\n return getFromCache(hash, configCache).then(alreadySentEvent => {\n if (alreadySentEvent) {\n return false;\n }\n saveToCache(hash, configCache);\n return true;\n });\n }\n\n return Promise.resolve(true);\n}\n\nexport default isUnique;\n","import 'promise-polyfill/src/polyfill';\nimport 'whatwg-fetch';\n\nimport configDefault from '../config-default.js';\n\nexport default function(url, options) {\n const config = {\n ...configDefault,\n ...(options.retry || {})\n };\n\n const retriesLimit = config.retry.limit;\n const retryInitialDelay = config.retry.initialDelay;\n const retryOn = config.retry.retryOnResponseStatuses;\n let retriesCount = 0;\n\n if (retryOn && !(retryOn instanceof Array)) {\n throw {\n name: 'ArgumentError',\n message: 'retryOn property expects an array'\n }\n }\n\n return new Promise(function(resolve, reject) {\n const wrappedFetch = function(n) {\n fetch(url, options)\n .then(function(response) {\n if (retryOn.indexOf(response.status) === -1) {\n resolve(response);\n } else {\n if (n > 0) {\n retry();\n } else {\n reject(response);\n }\n }\n })\n .catch(function(error) {\n if (n > 0) {\n retry();\n } else {\n reject(error);\n }\n });\n };\n\n function retry() {\n retriesCount = retriesCount + 1;\n setTimeout(function() {\n wrappedFetch(retriesLimit - retriesCount);\n }, 2^retriesCount * retryInitialDelay);\n }\n\n wrappedFetch(retriesLimit - retriesCount);\n });\n};\n","module.exports = {\n map: \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\",\n encode: function (n) {\n \"use strict\";\n var o = \"\", i = 0, m = this.map, i1, i2, i3, e1, e2, e3, e4;\n n = this.utf8.encode(n);\n while (i < n.length) {\n i1 = n.charCodeAt(i++); i2 = n.charCodeAt(i++); i3 = n.charCodeAt(i++);\n e1 = (i1 >> 2); e2 = (((i1 & 3) << 4) | (i2 >> 4)); e3 = (isNaN(i2) ? 64 : ((i2 & 15) << 2) | (i3 >> 6));\n e4 = (isNaN(i2) || isNaN(i3)) ? 64 : i3 & 63;\n o = o + m.charAt(e1) + m.charAt(e2) + m.charAt(e3) + m.charAt(e4);\n } return o;\n },\n decode: function (n) {\n \"use strict\";\n var o = \"\", i = 0, m = this.map, cc = String.fromCharCode, e1, e2, e3, e4, c1, c2, c3;\n n = n.replace(/[^A-Za-z0-9\\+\\/\\=]/g, \"\");\n while (i < n.length) {\n e1 = m.indexOf(n.charAt(i++)); e2 = m.indexOf(n.charAt(i++));\n e3 = m.indexOf(n.charAt(i++)); e4 = m.indexOf(n.charAt(i++));\n c1 = (e1 << 2) | (e2 >> 4); c2 = ((e2 & 15) << 4) | (e3 >> 2);\n c3 = ((e3 & 3) << 6) | e4;\n o = o + (cc(c1) + ((e3 != 64) ? cc(c2) : \"\")) + (((e4 != 64) ? cc(c3) : \"\"));\n } return this.utf8.decode(o);\n },\n utf8: {\n encode: function (n) {\n \"use strict\";\n var o = \"\", i = 0, cc = String.fromCharCode, c;\n while (i < n.length) {\n c = n.charCodeAt(i++); o = o + ((c < 128) ? cc(c) : ((c > 127) && (c < 2048)) ?\n (cc((c >> 6) | 192) + cc((c & 63) | 128)) : (cc((c >> 12) | 224) + cc(((c >> 6) & 63) | 128) + cc((c & 63) | 128)));\n } return o;\n },\n decode: function (n) {\n \"use strict\";\n var o = \"\", i = 0, cc = String.fromCharCode, c2, c;\n while (i < n.length) {\n c = n.charCodeAt(i);\n o = o + ((c < 128) ? [cc(c), i++][0] : ((c > 191) && (c < 224)) ?\n [cc(((c & 31) << 6) | ((c2 = n.charCodeAt(i + 1)) & 63)), (i += 2)][0] :\n [cc(((c & 15) << 12) | (((c2 = n.charCodeAt(i + 1)) & 63) << 6) | ((c3 = n.charCodeAt(i + 2)) & 63)), (i += 3)][0]);\n } return o;\n }\n }\n};\n","// shim for using process in browser\nvar process = module.exports = {};\n\n// cached from whatever global is present so that test runners that stub it\n// don't break things. But we need to wrap it in a try catch in case it is\n// wrapped in strict mode code which doesn't define any globals. It's inside a\n// function because try/catches deoptimize in certain engines.\n\nvar cachedSetTimeout;\nvar cachedClearTimeout;\n\nfunction defaultSetTimout() {\n throw new Error('setTimeout has not been defined');\n}\nfunction defaultClearTimeout () {\n throw new Error('clearTimeout has not been defined');\n}\n(function () {\n try {\n if (typeof setTimeout === 'function') {\n cachedSetTimeout = setTimeout;\n } else {\n cachedSetTimeout = defaultSetTimout;\n }\n } catch (e) {\n cachedSetTimeout = defaultSetTimout;\n }\n try {\n if (typeof clearTimeout === 'function') {\n cachedClearTimeout = clearTimeout;\n } else {\n cachedClearTimeout = defaultClearTimeout;\n }\n } catch (e) {\n cachedClearTimeout = defaultClearTimeout;\n }\n} ())\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n }\n // if setTimeout wasn't available but was latter defined\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n cachedSetTimeout = setTimeout;\n return setTimeout(fun, 0);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch(e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch(e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n\n\n}\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n }\n // if clearTimeout wasn't available but was latter defined\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n cachedClearTimeout = clearTimeout;\n return clearTimeout(marker);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n\n\n\n}\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\nprocess.prependListener = noop;\nprocess.prependOnceListener = noop;\n\nprocess.listeners = function (name) { return [] }\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n","(function (global, undefined) {\n \"use strict\";\n\n if (global.setImmediate) {\n return;\n }\n\n var nextHandle = 1; // Spec says greater than zero\n var tasksByHandle = {};\n var currentlyRunningATask = false;\n var doc = global.document;\n var registerImmediate;\n\n function setImmediate(callback) {\n // Callback can either be a function or a string\n if (typeof callback !== \"function\") {\n callback = new Function(\"\" + callback);\n }\n // Copy function arguments\n var args = new Array(arguments.length - 1);\n for (var i = 0; i < args.length; i++) {\n args[i] = arguments[i + 1];\n }\n // Store and register the task\n var task = { callback: callback, args: args };\n tasksByHandle[nextHandle] = task;\n registerImmediate(nextHandle);\n return nextHandle++;\n }\n\n function clearImmediate(handle) {\n delete tasksByHandle[handle];\n }\n\n function run(task) {\n var callback = task.callback;\n var args = task.args;\n switch (args.length) {\n case 0:\n callback();\n break;\n case 1:\n callback(args[0]);\n break;\n case 2:\n callback(args[0], args[1]);\n break;\n case 3:\n callback(args[0], args[1], args[2]);\n break;\n default:\n callback.apply(undefined, args);\n break;\n }\n }\n\n function runIfPresent(handle) {\n // From the spec: \"Wait until any invocations of this algorithm started before this one have completed.\"\n // So if we're currently running a task, we'll need to delay this invocation.\n if (currentlyRunningATask) {\n // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a\n // \"too much recursion\" error.\n setTimeout(runIfPresent, 0, handle);\n } else {\n var task = tasksByHandle[handle];\n if (task) {\n currentlyRunningATask = true;\n try {\n run(task);\n } finally {\n clearImmediate(handle);\n currentlyRunningATask = false;\n }\n }\n }\n }\n\n function installNextTickImplementation() {\n registerImmediate = function(handle) {\n process.nextTick(function () { runIfPresent(handle); });\n };\n }\n\n function canUsePostMessage() {\n // The test against `importScripts` prevents this implementation from being installed inside a web worker,\n // where `global.postMessage` means something completely different and can't be used for this purpose.\n if (global.postMessage && !global.importScripts) {\n var postMessageIsAsynchronous = true;\n var oldOnMessage = global.onmessage;\n global.onmessage = function() {\n postMessageIsAsynchronous = false;\n };\n global.postMessage(\"\", \"*\");\n global.onmessage = oldOnMessage;\n return postMessageIsAsynchronous;\n }\n }\n\n function installPostMessageImplementation() {\n // Installs an event handler on `global` for the `message` event: see\n // * https://developer.mozilla.org/en/DOM/window.postMessage\n // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages\n\n var messagePrefix = \"setImmediate$\" + Math.random() + \"$\";\n var onGlobalMessage = function(event) {\n if (event.source === global &&\n typeof event.data === \"string\" &&\n event.data.indexOf(messagePrefix) === 0) {\n runIfPresent(+event.data.slice(messagePrefix.length));\n }\n };\n\n if (global.addEventListener) {\n global.addEventListener(\"message\", onGlobalMessage, false);\n } else {\n global.attachEvent(\"onmessage\", onGlobalMessage);\n }\n\n registerImmediate = function(handle) {\n global.postMessage(messagePrefix + handle, \"*\");\n };\n }\n\n function installMessageChannelImplementation() {\n var channel = new MessageChannel();\n channel.port1.onmessage = function(event) {\n var handle = event.data;\n runIfPresent(handle);\n };\n\n registerImmediate = function(handle) {\n channel.port2.postMessage(handle);\n };\n }\n\n function installReadyStateChangeImplementation() {\n var html = doc.documentElement;\n registerImmediate = function(handle) {\n // Create a