New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

amplitude-js

Package Overview
Dependencies
Maintainers
2
Versions
113
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

amplitude-js - npm Package Compare versions

Comparing version 4.6.0-beta.3 to 4.6.0

2

amplitude-snippet.min.js
(function(e,t){var n=e.amplitude||{_q:[],_iq:{}};var r=t.createElement("script")
;r.type="text/javascript";r.async=true
;r.src="https://cdn.amplitude.com/libs/amplitude-4.6.0-beta.1-min.gz.js"
;r.src="https://cdn.amplitude.com/libs/amplitude-4.6.0-min.gz.js"
;r.onload=function(){if(e.amplitude.runQueuedFunctions){

@@ -5,0 +5,0 @@ e.amplitude.runQueuedFunctions()}else{

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.amplitude=t()}(this,function(){"use strict";var l="$default_instance",c=2,t=4096,a=1e3,f="$identify",h="$groupidentify",v="amplitude_lastEventId",g="amplitude_lastEventTime",m="amplitude_lastIdentifyId",y="amplitude_lastSequenceNumber",_="amplitude_sessionId",w="amplitude_deviceId",b="amplitude_optOut",I="amplitude_userId",n="amplitude_cookie_test",i="revenue_amount",r="$productId",o="$quantity",s="$price",u="$revenueType",p="amp_device_id",d="referrer",S="utm_source",O="utm_medium",E="utm_campaign",x="utm_term",N="utm_content",k=function(e){for(var t="",n=0;n<e.length;n++){var i=e.charCodeAt(n);i<128?t+=String.fromCharCode(i):(127<i&&i<2048?t+=String.fromCharCode(i>>6|192):(t+=String.fromCharCode(i>>12|224),t+=String.fromCharCode(i>>6&63|128)),t+=String.fromCharCode(63&i|128))}return t},A=function(e){for(var t="",n=0,i=0,r=0,o=0;n<e.length;)(i=e.charCodeAt(n))<128?(t+=String.fromCharCode(i),n++):191<i&&i<224?(r=e.charCodeAt(n+1),t+=String.fromCharCode((31&i)<<6|63&r),n+=2):(r=e.charCodeAt(n+1),o=e.charCodeAt(n+2),t+=String.fromCharCode((15&i)<<12|(63&r)<<6|63&o),n+=3);return t},T={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(e){try{if(window.btoa&&window.atob)return window.btoa(unescape(encodeURIComponent(e)))}catch(e){}return T._encode(e)},_encode:function(e){var t,n,i,r,o,s,a,u="",p=0;for(e=k(e);p<e.length;)r=(t=e.charCodeAt(p++))>>2,o=(3&t)<<4|(n=e.charCodeAt(p++))>>4,s=(15&n)<<2|(i=e.charCodeAt(p++))>>6,a=63&i,isNaN(n)?s=a=64:isNaN(i)&&(a=64),u=u+T._keyStr.charAt(r)+T._keyStr.charAt(o)+T._keyStr.charAt(s)+T._keyStr.charAt(a);return u},decode:function(e){try{if(window.btoa&&window.atob)return decodeURIComponent(escape(window.atob(e)))}catch(e){}return T._decode(e)},_decode:function(e){var t,n,i,r,o,s,a="",u=0;for(e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");u<e.length;)t=T._keyStr.indexOf(e.charAt(u++))<<2|(r=T._keyStr.indexOf(e.charAt(u++)))>>4,n=(15&r)<<4|(o=T._keyStr.indexOf(e.charAt(u++)))>>2,i=(3&o)<<6|(s=T._keyStr.indexOf(e.charAt(u++))),a+=String.fromCharCode(t),64!==o&&(a+=String.fromCharCode(n)),64!==s&&(a+=String.fromCharCode(i));return a=A(a)}},P=Object.prototype.toString,R=function(e){switch(P.call(e)){case"[object Date]":return"date";case"[object RegExp]":return"regexp";case"[object Arguments]":return"arguments";case"[object Array]":return"array";case"[object Error]":return"error"}return null===e?"null":void 0===e?"undefined":e!=e?"nan":e&&1===e.nodeType?"element":"undefined"!=typeof Buffer&&"function"==typeof Buffer.isBuffer&&Buffer.isBuffer(e)?"buffer":void 0===(e=e.valueOf?e.valueOf():Object.prototype.valueOf.apply(e))?"undefined":babelHelpers.typeof(e)},j={DISABLE:0,ERROR:1,WARN:2,INFO:3},q=j.WARN,C={error:function(e){q>=j.ERROR&&U(e)},warn:function(e){q>=j.WARN&&U(e)},info:function(e){q>=j.INFO&&U(e)}},U=function(e){try{console.log("[Amplitude] "+e)}catch(e){}},M=function(e){return"string"===R(e)&&e.length>t?e.substring(0,t):e},D=function(e){var t=R(e);if("object"!==t)return C.error("Error: invalid properties format. Expecting Javascript object, received "+t+", ignoring"),{};if(Object.keys(e).length>a)return C.error("Error: too many properties (more than 1000), ignoring"),{};var n={};for(var i in e)if(e.hasOwnProperty(i)){var r=i,o=R(r);"string"!==o&&(r=String(r),C.warn("WARNING: Non-string property key, received type "+o+', coercing to string "'+r+'"'));var s=B(r,e[i]);null!==s&&(n[r]=s)}return n},z=["null","nan","undefined","function","arguments","regexp","element"],B=function e(t,n){var i=R(n);if(-1!==z.indexOf(i))C.warn('WARNING: Property key "'+t+'" with invalid value type '+i+", ignoring"),n=null;else if("error"===i)n=String(n),C.warn('WARNING: Property key "'+t+'" with value type error, coercing to '+n);else if("array"===i){for(var r=[],o=0;o<n.length;o++){var s=n[o],a=R(s);"array"!==a&&"object"!==a?r.push(e(t,s)):C.warn("WARNING: Cannot have "+a+" nested in an array property value, skipping")}n=r}else"object"===i&&(n=D(n));return n},K=function(e,t){var n=R(t);if("string"===n)return t;if("date"===n||"number"===n||"boolean"===n)return t=String(t),C.warn("WARNING: Non-string groupName, received type "+n+', coercing to string "'+t+'"'),t;if("array"===n){for(var i=[],r=0;r<t.length;r++){var o=t[r],s=R(o);"array"!==s&&"object"!==s?"string"===s?i.push(o):"date"!==s&&"number"!==s&&"boolean"!==s||(o=String(o),C.warn("WARNING: Non-string groupName, received type "+s+', coercing to string "'+o+'"'),i.push(o)):C.warn("WARNING: Skipping nested "+s+" in array groupName")}return i}C.warn("WARNING: Non-string groupName, received type "+n+". Please use strings or array of strings for groupName")},L=function(e){j.hasOwnProperty(e)&&(q=j[e])},W=C,F=function(e){return!e||0===e.length},G=function(e,t){e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var n=new RegExp("[\\?&]"+e+"=([^&#]*)").exec(t);return null===n?void 0:decodeURIComponent(n[1].replace(/\+/g," "))},V=function e(t){if("array"===R(t))for(var n=0;n<t.length;n++)t[n]=e(t[n]);else if("object"===R(t))for(var i in t)t.hasOwnProperty(i)&&(t[i]=e(t[i]));else t=M(t);return t},$=function(e){var t=R(e);if("object"!==t)return C.error("Error: invalid groups format. Expecting Javascript object, received "+t+", ignoring"),{};var n={};for(var i in e)if(e.hasOwnProperty(i)){var r=i,o=R(r);"string"!==o&&(r=String(r),C.warn("WARNING: Non-string groupType, received type "+o+', coercing to string "'+r+'"'));var s=K(r,e[i]);null!==s&&(n[r]=s)}return n},H=function(e,t,n){return R(e)===n||(C.error("Invalid "+t+" input type. Expected "+n+" but received "+R(e)),!1)},J=D,X=function(e,t,n){var i=null!==t?n.expirationDays:-1;if(i){var r=new Date;r.setTime(r.getTime()+24*i*60*60*1e3),i=r}var o=e+"="+t;i&&(o+="; expires="+i.toUTCString()),o+="; path=/",n.domain&&(o+="; domain="+n.domain),document.cookie=o},Q=function(e){try{for(var t=document.cookie.split(";"),n=null,i=0;i<t.length;i++){for(var r=t[i];" "===r.charAt(0);)r=r.substring(1,r.length);if(0===r.indexOf(e)){n=r.substring(e.length,r.length);break}}return n}catch(e){return null}},Y={expirationDays:void 0,domain:void 0},Z=function(e){var t,n,i=(t=e,(n=document.createElement("a")).href=t,n.hostname||location.hostname).split("."),r=i[i.length-1],o=[];if(4===i.length&&r===parseInt(r,10))return o;if(i.length<=1)return o;for(var s=i.length-2;0<=s;--s)o.push(i.slice(s).join("."));for(var a=0;a<o.length;++a){var u="__tld_test__",p=o[a],c={domain:"."+p};if(X(u,1,c),Q(u))return X(u,null,c),p}return""},ee=function(e){var t="";return Y.domain&&(t="."===Y.domain.charAt(0)?Y.domain.substring(1):Y.domain),e+t},te=function(e){var t=ee(e)+"=",n=Q(t);try{if(n)return JSON.parse(T.decode(n))}catch(e){return null}return null},ne=function(e,t){try{return X(ee(e),T.encode(JSON.stringify(t)),Y),!0}catch(e){return!1}},ie=function(e){try{return X(ee(e),null,Y),!0}catch(e){return!1}},re={reset:function(){Y={expirationDays:void 0,domain:void 0}},options:function(e){if(0===arguments.length)return Y;e=e||{},Y.expirationDays=e.expirationDays;var t=F(e.domain)?"."+Z(window.location.href):e.domain,n=Math.random();Y.domain=t,ne("amplitude_test",n);var i=te("amplitude_test");return i&&i===n||(t=null),ie("amplitude_test"),Y.domain=t,Y},get:te,set:ne,remove:ie},oe=window.localStorage,se=function(){this.storage=null};se.prototype._cookiesEnabled=function(){var e,t=String(new Date);try{return re.set(n,t),e=re.get(n)===t,re.remove(n),e}catch(e){}return!1},se.prototype.getStorage=function(){if(null!==this.storage)return this.storage;if(this._cookiesEnabled())this.storage=re;else{var n="amp_cookiestore_";this.storage={_options:{expirationDays:void 0,domain:void 0},reset:function(){this._options={expirationDays:void 0,domain:void 0}},options:function(e){return 0===arguments.length||(e=e||{},this._options.expirationDays=e.expirationDays||this._options.expirationDays,this._options.domain=e.domain||this._options.domain||window.location.hostname),this._options},get:function(e){try{return JSON.parse(oe.getItem(n+e))}catch(e){}return null},set:function(e,t){try{return oe.setItem(n+e,JSON.stringify(t)),!0}catch(e){}return!1},remove:function(e){try{oe.removeItem(n+e)}catch(e){return!1}}}}return this.storage};var ae="$clearAll",ue=function(){this.userPropertiesOperations={},this.properties=[]};ue.prototype.add=function(e,t){return"number"===R(t)||"string"===R(t)?this._addOperation("$add",e,t):W.error("Unsupported type for value: "+R(t)+", expecting number or string"),this},ue.prototype.append=function(e,t){return this._addOperation("$append",e,t),this},ue.prototype.clearAll=function(){return 0<Object.keys(this.userPropertiesOperations).length?this.userPropertiesOperations.hasOwnProperty(ae)||W.error("Need to send $clearAll on its own Identify object without any other operations, skipping $clearAll"):this.userPropertiesOperations[ae]="-",this},ue.prototype.prepend=function(e,t){return this._addOperation("$prepend",e,t),this},ue.prototype.set=function(e,t){return this._addOperation("$set",e,t),this},ue.prototype.setOnce=function(e,t){return this._addOperation("$setOnce",e,t),this},ue.prototype.unset=function(e){return this._addOperation("$unset",e,"-"),this},ue.prototype._addOperation=function(e,t,n){this.userPropertiesOperations.hasOwnProperty(ae)?W.error("This identify already contains a $clearAll operation, skipping operation "+e):-1===this.properties.indexOf(t)?(this.userPropertiesOperations.hasOwnProperty(e)||(this.userPropertiesOperations[e]={}),this.userPropertiesOperations[e][t]=n,this.properties.push(t)):W.error('User property "'+t+'" already used in this identify, skipping operation '+e)};var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function pe(e,t){return e(t={exports:{}},t.exports),t.exports}var ce=pe(function(s){!function(e){function d(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function a(e,t,n,i,r,o){return d((s=d(d(t,e),d(i,o)))<<(a=r)|s>>>32-a,n);var s,a}function l(e,t,n,i,r,o,s){return a(t&n|~t&i,e,t,r,o,s)}function f(e,t,n,i,r,o,s){return a(t&i|n&~i,e,t,r,o,s)}function h(e,t,n,i,r,o,s){return a(t^n^i,e,t,r,o,s)}function v(e,t,n,i,r,o,s){return a(n^(t|~i),e,t,r,o,s)}function u(e,t){var n,i,r,o,s;e[t>>5]|=128<<t%32,e[14+(t+64>>>9<<4)]=t;var a=1732584193,u=-271733879,p=-1732584194,c=271733878;for(n=0;n<e.length;n+=16)u=v(u=v(u=v(u=v(u=h(u=h(u=h(u=h(u=f(u=f(u=f(u=f(u=l(u=l(u=l(u=l(r=u,p=l(o=p,c=l(s=c,a=l(i=a,u,p,c,e[n],7,-680876936),u,p,e[n+1],12,-389564586),a,u,e[n+2],17,606105819),c,a,e[n+3],22,-1044525330),p=l(p,c=l(c,a=l(a,u,p,c,e[n+4],7,-176418897),u,p,e[n+5],12,1200080426),a,u,e[n+6],17,-1473231341),c,a,e[n+7],22,-45705983),p=l(p,c=l(c,a=l(a,u,p,c,e[n+8],7,1770035416),u,p,e[n+9],12,-1958414417),a,u,e[n+10],17,-42063),c,a,e[n+11],22,-1990404162),p=l(p,c=l(c,a=l(a,u,p,c,e[n+12],7,1804603682),u,p,e[n+13],12,-40341101),a,u,e[n+14],17,-1502002290),c,a,e[n+15],22,1236535329),p=f(p,c=f(c,a=f(a,u,p,c,e[n+1],5,-165796510),u,p,e[n+6],9,-1069501632),a,u,e[n+11],14,643717713),c,a,e[n],20,-373897302),p=f(p,c=f(c,a=f(a,u,p,c,e[n+5],5,-701558691),u,p,e[n+10],9,38016083),a,u,e[n+15],14,-660478335),c,a,e[n+4],20,-405537848),p=f(p,c=f(c,a=f(a,u,p,c,e[n+9],5,568446438),u,p,e[n+14],9,-1019803690),a,u,e[n+3],14,-187363961),c,a,e[n+8],20,1163531501),p=f(p,c=f(c,a=f(a,u,p,c,e[n+13],5,-1444681467),u,p,e[n+2],9,-51403784),a,u,e[n+7],14,1735328473),c,a,e[n+12],20,-1926607734),p=h(p,c=h(c,a=h(a,u,p,c,e[n+5],4,-378558),u,p,e[n+8],11,-2022574463),a,u,e[n+11],16,1839030562),c,a,e[n+14],23,-35309556),p=h(p,c=h(c,a=h(a,u,p,c,e[n+1],4,-1530992060),u,p,e[n+4],11,1272893353),a,u,e[n+7],16,-155497632),c,a,e[n+10],23,-1094730640),p=h(p,c=h(c,a=h(a,u,p,c,e[n+13],4,681279174),u,p,e[n],11,-358537222),a,u,e[n+3],16,-722521979),c,a,e[n+6],23,76029189),p=h(p,c=h(c,a=h(a,u,p,c,e[n+9],4,-640364487),u,p,e[n+12],11,-421815835),a,u,e[n+15],16,530742520),c,a,e[n+2],23,-995338651),p=v(p,c=v(c,a=v(a,u,p,c,e[n],6,-198630844),u,p,e[n+7],10,1126891415),a,u,e[n+14],15,-1416354905),c,a,e[n+5],21,-57434055),p=v(p,c=v(c,a=v(a,u,p,c,e[n+12],6,1700485571),u,p,e[n+3],10,-1894986606),a,u,e[n+10],15,-1051523),c,a,e[n+1],21,-2054922799),p=v(p,c=v(c,a=v(a,u,p,c,e[n+8],6,1873313359),u,p,e[n+15],10,-30611744),a,u,e[n+6],15,-1560198380),c,a,e[n+13],21,1309151649),p=v(p,c=v(c,a=v(a,u,p,c,e[n+4],6,-145523070),u,p,e[n+11],10,-1120210379),a,u,e[n+2],15,718787259),c,a,e[n+9],21,-343485551),a=d(a,i),u=d(u,r),p=d(p,o),c=d(c,s);return[a,u,p,c]}function p(e){var t,n="",i=32*e.length;for(t=0;t<i;t+=8)n+=String.fromCharCode(e[t>>5]>>>t%32&255);return n}function c(e){var t,n=[];for(n[(e.length>>2)-1]=void 0,t=0;t<n.length;t+=1)n[t]=0;var i=8*e.length;for(t=0;t<i;t+=8)n[t>>5]|=(255&e.charCodeAt(t/8))<<t%32;return n}function i(e){var t,n,i="0123456789abcdef",r="";for(n=0;n<e.length;n+=1)t=e.charCodeAt(n),r+=i.charAt(t>>>4&15)+i.charAt(15&t);return r}function n(e){return unescape(encodeURIComponent(e))}function r(e){return p(u(c(t=n(e)),8*t.length));var t}function o(e,t){return function(e,t){var n,i,r=c(e),o=[],s=[];for(o[15]=s[15]=void 0,16<r.length&&(r=u(r,8*e.length)),n=0;n<16;n+=1)o[n]=909522486^r[n],s[n]=1549556828^r[n];return i=u(o.concat(c(t)),512+8*t.length),p(u(s.concat(i),640))}(n(e),n(t))}function t(e,t,n){return t?n?o(t,e):i(o(t,e)):n?r(e):i(r(e))}s.exports?s.exports=t:e.md5=t}(e)}),de=function(e){return encodeURIComponent(e).replace(/[!'()*]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})},le=Object.getOwnPropertySymbols,fe=Object.prototype.hasOwnProperty,he=Object.prototype.propertyIsEnumerable;var ve=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var i={};return"abcdefghijklmnopqrst".split("").forEach(function(e){i[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},i)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,i,r=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),o=1;o<arguments.length;o++){for(var s in n=Object(arguments[o]))fe.call(n,s)&&(r[s]=n[s]);if(le){i=le(n);for(var a=0;a<i.length;a++)he.call(n,i[a])&&(r[i[a]]=n[i[a]])}}return r},ge="%[a-f0-9]{2}";new RegExp(ge,"gi"),new RegExp("("+ge+")+","gi");function me(e,t){return t.encode?t.strict?de(e):encodeURIComponent(e):e}var ye=function(i,r){!1===(r=ve({encode:!0,strict:!0,arrayFormat:"none"},r)).sort&&(r.sort=function(){});var o=function(i){switch(i.arrayFormat){case"index":return function(e,t,n){return null===t?[me(e,i),"[",n,"]"].join(""):[me(e,i),"[",me(n,i),"]=",me(t,i)].join("")};case"bracket":return function(e,t){return null===t?me(e,i):[me(e,i),"[]=",me(t,i)].join("")};default:return function(e,t){return null===t?me(e,i):[me(e,i),"=",me(t,i)].join("")}}}(r);return i?Object.keys(i).sort(r.sort).map(function(t){var e=i[t];if(void 0===e)return"";if(null===e)return me(t,r);if(Array.isArray(e)){var n=[];return e.slice().forEach(function(e){void 0!==e&&n.push(o(t,e,n.length))}),n.join("&")}return me(t,r)+"="+me(e,r)}).filter(function(e){return 0<e.length}).join("&"):""},_e=function(e,t){this.url=e,this.data=t||{}};_e.prototype.send=function(e){if(!!window.XDomainRequest){var t=new window.XDomainRequest;t.open("POST",this.url,!0),t.onload=function(){e(200,t.responseText)},t.onerror=function(){"Request Entity Too Large"===t.responseText?e(413,t.responseText):e(500,t.responseText)},t.ontimeout=function(){},t.onprogress=function(){},t.send(ye(this.data))}else{var n=new XMLHttpRequest;n.open("POST",this.url,!0),n.onreadystatechange=function(){4===n.readyState&&e(n.status,n.responseText)},n.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"),n.send(ye(this.data))}};var we=function(){this._price=null,this._productId=null,this._quantity=1,this._revenueType=null,this._properties=null};we.prototype.setProductId=function(e){return"string"!==R(e)?W.error("Unsupported type for productId: "+R(e)+", expecting string"):F(e)?W.error("Invalid empty productId"):this._productId=e,this},we.prototype.setQuantity=function(e){return"number"!==R(e)?W.error("Unsupported type for quantity: "+R(e)+", expecting number"):this._quantity=parseInt(e),this},we.prototype.setPrice=function(e){return"number"!==R(e)?W.error("Unsupported type for price: "+R(e)+", expecting number"):this._price=e,this},we.prototype.setRevenueType=function(e){return"string"!==R(e)?W.error("Unsupported type for revenueType: "+R(e)+", expecting string"):this._revenueType=e,this},we.prototype.setEventProperties=function(e){return"object"!==R(e)?W.error("Unsupported type for eventProperties: "+R(e)+", expecting object"):this._properties=J(e),this},we.prototype._isValidRevenue=function(){return"number"===R(this._price)||(W.error("Invalid revenue, need to set price field"),!1)},we.prototype._toJSONObject=function(){var e="object"===R(this._properties)?this._properties:{};return null!==this._productId&&(e[r]=this._productId),null!==this._quantity&&(e[o]=this._quantity),null!==this._price&&(e[s]=this._price),null!==this._revenueType&&(e[u]=this._revenueType),e};var be=pe(function(S,O){!function(r,d){var l="function",f="undefined",h="object",e="model",t="name",n="type",i="vendor",o="version",s="architecture",a="console",u="mobile",p="tablet",c="smarttv",v="wearable",g={extend:function(e,t){var n={};for(var i in e)t[i]&&t[i].length%2==0?n[i]=t[i].concat(e[i]):n[i]=e[i];return n},has:function(e,t){return"string"==typeof e&&-1!==t.toLowerCase().indexOf(e.toLowerCase())},lowerize:function(e){return e.toLowerCase()},major:function(e){return"string"==typeof e?e.split(".")[0]:d}},m={rgx:function(){for(var e,t,n,i,r,o,s,a=0,u=arguments;a<u.length&&!o;){var p=u[a],c=u[a+1];if(typeof e===f)for(i in e={},c)c.hasOwnProperty(i)&&(typeof(r=c[i])===h?e[r[0]]=d:e[r]=d);for(t=n=0;t<p.length&&!o;)if(o=p[t++].exec(this.getUA()))for(i=0;i<c.length;i++)s=o[++n],typeof(r=c[i])===h&&0<r.length?2==r.length?typeof r[1]==l?e[r[0]]=r[1].call(this,s):e[r[0]]=r[1]:3==r.length?typeof r[1]!==l||r[1].exec&&r[1].test?e[r[0]]=s?s.replace(r[1],r[2]):d:e[r[0]]=s?r[1].call(this,s,r[2]):d:4==r.length&&(e[r[0]]=s?r[3].call(this,s.replace(r[1],r[2])):d):e[r]=s||d;a+=2}return e},str:function(e,t){for(var n in t)if(typeof t[n]===h&&0<t[n].length){for(var i=0;i<t[n].length;i++)if(g.has(t[n][i],e))return"?"===n?d:n}else if(g.has(t[n],e))return"?"===n?d:n;return e}},y={browser:{oldsafari:{version:{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}},name:{"Opera Mobile":"Opera Mobi","IE Mobile":"IEMobile"}},device:{amazon:{model:{"Fire Phone":["SD","KF"]}},sprint:{model:{"Evo Shift 4G":"7373KT"},vendor:{HTC:"APA",Sprint:"Sprint"}}},os:{windows:{version:{ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},name:{"Windows Phone":"Windows Phone OS"}}}},_={browser:[[/(opera\smini)\/([\w\.-]+)/i,/(opera\s[mobiletab]+).+version\/([\w\.-]+)/i,/(opera).+version\/([\w\.]+)/i,/(opera)[\/\s]+([\w\.]+)/i],[t,o],[/(OPiOS)[\/\s]+([\w\.]+)/i],[[t,"Opera Mini"],o],[/\s(opr)\/([\w\.]+)/i],[[t,"Opera"],o],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/\s]?([\w\.]+)*/i,/(avant\s|iemobile|slim|baidu)(?:browser)?[\/\s]?([\w\.]*)/i,/(?:ms|\()(ie)\s([\w\.]+)/i,/(rekonq)\/([\w\.]+)*/i,/(chromium|flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs)\/([\w\.-]+)/i],[t,o],[/(trident).+rv[:\s]([\w\.]+).+like\sgecko/i],[[t,"IE"],o],[/(edge)\/((\d+)?[\w\.]+)/i],[t,o],[/(yabrowser)\/([\w\.]+)/i],[[t,"Yandex"],o],[/(comodo_dragon)\/([\w\.]+)/i],[[t,/_/g," "],o],[/((?:android.+)crmo|crios)\/([\w\.]+)/i,/android.+(chrome)\/([\w\.]+)\s+(?:mobile\s?safari)/i],[[t,"Chrome Mobile"],o],[/(chrome|omniweb|arora|[tizenoka]{5}\s?browser)\/v?([\w\.]+)/i,/(qqbrowser)[\/\s]?([\w\.]+)/i],[t,o],[/(uc\s?browser)[\/\s]?([\w\.]+)/i,/ucweb.+(ucbrowser)[\/\s]?([\w\.]+)/i,/JUC.+(ucweb)[\/\s]?([\w\.]+)/i],[[t,"UCBrowser"],o],[/(dolfin)\/([\w\.]+)/i],[[t,"Dolphin"],o],[/XiaoMi\/MiuiBrowser\/([\w\.]+)/i],[o,[t,"MIUI Browser"]],[/android.+version\/([\w\.]+)\s+(?:mobile\s?safari|safari)/i],[o,[t,"Android Browser"]],[/FBAV\/([\w\.]+);/i],[o,[t,"Facebook"]],[/fxios\/([\w\.-]+)/i],[o,[t,"Firefox"]],[/version\/([\w\.]+).+?mobile\/\w+\s(safari)/i],[o,[t,"Mobile Safari"]],[/version\/([\w\.]+).+?(mobile\s?safari|safari)/i],[o,t],[/webkit.+?(mobile\s?safari|safari)(\/[\w\.]+)/i],[t,[o,m.str,y.browser.oldsafari.version]],[/(konqueror)\/([\w\.]+)/i,/(webkit|khtml)\/([\w\.]+)/i],[t,o],[/(blackberry)\\s?\/([\w\.]+)/i],[[t,"BlackBerry"],o],[/(navigator|netscape)\/([\w\.-]+)/i],[[t,"Netscape"],o],[/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo\sbrowser|minimo|conkeror)[\/\s]?([\w\.\+]+)/i,/(firefox|seamonkey|k-meleon|icecat|iceape|firebird|phoenix)\/([\w\.-]+)/i,/(mozilla)\/([\w\.]+).+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir)[\/\s]?([\w\.]+)/i,/(links)\s\(([\w\.]+)/i,/(gobrowser)\/?([\w\.]+)*/i,/(ice\s?browser)\/v?([\w\._]+)/i,/(mosaic)[\/\s]([\w\.]+)/i],[t,o]],cpu:[[/(?:(amd|x(?:(?:86|64)[_-])?|wow|win)64)[;\)]/i],[[s,"amd64"]],[/(ia32(?=;))/i],[[s,g.lowerize]],[/((?:i[346]|x)86)[;\)]/i],[[s,"ia32"]],[/windows\s(ce|mobile);\sppc;/i],[[s,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?:\smac|;|\))/i],[[s,/ower/,"",g.lowerize]],[/(sun4\w)[;\)]/i],[[s,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|arm(?:64|(?=v\d+;))|(?=atmel\s)avr|(?:irix|mips|sparc)(?:64)?(?=;)|pa-risc)/i],[[s,g.lowerize]]],device:[[/\((ipad|playbook);[\w\s\);-]+(rim|apple)/i],[e,i,[n,p]],[/applecoremedia\/[\w\.]+ \((ipad)/],[e,[i,"Apple"],[n,p]],[/(apple\s{0,1}tv)/i],[[e,"Apple TV"],[i,"Apple"]],[/(archos)\s(gamepad2?)/i,/(hp).+(touchpad)/i,/(kindle)\/([\w\.]+)/i,/\s(nook)[\w\s]+build\/(\w+)/i,/(dell)\s(strea[kpr\s\d]*[\dko])/i],[i,e,[n,p]],[/(kf[A-z]+)\sbuild\/[\w\.]+.*silk\//i],[e,[i,"Amazon"],[n,p]],[/(sd|kf)[0349hijorstuw]+\sbuild\/[\w\.]+.*silk\//i],[[e,m.str,y.device.amazon.model],[i,"Amazon"],[n,u]],[/\((ip[honed|\s\w*]+);.+(apple)/i],[e,i,[n,u]],[/\((ip[honed|\s\w*]+);/i],[e,[i,"Apple"],[n,u]],[/(blackberry)[\s-]?(\w+)/i,/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|huawei|meizu|motorola|polytron)[\s_-]?([\w-]+)*/i,/(hp)\s([\w\s]+\w)/i,/(asus)-?(\w+)/i],[i,e,[n,u]],[/\(bb10;\s(\w+)/i],[e,[i,"BlackBerry"],[n,u]],[/android.+(transfo[prime\s]{4,10}\s\w+|eeepc|slider\s\w+|nexus 7)/i],[e,[i,"Asus"],[n,p]],[/(sony)\s(tablet\s[ps])\sbuild\//i,/(sony)?(?:sgp.+)\sbuild\//i],[[i,"Sony"],[e,"Xperia Tablet"],[n,p]],[/(?:sony)?(?:(?:(?:c|d)\d{4})|(?:so[-l].+))\sbuild\//i],[[i,"Sony"],[e,"Xperia Phone"],[n,u]],[/\s(ouya)\s/i,/(nintendo)\s([wids3u]+)/i],[i,e,[n,a]],[/android.+;\s(shield)\sbuild/i],[e,[i,"Nvidia"],[n,a]],[/(playstation\s[34portablevi]+)/i],[e,[i,"Sony"],[n,a]],[/(sprint\s(\w+))/i],[[i,m.str,y.device.sprint.vendor],[e,m.str,y.device.sprint.model],[n,u]],[/(lenovo)\s?(S(?:5000|6000)+(?:[-][\w+]))/i],[i,e,[n,p]],[/(htc)[;_\s-]+([\w\s]+(?=\))|\w+)*/i,/(zte)-(\w+)*/i,/(alcatel|geeksphone|huawei|lenovo|nexian|panasonic|(?=;\s)sony)[_\s-]?([\w-]+)*/i],[i,[e,/_/g," "],[n,u]],[/(nexus\s9)/i],[e,[i,"HTC"],[n,p]],[/[\s\(;](xbox(?:\sone)?)[\s\);]/i],[e,[i,"Microsoft"],[n,a]],[/(kin\.[onetw]{3})/i],[[e,/\./g," "],[i,"Microsoft"],[n,u]],[/\s(milestone|droid(?:[2-4x]|\s(?:bionic|x2|pro|razr))?(:?\s4g)?)[\w\s]+build\//i,/mot[\s-]?(\w+)*/i,/(XT\d{3,4}) build\//i,/(nexus\s[6])/i],[e,[i,"Motorola"],[n,u]],[/android.+\s(mz60\d|xoom[\s2]{0,2})\sbuild\//i],[e,[i,"Motorola"],[n,p]],[/android.+((sch-i[89]0\d|shw-m380s|gt-p\d{4}|gt-n8000|sgh-t8[56]9|nexus 10))/i,/((SM-T\w+))/i],[[i,"Samsung"],e,[n,p]],[/((s[cgp]h-\w+|gt-\w+|galaxy\snexus|sm-n900))/i,/(sam[sung]*)[\s-]*(\w+-?[\w-]*)*/i,/sec-((sgh\w+))/i],[[i,"Samsung"],e,[n,u]],[/(samsung);smarttv/i],[i,e,[n,c]],[/\(dtv[\);].+(aquos)/i],[e,[i,"Sharp"],[n,c]],[/sie-(\w+)*/i],[e,[i,"Siemens"],[n,u]],[/(maemo|nokia).*(n900|lumia\s\d+)/i,/(nokia)[\s_-]?([\w-]+)*/i],[[i,"Nokia"],e,[n,u]],[/android\s3\.[\s\w;-]{10}(a\d{3})/i],[e,[i,"Acer"],[n,p]],[/android\s3\.[\s\w;-]{10}(lg?)-([06cv9]{3,4})/i],[[i,"LG"],e,[n,p]],[/(lg) netcast\.tv/i],[i,e,[n,c]],[/(nexus\s[45])/i,/lg[e;\s\/-]+(\w+)*/i],[e,[i,"LG"],[n,u]],[/android.+(ideatab[a-z0-9\-\s]+)/i],[e,[i,"Lenovo"],[n,p]],[/linux;.+((jolla));/i],[i,e,[n,u]],[/((pebble))app\/[\d\.]+\s/i],[i,e,[n,v]],[/android.+;\s(glass)\s\d/i],[e,[i,"Google"],[n,v]],[/android.+(\w+)\s+build\/hm\1/i,/android.+(hm[\s\-_]*note?[\s_]*(?:\d\w)?)\s+build/i,/android.+(mi[\s\-_]*(?:one|one[\s_]plus)?[\s_]*(?:\d\w)?)\s+build/i],[[e,/_/g," "],[i,"Xiaomi"],[n,u]],[/\s(tablet)[;\/\s]/i,/\s(mobile)[;\/\s]/i],[[n,g.lowerize],i,e]],engine:[[/windows.+\sedge\/([\w\.]+)/i],[o,[t,"EdgeHTML"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m)\/([\w\.]+)/i,/(khtml|tasman|links)[\/\s]\(?([\w\.]+)/i,/(icab)[\/\s]([23]\.[\d\.]+)/i],[t,o],[/rv\:([\w\.]+).*(gecko)/i],[o,t]],os:[[/microsoft\s(windows)\s(vista|xp)/i],[t,o],[/(windows)\snt\s6\.2;\s(arm)/i,/(windows\sphone(?:\sos)*|windows\smobile|windows)[\s\/]?([ntce\d\.\s]+\w)/i],[[t,m.str,y.os.windows.name],[o,m.str,y.os.windows.version]],[/(win(?=3|9|n)|win\s9x\s)([nt\d\.]+)/i],[[t,"Windows"],[o,m.str,y.os.windows.version]],[/\((bb)(10);/i],[[t,"BlackBerry"],o],[/(blackberry)\w*\/?([\w\.]+)*/i,/(tizen)[\/\s]([\w\.]+)/i,/(android|webos|palm\sos|qnx|bada|rim\stablet\sos|meego|contiki)[\/\s-]?([\w\.]+)*/i,/linux;.+(sailfish);/i],[t,o],[/(symbian\s?o?s?|symbos|s60(?=;))[\/\s-]?([\w\.]+)*/i],[[t,"Symbian"],o],[/\((series40);/i],[t],[/mozilla.+\(mobile;.+gecko.+firefox/i],[[t,"Firefox OS"],o],[/(nintendo|playstation)\s([wids34portablevu]+)/i,/(mint)[\/\s\(]?(\w+)*/i,/(mageia|vectorlinux)[;\s]/i,/(joli|[kxln]?ubuntu|debian|[open]*suse|gentoo|(?=\s)arch|slackware|fedora|mandriva|centos|pclinuxos|redhat|zenwalk|linpus)[\/\s-]?([\w\.-]+)*/i,/(hurd|linux)\s?([\w\.]+)*/i,/(gnu)\s?([\w\.]+)*/i],[[t,"Linux"],o],[/(cros)\s[\w]+\s([\w\.]+\w)/i],[[t,"Chromium OS"],o],[/(sunos)\s?([\w\.]+\d)*/i],[[t,"Solaris"],o],[/\s([frentopc-]{0,4}bsd|dragonfly)\s?([\w\.]+)*/i],[[t,"Linux"],o],[/(iphone)(?:.*os\s*([\w]+)*\slike\smac|;\sopera)/i],[[t,"iPhone"],[o,/_/g,"."]],[/(ipad)(?:.*os\s*([\w]+)*\slike\smac|;\sopera)/i],[[t,"iPad"],[o,/_/g,"."]],[/(ip[honead]+)(?:.*os\s([\w]+)*\slike\smac|;\sopera)/i],[[t,"iOS"],[o,/_/g,"."]],[/(mac\sos\sx)\s?([\w\s\.]+\w)*/i,/(macintosh|mac(?=_powerpc)\s)/i],[[t,"Mac"],[o,/_/g,"."]],[/((?:open)?solaris)[\/\s-]?([\w\.]+)*/i,/(haiku)\s(\w+)/i,/(aix)\s((\d)(?=\.|\)|\s)[\w\.]*)*/i,/(plan\s9|minix|beos|os\/2|amigaos|morphos|risc\sos|openvms)/i,/(unix)\s?([\w\.]+)*/i],[t,o]]},w=function(e,t){if(!(this instanceof w))return new w(e,t).getResult();var n=e||(r&&r.navigator&&r.navigator.userAgent?r.navigator.userAgent:""),i=t?g.extend(_,t):_;return this.getBrowser=function(){var e=m.rgx.apply(this,i.browser);return e.major=g.major(e.version),e},this.getCPU=function(){return m.rgx.apply(this,i.cpu)},this.getDevice=function(){return m.rgx.apply(this,i.device)},this.getEngine=function(){return m.rgx.apply(this,i.engine)},this.getOS=function(){return m.rgx.apply(this,i.os)},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return n},this.setUA=function(e){return n=e,this},this};w.VERSION="0.7.10",w.BROWSER={NAME:t,MAJOR:"major",VERSION:o},w.CPU={ARCHITECTURE:s},w.DEVICE={MODEL:e,VENDOR:i,TYPE:n,CONSOLE:a,MOBILE:u,SMARTTV:c,TABLET:p,WEARABLE:v,EMBEDDED:"embedded"},w.ENGINE={NAME:t,VERSION:o},w.OS={NAME:t,VERSION:o},S.exports&&(O=S.exports=w),O.UAParser=w;var b=r.jQuery||r.Zepto;if(typeof b!==f){var I=new w;b.ua=I.getResult(),b.ua.get=function(){return I.getUA()},b.ua.set=function(e){I.setUA(e);var t=I.getResult();for(var n in t)b.ua[n]=t[n]}}}("object"==typeof window?window:e)}),Ie=function e(t){return t?(t^16*Math.random()>>t/4).toString(16):([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,e)},Se="4.6.0-beta.1",Oe={apiEndpoint:"api.amplitude.com",batchEvents:!1,cookieExpiration:3650,cookieName:"amplitude_id",deviceIdFromUrlParam:!1,domain:"",eventUploadPeriodMillis:3e4,eventUploadThreshold:30,forceHttps:!0,includeGclid:!1,includeReferrer:!1,includeUtm:!1,language:{language:navigator&&(navigator.languages&&navigator.languages[0]||navigator.language||navigator.userLanguage)||void 0}.language,logLevel:"WARN",optOut:!1,platform:"Web",savedMaxCount:1e3,saveEvents:!0,saveParamsReferrerOncePerSession:!0,sessionTimeout:18e5,trackingOptions:{city:!0,country:!0,device_model:!0,dma:!0,ip_address:!0,language:!0,os_name:!0,os_version:!0,platform:!0,region:!0,version_name:!0},unsetParamsReferrerOnNewSession:!1,unsentKey:"amplitude_unsent",unsentIdentifyKey:"amplitude_unsent_identify",uploadBatchSize:100},Ee=function(e){this._instanceName=F(e)?l:e.toLowerCase(),this._legacyStorageSuffix=this._instanceName===l?"":"_"+this._instanceName,this._unsentEvents=[],this._unsentIdentifys=[],this._ua=new be(navigator.userAgent).getResult(),this.options=babelHelpers.extends({},Oe,{trackingOptions:babelHelpers.extends({},Oe.trackingOptions)}),this.cookieStorage=(new se).getStorage(),this._q=[],this._sending=!1,this._updateScheduled=!1,this._eventId=0,this._identifyId=0,this._lastEventTime=null,this._newSession=!1,this._sequenceNumber=0,this._sessionId=null,this._userAgent=navigator&&navigator.userAgent||null};Ee.prototype.Identify=ue,Ee.prototype.Revenue=we,Ee.prototype.init=function(e,t,n,i){if("string"!==R(e)||F(e))W.error("Invalid apiKey. Please re-initialize with a valid apiKey");else try{this.options.apiKey=e,this._storageSuffix="_"+e+this._legacyStorageSuffix,xe(this.options,n),"string"===R(this.options.logLevel)&&L(this.options.logLevel);var r=qe(this);if(this._apiPropertiesTrackingOptions=0<Object.keys(r).length?{tracking_options:r}:{},this.cookieStorage.options({expirationDays:this.options.cookieExpiration,domain:this.options.domain}),this.options.domain=this.cookieStorage.options().domain,this._instanceName===l&&Ne(this),ke(this),this.options.deviceId="object"===R(n)&&"string"===R(n.deviceId)&&!F(n.deviceId)&&n.deviceId||this.options.deviceIdFromUrlParam&&this._getDeviceIdFromUrlParam(this._getUrlParams())||this.options.deviceId||Ie()+"R",this.options.userId="string"===R(t)&&!F(t)&&t||"number"===R(t)&&t.toString()||this.options.userId||null,this.options.saveEvents){this._unsentEvents=this._loadSavedUnsentEvents(this.options.unsentKey),this._unsentIdentifys=this._loadSavedUnsentEvents(this.options.unsentIdentifyKey);for(var o=0;o<this._unsentEvents.length;o++){var s=this._unsentEvents[o].event_properties,a=this._unsentEvents[o].groups;this._unsentEvents[o].event_properties=J(s),this._unsentEvents[o].groups=$(a)}for(var u=0;u<this._unsentIdentifys.length;u++){var p=this._unsentIdentifys[u].user_properties,c=this._unsentIdentifys[u].groups;this._unsentIdentifys[u].user_properties=J(p),this._unsentIdentifys[u].groups=$(c)}}var d=(new Date).getTime();(!this._sessionId||!this._lastEventTime||d-this._lastEventTime>this.options.sessionTimeout)&&(this.options.unsetParamsReferrerOnNewSession&&this._unsetUTMParams(),this._newSession=!0,this._sessionId=d,this.options.saveParamsReferrerOncePerSession&&this._trackParamsAndReferrer()),this.options.saveParamsReferrerOncePerSession||this._trackParamsAndReferrer(),this._lastEventTime=d,Te(this),this._sendEventsIfReady()}catch(e){W.error(e)}finally{"function"===R(i)&&i(this)}},Ee.prototype._trackParamsAndReferrer=function(){this.options.includeUtm&&this._initUtmData(),this.options.includeReferrer&&this._saveReferrer(this._getReferrer()),this.options.includeGclid&&this._saveGclid(this._getUrlParams())};var xe=function i(r,o){if("object"===R(o)){var e=function(e){if(r.hasOwnProperty(e)){var t=o[e],n=R(r[e]);H(t,e+" option",n)&&("boolean"===n?r[e]=!!t:"string"===n&&!F(t)||"number"===n&&0<t?r[e]=t:"object"===n&&i(r[e],t))}};for(var t in o)o.hasOwnProperty(t)&&e(t)}};Ee.prototype.runQueuedFunctions=function(){for(var e=0;e<this._q.length;e++){var t=this[this._q[e][0]];"function"===R(t)&&t.apply(this,this._q[e].slice(1))}this._q=[]},Ee.prototype._apiKeySet=function(e){return!F(this.options.apiKey)||(W.error("Invalid apiKey. Please set a valid apiKey with init() before calling "+e),!1)},Ee.prototype._loadSavedUnsentEvents=function(e){var t=this._getFromStorage(oe,e),n=this._parseSavedUnsentEventsString(t,e),i=this._getFromStorageLegacy(oe,e),r=this._parseSavedUnsentEventsString(i,e).concat(n);return this._removeFromLegacyStorage(oe,e),this._setInStorage(oe,e,JSON.stringify(r)),r},Ee.prototype._removeFromLegacyStorage=function(e,t){e.removeItem(t+this._legacyStorageSuffix)},Ee.prototype._parseSavedUnsentEventsString=function(e,t){if(F(e))return[];if("string"===R(e))try{var n=JSON.parse(e);if("array"===R(n))return n}catch(e){}return W.error("Unable to load "+t+" events. Restart with a new empty queue."),[]},Ee.prototype.isNewSession=function(){return this._newSession},Ee.prototype.getSessionId=function(){return this._sessionId},Ee.prototype.nextEventId=function(){return this._eventId++,this._eventId},Ee.prototype.nextIdentifyId=function(){return this._identifyId++,this._identifyId},Ee.prototype.nextSequenceNumber=function(){return this._sequenceNumber++,this._sequenceNumber},Ee.prototype._unsentCount=function(){return this._unsentEvents.length+this._unsentIdentifys.length},Ee.prototype._sendEventsIfReady=function(e){return 0!==this._unsentCount()&&(this.options.batchEvents?this._unsentCount()>=this.options.eventUploadThreshold?(this.sendEvents(e),!0):(this._updateScheduled||(this._updateScheduled=!0,setTimeout(function(){this._updateScheduled=!1,this.sendEvents()}.bind(this),this.options.eventUploadPeriodMillis)),!1):(this.sendEvents(e),!0))},Ee.prototype._getFromStorage=function(e,t){return e.getItem(t+this._storageSuffix)},Ee.prototype._getFromStorageLegacy=function(e,t){return e.getItem(t+this._legacyStorageSuffix)},Ee.prototype._setInStorage=function(e,t,n){e.setItem(t+this._storageSuffix,n)};var Ne=function(e){var t=e.cookieStorage.get(e.options.cookieName+e._storageSuffix);if("object"!==R(t)&&(t=e.cookieStorage.get(e.options.cookieName+e._legacyStorageSuffix),!("object"===R(t)&&t.deviceId&&t.sessionId&&t.lastEventTime))){var n=function(e){var t=oe.getItem(e);return oe.removeItem(e),t},i="string"===R(e.options.apiKey)&&"_"+e.options.apiKey.slice(0,6)||"",r=n(w+i),o=n(I+i),s=n(b+i);null!=s&&(s="true"===String(s));var a=parseInt(n(_)),u=parseInt(n(g)),p=parseInt(n(v)),c=parseInt(n(m)),d=parseInt(n(y)),l=function(e){return"object"===R(t)&&t[e]};e.options.deviceId=l("deviceId")||r,e.options.userId=l("userId")||o,e._sessionId=l("sessionId")||a||e._sessionId,e._lastEventTime=l("lastEventTime")||u||e._lastEventTime,e._eventId=l("eventId")||p||e._eventId,e._identifyId=l("identifyId")||c||e._identifyId,e._sequenceNumber=l("sequenceNumber")||d||e._sequenceNumber,e.options.optOut=s||!1,t&&void 0!==t.optOut&&null!==t.optOut&&(e.options.optOut="true"===String(t.optOut)),Te(e)}},ke=function(e){var t=e.cookieStorage.get(e.options.cookieName+e._storageSuffix);if("object"===R(t))Ae(e,t);else{var n=e.cookieStorage.get(e.options.cookieName+e._legacyStorageSuffix);"object"===R(n)&&(e.cookieStorage.remove(e.options.cookieName+e._legacyStorageSuffix),Ae(e,n))}},Ae=function(e,t){t.deviceId&&(e.options.deviceId=t.deviceId),t.userId&&(e.options.userId=t.userId),null!==t.optOut&&void 0!==t.optOut&&(e.options.optOut=t.optOut),t.sessionId&&(e._sessionId=parseInt(t.sessionId)),t.lastEventTime&&(e._lastEventTime=parseInt(t.lastEventTime)),t.eventId&&(e._eventId=parseInt(t.eventId)),t.identifyId&&(e._identifyId=parseInt(t.identifyId)),t.sequenceNumber&&(e._sequenceNumber=parseInt(t.sequenceNumber))},Te=function(e){e.cookieStorage.set(e.options.cookieName+e._storageSuffix,{deviceId:e.options.deviceId,userId:e.options.userId,optOut:e.options.optOut,sessionId:e._sessionId,lastEventTime:e._lastEventTime,eventId:e._eventId,identifyId:e._identifyId,sequenceNumber:e._sequenceNumber})};Ee.prototype._initUtmData=function(e,t){e=e||this._getUrlParams(),t=t||this.cookieStorage.get("__utmz");var n,i,r,o,s,a,u,p,c,d,l,f=(i=e,r=(n=t)?"?"+n.split(".").slice(-1)[0].replace(/\|/g,"&"):"",s=(o=function(e,t,n,i){return G(e,t)||G(n,i)})(S,i,"utmcsr",r),a=o(O,i,"utmcmd",r),u=o(E,i,"utmccn",r),p=o(x,i,"utmctr",r),c=o(N,i,"utmcct",r),d={},(l=function(e,t){F(t)||(d[e]=t)})(S,s),l(O,a),l(E,u),l(x,p),l(N,c),d);Pe(this,f)},Ee.prototype._unsetUTMParams=function(){var e=new ue;e.unset(d),e.unset(S),e.unset(O),e.unset(E),e.unset(x),e.unset(N),this.identify(e)};var Pe=function(e,t){if("object"===R(t)&&0!==Object.keys(t).length){var n=new ue;for(var i in t)t.hasOwnProperty(i)&&(n.setOnce("initial_"+i,t[i]),n.set(i,t[i]));e.identify(n)}};Ee.prototype._getReferrer=function(){return document.referrer},Ee.prototype._getUrlParams=function(){return location.search},Ee.prototype._saveGclid=function(e){var t=G("gclid",e);F(t)||Pe(this,{gclid:t})},Ee.prototype._getDeviceIdFromUrlParam=function(e){return G(p,e)},Ee.prototype._getReferringDomain=function(e){if(F(e))return null;var t=e.split("/");return 3<=t.length?t[2]:null},Ee.prototype._saveReferrer=function(e){if(!F(e)){var t={referrer:e,referring_domain:this._getReferringDomain(e)};Pe(this,t)}},Ee.prototype.saveEvents=function(){try{this._setInStorage(oe,this.options.unsentKey,JSON.stringify(this._unsentEvents))}catch(e){}try{this._setInStorage(oe,this.options.unsentIdentifyKey,JSON.stringify(this._unsentIdentifys))}catch(e){}},Ee.prototype.setDomain=function(e){if(H(e,"domain","string"))try{this.cookieStorage.options({domain:e}),this.options.domain=this.cookieStorage.options().domain,ke(this),Te(this)}catch(e){W.error(e)}},Ee.prototype.setUserId=function(e){try{this.options.userId=null!=e&&""+e||null,Te(this)}catch(e){W.error(e)}},Ee.prototype.setGroup=function(e,t){if(this._apiKeySet("setGroup()")&&H(e,"groupType","string")&&!F(e)){var n={};n[e]=t;var i=(new ue).set(e,t);this._logEvent(f,null,null,i.userPropertiesOperations,n,null,null,null)}},Ee.prototype.setOptOut=function(e){if(H(e,"enable","boolean"))try{this.options.optOut=e,Te(this)}catch(e){W.error(e)}},Ee.prototype.setSessionId=function(e){if(H(e,"sessionId","number"))try{this._sessionId=e,Te(this)}catch(e){W.error(e)}},Ee.prototype.resetSessionId=function(){this.setSessionId((new Date).getTime())},Ee.prototype.regenerateDeviceId=function(){this.setDeviceId(Ie()+"R")},Ee.prototype.setDeviceId=function(e){if(H(e,"deviceId","string"))try{F(e)||(this.options.deviceId=""+e,Te(this))}catch(e){W.error(e)}},Ee.prototype.setUserProperties=function(e){if(this._apiKeySet("setUserProperties()")&&H(e,"userProperties","object")){var t=V(J(e));if(0!==Object.keys(t).length){var n=new ue;for(var i in t)t.hasOwnProperty(i)&&n.set(i,t[i]);this.identify(n)}}},Ee.prototype.clearUserProperties=function(){if(this._apiKeySet("clearUserProperties()")){var e=new ue;e.clearAll(),this.identify(e)}};var Re=function(e,t){for(var n=0;n<t._q.length;n++){var i=e[t._q[n][0]];"function"===R(i)&&i.apply(e,t._q[n].slice(1))}return e};Ee.prototype.identify=function(e,t){if(this._apiKeySet("identify()"))if("object"===R(e)&&e.hasOwnProperty("_q")&&(e=Re(new ue,e)),e instanceof ue){if(0<Object.keys(e.userPropertiesOperations).length)return this._logEvent(f,null,null,e.userPropertiesOperations,null,null,null,t);"function"===R(t)&&t(0,"No request sent",{reason:"No user property operations"})}else W.error("Invalid identify input type. Expected Identify object but saw "+R(e)),"function"===R(t)&&t(0,"No request sent",{reason:"Invalid identify input type"});else"function"===R(t)&&t(0,"No request sent",{reason:"API key is not set"})},Ee.prototype.groupIdentify=function(e,t,n,i){if(this._apiKeySet("groupIdentify()"))if(H(e,"group_type","string")&&!F(e))if(null!=t)if("object"===R(n)&&n.hasOwnProperty("_q")&&(n=Re(new ue,n)),n instanceof ue){if(0<Object.keys(n.userPropertiesOperations).length)return this._logEvent(h,null,null,null,babelHelpers.defineProperty({},e,t),n.userPropertiesOperations,null,i);"function"===R(i)&&i(0,"No request sent",{reason:"No group property operations"})}else W.error("Invalid identify input type. Expected Identify object but saw "+R(n)),"function"===R(i)&&i(0,"No request sent",{reason:"Invalid identify input type"});else"function"===R(i)&&i(0,"No request sent",{reason:"Invalid group name"});else"function"===R(i)&&i(0,"No request sent",{reason:"Invalid group type"});else"function"===R(i)&&i(0,"No request sent",{reason:"API key is not set"})},Ee.prototype.setVersionName=function(e){H(e,"versionName","string")&&(this.options.versionName=e)},Ee.prototype._logEvent=function(e,t,n,i,r,o,s,a){if(ke(this),e)if(this.options.optOut)"function"===R(a)&&a(0,"No request sent",{reason:"optOut is set to true"});else try{var u;u=e===f||e===h?this.nextIdentifyId():this.nextEventId();var p=this.nextSequenceNumber(),c="number"===R(s)?s:(new Date).getTime();(!this._sessionId||!this._lastEventTime||c-this._lastEventTime>this.options.sessionTimeout)&&(this._sessionId=c),this._lastEventTime=c,Te(this),i=i||{};var d=babelHelpers.extends({},this._apiPropertiesTrackingOptions);n=babelHelpers.extends({},n||{},d),t=t||{},r=r||{},o=o||{};var l={device_id:this.options.deviceId,user_id:this.options.userId,timestamp:c,event_id:u,session_id:this._sessionId||-1,event_type:e,version_name:je(this,"version_name")&&this.options.versionName||null,platform:je(this,"platform")?this.options.platform:null,os_name:je(this,"os_name")&&this._ua.browser.name||null,os_version:je(this,"os_version")&&this._ua.browser.major||null,device_model:je(this,"device_model")&&this._ua.os.name||null,language:je(this,"language")?this.options.language:null,api_properties:n,event_properties:V(J(t)),user_properties:V(J(i)),uuid:Ie(),library:{name:"amplitude-js",version:Se},sequence_number:p,groups:V($(r)),group_properties:V(J(o)),user_agent:this._userAgent};return e===f||e===h?(this._unsentIdentifys.push(l),this._limitEventsQueued(this._unsentIdentifys)):(this._unsentEvents.push(l),this._limitEventsQueued(this._unsentEvents)),this.options.saveEvents&&this.saveEvents(),this._sendEventsIfReady(a)||"function"!==R(a)||a(0,"No request sent",{reason:"No events to send or upload queued"}),u}catch(e){W.error(e)}else"function"===R(a)&&a(0,"No request sent",{reason:"Missing eventType"})};var je=function(e,t){return!!e.options.trackingOptions[t]},qe=function(e){for(var t=["city","country","dma","ip_address","region"],n={},i=0;i<t.length;i++){var r=t[i];je(e,r)||(n[r]=!1)}return n};Ee.prototype._limitEventsQueued=function(e){e.length>this.options.savedMaxCount&&e.splice(0,e.length-this.options.savedMaxCount)},Ee.prototype.logEvent=function(e,t,n){return this.logEventWithTimestamp(e,t,null,n)},Ee.prototype.logEventWithTimestamp=function(e,t,n,i){return this._apiKeySet("logEvent()")?H(e,"eventType","string")?F(e)?("function"===R(i)&&i(0,"No request sent",{reason:"Missing eventType"}),-1):this._logEvent(e,t,null,null,null,null,n,i):("function"===R(i)&&i(0,"No request sent",{reason:"Invalid type for eventType"}),-1):("function"===R(i)&&i(0,"No request sent",{reason:"API key not set"}),-1)},Ee.prototype.logEventWithGroups=function(e,t,n,i){return this._apiKeySet("logEventWithGroups()")?H(e,"eventType","string")?this._logEvent(e,t,null,null,n,null,null,i):("function"===R(i)&&i(0,"No request sent",{reason:"Invalid type for eventType"}),-1):("function"===R(i)&&i(0,"No request sent",{reason:"API key not set"}),-1)},Ee.prototype.logRevenueV2=function(e){if(this._apiKeySet("logRevenueV2()"))if("object"===R(e)&&e.hasOwnProperty("_q")&&(e=Re(new we,e)),e instanceof we){if(e&&e._isValidRevenue())return this.logEvent(i,e._toJSONObject())}else W.error("Invalid revenue input type. Expected Revenue object but saw "+R(e))},Ee.prototype.removeEvents=function(e,t){Ce(this,"_unsentEvents",e),Ce(this,"_unsentIdentifys",t)};var Ce=function(e,t,n){if(!(n<0)){for(var i=[],r=0;r<e[t].length;r++)e[t][r].event_id>n&&i.push(e[t][r]);e[t]=i}};Ee.prototype.sendEvents=function(n){if(this._apiKeySet("sendEvents()"))if(this.options.optOut)"function"===R(n)&&n(0,"No request sent",{reason:"optOut is set to true"});else if(0!==this._unsentCount())if(this._sending)"function"===R(n)&&n(0,"No request sent",{reason:"Request already in progress"});else{this._sending=!0;var e=(this.options.forceHttps?"https":"https:"===window.location.protocol?"https":"http")+"://"+this.options.apiEndpoint+"/",i=Math.min(this._unsentCount(),this.options.uploadBatchSize),t=this._mergeEventsAndIdentifys(i),r=t.maxEventId,o=t.maxIdentifyId,s=JSON.stringify(t.eventsToSend),a=(new Date).getTime(),u={client:this.options.apiKey,e:s,v:c,upload_time:a,checksum:ce(c+this.options.apiKey+s+a)},p=this;new _e(e,u).send(function(e,t){p._sending=!1;try{200===e&&"success"===t?(p.removeEvents(r,o),p.options.saveEvents&&p.saveEvents(),p._sendEventsIfReady(n)||"function"!==R(n)||n(e,t)):413===e?(1===p.options.uploadBatchSize&&p.removeEvents(r,o),p.options.uploadBatchSize=Math.ceil(i/2),p.sendEvents(n)):"function"===R(n)&&n(e,t)}catch(e){}})}else"function"===R(n)&&n(0,"No request sent",{reason:"No events to send"});else"function"===R(n)&&n(0,"No request sent",{reason:"API key not set"})},Ee.prototype._mergeEventsAndIdentifys=function(e){for(var t=[],n=0,i=-1,r=0,o=-1;t.length<e;){var s,a=r>=this._unsentIdentifys.length,u=n>=this._unsentEvents.length;if(u&&a){W.error("Merging Events and Identifys, less events and identifys than expected");break}a?i=(s=this._unsentEvents[n++]).event_id:u?o=(s=this._unsentIdentifys[r++]).event_id:!("sequence_number"in this._unsentEvents[n])||this._unsentEvents[n].sequence_number<this._unsentIdentifys[r].sequence_number?i=(s=this._unsentEvents[n++]).event_id:o=(s=this._unsentIdentifys[r++]).event_id,t.push(s)}return{eventsToSend:t,maxEventId:i,maxIdentifyId:o}},Ee.prototype.__VERSION__=Se;var Ue=function(){this.options=babelHelpers.extends({},Oe),this._q=[],this._instances={}};Ue.prototype.Identify=ue,Ue.prototype.Revenue=we,Ue.prototype.getInstance=function(e){e=F(e)?l:e.toLowerCase();var t=this._instances[e];return void 0===t&&(t=new Ee(e),this._instances[e]=t),t},Ue.prototype.__VERSION__=Se;var Me=window.amplitude||{},De=new Ue;for(var ze in De._q=Me._q||[],Me._iq)Me._iq.hasOwnProperty(ze)&&(De.getInstance(ze)._q=Me._iq[ze]._q||[]);return De});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.amplitude=t()}(this,function(){"use strict";var l="$default_instance",c=2,t=4096,a=1e3,f="$identify",h="$groupidentify",v="amplitude_lastEventId",g="amplitude_lastEventTime",y="amplitude_lastIdentifyId",m="amplitude_lastSequenceNumber",_="amplitude_sessionId",w="amplitude_deviceId",b="amplitude_optOut",I="amplitude_userId",n="amplitude_cookie_test",i="revenue_amount",r="$productId",o="$quantity",s="$price",u="$revenueType",p="amp_device_id",d="referrer",S="utm_source",O="utm_medium",E="utm_campaign",N="utm_term",x="utm_content",k=function(e){for(var t="",n=0;n<e.length;n++){var i=e.charCodeAt(n);i<128?t+=String.fromCharCode(i):(127<i&&i<2048?t+=String.fromCharCode(i>>6|192):(t+=String.fromCharCode(i>>12|224),t+=String.fromCharCode(i>>6&63|128)),t+=String.fromCharCode(63&i|128))}return t},A=function(e){for(var t="",n=0,i=0,r=0,o=0;n<e.length;)(i=e.charCodeAt(n))<128?(t+=String.fromCharCode(i),n++):191<i&&i<224?(r=e.charCodeAt(n+1),t+=String.fromCharCode((31&i)<<6|63&r),n+=2):(r=e.charCodeAt(n+1),o=e.charCodeAt(n+2),t+=String.fromCharCode((15&i)<<12|(63&r)<<6|63&o),n+=3);return t},P={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(e){try{if(window.btoa&&window.atob)return window.btoa(unescape(encodeURIComponent(e)))}catch(e){}return P._encode(e)},_encode:function(e){var t,n,i,r,o,s,a,u="",p=0;for(e=k(e);p<e.length;)r=(t=e.charCodeAt(p++))>>2,o=(3&t)<<4|(n=e.charCodeAt(p++))>>4,s=(15&n)<<2|(i=e.charCodeAt(p++))>>6,a=63&i,isNaN(n)?s=a=64:isNaN(i)&&(a=64),u=u+P._keyStr.charAt(r)+P._keyStr.charAt(o)+P._keyStr.charAt(s)+P._keyStr.charAt(a);return u},decode:function(e){try{if(window.btoa&&window.atob)return decodeURIComponent(escape(window.atob(e)))}catch(e){}return P._decode(e)},_decode:function(e){var t,n,i,r,o,s,a="",u=0;for(e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");u<e.length;)t=P._keyStr.indexOf(e.charAt(u++))<<2|(r=P._keyStr.indexOf(e.charAt(u++)))>>4,n=(15&r)<<4|(o=P._keyStr.indexOf(e.charAt(u++)))>>2,i=(3&o)<<6|(s=P._keyStr.indexOf(e.charAt(u++))),a+=String.fromCharCode(t),64!==o&&(a+=String.fromCharCode(n)),64!==s&&(a+=String.fromCharCode(i));return a=A(a)}},T="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},R=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},j=Object.prototype.toString;function q(e){switch(j.call(e)){case"[object Date]":return"date";case"[object RegExp]":return"regexp";case"[object Arguments]":return"arguments";case"[object Array]":return"array";case"[object Error]":return"error"}return null===e?"null":void 0===e?"undefined":e!=e?"nan":e&&1===e.nodeType?"element":"undefined"!=typeof Buffer&&"function"==typeof Buffer.isBuffer&&Buffer.isBuffer(e)?"buffer":void 0===(e=e.valueOf?e.valueOf():Object.prototype.valueOf.apply(e))?"undefined":T(e)}var C={DISABLE:0,ERROR:1,WARN:2,INFO:3},U=C.WARN,M={error:function(e){U>=C.ERROR&&D(e)},warn:function(e){U>=C.WARN&&D(e)},info:function(e){U>=C.INFO&&D(e)}},D=function(e){try{console.log("[Amplitude] "+e)}catch(e){}},z=function(e){return"string"===q(e)&&e.length>t?e.substring(0,t):e},B=function(e){var t=q(e);if("object"!==t)return M.error("Error: invalid properties format. Expecting Javascript object, received "+t+", ignoring"),{};if(Object.keys(e).length>a)return M.error("Error: too many properties (more than 1000), ignoring"),{};var n={};for(var i in e)if(e.hasOwnProperty(i)){var r=i,o=q(r);"string"!==o&&(r=String(r),M.warn("WARNING: Non-string property key, received type "+o+', coercing to string "'+r+'"'));var s=L(r,e[i]);null!==s&&(n[r]=s)}return n},K=["null","nan","undefined","function","arguments","regexp","element"],L=function e(t,n){var i=q(n);if(-1!==K.indexOf(i))M.warn('WARNING: Property key "'+t+'" with invalid value type '+i+", ignoring"),n=null;else if("error"===i)n=String(n),M.warn('WARNING: Property key "'+t+'" with value type error, coercing to '+n);else if("array"===i){for(var r=[],o=0;o<n.length;o++){var s=n[o],a=q(s);"array"!==a&&"object"!==a?r.push(e(t,s)):M.warn("WARNING: Cannot have "+a+" nested in an array property value, skipping")}n=r}else"object"===i&&(n=B(n));return n},W=function(e,t){var n=q(t);if("string"===n)return t;if("date"===n||"number"===n||"boolean"===n)return t=String(t),M.warn("WARNING: Non-string groupName, received type "+n+', coercing to string "'+t+'"'),t;if("array"===n){for(var i=[],r=0;r<t.length;r++){var o=t[r],s=q(o);"array"!==s&&"object"!==s?"string"===s?i.push(o):"date"!==s&&"number"!==s&&"boolean"!==s||(o=String(o),M.warn("WARNING: Non-string groupName, received type "+s+', coercing to string "'+o+'"'),i.push(o)):M.warn("WARNING: Skipping nested "+s+" in array groupName")}return i}M.warn("WARNING: Non-string groupName, received type "+n+". Please use strings or array of strings for groupName")},F=function(e){C.hasOwnProperty(e)&&(U=C[e])},G=M,V=function(e){return!e||0===e.length},$=function(e,t){e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var n=new RegExp("[\\?&]"+e+"=([^&#]*)").exec(t);return null===n?void 0:decodeURIComponent(n[1].replace(/\+/g," "))},J=function e(t){if("array"===q(t))for(var n=0;n<t.length;n++)t[n]=e(t[n]);else if("object"===q(t))for(var i in t)t.hasOwnProperty(i)&&(t[i]=e(t[i]));else t=z(t);return t},X=function(e){var t=q(e);if("object"!==t)return M.error("Error: invalid groups format. Expecting Javascript object, received "+t+", ignoring"),{};var n={};for(var i in e)if(e.hasOwnProperty(i)){var r=i,o=q(r);"string"!==o&&(r=String(r),M.warn("WARNING: Non-string groupType, received type "+o+', coercing to string "'+r+'"'));var s=W(r,e[i]);null!==s&&(n[r]=s)}return n},H=function(e,t,n){return q(e)===n||(M.error("Invalid "+t+" input type. Expected "+n+" but received "+q(e)),!1)},Q=B,Y=function(e,t,n){var i=null!==t?n.expirationDays:-1;if(i){var r=new Date;r.setTime(r.getTime()+24*i*60*60*1e3),i=r}var o=e+"="+t;i&&(o+="; expires="+i.toUTCString()),o+="; path=/",n.domain&&(o+="; domain="+n.domain),n.secure&&(o+="; Secure"),document.cookie=o},Z=function(e){try{for(var t=document.cookie.split(";"),n=null,i=0;i<t.length;i++){for(var r=t[i];" "===r.charAt(0);)r=r.substring(1,r.length);if(0===r.indexOf(e)){n=r.substring(e.length,r.length);break}}return n}catch(e){return null}},ee={expirationDays:void 0,domain:void 0},te=function(e){var t,n,i=(t=e,(n=document.createElement("a")).href=t,n.hostname||location.hostname).split("."),r=i[i.length-1],o=[];if(4===i.length&&r===parseInt(r,10))return o;if(i.length<=1)return o;for(var s=i.length-2;0<=s;--s)o.push(i.slice(s).join("."));for(var a=0;a<o.length;++a){var u="__tld_test__",p=o[a],c={domain:"."+p};if(Y(u,1,c),Z(u))return Y(u,null,c),p}return""},ne=function(e){var t="";return ee.domain&&(t="."===ee.domain.charAt(0)?ee.domain.substring(1):ee.domain),e+t},ie=function(e){var t=ne(e)+"=",n=Z(t);try{if(n)return JSON.parse(P.decode(n))}catch(e){return null}return null},re=function(e,t){try{return Y(ne(e),P.encode(JSON.stringify(t)),ee),!0}catch(e){return!1}},oe=function(e){try{return Y(ne(e),null,ee),!0}catch(e){return!1}},se={reset:function(){ee={expirationDays:void 0,domain:void 0}},options:function(e){if(0===arguments.length)return ee;e=e||{},ee.expirationDays=e.expirationDays,ee.secure=e.secure;var t=V(e.domain)?"."+te(window.location.href):e.domain,n=Math.random();ee.domain=t,re("amplitude_test",n);var i=ie("amplitude_test");return i&&i===n||(t=null),oe("amplitude_test"),ee.domain=t,ee},get:ie,set:re,remove:oe},ae=window.localStorage,ue=function(){this.storage=null};ue.prototype._cookiesEnabled=function(){var e,t=String(new Date);try{return se.set(n,t),e=se.get(n)===t,se.remove(n),e}catch(e){}return!1},ue.prototype.getStorage=function(){if(null!==this.storage)return this.storage;if(this._cookiesEnabled())this.storage=se;else{var n="amp_cookiestore_";this.storage={_options:{expirationDays:void 0,domain:void 0,secure:!1},reset:function(){this._options={expirationDays:void 0,domain:void 0,secure:!1}},options:function(e){return 0===arguments.length?this._options:(e=e||{},this._options.expirationDays=e.expirationDays||this._options.expirationDays,this._options.domain=e.domain||this._options.domain||window.location.hostname,this._options.secure=e.secure||!1)},get:function(e){try{return JSON.parse(ae.getItem(n+e))}catch(e){}return null},set:function(e,t){try{return ae.setItem(n+e,JSON.stringify(t)),!0}catch(e){}return!1},remove:function(e){try{ae.removeItem(n+e)}catch(e){return!1}}}}return this.storage};var pe="$clearAll",ce=function(){this.userPropertiesOperations={},this.properties=[]};ce.prototype.add=function(e,t){return"number"===q(t)||"string"===q(t)?this._addOperation("$add",e,t):G.error("Unsupported type for value: "+q(t)+", expecting number or string"),this},ce.prototype.append=function(e,t){return this._addOperation("$append",e,t),this},ce.prototype.clearAll=function(){return 0<Object.keys(this.userPropertiesOperations).length?this.userPropertiesOperations.hasOwnProperty(pe)||G.error("Need to send $clearAll on its own Identify object without any other operations, skipping $clearAll"):this.userPropertiesOperations[pe]="-",this},ce.prototype.prepend=function(e,t){return this._addOperation("$prepend",e,t),this},ce.prototype.set=function(e,t){return this._addOperation("$set",e,t),this},ce.prototype.setOnce=function(e,t){return this._addOperation("$setOnce",e,t),this},ce.prototype.unset=function(e){return this._addOperation("$unset",e,"-"),this},ce.prototype._addOperation=function(e,t,n){this.userPropertiesOperations.hasOwnProperty(pe)?G.error("This identify already contains a $clearAll operation, skipping operation "+e):-1===this.properties.indexOf(t)?(this.userPropertiesOperations.hasOwnProperty(e)||(this.userPropertiesOperations[e]={}),this.userPropertiesOperations[e][t]=n,this.properties.push(t)):G.error('User property "'+t+'" already used in this identify, skipping operation '+e)};var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function de(e,t){return e(t={exports:{}},t.exports),t.exports}var le=de(function(s){!function(e){function d(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function a(e,t,n,i,r,o){return d((s=d(d(t,e),d(i,o)))<<(a=r)|s>>>32-a,n);var s,a}function l(e,t,n,i,r,o,s){return a(t&n|~t&i,e,t,r,o,s)}function f(e,t,n,i,r,o,s){return a(t&i|n&~i,e,t,r,o,s)}function h(e,t,n,i,r,o,s){return a(t^n^i,e,t,r,o,s)}function v(e,t,n,i,r,o,s){return a(n^(t|~i),e,t,r,o,s)}function u(e,t){var n,i,r,o,s;e[t>>5]|=128<<t%32,e[14+(t+64>>>9<<4)]=t;var a=1732584193,u=-271733879,p=-1732584194,c=271733878;for(n=0;n<e.length;n+=16)u=v(u=v(u=v(u=v(u=h(u=h(u=h(u=h(u=f(u=f(u=f(u=f(u=l(u=l(u=l(u=l(r=u,p=l(o=p,c=l(s=c,a=l(i=a,u,p,c,e[n],7,-680876936),u,p,e[n+1],12,-389564586),a,u,e[n+2],17,606105819),c,a,e[n+3],22,-1044525330),p=l(p,c=l(c,a=l(a,u,p,c,e[n+4],7,-176418897),u,p,e[n+5],12,1200080426),a,u,e[n+6],17,-1473231341),c,a,e[n+7],22,-45705983),p=l(p,c=l(c,a=l(a,u,p,c,e[n+8],7,1770035416),u,p,e[n+9],12,-1958414417),a,u,e[n+10],17,-42063),c,a,e[n+11],22,-1990404162),p=l(p,c=l(c,a=l(a,u,p,c,e[n+12],7,1804603682),u,p,e[n+13],12,-40341101),a,u,e[n+14],17,-1502002290),c,a,e[n+15],22,1236535329),p=f(p,c=f(c,a=f(a,u,p,c,e[n+1],5,-165796510),u,p,e[n+6],9,-1069501632),a,u,e[n+11],14,643717713),c,a,e[n],20,-373897302),p=f(p,c=f(c,a=f(a,u,p,c,e[n+5],5,-701558691),u,p,e[n+10],9,38016083),a,u,e[n+15],14,-660478335),c,a,e[n+4],20,-405537848),p=f(p,c=f(c,a=f(a,u,p,c,e[n+9],5,568446438),u,p,e[n+14],9,-1019803690),a,u,e[n+3],14,-187363961),c,a,e[n+8],20,1163531501),p=f(p,c=f(c,a=f(a,u,p,c,e[n+13],5,-1444681467),u,p,e[n+2],9,-51403784),a,u,e[n+7],14,1735328473),c,a,e[n+12],20,-1926607734),p=h(p,c=h(c,a=h(a,u,p,c,e[n+5],4,-378558),u,p,e[n+8],11,-2022574463),a,u,e[n+11],16,1839030562),c,a,e[n+14],23,-35309556),p=h(p,c=h(c,a=h(a,u,p,c,e[n+1],4,-1530992060),u,p,e[n+4],11,1272893353),a,u,e[n+7],16,-155497632),c,a,e[n+10],23,-1094730640),p=h(p,c=h(c,a=h(a,u,p,c,e[n+13],4,681279174),u,p,e[n],11,-358537222),a,u,e[n+3],16,-722521979),c,a,e[n+6],23,76029189),p=h(p,c=h(c,a=h(a,u,p,c,e[n+9],4,-640364487),u,p,e[n+12],11,-421815835),a,u,e[n+15],16,530742520),c,a,e[n+2],23,-995338651),p=v(p,c=v(c,a=v(a,u,p,c,e[n],6,-198630844),u,p,e[n+7],10,1126891415),a,u,e[n+14],15,-1416354905),c,a,e[n+5],21,-57434055),p=v(p,c=v(c,a=v(a,u,p,c,e[n+12],6,1700485571),u,p,e[n+3],10,-1894986606),a,u,e[n+10],15,-1051523),c,a,e[n+1],21,-2054922799),p=v(p,c=v(c,a=v(a,u,p,c,e[n+8],6,1873313359),u,p,e[n+15],10,-30611744),a,u,e[n+6],15,-1560198380),c,a,e[n+13],21,1309151649),p=v(p,c=v(c,a=v(a,u,p,c,e[n+4],6,-145523070),u,p,e[n+11],10,-1120210379),a,u,e[n+2],15,718787259),c,a,e[n+9],21,-343485551),a=d(a,i),u=d(u,r),p=d(p,o),c=d(c,s);return[a,u,p,c]}function p(e){var t,n="",i=32*e.length;for(t=0;t<i;t+=8)n+=String.fromCharCode(e[t>>5]>>>t%32&255);return n}function c(e){var t,n=[];for(n[(e.length>>2)-1]=void 0,t=0;t<n.length;t+=1)n[t]=0;var i=8*e.length;for(t=0;t<i;t+=8)n[t>>5]|=(255&e.charCodeAt(t/8))<<t%32;return n}function i(e){var t,n,i="0123456789abcdef",r="";for(n=0;n<e.length;n+=1)t=e.charCodeAt(n),r+=i.charAt(t>>>4&15)+i.charAt(15&t);return r}function n(e){return unescape(encodeURIComponent(e))}function r(e){return p(u(c(t=n(e)),8*t.length));var t}function o(e,t){return function(e,t){var n,i,r=c(e),o=[],s=[];for(o[15]=s[15]=void 0,16<r.length&&(r=u(r,8*e.length)),n=0;n<16;n+=1)o[n]=909522486^r[n],s[n]=1549556828^r[n];return i=u(o.concat(c(t)),512+8*t.length),p(u(s.concat(i),640))}(n(e),n(t))}function t(e,t,n){return t?n?o(t,e):i(o(t,e)):n?r(e):i(r(e))}s.exports?s.exports=t:e.md5=t}(e)}),fe=function(e){return encodeURIComponent(e).replace(/[!'()*]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})},he=Object.getOwnPropertySymbols,ve=Object.prototype.hasOwnProperty,ge=Object.prototype.propertyIsEnumerable;var ye=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var i={};return"abcdefghijklmnopqrst".split("").forEach(function(e){i[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},i)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,i,r=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),o=1;o<arguments.length;o++){for(var s in n=Object(arguments[o]))ve.call(n,s)&&(r[s]=n[s]);if(he){i=he(n);for(var a=0;a<i.length;a++)ge.call(n,i[a])&&(r[i[a]]=n[i[a]])}}return r},me="%[a-f0-9]{2}";new RegExp(me,"gi"),new RegExp("("+me+")+","gi");function _e(e,t){return t.encode?t.strict?fe(e):encodeURIComponent(e):e}var we=function(i,r){!1===(r=ye({encode:!0,strict:!0,arrayFormat:"none"},r)).sort&&(r.sort=function(){});var o=function(i){switch(i.arrayFormat){case"index":return function(e,t,n){return null===t?[_e(e,i),"[",n,"]"].join(""):[_e(e,i),"[",_e(n,i),"]=",_e(t,i)].join("")};case"bracket":return function(e,t){return null===t?_e(e,i):[_e(e,i),"[]=",_e(t,i)].join("")};default:return function(e,t){return null===t?_e(e,i):[_e(e,i),"=",_e(t,i)].join("")}}}(r);return i?Object.keys(i).sort(r.sort).map(function(t){var e=i[t];if(void 0===e)return"";if(null===e)return _e(t,r);if(Array.isArray(e)){var n=[];return e.slice().forEach(function(e){void 0!==e&&n.push(o(t,e,n.length))}),n.join("&")}return _e(t,r)+"="+_e(e,r)}).filter(function(e){return 0<e.length}).join("&"):""},be=function(e,t){this.url=e,this.data=t||{}};be.prototype.send=function(e){if(!!window.XDomainRequest){var t=new window.XDomainRequest;t.open("POST",this.url,!0),t.onload=function(){e(200,t.responseText)},t.onerror=function(){"Request Entity Too Large"===t.responseText?e(413,t.responseText):e(500,t.responseText)},t.ontimeout=function(){},t.onprogress=function(){},t.send(we(this.data))}else{var n=new XMLHttpRequest;n.open("POST",this.url,!0),n.onreadystatechange=function(){4===n.readyState&&e(n.status,n.responseText)},n.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"),n.send(we(this.data))}};var Ie=function(){this._price=null,this._productId=null,this._quantity=1,this._revenueType=null,this._properties=null};Ie.prototype.setProductId=function(e){return"string"!==q(e)?G.error("Unsupported type for productId: "+q(e)+", expecting string"):V(e)?G.error("Invalid empty productId"):this._productId=e,this},Ie.prototype.setQuantity=function(e){return"number"!==q(e)?G.error("Unsupported type for quantity: "+q(e)+", expecting number"):this._quantity=parseInt(e),this},Ie.prototype.setPrice=function(e){return"number"!==q(e)?G.error("Unsupported type for price: "+q(e)+", expecting number"):this._price=e,this},Ie.prototype.setRevenueType=function(e){return"string"!==q(e)?G.error("Unsupported type for revenueType: "+q(e)+", expecting string"):this._revenueType=e,this},Ie.prototype.setEventProperties=function(e){return"object"!==q(e)?G.error("Unsupported type for eventProperties: "+q(e)+", expecting object"):this._properties=Q(e),this},Ie.prototype._isValidRevenue=function(){return"number"===q(this._price)||(G.error("Invalid revenue, need to set price field"),!1)},Ie.prototype._toJSONObject=function(){var e="object"===q(this._properties)?this._properties:{};return null!==this._productId&&(e[r]=this._productId),null!==this._quantity&&(e[o]=this._quantity),null!==this._price&&(e[s]=this._price),null!==this._revenueType&&(e[u]=this._revenueType),e};var Se=de(function(S,O){!function(r,d){var l="function",f="undefined",h="object",e="model",t="name",n="type",i="vendor",o="version",s="architecture",a="console",u="mobile",p="tablet",c="smarttv",v="wearable",g={extend:function(e,t){var n={};for(var i in e)t[i]&&t[i].length%2==0?n[i]=t[i].concat(e[i]):n[i]=e[i];return n},has:function(e,t){return"string"==typeof e&&-1!==t.toLowerCase().indexOf(e.toLowerCase())},lowerize:function(e){return e.toLowerCase()},major:function(e){return"string"==typeof e?e.split(".")[0]:d}},y={rgx:function(){for(var e,t,n,i,r,o,s,a=0,u=arguments;a<u.length&&!o;){var p=u[a],c=u[a+1];if(typeof e===f)for(i in e={},c)c.hasOwnProperty(i)&&(typeof(r=c[i])===h?e[r[0]]=d:e[r]=d);for(t=n=0;t<p.length&&!o;)if(o=p[t++].exec(this.getUA()))for(i=0;i<c.length;i++)s=o[++n],typeof(r=c[i])===h&&0<r.length?2==r.length?typeof r[1]==l?e[r[0]]=r[1].call(this,s):e[r[0]]=r[1]:3==r.length?typeof r[1]!==l||r[1].exec&&r[1].test?e[r[0]]=s?s.replace(r[1],r[2]):d:e[r[0]]=s?r[1].call(this,s,r[2]):d:4==r.length&&(e[r[0]]=s?r[3].call(this,s.replace(r[1],r[2])):d):e[r]=s||d;a+=2}return e},str:function(e,t){for(var n in t)if(typeof t[n]===h&&0<t[n].length){for(var i=0;i<t[n].length;i++)if(g.has(t[n][i],e))return"?"===n?d:n}else if(g.has(t[n],e))return"?"===n?d:n;return e}},m={browser:{oldsafari:{version:{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}},name:{"Opera Mobile":"Opera Mobi","IE Mobile":"IEMobile"}},device:{amazon:{model:{"Fire Phone":["SD","KF"]}},sprint:{model:{"Evo Shift 4G":"7373KT"},vendor:{HTC:"APA",Sprint:"Sprint"}}},os:{windows:{version:{ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},name:{"Windows Phone":"Windows Phone OS"}}}},_={browser:[[/(opera\smini)\/([\w\.-]+)/i,/(opera\s[mobiletab]+).+version\/([\w\.-]+)/i,/(opera).+version\/([\w\.]+)/i,/(opera)[\/\s]+([\w\.]+)/i],[t,o],[/(OPiOS)[\/\s]+([\w\.]+)/i],[[t,"Opera Mini"],o],[/\s(opr)\/([\w\.]+)/i],[[t,"Opera"],o],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/\s]?([\w\.]+)*/i,/(avant\s|iemobile|slim|baidu)(?:browser)?[\/\s]?([\w\.]*)/i,/(?:ms|\()(ie)\s([\w\.]+)/i,/(rekonq)\/([\w\.]+)*/i,/(chromium|flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs)\/([\w\.-]+)/i],[t,o],[/(trident).+rv[:\s]([\w\.]+).+like\sgecko/i],[[t,"IE"],o],[/(edge)\/((\d+)?[\w\.]+)/i],[t,o],[/(yabrowser)\/([\w\.]+)/i],[[t,"Yandex"],o],[/(comodo_dragon)\/([\w\.]+)/i],[[t,/_/g," "],o],[/((?:android.+)crmo|crios)\/([\w\.]+)/i,/android.+(chrome)\/([\w\.]+)\s+(?:mobile\s?safari)/i],[[t,"Chrome Mobile"],o],[/(chrome|omniweb|arora|[tizenoka]{5}\s?browser)\/v?([\w\.]+)/i,/(qqbrowser)[\/\s]?([\w\.]+)/i],[t,o],[/(uc\s?browser)[\/\s]?([\w\.]+)/i,/ucweb.+(ucbrowser)[\/\s]?([\w\.]+)/i,/JUC.+(ucweb)[\/\s]?([\w\.]+)/i],[[t,"UCBrowser"],o],[/(dolfin)\/([\w\.]+)/i],[[t,"Dolphin"],o],[/XiaoMi\/MiuiBrowser\/([\w\.]+)/i],[o,[t,"MIUI Browser"]],[/android.+version\/([\w\.]+)\s+(?:mobile\s?safari|safari)/i],[o,[t,"Android Browser"]],[/FBAV\/([\w\.]+);/i],[o,[t,"Facebook"]],[/fxios\/([\w\.-]+)/i],[o,[t,"Firefox"]],[/version\/([\w\.]+).+?mobile\/\w+\s(safari)/i],[o,[t,"Mobile Safari"]],[/version\/([\w\.]+).+?(mobile\s?safari|safari)/i],[o,t],[/webkit.+?(mobile\s?safari|safari)(\/[\w\.]+)/i],[t,[o,y.str,m.browser.oldsafari.version]],[/(konqueror)\/([\w\.]+)/i,/(webkit|khtml)\/([\w\.]+)/i],[t,o],[/(blackberry)\\s?\/([\w\.]+)/i],[[t,"BlackBerry"],o],[/(navigator|netscape)\/([\w\.-]+)/i],[[t,"Netscape"],o],[/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo\sbrowser|minimo|conkeror)[\/\s]?([\w\.\+]+)/i,/(firefox|seamonkey|k-meleon|icecat|iceape|firebird|phoenix)\/([\w\.-]+)/i,/(mozilla)\/([\w\.]+).+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir)[\/\s]?([\w\.]+)/i,/(links)\s\(([\w\.]+)/i,/(gobrowser)\/?([\w\.]+)*/i,/(ice\s?browser)\/v?([\w\._]+)/i,/(mosaic)[\/\s]([\w\.]+)/i],[t,o]],cpu:[[/(?:(amd|x(?:(?:86|64)[_-])?|wow|win)64)[;\)]/i],[[s,"amd64"]],[/(ia32(?=;))/i],[[s,g.lowerize]],[/((?:i[346]|x)86)[;\)]/i],[[s,"ia32"]],[/windows\s(ce|mobile);\sppc;/i],[[s,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?:\smac|;|\))/i],[[s,/ower/,"",g.lowerize]],[/(sun4\w)[;\)]/i],[[s,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|arm(?:64|(?=v\d+;))|(?=atmel\s)avr|(?:irix|mips|sparc)(?:64)?(?=;)|pa-risc)/i],[[s,g.lowerize]]],device:[[/\((ipad|playbook);[\w\s\);-]+(rim|apple)/i],[e,i,[n,p]],[/applecoremedia\/[\w\.]+ \((ipad)/],[e,[i,"Apple"],[n,p]],[/(apple\s{0,1}tv)/i],[[e,"Apple TV"],[i,"Apple"]],[/(archos)\s(gamepad2?)/i,/(hp).+(touchpad)/i,/(kindle)\/([\w\.]+)/i,/\s(nook)[\w\s]+build\/(\w+)/i,/(dell)\s(strea[kpr\s\d]*[\dko])/i],[i,e,[n,p]],[/(kf[A-z]+)\sbuild\/[\w\.]+.*silk\//i],[e,[i,"Amazon"],[n,p]],[/(sd|kf)[0349hijorstuw]+\sbuild\/[\w\.]+.*silk\//i],[[e,y.str,m.device.amazon.model],[i,"Amazon"],[n,u]],[/\((ip[honed|\s\w*]+);.+(apple)/i],[e,i,[n,u]],[/\((ip[honed|\s\w*]+);/i],[e,[i,"Apple"],[n,u]],[/(blackberry)[\s-]?(\w+)/i,/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|huawei|meizu|motorola|polytron)[\s_-]?([\w-]+)*/i,/(hp)\s([\w\s]+\w)/i,/(asus)-?(\w+)/i],[i,e,[n,u]],[/\(bb10;\s(\w+)/i],[e,[i,"BlackBerry"],[n,u]],[/android.+(transfo[prime\s]{4,10}\s\w+|eeepc|slider\s\w+|nexus 7)/i],[e,[i,"Asus"],[n,p]],[/(sony)\s(tablet\s[ps])\sbuild\//i,/(sony)?(?:sgp.+)\sbuild\//i],[[i,"Sony"],[e,"Xperia Tablet"],[n,p]],[/(?:sony)?(?:(?:(?:c|d)\d{4})|(?:so[-l].+))\sbuild\//i],[[i,"Sony"],[e,"Xperia Phone"],[n,u]],[/\s(ouya)\s/i,/(nintendo)\s([wids3u]+)/i],[i,e,[n,a]],[/android.+;\s(shield)\sbuild/i],[e,[i,"Nvidia"],[n,a]],[/(playstation\s[34portablevi]+)/i],[e,[i,"Sony"],[n,a]],[/(sprint\s(\w+))/i],[[i,y.str,m.device.sprint.vendor],[e,y.str,m.device.sprint.model],[n,u]],[/(lenovo)\s?(S(?:5000|6000)+(?:[-][\w+]))/i],[i,e,[n,p]],[/(htc)[;_\s-]+([\w\s]+(?=\))|\w+)*/i,/(zte)-(\w+)*/i,/(alcatel|geeksphone|huawei|lenovo|nexian|panasonic|(?=;\s)sony)[_\s-]?([\w-]+)*/i],[i,[e,/_/g," "],[n,u]],[/(nexus\s9)/i],[e,[i,"HTC"],[n,p]],[/[\s\(;](xbox(?:\sone)?)[\s\);]/i],[e,[i,"Microsoft"],[n,a]],[/(kin\.[onetw]{3})/i],[[e,/\./g," "],[i,"Microsoft"],[n,u]],[/\s(milestone|droid(?:[2-4x]|\s(?:bionic|x2|pro|razr))?(:?\s4g)?)[\w\s]+build\//i,/mot[\s-]?(\w+)*/i,/(XT\d{3,4}) build\//i,/(nexus\s[6])/i],[e,[i,"Motorola"],[n,u]],[/android.+\s(mz60\d|xoom[\s2]{0,2})\sbuild\//i],[e,[i,"Motorola"],[n,p]],[/android.+((sch-i[89]0\d|shw-m380s|gt-p\d{4}|gt-n8000|sgh-t8[56]9|nexus 10))/i,/((SM-T\w+))/i],[[i,"Samsung"],e,[n,p]],[/((s[cgp]h-\w+|gt-\w+|galaxy\snexus|sm-n900))/i,/(sam[sung]*)[\s-]*(\w+-?[\w-]*)*/i,/sec-((sgh\w+))/i],[[i,"Samsung"],e,[n,u]],[/(samsung);smarttv/i],[i,e,[n,c]],[/\(dtv[\);].+(aquos)/i],[e,[i,"Sharp"],[n,c]],[/sie-(\w+)*/i],[e,[i,"Siemens"],[n,u]],[/(maemo|nokia).*(n900|lumia\s\d+)/i,/(nokia)[\s_-]?([\w-]+)*/i],[[i,"Nokia"],e,[n,u]],[/android\s3\.[\s\w;-]{10}(a\d{3})/i],[e,[i,"Acer"],[n,p]],[/android\s3\.[\s\w;-]{10}(lg?)-([06cv9]{3,4})/i],[[i,"LG"],e,[n,p]],[/(lg) netcast\.tv/i],[i,e,[n,c]],[/(nexus\s[45])/i,/lg[e;\s\/-]+(\w+)*/i],[e,[i,"LG"],[n,u]],[/android.+(ideatab[a-z0-9\-\s]+)/i],[e,[i,"Lenovo"],[n,p]],[/linux;.+((jolla));/i],[i,e,[n,u]],[/((pebble))app\/[\d\.]+\s/i],[i,e,[n,v]],[/android.+;\s(glass)\s\d/i],[e,[i,"Google"],[n,v]],[/android.+(\w+)\s+build\/hm\1/i,/android.+(hm[\s\-_]*note?[\s_]*(?:\d\w)?)\s+build/i,/android.+(mi[\s\-_]*(?:one|one[\s_]plus)?[\s_]*(?:\d\w)?)\s+build/i],[[e,/_/g," "],[i,"Xiaomi"],[n,u]],[/\s(tablet)[;\/\s]/i,/\s(mobile)[;\/\s]/i],[[n,g.lowerize],i,e]],engine:[[/windows.+\sedge\/([\w\.]+)/i],[o,[t,"EdgeHTML"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m)\/([\w\.]+)/i,/(khtml|tasman|links)[\/\s]\(?([\w\.]+)/i,/(icab)[\/\s]([23]\.[\d\.]+)/i],[t,o],[/rv\:([\w\.]+).*(gecko)/i],[o,t]],os:[[/microsoft\s(windows)\s(vista|xp)/i],[t,o],[/(windows)\snt\s6\.2;\s(arm)/i,/(windows\sphone(?:\sos)*|windows\smobile|windows)[\s\/]?([ntce\d\.\s]+\w)/i],[[t,y.str,m.os.windows.name],[o,y.str,m.os.windows.version]],[/(win(?=3|9|n)|win\s9x\s)([nt\d\.]+)/i],[[t,"Windows"],[o,y.str,m.os.windows.version]],[/\((bb)(10);/i],[[t,"BlackBerry"],o],[/(blackberry)\w*\/?([\w\.]+)*/i,/(tizen)[\/\s]([\w\.]+)/i,/(android|webos|palm\sos|qnx|bada|rim\stablet\sos|meego|contiki)[\/\s-]?([\w\.]+)*/i,/linux;.+(sailfish);/i],[t,o],[/(symbian\s?o?s?|symbos|s60(?=;))[\/\s-]?([\w\.]+)*/i],[[t,"Symbian"],o],[/\((series40);/i],[t],[/mozilla.+\(mobile;.+gecko.+firefox/i],[[t,"Firefox OS"],o],[/(nintendo|playstation)\s([wids34portablevu]+)/i,/(mint)[\/\s\(]?(\w+)*/i,/(mageia|vectorlinux)[;\s]/i,/(joli|[kxln]?ubuntu|debian|[open]*suse|gentoo|(?=\s)arch|slackware|fedora|mandriva|centos|pclinuxos|redhat|zenwalk|linpus)[\/\s-]?([\w\.-]+)*/i,/(hurd|linux)\s?([\w\.]+)*/i,/(gnu)\s?([\w\.]+)*/i],[[t,"Linux"],o],[/(cros)\s[\w]+\s([\w\.]+\w)/i],[[t,"Chromium OS"],o],[/(sunos)\s?([\w\.]+\d)*/i],[[t,"Solaris"],o],[/\s([frentopc-]{0,4}bsd|dragonfly)\s?([\w\.]+)*/i],[[t,"Linux"],o],[/(iphone)(?:.*os\s*([\w]+)*\slike\smac|;\sopera)/i],[[t,"iPhone"],[o,/_/g,"."]],[/(ipad)(?:.*os\s*([\w]+)*\slike\smac|;\sopera)/i],[[t,"iPad"],[o,/_/g,"."]],[/(ip[honead]+)(?:.*os\s([\w]+)*\slike\smac|;\sopera)/i],[[t,"iOS"],[o,/_/g,"."]],[/(mac\sos\sx)\s?([\w\s\.]+\w)*/i,/(macintosh|mac(?=_powerpc)\s)/i],[[t,"Mac"],[o,/_/g,"."]],[/((?:open)?solaris)[\/\s-]?([\w\.]+)*/i,/(haiku)\s(\w+)/i,/(aix)\s((\d)(?=\.|\)|\s)[\w\.]*)*/i,/(plan\s9|minix|beos|os\/2|amigaos|morphos|risc\sos|openvms)/i,/(unix)\s?([\w\.]+)*/i],[t,o]]},w=function(e,t){if(!(this instanceof w))return new w(e,t).getResult();var n=e||(r&&r.navigator&&r.navigator.userAgent?r.navigator.userAgent:""),i=t?g.extend(_,t):_;return this.getBrowser=function(){var e=y.rgx.apply(this,i.browser);return e.major=g.major(e.version),e},this.getCPU=function(){return y.rgx.apply(this,i.cpu)},this.getDevice=function(){return y.rgx.apply(this,i.device)},this.getEngine=function(){return y.rgx.apply(this,i.engine)},this.getOS=function(){return y.rgx.apply(this,i.os)},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return n},this.setUA=function(e){return n=e,this},this};w.VERSION="0.7.10",w.BROWSER={NAME:t,MAJOR:"major",VERSION:o},w.CPU={ARCHITECTURE:s},w.DEVICE={MODEL:e,VENDOR:i,TYPE:n,CONSOLE:a,MOBILE:u,SMARTTV:c,TABLET:p,WEARABLE:v,EMBEDDED:"embedded"},w.ENGINE={NAME:t,VERSION:o},w.OS={NAME:t,VERSION:o},S.exports&&(O=S.exports=w),O.UAParser=w;var b=r.jQuery||r.Zepto;if(typeof b!==f){var I=new w;b.ua=I.getResult(),b.ua.get=function(){return I.getUA()},b.ua.set=function(e){I.setUA(e);var t=I.getResult();for(var n in t)b.ua[n]=t[n]}}}("object"==typeof window?window:e)}),Oe=(Se.UAParser,function e(t){return t?(t^16*Math.random()>>t/4).toString(16):([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,e)}),Ee="4.6.0",Ne={apiEndpoint:"api.amplitude.com",batchEvents:!1,cookieExpiration:3650,cookieName:"amplitude_id",deviceIdFromUrlParam:!1,domain:"",eventUploadPeriodMillis:3e4,eventUploadThreshold:30,forceHttps:!0,includeGclid:!1,includeReferrer:!1,includeUtm:!1,language:{language:navigator&&(navigator.languages&&navigator.languages[0]||navigator.language||navigator.userLanguage)||void 0}.language,logLevel:"WARN",optOut:!1,platform:"Web",savedMaxCount:1e3,saveEvents:!0,saveParamsReferrerOncePerSession:!0,secureCookie:!1,sessionTimeout:18e5,trackingOptions:{city:!0,country:!0,device_model:!0,dma:!0,ip_address:!0,language:!0,os_name:!0,os_version:!0,platform:!0,region:!0,version_name:!0},unsetParamsReferrerOnNewSession:!1,unsentKey:"amplitude_unsent",unsentIdentifyKey:"amplitude_unsent_identify",uploadBatchSize:100},xe=function(e){this._instanceName=V(e)?l:e.toLowerCase(),this._legacyStorageSuffix=this._instanceName===l?"":"_"+this._instanceName,this._unsentEvents=[],this._unsentIdentifys=[],this._ua=new Se(navigator.userAgent).getResult(),this.options=R({},Ne,{trackingOptions:R({},Ne.trackingOptions)}),this.cookieStorage=(new ue).getStorage(),this._q=[],this._sending=!1,this._updateScheduled=!1,this._eventId=0,this._identifyId=0,this._lastEventTime=null,this._newSession=!1,this._sequenceNumber=0,this._sessionId=null,this._userAgent=navigator&&navigator.userAgent||null};xe.prototype.Identify=ce,xe.prototype.Revenue=Ie,xe.prototype.init=function(e,t,n,i){if("string"!==q(e)||V(e))G.error("Invalid apiKey. Please re-initialize with a valid apiKey");else try{this.options.apiKey=e,this._storageSuffix="_"+e+this._legacyStorageSuffix,ke(this.options,n),"string"===q(this.options.logLevel)&&F(this.options.logLevel);var r=Ue(this);if(this._apiPropertiesTrackingOptions=0<Object.keys(r).length?{tracking_options:r}:{},this.cookieStorage.options({expirationDays:this.options.cookieExpiration,domain:this.options.domain,secure:this.options.secureCookie}),this.options.domain=this.cookieStorage.options().domain,this._instanceName===l&&Ae(this),Pe(this),this.options.deviceId="object"===q(n)&&"string"===q(n.deviceId)&&!V(n.deviceId)&&n.deviceId||this.options.deviceIdFromUrlParam&&this._getDeviceIdFromUrlParam(this._getUrlParams())||this.options.deviceId||Oe()+"R",this.options.userId="string"===q(t)&&!V(t)&&t||"number"===q(t)&&t.toString()||this.options.userId||null,this.options.saveEvents){this._unsentEvents=this._loadSavedUnsentEvents(this.options.unsentKey),this._unsentIdentifys=this._loadSavedUnsentEvents(this.options.unsentIdentifyKey);for(var o=0;o<this._unsentEvents.length;o++){var s=this._unsentEvents[o].event_properties,a=this._unsentEvents[o].groups;this._unsentEvents[o].event_properties=Q(s),this._unsentEvents[o].groups=X(a)}for(var u=0;u<this._unsentIdentifys.length;u++){var p=this._unsentIdentifys[u].user_properties,c=this._unsentIdentifys[u].groups;this._unsentIdentifys[u].user_properties=Q(p),this._unsentIdentifys[u].groups=X(c)}}var d=(new Date).getTime();(!this._sessionId||!this._lastEventTime||d-this._lastEventTime>this.options.sessionTimeout)&&(this.options.unsetParamsReferrerOnNewSession&&this._unsetUTMParams(),this._newSession=!0,this._sessionId=d,this.options.saveParamsReferrerOncePerSession&&this._trackParamsAndReferrer()),this.options.saveParamsReferrerOncePerSession||this._trackParamsAndReferrer(),this._lastEventTime=d,Re(this),this._sendEventsIfReady()}catch(e){G.error(e)}finally{"function"===q(i)&&i(this)}},xe.prototype._trackParamsAndReferrer=function(){this.options.includeUtm&&this._initUtmData(),this.options.includeReferrer&&this._saveReferrer(this._getReferrer()),this.options.includeGclid&&this._saveGclid(this._getUrlParams())};var ke=function i(r,o){if("object"===q(o)){var e=function(e){if(r.hasOwnProperty(e)){var t=o[e],n=q(r[e]);H(t,e+" option",n)&&("boolean"===n?r[e]=!!t:"string"===n&&!V(t)||"number"===n&&0<t?r[e]=t:"object"===n&&i(r[e],t))}};for(var t in o)o.hasOwnProperty(t)&&e(t)}};xe.prototype.runQueuedFunctions=function(){for(var e=0;e<this._q.length;e++){var t=this[this._q[e][0]];"function"===q(t)&&t.apply(this,this._q[e].slice(1))}this._q=[]},xe.prototype._apiKeySet=function(e){return!V(this.options.apiKey)||(G.error("Invalid apiKey. Please set a valid apiKey with init() before calling "+e),!1)},xe.prototype._loadSavedUnsentEvents=function(e){var t=this._getFromStorage(ae,e),n=this._parseSavedUnsentEventsString(t,e),i=this._getFromStorageLegacy(ae,e),r=this._parseSavedUnsentEventsString(i,e).concat(n);return this._removeFromLegacyStorage(ae,e),this._setInStorage(ae,e,JSON.stringify(r)),r},xe.prototype._removeFromLegacyStorage=function(e,t){e.removeItem(t+this._legacyStorageSuffix)},xe.prototype._parseSavedUnsentEventsString=function(e,t){if(V(e))return[];if("string"===q(e))try{var n=JSON.parse(e);if("array"===q(n))return n}catch(e){}return G.error("Unable to load "+t+" events. Restart with a new empty queue."),[]},xe.prototype.isNewSession=function(){return this._newSession},xe.prototype.getSessionId=function(){return this._sessionId},xe.prototype.nextEventId=function(){return this._eventId++,this._eventId},xe.prototype.nextIdentifyId=function(){return this._identifyId++,this._identifyId},xe.prototype.nextSequenceNumber=function(){return this._sequenceNumber++,this._sequenceNumber},xe.prototype._unsentCount=function(){return this._unsentEvents.length+this._unsentIdentifys.length},xe.prototype._sendEventsIfReady=function(e){return 0!==this._unsentCount()&&(this.options.batchEvents?this._unsentCount()>=this.options.eventUploadThreshold?(this.sendEvents(e),!0):(this._updateScheduled||(this._updateScheduled=!0,setTimeout(function(){this._updateScheduled=!1,this.sendEvents()}.bind(this),this.options.eventUploadPeriodMillis)),!1):(this.sendEvents(e),!0))},xe.prototype._getFromStorage=function(e,t){return e.getItem(t+this._storageSuffix)},xe.prototype._getFromStorageLegacy=function(e,t){return e.getItem(t+this._legacyStorageSuffix)},xe.prototype._setInStorage=function(e,t,n){e.setItem(t+this._storageSuffix,n)};var Ae=function(e){var t=e.cookieStorage.get(e.options.cookieName+e._storageSuffix);if("object"!==q(t)&&!("object"===q(t=e.cookieStorage.get(e.options.cookieName+e._legacyStorageSuffix))&&t.deviceId&&t.sessionId&&t.lastEventTime)){var n=function(e){var t=ae.getItem(e);return ae.removeItem(e),t},i="string"===q(e.options.apiKey)&&"_"+e.options.apiKey.slice(0,6)||"",r=n(w+i),o=n(I+i),s=n(b+i);null!=s&&(s="true"===String(s));var a=parseInt(n(_)),u=parseInt(n(g)),p=parseInt(n(v)),c=parseInt(n(y)),d=parseInt(n(m)),l=function(e){return"object"===q(t)&&t[e]};e.options.deviceId=l("deviceId")||r,e.options.userId=l("userId")||o,e._sessionId=l("sessionId")||a||e._sessionId,e._lastEventTime=l("lastEventTime")||u||e._lastEventTime,e._eventId=l("eventId")||p||e._eventId,e._identifyId=l("identifyId")||c||e._identifyId,e._sequenceNumber=l("sequenceNumber")||d||e._sequenceNumber,e.options.optOut=s||!1,t&&void 0!==t.optOut&&null!==t.optOut&&(e.options.optOut="true"===String(t.optOut)),Re(e)}},Pe=function(e){var t=e.cookieStorage.get(e.options.cookieName+e._storageSuffix);if("object"===q(t))Te(e,t);else{var n=e.cookieStorage.get(e.options.cookieName+e._legacyStorageSuffix);"object"===q(n)&&(e.cookieStorage.remove(e.options.cookieName+e._legacyStorageSuffix),Te(e,n))}},Te=function(e,t){t.deviceId&&(e.options.deviceId=t.deviceId),t.userId&&(e.options.userId=t.userId),null!==t.optOut&&void 0!==t.optOut&&(e.options.optOut=t.optOut),t.sessionId&&(e._sessionId=parseInt(t.sessionId)),t.lastEventTime&&(e._lastEventTime=parseInt(t.lastEventTime)),t.eventId&&(e._eventId=parseInt(t.eventId)),t.identifyId&&(e._identifyId=parseInt(t.identifyId)),t.sequenceNumber&&(e._sequenceNumber=parseInt(t.sequenceNumber))},Re=function(e){e.cookieStorage.set(e.options.cookieName+e._storageSuffix,{deviceId:e.options.deviceId,userId:e.options.userId,optOut:e.options.optOut,sessionId:e._sessionId,lastEventTime:e._lastEventTime,eventId:e._eventId,identifyId:e._identifyId,sequenceNumber:e._sequenceNumber})};xe.prototype._initUtmData=function(e,t){e=e||this._getUrlParams(),t=t||this.cookieStorage.get("__utmz");var n,i,r,o,s,a,u,p,c,d,l,f=(i=e,r=(n=t)?"?"+n.split(".").slice(-1)[0].replace(/\|/g,"&"):"",s=(o=function(e,t,n,i){return $(e,t)||$(n,i)})(S,i,"utmcsr",r),a=o(O,i,"utmcmd",r),u=o(E,i,"utmccn",r),p=o(N,i,"utmctr",r),c=o(x,i,"utmcct",r),d={},(l=function(e,t){V(t)||(d[e]=t)})(S,s),l(O,a),l(E,u),l(N,p),l(x,c),d);je(this,f)},xe.prototype._unsetUTMParams=function(){var e=new ce;e.unset(d),e.unset(S),e.unset(O),e.unset(E),e.unset(N),e.unset(x),this.identify(e)};var je=function(e,t){if("object"===q(t)&&0!==Object.keys(t).length){var n=new ce;for(var i in t)t.hasOwnProperty(i)&&(n.setOnce("initial_"+i,t[i]),n.set(i,t[i]));e.identify(n)}};xe.prototype._getReferrer=function(){return document.referrer},xe.prototype._getUrlParams=function(){return location.search},xe.prototype._saveGclid=function(e){var t=$("gclid",e);V(t)||je(this,{gclid:t})},xe.prototype._getDeviceIdFromUrlParam=function(e){return $(p,e)},xe.prototype._getReferringDomain=function(e){if(V(e))return null;var t=e.split("/");return 3<=t.length?t[2]:null},xe.prototype._saveReferrer=function(e){if(!V(e)){var t={referrer:e,referring_domain:this._getReferringDomain(e)};je(this,t)}},xe.prototype.saveEvents=function(){try{this._setInStorage(ae,this.options.unsentKey,JSON.stringify(this._unsentEvents))}catch(e){}try{this._setInStorage(ae,this.options.unsentIdentifyKey,JSON.stringify(this._unsentIdentifys))}catch(e){}},xe.prototype.setDomain=function(e){if(H(e,"domain","string"))try{this.cookieStorage.options({domain:e}),this.options.domain=this.cookieStorage.options().domain,Pe(this),Re(this)}catch(e){G.error(e)}},xe.prototype.setUserId=function(e){try{this.options.userId=null!=e&&""+e||null,Re(this)}catch(e){G.error(e)}},xe.prototype.setGroup=function(e,t){if(this._apiKeySet("setGroup()")&&H(e,"groupType","string")&&!V(e)){var n={};n[e]=t;var i=(new ce).set(e,t);this._logEvent(f,null,null,i.userPropertiesOperations,n,null,null,null)}},xe.prototype.setOptOut=function(e){if(H(e,"enable","boolean"))try{this.options.optOut=e,Re(this)}catch(e){G.error(e)}},xe.prototype.setSessionId=function(e){if(H(e,"sessionId","number"))try{this._sessionId=e,Re(this)}catch(e){G.error(e)}},xe.prototype.resetSessionId=function(){this.setSessionId((new Date).getTime())},xe.prototype.regenerateDeviceId=function(){this.setDeviceId(Oe()+"R")},xe.prototype.setDeviceId=function(e){if(H(e,"deviceId","string"))try{V(e)||(this.options.deviceId=""+e,Re(this))}catch(e){G.error(e)}},xe.prototype.setUserProperties=function(e){if(this._apiKeySet("setUserProperties()")&&H(e,"userProperties","object")){var t=J(Q(e));if(0!==Object.keys(t).length){var n=new ce;for(var i in t)t.hasOwnProperty(i)&&n.set(i,t[i]);this.identify(n)}}},xe.prototype.clearUserProperties=function(){if(this._apiKeySet("clearUserProperties()")){var e=new ce;e.clearAll(),this.identify(e)}};var qe=function(e,t){for(var n=0;n<t._q.length;n++){var i=e[t._q[n][0]];"function"===q(i)&&i.apply(e,t._q[n].slice(1))}return e};xe.prototype.identify=function(e,t){if(this._apiKeySet("identify()"))if("object"===q(e)&&e.hasOwnProperty("_q")&&(e=qe(new ce,e)),e instanceof ce){if(0<Object.keys(e.userPropertiesOperations).length)return this._logEvent(f,null,null,e.userPropertiesOperations,null,null,null,t);"function"===q(t)&&t(0,"No request sent",{reason:"No user property operations"})}else G.error("Invalid identify input type. Expected Identify object but saw "+q(e)),"function"===q(t)&&t(0,"No request sent",{reason:"Invalid identify input type"});else"function"===q(t)&&t(0,"No request sent",{reason:"API key is not set"})},xe.prototype.groupIdentify=function(e,t,n,i){var r,o,s;if(this._apiKeySet("groupIdentify()"))if(H(e,"group_type","string")&&!V(e))if(null!=t)if("object"===q(n)&&n.hasOwnProperty("_q")&&(n=qe(new ce,n)),n instanceof ce){if(0<Object.keys(n.userPropertiesOperations).length)return this._logEvent(h,null,null,null,(s=t,(o=e)in(r={})?Object.defineProperty(r,o,{value:s,enumerable:!0,configurable:!0,writable:!0}):r[o]=s,r),n.userPropertiesOperations,null,i);"function"===q(i)&&i(0,"No request sent",{reason:"No group property operations"})}else G.error("Invalid identify input type. Expected Identify object but saw "+q(n)),"function"===q(i)&&i(0,"No request sent",{reason:"Invalid identify input type"});else"function"===q(i)&&i(0,"No request sent",{reason:"Invalid group name"});else"function"===q(i)&&i(0,"No request sent",{reason:"Invalid group type"});else"function"===q(i)&&i(0,"No request sent",{reason:"API key is not set"})},xe.prototype.setVersionName=function(e){H(e,"versionName","string")&&(this.options.versionName=e)},xe.prototype._logEvent=function(e,t,n,i,r,o,s,a){if(Pe(this),e)if(this.options.optOut)"function"===q(a)&&a(0,"No request sent",{reason:"optOut is set to true"});else try{var u;u=e===f||e===h?this.nextIdentifyId():this.nextEventId();var p=this.nextSequenceNumber(),c="number"===q(s)?s:(new Date).getTime();(!this._sessionId||!this._lastEventTime||c-this._lastEventTime>this.options.sessionTimeout)&&(this._sessionId=c),this._lastEventTime=c,Re(this),i=i||{};var d=R({},this._apiPropertiesTrackingOptions);n=R({},n||{},d),t=t||{},r=r||{},o=o||{};var l={device_id:this.options.deviceId,user_id:this.options.userId,timestamp:c,event_id:u,session_id:this._sessionId||-1,event_type:e,version_name:Ce(this,"version_name")&&this.options.versionName||null,platform:Ce(this,"platform")?this.options.platform:null,os_name:Ce(this,"os_name")&&this._ua.browser.name||null,os_version:Ce(this,"os_version")&&this._ua.browser.major||null,device_model:Ce(this,"device_model")&&this._ua.os.name||null,language:Ce(this,"language")?this.options.language:null,api_properties:n,event_properties:J(Q(t)),user_properties:J(Q(i)),uuid:Oe(),library:{name:"amplitude-js",version:Ee},sequence_number:p,groups:J(X(r)),group_properties:J(Q(o)),user_agent:this._userAgent};return e===f||e===h?(this._unsentIdentifys.push(l),this._limitEventsQueued(this._unsentIdentifys)):(this._unsentEvents.push(l),this._limitEventsQueued(this._unsentEvents)),this.options.saveEvents&&this.saveEvents(),this._sendEventsIfReady(a)||"function"!==q(a)||a(0,"No request sent",{reason:"No events to send or upload queued"}),u}catch(e){G.error(e)}else"function"===q(a)&&a(0,"No request sent",{reason:"Missing eventType"})};var Ce=function(e,t){return!!e.options.trackingOptions[t]},Ue=function(e){for(var t=["city","country","dma","ip_address","region"],n={},i=0;i<t.length;i++){var r=t[i];Ce(e,r)||(n[r]=!1)}return n};xe.prototype._limitEventsQueued=function(e){e.length>this.options.savedMaxCount&&e.splice(0,e.length-this.options.savedMaxCount)},xe.prototype.logEvent=function(e,t,n){return this.logEventWithTimestamp(e,t,null,n)},xe.prototype.logEventWithTimestamp=function(e,t,n,i){return this._apiKeySet("logEvent()")?H(e,"eventType","string")?V(e)?("function"===q(i)&&i(0,"No request sent",{reason:"Missing eventType"}),-1):this._logEvent(e,t,null,null,null,null,n,i):("function"===q(i)&&i(0,"No request sent",{reason:"Invalid type for eventType"}),-1):("function"===q(i)&&i(0,"No request sent",{reason:"API key not set"}),-1)},xe.prototype.logEventWithGroups=function(e,t,n,i){return this._apiKeySet("logEventWithGroups()")?H(e,"eventType","string")?this._logEvent(e,t,null,null,n,null,null,i):("function"===q(i)&&i(0,"No request sent",{reason:"Invalid type for eventType"}),-1):("function"===q(i)&&i(0,"No request sent",{reason:"API key not set"}),-1)},xe.prototype.logRevenueV2=function(e){if(this._apiKeySet("logRevenueV2()"))if("object"===q(e)&&e.hasOwnProperty("_q")&&(e=qe(new Ie,e)),e instanceof Ie){if(e&&e._isValidRevenue())return this.logEvent(i,e._toJSONObject())}else G.error("Invalid revenue input type. Expected Revenue object but saw "+q(e))},xe.prototype.removeEvents=function(e,t){Me(this,"_unsentEvents",e),Me(this,"_unsentIdentifys",t)};var Me=function(e,t,n){if(!(n<0)){for(var i=[],r=0;r<e[t].length;r++)e[t][r].event_id>n&&i.push(e[t][r]);e[t]=i}};xe.prototype.sendEvents=function(n){if(this._apiKeySet("sendEvents()"))if(this.options.optOut)"function"===q(n)&&n(0,"No request sent",{reason:"optOut is set to true"});else if(0!==this._unsentCount())if(this._sending)"function"===q(n)&&n(0,"No request sent",{reason:"Request already in progress"});else{this._sending=!0;var e=(this.options.forceHttps?"https":"https:"===window.location.protocol?"https":"http")+"://"+this.options.apiEndpoint+"/",i=Math.min(this._unsentCount(),this.options.uploadBatchSize),t=this._mergeEventsAndIdentifys(i),r=t.maxEventId,o=t.maxIdentifyId,s=JSON.stringify(t.eventsToSend),a=(new Date).getTime(),u={client:this.options.apiKey,e:s,v:c,upload_time:a,checksum:le(c+this.options.apiKey+s+a)},p=this;new be(e,u).send(function(e,t){p._sending=!1;try{200===e&&"success"===t?(p.removeEvents(r,o),p.options.saveEvents&&p.saveEvents(),p._sendEventsIfReady(n)||"function"!==q(n)||n(e,t)):413===e?(1===p.options.uploadBatchSize&&p.removeEvents(r,o),p.options.uploadBatchSize=Math.ceil(i/2),p.sendEvents(n)):"function"===q(n)&&n(e,t)}catch(e){}})}else"function"===q(n)&&n(0,"No request sent",{reason:"No events to send"});else"function"===q(n)&&n(0,"No request sent",{reason:"API key not set"})},xe.prototype._mergeEventsAndIdentifys=function(e){for(var t=[],n=0,i=-1,r=0,o=-1;t.length<e;){var s,a=r>=this._unsentIdentifys.length,u=n>=this._unsentEvents.length;if(u&&a){G.error("Merging Events and Identifys, less events and identifys than expected");break}a?i=(s=this._unsentEvents[n++]).event_id:u?o=(s=this._unsentIdentifys[r++]).event_id:!("sequence_number"in this._unsentEvents[n])||this._unsentEvents[n].sequence_number<this._unsentIdentifys[r].sequence_number?i=(s=this._unsentEvents[n++]).event_id:o=(s=this._unsentIdentifys[r++]).event_id,t.push(s)}return{eventsToSend:t,maxEventId:i,maxIdentifyId:o}},xe.prototype.__VERSION__=Ee;var De=function(){this.options=R({},Ne),this._q=[],this._instances={}};De.prototype.Identify=ce,De.prototype.Revenue=Ie,De.prototype.getInstance=function(e){e=V(e)?l:e.toLowerCase();var t=this._instances[e];return void 0===t&&(t=new xe(e),this._instances[e]=t),t},De.prototype.__VERSION__=Ee;var ze=window.amplitude||{},Be=new De;for(var Ke in Be._q=ze._q||[],ze._iq)ze._iq.hasOwnProperty(Ke)&&(Be.getInstance(Ke)._q=ze._iq[Ke]._q||[]);return Be});

@@ -1,2 +0,2 @@

### 4.6.0 (December 7, 2018)
### 4.6.0 (February 25, 2018)

@@ -6,2 +6,5 @@ * Add support for unsetting utm params when a new session is created

* Bugfix: Allow logLevel to be set to disabled.
* Bugfix: Update ua-parser to work in quirks mode in older internet explorer versions
* Fetch ua-parsers-js from npm instead of github
* Add `secureCookie` option to add a secure flag to the cookie

@@ -8,0 +11,0 @@ ### 4.5.2 (November 10, 2018)

{
"name": "amplitude-js",
"author": "Amplitude <support@amplitude.com>",
"version": "4.6.0-beta.3",
"version": "4.6.0",
"license": "MIT",

@@ -16,8 +16,9 @@ "description": "Javascript library for Amplitude Analytics",

"json3": "^3.3.2",
"lodash": "^4.17.4",
"query-string": "5",
"@amplitude/ua-parser-js": "0.7.10"
"@amplitude/ua-parser-js": "0.7.11"
},
"devDependencies": {
"babel-core": "6",
"babel-plugin-external-helpers": "^6.22.0",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-polyfill": "^6.26.0",

@@ -40,3 +41,3 @@ "babel-preset-env": "1",

"mocha": "^4.0.1",
"rollup": "^0.49.3",
"rollup": "^0.56.0",
"rollup-plugin-babel": "^3.0.2",

@@ -46,2 +47,3 @@ "rollup-plugin-commonjs": "8",

"rollup-plugin-node-resolve": "^3.0.0",
"rollup-plugin-replace": "^2.1.0",
"rollup-plugin-uglify": "^2.0.1",

@@ -52,4 +54,5 @@ "sinon": "^4.1.2",

"scripts": {
"test": "make test"
"test": "make test",
"dev": "node test/browser/server.js"
}
}

@@ -14,3 +14,3 @@ Amplitude-JavaScript

[4.6.0-beta.1 - Released on November 10, 2018](https://github.com/amplitude/Amplitude-JavaScript/releases/latest)
[4.6.0 - Released on February 25, 2019](https://github.com/amplitude/Amplitude-JavaScript/releases/latest)

@@ -17,0 +17,0 @@

@@ -7,7 +7,6 @@ import Constants from './constants';

import md5 from 'blueimp-md5';
import merge from 'lodash/merge';
import Request from './xhr';
import Revenue from './revenue';
import type from './type';
import UAParser from 'ua-parser-js';
import UAParser from '@amplitude/ua-parser-js';
import utils from './utils';

@@ -31,3 +30,3 @@ import UUID from './uuid';

this._ua = new UAParser(navigator.userAgent).getResult();
this.options = merge({}, DEFAULT_OPTIONS);
this.options = {...DEFAULT_OPTIONS, trackingOptions: {...DEFAULT_OPTIONS.trackingOptions}};
this.cookieStorage = new cookieStorage().getStorage();

@@ -84,3 +83,4 @@ this._q = []; // queue for proxied functions before script load

expirationDays: this.options.cookieExpiration,
domain: this.options.domain
domain: this.options.domain,
secure: this.options.secureCookie,
});

@@ -976,4 +976,4 @@ this.options.domain = this.cookieStorage.options().domain;

userProperties = userProperties || {};
var trackingOptions = merge({}, this._apiPropertiesTrackingOptions);
apiProperties = merge(trackingOptions, (apiProperties || {}));
var trackingOptions = {...this._apiPropertiesTrackingOptions};
apiProperties = {...(apiProperties || {}), ...trackingOptions};
eventProperties = eventProperties || {};

@@ -1180,25 +1180,27 @@ groups = groups || {};

/**
* Log revenue event with a price, quantity, and product identifier. DEPRECATED - use logRevenueV2
* @public
* @deprecated
* @param {number} price - price of revenue event
* @param {number} quantity - (optional) quantity of products in revenue event. If no quantity specified default to 1.
* @param {string} product - (optional) product identifier
* @example amplitudeClient.logRevenue(3.99, 1, 'product_1234');
*/
AmplitudeClient.prototype.logRevenue = function logRevenue(price, quantity, product) {
// Test that the parameters are of the right type.
if (!this._apiKeySet('logRevenue()') || !_isNumber(price) || (quantity !== undefined && !_isNumber(quantity))) {
// utils.log('Price and quantity arguments to logRevenue must be numbers');
return -1;
}
if (BUILD_COMPAT_2_0) {
/**
* Log revenue event with a price, quantity, and product identifier. DEPRECATED - use logRevenueV2
* @public
* @deprecated
* @param {number} price - price of revenue event
* @param {number} quantity - (optional) quantity of products in revenue event. If no quantity specified default to 1.
* @param {string} product - (optional) product identifier
* @example amplitudeClient.logRevenue(3.99, 1, 'product_1234');
*/
AmplitudeClient.prototype.logRevenue = function logRevenue(price, quantity, product) {
// Test that the parameters are of the right type.
if (!this._apiKeySet('logRevenue()') || !_isNumber(price) || (quantity !== undefined && !_isNumber(quantity))) {
// utils.log('Price and quantity arguments to logRevenue must be numbers');
return -1;
}
return this._logEvent(Constants.REVENUE_EVENT, {}, {
productId: product,
special: 'revenue_amount',
quantity: quantity || 1,
price: price
}, null, null, null, null, null);
};
return this._logEvent(Constants.REVENUE_EVENT, {}, {
productId: product,
special: 'revenue_amount',
quantity: quantity || 1,
price: price
}, null, null, null, null, null);
};
}

@@ -1382,10 +1384,12 @@ /**

/**
* Set global user properties. Note this is deprecated, and we recommend using setUserProperties
* @public
* @deprecated
*/
AmplitudeClient.prototype.setGlobalUserProperties = function setGlobalUserProperties(userProperties) {
this.setUserProperties(userProperties);
};
if (BUILD_COMPAT_2_0) {
/**
* Set global user properties. Note this is deprecated, and we recommend using setUserProperties
* @public
* @deprecated
*/
AmplitudeClient.prototype.setGlobalUserProperties = function setGlobalUserProperties(userProperties) {
this.setUserProperties(userProperties);
};
}

@@ -1392,0 +1396,0 @@ /**

@@ -6,3 +6,3 @@ (function(window, document) {

as.async = true;
as.src = 'https://cdn.amplitude.com/libs/amplitude-4.6.0-beta.1-min.gz.js';
as.src = 'https://cdn.amplitude.com/libs/amplitude-4.6.0-min.gz.js';
as.onload = function() {if(window.amplitude.runQueuedFunctions) {window.amplitude.runQueuedFunctions();} else {console.log('[Amplitude] Error: could not load SDK');}};

@@ -9,0 +9,0 @@ var s = document.getElementsByTagName('script')[0];

import AmplitudeClient from './amplitude-client';
import Constants from './constants';
import Identify from './identify';
import assign from 'lodash/assign';
import Revenue from './revenue';

@@ -20,3 +19,3 @@ import type from './type';

var Amplitude = function Amplitude() {
this.options = assign({}, DEFAULT_OPTIONS);
this.options = {...DEFAULT_OPTIONS};
this._q = [];

@@ -39,322 +38,326 @@ this._instances = {}; // mapping of instance names to instances

/**
* Initializes the Amplitude Javascript SDK with your apiKey and any optional configurations.
* This is required before any other methods can be called.
* @public
* @param {string} apiKey - The API key for your app.
* @param {string} opt_userId - (optional) An identifier for this user.
* @param {object} opt_config - (optional) Configuration options.
* See [Readme]{@link https://github.com/amplitude/Amplitude-Javascript#configuration-options} for list of options and default values.
* @param {function} opt_callback - (optional) Provide a callback function to run after initialization is complete.
* @deprecated Please use amplitude.getInstance().init(apiKey, opt_userId, opt_config, opt_callback);
* @example amplitude.init('API_KEY', 'USER_ID', {includeReferrer: true, includeUtm: true}, function() { alert('init complete'); });
*/
Amplitude.prototype.init = function init(apiKey, opt_userId, opt_config, opt_callback) {
this.getInstance().init(apiKey, opt_userId, opt_config, function(instance) {
// make options such as deviceId available for callback functions
this.options = instance.options;
if (type(opt_callback) === 'function') {
opt_callback(instance);
if (BUILD_COMPAT_SNIPPET) {
/**
* Run functions queued up by proxy loading snippet
* @private
*/
Amplitude.prototype.runQueuedFunctions = function () {
// run queued up old versions of functions
for (var i = 0; i < this._q.length; i++) {
var fn = this[this._q[i][0]];
if (type(fn) === 'function') {
fn.apply(this, this._q[i].slice(1));
}
}
}.bind(this));
};
this._q = []; // clear function queue after running
/**
* Run functions queued up by proxy loading snippet
* @private
*/
Amplitude.prototype.runQueuedFunctions = function () {
// run queued up old versions of functions
for (var i = 0; i < this._q.length; i++) {
var fn = this[this._q[i][0]];
if (type(fn) === 'function') {
fn.apply(this, this._q[i].slice(1));
// run queued up functions on instances
for (var instance in this._instances) {
if (this._instances.hasOwnProperty(instance)) {
this._instances[instance].runQueuedFunctions();
}
}
}
this._q = []; // clear function queue after running
};
}
// run queued up functions on instances
for (var instance in this._instances) {
if (this._instances.hasOwnProperty(instance)) {
this._instances[instance].runQueuedFunctions();
}
}
};
if (BUILD_COMPAT_2_0) {
/**
* Initializes the Amplitude Javascript SDK with your apiKey and any optional configurations.
* This is required before any other methods can be called.
* @public
* @param {string} apiKey - The API key for your app.
* @param {string} opt_userId - (optional) An identifier for this user.
* @param {object} opt_config - (optional) Configuration options.
* See [Readme]{@link https://github.com/amplitude/Amplitude-Javascript#configuration-options} for list of options and default values.
* @param {function} opt_callback - (optional) Provide a callback function to run after initialization is complete.
* @deprecated Please use amplitude.getInstance().init(apiKey, opt_userId, opt_config, opt_callback);
* @example amplitude.init('API_KEY', 'USER_ID', {includeReferrer: true, includeUtm: true}, function() { alert('init complete'); });
*/
Amplitude.prototype.init = function init(apiKey, opt_userId, opt_config, opt_callback) {
this.getInstance().init(apiKey, opt_userId, opt_config, function(instance) {
// make options such as deviceId available for callback functions
this.options = instance.options;
if (type(opt_callback) === 'function') {
opt_callback(instance);
}
}.bind(this));
};
/**
* Returns true if a new session was created during initialization, otherwise false.
* @public
* @return {boolean} Whether a new session was created during initialization.
* @deprecated Please use amplitude.getInstance().isNewSession();
*/
Amplitude.prototype.isNewSession = function isNewSession() {
return this.getInstance().isNewSession();
};
/**
* Returns true if a new session was created during initialization, otherwise false.
* @public
* @return {boolean} Whether a new session was created during initialization.
* @deprecated Please use amplitude.getInstance().isNewSession();
*/
Amplitude.prototype.isNewSession = function isNewSession() {
return this.getInstance().isNewSession();
};
/**
* Returns the id of the current session.
* @public
* @return {number} Id of the current session.
* @deprecated Please use amplitude.getInstance().getSessionId();
*/
Amplitude.prototype.getSessionId = function getSessionId() {
return this.getInstance().getSessionId();
};
/**
* Returns the id of the current session.
* @public
* @return {number} Id of the current session.
* @deprecated Please use amplitude.getInstance().getSessionId();
*/
Amplitude.prototype.getSessionId = function getSessionId() {
return this.getInstance().getSessionId();
};
/**
* Increments the eventId and returns it.
* @private
*/
Amplitude.prototype.nextEventId = function nextEventId() {
return this.getInstance().nextEventId();
};
/**
* Increments the eventId and returns it.
* @private
*/
Amplitude.prototype.nextEventId = function nextEventId() {
return this.getInstance().nextEventId();
};
/**
* Increments the identifyId and returns it.
* @private
*/
Amplitude.prototype.nextIdentifyId = function nextIdentifyId() {
return this.getInstance().nextIdentifyId();
};
/**
* Increments the identifyId and returns it.
* @private
*/
Amplitude.prototype.nextIdentifyId = function nextIdentifyId() {
return this.getInstance().nextIdentifyId();
};
/**
* Increments the sequenceNumber and returns it.
* @private
*/
Amplitude.prototype.nextSequenceNumber = function nextSequenceNumber() {
return this.getInstance().nextSequenceNumber();
};
/**
* Increments the sequenceNumber and returns it.
* @private
*/
Amplitude.prototype.nextSequenceNumber = function nextSequenceNumber() {
return this.getInstance().nextSequenceNumber();
};
/**
* Saves unsent events and identifies to localStorage. JSON stringifies event queues before saving.
* Note: this is called automatically every time events are logged, unless you explicitly set option saveEvents to false.
* @private
*/
Amplitude.prototype.saveEvents = function saveEvents() {
this.getInstance().saveEvents();
};
/**
* Saves unsent events and identifies to localStorage. JSON stringifies event queues before saving.
* Note: this is called automatically every time events are logged, unless you explicitly set option saveEvents to false.
* @private
*/
Amplitude.prototype.saveEvents = function saveEvents() {
this.getInstance().saveEvents();
};
/**
* Sets a customer domain for the amplitude cookie. Useful if you want to support cross-subdomain tracking.
* @public
* @param {string} domain to set.
* @deprecated Please use amplitude.getInstance().setDomain(domain);
* @example amplitude.setDomain('.amplitude.com');
*/
Amplitude.prototype.setDomain = function setDomain(domain) {
this.getInstance().setDomain(domain);
};
/**
* Sets a customer domain for the amplitude cookie. Useful if you want to support cross-subdomain tracking.
* @public
* @param {string} domain to set.
* @deprecated Please use amplitude.getInstance().setDomain(domain);
* @example amplitude.setDomain('.amplitude.com');
*/
Amplitude.prototype.setDomain = function setDomain(domain) {
this.getInstance().setDomain(domain);
};
/**
* Sets an identifier for the current user.
* @public
* @param {string} userId - identifier to set. Can be null.
* @deprecated Please use amplitude.getInstance().setUserId(userId);
* @example amplitude.setUserId('joe@gmail.com');
*/
Amplitude.prototype.setUserId = function setUserId(userId) {
this.getInstance().setUserId(userId);
};
/**
* Sets an identifier for the current user.
* @public
* @param {string} userId - identifier to set. Can be null.
* @deprecated Please use amplitude.getInstance().setUserId(userId);
* @example amplitude.setUserId('joe@gmail.com');
*/
Amplitude.prototype.setUserId = function setUserId(userId) {
this.getInstance().setUserId(userId);
};
/**
* Add user to a group or groups. You need to specify a groupType and groupName(s).
* For example you can group people by their organization.
* In that case groupType is "orgId" and groupName would be the actual ID(s).
* groupName can be a string or an array of strings to indicate a user in multiple gruups.
* You can also call setGroup multiple times with different groupTypes to track multiple types of groups (up to 5 per app).
* Note: this will also set groupType: groupName as a user property.
* See the [SDK Readme]{@link https://github.com/amplitude/Amplitude-Javascript#setting-groups} for more information.
* @public
* @param {string} groupType - the group type (ex: orgId)
* @param {string|list} groupName - the name of the group (ex: 15), or a list of names of the groups
* @deprecated Please use amplitude.getInstance().setGroup(groupType, groupName);
* @example amplitude.setGroup('orgId', 15); // this adds the current user to orgId 15.
*/
Amplitude.prototype.setGroup = function(groupType, groupName) {
this.getInstance().setGroup(groupType, groupName);
};
/**
* Add user to a group or groups. You need to specify a groupType and groupName(s).
* For example you can group people by their organization.
* In that case groupType is "orgId" and groupName would be the actual ID(s).
* groupName can be a string or an array of strings to indicate a user in multiple gruups.
* You can also call setGroup multiple times with different groupTypes to track multiple types of groups (up to 5 per app).
* Note: this will also set groupType: groupName as a user property.
* See the [SDK Readme]{@link https://github.com/amplitude/Amplitude-Javascript#setting-groups} for more information.
* @public
* @param {string} groupType - the group type (ex: orgId)
* @param {string|list} groupName - the name of the group (ex: 15), or a list of names of the groups
* @deprecated Please use amplitude.getInstance().setGroup(groupType, groupName);
* @example amplitude.setGroup('orgId', 15); // this adds the current user to orgId 15.
*/
Amplitude.prototype.setGroup = function(groupType, groupName) {
this.getInstance().setGroup(groupType, groupName);
};
/**
* Sets whether to opt current user out of tracking.
* @public
* @param {boolean} enable - if true then no events will be logged or sent.
* @deprecated Please use amplitude.getInstance().setOptOut(enable);
* @example: amplitude.setOptOut(true);
*/
Amplitude.prototype.setOptOut = function setOptOut(enable) {
this.getInstance().setOptOut(enable);
};
/**
* Sets whether to opt current user out of tracking.
* @public
* @param {boolean} enable - if true then no events will be logged or sent.
* @deprecated Please use amplitude.getInstance().setOptOut(enable);
* @example: amplitude.setOptOut(true);
*/
Amplitude.prototype.setOptOut = function setOptOut(enable) {
this.getInstance().setOptOut(enable);
};
/**
* Regenerates a new random deviceId for current user. Note: this is not recommended unless you know what you
* are doing. This can be used in conjunction with `setUserId(null)` to anonymize users after they log out.
* With a null userId and a completely new deviceId, the current user would appear as a brand new user in dashboard.
* This uses src/uuid.js to regenerate the deviceId.
* @public
* @deprecated Please use amplitude.getInstance().regenerateDeviceId();
*/
Amplitude.prototype.regenerateDeviceId = function regenerateDeviceId() {
this.getInstance().regenerateDeviceId();
};
/**
* Regenerates a new random deviceId for current user. Note: this is not recommended unless you know what you
* are doing. This can be used in conjunction with `setUserId(null)` to anonymize users after they log out.
* With a null userId and a completely new deviceId, the current user would appear as a brand new user in dashboard.
* This uses src/uuid.js to regenerate the deviceId.
* @public
* @deprecated Please use amplitude.getInstance().regenerateDeviceId();
*/
Amplitude.prototype.regenerateDeviceId = function regenerateDeviceId() {
this.getInstance().regenerateDeviceId();
};
/**
* Sets a custom deviceId for current user. Note: this is not recommended unless you know what you are doing
* (like if you have your own system for managing deviceIds). Make sure the deviceId you set is sufficiently unique
* (we recommend something like a UUID - see src/uuid.js for an example of how to generate) to prevent conflicts with other devices in our system.
* @public
* @param {string} deviceId - custom deviceId for current user.
* @deprecated Please use amplitude.getInstance().setDeviceId(deviceId);
* @example amplitude.setDeviceId('45f0954f-eb79-4463-ac8a-233a6f45a8f0');
*/
Amplitude.prototype.setDeviceId = function setDeviceId(deviceId) {
this.getInstance().setDeviceId(deviceId);
};
/**
* Sets a custom deviceId for current user. Note: this is not recommended unless you know what you are doing
* (like if you have your own system for managing deviceIds). Make sure the deviceId you set is sufficiently unique
* (we recommend something like a UUID - see src/uuid.js for an example of how to generate) to prevent conflicts with other devices in our system.
* @public
* @param {string} deviceId - custom deviceId for current user.
* @deprecated Please use amplitude.getInstance().setDeviceId(deviceId);
* @example amplitude.setDeviceId('45f0954f-eb79-4463-ac8a-233a6f45a8f0');
*/
Amplitude.prototype.setDeviceId = function setDeviceId(deviceId) {
this.getInstance().setDeviceId(deviceId);
};
/**
* Sets user properties for the current user.
* @public
* @param {object} - object with string keys and values for the user properties to set.
* @param {boolean} - DEPRECATED opt_replace: in earlier versions of the JS SDK the user properties object was kept in
* memory and replace = true would replace the object in memory. Now the properties are no longer stored in memory, so replace is deprecated.
* @deprecated Please use amplitude.getInstance.setUserProperties(userProperties);
* @example amplitude.setUserProperties({'gender': 'female', 'sign_up_complete': true})
*/
Amplitude.prototype.setUserProperties = function setUserProperties(userProperties) {
this.getInstance().setUserProperties(userProperties);
};
/**
* Sets user properties for the current user.
* @public
* @param {object} - object with string keys and values for the user properties to set.
* @param {boolean} - DEPRECATED opt_replace: in earlier versions of the JS SDK the user properties object was kept in
* memory and replace = true would replace the object in memory. Now the properties are no longer stored in memory, so replace is deprecated.
* @deprecated Please use amplitude.getInstance.setUserProperties(userProperties);
* @example amplitude.setUserProperties({'gender': 'female', 'sign_up_complete': true})
*/
Amplitude.prototype.setUserProperties = function setUserProperties(userProperties) {
this.getInstance().setUserProperties(userProperties);
};
/**
* Clear all of the user properties for the current user. Note: clearing user properties is irreversible!
* @public
* @deprecated Please use amplitude.getInstance().clearUserProperties();
* @example amplitude.clearUserProperties();
*/
Amplitude.prototype.clearUserProperties = function clearUserProperties(){
this.getInstance().clearUserProperties();
};
/**
* Clear all of the user properties for the current user. Note: clearing user properties is irreversible!
* @public
* @deprecated Please use amplitude.getInstance().clearUserProperties();
* @example amplitude.clearUserProperties();
*/
Amplitude.prototype.clearUserProperties = function clearUserProperties(){
this.getInstance().clearUserProperties();
};
/**
* Send an identify call containing user property operations to Amplitude servers.
* See [Readme]{@link https://github.com/amplitude/Amplitude-Javascript#user-properties-and-user-property-operations}
* for more information on the Identify API and user property operations.
* @param {Identify} identify_obj - the Identify object containing the user property operations to send.
* @param {Amplitude~eventCallback} opt_callback - (optional) callback function to run when the identify event has been sent.
* Note: the server response code and response body from the identify event upload are passed to the callback function.
* @deprecated Please use amplitude.getInstance().identify(identify);
* @example
* var identify = new amplitude.Identify().set('colors', ['rose', 'gold']).add('karma', 1).setOnce('sign_up_date', '2016-03-31');
* amplitude.identify(identify);
*/
Amplitude.prototype.identify = function(identify_obj, opt_callback) {
this.getInstance().identify(identify_obj, opt_callback);
};
/**
* Send an identify call containing user property operations to Amplitude servers.
* See [Readme]{@link https://github.com/amplitude/Amplitude-Javascript#user-properties-and-user-property-operations}
* for more information on the Identify API and user property operations.
* @param {Identify} identify_obj - the Identify object containing the user property operations to send.
* @param {Amplitude~eventCallback} opt_callback - (optional) callback function to run when the identify event has been sent.
* Note: the server response code and response body from the identify event upload are passed to the callback function.
* @deprecated Please use amplitude.getInstance().identify(identify);
* @example
* var identify = new amplitude.Identify().set('colors', ['rose', 'gold']).add('karma', 1).setOnce('sign_up_date', '2016-03-31');
* amplitude.identify(identify);
*/
Amplitude.prototype.identify = function(identify_obj, opt_callback) {
this.getInstance().identify(identify_obj, opt_callback);
};
/**
* Set a versionName for your application.
* @public
* @param {string} versionName - The version to set for your application.
* @deprecated Please use amplitude.getInstance().setVersionName(versionName);
* @example amplitude.setVersionName('1.12.3');
*/
Amplitude.prototype.setVersionName = function setVersionName(versionName) {
this.getInstance().setVersionName(versionName);
};
/**
* Set a versionName for your application.
* @public
* @param {string} versionName - The version to set for your application.
* @deprecated Please use amplitude.getInstance().setVersionName(versionName);
* @example amplitude.setVersionName('1.12.3');
*/
Amplitude.prototype.setVersionName = function setVersionName(versionName) {
this.getInstance().setVersionName(versionName);
};
/**
* This is the callback for logEvent and identify calls. It gets called after the event/identify is uploaded,
* and the server response code and response body from the upload request are passed to the callback function.
* @callback Amplitude~eventCallback
* @param {number} responseCode - Server response code for the event / identify upload request.
* @param {string} responseBody - Server response body for the event / identify upload request.
*/
/**
* This is the callback for logEvent and identify calls. It gets called after the event/identify is uploaded,
* and the server response code and response body from the upload request are passed to the callback function.
* @callback Amplitude~eventCallback
* @param {number} responseCode - Server response code for the event / identify upload request.
* @param {string} responseBody - Server response body for the event / identify upload request.
*/
/**
* Log an event with eventType and eventProperties
* @public
* @param {string} eventType - name of event
* @param {object} eventProperties - (optional) an object with string keys and values for the event properties.
* @param {Amplitude~eventCallback} opt_callback - (optional) a callback function to run after the event is logged.
* Note: the server response code and response body from the event upload are passed to the callback function.
* @deprecated Please use amplitude.getInstance().logEvent(eventType, eventProperties, opt_callback);
* @example amplitude.logEvent('Clicked Homepage Button', {'finished_flow': false, 'clicks': 15});
*/
Amplitude.prototype.logEvent = function logEvent(eventType, eventProperties, opt_callback) {
return this.getInstance().logEvent(eventType, eventProperties, opt_callback);
};
/**
* Log an event with eventType and eventProperties
* @public
* @param {string} eventType - name of event
* @param {object} eventProperties - (optional) an object with string keys and values for the event properties.
* @param {Amplitude~eventCallback} opt_callback - (optional) a callback function to run after the event is logged.
* Note: the server response code and response body from the event upload are passed to the callback function.
* @deprecated Please use amplitude.getInstance().logEvent(eventType, eventProperties, opt_callback);
* @example amplitude.logEvent('Clicked Homepage Button', {'finished_flow': false, 'clicks': 15});
*/
Amplitude.prototype.logEvent = function logEvent(eventType, eventProperties, opt_callback) {
return this.getInstance().logEvent(eventType, eventProperties, opt_callback);
};
/**
* Log an event with eventType, eventProperties, and groups. Use this to set event-level groups.
* Note: the group(s) set only apply for the specific event type being logged and does not persist on the user
* (unless you explicitly set it with setGroup).
* See the [SDK Readme]{@link https://github.com/amplitude/Amplitude-Javascript#setting-groups} for more information
* about groups and Count by Distinct on the Amplitude platform.
* @public
* @param {string} eventType - name of event
* @param {object} eventProperties - (optional) an object with string keys and values for the event properties.
* @param {object} groups - (optional) an object with string groupType: groupName values for the event being logged.
* groupName can be a string or an array of strings.
* @param {Amplitude~eventCallback} opt_callback - (optional) a callback function to run after the event is logged.
* Note: the server response code and response body from the event upload are passed to the callback function.
* Deprecated Please use amplitude.getInstance().logEventWithGroups(eventType, eventProperties, groups, opt_callback);
* @example amplitude.logEventWithGroups('Clicked Button', null, {'orgId': 24});
*/
Amplitude.prototype.logEventWithGroups = function(eventType, eventProperties, groups, opt_callback) {
return this.getInstance().logEventWithGroups(eventType, eventProperties, groups, opt_callback);
};
/**
* Log an event with eventType, eventProperties, and groups. Use this to set event-level groups.
* Note: the group(s) set only apply for the specific event type being logged and does not persist on the user
* (unless you explicitly set it with setGroup).
* See the [SDK Readme]{@link https://github.com/amplitude/Amplitude-Javascript#setting-groups} for more information
* about groups and Count by Distinct on the Amplitude platform.
* @public
* @param {string} eventType - name of event
* @param {object} eventProperties - (optional) an object with string keys and values for the event properties.
* @param {object} groups - (optional) an object with string groupType: groupName values for the event being logged.
* groupName can be a string or an array of strings.
* @param {Amplitude~eventCallback} opt_callback - (optional) a callback function to run after the event is logged.
* Note: the server response code and response body from the event upload are passed to the callback function.
* Deprecated Please use amplitude.getInstance().logEventWithGroups(eventType, eventProperties, groups, opt_callback);
* @example amplitude.logEventWithGroups('Clicked Button', null, {'orgId': 24});
*/
Amplitude.prototype.logEventWithGroups = function(eventType, eventProperties, groups, opt_callback) {
return this.getInstance().logEventWithGroups(eventType, eventProperties, groups, opt_callback);
};
/**
* Log revenue with Revenue interface. The new revenue interface allows for more revenue fields like
* revenueType and event properties.
* See [Readme]{@link https://github.com/amplitude/Amplitude-Javascript#tracking-revenue}
* for more information on the Revenue interface and logging revenue.
* @public
* @param {Revenue} revenue_obj - the revenue object containing the revenue data being logged.
* @deprecated Please use amplitude.getInstance().logRevenueV2(revenue_obj);
* @example var revenue = new amplitude.Revenue().setProductId('productIdentifier').setPrice(10.99);
* amplitude.logRevenueV2(revenue);
*/
Amplitude.prototype.logRevenueV2 = function logRevenueV2(revenue_obj) {
return this.getInstance().logRevenueV2(revenue_obj);
};
/**
* Log revenue with Revenue interface. The new revenue interface allows for more revenue fields like
* revenueType and event properties.
* See [Readme]{@link https://github.com/amplitude/Amplitude-Javascript#tracking-revenue}
* for more information on the Revenue interface and logging revenue.
* @public
* @param {Revenue} revenue_obj - the revenue object containing the revenue data being logged.
* @deprecated Please use amplitude.getInstance().logRevenueV2(revenue_obj);
* @example var revenue = new amplitude.Revenue().setProductId('productIdentifier').setPrice(10.99);
* amplitude.logRevenueV2(revenue);
*/
Amplitude.prototype.logRevenueV2 = function logRevenueV2(revenue_obj) {
return this.getInstance().logRevenueV2(revenue_obj);
};
/**
* Log revenue event with a price, quantity, and product identifier. DEPRECATED - use logRevenueV2
* @public
* @param {number} price - price of revenue event
* @param {number} quantity - (optional) quantity of products in revenue event. If no quantity specified default to 1.
* @param {string} product - (optional) product identifier
* @deprecated Please use amplitude.getInstance().logRevenueV2(revenue_obj);
* @example amplitude.logRevenue(3.99, 1, 'product_1234');
*/
Amplitude.prototype.logRevenue = function logRevenue(price, quantity, product) {
return this.getInstance().logRevenue(price, quantity, product);
};
/**
* Log revenue event with a price, quantity, and product identifier. DEPRECATED - use logRevenueV2
* @public
* @param {number} price - price of revenue event
* @param {number} quantity - (optional) quantity of products in revenue event. If no quantity specified default to 1.
* @param {string} product - (optional) product identifier
* @deprecated Please use amplitude.getInstance().logRevenueV2(revenue_obj);
* @example amplitude.logRevenue(3.99, 1, 'product_1234');
*/
Amplitude.prototype.logRevenue = function logRevenue(price, quantity, product) {
return this.getInstance().logRevenue(price, quantity, product);
};
/**
* Remove events in storage with event ids up to and including maxEventId.
* @private
*/
Amplitude.prototype.removeEvents = function removeEvents(maxEventId, maxIdentifyId) {
this.getInstance().removeEvents(maxEventId, maxIdentifyId);
};
/**
* Remove events in storage with event ids up to and including maxEventId.
* @private
*/
Amplitude.prototype.removeEvents = function removeEvents(maxEventId, maxIdentifyId) {
this.getInstance().removeEvents(maxEventId, maxIdentifyId);
};
/**
* Send unsent events. Note: this is called automatically after events are logged if option batchEvents is false.
* If batchEvents is true, then events are only sent when batch criterias are met.
* @private
* @param {Amplitude~eventCallback} callback - (optional) callback to run after events are sent.
* Note the server response code and response body are passed to the callback as input arguments.
*/
Amplitude.prototype.sendEvents = function sendEvents(callback) {
this.getInstance().sendEvents(callback);
};
/**
* Send unsent events. Note: this is called automatically after events are logged if option batchEvents is false.
* If batchEvents is true, then events are only sent when batch criterias are met.
* @private
* @param {Amplitude~eventCallback} callback - (optional) callback to run after events are sent.
* Note the server response code and response body are passed to the callback as input arguments.
*/
Amplitude.prototype.sendEvents = function sendEvents(callback) {
this.getInstance().sendEvents(callback);
};
/**
* Set global user properties. Note this is deprecated, and we recommend using setUserProperties
* @public
* @deprecated
*/
Amplitude.prototype.setGlobalUserProperties = function setGlobalUserProperties(userProperties) {
this.getInstance().setUserProperties(userProperties);
};
/**
* Set global user properties. Note this is deprecated, and we recommend using setUserProperties
* @public
* @deprecated
*/
Amplitude.prototype.setGlobalUserProperties = function setGlobalUserProperties(userProperties) {
this.getInstance().setUserProperties(userProperties);
};
}

@@ -361,0 +364,0 @@ /**

@@ -39,2 +39,5 @@ const get = (name) => {

}
if (opts.secure) {
str += '; Secure';
}
document.cookie = str;

@@ -41,0 +44,0 @@ };

@@ -72,2 +72,3 @@ /*

_options.expirationDays = opts.expirationDays;
_options.secure = opts.secure;

@@ -74,0 +75,0 @@ var domain = (!utils.isEmptyString(opts.domain)) ? opts.domain : '.' + topDomain(getLocation().href);

@@ -45,3 +45,4 @@ /* jshint -W020, unused: false, noempty: false, boss: true */

expirationDays: undefined,
domain: undefined
domain: undefined,
secure: false,
},

@@ -51,3 +52,4 @@ reset: function() {

expirationDays: undefined,
domain: undefined
domain: undefined,
secure: false,
};

@@ -63,3 +65,3 @@ },

this._options.domain = opts.domain || this._options.domain || window.location.hostname;
return this._options;
return this._options.secure = opts.secure || false;
},

@@ -66,0 +68,0 @@ get: function(name) {

/* jshint expr:true */
import 'json3';
import Amplitude from './amplitude';

@@ -4,0 +3,0 @@

@@ -6,97 +6,104 @@ /* jshint -W020, unused: false, noempty: false, boss: true */

*/
var localStorage; // jshint ignore:line
// test that Window.localStorage is available and works
function windowLocalStorageAvailable() {
var uid = new Date();
var result;
try {
window.localStorage.setItem(uid, uid);
result = window.localStorage.getItem(uid) === String(uid);
window.localStorage.removeItem(uid);
return result;
} catch (e) {
// localStorage not available
}
return false;
if (!BUILD_COMPAT_LOCAL_STORAGE) {
localStorage = window.localStorage;
}
if (windowLocalStorageAvailable()) {
localStorage = window.localStorage;
} else if (window.globalStorage) {
// Firefox 2-3 use globalStorage
// See https://developer.mozilla.org/en/dom/storage#globalStorage
try {
localStorage = window.globalStorage[window.location.hostname];
} catch (e) {
// Something bad happened...
if (BUILD_COMPAT_LOCAL_STORAGE) {
var localStorage; // jshint ignore:line
// test that Window.localStorage is available and works
const windowLocalStorageAvailable = () => {
var uid = new Date();
var result;
try {
window.localStorage.setItem(uid, uid);
result = window.localStorage.getItem(uid) === String(uid);
window.localStorage.removeItem(uid);
return result;
} catch (e) {
// localStorage not available
}
return false;
};
if (windowLocalStorageAvailable()) {
localStorage = window.localStorage;
} else if (window.globalStorage) {
// Firefox 2-3 use globalStorage
// See https://developer.mozilla.org/en/dom/storage#globalStorage
try {
localStorage = window.globalStorage[window.location.hostname];
} catch (e) {
// Something bad happened...
}
} else {
// IE 5-7 use userData
// See http://msdn.microsoft.com/en-us/library/ms531424(v=vs.85).aspx
var div = document.createElement('div'),
attrKey = 'localStorage';
div.style.display = 'none';
document.getElementsByTagName('head')[0].appendChild(div);
if (div.addBehavior) {
div.addBehavior('#default#userdata');
localStorage = {
length: 0,
setItem: function(k, v) {
div.load(attrKey);
if (!div.getAttribute(k)) {
this.length++;
}
div.setAttribute(k, v);
div.save(attrKey);
},
getItem: function(k) {
div.load(attrKey);
return div.getAttribute(k);
},
removeItem: function(k) {
div.load(attrKey);
if (div.getAttribute(k)) {
this.length--;
}
div.removeAttribute(k);
div.save(attrKey);
},
clear: function() {
div.load(attrKey);
var i = 0;
var attr;
while (attr = div.XMLDocument.documentElement.attributes[i++]) {
div.removeAttribute(attr.name);
}
div.save(attrKey);
this.length = 0;
},
key: function(k) {
div.load(attrKey);
return div.XMLDocument.documentElement.attributes[k];
}
};
div.load(attrKey);
localStorage.length = div.XMLDocument.documentElement.attributes.length;
} else {
/* Nothing we can do ... */
}
}
} else {
// IE 5-7 use userData
// See http://msdn.microsoft.com/en-us/library/ms531424(v=vs.85).aspx
var div = document.createElement('div'),
attrKey = 'localStorage';
div.style.display = 'none';
document.getElementsByTagName('head')[0].appendChild(div);
if (div.addBehavior) {
div.addBehavior('#default#userdata');
if (!localStorage) {
localStorage = {
length: 0,
setItem: function(k, v) {
div.load(attrKey);
if (!div.getAttribute(k)) {
this.length++;
}
div.setAttribute(k, v);
div.save(attrKey);
},
getItem: function(k) {
div.load(attrKey);
return div.getAttribute(k);
},
removeItem: function(k) {
div.load(attrKey);
if (div.getAttribute(k)) {
this.length--;
}
div.removeAttribute(k);
div.save(attrKey);
},
clear: function() {
div.load(attrKey);
var i = 0;
var attr;
while (attr = div.XMLDocument.documentElement.attributes[i++]) {
div.removeAttribute(attr.name);
}
div.save(attrKey);
this.length = 0;
},
key: function(k) {
div.load(attrKey);
return div.XMLDocument.documentElement.attributes[k];
}
};
div.load(attrKey);
localStorage.length = div.XMLDocument.documentElement.attributes.length;
} else {
/* Nothing we can do ... */
}
}
if (!localStorage) {
localStorage = {
length: 0,
setItem: function(k, v) {
},
getItem: function(k) {
},
removeItem: function(k) {
},
clear: function() {
},
key: function(k) {
}
};
}
export default localStorage;

@@ -24,2 +24,3 @@ import language from './language';

saveParamsReferrerOncePerSession: true,
secureCookie: false,
sessionTimeout: 30 * 60 * 1000,

@@ -26,0 +27,0 @@ trackingOptions: {

@@ -1,1 +0,1 @@

export default '4.6.0-beta.1';
export default '4.6.0';

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc