module.exports = "(function(e,i,r){var n=r(5894),t=r(4934),a=r(4810),o=r(3316),l=r(8131),c=r(1442),s=r(7004),g=r(1709),d=r(7152),p=\"mixpanel\",f=255,m=\"mixpanel\",u=r(2933),y=\"holdback\",v=\"Campaign Decided: \",x=\"Experiment Decided: \";function h(e,i,r){var n;if(\"\"===e)n=i;else{var t=r-i.length;if(e.length>t){var a=Math.min(e.length,t);n=(e=e.substring(0,a))+i}else n=e+\" \"+i}return n}function S(e,i){this.get_config(\"save_referrer\")&&(a.log(\"Calling register_once to potentially update $initial_referrer to:\",e),this.register_once({$initial_referrer:e||\"$direct\",$initial_referring_domain:i||\"$direct\"}))}var E={preRedirectPolicy:s.PreRedirectPolicies.PERSIST_BEFORE_REDIRECT,postRedirectPolicy:s.PostRedirectPolicies.TRACK_IMMEDIATELY,nonRedirectPolicy:s.NonRedirectPolicies.TRACK_IMMEDIATELY,trackLayerDecision:function(e){var i=e.integrationSettings;if(i&&i[m]&&e.experimentId&&e.variationId){var r={id:e.layerId,name:e.layerName,policy:e.layerPolicy,integrationStringVersion:e.integrationStringVersion,experiments:[]},t=e.isLayerHoldback;if(!(r.integrationStringVersion&&2===r.integrationStringVersion&&o.isSingleExperimentPolicy(e.layerPolicy)&&t))return function(e,i,r,t){return(s=50,m=200,l.pollFor((function(){return d.getGlobal(p)}),m,s)).then((function(l){a.log(\"Mixpanel variable found on window\"),function(e){var i=c.getExperimentAndVariation(),r=c.getReferrer();if(i){var n;r&&(a.log(\"effectiveReferrer found, updating Mixpanel $referrer to:\",r),n=g.guessDomain(r,!0),e.push([\"register\",{$referrer:r,$referring_domain:n}])),e.push((function(){S.call(this,r,n)}))}}(l);var s=u.formatNamesAndIdsForAnalytics(e,i,r,!1);!function(e,i){e.push([\"register\",i]),a.log(\"Mixpanel super property registered with:\",i)}(l,function(e,i,r,t,a){var l=t-2-2,c={};n.each(e,(function(e,r){var n=i[r],a=\"layer\"===r?l:t;c[r]=h(e,n,a)}));var s={};s[c.experiment]=c.variation,o.isSingleExperimentPolicy(a)||(s[c.layer]=c.experiment,s[c.experiment]=r?y:c.variation,c.holdback=\"HB [\"+c.layer+\"]\",s[c.holdback]=r);return s}(s.names,s.idStrings,t,f,e.policy)),function(e,i,r){var n,t,l;o.isSingleExperimentPolicy(i)?(l=235,t=h(r.names.experiment,r.idStrings.experiment,l),n=x+t):(l=237,t=h(r.names.layer,r.idStrings.layer,l),n=v+t);e.push([\"track\",n]),a.log(\"Optimizely Campaign Decision tracked in Mixpanel\")}(l,e.policy,s)}));var s,m}(r,{id:e.experimentId,name:e.experimentName,audienceIds:[],variations:[]},{id:e.variationId,name:e.variationName,actions:[]},t).catch((function(e){a.warn(\"Tracker for\",m,\"failed:\",e)}))}},serializeSettings:t.stringify,deserializeSettings:t.parse};e.exports=function(e){e.registerAnalyticsTracker(\"mixpanel\",E)}})";