!function(a){var b="object"==typeof exports&&exports,c="object"==typeof module&&module&&module.exports==b&&module,d="object"==typeof global&&global;d.global!==d&&d.window!==d||(a=d);var e=function(a){this.message=a};e.prototype=new Error,e.prototype.name="InvalidCharacterError";var f=function(a){throw new e(a)},g="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",h=/[\t\n\f\r ]/g,i=function(a){a=String(a).replace(h,"");var b=a.length;b%4==0&&(a=a.replace(/==?$/,""),b=a.length),(b%4==1||/[^+a-zA-Z0-9/]/.test(a))&&f("Invalid character: the string to be decoded is not correctly encoded.");for(var c,d,e=0,i="",j=-1;++j>(-2*e&6)));return i},j=function(a){a=String(a),/[^\0-\xFF]/.test(a)&&f("The string to be encoded contains characters outside of the Latin1 range.");for(var b,c,d,e,h=a.length%3,i="",j=-1,k=a.length-h;++j>18&63)+g.charAt(e>>12&63)+g.charAt(e>>6&63)+g.charAt(63&e);return 2==h?(b=a.charCodeAt(j)<<8,c=a.charCodeAt(++j),e=b+c,i+=g.charAt(e>>10)+g.charAt(e>>4&63)+g.charAt(e<<2&63)+"="):1==h&&(e=a.charCodeAt(j),i+=g.charAt(e>>2)+g.charAt(e<<4&63)+"=="),i},k={encode:j,decode:i,version:"0.1.0"};if("function"==typeof define&&"object"==typeof define.amd&&define.amd)define(function(){return k});else if(b&&!b.nodeType)if(c)c.exports=k;else for(var l in k)k.hasOwnProperty(l)&&(b[l]=k[l]);else a.base64=k}(this),function(a){"use strict";function b(a,b){var c=(65535&a)+(65535&b),d=(a>>16)+(b>>16)+(c>>16);return d<<16|65535&c}function c(a,b){return a<>>32-b}function d(a,d,e,f,g,h){return b(c(b(b(d,a),b(f,h)),g),e)}function e(a,b,c,e,f,g,h){return d(b&c|~b&e,a,b,f,g,h)}function f(a,b,c,e,f,g,h){return d(b&e|c&~e,a,b,f,g,h)}function g(a,b,c,e,f,g,h){return d(b^c^e,a,b,f,g,h)}function h(a,b,c,e,f,g,h){return d(c^(b|~e),a,b,f,g,h)}function i(a,c){a[c>>5]|=128<>>9<<4)+14]=c;var d,i,j,k,l,m=1732584193,n=-271733879,o=-1732584194,p=271733878;for(d=0;d>5]>>>b%32&255);return c}function k(a){var b,c=[];for(c[(a.length>>2)-1]=void 0,b=0;b>5]|=(255&a.charCodeAt(b/8))<16&&(e=i(e,8*a.length)),c=0;c<16;c+=1)f[c]=909522486^e[c],g[c]=1549556828^e[c];return d=i(f.concat(k(b)),512+8*b.length),j(i(g.concat(d),640))}function n(a){var b,c,d="0123456789abcdef",e="";for(c=0;c>>4&15)+d.charAt(15&b);return e}function o(a){return unescape(encodeURIComponent(a))}function p(a){return l(o(a))}function q(a){return n(p(a))}function r(a,b){return m(o(a),o(b))}function s(a,b){return n(r(a,b))}function t(a,b,c){return b?c?r(b,a):s(b,a):c?p(a):q(a)}"function"==typeof define&&define.amd?define(function(){return t}):a.md5=t}(this),function(){function a(a,b,c){var d=b&&c||0,e=0;for(b=b||[],a.toLowerCase().replace(/[0-9a-f]{2}/g,function(a){e<16&&(b[d+e++]=m[a])});e<16;)b[d+e++]=0;return b}function b(a,b){var c=b||0,d=l;return d[a[c++]]+d[a[c++]]+d[a[c++]]+d[a[c++]]+"-"+d[a[c++]]+d[a[c++]]+"-"+d[a[c++]]+d[a[c++]]+"-"+d[a[c++]]+d[a[c++]]+"-"+d[a[c++]]+d[a[c++]]+d[a[c++]]+d[a[c++]]+d[a[c++]]+d[a[c++]]}function c(a,c,d){var e=c&&d||0,f=c||[];a=a||{};var g=null!=a.clockseq?a.clockseq:q,h=null!=a.msecs?a.msecs:(new Date).getTime(),i=null!=a.nsecs?a.nsecs:s+1,j=h-r+(i-s)/1e4;if(j<0&&null==a.clockseq&&(g=g+1&16383),(j<0||h>r)&&null==a.nsecs&&(i=0),i>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");r=h,s=i,q=g,h+=122192928e5;var k=(1e4*(268435455&h)+i)%4294967296;f[e++]=k>>>24&255,f[e++]=k>>>16&255,f[e++]=k>>>8&255,f[e++]=255&k;var l=h/4294967296*1e4&268435455;f[e++]=l>>>8&255,f[e++]=255&l,f[e++]=l>>>24&15|16,f[e++]=l>>>16&255,f[e++]=g>>>8|128,f[e++]=255&g;for(var m=a.node||p,n=0;n<6;n++)f[e+n]=m[n];return c?c:b(f)}function d(a,c,d){var f=c&&d||0;"string"==typeof a&&(c="binary"==a?new k(16):null,a=null),a=a||{};var g=a.random||(a.rng||e)();if(g[6]=15&g[6]|64,g[8]=63&g[8]|128,c)for(var h=0;h<16;h++)c[f+h]=g[h];return c||b(g)}var e,f=this;if("function"==typeof f.require)try{var g=f.require("crypto").randomBytes;e=g&&function(){return g(16)}}catch(h){}if(!e&&f.crypto&&crypto.getRandomValues){var i=new Uint8Array(16);e=function(){return crypto.getRandomValues(i),i}}if(!e){var j=new Array(16);e=function(){for(var a,b=0;b<16;b++)0===(3&b)&&(a=4294967296*Math.random()),j[b]=a>>>((3&b)<<3)&255;return j}}for(var k="function"==typeof f.Buffer?f.Buffer:Array,l=[],m={},n=0;n<256;n++)l[n]=(n+256).toString(16).substr(1),m[l[n]]=n;var o=e(),p=[1|o[0],o[1],o[2],o[3],o[4],o[5]],q=16383&(o[6]<<8|o[7]),r=0,s=0,t=d;if(t.v1=c,t.v4=d,t.parse=a,t.unparse=b,t.BufferClass=k,"function"==typeof define&&define.amd)define(function(){return t});else if("undefined"!=typeof module&&module.exports)module.exports=t;else{var u=f.uuid;t.noConflict=function(){return f.uuid=u,t},f.uuid=t}}.call(this),function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){function b(a){return h.raw?a:encodeURIComponent(a)}function c(a){return h.raw?a:decodeURIComponent(a)}function d(a){return b(h.json?JSON.stringify(a):String(a))}function e(a){0===a.indexOf('"')&&(a=a.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\"));try{return a=decodeURIComponent(a.replace(g," ")),h.json?JSON.parse(a):a}catch(b){}}function f(b,c){var d=h.raw?b:e(b);return a.isFunction(c)?c(d):d}var g=/\+/g,h=a.cookie=function(e,g,i){if(void 0!==g&&!a.isFunction(g)){if(i=a.extend({},h.defaults,i),"number"==typeof i.expires){var j=i.expires,k=i.expires=new Date;k.setTime(+k+864e5*j)}return document.cookie=[b(e),"=",d(g),i.expires?"; expires="+i.expires.toUTCString():"",i.path?"; path="+i.path:"",i.domain?"; domain="+i.domain:"",i.secure?"; secure":""].join("")}for(var l=e?void 0:{},m=document.cookie?document.cookie.split("; "):[],n=0,o=m.length;nb)return f}throw new Error("Assignment bucket out of range. "+b+" unmatched in "+this.splitName+": "+JSON.stringify(c))},a.prototype.getSplitVisitorHash=function(){return b(this.splitName+this.visitor.getId())},a.prototype.getHashFixnum=function(){return parseInt(this.getSplitVisitorHash().substr(0,8),16)},a.prototype.getAssignmentBucket=function(){return this.getHashFixnum()%100},a.prototype.getSortedVariants=function(){return this.getVariants().sort()},a.prototype.getVariants=function(){return Object.getOwnPropertyNames(this.getWeighting())},a.prototype.getWeighting=function(){var a=h.getSplitRegistry()[this.splitName];if(!a){var b='Unknown split: "'+this.splitName+'"';throw this.visitor.logError(b),new Error(b)}return a},a}(),j=function(){var a=function(a){if(a=a||{},this._visitor=a.visitor,this._assignment=a.assignment,!this._visitor)throw new Error("must provide visitor");if(!this._assignment)throw new Error("must provide assignment")};return a.prototype.send=function(){this.persistAssignment(),this._visitor.analytics.trackAssignment(this._visitor.getId(),this._assignment,function(a){this.persistAssignment(a?"success":"failure")}.bind(this))},a.prototype.persistAssignment=function(a){return c.ajax(h.getUrl()+"/api/v1/assignment_event",{method:"POST",dataType:"json",crossDomain:!0,data:{visitor_id:this._visitor.getId(),split_name:this._assignment.getSplitName(),context:this._assignment.getContext(),mixpanel_result:a}}).fail(function(a,b,c){var d=a&&a.status,e=a&&a.responseText;this._visitor.logError("test_track persistAssignment error: "+[a,d,e,b,c].join(", "))}.bind(this))},a}(),k=function(){var a=function(a){if(a=a||{},this._visitor=a.visitor,this._assignment=a.assignment,this._username=a.username,this._password=a.password,!this._visitor)throw new Error("must provide visitor");if(!this._assignment)throw new Error("must provide assignment");if(!this._username)throw new Error("must provide username");if(!this._password)throw new Error("must provide password")};return a.prototype.send=function(){this.persistAssignment(),this._visitor.analytics.trackAssignment(this._visitor.getId(),this._assignment,function(a){this.persistAssignment(a?"success":"failure")}.bind(this))},a.prototype.persistAssignment=function(a){return c.ajax(h.getUrl()+"/api/v1/assignment_override",{method:"POST",dataType:"json",crossDomain:!0,headers:{Authorization:"Basic "+btoa(this._username+":"+this._password)},data:{visitor_id:this._visitor.getId(),split_name:this._assignment.getSplitName(),variant:this._assignment.getVariant(),context:this._assignment.getContext(),mixpanel_result:a}}).fail(function(a,b,c){var d=a&&a.status,e=a&&a.responseText;this._visitor.logError("test_track persistAssignment error: "+[a,d,e,b,c].join(", "))}.bind(this))},a}(),l=function(){var b=function(a){if(a=a||{},this._id=a.id,this._assignments=a.assignments,this._ttOffline=a.ttOffline,!this._id)throw new Error("must provide id");if(!this._assignments)throw new Error("must provide assignments");this._errorLogger=function(a){window.console.error(a)},this.analytics=new e};return b.loadVisitor=function(b){var d=c.Deferred(),e=function(a){d.resolve(new l(a))};return b?h.getAssignments()?e({id:b,assignments:h.getAssignments(),ttOffline:!1}):c.ajax(h.getUrl()+"/api/v1/visitors/"+b,{method:"GET",timeout:5e3}).done(function(a){e({id:a.id,assignments:f.fromJsonArray(a.assignments),ttOffline:!1})}).fail(function(){e({id:b,assignments:[],ttOffline:!0})}):e({id:a.v4(),assignments:[],ttOffline:!1}),d.promise()},b.prototype.getId=function(){return this._id},b.prototype.getAssignmentRegistry=function(){if(!this._assignmentRegistry){for(var a={},b=0;b0,d=c?a.slice(0,Math.max(1,b)):[],e=a[b];if(0===d.length)throw new Error("must provide at least one variant");for(var f=0;f0){var b=a.join(", ").replace(/, (.+)$/," and $1");this._visitor.logError("does not configure variants "+b)}}},a.prototype._getSplit=function(){return this._splitRegistry?this._splitRegistry[this._assignment.getSplitName()]:null},a.prototype._getVariants=function(){return Object.getOwnPropertyNames(this._variantHandlers)},a.prototype._getMissingVariants=function(){for(var a=this._getVariants(),b=this._getSplit(),c=Object.getOwnPropertyNames(b),d=[],e=0;e2&&this._visitor.logError("A/B for "+this._splitName+" configures split with more than 2 variants"),{true:this._getTrueVariant(),false:this._getFalseVariant()}},a.prototype._getTrueVariant=function(){return this._trueVariant||!0},a.prototype._getFalseVariant=function(){var a=this._getNonTrueVariants();return!!a&&a.sort()[0]},a.prototype._getNonTrueVariants=function(){var a=this._getSplitVariants();if(a){var b=this._getTrueVariant(),c=a.indexOf(b);return c!==-1&&a.splice(c,1),a}return null},a.prototype._getSplit=function(){return this._splitRegistry?this._splitRegistry[this._splitName]:null},a.prototype._getSplitVariants=function(){return this._getSplit()&&Object.getOwnPropertyNames(this._getSplit())},a}(),q=(new m).getPublicAPI(),r=function(){window.dispatchEvent(new CustomEvent("tt:lib:loaded",{detail:{TestTrack:q}}))};try{c(document).ready(function(){c(document.body).addClass("_tt");try{window.dispatchEvent(new CustomEvent("tt:class:added"))}catch(a){}}),r(),window.addEventListener("tt:listener:ready",r)}catch(s){}return q});