-
Notifications
You must be signed in to change notification settings - Fork 0
/
popup.js
11 lines (11 loc) · 83.3 KB
/
popup.js
1
2
3
4
5
6
7
8
9
10
11
!function(e){"function"==typeof define&&define.amd?define(e):e()}((function(){"use strict";class e extends Error{constructor(e,t=""){super(t),this.status=e,this.error=t,this.message=`InstagramError ${e}: ${t.response?t.response.message:t.message}`,this.response=t.response}}class t extends Error{constructor(e){super(e),this.message=e||"TimeoutError: Extension may be not installed or configured incorrectly. Try reinstalling"}}const n=new class{constructor(){this.isStopped=!1,this.isConnected=!1,this.init=async()=>{try{const e=await this.request({method:"ping"});console.log("ping",e),this.isConnected="ok"===e.status&&Boolean(e.pong)}catch(e){if(e instanceof t)return void(this.isConnected=!1);throw e}},this.start=()=>this.isStopped=!1,this.kill=()=>this.isStopped=!0}request(n){return new Promise((r,i)=>{if(this.isStopped)return i(new Error("Request was killed"));const o=Date.now(),s=(t,a)=>{const{status:u,error:c}=t;t.req_id&&o!==t.req_id||(chrome.runtime.onMessage&&chrome.runtime.onMessage.removeListener(s),console.log("request",n.method,"->",u,t),console.log(u,c),"ok"!==u?i(new e(u,c)):r(t))};setTimeout(()=>i(new t),1e4),chrome.runtime.onMessage&&chrome.runtime.onMessage.addListener(s),console.log("send_message",null,{req_id:o,...n}),chrome.runtime.sendMessage(null,{req_id:o,...n})})}};window.instagram=n;const r=(e,t)=>new Promise((n,r)=>{chrome.storage.local.set({credentials:{username:e,password:t}},()=>{n({username:e,password:t})}),setTimeout(()=>r("storage error"),5e3)}),i=()=>new Promise((e,t)=>{chrome.storage.local.get(["credentials"],t=>{e(t.credentials)}),setTimeout(()=>t("storage error"),5e3)}),o=()=>new Promise((e,t)=>{chrome.storage.local.set({credentials:null},t=>{e(t)}),setTimeout(()=>t("storage error"),5e3)});window.saveCredentials=r,window.getCredentials=i,window.clearCredentials=o;var s="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},a=[],u=[],c="undefined"!=typeof Uint8Array?Uint8Array:Array,l=!1;function p(){l=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0,n=e.length;t<n;++t)a[t]=e[t],u[e.charCodeAt(t)]=t;u["-".charCodeAt(0)]=62,u["_".charCodeAt(0)]=63}function f(e,t,n){for(var r,i,o=[],s=t;s<n;s+=3)r=(e[s]<<16)+(e[s+1]<<8)+e[s+2],o.push(a[(i=r)>>18&63]+a[i>>12&63]+a[i>>6&63]+a[63&i]);return o.join("")}function d(e){var t;l||p();for(var n=e.length,r=n%3,i="",o=[],s=0,u=n-r;s<u;s+=16383)o.push(f(e,s,s+16383>u?u:s+16383));return 1===r?(t=e[n-1],i+=a[t>>2],i+=a[t<<4&63],i+="=="):2===r&&(t=(e[n-2]<<8)+e[n-1],i+=a[t>>10],i+=a[t>>4&63],i+=a[t<<2&63],i+="="),o.push(i),o.join("")}function h(e,t,n,r,i){var o,s,a=8*i-r-1,u=(1<<a)-1,c=u>>1,l=-7,p=n?i-1:0,f=n?-1:1,d=e[t+p];for(p+=f,o=d&(1<<-l)-1,d>>=-l,l+=a;l>0;o=256*o+e[t+p],p+=f,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=r;l>0;s=256*s+e[t+p],p+=f,l-=8);if(0===o)o=1-c;else{if(o===u)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,r),o-=c}return(d?-1:1)*s*Math.pow(2,o-r)}function g(e,t,n,r,i,o){var s,a,u,c=8*o-i-1,l=(1<<c)-1,p=l>>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:o-1,h=r?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=l):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),(t+=s+p>=1?f/u:f*Math.pow(2,1-p))*u>=2&&(s++,u/=2),s+p>=l?(a=0,s=l):s+p>=1?(a=(t*u-1)*Math.pow(2,i),s+=p):(a=t*Math.pow(2,p-1)*Math.pow(2,i),s=0));i>=8;e[n+d]=255&a,d+=h,a/=256,i-=8);for(s=s<<i|a,c+=i;c>0;e[n+d]=255&s,d+=h,s/=256,c-=8);e[n+d-h]|=128*g}var v={}.toString,y=Array.isArray||function(e){return"[object Array]"==v.call(e)};function m(){return _.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function w(e,t){if(m()<t)throw new RangeError("Invalid typed array length");return _.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=_.prototype:(null===e&&(e=new _(t)),e.length=t),e}function _(e,t,n){if(!(_.TYPED_ARRAY_SUPPORT||this instanceof _))return new _(e,t,n);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return E(this,e)}return b(this,e,t,n)}function b(e,t,n,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,n,r){if(t.byteLength,n<0||t.byteLength<n)throw new RangeError("'offset' is out of bounds");if(t.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");t=void 0===n&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,n):new Uint8Array(t,n,r);_.TYPED_ARRAY_SUPPORT?(e=t).__proto__=_.prototype:e=S(e,t);return e}(e,t,n,r):"string"==typeof t?function(e,t,n){"string"==typeof n&&""!==n||(n="utf8");if(!_.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|R(t,n),i=(e=w(e,r)).write(t,n);i!==r&&(e=e.slice(0,i));return e}(e,t,n):function(e,t){if(O(t)){var n=0|A(t.length);return 0===(e=w(e,n)).length||t.copy(e,0,0,n),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(r=t.length)!=r?w(e,0):S(e,t);if("Buffer"===t.type&&y(t.data))return S(e,t.data)}var r;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function I(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function E(e,t){if(I(t),e=w(e,t<0?0:0|A(t)),!_.TYPED_ARRAY_SUPPORT)for(var n=0;n<t;++n)e[n]=0;return e}function S(e,t){var n=t.length<0?0:0|A(t.length);e=w(e,n);for(var r=0;r<n;r+=1)e[r]=255&t[r];return e}function A(e){if(e>=m())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+m().toString(16)+" bytes");return 0|e}function O(e){return!(null==e||!e._isBuffer)}function R(e,t){if(O(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return Z(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return ee(e).length;default:if(r)return Z(e).length;t=(""+t).toLowerCase(),r=!0}}function T(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return Y(this,t,n);case"utf8":case"utf-8":return M(this,t,n);case"ascii":return L(this,t,n);case"latin1":case"binary":return z(this,t,n);case"base64":return B(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return F(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function x(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function P(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=_.from(t,r)),O(t))return 0===t.length?-1:k(e,t,n,r,i);if("number"==typeof t)return t&=255,_.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):k(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function k(e,t,n,r,i){var o,s=1,a=e.length,u=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;s=2,a/=2,u/=2,n/=2}function c(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var l=-1;for(o=n;o<a;o++)if(c(e,o)===c(t,-1===l?0:o-l)){if(-1===l&&(l=o),o-l+1===u)return l*s}else-1!==l&&(o-=o-l),l=-1}else for(n+u>a&&(n=a-u),o=n;o>=0;o--){for(var p=!0,f=0;f<u;f++)if(c(e,o+f)!==c(t,f)){p=!1;break}if(p)return o}return-1}function N(e,t,n,r){n=Number(n)||0;var i=e.length-n;r?(r=Number(r))>i&&(r=i):r=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var s=0;s<r;++s){var a=parseInt(t.substr(2*s,2),16);if(isNaN(a))return s;e[n+s]=a}return s}function C(e,t,n,r){return te(Z(t,e.length-n),e,n,r)}function q(e,t,n,r){return te(function(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function U(e,t,n,r){return q(e,t,n,r)}function D(e,t,n,r){return te(ee(t),e,n,r)}function j(e,t,n,r){return te(function(e,t){for(var n,r,i,o=[],s=0;s<e.length&&!((t-=2)<0);++s)n=e.charCodeAt(s),r=n>>8,i=n%256,o.push(i),o.push(r);return o}(t,e.length-n),e,n,r)}function B(e,t,n){return 0===t&&n===e.length?d(e):d(e.slice(t,n))}function M(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i<n;){var o,s,a,u,c=e[i],l=null,p=c>239?4:c>223?3:c>191?2:1;if(i+p<=n)switch(p){case 1:c<128&&(l=c);break;case 2:128==(192&(o=e[i+1]))&&(u=(31&c)<<6|63&o)>127&&(l=u);break;case 3:o=e[i+1],s=e[i+2],128==(192&o)&&128==(192&s)&&(u=(15&c)<<12|(63&o)<<6|63&s)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:o=e[i+1],s=e[i+2],a=e[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(u=(15&c)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(l=u)}null===l?(l=65533,p=1):l>65535&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|1023&l),r.push(l),i+=p}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);var n="",r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=4096));return n}(r)}_.TYPED_ARRAY_SUPPORT=void 0===s.TYPED_ARRAY_SUPPORT||s.TYPED_ARRAY_SUPPORT,_.poolSize=8192,_._augment=function(e){return e.__proto__=_.prototype,e},_.from=function(e,t,n){return b(null,e,t,n)},_.TYPED_ARRAY_SUPPORT&&(_.prototype.__proto__=Uint8Array.prototype,_.__proto__=Uint8Array),_.alloc=function(e,t,n){return function(e,t,n,r){return I(t),t<=0?w(e,t):void 0!==n?"string"==typeof r?w(e,t).fill(n,r):w(e,t).fill(n):w(e,t)}(null,e,t,n)},_.allocUnsafe=function(e){return E(null,e)},_.allocUnsafeSlow=function(e){return E(null,e)},_.isBuffer=function(e){return null!=e&&(!!e._isBuffer||ne(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&ne(e.slice(0,0))}(e))},_.compare=function(e,t){if(!O(e)||!O(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,i=0,o=Math.min(n,r);i<o;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:r<n?1:0},_.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},_.concat=function(e,t){if(!y(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return _.alloc(0);var n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var r=_.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){var o=e[n];if(!O(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(r,i),i+=o.length}return r},_.byteLength=R,_.prototype._isBuffer=!0,_.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)x(this,t,t+1);return this},_.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)x(this,t,t+3),x(this,t+1,t+2);return this},_.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)x(this,t,t+7),x(this,t+1,t+6),x(this,t+2,t+5),x(this,t+3,t+4);return this},_.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?M(this,0,e):T.apply(this,arguments)},_.prototype.equals=function(e){if(!O(e))throw new TypeError("Argument must be a Buffer");return this===e||0===_.compare(this,e)},_.prototype.inspect=function(){var e="";return this.length>0&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(e+=" ... ")),"<Buffer "+e+">"},_.prototype.compare=function(e,t,n,r,i){if(!O(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(r>>>=0),s=(n>>>=0)-(t>>>=0),a=Math.min(o,s),u=this.slice(r,i),c=e.slice(t,n),l=0;l<a;++l)if(u[l]!==c[l]){o=u[l],s=c[l];break}return o<s?-1:s<o?1:0},_.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},_.prototype.indexOf=function(e,t,n){return P(this,e,t,n,!0)},_.prototype.lastIndexOf=function(e,t,n){return P(this,e,t,n,!1)},_.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(n)?(n|=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return N(this,e,t,n);case"utf8":case"utf-8":return C(this,e,t,n);case"ascii":return q(this,e,t,n);case"latin1":case"binary":return U(this,e,t,n);case"base64":return D(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return j(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},_.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function L(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(127&e[i]);return r}function z(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function Y(e,t,n){var r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);for(var i="",o=t;o<n;++o)i+=H(e[o]);return i}function F(e,t,n){for(var r=e.slice(t,n),i="",o=0;o<r.length;o+=2)i+=String.fromCharCode(r[o]+256*r[o+1]);return i}function G(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function K(e,t,n,r,i,o){if(!O(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function V(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-n,2);i<o;++i)e[n+i]=(t&255<<8*(r?i:1-i))>>>8*(r?i:1-i)}function W(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-n,4);i<o;++i)e[n+i]=t>>>8*(r?i:3-i)&255}function $(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function J(e,t,n,r,i){return i||$(e,0,n,4),g(e,t,n,r,23,4),n+4}function Q(e,t,n,r,i){return i||$(e,0,n,8),g(e,t,n,r,52,8),n+8}_.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e),_.TYPED_ARRAY_SUPPORT)(n=this.subarray(e,t)).__proto__=_.prototype;else{var i=t-e;n=new _(i,void 0);for(var o=0;o<i;++o)n[o]=this[o+e]}return n},_.prototype.readUIntLE=function(e,t,n){e|=0,t|=0,n||G(e,t,this.length);for(var r=this[e],i=1,o=0;++o<t&&(i*=256);)r+=this[e+o]*i;return r},_.prototype.readUIntBE=function(e,t,n){e|=0,t|=0,n||G(e,t,this.length);for(var r=this[e+--t],i=1;t>0&&(i*=256);)r+=this[e+--t]*i;return r},_.prototype.readUInt8=function(e,t){return t||G(e,1,this.length),this[e]},_.prototype.readUInt16LE=function(e,t){return t||G(e,2,this.length),this[e]|this[e+1]<<8},_.prototype.readUInt16BE=function(e,t){return t||G(e,2,this.length),this[e]<<8|this[e+1]},_.prototype.readUInt32LE=function(e,t){return t||G(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},_.prototype.readUInt32BE=function(e,t){return t||G(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},_.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||G(e,t,this.length);for(var r=this[e],i=1,o=0;++o<t&&(i*=256);)r+=this[e+o]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*t)),r},_.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||G(e,t,this.length);for(var r=t,i=1,o=this[e+--r];r>0&&(i*=256);)o+=this[e+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},_.prototype.readInt8=function(e,t){return t||G(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},_.prototype.readInt16LE=function(e,t){t||G(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},_.prototype.readInt16BE=function(e,t){t||G(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},_.prototype.readInt32LE=function(e,t){return t||G(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},_.prototype.readInt32BE=function(e,t){return t||G(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},_.prototype.readFloatLE=function(e,t){return t||G(e,4,this.length),h(this,e,!0,23,4)},_.prototype.readFloatBE=function(e,t){return t||G(e,4,this.length),h(this,e,!1,23,4)},_.prototype.readDoubleLE=function(e,t){return t||G(e,8,this.length),h(this,e,!0,52,8)},_.prototype.readDoubleBE=function(e,t){return t||G(e,8,this.length),h(this,e,!1,52,8)},_.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||K(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[t]=255&e;++o<n&&(i*=256);)this[t+o]=e/i&255;return t+n},_.prototype.writeUIntBE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||K(this,e,t,n,Math.pow(2,8*n)-1,0);var i=n-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+n},_.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||K(this,e,t,1,255,0),_.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},_.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||K(this,e,t,2,65535,0),_.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):V(this,e,t,!0),t+2},_.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||K(this,e,t,2,65535,0),_.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):V(this,e,t,!1),t+2},_.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||K(this,e,t,4,4294967295,0),_.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):W(this,e,t,!0),t+4},_.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||K(this,e,t,4,4294967295,0),_.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):W(this,e,t,!1),t+4},_.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);K(this,e,t,n,i-1,-i)}var o=0,s=1,a=0;for(this[t]=255&e;++o<n&&(s*=256);)e<0&&0===a&&0!==this[t+o-1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+n},_.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);K(this,e,t,n,i-1,-i)}var o=n-1,s=1,a=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+n},_.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||K(this,e,t,1,127,-128),_.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},_.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||K(this,e,t,2,32767,-32768),_.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):V(this,e,t,!0),t+2},_.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||K(this,e,t,2,32767,-32768),_.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):V(this,e,t,!1),t+2},_.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||K(this,e,t,4,2147483647,-2147483648),_.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):W(this,e,t,!0),t+4},_.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||K(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),_.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):W(this,e,t,!1),t+4},_.prototype.writeFloatLE=function(e,t,n){return J(this,e,t,!0,n)},_.prototype.writeFloatBE=function(e,t,n){return J(this,e,t,!1,n)},_.prototype.writeDoubleLE=function(e,t,n){return Q(this,e,t,!0,n)},_.prototype.writeDoubleBE=function(e,t,n){return Q(this,e,t,!1,n)},_.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);var i,o=r-n;if(this===e&&n<t&&t<r)for(i=o-1;i>=0;--i)e[i+t]=this[i+n];else if(o<1e3||!_.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)e[i+t]=this[i+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+o),t);return o},_.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),1===e.length){var i=e.charCodeAt(0);i<256&&(e=i)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!_.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;var o;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(o=t;o<n;++o)this[o]=e;else{var s=O(e)?e:Z(new _(e,r).toString()),a=s.length;for(o=0;o<n-t;++o)this[o+t]=s[o%a]}return this};var X=/[^+\/0-9A-Za-z-_]/g;function H(e){return e<16?"0"+e.toString(16):e.toString(16)}function Z(e,t){var n;t=t||1/0;for(var r=e.length,i=null,o=[],s=0;s<r;++s){if((n=e.charCodeAt(s))>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function ee(e){return function(e){var t,n,r,i,o,s;l||p();var a=e.length;if(a%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o="="===e[a-2]?2:"="===e[a-1]?1:0,s=new c(3*a/4-o),r=o>0?a-4:a;var f=0;for(t=0,n=0;t<r;t+=4,n+=3)i=u[e.charCodeAt(t)]<<18|u[e.charCodeAt(t+1)]<<12|u[e.charCodeAt(t+2)]<<6|u[e.charCodeAt(t+3)],s[f++]=i>>16&255,s[f++]=i>>8&255,s[f++]=255&i;return 2===o?(i=u[e.charCodeAt(t)]<<2|u[e.charCodeAt(t+1)]>>4,s[f++]=255&i):1===o&&(i=u[e.charCodeAt(t)]<<10|u[e.charCodeAt(t+1)]<<4|u[e.charCodeAt(t+2)]>>2,s[f++]=i>>8&255,s[f++]=255&i),s}(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(X,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function te(e,t,n,r){for(var i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function ne(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}var re="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};const ie=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e,t){e.exports=function(){function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function t(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function n(e){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{},i=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),i.forEach((function(n){t(e,n,r[n])}))}return e}var r="$default_instance",i=2,o=4096,s=1e3,a="$identify",u="$groupidentify",c="amplitude_lastEventId",l="amplitude_lastEventTime",p="amplitude_lastIdentifyId",f="amplitude_lastSequenceNumber",d="amplitude_sessionId",h="amplitude_deviceId",g="amplitude_optOut",v="amplitude_userId",y="amplitude_cookie_test",m="revenue_amount",w="$productId",b="$quantity",I="$price",E="$revenueType",S="amp_device_id",A="referrer",O="utm_source",R="utm_medium",T="utm_campaign",x="utm_term",P="utm_content",k=function(e){for(var t="",n=0;n<e.length;n++){var r=e.charCodeAt(n);r<128?t+=String.fromCharCode(r):r>127&&r<2048?(t+=String.fromCharCode(r>>6|192),t+=String.fromCharCode(63&r|128)):(t+=String.fromCharCode(r>>12|224),t+=String.fromCharCode(r>>6&63|128),t+=String.fromCharCode(63&r|128))}return t},N=function(e){for(var t="",n=0,r=0,i=0,o=0;n<e.length;)(r=e.charCodeAt(n))<128?(t+=String.fromCharCode(r),n++):r>191&&r<224?(i=e.charCodeAt(n+1),t+=String.fromCharCode((31&r)<<6|63&i),n+=2):(i=e.charCodeAt(n+1),o=e.charCodeAt(n+2),t+=String.fromCharCode((15&r)<<12|(63&i)<<6|63&o),n+=3);return t},C={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(e){try{if(window.btoa&&window.atob)return window.btoa(unescape(encodeURIComponent(e)))}catch(e){}return C._encode(e)},_encode:function(e){var t,n,r,i,o,s,a,u="",c=0;for(e=k(e);c<e.length;)i=(t=e.charCodeAt(c++))>>2,o=(3&t)<<4|(n=e.charCodeAt(c++))>>4,s=(15&n)<<2|(r=e.charCodeAt(c++))>>6,a=63&r,isNaN(n)?s=a=64:isNaN(r)&&(a=64),u=u+C._keyStr.charAt(i)+C._keyStr.charAt(o)+C._keyStr.charAt(s)+C._keyStr.charAt(a);return u},decode:function(e){try{if(window.btoa&&window.atob)return decodeURIComponent(escape(window.atob(e)))}catch(e){}return C._decode(e)},_decode:function(e){var t,n,r,i,o,s,a="",u=0;for(e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");u<e.length;)t=C._keyStr.indexOf(e.charAt(u++))<<2|(i=C._keyStr.indexOf(e.charAt(u++)))>>4,n=(15&i)<<4|(o=C._keyStr.indexOf(e.charAt(u++)))>>2,r=(3&o)<<6|(s=C._keyStr.indexOf(e.charAt(u++))),a+=String.fromCharCode(t),64!==o&&(a+=String.fromCharCode(n)),64!==s&&(a+=String.fromCharCode(r));return a=N(a)}},q=Object.prototype.toString;function U(t){switch(q.call(t)){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===t?"null":void 0===t?"undefined":t!=t?"nan":t&&1===t.nodeType?"element":"function"==typeof _.isBuffer&&_.isBuffer(t)?"buffer":e(t=t.valueOf?t.valueOf():Object.prototype.valueOf.apply(t))}var D,j={DISABLE:0,ERROR:1,WARN:2,INFO:3},B=j.WARN,M={error:function(e){B>=j.ERROR&&L(e)},warn:function(e){B>=j.WARN&&L(e)},info:function(e){B>=j.INFO&&L(e)}},L=function(e){try{console.log("[Amplitude] "+e)}catch(e){}},z=function(e){return"string"===U(e)&&e.length>o?e.substring(0,o):e},Y=function(e){var t=U(e);if("object"!==t)return M.error("Error: invalid properties format. Expecting Javascript object, received "+t+", ignoring"),{};if(Object.keys(e).length>s)return M.error("Error: too many properties (more than 1000), ignoring"),{};var n={};for(var r in e)if(e.hasOwnProperty(r)){var i=r,o=U(i);"string"!==o&&(i=String(i),M.warn("WARNING: Non-string property key, received type "+o+', coercing to string "'+i+'"'));var a=G(i,e[r]);null!==a&&(n[i]=a)}return n},F=["nan","function","arguments","regexp","element"],G=function e(t,n){var r=U(n);if(-1!==F.indexOf(r))M.warn('WARNING: Property key "'+t+'" with invalid value type '+r+", ignoring"),n=null;else if("undefined"===r)n=null;else if("error"===r)n=String(n),M.warn('WARNING: Property key "'+t+'" with value type error, coercing to '+n);else if("array"===r){for(var i=[],o=0;o<n.length;o++){var s=n[o],a=U(s);"array"!==a?"object"===a?i.push(Y(s)):i.push(e(t,s)):M.warn("WARNING: Cannot have "+a+" nested in an array property value, skipping")}n=i}else"object"===r&&(n=Y(n));return n},K=function(e,t){var n=U(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 r=[],i=0;i<t.length;i++){var o=t[i],s=U(o);"array"!==s&&"object"!==s?"string"===s?r.push(o):"date"!==s&&"number"!==s&&"boolean"!==s||(o=String(o),M.warn("WARNING: Non-string groupName, received type "+s+', coercing to string "'+o+'"'),r.push(o)):M.warn("WARNING: Skipping nested "+s+" in array groupName")}return r}M.warn("WARNING: Non-string groupName, received type "+n+". Please use strings or array of strings for groupName")},V=function(e){j.hasOwnProperty(e)&&(B=j[e])},W=M,$=function(e){return!e||0===e.length},J=function(e,t){e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var n=new RegExp("[\\?&]"+e+"=([^&#]*)").exec(t);return null===n?void 0:decodeURIComponent(n[1].replace(/\+/g," "))},Q=function e(t){if("array"===U(t))for(var n=0;n<t.length;n++)t[n]=e(t[n]);else if("object"===U(t))for(var r in t)t.hasOwnProperty(r)&&(t[r]=e(t[r]));else t=z(t);return t},X=function(e){var t=U(e);if("object"!==t)return M.error("Error: invalid groups format. Expecting Javascript object, received "+t+", ignoring"),{};var n={};for(var r in e)if(e.hasOwnProperty(r)){var i=r,o=U(i);"string"!==o&&(i=String(i),M.warn("WARNING: Non-string groupType, received type "+o+', coercing to string "'+i+'"'));var s=K(i,e[r]);null!==s&&(n[i]=s)}return n},H=function(e,t,n){return U(e)===n||(M.error("Invalid "+t+" input type. Expected "+n+" but received "+U(e)),!1)},Z=Y,ee=function(){return window.location},te=function(e,t,n){var r=null!==t?n.expirationDays:-1;if(r){var i=new Date;i.setTime(i.getTime()+24*r*60*60*1e3),r=i}var o=e+"="+t;r&&(o+="; expires="+r.toUTCString()),o+="; path=/",n.domain&&(o+="; domain="+n.domain),n.secure&&(o+="; Secure"),document.cookie=o},ne=function(e){try{for(var t=document.cookie.split(";"),n=null,r=0;r<t.length;r++){for(var i=t[r];" "===i.charAt(0);)i=i.substring(1,i.length);if(0===i.indexOf(e)){n=i.substring(e.length,i.length);break}}return n}catch(e){return null}},ie={expirationDays:void 0,domain:void 0},oe=function(e){var t=function(e){var t=document.createElement("a");return t.href=e,t.hostname||location.hostname}(e).split("."),n=t[t.length-1],r=[];if(4===t.length&&n===parseInt(n,10))return r;if(t.length<=1)return r;for(var i=t.length-2;i>=0;--i)r.push(t.slice(i).join("."));for(var o=0;o<r.length;++o){var s="__tld_test__",a=r[o],u={domain:"."+a};if(te(s,1,u),ne(s))return te(s,null,u),a}return""},se=function(e){var t="";return ie.domain&&(t="."===ie.domain.charAt(0)?ie.domain.substring(1):ie.domain),e+t},ae=function(e){var t=se(e)+"=",n=ne(t);try{if(n)return JSON.parse(C.decode(n))}catch(e){return null}return null},ue=function(e,t){try{return te(se(e),C.encode(JSON.stringify(t)),ie),!0}catch(e){return!1}},ce=function(e){try{return te(se(e),null,ie),!0}catch(e){return!1}},le={reset:function(){ie={expirationDays:void 0,domain:void 0}},options:function(e){if(0===arguments.length)return ie;e=e||{},ie.expirationDays=e.expirationDays,ie.secure=e.secure;var t=$(e.domain)?"."+oe(ee().href):e.domain,n=Math.random();ie.domain=t,ue("amplitude_test",n);var r=ae("amplitude_test");return r&&r===n||(t=null),ce("amplitude_test"),ie.domain=t,ie},get:ae,set:ue,remove:ce};if(function(){var e,t=new Date;try{return window.localStorage.setItem(t,t),e=window.localStorage.getItem(t)===String(t),window.localStorage.removeItem(t),e}catch(e){}return!1}())D=window.localStorage;else if(window.globalStorage)try{D=window.globalStorage[window.location.hostname]}catch(e){}else if("undefined"!=typeof document){var pe=document.createElement("div"),fe="localStorage";pe.style.display="none",document.getElementsByTagName("head")[0].appendChild(pe),pe.addBehavior&&(pe.addBehavior("#default#userdata"),D={length:0,setItem:function(e,t){pe.load(fe),pe.getAttribute(e)||this.length++,pe.setAttribute(e,t),pe.save(fe)},getItem:function(e){return pe.load(fe),pe.getAttribute(e)},removeItem:function(e){pe.load(fe),pe.getAttribute(e)&&this.length--,pe.removeAttribute(e),pe.save(fe)},clear:function(){pe.load(fe);for(var e,t=0;e=pe.XMLDocument.documentElement.attributes[t++];)pe.removeAttribute(e.name);pe.save(fe),this.length=0},key:function(e){return pe.load(fe),pe.XMLDocument.documentElement.attributes[e]}},pe.load(fe),D.length=pe.XMLDocument.documentElement.attributes.length)}D||(D={length:0,setItem:function(e,t){},getItem:function(e){},removeItem:function(e){},clear:function(){},key:function(e){}});var de=D,he=function(){this.storage=null};he.prototype._cookiesEnabled=function(){var e,t=String(new Date);try{return le.set(y,t),e=le.get(y)===t,le.remove(y),e}catch(e){}return!1},he.prototype.getStorage=function(){return null!==this.storage||(this._cookiesEnabled()?this.storage=le: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&&window.location&&window.location.hostname,this._options.secure=e.secure||!1)},get:function(e){try{return JSON.parse(de.getItem("amp_cookiestore_"+e))}catch(e){}return null},set:function(e,t){try{return de.setItem("amp_cookiestore_"+e,JSON.stringify(t)),!0}catch(e){}return!1},remove:function(e){try{de.removeItem("amp_cookiestore_"+e)}catch(e){return!1}}}),this.storage};var ge=function(){this.userPropertiesOperations={},this.properties=[]};ge.prototype.add=function(e,t){return"number"===U(t)||"string"===U(t)?this._addOperation("$add",e,t):W.error("Unsupported type for value: "+U(t)+", expecting number or string"),this},ge.prototype.append=function(e,t){return this._addOperation("$append",e,t),this},ge.prototype.clearAll=function(){return Object.keys(this.userPropertiesOperations).length>0?(this.userPropertiesOperations.hasOwnProperty("$clearAll")||W.error("Need to send $clearAll on its own Identify object without any other operations, skipping $clearAll"),this):(this.userPropertiesOperations.$clearAll="-",this)},ge.prototype.prepend=function(e,t){return this._addOperation("$prepend",e,t),this},ge.prototype.set=function(e,t){return this._addOperation("$set",e,t),this},ge.prototype.setOnce=function(e,t){return this._addOperation("$setOnce",e,t),this},ge.prototype.unset=function(e){return this._addOperation("$unset",e,"-"),this},ge.prototype._addOperation=function(e,t,n){this.userPropertiesOperations.hasOwnProperty("$clearAll")?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 ve="undefined"!=typeof window?window:void 0!==re?re:"undefined"!=typeof self?self:{};function ye(e,t){return e(t={exports:{}},t.exports),t.exports}var me=ye((function(e){!function(t){function n(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function r(e,t,r,i,o,s){return n((a=n(n(t,e),n(i,s)))<<(u=o)|a>>>32-u,r);var a,u}function i(e,t,n,i,o,s,a){return r(t&n|~t&i,e,t,o,s,a)}function o(e,t,n,i,o,s,a){return r(t&i|n&~i,e,t,o,s,a)}function s(e,t,n,i,o,s,a){return r(t^n^i,e,t,o,s,a)}function a(e,t,n,i,o,s,a){return r(n^(t|~i),e,t,o,s,a)}function u(e,t){var r,u,c,l,p;e[t>>5]|=128<<t%32,e[14+(t+64>>>9<<4)]=t;var f=1732584193,d=-271733879,h=-1732584194,g=271733878;for(r=0;r<e.length;r+=16)u=f,c=d,l=h,p=g,f=i(f,d,h,g,e[r],7,-680876936),g=i(g,f,d,h,e[r+1],12,-389564586),h=i(h,g,f,d,e[r+2],17,606105819),d=i(d,h,g,f,e[r+3],22,-1044525330),f=i(f,d,h,g,e[r+4],7,-176418897),g=i(g,f,d,h,e[r+5],12,1200080426),h=i(h,g,f,d,e[r+6],17,-1473231341),d=i(d,h,g,f,e[r+7],22,-45705983),f=i(f,d,h,g,e[r+8],7,1770035416),g=i(g,f,d,h,e[r+9],12,-1958414417),h=i(h,g,f,d,e[r+10],17,-42063),d=i(d,h,g,f,e[r+11],22,-1990404162),f=i(f,d,h,g,e[r+12],7,1804603682),g=i(g,f,d,h,e[r+13],12,-40341101),h=i(h,g,f,d,e[r+14],17,-1502002290),f=o(f,d=i(d,h,g,f,e[r+15],22,1236535329),h,g,e[r+1],5,-165796510),g=o(g,f,d,h,e[r+6],9,-1069501632),h=o(h,g,f,d,e[r+11],14,643717713),d=o(d,h,g,f,e[r],20,-373897302),f=o(f,d,h,g,e[r+5],5,-701558691),g=o(g,f,d,h,e[r+10],9,38016083),h=o(h,g,f,d,e[r+15],14,-660478335),d=o(d,h,g,f,e[r+4],20,-405537848),f=o(f,d,h,g,e[r+9],5,568446438),g=o(g,f,d,h,e[r+14],9,-1019803690),h=o(h,g,f,d,e[r+3],14,-187363961),d=o(d,h,g,f,e[r+8],20,1163531501),f=o(f,d,h,g,e[r+13],5,-1444681467),g=o(g,f,d,h,e[r+2],9,-51403784),h=o(h,g,f,d,e[r+7],14,1735328473),f=s(f,d=o(d,h,g,f,e[r+12],20,-1926607734),h,g,e[r+5],4,-378558),g=s(g,f,d,h,e[r+8],11,-2022574463),h=s(h,g,f,d,e[r+11],16,1839030562),d=s(d,h,g,f,e[r+14],23,-35309556),f=s(f,d,h,g,e[r+1],4,-1530992060),g=s(g,f,d,h,e[r+4],11,1272893353),h=s(h,g,f,d,e[r+7],16,-155497632),d=s(d,h,g,f,e[r+10],23,-1094730640),f=s(f,d,h,g,e[r+13],4,681279174),g=s(g,f,d,h,e[r],11,-358537222),h=s(h,g,f,d,e[r+3],16,-722521979),d=s(d,h,g,f,e[r+6],23,76029189),f=s(f,d,h,g,e[r+9],4,-640364487),g=s(g,f,d,h,e[r+12],11,-421815835),h=s(h,g,f,d,e[r+15],16,530742520),f=a(f,d=s(d,h,g,f,e[r+2],23,-995338651),h,g,e[r],6,-198630844),g=a(g,f,d,h,e[r+7],10,1126891415),h=a(h,g,f,d,e[r+14],15,-1416354905),d=a(d,h,g,f,e[r+5],21,-57434055),f=a(f,d,h,g,e[r+12],6,1700485571),g=a(g,f,d,h,e[r+3],10,-1894986606),h=a(h,g,f,d,e[r+10],15,-1051523),d=a(d,h,g,f,e[r+1],21,-2054922799),f=a(f,d,h,g,e[r+8],6,1873313359),g=a(g,f,d,h,e[r+15],10,-30611744),h=a(h,g,f,d,e[r+6],15,-1560198380),d=a(d,h,g,f,e[r+13],21,1309151649),f=a(f,d,h,g,e[r+4],6,-145523070),g=a(g,f,d,h,e[r+11],10,-1120210379),h=a(h,g,f,d,e[r+2],15,718787259),d=a(d,h,g,f,e[r+9],21,-343485551),f=n(f,u),d=n(d,c),h=n(h,l),g=n(g,p);return[f,d,h,g]}function c(e){var t,n="",r=32*e.length;for(t=0;t<r;t+=8)n+=String.fromCharCode(e[t>>5]>>>t%32&255);return n}function l(e){var t,n=[];for(n[(e.length>>2)-1]=void 0,t=0;t<n.length;t+=1)n[t]=0;var r=8*e.length;for(t=0;t<r;t+=8)n[t>>5]|=(255&e.charCodeAt(t/8))<<t%32;return n}function p(e){var t,n,r="";for(n=0;n<e.length;n+=1)t=e.charCodeAt(n),r+="0123456789abcdef".charAt(t>>>4&15)+"0123456789abcdef".charAt(15&t);return r}function f(e){return unescape(encodeURIComponent(e))}function d(e){return function(e){return c(u(l(e),8*e.length))}(f(e))}function h(e,t){return function(e,t){var n,r,i=l(e),o=[],s=[];for(o[15]=s[15]=void 0,i.length>16&&(i=u(i,8*e.length)),n=0;n<16;n+=1)o[n]=909522486^i[n],s[n]=1549556828^i[n];return r=u(o.concat(l(t)),512+8*t.length),c(u(s.concat(r),640))}(f(e),f(t))}function g(e,t,n){return t?n?h(t,e):p(h(t,e)):n?d(e):p(d(e))}e.exports?e.exports=g:t.md5=g}(ve)})),we=Object.getOwnPropertySymbols,_e=Object.prototype.hasOwnProperty,be=Object.prototype.propertyIsEnumerable;function Ie(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}var Ee=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 r={};return"abcdefghijklmnopqrst".split("").forEach((function(e){r[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,r,i=Ie(e),o=1;o<arguments.length;o++){for(var s in n=Object(arguments[o]))_e.call(n,s)&&(i[s]=n[s]);if(we){r=we(n);for(var a=0;a<r.length;a++)be.call(n,r[a])&&(i[r[a]]=n[r[a]])}}return i};function Se(e,t){return t.encode?t.strict?encodeURIComponent(e).replace(/[!'()*]/g,(function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})):encodeURIComponent(e):e}new RegExp("%[a-f0-9]{2}","gi"),new RegExp("(%[a-f0-9]{2})+","gi");var Ae=function(e,t){!1===(t=Ee({encode:!0,strict:!0,arrayFormat:"none"},t)).sort&&(t.sort=function(){});var n=function(e){switch(e.arrayFormat){case"index":return function(t,n,r){return null===n?[Se(t,e),"[",r,"]"].join(""):[Se(t,e),"[",Se(r,e),"]=",Se(n,e)].join("")};case"bracket":return function(t,n){return null===n?Se(t,e):[Se(t,e),"[]=",Se(n,e)].join("")};default:return function(t,n){return null===n?Se(t,e):[Se(t,e),"=",Se(n,e)].join("")}}}(t);return e?Object.keys(e).sort(t.sort).map((function(r){var i=e[r];if(void 0===i)return"";if(null===i)return Se(r,t);if(Array.isArray(i)){var o=[];return i.slice().forEach((function(e){void 0!==e&&o.push(n(r,e,o.length))})),o.join("&")}return Se(r,t)+"="+Se(i,t)})).filter((function(e){return e.length>0})).join("&"):""},Oe=function(e,t){this.url=e,this.data=t||{}};Oe.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(Ae(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(Ae(this.data))}};var Re=function(){this._price=null,this._productId=null,this._quantity=1,this._revenueType=null,this._properties=null};Re.prototype.setProductId=function(e){return"string"!==U(e)?W.error("Unsupported type for productId: "+U(e)+", expecting string"):$(e)?W.error("Invalid empty productId"):this._productId=e,this},Re.prototype.setQuantity=function(e){return"number"!==U(e)?W.error("Unsupported type for quantity: "+U(e)+", expecting number"):this._quantity=parseInt(e),this},Re.prototype.setPrice=function(e){return"number"!==U(e)?W.error("Unsupported type for price: "+U(e)+", expecting number"):this._price=e,this},Re.prototype.setRevenueType=function(e){return"string"!==U(e)?W.error("Unsupported type for revenueType: "+U(e)+", expecting string"):this._revenueType=e,this},Re.prototype.setEventProperties=function(e){return"object"!==U(e)?W.error("Unsupported type for eventProperties: "+U(e)+", expecting object"):this._properties=Z(e),this},Re.prototype._isValidRevenue=function(){return"number"===U(this._price)||(W.error("Invalid revenue, need to set price field"),!1)},Re.prototype._toJSONObject=function(){var e="object"===U(this._properties)?this._properties:{};return null!==this._productId&&(e[w]=this._productId),null!==this._quantity&&(e[b]=this._quantity),null!==this._price&&(e[I]=this._price),null!==this._revenueType&&(e[E]=this._revenueType),e};var Te=ye((function(e,t){
/*!
* UAParser.js v0.7.19
* Lightweight JavaScript-based User-Agent string parser
* https://github.com/faisalman/ua-parser-js
*
* Copyright © 2012-2016 Faisal Salman <[email protected]>
* Dual licensed under GPLv2 or MIT
*/
!function(n,r){var i="model",o="name",s="type",a="vendor",u="version",c="mobile",l="tablet",p={extend:function(e,t){var n={};for(var r in e)t[r]&&t[r].length%2==0?n[r]=t[r].concat(e[r]):n[r]=e[r];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.replace(/[^\d\.]/g,"").split(".")[0]:void 0},trim:function(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}},f={rgx:function(e,t){for(var n,r,i,o,s,a,u=0;u<t.length&&!s;){var c=t[u],l=t[u+1];for(n=r=0;n<c.length&&!s;)if(s=c[n++].exec(e))for(i=0;i<l.length;i++)a=s[++r],"object"==typeof(o=l[i])&&o.length>0?2==o.length?"function"==typeof o[1]?this[o[0]]=o[1].call(this,a):this[o[0]]=o[1]:3==o.length?"function"!=typeof o[1]||o[1].exec&&o[1].test?this[o[0]]=a?a.replace(o[1],o[2]):void 0:this[o[0]]=a?o[1].call(this,a,o[2]):void 0:4==o.length&&(this[o[0]]=a?o[3].call(this,a.replace(o[1],o[2])):void 0):this[o]=a||void 0;u+=2}},str:function(e,t){for(var n in t)if("object"==typeof t[n]&&t[n].length>0){for(var r=0;r<t[n].length;r++)if(p.has(t[n][r],e))return"?"===n?void 0:n}else if(p.has(t[n],e))return"?"===n?void 0:n;return e}},d={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"}}}},h={browser:[[/(opera\smini)\/([\w\.-]+)/i,/(opera\s[mobiletab]+).+version\/([\w\.-]+)/i,/(opera).+version\/([\w\.]+)/i,/(opera)[\/\s]+([\w\.]+)/i],[o,u],[/(opios)[\/\s]+([\w\.]+)/i],[[o,"Opera Mini"],u],[/\s(opr)\/([\w\.]+)/i],[[o,"Opera"],u],[/(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|bowser|quark|qupzilla|falkon)\/([\w\.-]+)/i],[o,u],[/(konqueror)\/([\w\.]+)/i],[[o,"Konqueror"],u],[/(trident).+rv[:\s]([\w\.]+).+like\sgecko/i],[[o,"IE"],u],[/(edge|edgios|edga)\/((\d+)?[\w\.]+)/i],[[o,"Edge"],u],[/(yabrowser)\/([\w\.]+)/i],[[o,"Yandex"],u],[/(puffin)\/([\w\.]+)/i],[[o,"Puffin"],u],[/(focus)\/([\w\.]+)/i],[[o,"Firefox Focus"],u],[/(opt)\/([\w\.]+)/i],[[o,"Opera Touch"],u],[/((?:[\s\/])uc?\s?browser|(?:juc.+)ucweb)[\/\s]?([\w\.]+)/i],[[o,"UCBrowser"],u],[/(comodo_dragon)\/([\w\.]+)/i],[[o,/_/g," "],u],[/((?:android.+)crmo|crios)\/([\w\.]+)/i,/android.+(chrome)\/([\w\.]+)\s+(?:mobile\s?safari)/i],[[o,"Chrome Mobile"],u],[/(micromessenger)\/([\w\.]+)/i],[[o,"WeChat"],u],[/(brave)\/([\w\.]+)/i],[[o,"Brave"],u],[/(qqbrowserlite)\/([\w\.]+)/i],[o,u],[/(QQ)\/([\d\.]+)/i],[o,u],[/m?(qqbrowser)[\/\s]?([\w\.]+)/i],[o,u],[/(BIDUBrowser)[\/\s]?([\w\.]+)/i],[o,u],[/(2345Explorer)[\/\s]?([\w\.]+)/i],[o,u],[/(MetaSr)[\/\s]?([\w\.]+)/i],[o],[/(LBBROWSER)/i],[o],[/xiaomi\/miuibrowser\/([\w\.]+)/i],[u,[o,"MIUI Browser"]],[/;fbav\/([\w\.]+);/i],[u,[o,"Facebook"]],[/safari\s(line)\/([\w\.]+)/i,/android.+(line)\/([\w\.]+)\/iab/i],[o,u],[/headlesschrome(?:\/([\w\.]+)|\s)/i],[u,[o,"Chrome Headless"]],[/\swv\).+(chrome)\/([\w\.]+)/i],[[o,/(.+)/,"$1 WebView"],u],[/((?:oculus|samsung)browser)\/([\w\.]+)/i],[[o,/(.+(?:g|us))(.+)/,"$1 $2"],u],[/android.+version\/([\w\.]+)\s+(?:mobile\s?safari|safari)*/i],[u,[o,"Android Browser"]],[/(chrome|omniweb|arora|[tizenoka]{5}\s?browser)\/v?([\w\.]+)/i],[o,u],[/(dolfin)\/([\w\.]+)/i],[[o,"Dolphin"],u],[/(coast)\/([\w\.]+)/i],[[o,"Opera Coast"],u],[/fxios\/([\w\.-]+)/i],[u,[o,"Firefox"]],[/version\/([\w\.]+).+?mobile\/\w+\s(safari)/i],[u,[o,"Mobile Safari"]],[/version\/([\w\.]+).+?(mobile\s?safari|safari)/i],[u,o],[/webkit.+?(gsa)\/([\w\.]+).+?(mobile\s?safari|safari)(\/[\w\.]+)/i],[[o,"GSA"],u],[/webkit.+?(mobile\s?safari|safari)(\/[\w\.]+)/i],[o,[u,f.str,d.browser.oldsafari.version]],[/(webkit|khtml)\/([\w\.]+)/i],[o,u],[/(navigator|netscape)\/([\w\.-]+)/i],[[o,"Netscape"],u],[/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo\sbrowser|minimo|conkeror)[\/\s]?([\w\.\+]+)/i,/(firefox|seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([\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],[o,u]],cpu:[[/(?:(amd|x(?:(?:86|64)[_-])?|wow|win)64)[;\)]/i],[["architecture","amd64"]],[/(ia32(?=;))/i],[["architecture",p.lowerize]],[/((?:i[346]|x)86)[;\)]/i],[["architecture","ia32"]],[/windows\s(ce|mobile);\sppc;/i],[["architecture","arm"]],[/((?:ppc|powerpc)(?:64)?)(?:\smac|;|\))/i],[["architecture",/ower/,"",p.lowerize]],[/(sun4\w)[;\)]/i],[["architecture","sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|arm(?:64|(?=v\d+[;l]))|(?=atmel\s)avr|(?:irix|mips|sparc)(?:64)?(?=;)|pa-risc)/i],[["architecture",p.lowerize]]],device:[[/\((ipad|playbook);[\w\s\),;-]+(rim|apple)/i],[i,a,[s,l]],[/applecoremedia\/[\w\.]+ \((ipad)/],[i,[a,"Apple"],[s,l]],[/(apple\s{0,1}tv)/i],[[i,"Apple TV"],[a,"Apple"]],[/(archos)\s(gamepad2?)/i,/(hp).+(touchpad)/i,/(hp).+(tablet)/i,/(kindle)\/([\w\.]+)/i,/\s(nook)[\w\s]+build\/(\w+)/i,/(dell)\s(strea[kpr\s\d]*[\dko])/i],[a,i,[s,l]],[/(kf[A-z]+)\sbuild\/.+silk\//i],[i,[a,"Amazon"],[s,l]],[/(sd|kf)[0349hijorstuw]+\sbuild\/.+silk\//i],[[i,f.str,d.device.amazon.model],[a,"Amazon"],[s,c]],[/android.+aft([bms])\sbuild/i],[i,[a,"Amazon"],[s,"smarttv"]],[/\((ip[honed|\s\w*]+);.+(apple)/i],[i,a,[s,c]],[/\((ip[honed|\s\w*]+);/i],[i,[a,"Apple"],[s,c]],[/(blackberry)[\s-]?(\w+)/i,/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[\s_-]?([\w-]*)/i,/(hp)\s([\w\s]+\w)/i,/(asus)-?(\w+)/i],[a,i,[s,c]],[/\(bb10;\s(\w+)/i],[i,[a,"BlackBerry"],[s,c]],[/android.+(transfo[prime\s]{4,10}\s\w+|eeepc|slider\s\w+|nexus 7|padfone|p00c)/i],[i,[a,"Asus"],[s,l]],[/(sony)\s(tablet\s[ps])\sbuild\//i,/(sony)?(?:sgp.+)\sbuild\//i],[[a,"Sony"],[i,"Xperia Tablet"],[s,l]],[/android.+\s([c-g]\d{4}|so[-l]\w+)(?=\sbuild\/|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[i,[a,"Sony"],[s,c]],[/\s(ouya)\s/i,/(nintendo)\s([wids3u]+)/i],[a,i,[s,"console"]],[/android.+;\s(shield)\sbuild/i],[i,[a,"Nvidia"],[s,"console"]],[/(playstation\s[34portablevi]+)/i],[i,[a,"Sony"],[s,"console"]],[/(sprint\s(\w+))/i],[[a,f.str,d.device.sprint.vendor],[i,f.str,d.device.sprint.model],[s,c]],[/(lenovo)\s?(S(?:5000|6000)+(?:[-][\w+]))/i],[a,i,[s,l]],[/(htc)[;_\s-]+([\w\s]+(?=\)|\sbuild)|\w+)/i,/(zte)-(\w*)/i,/(alcatel|geeksphone|lenovo|nexian|panasonic|(?=;\s)sony)[_\s-]?([\w-]*)/i],[a,[i,/_/g," "],[s,c]],[/(nexus\s9)/i],[i,[a,"HTC"],[s,l]],[/d\/huawei([\w\s-]+)[;\)]/i,/(nexus\s6p)/i],[i,[a,"Huawei"],[s,c]],[/(microsoft);\s(lumia[\s\w]+)/i],[a,i,[s,c]],[/[\s\(;](xbox(?:\sone)?)[\s\);]/i],[i,[a,"Microsoft"],[s,"console"]],[/(kin\.[onetw]{3})/i],[[i,/\./g," "],[a,"Microsoft"],[s,c]],[/\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\s6)/i],[i,[a,"Motorola"],[s,c]],[/android.+\s(mz60\d|xoom[\s2]{0,2})\sbuild\//i],[i,[a,"Motorola"],[s,l]],[/hbbtv\/\d+\.\d+\.\d+\s+\([\w\s]*;\s*(\w[^;]*);([^;]*)/i],[[a,p.trim],[i,p.trim],[s,"smarttv"]],[/hbbtv.+maple;(\d+)/i],[[i,/^/,"SmartTV"],[a,"Samsung"],[s,"smarttv"]],[/\(dtv[\);].+(aquos)/i],[i,[a,"Sharp"],[s,"smarttv"]],[/android.+((sch-i[89]0\d|shw-m380s|gt-p\d{4}|gt-n\d+|sgh-t8[56]9|nexus 10))/i,/((SM-T\w+))/i],[[a,"Samsung"],i,[s,l]],[/smart-tv.+(samsung)/i],[a,[s,"smarttv"],i],[/((s[cgp]h-\w+|gt-\w+|galaxy\snexus|sm-\w[\w\d]+))/i,/(sam[sung]*)[\s-]*(\w+-?[\w-]*)/i,/sec-((sgh\w+))/i],[[a,"Samsung"],i,[s,c]],[/sie-(\w*)/i],[i,[a,"Siemens"],[s,c]],[/(maemo|nokia).*(n900|lumia\s\d+)/i,/(nokia)[\s_-]?([\w-]*)/i],[[a,"Nokia"],i,[s,c]],[/android[x\d\.\s;]+\s([ab][1-7]\-?[0178a]\d\d?)/i],[i,[a,"Acer"],[s,l]],[/android.+([vl]k\-?\d{3})\s+build/i],[i,[a,"LG"],[s,l]],[/android\s3\.[\s\w;-]{10}(lg?)-([06cv9]{3,4})/i],[[a,"LG"],i,[s,l]],[/(lg) netcast\.tv/i],[a,i,[s,"smarttv"]],[/(nexus\s[45])/i,/lg[e;\s\/-]+(\w*)/i,/android.+lg(\-?[\d\w]+)\s+build/i],[i,[a,"LG"],[s,c]],[/android.+(ideatab[a-z0-9\-\s]+)/i],[i,[a,"Lenovo"],[s,l]],[/linux;.+((jolla));/i],[a,i,[s,c]],[/((pebble))app\/[\d\.]+\s/i],[a,i,[s,"wearable"]],[/android.+;\s(oppo)\s?([\w\s]+)\sbuild/i],[a,i,[s,c]],[/crkey/i],[[i,"Chromecast"],[a,"Google"]],[/android.+;\s(glass)\s\d/i],[i,[a,"Google"],[s,"wearable"]],[/android.+;\s(pixel c)[\s)]/i],[i,[a,"Google"],[s,l]],[/android.+;\s(pixel( [23])?( xl)?)\s/i],[i,[a,"Google"],[s,c]],[/android.+;\s(\w+)\s+build\/hm\1/i,/android.+(hm[\s\-_]*note?[\s_]*(?:\d\w)?)\s+build/i,/android.+(mi[\s\-_]*(?:one|one[\s_]plus|note lte)?[\s_]*(?:\d?\w?)[\s_]*(?:plus)?)\s+build/i,/android.+(redmi[\s\-_]*(?:note)?(?:[\s_]*[\w\s]+))\s+build/i],[[i,/_/g," "],[a,"Xiaomi"],[s,c]],[/android.+(mi[\s\-_]*(?:pad)(?:[\s_]*[\w\s]+))\s+build/i],[[i,/_/g," "],[a,"Xiaomi"],[s,l]],[/android.+;\s(m[1-5]\snote)\sbuild/i],[i,[a,"Meizu"],[s,l]],[/(mz)-([\w-]{2,})/i],[[a,"Meizu"],i,[s,c]],[/android.+a000(1)\s+build/i,/android.+oneplus\s(a\d{4})\s+build/i],[i,[a,"OnePlus"],[s,c]],[/android.+[;\/]\s*(RCT[\d\w]+)\s+build/i],[i,[a,"RCA"],[s,l]],[/android.+[;\/\s]+(Venue[\d\s]{2,7})\s+build/i],[i,[a,"Dell"],[s,l]],[/android.+[;\/]\s*(Q[T|M][\d\w]+)\s+build/i],[i,[a,"Verizon"],[s,l]],[/android.+[;\/]\s+(Barnes[&\s]+Noble\s+|BN[RT])(V?.*)\s+build/i],[[a,"Barnes & Noble"],i,[s,l]],[/android.+[;\/]\s+(TM\d{3}.*\b)\s+build/i],[i,[a,"NuVision"],[s,l]],[/android.+;\s(k88)\sbuild/i],[i,[a,"ZTE"],[s,l]],[/android.+[;\/]\s*(gen\d{3})\s+build.*49h/i],[i,[a,"Swiss"],[s,c]],[/android.+[;\/]\s*(zur\d{3})\s+build/i],[i,[a,"Swiss"],[s,l]],[/android.+[;\/]\s*((Zeki)?TB.*\b)\s+build/i],[i,[a,"Zeki"],[s,l]],[/(android).+[;\/]\s+([YR]\d{2})\s+build/i,/android.+[;\/]\s+(Dragon[\-\s]+Touch\s+|DT)(\w{5})\sbuild/i],[[a,"Dragon Touch"],i,[s,l]],[/android.+[;\/]\s*(NS-?\w{0,9})\sbuild/i],[i,[a,"Insignia"],[s,l]],[/android.+[;\/]\s*((NX|Next)-?\w{0,9})\s+build/i],[i,[a,"NextBook"],[s,l]],[/android.+[;\/]\s*(Xtreme\_)?(V(1[045]|2[015]|30|40|60|7[05]|90))\s+build/i],[[a,"Voice"],i,[s,c]],[/android.+[;\/]\s*(LVTEL\-)?(V1[12])\s+build/i],[[a,"LvTel"],i,[s,c]],[/android.+;\s(PH-1)\s/i],[i,[a,"Essential"],[s,c]],[/android.+[;\/]\s*(V(100MD|700NA|7011|917G).*\b)\s+build/i],[i,[a,"Envizen"],[s,l]],[/android.+[;\/]\s*(Le[\s\-]+Pan)[\s\-]+(\w{1,9})\s+build/i],[a,i,[s,l]],[/android.+[;\/]\s*(Trio[\s\-]*.*)\s+build/i],[i,[a,"MachSpeed"],[s,l]],[/android.+[;\/]\s*(Trinity)[\-\s]*(T\d{3})\s+build/i],[a,i,[s,l]],[/android.+[;\/]\s*TU_(1491)\s+build/i],[i,[a,"Rotor"],[s,l]],[/android.+(KS(.+))\s+build/i],[i,[a,"Amazon"],[s,l]],[/android.+(Gigaset)[\s\-]+(Q\w{1,9})\s+build/i],[a,i,[s,l]],[/\s(tablet|tab)[;\/]/i,/\s(mobile)(?:[;\/]|\ssafari)/i],[[s,p.lowerize],a,i],[/[\s\/\(](smart-?tv)[;\)]/i],[[s,"smarttv"]],[/(android[\w\.\s\-]{0,9});.+build/i],[i,[a,"Generic"]]],engine:[[/windows.+\sedge\/([\w\.]+)/i],[u,[o,"EdgeHTML"]],[/webkit\/537\.36.+chrome\/(?!27)/i],[[o,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/(khtml|tasman|links)[\/\s]\(?([\w\.]+)/i,/(icab)[\/\s]([23]\.[\d\.]+)/i],[o,u],[/rv\:([\w\.]{1,9}).+(gecko)/i],[u,o]],os:[[/microsoft\s(windows)\s(vista|xp)/i],[o,u],[/(windows)\snt\s6\.2;\s(arm)/i,/(windows\sphone(?:\sos)*)[\s\/]?([\d\.\s\w]*)/i,/(windows\smobile|windows)[\s\/]?([ntce\d\.\s]+\w)/i],[[o,f.str,d.os.windows.name],[u,f.str,d.os.windows.version]],[/(win(?=3|9|n)|win\s9x\s)([nt\d\.]+)/i],[[o,"Windows"],[u,f.str,d.os.windows.version]],[/\((bb)(10);/i],[[o,"BlackBerry"],u],[/(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],[o,u],[/(symbian\s?os|symbos|s60(?=;))[\/\s-]?([\w\.]*)/i],[[o,"Symbian"],u],[/\((series40);/i],[o],[/mozilla.+\(mobile;.+gecko.+firefox/i],[[o,"Firefox OS"],u],[/(nintendo|playstation)\s([wids34portablevu]+)/i,/(mint)[\/\s\(]?(\w*)/i,/(mageia|vectorlinux)[;\s]/i,/(joli|[kxln]?ubuntu|debian|suse|opensuse|gentoo|(?=\s)arch|slackware|fedora|mandriva|centos|pclinuxos|redhat|zenwalk|linpus)[\/\s-]?(?!chrom)([\w\.-]*)/i,/(hurd|linux)\s?([\w\.]*)/i,/(gnu)\s?([\w\.]*)/i],[[o,"Linux"],u],[/(cros)\s[\w]+\s([\w\.]+\w)/i],[[o,"Chromium OS"],u],[/(sunos)\s?([\w\.\d]*)/i],[[o,"Solaris"],u],[/\s([frentopc-]{0,4}bsd|dragonfly)\s?([\w\.]*)/i],[[o,"Linux"],u],[/(iphone)(?:.*os\s*([\w]*)\slike\smac|;\sopera)/i],[[o,"iPhone"],[u,/_/g,"."]],[/(ipad)(?:.*os\s*([\w]*)\slike\smac|;\sopera)/i],[[o,"iPad"],[u,/_/g,"."]],[/(haiku)\s(\w+)/i],[o,u],[/cfnetwork\/.+darwin/i,/ip[honead]{2,4}(?:.*os\s([\w]+)\slike\smac|;\sopera)/i],[[u,/_/g,"."],[o,"iOS"]],[/(mac\sos\sx)\s?([\w\s\.]*)/i,/(macintosh|mac(?=_powerpc)\s)/i],[[o,"Mac"],[u,/_/g,"."]],[/((?:open)?solaris)[\/\s-]?([\w\.]*)/i,/(aix)\s((\d)(?=\.|\)|\s)[\w\.])*/i,/(plan\s9|minix|beos|os\/2|amigaos|morphos|risc\sos|openvms|fuchsia)/i,/(unix)\s?([\w\.]*)/i],[o,u]]},g=function(e,t){if("object"==typeof e&&(t=e,e=void 0),!(this instanceof g))return new g(e,t).getResult();var r=e||(n&&n.navigator&&n.navigator.userAgent?n.navigator.userAgent:""),i=t?p.extend(h,t):h;return this.getBrowser=function(){var e={name:void 0,version:void 0};return f.rgx.call(e,r,i.browser),e.major=p.major(e.version),e},this.getCPU=function(){var e={architecture:void 0};return f.rgx.call(e,r,i.cpu),e},this.getDevice=function(){var e={vendor:void 0,model:void 0,type:void 0};return f.rgx.call(e,r,i.device),e},this.getEngine=function(){var e={name:void 0,version:void 0};return f.rgx.call(e,r,i.engine),e},this.getOS=function(){var e={name:void 0,version:void 0};return f.rgx.call(e,r,i.os),e},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 r},this.setUA=function(e){return r=e,this},this};g.VERSION="0.7.19",g.BROWSER={NAME:o,MAJOR:"major",VERSION:u},g.CPU={ARCHITECTURE:"architecture"},g.DEVICE={MODEL:i,VENDOR:a,TYPE:s,CONSOLE:"console",MOBILE:c,SMARTTV:"smarttv",TABLET:l,WEARABLE:"wearable",EMBEDDED:"embedded"},g.ENGINE={NAME:o,VERSION:u},g.OS={NAME:o,VERSION:u},e.exports&&(t=e.exports=g),t.UAParser=g;var v=n&&(n.jQuery||n.Zepto);if(void 0!==v&&!v.ua){var y=new g;v.ua=y.getResult(),v.ua.get=function(){return y.getUA()},v.ua.set=function(e){y.setUA(e);var t=y.getResult();for(var n in t)v.ua[n]=t[n]}}}("object"==typeof window?window:ve)})),xe=(Te.UAParser,function e(t){return t?(t^16*Math.random()>>t/4).toString(16):([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,e)}),Pe={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:navigator&&(navigator.languages&&navigator.languages[0]||navigator.language||navigator.userLanguage)||void 0,logLevel:"WARN",optOut:!1,onError:function(){},platform:"Web",savedMaxCount:1e3,saveEvents:!0,saveParamsReferrerOncePerSession:!0,secureCookie:!1,sessionTimeout:18e5,trackingOptions:{city:!0,country:!0,carrier:!0,device_manufacturer:!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},ke=function(e){this._instanceName=$(e)?r:e.toLowerCase(),this._legacyStorageSuffix=this._instanceName===r?"":"_"+this._instanceName,this._unsentEvents=[],this._unsentIdentifys=[],this._ua=new Te(navigator.userAgent).getResult(),this.options=n({},Pe,{trackingOptions:n({},Pe.trackingOptions)}),this.cookieStorage=(new he).getStorage(),this._q=[],this._sending=!1,this._updateScheduled=!1,this._onInit=[],this._eventId=0,this._identifyId=0,this._lastEventTime=null,this._newSession=!1,this._sequenceNumber=0,this._sessionId=null,this._isInitialized=!1,this._userAgent=navigator&&navigator.userAgent||null};ke.prototype.Identify=ge,ke.prototype.Revenue=Re,ke.prototype.init=function(e,t,n,i){var o=this;if("string"!==U(e)||$(e))W.error("Invalid apiKey. Please re-initialize with a valid apiKey");else try{this.options.apiKey=e,this._storageSuffix="_"+e+this._legacyStorageSuffix;var s=!!this.cookieStorage.get(this.options.cookieName+this._storageSuffix);if(n&&n.deferInitialization&&!s)return void this._deferInitialization(e,t,n,i);Ne(this.options,n),"string"===U(this.options.logLevel)&&V(this.options.logLevel);var a=Le(this);this._apiPropertiesTrackingOptions=Object.keys(a).length>0?{tracking_options:a}:{},this.cookieStorage.options({expirationDays:this.options.cookieExpiration,domain:this.options.domain,secure:this.options.secureCookie}),this.options.domain=this.cookieStorage.options().domain,this._instanceName===r&&Ce(this),qe(this),this._pendingReadStorage=!0;var u=function(e){o.options.deviceId="object"===U(n)&&"string"===U(n.deviceId)&&!$(n.deviceId)&&n.deviceId||o.options.deviceIdFromUrlParam&&o._getDeviceIdFromUrlParam(o._getUrlParams())||o.options.deviceId||e||xe()+"R",o.options.userId="string"===U(t)&&!$(t)&&t||"number"===U(t)&&t.toString()||o.options.userId||null;var r=(new Date).getTime();if((!o._sessionId||!o._lastEventTime||r-o._lastEventTime>o.options.sessionTimeout)&&(o.options.unsetParamsReferrerOnNewSession&&o._unsetUTMParams(),o._newSession=!0,o._sessionId=r,o.options.saveParamsReferrerOncePerSession&&o._trackParamsAndReferrer()),o.options.saveParamsReferrerOncePerSession||o._trackParamsAndReferrer(),o.options.saveEvents){for(var i=0;i<o._unsentEvents.length;i++){var s=o._unsentEvents[i].event_properties,a=o._unsentEvents[i].groups;o._unsentEvents[i].event_properties=Z(s),o._unsentEvents[i].groups=X(a)}for(var u=0;u<o._unsentIdentifys.length;u++){var c=o._unsentIdentifys[u].user_properties,l=o._unsentIdentifys[u].groups;o._unsentIdentifys[u].user_properties=Z(c),o._unsentIdentifys[u].groups=X(l)}}o._lastEventTime=r,De(o),o._pendingReadStorage=!1,o._sendEventsIfReady();for(var p=0;p<o._onInit.length;p++)o._onInit[p]();o._onInit=[],o._isInitialized=!0};this.options.saveEvents&&(this._unsentEvents=this._loadSavedUnsentEvents(this.options.unsentKey).concat(this._unsentEvents),this._unsentIdentifys=this._loadSavedUnsentEvents(this.options.unsentIdentifyKey).concat(this._unsentIdentifys)),u(),this.runQueuedFunctions(),"function"===U(i)&&i(this)}catch(e){W.error(e),this.options.onError(e)}},ke.prototype._migrateUnsentEvents=function(e){var t=this;Promise.all([(void 0).getItem(this.options.unsentKey),(void 0).getItem(this.options.unsentIdentifyKey)]).then((function(e){if(t.options.saveEvents){var n=e[0],r=e[1],i=[],o=[];n&&(i.push((void 0).setItem(t.options.unsentKey+t._storageSuffix,JSON.stringify(n))),o.push((void 0).removeItem(t.options.unsentKey))),r&&(i.push((void 0).setItem(t.options.unsentIdentifyKey+t._storageSuffix,JSON.stringify(r))),o.push((void 0).removeItem(t.options.unsentIdentifyKey))),i.length>0&&Promise.all(i).then((function(){})).catch((function(e){t.options.onError(e)}))}})).then(e).catch((function(e){t.options.onError(e)}))},ke.prototype._trackParamsAndReferrer=function(){this.options.includeUtm&&this._initUtmData(),this.options.includeReferrer&&this._saveReferrer(this._getReferrer()),this.options.includeGclid&&this._saveGclid(this._getUrlParams())};var Ne=function e(t,n){if("object"===U(n)){var r=function(r){if(t.hasOwnProperty(r)){var i=n[r],o=U(t[r]);H(i,r+" option",o)&&("boolean"===o?t[r]=!!i:"string"===o&&!$(i)||"number"===o&&i>0?t[r]=i:"object"===o&&e(t[r],i))}};for(var i in n)n.hasOwnProperty(i)&&r(i)}};ke.prototype.runQueuedFunctions=function(){var e=this._q;this._q=[];for(var t=0;t<e.length;t++){var n=this[e[t][0]];"function"===U(n)&&n.apply(this,e[t].slice(1))}},ke.prototype._apiKeySet=function(e){return!$(this.options.apiKey)||(W.error("Invalid apiKey. Please set a valid apiKey with init() before calling "+e),!1)},ke.prototype._loadSavedUnsentEvents=function(e){var t=this._getFromStorage(de,e),n=this._parseSavedUnsentEventsString(t,e);return this._setInStorage(de,e,JSON.stringify(n)),n},ke.prototype._parseSavedUnsentEventsString=function(e,t){if($(e))return[];if("string"===U(e))try{var n=JSON.parse(e);if("array"===U(n))return n}catch(e){}return W.error("Unable to load "+t+" events. Restart with a new empty queue."),[]},ke.prototype.isNewSession=function(){return this._newSession},ke.prototype.onInit=function(e){this._isInitialized?e():this._onInit.push(e)},ke.prototype.getSessionId=function(){return this._sessionId},ke.prototype.nextEventId=function(){return this._eventId++,this._eventId},ke.prototype.nextIdentifyId=function(){return this._identifyId++,this._identifyId},ke.prototype.nextSequenceNumber=function(){return this._sequenceNumber++,this._sequenceNumber},ke.prototype._unsentCount=function(){return this._unsentEvents.length+this._unsentIdentifys.length},ke.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))},ke.prototype._getFromStorage=function(e,t){return e.getItem(t+this._storageSuffix)},ke.prototype._setInStorage=function(e,t,n){e.setItem(t+this._storageSuffix,n)};var Ce=function(e){var t=e.cookieStorage.get(e.options.cookieName+e._storageSuffix);if("object"!==U(t)&&!("object"===U(t=e.cookieStorage.get(e.options.cookieName+e._legacyStorageSuffix))&&t.deviceId&&t.sessionId&&t.lastEventTime)){var n=function(e){var t=de.getItem(e);return de.removeItem(e),t},r="string"===U(e.options.apiKey)&&"_"+e.options.apiKey.slice(0,6)||"",i=n(h+r),o=n(v+r),s=n(g+r);null!=s&&(s="true"===String(s));var a=parseInt(n(d)),u=parseInt(n(l)),y=parseInt(n(c)),m=parseInt(n(p)),w=parseInt(n(f)),_=function(e){return"object"===U(t)&&t[e]};e.options.deviceId=_("deviceId")||i,e.options.userId=_("userId")||o,e._sessionId=_("sessionId")||a||e._sessionId,e._lastEventTime=_("lastEventTime")||u||e._lastEventTime,e._eventId=_("eventId")||y||e._eventId,e._identifyId=_("identifyId")||m||e._identifyId,e._sequenceNumber=_("sequenceNumber")||w||e._sequenceNumber,e.options.optOut=s||!1,t&&void 0!==t.optOut&&null!==t.optOut&&(e.options.optOut="true"===String(t.optOut)),De(e)}},qe=function(e){var t=e.cookieStorage.get(e.options.cookieName+e._storageSuffix);if("object"===U(t))Ue(e,t);else{var n=e.cookieStorage.get(e.options.cookieName+e._legacyStorageSuffix);"object"===U(n)&&(e.cookieStorage.remove(e.options.cookieName+e._legacyStorageSuffix),Ue(e,n))}},Ue=function(e,t){t.deviceId&&(e.options.deviceId=t.deviceId),t.userId&&(e.options.userId=t.userId),null!==t.optOut&&void 0!==t.optOut&&!1!==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))},De=function(e){var t={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};e.cookieStorage.set(e.options.cookieName+e._storageSuffix,t)};ke.prototype._initUtmData=function(e,t){e=e||this._getUrlParams(),t=t||this.cookieStorage.get("__utmz");var n,r,i,o,s,a,u,c,l,p,f,d=(r=e,i=(n=t)?"?"+n.split(".").slice(-1)[0].replace(/\|/g,"&"):"",s=(o=function(e,t,n,r){return J(e,t)||J(n,r)})(O,r,"utmcsr",i),a=o(R,r,"utmcmd",i),u=o(T,r,"utmccn",i),c=o(x,r,"utmctr",i),l=o(P,r,"utmcct",i),p={},(f=function(e,t){$(t)||(p[e]=t)})(O,s),f(R,a),f(T,u),f(x,c),f(P,l),p);je(this,d)},ke.prototype._unsetUTMParams=function(){var e=new ge;e.unset(A),e.unset(O),e.unset(R),e.unset(T),e.unset(x),e.unset(P),this.identify(e)};var je=function(e,t){if("object"===U(t)&&0!==Object.keys(t).length){var n=new ge;for(var r in t)t.hasOwnProperty(r)&&(n.setOnce("initial_"+r,t[r]),n.set(r,t[r]));e.identify(n)}};ke.prototype._getReferrer=function(){return document.referrer},ke.prototype._getUrlParams=function(){return location.search},ke.prototype._saveGclid=function(e){var t=J("gclid",e);$(t)||je(this,{gclid:t})},ke.prototype._getDeviceIdFromUrlParam=function(e){return J(S,e)},ke.prototype._getReferringDomain=function(e){if($(e))return null;var t=e.split("/");return t.length>=3?t[2]:null},ke.prototype._saveReferrer=function(e){if(!$(e)){var t={referrer:e,referring_domain:this._getReferringDomain(e)};je(this,t)}},ke.prototype.saveEvents=function(){try{this._setInStorage(de,this.options.unsentKey,JSON.stringify(this._unsentEvents))}catch(e){}try{this._setInStorage(de,this.options.unsentIdentifyKey,JSON.stringify(this._unsentIdentifys))}catch(e){}},ke.prototype.setDomain=function(e){if(this._shouldDeferCall())return this._q.push(["setDomain"].concat(Array.prototype.slice.call(arguments,0)));if(H(e,"domain","string"))try{this.cookieStorage.options({expirationDays:this.options.cookieExpiration,secure:this.options.secureCookie,domain:e}),this.options.domain=this.cookieStorage.options().domain,qe(this),De(this)}catch(e){W.error(e)}},ke.prototype.setUserId=function(e){if(this._shouldDeferCall())return this._q.push(["setUserId"].concat(Array.prototype.slice.call(arguments,0)));try{this.options.userId=null!=e&&""+e||null,De(this)}catch(e){W.error(e)}},ke.prototype.setGroup=function(e,t){if(this._shouldDeferCall())return this._q.push(["setGroup"].concat(Array.prototype.slice.call(arguments,0)));if(this._apiKeySet("setGroup()")&&H(e,"groupType","string")&&!$(e)){var n={};n[e]=t;var r=(new ge).set(e,t);this._logEvent(a,null,null,r.userPropertiesOperations,n,null,null,null)}},ke.prototype.setOptOut=function(e){if(this._shouldDeferCall())return this._q.push(["setOptOut"].concat(Array.prototype.slice.call(arguments,0)));if(H(e,"enable","boolean"))try{this.options.optOut=e,De(this)}catch(e){W.error(e)}},ke.prototype.setSessionId=function(e){if(H(e,"sessionId","number"))try{this._sessionId=e,De(this)}catch(e){W.error(e)}},ke.prototype.resetSessionId=function(){this.setSessionId((new Date).getTime())},ke.prototype.regenerateDeviceId=function(){if(this._shouldDeferCall())return this._q.push(["regenerateDeviceId"].concat(Array.prototype.slice.call(arguments,0)));this.setDeviceId(xe()+"R")},ke.prototype.setDeviceId=function(e){if(this._shouldDeferCall())return this._q.push(["setDeviceId"].concat(Array.prototype.slice.call(arguments,0)));if(H(e,"deviceId","string"))try{$(e)||(this.options.deviceId=""+e,De(this))}catch(e){W.error(e)}},ke.prototype.setUserProperties=function(e){if(this._shouldDeferCall())return this._q.push(["setUserProperties"].concat(Array.prototype.slice.call(arguments,0)));if(this._apiKeySet("setUserProperties()")&&H(e,"userProperties","object")){var t=Q(Z(e));if(0!==Object.keys(t).length){var n=new ge;for(var r in t)t.hasOwnProperty(r)&&n.set(r,t[r]);this.identify(n)}}},ke.prototype.clearUserProperties=function(){if(this._shouldDeferCall())return this._q.push(["clearUserProperties"].concat(Array.prototype.slice.call(arguments,0)));if(this._apiKeySet("clearUserProperties()")){var e=new ge;e.clearAll(),this.identify(e)}};var Be=function(e,t){for(var n=0;n<t._q.length;n++){var r=e[t._q[n][0]];"function"===U(r)&&r.apply(e,t._q[n].slice(1))}return e};ke.prototype.identify=function(e,t){if(this._shouldDeferCall())return this._q.push(["identify"].concat(Array.prototype.slice.call(arguments,0)));if(this._apiKeySet("identify()"))if("object"===U(e)&&e.hasOwnProperty("_q")&&(e=Be(new ge,e)),e instanceof ge){if(Object.keys(e.userPropertiesOperations).length>0)return this._logEvent(a,null,null,e.userPropertiesOperations,null,null,null,t);"function"===U(t)&&t(0,"No request sent",{reason:"No user property operations"})}else W.error("Invalid identify input type. Expected Identify object but saw "+U(e)),"function"===U(t)&&t(0,"No request sent",{reason:"Invalid identify input type"});else"function"===U(t)&&t(0,"No request sent",{reason:"API key is not set"})},ke.prototype.groupIdentify=function(e,n,r,i){if(this._shouldDeferCall())return this._q.push(["groupIdentify"].concat(Array.prototype.slice.call(arguments,0)));if(this._apiKeySet("groupIdentify()"))if(H(e,"group_type","string")&&!$(e))if(null!=n)if("object"===U(r)&&r.hasOwnProperty("_q")&&(r=Be(new ge,r)),r instanceof ge){if(Object.keys(r.userPropertiesOperations).length>0)return this._logEvent(u,null,null,null,t({},e,n),r.userPropertiesOperations,null,i);"function"===U(i)&&i(0,"No request sent",{reason:"No group property operations"})}else W.error("Invalid identify input type. Expected Identify object but saw "+U(r)),"function"===U(i)&&i(0,"No request sent",{reason:"Invalid identify input type"});else"function"===U(i)&&i(0,"No request sent",{reason:"Invalid group name"});else"function"===U(i)&&i(0,"No request sent",{reason:"Invalid group type"});else"function"===U(i)&&i(0,"No request sent",{reason:"API key is not set"})},ke.prototype.setVersionName=function(e){if(this._shouldDeferCall())return this._q.push(["setVersionName"].concat(Array.prototype.slice.call(arguments,0)));H(e,"versionName","string")&&(this.options.versionName=e)},ke.prototype._logEvent=function(e,t,r,i,o,s,c,l){if(qe(this),e)if(this.options.optOut)"function"===U(l)&&l(0,"No request sent",{reason:"optOut is set to true"});else try{var p;p=e===a||e===u?this.nextIdentifyId():this.nextEventId();var f=this.nextSequenceNumber(),d="number"===U(c)?c:(new Date).getTime();(!this._sessionId||!this._lastEventTime||d-this._lastEventTime>this.options.sessionTimeout)&&(this._sessionId=d),this._lastEventTime=d,De(this);var h=this._ua.browser.name,g=this._ua.browser.major,v=this._ua.os.name;i=i||{};var y=n({},this._apiPropertiesTrackingOptions);r=n({},r||{},y),t=t||{},o=o||{},s=s||{};var m={device_id:this.options.deviceId,user_id:this.options.userId,timestamp:d,event_id:p,session_id:this._sessionId||-1,event_type:e,version_name:Me(this,"version_name")&&this.options.versionName||null,platform:Me(this,"platform")?this.options.platform:null,os_name:Me(this,"os_name")&&h||null,os_version:Me(this,"os_version")&&g||null,device_model:Me(this,"device_model")&&v||null,device_manufacturer:(Me(this,"device_manufacturer"),null),language:Me(this,"language")?this.options.language:null,carrier:(Me(this,"carrier"),null),api_properties:r,event_properties:Q(Z(t)),user_properties:Q(Z(i)),uuid:xe(),library:{name:"amplitude-js",version:"5.9.0"},sequence_number:f,groups:Q(X(o)),group_properties:Q(Z(s)),user_agent:this._userAgent};return e===a||e===u?(this._unsentIdentifys.push(m),this._limitEventsQueued(this._unsentIdentifys)):(this._unsentEvents.push(m),this._limitEventsQueued(this._unsentEvents)),this.options.saveEvents&&this.saveEvents(),this._sendEventsIfReady(l)||"function"!==U(l)||l(0,"No request sent",{reason:"No events to send or upload queued"}),p}catch(e){W.error(e)}else"function"===U(l)&&l(0,"No request sent",{reason:"Missing eventType"})};var Me=function(e,t){return!!e.options.trackingOptions[t]},Le=function(e){for(var t=["city","country","dma","ip_address","region"],n={},r=0;r<t.length;r++){var i=t[r];Me(e,i)||(n[i]=!1)}return n};ke.prototype._limitEventsQueued=function(e){e.length>this.options.savedMaxCount&&e.splice(0,e.length-this.options.savedMaxCount)},ke.prototype.logEvent=function(e,t,n){return this._shouldDeferCall()?this._q.push(["logEvent"].concat(Array.prototype.slice.call(arguments,0))):this.logEventWithTimestamp(e,t,null,n)},ke.prototype.logEventWithTimestamp=function(e,t,n,r){return this._shouldDeferCall()?this._q.push(["logEventWithTimestamp"].concat(Array.prototype.slice.call(arguments,0))):this._apiKeySet("logEvent()")?H(e,"eventType","string")?$(e)?("function"===U(r)&&r(0,"No request sent",{reason:"Missing eventType"}),-1):this._logEvent(e,t,null,null,null,null,n,r):("function"===U(r)&&r(0,"No request sent",{reason:"Invalid type for eventType"}),-1):("function"===U(r)&&r(0,"No request sent",{reason:"API key not set"}),-1)},ke.prototype.logEventWithGroups=function(e,t,n,r){return this._shouldDeferCall()?this._q.push(["logEventWithGroups"].concat(Array.prototype.slice.call(arguments,0))):this._apiKeySet("logEventWithGroups()")?H(e,"eventType","string")?this._logEvent(e,t,null,null,n,null,null,r):("function"===U(r)&&r(0,"No request sent",{reason:"Invalid type for eventType"}),-1):("function"===U(r)&&r(0,"No request sent",{reason:"API key not set"}),-1)};var ze=function(e){return!isNaN(parseFloat(e))&&isFinite(e)};ke.prototype.logRevenueV2=function(e){if(this._shouldDeferCall())return this._q.push(["logRevenueV2"].concat(Array.prototype.slice.call(arguments,0)));if(this._apiKeySet("logRevenueV2()"))if("object"===U(e)&&e.hasOwnProperty("_q")&&(e=Be(new Re,e)),e instanceof Re){if(e&&e._isValidRevenue())return this.logEvent(m,e._toJSONObject())}else W.error("Invalid revenue input type. Expected Revenue object but saw "+U(e))},ke.prototype.logRevenue=function(e,t,n){return this._shouldDeferCall()?this._q.push(["logRevenue"].concat(Array.prototype.slice.call(arguments,0))):this._apiKeySet("logRevenue()")&&ze(e)&&(void 0===t||ze(t))?this._logEvent(m,{},{productId:n,special:"revenue_amount",quantity:t||1,price:e},null,null,null,null,null):-1},ke.prototype.removeEvents=function(e,t){Ye(this,"_unsentEvents",e),Ye(this,"_unsentIdentifys",t)};var Ye=function(e,t,n){if(!(n<0)){for(var r=[],i=0;i<e[t].length;i++)e[t][i].event_id>n&&r.push(e[t][i]);e[t]=r}};ke.prototype.sendEvents=function(e){if(this._apiKeySet("sendEvents()"))if(this.options.optOut)"function"===U(e)&&e(0,"No request sent",{reason:"optOut is set to true"});else if(0!==this._unsentCount())if(this._sending)"function"===U(e)&&e(0,"No request sent",{reason:"Request already in progress. Events will be sent once this request is complete"});else{this._sending=!0;var t=(this.options.forceHttps||"https:"===window.location.protocol?"https":"http")+"://"+this.options.apiEndpoint,n=Math.min(this._unsentCount(),this.options.uploadBatchSize),r=this._mergeEventsAndIdentifys(n),o=r.maxEventId,s=r.maxIdentifyId,a=JSON.stringify(r.eventsToSend),u=(new Date).getTime(),c={client:this.options.apiKey,e:a,v:i,upload_time:u,checksum:me(i+this.options.apiKey+a+u)},l=this;new Oe(t,c).send((function(t,r){l._sending=!1;try{200===t&&"success"===r?(l.removeEvents(o,s),l.options.saveEvents&&l.saveEvents(),l._sendEventsIfReady(e)||"function"!==U(e)||e(t,r)):413===t?(1===l.options.uploadBatchSize&&l.removeEvents(o,s),l.options.uploadBatchSize=Math.ceil(n/2),l.sendEvents(e)):"function"===U(e)&&e(t,r)}catch(e){}}))}else"function"===U(e)&&e(0,"No request sent",{reason:"No events to send"});else"function"===U(e)&&e(0,"No request sent",{reason:"API key not set"})},ke.prototype._mergeEventsAndIdentifys=function(e){for(var t=[],n=0,r=-1,i=0,o=-1;t.length<e;){var s,a=i>=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?r=(s=this._unsentEvents[n++]).event_id:u?o=(s=this._unsentIdentifys[i++]).event_id:!("sequence_number"in this._unsentEvents[n])||this._unsentEvents[n].sequence_number<this._unsentIdentifys[i].sequence_number?r=(s=this._unsentEvents[n++]).event_id:o=(s=this._unsentIdentifys[i++]).event_id,t.push(s)}return{eventsToSend:t,maxEventId:r,maxIdentifyId:o}},ke.prototype.setGlobalUserProperties=function(e){this.setUserProperties(e)},ke.prototype.__VERSION__="5.9.0",ke.prototype._shouldDeferCall=function(){return this._pendingReadStorage||this._initializationDeferred},ke.prototype._deferInitialization=function(){this._initializationDeferred=!0,this._q.push(["init"].concat(Array.prototype.slice.call(arguments,0)))},ke.prototype.enableTracking=function(){this._initializationDeferred=!1,De(this),this.runQueuedFunctions()};var Fe=function(){this.options=n({},Pe),this._q=[],this._instances={}};Fe.prototype.Identify=ge,Fe.prototype.Revenue=Re,Fe.prototype.getInstance=function(e){e=$(e)?r:e.toLowerCase();var t=this._instances[e];return void 0===t&&(t=new ke(e),this._instances[e]=t),t},Fe.prototype.runQueuedFunctions=function(){for(var e=0;e<this._q.length;e++){var t=this[this._q[e][0]];"function"===U(t)&&t.apply(this,this._q[e].slice(1))}for(var n in this._q=[],this._instances)this._instances.hasOwnProperty(n)&&this._instances[n].runQueuedFunctions()},Fe.prototype.init=function(e,t,n,r){this.getInstance().init(e,t,n,function(e){this.options=e.options,"function"===U(r)&&r(e)}.bind(this))},Fe.prototype.isNewSession=function(){return this.getInstance().isNewSession()},Fe.prototype.getSessionId=function(){return this.getInstance().getSessionId()},Fe.prototype.nextEventId=function(){return this.getInstance().nextEventId()},Fe.prototype.nextIdentifyId=function(){return this.getInstance().nextIdentifyId()},Fe.prototype.nextSequenceNumber=function(){return this.getInstance().nextSequenceNumber()},Fe.prototype.saveEvents=function(){this.getInstance().saveEvents()},Fe.prototype.setDomain=function(e){this.getInstance().setDomain(e)},Fe.prototype.setUserId=function(e){this.getInstance().setUserId(e)},Fe.prototype.setGroup=function(e,t){this.getInstance().setGroup(e,t)},Fe.prototype.setOptOut=function(e){this.getInstance().setOptOut(e)},Fe.prototype.regenerateDeviceId=function(){this.getInstance().regenerateDeviceId()},Fe.prototype.setDeviceId=function(e){this.getInstance().setDeviceId(e)},Fe.prototype.setUserProperties=function(e){this.getInstance().setUserProperties(e)},Fe.prototype.clearUserProperties=function(){this.getInstance().clearUserProperties()},Fe.prototype.identify=function(e,t){this.getInstance().identify(e,t)},Fe.prototype.setVersionName=function(e){this.getInstance().setVersionName(e)},Fe.prototype.logEvent=function(e,t,n){return this.getInstance().logEvent(e,t,n)},Fe.prototype.logEventWithGroups=function(e,t,n,r){return this.getInstance().logEventWithGroups(e,t,n,r)},Fe.prototype.logRevenueV2=function(e){return this.getInstance().logRevenueV2(e)},Fe.prototype.logRevenue=function(e,t,n){return this.getInstance().logRevenue(e,t,n)},Fe.prototype.removeEvents=function(e,t){this.getInstance().removeEvents(e,t)},Fe.prototype.sendEvents=function(e){this.getInstance().sendEvents(e)},Fe.prototype.setGlobalUserProperties=function(e){this.getInstance().setUserProperties(e)},Fe.prototype.__VERSION__="5.9.0";var Ge=window.amplitude||{},Ke=new Fe;for(var Ve in Ke._q=Ge._q||[],Ge._iq)Ge._iq.hasOwnProperty(Ve)&&(Ke.getInstance(Ve)._q=Ge._iq[Ve]._q||[]);return Ke.runQueuedFunctions(),Ke}()})).getInstance();ie.init("42ca3c6562cdbef619110c8b1d8bcfec");const oe=(e,t)=>{try{ie.logEvent(e,t)}catch(e){console.log("AmplitudeError",e)}},se=(e,t)=>t?e.classList.remove("hide"):e.classList.add("hide"),ae=({is_loading:e,logged_in:t,user:n={},creds:r}={})=>{const i=document.forms.instalogin;t?(document.querySelectorAll(".logged_in").forEach(e=>se(e,!0)),document.querySelectorAll(".not_logged_in").forEach(e=>se(e,!1))):(document.querySelectorAll(".logged_in").forEach(e=>se(e,!1)),document.querySelectorAll(".not_logged_in").forEach(e=>se(e,!0))),n&&(document.querySelector(".username-field").innerText=n.username),console.log("creds",r),void 0!==r&&r!=={}&&null!==r&&(i.elements.username.value=r.username,i.elements.password.value=r.password),console.log("is loading",e),e?document.querySelectorAll(".loading").forEach(e=>se(e,!0)):document.querySelectorAll(".loading").forEach(e=>se(e,!1))},ue=async()=>{const e=await i();try{const{logged_in:t,user:r}=await(async()=>{const{user:e}=await n.request({method:"check_login"});return console.log("update view, user =",e),{logged_in:!!e&&!!e.pk,user:e}})();ae({logged_in:t,user:r,creds:e})}catch(t){ae({logged_in:!1,user:null,creds:e}),alert(t.message)}},ce=async(e,t)=>{if(await(async()=>{const{user:e}=await n.request({method:"get_user_info",params:["instagram"]});console.log("@instagram",e.pk,e),await ue()})(),t){const{username:e,password:n}=t;await r(e,n),console.log("saved creds",e,n)}oe("Login Success",{isCookie:!t}),window.open("https://dashboard.likeup.me/")},le=async e=>{oe("Login Error",{reason:e}),alert(e),console.error("LoginError:",e)};window.onload=async()=>{oe("App Loaded");const e=document.forms.instalogin;var r;e&&(document.querySelector("#exit").onclick=async()=>{await o(),oe("Logout"),await n.request({method:"exit"}),await ue()},document.querySelector(".btn-get-cookies")&&(document.querySelector(".btn-get-cookies").onclick=async e=>{e.preventDefault();try{ae({is_loading:!0});await n.request({method:"login_via_cookie"});ce()}catch(e){console.log("Login Error",e),le(e.message);const{error:{response:t}}=e;console.error(t)}finally{ae({is_loading:!1})}}),e.onsubmit=async e=>{e.preventDefault();const{username:r,password:i}=document.forms.instalogin.elements,o={username:r.value,password:i.value};try{ae({is_loading:!0});await n.request({method:"login",params:[r.value,i.value]});ce(0,o)}catch(e){console.error(e);const{message:s,response:a}=e||{};if(console.error(a),e instanceof t)return void le(e.message);if(a.two_factor_required){const e=a,t=prompt("Input a code for two-factor auth from SMS");if(!t)return void le("No code");const s=await n.request({method:"login_2fa",params:[r.value,i.value,t,e]});"ok"===s.status?ce(0,o):le(s.error.message)}else a.challenge?(le(a.message),window.open(a.challenge.url)):le(a?a.message:s)}finally{ae({is_loading:!1})}},ae({is_loading:!0}),await(r=100,new Promise(e=>setTimeout(e,r))),await n.init(),await ue())}}));
//# sourceMappingURL=popup.js.map