mixpanel-browser
Version:
The official Mixpanel JavaScript browser client library
97 lines • 78.3 kB
JavaScript
(function(){function Cb(){function a(){a.done||(Qa=a.done=!0,Ra=!1,d.g(R,function(e){e.nd()}))}function b(){try{B.documentElement.doScroll("left")}catch(e){setTimeout(b,1);return}a()}if(B.addEventListener)"complete"===B.readyState?a():B.addEventListener("DOMContentLoaded",a,!1);else if(B.attachEvent){B.attachEvent("onreadystatechange",a);var c=!1;try{c=null===r.frameElement}catch(e){}B.documentElement.doScroll&&c&&b()}d.Oc(r,"load",a,!0)}function Db(){E.init=function(a,b,c){if(c)return E[c]||(E[c]=
R[c]=ma(a,b,c),E[c].ya()),E[c];c=E;R.mixpanel?c=R.mixpanel:a&&(c=ma(a,b,"mixpanel"),c.ya(),R.mixpanel=c);E=c;1===xa&&(r.mixpanel=E);Eb()}}function Eb(){d.g(R,function(a,b){"mixpanel"!==b&&(E[b]=a)});E._=d}function ya(a){a=d.j(a)?a:d.l(a)?{}:{days:a};return d.extend({},Fb,a)}function ma(a,b,c){var e="mixpanel"===c?E:E[c];if(e&&0===xa)var f=e;else{if(e&&!d.isArray(e)){z.error("You have already initialized "+c);return}f=new l}f.Qb={};f.ka(a,b,c);f.people=new x;f.people.ka(f);if(!f.h("skip_first_touch_marketing")){a=
d.info.la(null);var g={},k=!1;d.g(a,function(h,p){(g["initial_"+p]=h)&&(k=!0)});k&&f.people.aa(g)}S=S||f.h("debug");!d.l(e)&&d.isArray(e)&&(f.Va.call(f.people,e.people),f.Va(e));return f}function l(){}function Gb(a){return a}function Sa(a){throw Error(a+" not available in this build.");}function T(a){this.W=null;this.Pe=a}function y(a){this.props={};this.name=a.persistence_name?"mp_"+a.persistence_name:"mp_"+a.token+"_mixpanel";var b=a.persistence;"cookie"!==b&&"localStorage"!==b&&(z.s("Unknown persistence type "+
b+"; falling back to cookie"),b=a.persistence="cookie");"localStorage"===b&&d.localStorage.na()?this.storage=d.localStorage:this.storage=d.cookie;this.load();this.gd(a);this.upgrade();this.save()}function x(){}function C(){}function M(a,b){this.X=b.X;this.ra=new O(a,{X:d.bind(this.m,this),P:b.P,Yc:b.Yc,Zc:b.Zc,F:b.F,kb:b.kb});this.O=b.O;this.Be=b.Ce;this.Aa=b.Aa;this.Ne=b.Oe;this.S=this.O.batch_size;this.Ha=this.O.batch_flush_interval_ms;this.stopped=!this.O.batch_autostart;this.hb=0;this.V={};this.pc=
b.pc||!1}function Ta(a,b){var c=[];d.g(a,function(e){var f=e.id;f in b?(f=b[f],null!==f&&(e.payload=f,c.push(e))):c.push(e)});return c}function Ua(a,b){var c=[];d.g(a,function(e){e.id&&!b[e.id]&&c.push(e)});return c}function O(a,b){b=b||{};this.ba=a;if(this.F=b.F)this.P=b.P||new fa,this.lock=new Va(a,{storage:b.Yc||r.localStorage,Hb:b.Zc});this.m=b.X||d.bind(Wa.error,Wa);this.Oa=b.Oa||null;this.K=[];this.vb=!1;this.Ld=b.kb?Hb(d.bind(this.Sb,this),b.kb):d.bind(function(c){return this.Sb([c])},this)}
function fa(a){this.storage=a||r.localStorage}function Va(a,b){b=b||{};this.ba=a;this.storage=b.storage||r.localStorage;this.Lc=b.Lc||100;this.Hb=b.Hb||2E3;this.Mc=b.Mc||D}function na(){this.Hc="submit"}function ba(){this.Hc="click"}function Q(){}function A(a){this.nb=a.nb;this.pb=a.Qd;this.qc=a.Sd;this.track=a.bf}function K(a){this.A=a}function ha(){}function Xa(a){var b=Ib,c=a.split(".");c=c[c.length-1];if(4<c.length||"com"===c||"org"===c)b=Jb;return(a=a.match(b))?a[0]:""}function za(a){var b=Math.random().toString(36).substring(2,
10)+Math.random().toString(36).substring(2,10);return a?b.substring(0,a):b}function Hb(a,b){var c=null,e=[];return function(f){var g=this;e.push(f);c||(c=new D(function(k){setTimeout(function(){var h=a.apply(g,[e]);c=null;e=[];k(h)},b)}));return c}}function oa(a,b){return null===Aa||b?Aa=Ya(a||r.localStorage):Aa}function Ya(a){var b=!0;try{var c="__mplss_"+za(8);a.setItem(c,"xyz");"xyz"!==a.getItem(c)&&(b=!1);a.removeItem(c)}catch(e){b=!1}return b}function Za(a){a=a.prototype;for(var b in a)"function"===
typeof a[b]&&(a[b]=Ba(a[b]))}function Ba(a){return function(){try{return a.apply(this,arguments)}catch(b){z.s("Implementation error. Please turn on debug and contact support@mixpanel.com."),S&&z.s(b)}}}function ia(a){return{log:Ca(z.log,a),error:Ca(z.error,a),s:Ca(z.s,a)}}function Ca(a,b){return function(){arguments[0]="["+b+"] "+arguments[0];return a.apply(z,arguments)}}function pa(a,b){$a.add(a,b);Da||(Da=Kb($a.Kd))}function ab(a){var b=typeof a;if(null!==a&&("object"===b||"function"===b))var c=
a.then;return"function"===typeof c?c:!1}function Ea(){for(var a=0;a<this.N.length;a++){var b=void 0,c=void 0,e=1===this.state?this.N[a].Qe:this.N[a].Md,f=this.N[a];try{!1===e?f.reject(this.pa):(c=!0===e?this.pa:e.call(void 0,this.pa),c===f.promise?f.reject(TypeError("Promise-chain cycle")):(b=ab(c))?b.call(c,f.resolve,f.reject):f.resolve(c))}catch(g){f.reject(g)}}this.N.length=0}function bb(a){var b,c=this;if(!c.ua){c.ua=!0;c.Ga&&(c=c.Ga);try{(b=ab(a))?pa(function(){var e=new cb(c);try{b.call(a,function(){bb.apply(e,
arguments)},function(){ja.apply(e,arguments)})}catch(f){ja.call(e,f)}}):(c.pa=a,c.state=1,0<c.N.length&&pa(Ea,c))}catch(e){ja.call(new cb(c),e)}}}function ja(a){var b=this;b.ua||(b.ua=!0,b.Ga&&(b=b.Ga),b.pa=a,b.state=2,0<b.N.length&&pa(Ea,b))}function db(a,b,c,e){for(var f=0;f<b.length;f++)(function(g){a.resolve(b[g]).then(function(k){c(g,k)},e)})(f)}function cb(a){this.Ga=a;this.ua=!1}function Lb(a){this.promise=a;this.state=0;this.ua=!1;this.N=[];this.pa=void 0}function U(a){if("function"!==typeof a)throw TypeError("Not a function");
if(0!==this.__NPO__)throw TypeError("Not a promise");this.__NPO__=1;var b=new Lb(this);this.then=function(c,e){var f={Qe:"function"===typeof c?c:!0,Md:"function"===typeof e?e:!1};f.promise=new this.constructor(function(g,k){if("function"!==typeof g||"function"!==typeof k)throw TypeError("Not a function");f.resolve=g;f.reject=k});b.N.push(f);0!==b.state&&pa(Ea,b);return f.promise};this["catch"]=function(c){return this.then(void 0,c)};try{a.call(void 0,function(c){bb.call(b,c)},function(c){ja.call(b,
c)})}catch(c){ja.call(b,c)}}function eb(a,b,c){function e(f){z.error(b+" error: "+f)}return{na:function(f){(f=c(a,f))||z.error(b+" unsupported");return f},error:e,get:function(f){try{return a.getItem(f)}catch(g){e(g)}return null},parse:function(f){try{return d.fa(a.getItem(f))||{}}catch(g){}return null},set:function(f,g){try{a.setItem(f,g)}catch(k){e(k)}},remove:function(f){try{a.removeItem(f)}catch(g){e(g)}}}}function Fa(a){var b={};a=fb(a).split(" ");for(var c=0;c<a.length;c++){var e=a[c];e&&(b[e]=
!0)}return b}function fb(a){switch(typeof a.className){case "string":return a.className;case "object":return a.className.ff||a.getAttribute("class")||"";default:return""}}function Mb(a){if(a.previousElementSibling)return a.previousElementSibling;do a=a.previousSibling;while(a&&(!a||1!==a.nodeType));return a}function gb(a,b,c,e,f,g){var k={$classes:fb(a).split(" "),$tag_name:a.tagName.toLowerCase()},h=a.id;h&&(k.$id=h);Ga(a,b,f,g)&&d.g(Nb.concat(e),function(p){if(a.hasAttribute(p)&&!c[p]){var q=a.getAttribute(p);
qa(q)&&(k["$attr-"+p]=q)}});e=b=1;for(f=a;f=Mb(f);)b++,f.tagName===a.tagName&&e++;k.$nth_child=b;k.$nth_of_type=e;return k}function Ob(a,b){var c=b.wd,e=b.xd||[],f=b.Bd,g=b.Cd||[],k=b.Fd||!1,h=b.Ed||[],p=b.Gd||!1,q={};d.g(b.Ad||[],function(v){q[v]=!0});var n=null,m="undefined"===typeof a.target?a.srcElement:a.target;m&&3===m.nodeType&&(m=m.parentNode);if(Pb(m,a)&&Ha(m,a,c,e)&&!Ia(m,a,f,g)){b=[m];for(var t=m;t.parentNode&&!P(t,"body");)b.push(t.parentNode),t=t.parentNode;var w=[],u,G=!1;d.g(b,function(v){var N=
Ga(v,a,c,e);q.href||"a"!==v.tagName.toLowerCase()||(u=v.getAttribute("href"),u=N&&qa(u)&&u);Ia(v,a,f,g)&&(G=!0);w.push(gb(v,a,q,h,c,e))},this);if(!G&&(b=B.documentElement,n={$event_type:a.type,$host:r.location.host,$pathname:r.location.pathname,$elements:w,$el_attr__href:u,$viewportHeight:Math.max(b.clientHeight,r.innerHeight||0),$viewportWidth:Math.max(b.clientWidth,r.innerWidth||0),$pageHeight:B.body.offsetHeight||0,$pageWidth:B.body.offsetWidth||0},d.g(h,function(v){if(!q[v]&&m.hasAttribute(v)){var N=
m.getAttribute(v);qa(N)&&(n["$el_attr__"+v]=N)}}),k&&(b=hb(m,a,c,e))&&b.length&&(n.$el_text=b),"click"===a.type&&(d.g(Qb,function(v){v in a&&(n["$"+v]=a[v])}),p&&(n.$captured_for_heatmap=!0),m=Rb(a)),k&&(b=hb(m,a,c,e))&&b.length&&(n.$el_text=b),m)){if(!Ha(m,a,c,e)||Ia(m,a,f,g))return null;k=gb(m,a,q,h,c,e);n.$target=k;n.$el_classes=k.$classes;d.extend(n,d.ca({$el_id:k.$id,$el_tag_name:k.$tag_name}))}}return n}function hb(a,b,c,e){var f="";Ga(a,b,c,e)&&a.childNodes&&a.childNodes.length&&d.g(a.childNodes,
function(g){g&&3===g.nodeType&&g.textContent&&(f+=d.trim(g.textContent).split(/(\s+)/).filter(qa).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255))});return d.trim(f)}function Rb(a){var b=a.target;a=a.composedPath();for(var c=0;c<a.length;c++){var e=a[c];if(P(e,"a")||P(e,"button")||P(e,"input")||P(e,"select")||e.getAttribute&&"button"===e.getAttribute("role")){b=e;break}if(e===b)break}return b}function Ha(a,b,c,e){if(c)try{if(!c(a,b))return!1}catch(f){return I.s("Error while checking element in allowElementCallback",
f),!1}if(!e.length)return!0;for(b=0;b<e.length;b++){c=e[b];try{if(a.matches(c))return!0}catch(f){I.s("Error while checking selector: "+c,f)}}return!1}function Ia(a,b,c,e){if(c)try{if(c(a,b))return!0}catch(f){return I.s("Error while checking element in blockElementCallback",f),!0}if(e&&e.length)for(b=0;b<e.length;b++){c=e[b];try{if(a.matches(c))return!0}catch(f){I.s("Error while checking selector: "+c,f)}}a=Fa(a);for(b=0;b<Ja.length;b++)if(a[Ja[b]])return!0;return!1}function P(a,b){return a&&a.tagName&&
a.tagName.toLowerCase()===b.toLowerCase()}function Pb(a,b){if(!a||P(a,"html")||!a||1!==a.nodeType)return!1;switch(a.tagName.toLowerCase()){case "form":return"submit"===b.type;case "input":return-1===["button","submit"].indexOf(a.getAttribute("type"))?"change"===b.type:"click"===b.type;case "select":case "textarea":return"change"===b.type;default:return"click"===b.type}}function Ga(a,b,c,e){if(!Ha(a,b,c,e))return!1;for(c=a;c.parentNode&&!P(c,"body");c=c.parentNode)for(e=Fa(c),b=0;b<ib.length;b++)if(e[ib[b]])return!1;
c=Fa(a);for(b=0;b<jb.length;b++)if(c[jb[b]])return!0;if(P(a,"input")||P(a,"select")||P(a,"textarea")||"true"===a.getAttribute("contenteditable"))return!1;b=a.type||"";if("string"===typeof b)switch(b.toLowerCase()){case "hidden":return!1;case "password":return!1}a=a.name||a.id||"";return"string"===typeof a&&/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(a.replace(/[^a-zA-Z0-9]/g,""))?!1:!0}function qa(a){return null===a||
d.l(a)||"string"===typeof a&&(a=d.trim(a),/^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$/.test((a||"").replace(/[- ]/g,""))||/(^\d{3}-?\d{2}-?\d{4}$)/.test(a))?!1:!0}function Sb(a,b){kb(!0,a,b)}function Tb(a,b){kb(!1,a,b)}function Ub(a,b){return"1"===lb(a,b)}function mb(a,b){if(Vb(b))return z.warn('This browser has "Do Not Track" enabled. This will prevent the Mixpanel SDK from sending any data. To ignore the "Do Not Track" browser setting, initialize the Mixpanel instance with the config "ignore_dnt: true"'),
!0;(a="0"===lb(a,b))&&z.warn("You are opted out of Mixpanel tracking. This will prevent the Mixpanel SDK from sending any data.");return a}function Y(a){return Ka(a,function(b){return this.h(b)})}function V(a){return Ka(a,function(b){return this.I(b)})}function ca(a){return Ka(a,function(b){return this.I(b)})}function Wb(a,b){b=b||{};La(b).remove(Ma(a,b),!!b.ic,b.fc)}function La(a){a=a||{};return"localStorage"===a.Kc?d.localStorage:d.cookie}function Ma(a,b){b=b||{};return(b.Jc||"__mp_opt_in_out_")+
a}function lb(a,b){return La(b).get(Ma(a,b))}function Vb(a){if(a&&a.xc)return!1;a=a&&a.window||r;var b=a.navigator||{},c=!1;d.g([b.doNotTrack,b.msDoNotTrack,a.doNotTrack],function(e){d.includes([!0,1,"1","yes"],e)&&(c=!0)});return c}function kb(a,b,c){d.xb(b)&&b.length?(c=c||{},La(c).set(Ma(b,c),a?1:0,d.ge(c.hc)?c.hc:null,!!c.ic,!!c.Ae,!!c.Hd,c.fc),c.track&&a&&c.track(c.Ve||"$opt_in",c.Xe,{send_immediately:!0})):z.error("gdpr."+(a?"optIn":"optOut")+" called with an invalid token")}function Ka(a,b){return function(){var c=
!1;try{var e=b.call(this,"token"),f=b.call(this,"ignore_dnt"),g=b.call(this,"opt_out_tracking_persistence_type"),k=b.call(this,"opt_out_tracking_cookie_prefix"),h=b.call(this,"window");e&&(c=mb(e,{xc:f,Kc:g,Jc:k,window:h}))}catch(p){z.error("Unexpected error when checking tracking opt-out status: "+p)}if(!c)return a.apply(this,arguments);c=arguments[arguments.length-1];"function"===typeof c&&c(0)}}var S=!1;if("undefined"===typeof window){var nb={hostname:""};var r={crypto:{jf:function(){throw Error("unsupported");
}},navigator:{userAgent:"",onLine:!0},document:{createElement:function(){return{}},location:nb,referrer:""},screen:{width:0,height:0},location:nb,addEventListener:function(){},removeEventListener:function(){}}}else r=window;var ob=r.setImmediate,Da,pb=Object.prototype.toString,Kb="undefined"!==typeof ob?function(a){return ob(a)}:setTimeout;try{Object.defineProperty({},"x",{});var Z=function(a,b,c,e){return Object.defineProperty(a,b,{value:c,writable:!0,configurable:!1!==e})}}catch(a){Z=function(b,
c,e){b[c]=e;return b}}var $a=function(){function a(f,g){this.Od=f;this.self=g;this.next=void 0}var b,c,e;return{add:function(f,g){e=new a(f,g);c?c.next=e:b=e;c=e;e=void 0},Kd:function(){var f=b;for(b=c=Da=void 0;f;)f.Od.call(f.self),f=f.next}}}();var qb=Z({},"constructor",U,!1);U.prototype=qb;Z(qb,"__NPO__",0,!1);Z(U,"resolve",function(a){return a&&"object"===typeof a&&1===a.__NPO__?a:new this(function(b,c){if("function"!==typeof b||"function"!==typeof c)throw TypeError("Not a function");b(a)})});
Z(U,"reject",function(a){return new this(function(b,c){if("function"!==typeof b||"function"!==typeof c)throw TypeError("Not a function");c(a)})});Z(U,"all",function(a){var b=this;return"[object Array]"!==pb.call(a)?b.reject(TypeError("Not an array")):0===a.length?b.resolve([]):new b(function(c,e){if("function"!==typeof c||"function"!==typeof e)throw TypeError("Not a function");var f=a.length,g=Array(f),k=0;db(b,a,function(h,p){g[h]=p;++k===f&&c(g)},e)})});Z(U,"race",function(a){var b=this;return"[object Array]"!==
pb.call(a)?b.reject(TypeError("Not an array")):new b(function(c,e){if("function"!==typeof c||"function"!==typeof e)throw TypeError("Not a function");db(b,a,function(f,g){c(g)},e)})});var D="undefined"!==typeof Promise&&-1!==Promise.toString().indexOf("[native code]")?Promise:U;var ra=Array.prototype,rb=Object.prototype,aa=ra.slice,ka=rb.toString,sa=rb.hasOwnProperty,F=r.console,W=r.navigator,B=r.document,ta=r.opera,sb=r.screen,H=W.userAgent,Na=Function.prototype.bind,tb=ra.forEach,ub=ra.indexOf,vb=
ra.map,Xb=Array.isArray,Oa={},d={trim:function(a){return a.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}},z={log:function(){if(S&&!d.l(F)&&F)try{F.log.apply(F,arguments)}catch(a){d.g(arguments,function(b){F.log(b)})}},warn:function(){if(S&&!d.l(F)&&F){var a=["Mixpanel warning:"].concat(d.da(arguments));try{F.warn.apply(F,a)}catch(b){d.g(a,function(c){F.warn(c)})}}},error:function(){if(S&&!d.l(F)&&F){var a=["Mixpanel error:"].concat(d.da(arguments));try{F.error.apply(F,a)}catch(b){d.g(a,function(c){F.error(c)})}}},
s:function(){if(!d.l(F)&&F){var a=["Mixpanel error:"].concat(d.da(arguments));try{F.error.apply(F,a)}catch(b){d.g(a,function(c){F.error(c)})}}}};d.bind=function(a,b){var c;if(Na&&a.bind===Na)return Na.apply(a,aa.call(arguments,1));if(!d.wb(a))throw new TypeError;var e=aa.call(arguments,2);return c=function(){if(!(this instanceof c))return a.apply(b,e.concat(aa.call(arguments)));var f={};f.prototype=a.prototype;var g=new f;f.prototype=null;f=a.apply(g,e.concat(aa.call(arguments)));return Object(f)===
f?f:g}};d.g=function(a,b,c){if(null!==a&&void 0!==a)if(tb&&a.forEach===tb)a.forEach(b,c);else if(a.length===+a.length)for(var e=0,f=a.length;e<f&&!(e in a&&b.call(c,a[e],e,a)===Oa);e++);else for(e in a)if(sa.call(a,e)&&b.call(c,a[e],e,a)===Oa)break};d.extend=function(a){d.g(aa.call(arguments,1),function(b){for(var c in b)void 0!==b[c]&&(a[c]=b[c])});return a};d.isArray=Xb||function(a){return"[object Array]"===ka.call(a)};d.wb=function(a){try{return/^\s*\bfunction\b/.test(a)}catch(b){return!1}};d.de=
function(a){return!(!a||!sa.call(a,"callee"))};d.da=function(a){return a?a.da?a.da():d.isArray(a)||d.de(a)?aa.call(a):d.values(a):[]};d.map=function(a,b,c){if(vb&&a.map===vb)return a.map(b,c);var e=[];d.g(a,function(f){e.push(b.call(c,f))});return e};d.keys=function(a){var b=[];if(null===a)return b;d.g(a,function(c,e){b[b.length]=e});return b};d.values=function(a){var b=[];if(null===a)return b;d.g(a,function(c){b[b.length]=c});return b};d.ub=function(a,b){var c=!1;if(null===a)return c;if(ub&&a.indexOf===
ub)return-1!=a.indexOf(b);d.g(a,function(e){if(c||(c=e===b))return Oa});return c};d.includes=function(a,b){return-1!==a.indexOf(b)};d.zc=function(a,b){a.prototype=new b;a.prototype.constructor=a;a.Re=b.prototype};d.j=function(a){return a===Object(a)&&!d.isArray(a)};d.Ka=function(a){if(d.j(a)){for(var b in a)if(sa.call(a,b))return!1;return!0}return!1};d.l=function(a){return void 0===a};d.xb=function(a){return"[object String]"==ka.call(a)};d.ee=function(a){return"[object Date]"==ka.call(a)};d.ge=function(a){return"[object Number]"==
ka.call(a)};d.fe=function(a){return!(!a||1!==a.nodeType)};d.jb=function(a){d.g(a,function(b,c){d.ee(b)?a[c]=d.Pd(b):d.j(b)&&(a[c]=d.jb(b))});return a};d.timestamp=function(){Date.now=Date.now||function(){return+new Date};return Date.now()};d.Pd=function(a){function b(c){return 10>c?"0"+c:c}return a.getUTCFullYear()+"-"+b(a.getUTCMonth()+1)+"-"+b(a.getUTCDate())+"T"+b(a.getUTCHours())+":"+b(a.getUTCMinutes())+":"+b(a.getUTCSeconds())};d.ca=function(a){var b={};d.g(a,function(c,e){d.xb(c)&&0<c.length&&
(b[e]=c)});return b};d.truncate=function(a,b){if("string"===typeof a)var c=a.slice(0,b);else d.isArray(a)?(c=[],d.g(a,function(e){c.push(d.truncate(e,b))})):d.j(a)?(c={},d.g(a,function(e,f){c[f]=d.truncate(e,b)})):c=a;return c};d.Ob=function(){return function(a){function b(e,f){var g="";var k="";var h=g;(f=f[e])&&"object"===typeof f&&"function"===typeof f.toJSON&&(f=f.toJSON(e));switch(typeof f){case "string":return c(f);case "number":return isFinite(f)?String(f):"null";case "boolean":case "null":return String(f);
case "object":if(!f)return"null";g+=" ";e=[];if("[object Array]"===ka.apply(f)){var p=f.length;for(k=0;k<p;k+=1)e[k]=b(k,f)||"null";return p=0===e.length?"[]":g?"[\n"+g+e.join(",\n"+g)+"\n"+h+"]":"["+e.join(",")+"]"}for(k in f)sa.call(f,k)&&(p=b(k,f))&&e.push(c(k)+(g?": ":":")+p);return p=0===e.length?"{}":g?"{"+e.join(",")+h+"}":"{"+e.join(",")+"}"}}function c(e){var f=/[\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,g={"\b":"\\b",
"\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};f.lastIndex=0;return f.test(e)?'"'+e.replace(f,function(k){var h=g[k];return"string"===typeof h?h:"\\u"+("0000"+k.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+e+'"'}return b("",{"":a})}}();d.fa=function(){function a(){switch(h){case "t":return f("t"),f("r"),f("u"),f("e"),!0;case "f":return f("f"),f("a"),f("l"),f("s"),f("e"),!1;case "n":return f("n"),f("u"),f("l"),f("l"),null}g('Unexpected "'+h+'"')}function b(){for(;h&&" ">=h;)f()}
function c(){var m,t="",w;if('"'===h)for(;f();){if('"'===h)return f(),t;if("\\"===h)if(f(),"u"===h){for(m=w=0;4>m;m+=1){var u=parseInt(f(),16);if(!isFinite(u))break;w=16*w+u}t+=String.fromCharCode(w)}else if("string"===typeof p[h])t+=p[h];else break;else t+=h}g("Bad string")}function e(){var m="";"-"===h&&(m="-",f("-"));for(;"0"<=h&&"9">=h;)m+=h,f();if("."===h)for(m+=".";f()&&"0"<=h&&"9">=h;)m+=h;if("e"===h||"E"===h){m+=h;f();if("-"===h||"+"===h)m+=h,f();for(;"0"<=h&&"9">=h;)m+=h,f()}m=+m;if(isFinite(m))return m;
g("Bad number")}function f(m){m&&m!==h&&g("Expected '"+m+"' instead of '"+h+"'");h=q.charAt(k);k+=1;return h}function g(m){m=new SyntaxError(m);m.ef=k;m.text=q;throw m;}var k,h,p={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"},q;var n=function(){b();switch(h){case "{":a:{var m={};if("{"===h){f("{");b();if("}"===h){f("}");var t=m;break a}for(;h;){t=c();b();f(":");Object.hasOwnProperty.call(m,t)&&g('Duplicate key "'+t+'"');m[t]=n();b();if("}"===h){f("}");t=m;break a}f(",");b()}}g("Bad object");
t=void 0}return t;case "[":a:{t=[];if("["===h){f("[");b();if("]"===h){f("]");break a}for(;h;){t.push(n());b();if("]"===h){f("]");break a}f(",");b()}}g("Bad array");t=void 0}return t;case '"':return c();case "-":return e();default:return"0"<=h&&"9">=h?e():a()}};return function(m){q=m;k=0;h=" ";m=n();b();h&&g("Syntax error");return m}}();d.zd=function(a){var b=0,c=0,e=[];if(!a)return a;a=d.df(a);do{var f=a.charCodeAt(b++);var g=a.charCodeAt(b++);var k=a.charCodeAt(b++);var h=f<<16|g<<8|k;f=h>>18&63;
g=h>>12&63;k=h>>6&63;h&=63;e[c++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(f)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(g)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(k)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(h)}while(b<a.length);b=e.join("");switch(a.length%3){case 1:b=b.slice(0,-2)+"==";break;case 2:b=b.slice(0,-1)+"="}return b};d.df=function(a){a=(a+"").replace(/\r\n/g,
"\n").replace(/\r/g,"\n");var b="",c,e;var f=c=0;var g=a.length;for(e=0;e<g;e++){var k=a.charCodeAt(e),h=null;128>k?c++:h=127<k&&2048>k?String.fromCharCode(k>>6|192,k&63|128):String.fromCharCode(k>>12|224,k>>6&63|128,k&63|128);null!==h&&(c>f&&(b+=a.substring(f,c)),b+=h,f=c=e+1)}c>f&&(b+=a.substring(f,a.length));return b};d.Qa=function(){try{return r.crypto.randomUUID()}catch(c){for(var a=Array(36),b=0;36>b;b++)a[b]=Math.floor(16*Math.random());a[14]=4;a[19]=a[19]&=-5;a[19]=a[19]|=8;a[8]=a[13]=a[18]=
a[23]="-";return d.map(a,function(e){return e.toString(16)}).join("")}};var wb="ahrefsbot;ahrefssiteaudit;amazonbot;baiduspider;bingbot;bingpreview;chrome-lighthouse;facebookexternal;petalbot;pinterest;screaming frog;yahoo! slurp;yandex;adsbot-google;apis-google;duplexweb-google;feedfetcher-google;google favicon;google web preview;google-read-aloud;googlebot;googleweblight;mediapartners-google;storebot-google".split(";");d.Ac=function(a){var b;a=a.toLowerCase();for(b=0;b<wb.length;b++)if(-1!==a.indexOf(wb[b]))return!0;
return!1};d.Nb=function(a){var b,c,e,f=[];d.l(b)&&(b="&");d.g(a,function(g,k){c=encodeURIComponent(g.toString());e=encodeURIComponent(k);f[f.length]=e+"="+c});return f.join(b)};d.qb=function(a,b){b=b.replace(/[[]/g,"\\[").replace(/[\]]/g,"\\]");a=(new RegExp("[\\?&]"+b+"=([^&#]*)")).exec(a);if(null===a||a&&"string"!==typeof a[1]&&a[1].length)return"";a=a[1];try{a=decodeURIComponent(a)}catch(c){z.error("Skipping decoding for malformed query param: "+a)}return a.replace(/\+/g," ")};d.cookie={get:function(a){a+=
"=";for(var b=B.cookie.split(";"),c=0;c<b.length;c++){for(var e=b[c];" "==e.charAt(0);)e=e.substring(1,e.length);if(0===e.indexOf(a))return decodeURIComponent(e.substring(a.length,e.length))}return null},parse:function(a){try{var b=d.fa(d.cookie.get(a))||{}}catch(c){}return b},kf:function(a,b,c,e,f,g,k){var h="",p="",q="";k?h="; domain="+k:e&&(h=(h=Xa(B.location.hostname))?"; domain=."+h:"");c&&(p=new Date,p.setTime(p.getTime()+1E3*c),p="; expires="+p.toGMTString());g&&(f=!0,q="; SameSite=None");
f&&(q+="; secure");B.cookie=a+"="+encodeURIComponent(b)+p+"; path=/"+h+q},set:function(a,b,c,e,f,g,k){var h="",p="",q="";k?h="; domain="+k:e&&(h=(h=Xa(B.location.hostname))?"; domain=."+h:"");c&&(p=new Date,p.setTime(p.getTime()+864E5*c),p="; expires="+p.toGMTString());g&&(f=!0,q="; SameSite=None");f&&(q+="; secure");a=a+"="+encodeURIComponent(b)+p+"; path=/"+h+q;return B.cookie=a},remove:function(a,b,c){d.cookie.set(a,"",-1,b,!1,!1,c)}};var Aa=null,Pa=null;d.localStorage=eb(r.localStorage,"localStorage",
oa);d.sessionStorage=eb(r.sessionStorage,"sessionStorage",function(a,b){return null===Pa||b?Pa=Ya(a||r.sessionStorage):Pa});d.Oc=function(){function a(c,e,f){return function(g){if(g=g||b(r.event)){var k=!0,h;d.wb(f)&&(h=f(g));g=e.call(c,g);if(!1===h||!1===g)k=!1;return k}}}function b(c){c&&(c.preventDefault=b.preventDefault,c.stopPropagation=b.stopPropagation);return c}b.preventDefault=function(){this.returnValue=!1};b.stopPropagation=function(){this.cancelBubble=!0};return function(c,e,f,g,k){c?
c.addEventListener&&!g?c.addEventListener(e,f,!!k):(e="on"+e,c[e]=a(c,f,c[e])):z.error("No valid element provided to register_event")}}();var Yb=/^(\w*)\[(\w+)([=~\|\^\$\*]?)=?"?([^\]"]*)"?\]$/;d.Jd=function(){function a(f){return f.all?f.all:f.getElementsByTagName("*")}function b(f,g){g=" "+g+" ";return 0<=(" "+f.className+" ").replace(e," ").indexOf(g)}function c(f){if(!B.getElementsByTagName)return[];f=f.split(" ");var g,k,h,p,q=[B];for(k=0;k<f.length;k++){var n=f[k].replace(/^\s+/,"").replace(/\s+$/,
"");if(-1<n.indexOf("#")){var m=n.split("#");n=m[0];q=B.getElementById(m[1]);if(!q||n&&q.nodeName.toLowerCase()!=n)return[];q=[q]}else if(-1<n.indexOf(".")){m=n.split(".");n=m[0];var t=m[1];n||(n="*");m=[];for(h=g=0;h<q.length;h++){var w="*"==n?a(q[h]):q[h].getElementsByTagName(n);for(p=0;p<w.length;p++)m[g++]=w[p]}q=[];for(h=n=0;h<m.length;h++)m[h].className&&d.xb(m[h].className)&&b(m[h],t)&&(q[n++]=m[h])}else if(m=n.match(Yb)){n=m[1];var u=m[2];t=m[3];var G=m[4];n||(n="*");m=[];for(h=g=0;h<q.length;h++)for(w=
"*"==n?a(q[h]):q[h].getElementsByTagName(n),p=0;p<w.length;p++)m[g++]=w[p];q=[];n=0;switch(t){case "=":t=function(v){return v.getAttribute(u)==G};break;case "~":t=function(v){return v.getAttribute(u).match(new RegExp("\\b"+G+"\\b"))};break;case "|":t=function(v){return v.getAttribute(u).match(new RegExp("^"+G+"-?"))};break;case "^":t=function(v){return 0===v.getAttribute(u).indexOf(G)};break;case "$":t=function(v){return v.getAttribute(u).lastIndexOf(G)==v.getAttribute(u).length-G.length};break;case "*":t=
function(v){return-1<v.getAttribute(u).indexOf(G)};break;default:t=function(v){return v.getAttribute(u)}}q=[];for(h=n=0;h<m.length;h++)t(m[h])&&(q[n++]=m[h])}else{m=[];for(h=g=0;h<q.length;h++)for(w=q[h].getElementsByTagName(n),p=0;p<w.length;p++)m[g++]=w[p];q=m}}return q}var e=/[\t\r\n]/g;return function(f){return d.fe(f)?[f]:d.j(f)&&!d.l(f.length)?f:c.call(this,f)}}();var Zb="utm_source utm_medium utm_campaign utm_content utm_term utm_id utm_source_platform utm_campaign_id utm_creative_format utm_marketing_tactic".split(" "),
$b="dclid fbclid gclid ko_click_id li_fat_id msclkid sccid ttclid twclid wbraid".split(" ");d.info={la:function(a){var b="",c={};d.g(Zb,function(e){b=d.qb(B.URL,e);b.length?c[e]=b:void 0!==a&&(c[e]=a)});return c},ec:function(){var a="",b={};d.g($b,function(c){a=d.qb(B.URL,c);a.length&&(b[c]=a)});return b},oe:function(){return d.extend(d.info.la(),d.info.ec())},ye:function(a){return 0===a.search("https?://(.*)google.([^/?]*)")?"google":0===a.search("https?://(.*)bing.com")?"bing":0===a.search("https?://(.*)yahoo.com")?
"yahoo":0===a.search("https?://(.*)duckduckgo.com")?"duckduckgo":null},ze:function(a){var b=d.info.ye(a),c={};null!==b&&(c.$search_engine=b,a=d.qb(a,"yahoo"!=b?"q":"p"),a.length&&(c.mp_keyword=a));return c},Ba:function(a,b,c){b=b||"";return c||d.includes(a," OPR/")?d.includes(a,"Mini")?"Opera Mini":"Opera":/(BlackBerry|PlayBook|BB10)/i.test(a)?"BlackBerry":d.includes(a,"IEMobile")||d.includes(a,"WPDesktop")?"Internet Explorer Mobile":d.includes(a,"SamsungBrowser/")?"Samsung Internet":d.includes(a,
"Edge")||d.includes(a,"Edg/")?"Microsoft Edge":d.includes(a,"FBIOS")?"Facebook Mobile":d.includes(a,"Whale/")?"Whale Browser":d.includes(a,"Chrome")?"Chrome":d.includes(a,"CriOS")?"Chrome iOS":d.includes(a,"UCWEB")||d.includes(a,"UCBrowser")?"UC Browser":d.includes(a,"FxiOS")?"Firefox iOS":d.includes(b,"Apple")?d.includes(a,"Mobile")?"Mobile Safari":"Safari":d.includes(a,"Android")?"Android Mobile":d.includes(a,"Konqueror")?"Konqueror":d.includes(a,"Firefox")?"Firefox":d.includes(a,"MSIE")||d.includes(a,
"Trident/")?"Internet Explorer":d.includes(a,"Gecko")?"Mozilla":""},gb:function(a,b,c){b={"Internet Explorer Mobile":/rv:(\d+(\.\d+)?)/,"Microsoft Edge":/Edge?\/(\d+(\.\d+)?)/,Chrome:/Chrome\/(\d+(\.\d+)?)/,"Chrome iOS":/CriOS\/(\d+(\.\d+)?)/,"UC Browser":/(UCBrowser|UCWEB)\/(\d+(\.\d+)?)/,Safari:/Version\/(\d+(\.\d+)?)/,"Mobile Safari":/Version\/(\d+(\.\d+)?)/,Opera:/(Opera|OPR)\/(\d+(\.\d+)?)/,Firefox:/Firefox\/(\d+(\.\d+)?)/,"Firefox iOS":/FxiOS\/(\d+(\.\d+)?)/,Konqueror:/Konqueror:(\d+(\.\d+)?)/,
BlackBerry:/BlackBerry (\d+(\.\d+)?)/,"Android Mobile":/android\s(\d+(\.\d+)?)/,"Samsung Internet":/SamsungBrowser\/(\d+(\.\d+)?)/,"Internet Explorer":/(rv:|MSIE )(\d+(\.\d+)?)/,Mozilla:/rv:(\d+(\.\d+)?)/,"Whale Browser":/Whale\/(\d+(\.\d+)?)/}[d.info.Ba(a,b,c)];return void 0===b?null:(a=a.match(b))?parseFloat(a[a.length-2]):null},Gc:function(){return/Windows/i.test(H)?/Phone/.test(H)||/WPDesktop/.test(H)?"Windows Phone":"Windows":/(iPhone|iPad|iPod)/.test(H)?"iOS":/Android/.test(H)?"Android":/(BlackBerry|PlayBook|BB10)/i.test(H)?
"BlackBerry":/Mac/i.test(H)?"Mac OS X":/Linux/.test(H)?"Linux":/CrOS/.test(H)?"Chrome OS":""},mc:function(a){return/Windows Phone/i.test(a)||/WPDesktop/.test(a)?"Windows Phone":/iPad/.test(a)?"iPad":/iPod/.test(a)?"iPod Touch":/iPhone/.test(a)?"iPhone":/(BlackBerry|PlayBook|BB10)/i.test(a)?"BlackBerry":/Android/.test(a)?"Android":""},Nc:function(a){a=a.split("/");return 3<=a.length?a[2]:""},Ea:function(){return r.location.href},qa:function(a){"object"!==typeof a&&(a={});return d.extend(d.ca({$os:d.info.Gc(),
$browser:d.info.Ba(H,W.vendor,ta),$referrer:B.referrer,$referring_domain:d.info.Nc(B.referrer),$device:d.info.mc(H)}),{$current_url:d.info.Ea(),$browser_version:d.info.gb(H,W.vendor,ta),$screen_height:sb.height,$screen_width:sb.width,mp_lib:"web",$lib_version:"2.67.0",$insert_id:za(),time:d.timestamp()/1E3},d.ca(a))},te:function(){return d.extend(d.ca({$os:d.info.Gc(),$browser:d.info.Ba(H,W.vendor,ta)}),{$browser_version:d.info.gb(H,W.vendor,ta)})},pe:function(){return d.ca({current_page_title:B.title,
current_domain:r.location.hostname,current_url_path:r.location.pathname,current_url_protocol:r.location.protocol,current_url_search:r.location.search})}};var Jb=/[a-z0-9][a-z0-9-]*\.[a-z]+$/i,Ib=/[a-z0-9][a-z0-9-]+\.[a-z.]{2,6}$/i,da=null,ua=null;"undefined"!==typeof JSON&&(da=JSON.stringify,ua=JSON.parse);da=da||d.Ob;ua=ua||d.fa;d.info=d.info;d.info.browser=d.info.Ba;d.info.browserVersion=d.info.gb;d.info.device=d.info.mc;d.info.properties=d.info.qa;d.isBlockedUA=d.Ac;d.isEmptyObject=d.Ka;d.isObject=
d.j;d.JSONDecode=d.fa;d.JSONEncode=d.Ob;d.toArray=d.da;d.NPO=U;var Qb="clientX clientY offsetX offsetY pageX pageY screenX screenY x y".split(" "),jb=["mp-include"],Ja=["mp-no-track"],ib=Ja.concat(["mp-sensitive"]),Nb="aria-label aria-labelledby aria-describedby href name role title type".split(" "),I=ia("autocapture"),xb={allow_selectors:[],allow_url_regexes:[],block_attrs:[],block_element_callback:null,block_selectors:[],block_url_regexes:[],capture_extra_attrs:[],capture_text_content:!1,scroll_capture_all:!1,
scroll_depth_percent_checkpoints:[25,50,75,100],click:!0,input:!0,pageview:"full-url",scroll:!0,submit:!0},va={$mp_autocapture:!0};K.prototype.B=function(){try{var a=!!B.createElement("div").matches}catch(b){a=!1}a?(this.$d(),this.Yd(),this.Zd(),this.ae(),this.be()):I.s("Autocapture unavailable: missing required DOM APIs")};K.prototype.ob=function(){var a=this.A.h("autocapture");return a?d.j(a)?d.extend({},xb,a):xb:{}};K.prototype.o=function(a){return this.ob()[a]};K.prototype.Fa=function(){var a,
b=d.info.Ea(),c=this.o("allow_url_regexes")||[];if(c.length){var e=!1;for(a=0;a<c.length;a++){var f=c[a];try{if(b.match(f)){e=!0;break}}catch(g){return I.s("Error while checking block URL regex: "+f,g),!0}}if(!e)return!0}c=this.o("block_url_regexes")||[];if(!c||!c.length)return!1;for(a=0;a<c.length;a++)try{if(b.match(c[a]))return!0}catch(g){return I.s("Error while checking block URL regex: "+c[a],g),!0}return!1};K.prototype.Ic=function(){return this.A.h("autocapture")?this.o("pageview"):this.A.h("track_pageview")};
K.prototype.Ib=function(a,b){!this.Fa()&&(a=Ob(a,{wd:this.o("allow_element_callback"),xd:this.o("allow_selectors"),Ad:this.o("block_attrs"),Bd:this.o("block_element_callback"),Cd:this.o("block_selectors"),Ed:this.o("capture_extra_attrs"),Fd:this.o("capture_text_content"),Gd:"$mp_click"===b&&!this.o("click")&&this.A.Dc()}))&&(d.extend(a,va),this.A.track(b,a))};K.prototype.Yd=function(){r.removeEventListener("click",this.ie);if(this.o("click")||this.A.h("record_heatmap_data"))I.log("Initializing click tracking"),
this.ie=r.addEventListener("click",function(a){(this.o("click")||this.A.Dc())&&this.Ib(a,"$mp_click")}.bind(this))};K.prototype.Zd=function(){r.removeEventListener("change",this.he);this.o("input")&&(I.log("Initializing input tracking"),this.he=r.addEventListener("change",function(a){this.o("input")&&this.Ib(a,"$mp_input_change")}.bind(this)))};K.prototype.$d=function(){r.removeEventListener("popstate",this.le);r.removeEventListener("hashchange",this.je);r.removeEventListener("mp_locationchange",
this.ke);if(this.Ic()){I.log("Initializing pageview tracking");var a="",b=!1;this.Fa()||(b=this.A.Jb(va));b&&(a=d.info.Ea());this.le=r.addEventListener("popstate",function(){r.dispatchEvent(new Event("mp_locationchange"))});this.je=r.addEventListener("hashchange",function(){r.dispatchEvent(new Event("mp_locationchange"))});var c=r.history.pushState;"function"===typeof c&&(r.history.pushState=function(f,g,k){c.call(r.history,f,g,k);r.dispatchEvent(new Event("mp_locationchange"))});var e=r.history.replaceState;
"function"===typeof e&&(r.history.replaceState=function(f,g,k){e.call(r.history,f,g,k);r.dispatchEvent(new Event("mp_locationchange"))});this.ke=r.addEventListener("mp_locationchange",Ba(function(){if(!this.Fa()){var f=d.info.Ea(),g=!1,k=f.split("#")[0].split("?")[0]!==a.split("#")[0].split("?")[0],h=this.Ic();"full-url"===h?g=f!==a:"url-with-path-and-query-string"===h?g=f.split("#")[0]!==a.split("#")[0]:"url-with-path"===h&&(g=k);g&&(this.A.Jb(va)&&(a=f),k&&(this.La=0,I.log("Path change: re-initializing scroll depth checkpoints")))}}.bind(this)))}};
K.prototype.ae=function(){r.removeEventListener("scrollend",this.me);this.o("scroll")&&(I.log("Initializing scroll tracking"),this.La=0,this.me=r.addEventListener("scrollend",Ba(function(){if(this.o("scroll")&&!this.Fa()){var a=this.o("scroll_capture_all"),b=(this.o("scroll_depth_percent_checkpoints")||[]).slice().sort(function(h,p){return h-p}),c=r.scrollY,e=d.extend({$scroll_top:c},va);try{var f=B.body.scrollHeight,g=Math.round(c/(f-r.innerHeight)*100);e.$scroll_height=f;e.$scroll_percentage=g;
if(g>this.La)for(c=0;c<b.length;c++){var k=b[c];g>=k&&this.La<k&&(this.La=e.$scroll_checkpoint=k,a=!0)}}catch(h){I.s("Error while calculating scroll percentage",h)}a&&this.A.track("$mp_scroll",e)}}.bind(this))))};K.prototype.be=function(){r.removeEventListener("submit",this.ne);this.o("submit")&&(I.log("Initializing submit tracking"),this.ne=r.addEventListener("submit",function(a){this.o("submit")&&this.Ib(a,"$mp_submit")}.bind(this)))};Za(K);var ac=r.fetch,J=ia("flags"),yb={context:{}};A.prototype.B=
function(){ac&&"undefined"!==typeof Promise&&"undefined"!==typeof Map&&"undefined"!==typeof Set?(this.flags=null,this.nc(),this.cd=new Set):J.s("Feature Flags unavailable: missing minimum required APIs")};A.prototype.ob=function(){var a=this.pb("flags");return a?d.j(a)?d.extend({},yb,a):yb:{}};A.prototype.o=function(a){return this.ob()[a]};A.prototype.Cc=function(){return!!this.pb("flags")};A.prototype.ac=function(){this.Cc()||J.error("Feature Flags not enabled");return!!this.flags};A.prototype.nc=
function(){if(this.Cc()){var a=this.qc("distinct_id"),b=this.qc("$device_id");J.log("Fetching flags for distinct ID: "+a);a={context:d.extend({distinct_id:a,device_id:b},this.o("context"))};this.Wa=Date.now();this.oc=r.fetch(this.nb(),{method:"POST",headers:{Authorization:"Basic "+btoa(this.pb("token")+":"),"Content-Type":"application/octet-stream"},body:JSON.stringify(a)}).then(function(c){this.yb();return c.json().then(function(e){e=e.flags;if(!e)throw Error("No flags in API response");var f=new Map;
d.g(e,function(g,k){f.set(k,{key:g.variant_key,value:g.variant_value})});this.flags=f}.bind(this)).catch(function(e){this.yb();J.error(e)}.bind(this))}.bind(this)).catch(function(c){this.yb();J.error(c)}.bind(this))}};A.prototype.yb=function(){this.Wa?(this.Vb=this.Wa,this.Ub=Date.now(),this.pd=this.Ub-this.Vb,this.Wa=null):J.error("Fetch in progress started time not set, cannot mark fetch complete")};A.prototype.rc=function(a,b){return this.oc?this.oc.then(function(){return this.rb(a,b)}.bind(this)).catch(function(c){J.error(c);
return b}):new Promise(function(c){J.s("Feature Flags not initialized");c(b)})};A.prototype.rb=function(a,b){if(!this.ac())return J.log("Flags not loaded yet"),b;var c=this.flags.get(a);if(!c)return J.log('No flag found: "'+a+'"'),b;this.We(a,c);return c};A.prototype.sb=function(a,b){return this.rc(a,{value:b}).then(function(c){return c.value}).catch(function(c){J.error(c);return b})};A.prototype.Rd=function(a,b){J.s("mixpanel.flags.get_feature_data() is deprecated and will be removed in a future release. Use mixpanel.flags.get_variant_value() instead.");
return this.sb(a,b)};A.prototype.sc=function(a,b){return this.rb(a,{value:b}).value};A.prototype.isEnabled=function(a,b){return this.sb(a).then(function(){return this.Bc(a,b)}.bind(this)).catch(function(c){J.error(c);return b})};A.prototype.Bc=function(a,b){b=b||!1;var c=this.sc(a,b);!0!==c&&!1!==c&&(J.error('Feature flag "'+a+'" value: '+c+" is not a boolean; returning fallback value: "+b),c=b);return c};A.prototype.We=function(a,b){this.cd.has(a)||(this.cd.add(a),this.track("$experiment_started",
{"Experiment name":a,"Variant name":b.key,$experiment_type:"feature_flag","Variant fetch start time":(new Date(this.Vb)).toISOString(),"Variant fetch complete time":(new Date(this.Ub)).toISOString(),"Variant fetch latency (ms)":this.pd}))};Za(A);A.prototype.are_flags_ready=A.prototype.ac;A.prototype.get_variant=A.prototype.rc;A.prototype.get_variant_sync=A.prototype.rb;A.prototype.get_variant_value=A.prototype.sb;A.prototype.get_variant_value_sync=A.prototype.sc;A.prototype.is_enabled=A.prototype.isEnabled;
A.prototype.is_enabled_sync=A.prototype.Bc;A.prototype.get_feature_data=A.prototype.Rd;Q.prototype.Da=function(){};Q.prototype.lb=function(){};Q.prototype.cb=function(){};Q.prototype.B=function(a){this.A=a;return this};Q.prototype.track=function(a,b,c,e){var f=this,g=d.Jd(a);if(0===g.length)z.error("The DOM query ("+a+") returned 0 elements");else return d.g(g,function(k){d.Oc(k,this.Hc,function(h){var p={},q=f.Da(c,this),n=f.A.h("track_links_timeout");f.lb(h,this,p);window.setTimeout(f.bd(e,q,p,
!0),n);f.A.track(b,q,f.bd(e,q,p))})},this),!0};Q.prototype.bd=function(a,b,c,e){e=e||!1;var f=this;return function(){c.Dd||(c.Dd=!0,a&&!1===a(e,b)||f.cb(c))}};Q.prototype.Da=function(a,b){return"function"===typeof a?a(b):d.extend({},a)};d.zc(ba,Q);ba.prototype.Da=function(a,b){var c=ba.Re.Da.apply(this,arguments);b.href&&(c.url=b.href);return c};ba.prototype.lb=function(a,b,c){c.Ec=2===a.which||a.metaKey||a.ctrlKey||"_blank"===b.target;c.href=b.href;c.Ec||a.preventDefault()};ba.prototype.cb=function(a){a.Ec||
setTimeout(function(){window.location=a.href},0)};d.zc(na,Q);na.prototype.lb=function(a,b,c){c.element=b;a.preventDefault()};na.prototype.cb=function(a){setTimeout(function(){a.element.submit()},0)};var bc=ia("lock");Va.prototype.Mb=function(a,b){return new this.Mc(d.bind(function(c,e){function f(){function L(){u.removeItem(N);u.getItem(v)===q&&u.removeItem(v);u.getItem(G)===q&&u.removeItem(G)}u.setItem(N,"1");a().then(function(X){L();c(X)}).catch(function(X){L();e(X)})}function g(){u.setItem(G,q);
h(k,function(){u.getItem(G)===q?f():p(function(){u.getItem(v)!==q?g():h(function(){return!u.getItem(N)},f)})})}function k(){var L=u.getItem(v);if(L&&L!==q)return!1;u.setItem(v,q);if(u.getItem(v)===q)return!0;oa(u,!0)||e(Error("localStorage support dropped while acquiring lock"));return!1}function h(L,X){L()?X():p(function(){h(L,X)})}function p(L){(new Date).getTime()-n>w?(bc.error("Timeout waiting for mutex on "+m+"; clearing lock. ["+q+"]"),u.removeItem(N),u.removeItem(v),g()):setTimeout(function(){try{L()}catch(X){e(X)}},
t*(Math.random()+.1))}var q=b||(new Date).getTime()+"|"+Math.random(),n=(new Date).getTime(),m=this.ba,t=this.Lc,w=this.Hb,u=this.storage,G=m+":X",v=m+":Y",N=m+":Z";try{if(oa(u,!0))g();else throw Error("localStorage support check failed");}catch(L){e(L)}},this))};fa.prototype.B=function(){return D.resolve()};fa.prototype.setItem=function(a,b){return new D(d.bind(function(c,e){try{this.storage.setItem(a,da(b))}catch(f){e(f)}c()},this))};fa.prototype.getItem=function(a){return new D(d.bind(function(b,
c){try{var e=ua(this.storage.getItem(a))}catch(f){c(f)}b(e)},this))};fa.prototype.removeItem=function(a){return new D(d.bind(function(b,c){try{this.storage.removeItem(a)}catch(e){c(e)}b()},this))};var Wa=ia("batch");O.prototype.T=function(){return this.vb?D.resolve():this.P.B().then(d.bind(function(){this.vb=!0},this)).catch(d.bind(function(a){this.m("Error initializing queue persistence. Disabling persistence",a);this.vb=!0;this.F=!1},this))};O.prototype.enqueue=function(a,b){a={id:za(),flushAfter:(new Date).getTime()+
2*b,payload:a};if(this.F)return this.Ld(a);this.K.push(a);return D.resolve(!0)};O.prototype.Sb=function(a){var b=d.bind(function(){return this.T().then(d.bind(function(){return this.ta()},this)).then(d.bind(function(c){return this.Cb(c.concat(a))},this)).then(d.bind(function(c){c&&(this.K=this.K.concat(a));return c},this)).catch(d.bind(function(c){this.m("Error enqueueing items",c,a);return!1},this))},this);return this.lock.Mb(b,this.Oa).catch(d.bind(function(c){this.m("Error acquiring storage lock",
c);return!1},this))};O.prototype.Nd=function(a){var b=this.K.slice(0,a);return this.F&&b.length<a?this.T().then(d.bind(function(){return this.ta()},this)).then(d.bind(function(c){if(c.length){var e={};d.g(b,function(k){e[k.id]=!0});for(var f=0;f<c.length;f++){var g=c[f];if((new Date).getTime()>g.flushAfter&&!e[g.id]&&(g.re=!0,b.push(g),b.length>=a))break}}return b},this)):D.resolve(b)};O.prototype.ue=function(a){var b={};d.g(a,function(e){b[e]=!0});this.K=Ua(this.K,b);if(this.F){var c=d.bind(function(){return this.T().then(d.bind(function(){return this.ta()},
this)).then(d.bind(function(e){e=Ua(e,b);return this.Cb(e)},this)).then(d.bind(function(){return this.ta()},this)).then(d.bind(function(e){for(var f=0;f<e.length;f++){var g=e[f];if(g.id&&b[g.id])throw Error("Item not removed from storage");}return!0},this)).catch(d.bind(function(e){this.m("Error removing items",e,a);return!1},this))},this);return this.lock.Mb(c,this.Oa).catch(d.bind(function(e){this.m("Error acquiring storage lock",e);return oa(this.lock.storage,!0)?!1:c().then(d.bind(function(f){return f?
f:this.P.removeItem(this.ba).then(function(){return f})},this)).catch(d.bind(function(f){this.m("Error clearing queue",f);return!1},this))},this))}return D.resolve(!0)};O.prototype.cf=function(a){this.K=Ta(this.K,a);return this.F?this.lock.Mb(d.bind(function(){return this.T().then(d.bind(function(){return this.ta()},this)).then(d.bind(function(b){b=Ta(b,a);return this.Cb(b)},this)).catch(d.bind(function(b){this.m("Error updating items",a,b);return!1},this))},this),this.Oa).catch(d.bind(function(b){this.m("Error acquiring storage lock",
b);return!1},this)):D.resolve(!0)};O.prototype.ta=function(){return this.T().then(d.bind(function(){return this.P.getItem(this.ba)},this)).then(d.bind(function(a){a&&!d.isArray(a)&&(this.m("Invalid storage entry:",a),a=null);return a||[]},this)).catch(d.bind(function(a){this.m("Error retrieving queue",a);return[]},this))};O.prototype.Cb=function(a){return this.T().then(d.bind(function(){return this.P.setItem(this.ba,a)},this)).then(function(){return!0}).catch(d.bind(function(b){this.m("Error saving queue",
b);return!1},this))};O.prototype.clear=function(){this.K=[];return this.F?this.T().then(d.bind(function(){return this.P.removeItem(this.ba)},this)):D.resolve()};var la=ia("batch");M.prototype.enqueue=function(a){return this.ra.enqueue(a,this.Ha)};M.prototype.start=function(){this.stopped=!1;this.hb=0;return this.flush()};M.prototype.stop=function(){this.stopped=!0;this.Gb&&(clearTimeout(this.Gb),this.Gb=null)};M.prototype.clear=function(){return this.ra.clear()};M.prototype.Qc=function(){this.S=this.O.batch_size};
M.prototype.$=function(){this.Sc(this.O.batch_flush_interval_ms)};M.prototype.Sc=function(a){this.Ha=a;this.stopped||(this.Gb=setTimeout(d.bind(function(){this.stopped||this.flush()},this),this.Ha))};M.prototype.De=function(a,b){return new D(d.bind(function(c){this.Be(a,b,c)},this))};M.prototype.flush=function(a){if(this.Bb)return la.log("Flush: Request already in progress"),D.resolve();this.Bb=!0;a=a||{};var b=this.O.batch_request_timeout_ms,c=(new Date).getTime(),e=this.S;return this.ra.Nd(e).then(d.bind(function(f){var g=
f.length===e,k=[],h={};d.g(f,function(m){var t=m.payload;this.Aa&&!m.re&&(t=this.Aa(t));if(t){t.event&&t.properties&&(t.properties=d.extend({},t.properties,{mp_sent_by_lib_version:"2.67.0"}));var w=!0,u=m.id;u?5<(this.V[u]||0)&&(this.m("[dupe] item ID sent too many times, not sending",{item:m,S:f.length,Ue:this.V[u]}),w=!1):this.m("[dupe] found item with no ID",{item:m});w&&k.push(t)}h[m.id]=t},this);if(1>k.length)return this.Bb=!1,this.$(),D.resolve();var p=d.bind(function(){return this.ra.ue(d.map(f,
function(m){return m.id})).then(d.bind(function(m){d.g(f,d.bind(function(t){var w=t.id;w?(this.V[w]=this.V[w]||0,this.V[w]++,5<this.V[w]&&this.m("[dupe] item ID sent too many times",{item:t,S:f.length,Ue:this.V[w]})):this.m("[dupe] found item with no ID while removing",{item:t})},this));if(m)return this.hb=0,this.pc&&!g?(this.$(),D.resolve()):this.flush();5<++this.hb?(this.m("Too many queue failures; disabling batching system."),this.Ne()):this.$();return D.resolve()},this))},this),q=d.bind(function(m){this.Bb=
!1;try{if(a.ed)return this.ra.cf(h);if(d.j(m)&&"timeout"===m.error&&(new Date).getTime()-c>=b)return this.m("Network timeout; retrying"),this.flush();var t;if(t=d.j(m)){var w;if(!(w=500<=m.Ja||429===m.Ja)){var u;if(u=0>=m.Ja){var G=r.navigator.onLine;u=!(d.l(G)||G)}w=u}t=w||"timeout"===m.error}if(t){var v=2*this.Ha;m.Rc&&(v=1E3*parseInt(m.Rc,10)||v);v=Math.min(6E5,v);this.m("Error; retry in "+v+" ms");this.Sc(v);return D.resolve()}if(d.j(m)&&413===m.Ja){if(1<f.length)return this.S=Math.min(this.S,
Math.max(1,Math.floor(e/2)),f.length-1),this.m("413 response; reducing batch size to "+this.S),this.$(),D.resolve();this.m("Single-event request too large; dropping",f);this.Qc()}return p()}catch(N){this.m("Error handling API response",N),this.$()}},this),n={method:"POST",jd:!0,Xd:!0,ad:b};a.ed&&(n.Kb="sendBeacon");la.log("MIXPANEL REQUEST:",k);return this.De(k,n).then(q)},this)).catch(d.bind(function(f){this.m("Error flushing request queue",f);this.$()},this))};M.prototype.m=function(a,b){la.error.apply(la.error,
arguments);if(this.X)try{b instanceof Error||(b=Error(a)),this.X(a,b)}catch(c){la.error(c)}};var zb={Uc:function(a,b){var c={},e={};d.j(a)?d.g(a,function(f,g){this.M(g)||(e[g]=f)},this):e[a]=b;c.$set=e;return c},fd:function(a){var b={},c=[];d.isArray(a)||(a=[a]);d.g(a,function(e){this.M(e)||c.push(e)},this);b.$unset=c;return b},Xc:function(a,b){var c={},e={};d.j(a)?d.g(a,function(f,g){this.M(g)||(e[g]=f)},this):e[a]=b;c.$set_once=e;return c},dd:function(a,b){var c={},e={};d.j(a)?d.g(a,function(f,
g){this.M(g)||(e[g]=d.isArray(f)?f:[f])},this):e[a]=d.isArray(b)?b:[b];c.$union=e;return c},yd:function(a,b){var c={},e={};d.j(a)?d.g(a,function(f,g){this.M(g)||(e[g]=f)},this):e[a]=b;c.$append=e;return c},Pc:function(a,b){var c={},e={};d.j(a)?d.g(a,function(f,g){this.M(g)||(e[g]=f)},this):e[a]=b;c.$remove=e;return c},gf:function(){return{$delete:""}}};d.extend(C.prototype,zb);C.prototype.ka=function(a,b,c){this.i=a;this.Za=b;this.Ya=c};C.prototype.set=ca(function(a,b,c){var e=this.Uc(a,b);d.j(a)&&
(c=b);return this.u(e,c)});C.prototype.aa=ca(function(a,b,c){var e=this.Xc(a,b);d.j(a)&&(c=b);return this.u(e,c)});C.prototype.Pa=ca(function(a,b){a=this.fd(a);return this.u(a,b)});C.prototype.va=ca(function(a,b,c){d.j(a)&&(c=b);a=this.dd(a,b);return this.u(a,c)});C.prototype["delete"]=ca(function(a){return this.u({$delete:""},a)});C.prototype.remove=ca(function(a,b,c){a=this.Pc(a,b);return this.u(a,c)});C.prototype.u=function(a,b){a.$group_key=this.Za;a.$group_id=this.Ya;a.$token=this.I("token");
a=d.jb(a);return this.i.bb({type:"groups",data:a,endpoint:this.i.Z("groups")+"/"+this.I("api_routes").groups,fb:this.i.H.groups},b)};C.prototype.M=function(a){return"$group_key"===a||"$group_id"===a};C.prototype.I=function(a){return this.i.h(a)};C.prototype.toString=function(){return this.i.toString()+".group."+this.Za+"."+this.Ya};C.prototype.remove=C.prototype.remove;C.prototype.set=C.prototype.set;C.prototype.set_once=C.prototype.aa;C.prototype.union=C.prototype.va;C.prototype.unset=C.prototype.Pa;
C.prototype.toString=C.prototype.toString;d.extend(x.prototype,zb);x.prototype.ka=function(a){this.i=a};x.prototype.set=V(function(a,b,c){var e=this.Uc(a,b);d.j(a)&&(c=b);this.I("save_referrer")&&this.i.persistence.Lb(document.referrer);e.$set=d.extend({},d.info.te(),e.$set);return this.u(e,c)});x.prototype.aa=V(function(a,b,c){var e=this.Xc(a,b);d.j(a)&&(c=b);return this.u(e,c)});x.prototype.Pa=V(function(a,b){a=this.fd(a);return this.u(a,b)});x.prototype.yc=V(function(a,b,c){var e={},f={};d.j(a)?
(d.g(a,function(g,k){this.M(k)||(isNaN(parseFloat(g))?z.error("Invalid increment value passed to mixpanel.people.increment - must be a number"):f[k]=g)},this),c=b):(d.l(b)&&(b=1),f[a]=b);e.$add=f;return this.u(e,c)});x.prototype.append=V(function(a,b,c){d.j(a)&&(c=b);a=this.yd(a,b);return this.u(a,c)});x.prototype.remove=V(function(a,b,c){d.j(a)&&(c=b);a=this.Pc(a,b);return this.u(a,c)});x.prototype.va=V(function(a,b,c){d.j(a)&&(c=b);a=this.dd(a