!(function(e){function t(i){if(n[i])return n[i].exports;var r=n[i]={exports:{},id:i,loaded:!1};return e[i].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)})([(function(e,t,n){function i(){function e(e){var t=n(146),i=[t];i.push(n(148)),i.push(n(154)),i.push(n(157)),i.push(n(160)),i.push(n(162)),i.push(n(172)),i.push(n(175)),i.push(n(177)),i.push(n(180)),i.push(n(184)),i.push(n(187)),i.push(n(191)),i.push(n(195)),i.push(n(200)),i.push(n(201)),i.push(n(204)),i.push(n(205)),i.push(n(206)),i.push(n(210)),i.push(n(215)),i.push(n(218)),i.push(n(219)),g.initialize({clientData:e,plugins:i})}function t(e,t,n){return"/dist/preview_data.js?token=__TOKEN__&preview_layer_ids=__PREVIEW_LAYER_IDS__".replace("__TOKEN__",e).replace("__PROJECT_ID__",t).replace("__PREVIEW_LAYER_IDS__",n.join(",")).replace("__GET_ONLY_PREVIEW_LAYERS__",!0)}window.performance&&window.performance.mark&&window.performance.mark("optimizely:blockBegin");var i=n(1);i.initialize();var r=n(82),a=n(23),o=n(16);n(126);var s=o.get("stores/directive"),u=n(88);if(!u.isCORSSupported())throw new Error("CORS is not supported on this browser, aborting.");var c,l=n(128),d=n(116),f=n(129),p={"layers": [{"holdback": 5000, "activation": {}, "integrationSettings": {}, "integrationStringVersion": 2, "viewIds": ["8733381018"], "experiments": [{"weightDistributions": null, "audienceName": null, "name": null, "bucketingStrategy": null, "variations": [{"id": "8783601397", "actions": [{"viewId": "8733381018", "changes": [{"dependencies": [], "type": "custom_code", "id": "B0647B0B-93E4-400D-8B16-099CEC7E50AE", "value": function($){$(".qz_form").append("
"); $(document).on("click",".quiz-flag a", function() { var question = $(this).closest(".qz_container").find(".qz_question").text(); console.log(question); WH.maEvent("quiz_flag", {"type":"click", "question":question, "article":window.location.pathname}, true); //show details form $(this).closest(".quiz-flag").text("Uh oh! Can you tell us more so we can fix it?").after("").addClass("details"); //$(this).closest(".quiz-flag").after(""); }); $(document).on("click",".quiz-flag-details-form button", function(e) { e.preventDefault(); var question = $(this).closest(".qz_container").find(".qz_question").text(); var details = $(this).closest(".quiz-flag-details-form").find("textarea").val(); console.log(details); WH.maEvent("quiz_flag", {"type":"details", "question":question, "article":window.location.pathname, "details":details}, true); $(this).closest(".qz_container").find(".quiz-flag").text("Thanks! We'll look into that."); $(this).closest(".quiz-flag-details-form").remove(); }); }}, {"value": "", "selector": "head", "dependencies": [], "type": "append", "id": "7ED51F40-FB85-4E29-8EF8-FF0D045B6B7B"}, {"selector": ".quiz-flag a", "dependencies": [], "attributes": {}, "type": "attribute", "id": "D9EC1FB6-088E-41F9-9DB5-7C2205E9B41F", "css": {}}, {"selector": ".quiz-flag-details-form button", "dependencies": [], "attributes": {}, "type": "attribute", "id": "8F499360-5675-42A4-9A89-EFECBF96464F", "css": {}}]}], "name": null}], "audienceIds": ["or", "7402251834"], "changes": null, "id": "8787522806", "integrationSettings": null}], "id": "8779961332", "weightDistributions": null, "name": null, "groupId": null, "commitId": "9393061060", "decisionMetadata": null, "policy": "single_experiment", "changes": null}, {"holdback": 8500, "activation": {}, "integrationSettings": {}, "integrationStringVersion": 2, "viewIds": ["9630360919"], "experiments": [{"weightDistributions": null, "audienceName": null, "name": null, "bucketingStrategy": null, "variations": [{"id": "9622841494", "actions": [{"viewId": "9630360919", "changes": [{"dependencies": [], "type": "custom_code", "id": "2F23D0D1-C869-40A8-AA4B-D5234E714A01", "value": function($){var isMobile = false; if (window.location.hostname == "m.wikihow.com") { isMobile = true; } $(document).ready(function() { if (!isMobile) { $("#article_rating #ar_buttons").hide(); $("#article_rating").append(""); $(".testimonial-cta").bind('click', function() { mw.loader.using('ext.wikihow.UserReviewForm', function () { window.WH.UserReviewForm.prototype.loadUserReviewForm(); }); $("#article_rating").hide(); }); } else { $("#article_rating").hide(); $("#article_rating").addClass("hidden"); $("#article_rating_mobile").append(""); $(".testimonial-cta").bind("click", function() { mw.loader.using('ext.wikihow.UserReviewForm.mobile', function () { window.WH.UserReviewForm.prototype.loadUserReviewForm(); }); $("#article_rating_mobile").hide(); }); } }); }}, {"selector": "button.primary.testimonial-cta.leavetestimonial", "dependencies": [], "attributes": {}, "type": "attribute", "id": "066AA86E-63F6-45B3-818F-B8889C4A3EAF", "css": {}}, {"selector": "#urf-submit", "dependencies": [], "attributes": {}, "type": "attribute", "id": "6710B375-43E6-4632-9F4F-6926616A73CD", "css": {}}, {"selector": "#urf-cancel", "dependencies": [], "attributes": {}, "type": "attribute", "id": "801117D0-8B38-4F64-A941-2E5D1B834BA9", "css": {}}]}], "name": null}], "audienceIds": ["or", "7402251834"], "changes": null, "id": "9624960937", "integrationSettings": null}], "id": "9619671650", "weightDistributions": null, "name": null, "groupId": null, "commitId": "12799850330", "decisionMetadata": null, "policy": "single_experiment", "changes": [{"value": "", "selector": "head", "dependencies": [], "type": "append", "id": "208CD2E2-BE67-4D81-8238-3E8F65DC3C00"}]}, {"holdback": 7000, "activation": {}, "integrationSettings": {}, "integrationStringVersion": 2, "viewIds": ["9619521679"], "experiments": [{"weightDistributions": null, "audienceName": null, "name": null, "bucketingStrategy": null, "variations": [{"id": "9635171206", "actions": [{"viewId": "9619521679", "changes": [{"dependencies": [], "type": "custom_code", "id": "93190104-13B0-432D-8D5D-5D8754A964BB", "value": function($){$("#qa").append("Describe your experience:
\n \n \n \n \n \n \nThank you for sharing!
\n1)for(var n=1;n-1;case"regex":try{if(a&&r){var s=new RegExp(e);return s.test(String(n))}return!1}catch(e){}return!1;case"range":var u=e.split(":"),c=parseFloat(u[0]),l=parseFloat(u[1]),d=parseFloat(n);return d>=c&&d<=l;default:return!1}}}),(function(e,t,n){var i=n(2),r=n(7),a=n(22),o=n(23);e.exports={initialize:function(){this.L={actions:{},actionState:{}},this.on(r.DATA_LOADED,this.k),this.on(r.ACTION_EXECUTED,this.F),this.on(r.SET_CHANGE_APPLIER,this.M),this.on(r.REMOVE_ACTION_STATE,this.U)},k:function(e){var t=this;i.isEmpty(e.data.layers)||(i.each(e.data.layers,(function(e){var n;if(e.changes){var r="layerId:"+e.id;n={id:r,layerId:e.id,changeSet:e.changes,type:"layer"},a.deepFreeze(n),t.L.actions[r]=n}i.each(e.experiments,(function(r){if(r.changes){var o="experimentId:"+r.id;n={id:o,layerId:e.id,experimentId:r.id,changeSet:r.changes,type:"experiment"},a.deepFreeze(n),t.L.actions[o]=n}i.each(r.variations,(function(o){i.each(o.actions,(function(i){var s=i.pageId||i.viewId,u=r.id+":"+o.id+":"+s;n={id:u,layerId:e.id,experimentId:r.id,variationId:o.id,pageId:s,changeSet:i.changes,type:"variation"},a.deepFreeze(n),t.L.actions[u]=n}))}))}))})),this.emitChange())},F:function(e){var t=e.actionId;i.isUndefined(t)||this.L.actionState[t]||(this.L.actionState[t]={})},M:function(e){var t=e.actionId,n=e.changeId;return this.L.actionState[t]?void(this.L.actionState[t][n]=e.changeApplier):void o.warn("Action Data / Attempted to set changeApplier for inactive action: ",t)},U:function(e){delete this.L.actionState[e.actionId]},get:function(e){return a.safeReference(this.L.actions[e])},getActionState:function(e){return a.safeReference(this.L.actionState[e])},getByChangeId:function(e){return i.find(this.L.actions,{changeSet:[{id:e}]})},getAllActionIdsByPageId:function(e){return i.map(i.filter(this.L.actions,{pageId:e}),"id")},getChangeApplier:function(e,t){var n=this.L.actionState[t];if(n)return n[e]},getExperimentVariationActions:function(e,t){return a.safeReference(i.filter(this.L.actions,{experimentId:e,variationId:t}))},getLayerActions:function(e){return a.safeReference(i.filter(this.L.actions,{id:"layerId:"+e}))},getExperimentActions:function(e){return a.safeReference(i.filter(this.L.actions,{id:"experimentId:"+e}))},getAll:function(){return a.safeReference(i.values(this.L.actions))}}}),(function(e,t,n){var i=n(2),r=!1;t.deepFreeze=function e(t){r&&i.isObject(t)&&!i.isFunction(t)&&(i.forOwn(t,e),Object.freeze(t))},t.safeReference=function e(t){return r?!i.isObject(t)||i.isFunction(t)||Object.isFrozen(t)?t:i.isArray(t)?i.map(t,e):i.reduce(t,(function(t,n,i){return t[i]=e(n),t}),{}):i.cloneDeep(t)}}),(function(e,t,n){function i(){this.logLevel=null,this.logMatch=null,this.logs=[],this.timebase=o.now()}var r=n(2),a=n(7),o=n(24),s=n(25),u=n(9),c=n(26);i.prototype.G=function(){return!r.isNull(this.logLevel)},i.prototype.setLogLevel=function(e){var t=this.B(e);null===t?console.error("Unknown log level: "+e):this.logLevel!==t&&(this.log("Setting log level to "+t),this.logLevel=t,this.flush())},i.prototype.setLogMatcher=function(e){r.isString(e)?this.logMatcher=e:this.logMatcher="",this.logGroup=0},i.prototype.shouldLog=function(e){return this.G()&&this.logLevel>=e},i.prototype.matchesLogMessage=function(e,t){var n=this.logMatcher;if(!this.logMatcher)return!0;if(this.logGroup)return"GROUPSTART"===e?this.logGroup++:"GROUPEND"===e&&this.logGroup--,!0;var i=r.some(t,(function(e){if(!r.isString(e))try{e=c.stringify(e)}catch(e){}return r.isString(e)&&r.includes(e,n)}));return i&&"GROUPSTART"===e&&this.logGroup++,i},i.prototype.storeLog=function(e,t){var n={logLevel:e,logMessage:t};u.dispatch(a.LOG,n)},i.prototype.flush=function(){var e=n(16),t=e.get("stores/log");this.logGroup=0;var i=t.getLogs();r.each(i,r.bind((function(e){this.z(e.logLevel,e.logMessage,!0)}),this))},i.prototype.z=function(e,t,n){var i,a=e;if(console)switch(e){case"GROUPSTART":i=console.groupCollapsed,a=s.LogLevel.DEBUG;break;case"GROUPEND":i=console.groupEnd,a=s.LogLevel.DEBUG;break;case s.LogLevel.ERROR:i=console.error;break;case s.LogLevel.WARN:i=console.warn;break;case s.LogLevel.DEBUG:i=console.debug;break;default:i=console.log}try{n||this.G()&&!this.shouldLog(a)||(r.isArray(t)&&r.isString(t[0])&&(t=this.j(t)),this.storeLog(e,t)),i&&this.shouldLog(a)&&this.matchesLogMessage(e,t)&&i.apply(console,t)}catch(e){console&&(console.error?console.error(e):console.log(e))}},i.prototype.debug=function(){this.z(s.LogLevel.DEBUG,[].slice.call(arguments))},i.prototype.log=function(){this.z(s.LogLevel.INFO,[].slice.call(arguments))},i.prototype.logAlways=function(){var e=this.j([].slice.call(arguments));console&&console.log&&console.log.apply&&console.log.apply(console,e),this.storeLog(s.LogLevel.INFO,e)},i.prototype.warn=function(){this.z(s.LogLevel.WARN,[].slice.call(arguments))},i.prototype.error=function(e){var t=[].slice.call(arguments);1===t.length&&e.stack?(this.z(s.LogLevel.ERROR,[this.H(),e]),this.z(s.LogLevel.INFO,[e.stack])):this.z(s.LogLevel.ERROR,t)},i.prototype.groupCollapsed=function(){this.z("GROUPSTART",[].slice.call(arguments))},i.prototype.groupEnd=function(){this.z("GROUPEND",[].slice.call(arguments))},i.prototype.j=function(e){var t=this.H().toString();return t.length<6&&(t=(" "+t).slice(-6)),[t+"| Optly / "+e[0]].concat(e.slice(1))},i.prototype.H=function(){return this.timebase?o.now()-this.timebase:0},i.prototype.B=function(e){return e&&(e=e.toUpperCase(),"TRUE"===e&&(e="INFO"),"FALSE"===e&&(e="OFF"),"ALL"===e&&(e="DEBUG"),!r.isUndefined(s.LogLevel[e]))?s.LogLevel[e]:null},e.exports=new i}),(function(e,t){t.now=function(){return+new Date}}),(function(e,t,n){var i=n(8);t.COOKIES={OPT_OUT:"optimizelyOptOut",PREVIEW:"optimizelyPreview",REDIRECT:"optimizelyRedirectData",SESSION_STATE:"optimizelySessionState",TOKEN:"optimizelyToken",VISITOR_ID:"optimizelyEndUserId"},t.LayerActivationTypes={CONDITIONAL:"conditional",IMMEDIATE:"immediate",MANUAL:"manual",READY:"ready",TIMEOUT:"timeout"},t.LogLevel={OFF:0,ERROR:1,WARN:2,INFO:3,DEBUG:4},t.Lifecycle=i({preActivate:null,postVisitorProfileLoad:null,postViewsActivated:null,postActivate:null}),t.ViewActivationTypes={immediate:"immediate",manual:"manual",callback:"callback",polling:"polling",URLChanged:"url_changed",DOMChanged:"dom_changed"},t.StorageKeys={PENDING_EVENTS:"pending_events"},t.PluginTypes=i({visitorProfileProviders:null,viewProviders:null,audienceMatchers:null,viewMatchers:null,analyticsTrackers:null,viewTagLocators:null,userFeatureDefs:null,apiModules:null,changeAppliers:null,deciders:null,eventImplementations:null,viewTriggers:null}),t.ResourceTimingAttributes=i({connectStart:null,connectEnd:null,decodedBodySize:null,domainLookupStart:null,domainLookupEnd:null,duration:null,encodedBodySize:null,fetchStart:null,requestStart:null,responseStart:null,responseEnd:null,secureConnectionStart:null,startTime:null,transferSize:null,serverTiming:null}),t.RUMPerformanceTimingAttributes=i({blockTime:null}),t.AttributionTypes=i({FIRST_TOUCH:null,LAST_TOUCH:null}),t.SandboxedFunctions=i({XMLHttpRequest:null}),t.PerformanceData=i({performance_marks:null,resource_timing:null,performance_timing:null}),t.PerformanceCounters=i({mutation_observer_invocation:null,polling_invocation:null,match_selector_invocation:null}),t.VisitorStorageKeys={EVENTS:"events",EVENT_QUEUE:"event_queue",LAYER_MAP:"layer_map",LAYER_STATES:"layer_states",SESSION_STATE:"session_state",VISITOR_PROFILE:"visitor_profile",VARIATION_MAP:"variation_map",TRACKER_OPTIMIZELY:"tracker_optimizely"},t.ListTargetingKeyTypes={COOKIE:"c",QUERY:"q",JS_VARIABLE:"j"}}),(function(e,t,n){function i(e){var t=[Array.prototype],n=[];r.each(t,(function(e){r.isUndefined(e.toJSON)||(n.push(e.toJSON),delete e.toJSON)}));var i,a;try{i=e()}catch(e){a=e}finally{r.each(n,(function(e,n){t[n].toJSON=e}))}if(a)throw a;return i}var r=n(2);t.stringify=function(){return i(r.bind((function(){return JSON.stringify.apply(null,this)}),arguments))},t.parse=JSON.parse}),(function(e,t,n){var i=n(7);e.exports={initialize:function(){this.L={},this.on(i.REGISTER_ASYNC_DEFERRED,this.Y),this.on(i.RESOLVE_DEFERRED,this.K),this.on(i.REJECT_DEFERRED,this.q)},getRequest:function(e){return this.L[e]},getPromise:function(e){var t=this.getRequest(e);if(t)return t.promise},Y:function(e){this.L[e.source]={promise:e.promise,resolver:e.resolver,rejecter:e.rejecter}},K:function(e){var t=this.getRequest(e.source);if(!t)throw new Error("No request registered for source: "+e.source);t.resolver(e.resolveWith)},q:function(e){var t=this.getRequest(e.source);if(!t)throw new Error("No request registered for source: "+e.source);if(!t.rejecter)throw new Error("No rejecter registered for source: "+e.source);t.rejecter(e.rejectWith)}}}),(function(e,t,n){var i=n(2),r=n(7),a=n(22);e.exports={initialize:function(){this.L={},this.on(r.DATA_LOADED,this.k)},k:function(e){i.isEmpty(e.data.audiences)||(i.each(e.data.audiences,i.bind((function(e){a.deepFreeze(e),this.L[e.id]=e}),this)),this.emitChange())},getAll:function(){return a.safeReference(i.values(this.L))},getAudiencesMap:function(){return a.safeReference(this.L)},get:function(e){return a.safeReference(this.L[e])},getAudienceName:function(e){var t=i.find(i.values(this.L),{id:e});return t.name||"Aud "+e}}}),(function(e,t,n){var i=n(2),r=n(7),a=n(22);e.exports={initialize:function(){this.L={},this.on(r.ADD_CHANGE,this.W),this.on(r.DATA_LOADED,this.k)},getChange:function(e){return this.L[e]},k:function(e){i.isEmpty(e.data.changes)||i.each(e.data.changes,i.bind(this.W,this))},W:function(e){a.deepFreeze(e),this.L[e.id]=e,this.emitChange()}}}),(function(e,t,n){var i=n(2),r=n(7),a=n(25);e.exports={initialize:function(){this.L={},i.each(a.Lifecycle,i.bind((function(e){this.L[e]=[]}),this)),this.on(r.ADD_CLEANUP_FN,this.X),this.on(r.CLEAR_CLEANUP_FN,this.Q)},getCleanupFns:function(e){return i.cloneDeep(this.L[e])},X:function(e){this.L[e.lifecycle].push(e.cleanupFn),this.emitChange()},Q:function(e){var t=this.L[e.lifecycle];if(e.cleanupFn){var n=t.indexOf(e.cleanupFn);n>-1&&(t.splice(n,1),this.emitChange())}else this.L[e.lifecycle]=[],this.emitChange()}}}),(function(e,t,n){var i=n(7),r=15552e3,a=!0;e.exports={initialize:function(){this.L={currentDomain:null,defaultAgeSeconds:r,autoRefresh:a},this.on(i.SET_COOKIE_DOMAIN,this.$),this.on(i.SET_COOKIE_AGE,this.J),this.on(i.SET_COOKIE_AUTO_REFRESH,this.Z)},getCurrentDomain:function(){return this.L.currentDomain},getDefaultAgeInSeconds:function(){return this.L.defaultAgeSeconds},getAutoRefresh:function(){return this.L.autoRefresh},$:function(e){this.L.currentDomain=e,this.emitChange()},J:function(e){this.L.defaultAgeSeconds=e,this.emitChange()},Z:function(e){this.L.autoRefresh=e,this.emitChange()}}}),(function(e,t,n){var i=n(2),r=n(7),a=n(22);e.exports={initialize:function(){this.L={},this.on(r.DATA_LOADED,this.k)},getAll:function(){return a.safeReference(i.values(this.L))},getEventsMap:function(){return a.safeReference(this.L)},get:function(e){return a.safeReference(this.L[e])},getByApiName:function(e){return a.safeReference(i.find(i.values(this.L),{apiName:e}))},getByPageId:function(e){return a.safeReference(i.filter(this.L,{pageId:e}))},k:function(e){i.isEmpty(e.data.events)||(i.each(e.data.events,i.bind((function(e){e.pageId||(e.pageId=e.viewId),a.deepFreeze(e),this.L[e.id]=e}),this)),this.emitChange())}}}),(function(e,t,n){function i(e){var t=[];return e&&r.isObject(e)?(e.type&&t.push(e.type),t.push(o),e.type&&e.name&&t.push(e.name),t.join("")):o}var r=n(2),a=n(7),o="|";e.exports={initialize:function(){this.L={handlers:{}},this.on(a.ADD_EMITTER_HANDLER,this.ee),this.on(a.REMOVE_EMITTER_HANDLER,this.te)},getHandlers:function(e,t){var n=[null,{type:e.type},{type:e.type,name:e.name}],a=[];return r.each(n,r.bind((function(e){var t=i(e),n=this.L.handlers[t];n&&(a=a.concat(n))}),this)),t&&(a=r.filter(a,(function(e){return!e.publicOnly}))),a},ee:function(e){var t=i(e.filter);this.L.handlers[t]||(this.L.handlers[t]=[]),this.L.handlers[t].push({handler:e.handler,token:e.token,publicOnly:!!e.publicOnly,emitErrors:!!e.emitErrors}),this.emitChange()},te:function(e){var t=!1,n=e.token;r.forOwn(this.L.handlers,r.bind((function(e,i){var a=r.filter(e,(function(e){return e.token!==n}));a.length!==e.length&&(t=!0,this.L.handlers[i]=a)}),this)),t&&this.emitChange()}}}),(function(e,t,n){var i=n(2),r=n(7),a=n(22);e.exports={initialize:function(){this.L={},this.on(r.DATA_LOADED,this.k)},k:function(e){i.isEmpty(e.data.dimensions)||(i.each(e.data.dimensions,i.bind((function(e){a.deepFreeze(e),this.L[e.id]=e}),this)),this.emitChange())},getAll:function(){return a.safeReference(i.values(this.L))},getById:function(e){return a.safeReference(this.L[e])},getByApiName:function(e){return a.safeReference(i.find(i.values(this.L),{apiName:e}))}}}),(function(e,t,n){var i=n(2),r=n(7);e.exports={initialize:function(){this.L={disabled:!1,forceAudienceIds:[],forceVariationIds:[],alreadyInitialized:!1,mutationObserverAPISupported:!1,isEditor:!1,isPreview:!1,isLegacyPreview:!1,isSlave:!1,previewLayerIds:[],projectToken:null,shouldOptOut:!1,trackingDisabled:!1,isRunningInV2Editor:!1,isRunningInDesktopApp:!1,forceTracking:!1},this.on(r.LOAD_DIRECTIVE,this.ne)},getAll:function(){return i.cloneDeep(this.L)},conflictInObservingChanges:function(){return!1},isDisabled:function(){return this.L.disabled},isEditor:function(){return this.L.isEditor},clientHasAlreadyInitialized:function(){return this.L.alreadyInitialized},getForceAudienceIds:function(){return this.L.forceAudienceIds},getForceVariationIds:function(){return this.L.forceVariationIds},getPreviewLayerIds:function(){return this.L.previewLayerIds},getProjectToken:function(){return this.L.projectToken},getForceTracking:function(){return this.L.forceTracking},shouldActivate:function(){return!this.L.isEditor&&!this.isDisabled()},shouldBootstrapDataForPreview:function(){return this.L.isPreview},shouldBootstrapDataForEditor:function(){return this.L.isEditor},shouldInitialize:function(){return!(this.shouldLoadPreview()||this.isDisabled()||this.getProjectToken())},shouldLoadPreview:function(){return!(this.L.isPreview||this.L.isLegacyPreview||!this.getProjectToken()||this.L.isEditor)},shouldBailForDesktopApp:function(){return!this.L.isEditor&&this.L.isRunningInDesktopApp},shouldLoadInnie:function(){return!this.L.isSlave&&!this.L.isEditor&&this.L.isRunningInV2Editor},shouldObserveChangesIndefinitely:function(){return!1},shouldObserveChangesUntilTimeout:function(){return!this.shouldObserveChangesIndefinitely()},shouldOptOut:function(){return this.L.shouldOptOut},shouldSendTrackingData:function(){return!this.L.trackingDisabled&&(!!this.L.forceTracking||!this.L.isPreview&&i.isEmpty(this.getForceVariationIds())&&i.isEmpty(this.getForceAudienceIds()))},isSlave:function(){return this.L.isSlave},isRunningInDesktopApp:function(){return this.L.isRunningInDesktopApp},isRunningInV2Editor:function(){return this.L.isRunningInV2Editor},ne:function(e){i.extend(this.L,e),this.emitChange()}}}),(function(e,t,n){var i=n(2),r=n(7),a=n(22);e.exports={initialize:function(){this.L={holdback:0,isGlobalHoldback:null,listTargetingKeys:[],revision:null,projectId:null,accountId:null,namespace:null,activationId:null,activationTimestamp:null,dcpServiceId:null,dcpKeyfieldLocators:[],recommenderServices:[],anonymizeIP:null,projectJS:null,snippetId:null,plugins:[],domContentLoaded:!1,experimental:{}},this.on(r.DATA_LOADED,this.re),this.on(r.ACTIVATE,this.ae),this.on(r.RECORD_GLOBAL_DECISION,this.oe),this.on(r.SET_DOMCONTENTLOADED,this.se)},getRevision:function(){return this.L.revision},getGlobalHoldbackThreshold:function(){return this.L.holdback},getProjectId:function(){return this.L.projectId},getSnippetId:function(){return this.L.snippetId},getAccountId:function(){return this.L.accountId},getNamespace:function(){return this.L.namespace},getActivationId:function(){return this.L.activationId},getActivationTimestamp:function(){return this.L.activationTimestamp},getAnonymizeIP:function(){return this.L.anonymizeIP},isGlobalHoldback:function(){return!!this.L.isGlobalHoldback},getListTargetingKeys:function(){return this.L.listTargetingKeys.slice()},getDCPServiceId:function(){return this.L.dcpServiceId},getDCPKeyfieldLocators:function(){return this.L.dcpKeyfieldLocators},getRecommenderServices:function(){return this.L.recommenderServices},getProjectJS:function(){return this.L.projectJS},getPlugins:function(){return this.L.plugins},getExperimental:function(){return a.safeReference(this.L.experimental)},domContentLoadedHasFired:function(){return this.L.domContentLoaded},ae:function(e){this.L.activationId=e.activationId,this.L.activationTimestamp=e.activationTimestamp,this.L.isGlobalHoldback=null},oe:function(e){var t=e.isGlobalHoldback;if(null!==this.L.isGlobalHoldback&&this.L.isGlobalHoldback!==t)throw new Error("Attempted to change already set global holdback!");this.L.isGlobalHoldback=t,this.emitChange()},re:function(e){var t=i.pick(e.data,["holdback","accountId","projectId","snippetId","namespace","revision","listTargetingKeys","dcpServiceId","dcpKeyfieldLocators","recommenderServices","anonymizeIP","plugins","projectJS","experimental"]);if(0!==i.keys(t).length){var n={listTargetingKeys:[],dcpServiceId:null,dcpKeyfieldLocators:[]};i.extend(this.L,n,t),this.emitChange()}},se:function(){this.L.domContentLoaded=!0,this.emitChange()}}}),(function(e,t,n){var i=n(2),r=n(7);e.exports={initialize:function(){this.L={effectiveReferrer:null,effectiveVariationId:null},this.on(r.INITIALIZE_STATE,this.ue)},getEffectiveReferrer:function(){return this.L.effectiveReferrer},getEffectiveVariationId:function(){return this.L.effectiveVariationId},ue:function(e){i.isUndefined(e.effectiveReferrer)||(this.L.effectiveReferrer=e.effectiveReferrer),i.isUndefined(e.effectiveVariationId)||(this.L.effectiveVariationId=e.effectiveVariationId),this.emitChange()}}}),(function(e,t,n){var i=n(2),r=n(7),a=n(39);e.exports={initialize:function(){this.L={originalPushState:null,originalReplaceState:null},this.on(r.ENSURE_ORIGINAL_PUSHSTATE,this.ce),this.on(r.ENSURE_ORIGINAL_REPLACESTATE,this.le)},getOriginalPushState:function(){return this.L.originalPushState},getOriginalReplaceState:function(){return this.L.originalReplaceState},ce:function(){this.L.originalPushState||(this.L.originalPushState=i.bind(a.getGlobal("history").pushState,a.getGlobal("history")))},le:function(){this.L.originalReplaceState||(this.L.originalReplaceState=i.bind(a.getGlobal("history").replaceState,a.getGlobal("history")))}}}),(function(e,t,n){var i=n(2),r=n(23);t.getUserAgent=function(){return window.navigator.userAgent},t.getLocationSearch=function(){return window.location.search},t.getNavigatorLanguage=function(){return window.navigator.language||window.navigator.userLanguage},t.getHref=function(){return window.location.href},t.getLocation=function(){return window.location},t.setLocation=function(e){window.location.replace(e)},t.setGlobal=function(e,t){window[e]=t},t.getGlobal=function(e){return window[e]},t.addEventListener=function(){return window.addEventListener.apply(window,arguments)},t.removeEventListener=function(){return window.removeEventListener.apply(window,arguments)},t.isMutationObserverAPISupported=function(){return!i.isUndefined(window.MutationObserver)},t.alert=function(e){alert(e)},t.setTimeout=function(e,t){return setTimeout((function(){try{e()}catch(e){r.warn("Deferred function threw error:",e)}}),t)},t.setInterval=function(e,t){return setInterval((function(){try{e()}catch(e){r.warn("Polling function threw error:",e)}}),t)}}),(function(e,t,n){var i=n(2),r=n(7);e.exports={initialize:function(){this.L={},this.on(r.DATA_LOADED,this.k),this.on(r.SET_INTEGRATION_SETTINGS,this.de)},k:function(e){i.isEmpty(e.data.integrationSettings)||(i.each(e.data.integrationSettings,i.bind((function(e){this.L[e.id]=e}),this)),this.emitChange())},de:function(e){var t=this.L[e.id];t?i.extend(t,e):this.L[e.id]=e},getAll:function(){return i.cloneDeep(i.values(this.L))},get:function(e){return i.cloneDeep(this.L[e])},getReference:function(e){return this.L[e]}}}),(function(e,t,n){var i=n(2),r=n(7),a=n(23),o="*";e.exports={initialize:function(){this.L={},this.on(r.LOAD_PERSISTED_LAYER_STATES,this.fe),this.on(r.RECORD_LAYER_DECISION,this.pe),this.on(r.RECORD_LAYER_DECISION_EVENT_ID,this.ge)},getLayerState:function(e,t){if(this.L[e]){var n=this.L[e];if(i.keys(n).length>1&&!t)throw new Error("View Id must be specified when more than one layerState for layer.");return t?i.cloneDeep(i.find(n,{pageId:t})):i.cloneDeep(n[o])}},getLayerStates:function(e){var t=[];for(var n in this.L)i.forEach(this.L[n],(function(n){(i.isUndefined(e)||n.namespace===e)&&t.push(i.cloneDeep(n))}));return t},getLayerStatesForAnalytics:function(){var e=[];for(var t in this.L)i.forEach(this.L[t],(function(t){e.push(i.pick(t,["layerId","decision","decisionEventId"]))}));return e},fe:function(e){e.merge||(this.L={}),i.each(e.layerStates,i.bind((function(e){var t=e.layerId;e.pageId||(e.pageId=e.viewId);var n=e.pageId||o,r=this.L[t];if(i.isUndefined(r))this.L[t]={},this.L[t][n]=e;else{var a=r[n];(!a||e.decisionTimestamp>(a.decisionTimestamp||0))&&(this.L[t][n]=e)}}),this)),this.emitChange()},pe:function(e){var t={layerId:e.layerId,revision:e.revision,namespace:e.namespace,pageId:e.pageId,decisionTicket:e.decisionTicket,decision:e.decision,decisionActivationId:e.activationId,decisionTimestamp:e.timestamp,decisionEventId:null},n=this.L[e.layerId]||{};e.pageId?(delete n[o],n[e.pageId]=t):(n={},n[o]=t),this.L[e.layerId]=n,this.emitChange()},ge:function(e){var t=e.layerId,n=e.pageId||o;return this.L[t]?this.L[t][n]?(this.L[t][n].decisionEventId=e.decisionId,void this.emitChange()):void a.warn("Not recording decision event: Layer state not found for view",n):void a.warn("Not recording decision event: Campaign not registered",t); }}}),(function(e,t,n){var i=n(2),r=n(7),a=n(22),o=n(43);e.exports={initialize:function(){this.L={layers:{},experiments:{},variations:{}},this.on(r.DATA_LOADED,this.k)},k:function(e){if(!i.isEmpty(e.data.layers)){var t=this;i.each(e.data.layers,(function(e){i.each(e.experiments,(function(n){e.pageIds||(e.pageIds=e.viewIds),n.campaignName||o.isSingleExperimentPolicy(e.policy)?o.isSingleExperimentPolicy(e.policy)&&e.groupId&&(n.groupId=e.groupId):n.campaignName=e.name,i.each(n.variations,(function(e){i.each(e.actions,(function(e){e.pageId||(e.pageId=e.viewId)})),t.L.variations[e.id]=e})),t.L.experiments[n.id]=n})),a.deepFreeze(e),t.L.layers[e.id]=e})),this.emitChange()}},getAll:function(){return a.safeReference(i.values(this.L.layers))},getCampaignsMap:function(){return a.safeReference(this.L.layers)},getExperimentsMap:function(){return a.safeReference(this.L.experiments)},getVariationsMap:function(){return a.safeReference(this.L.variations)},getCount:function(){return i.keys(this.L.layers).length},getAllByPageIds:function(e){return a.safeReference(i.filter(i.values(this.L.layers),(function(t){return i.some(e,i.partial(i.includes,t.pageIds))})))},get:function(e){return a.safeReference(this.L.layers[e])},getLayerByExperimentId:function(e){var t=i.values(this.L.layers),n=i.find(t,(function(t){return i.find(t.experiments,{id:e})}));return a.safeReference(n)},getExperimentByVariationId:function(e){var t,n=i.values(this.L.layers);return i.some(n,(function(n){return i.some(n.experiments,(function(n){return i.find(n.variations,{id:e})&&(t=n),t})),t})),a.safeReference(t)}}}),(function(e,t){var n="single_experiment",i="multivariate";t.isSingleExperimentPolicy=function(e){return e===n||e===i}}),(function(e,t,n){var i=n(7);e.exports={initialize:function(){this.L={logs:[]},this.on(i.LOG,this.he)},getLogs:function(){return this.L.logs},he:function(e){this.L.logs.push(e),this.emitChange()},w:function(){return this.L.logs.slice()}}}),(function(e,t,n){var i=n(7),r=n(22);e.exports={initialize:function(){this.L={data:null,hasTracked:null},this.on(i.LOAD_REDIRECT_DATA,this._e),this.on(i.REGISTER_TRACKED_REDIRECT_DATA,this.ve)},get:function(){return r.safeReference(this.L.data)},hasTracked:function(){return this.L.hasTracked},_e:function(e){r.deepFreeze(e),this.L.data=e,this.L.hasTracked=!1,this.emitChange()},ve:function(){this.L.hasTracked=!0}}}),(function(e,t,n){var i=n(2),r=n(7),a=n(26),o=1e3;e.exports={initialize:function(){this.L={},this.on(r.SET_PENDING_EVENT,this.Ee),this.on(r.REMOVE_PENDING_EVENT,this.me),this.on(r.LOAD_PENDING_EVENTS,this.Ie)},getEvents:function(){return this.L},getEventsString:function(){return a.stringify(this.L)},Ee:function(e){i.keys(this.L).length>=o&&this.ye();var t=e.id,n=e.retryCount;this.L[t]&&this.L[t].retryCount===n||(this.L[t]={id:t,timeStamp:e.timeStamp,data:e.data,retryCount:n},this.emitChange())},me:function(e){delete this.L[e.id],this.emitChange()},Ie:function(e){this.L=e.events,this.ye(),this.emitChange()},ye:function(){for(var e=i.sortBy(this.L,"timeStamp"),t=0;t<=e.length-o;t++)delete this.L[e[t].id];this.emitChange()}}}),(function(e,t,n){var i=n(2),r=n(7),a=n(25);e.exports={initialize:function(){this.L={},this.L[a.PerformanceData.performance_marks]={},this.on(r.SET_PERFORMANCE_MARKS_DATA,this.Se)},Se:function(e){i.isUndefined(this.L[a.PerformanceData.performance_marks][e.name])&&(this.L[a.PerformanceData.performance_marks][e.name]=[]),this.L[a.PerformanceData.performance_marks][e.name].push(e.data),this.emitChange()},getMarks:function(){return i.mapValues(this.L[a.PerformanceData.performance_marks],(function(e){return i.map(e,(function(e){return[e.startTime,e.duration]}))}))},getDurationsFor:function(e){return i.reduce(e,i.bind((function(e,t){var n=this.L[a.PerformanceData.performance_marks][t];return n&&(e[t]=Math.round(i.reduce(n,(function(e,t){return e+t.duration}),0))),e}),this),{})}}}),(function(e,t,n){var i=n(2),r=n(7),a=n(25),o=n(23);e.exports={initialize:function(){this.L=i.mapValues(a.PluginTypes,(function(){return{}})),this.on(r.REGISTER_PLUGIN,this.Te)},Te:function(e){var t=e.type,n=e.name,i=e.plugin;if(!t||!n)throw new Error("Missing information needed to register plugins: "+t+":"+n);if(!this.L[t])throw new Error("Invalid plugin type specified: "+t);this.L[t][n]=i,o.debug("Plugin Store: Registering Plugin :",e)},getAllPlugins:function(e){if(e){if(this.L[e])return this.L[e];throw new Error("Invalid plugin type: "+e)}return this.L},getPlugin:function(e,t){if(!t||!e)throw new Error("Missing plugin parameters");var n=this.getAllPlugins(e);return n[t]||null}}}),(function(e,t,n){var i=n(2),r=n(7),a=n(19);e.exports={initialize:function(){this.L={},this.on(r.SET_VISITOR_ATTRIBUTE_PENDING,this.Ae)},getPendingAttributeValue:function(e){return e=i.isArray(e)?e.concat("pending"):[e,"pending"],a.getFieldValue(this.L,e)},Ae:function(e){a.setFieldValue(this.L,e.key,{pending:e.pending}),this.emitChange()}}}),(function(e,t,n){var i=n(2),r=n(7);e.exports={initialize:function(){this.L={layerId:null},this.on(r.ANNOUNCE_PENDING_REDIRECT,this._e)},isExpectingRedirect:function(){return i.isString(this.L.layerId)},getLayerId:function(){return this.L.layerId},_e:function(e){this.isExpectingRedirect()||(this.L.layerId=e.layerId,this.emitChange())}}}),(function(e,t,n){var i=n(2),r=n(7);e.exports={initialize:function(){this.L={inRumSample:!1,id:null,src:null,RumHost:null,data:{extras:{}},apis:{},DOMObservation:{}},this.on(r.SET_RUM_DATA,this.be),this.on(r.RECORD_API_USAGE,this.we),this.on(r.INITIALIZE_CHANGE_METRICS,this.De),this.on(r.RECORD_CHANGE_MACROTASK_RATE,this.Re),this.on(r.RECORD_CHANGE_OVERHEATED,this.Oe),this.on(r.RECORD_DOM_OBSERVATION_OCCURENCE,this.Ne)},be:function(e){i.merge(this.L,e),this.emitChange()},we:function(e){this.L.apis[e.methodName]||(this.L.apis[e.methodName]=0),this.L.apis[e.methodName]++,this.emitChange()},De:function(){i.isUndefined(this.L.data.extras.changeMacrotaskRate)&&(this.L.data.extras.changeMacrotaskRate=0),i.isUndefined(this.L.data.extras.numOverheatedChanges)&&(this.L.data.extras.numOverheatedChanges=0)},Re:function(e){i.isUndefined(this.L.data.extras.changeMacrotaskRate)&&(this.L.data.extras.changeMacrotaskRate=0),e.changeMacrotaskRate>this.L.data.extras.changeMacrotaskRate&&(this.L.data.extras.changeMacrotaskRate=e.changeMacrotaskRate),this.emitChange()},Oe:function(){i.isUndefined(this.L.data.extras.numOverheatedChanges)&&(this.L.data.extras.numOverheatedChanges=0),this.L.data.extras.numOverheatedChanges++,this.emitChange()},Ne:function(e){this.L.DOMObservation[e.counterName]||(this.L.DOMObservation[e.counterName]=0),this.L.DOMObservation[e.counterName]++,this.emitChange()},getSampleRum:function(){return this.L.inRumSample},getRumId:function(){return this.L.id},getRumHost:function(){return this.L.RumHost},getApiData:function(){return this.L.apis},getDOMObservationData:function(){return this.L.DOMObservation},getRumData:function(){return i.cloneDeep(this.L.data)},getScriptSrc:function(){return this.L.src}}}),(function(e,t,n){var i=n(7);e.exports={initialize:function(){this.L={initialized:!1,natives:{}},this.on(i.SANDBOXED_FUNCTIONS_ADDED,this.Ce)},Ce:function(e){if(!e.sandboxedFunctions)throw new Error("No sandboxedFunctions found in payload");this.L.natives=e.sandboxedFunctions,this.L.initialized=!0,this.emitChange()},getAll:function(){return this.L.natives},get:function(e){if(!e)throw new Error("Missing name parameter");return this.L.natives[e]||null},isInitialized:function(){return this.L.initialized}}}),(function(e,t,n){var i=n(2),r=n(7),a=n(24),o=n(5),s=18e5;e.exports={initialize:function(){this.L={lastSessionTimestamp:0,sessionId:null},this.on(r.REFRESH_SESSION,this.Pe),this.on(r.LOAD_SESSION_STATE,this.Le)},getState:function(){return i.cloneDeep(this.L)},getSessionId:function(){return this.L.sessionId},Le:function(e){this.L.sessionId=e.sessionId,this.L.lastSessionTimestamp=e.lastSessionTimestamp,this.emitChange()},Pe:function(){var e=a.now(),t=this.L.lastSessionTimestamp;(!this.L.sessionId||e-t>s)&&(this.L.sessionId=o.generate()),this.L.lastSessionTimestamp=e,this.emitChange()}}}),(function(e,t,n){var i=n(2),r=n(7);e.exports={initialize:function(){this.Ve(),this.on(r.FINALIZE_BATCH_SNAPSHOT,this.xe),this.on(r.REGISTER_PREVIOUS_BATCH,this.ke),this.on(r.REGISTER_TRACKER_VISITOR,this.Fe),this.on(r.REGISTER_TRACKER_EVENT,this.Me),this.on(r.REGISTER_TRACKER_DECISION,this.Ue),this.on(r.RESET_TRACKER_EVENTS,this.Ge),this.on(r.RESET_TRACKER_STORE,this.Ve),this.on(r.RESET_TRACKER_PREVIOUS_BATCHES,this.Be),this.on(r.SET_TRACKER_POLLING,this.ze),this.on(r.SET_TRACKER_BATCHING,this.je),this.on(r.SET_TRACKER_SEND_EVENTS,this.He),this.on(r.SET_TRACKER_PERSISTABLE_STATE,this.Ye),this.on(r.SET_TRACKER_DIRTY,this.Ke),this.on(r.UPDATE_TRACKER_VISITOR_ATTRIBUTES,this.qe)},getPersistableState:function(){return this.L.isDirty?this.hasEventsToSend()||this.hasPreviousBatchesToSend()?{data:this.L.data,decisions:this.L.decisions,decisionEvents:this.L.decisionEvents,previousBatches:this.L.previousBatches}:{}:null},Ye:function(e){i.isEmpty(this.L.data)||i.isEmpty(e.data)||(this.xe(),this.L.previousBatches.push(this.getEventBatch())),this.L.data=e.data||{},this.L.decisions=e.decisions||[],this.L.decisionEvents=e.decisionEvents||[],i.isEmpty(this.L.previousBatches)||i.isEmpty(e.previousBatches)?this.L.previousBatches=e.previousBatches||[]:this.L.previousBatches=this.L.previousBatches.concat(e.previousBatches),this.emitChange()},Ke:function(e){this.L.isDirty=e,this.emitChange()},Me:function(e){var t=this.We();!i.isEmpty(t.snapshots)&&i.isEmpty(this.L.decisionEvents)||this.Xe(),this.Qe().events.push(e.event),this.L.decisions=e.decisions,this.Ke(!0)},Ue:function(e){this.L.decisionEvents.push(e.decisionEvent),this.L.decisions=e.decisions,this.Ke(!0)},Fe:function(e){i.isEmpty(this.L.data)?this.L.data=e.data:this.xe(),this.L.data.visitors.push(e.visitor),this.L.decisions=e.decisions,this.L.decisionEvents=[],this.Ke(!0)},ke:function(e){this.L.previousBatches.push(e),this.Ke(!0)},Ve:function(){this.L={polling:!1,shouldBatch:!0,data:{},decisions:[],decisionEvents:[],canSend:!1,isDirty:!1,previousBatches:[]},this.emitChange()},Ge:function(){var e=this.We();this.L.data.visitors=[e],e.snapshots=[],this.Ke(!0)},Be:function(){this.L.previousBatches=[],this.Ke(!0)},ze:function(e){this.L.polling=e,this.emitChange()},je:function(e){this.L.shouldBatch=e,this.emitChange()},He:function(e){this.L.canSend=e,this.emitChange()},getEventBatch:function(){return i.cloneDeep(this.L.data)},getPreviousBatches:function(){return i.cloneDeep(this.L.previousBatches)},$e:function(){return this.L.decisionEvents.slice()},Je:function(){this.L.decisionEvents=[]},Ze:function(){return this.L.decisions.slice()},isPolling:function(){return this.L.polling},shouldBatch:function(){return this.L.shouldBatch},Qe:function(){return i.last(this.We().snapshots)},We:function(){return i.last(this.L.data.visitors)},Xe:function(){var e=this.$e(),t=this.We();t.snapshots.push({decisions:this.Ze(),events:e}),this.Je(),this.Ke(!0)},xe:function(){this.L.decisionEvents.length>0&&this.Xe()},hasEventsToSend:function(){if(!i.isEmpty(this.L.decisionEvents))return!0;if(!i.isEmpty(this.L.data)){var e=i.some(this.L.data.visitors||[],(function(e){return e.snapshots.length>0}));if(e)return!0}return!1},hasPreviousBatchesToSend:function(){return!i.isEmpty(this.L.previousBatches)},canSend:function(){return this.L.canSend},qe:function(e){var t=this.We();t&&(t.attributes=e.attributes)}}}),(function(e,t,n){var i=n(2),r=n(7);e.exports={initialize:function(){this.L={},this.on(r.SET_UA_DATA,this.k)},k:function(e){i.isEmpty(this.L)&&(this.L=e.data)},get:function(){return i.cloneDeep(this.L)}}}),(function(e,t,n){var i=n(2),r=n(7),a=n(23),o={globalTags:{},viewStates:{},shouldBatch:!1};e.exports={initialize:function(){this.L=i.cloneDeep(o),this.on(r.REGISTER_VIEWS,this.et),this.on(r.SET_VIEW_ACTIVE_STATE,this.tt),this.on(r.UPDATE_PARSED_VIEW_METADATA,this.nt),this.on(r.UPDATE_USER_SUPPLIED_METADATA,this.it),this.on(r.TRACK_VIEW_ACTIVATED_EVENT,this.rt),this.on(r.SET_GLOBAL_TAGS,this.at),this.on(r.ACTIVATE,this.ot),this.on(r.SET_VIEW_BATCHING,this.je)},getAll:function(){var e={};for(var t in this.L.viewStates)e[t]=this.getViewState(t);return e},shouldBatch:function(){return this.L.shouldBatch},getViewState:function(e){var t=i.cloneDeep(this.L.viewStates[e]),n=this.L.globalTags;return t.metadata=i.extend({},t.parsedMetadata,n,t.userSuppliedMetadata),t},getActiveViewTags:function(){var e=this.getActiveViewStates(),t=i.map(e,(function(e){return e.metadata})),n=[{}].concat(t);return i.extend.apply(i,n)},getActivationEventId:function(e){return this.L.viewStates[e]?this.L.viewStates[e].activationEventId:null},getActiveViewStates:function(){return i.reduce(this.L.viewStates,i.bind((function(e,t,n){return this.isViewActive(n)&&e.push(this.getViewState(n)),e}),this),[])},isViewActive:function(e){var t=this.L.viewStates[e];return t||a.warn("No Page registered with id",e),!!t.isActive},getGlobalTags:function(){return i.cloneDeep(this.L.globalTags)},ot:function(){this.L.viewStates={},this.emitChange()},et:function(e){i.each(e.views,i.bind((function(e){var t=e.id;this.L.viewStates[t]={id:t,isActive:!1,activatedTimestamp:null,activationEventId:null,parsedMetadata:{},userSuppliedMetadata:{}}}),this)),this.emitChange()},tt:function(e){var t=e.view.id;if(!this.L.viewStates[t])throw new Error("No view exists with id "+t);this.L.viewStates[t].isActive=e.isActive,e.isActive?this.L.viewStates[t].activatedTimestamp=e.timestamp:(this.L.viewStates[t].parsedMetadata={},this.L.viewStates[t].userSuppliedMetadata={}),this.emitChange()},nt:function(e){var t=e.pageId;if(!this.L.viewStates[t])throw new Error("No view exists with id "+t);i.assign(this.L.viewStates[t].parsedMetadata,e.metadata),this.emitChange()},it:function(e){var t=e.pageId;if(!this.L.viewStates[t])throw new Error("No view exists with id "+t);i.assign(this.L.viewStates[t].userSuppliedMetadata,e.metadata),this.emitChange()},rt:function(e){var t=e.pageId;this.L.viewStates[t]&&(this.L.viewStates[t].activationEventId=e.eventData.eventId,this.emitChange())},at:function(e){i.extend(this.L.globalTags,e),this.emitChange()},je:function(e){this.L.shouldBatch=e,this.emitChange()}}}),(function(e,t,n){var i=n(2),r=n(7),a=n(22);e.exports={initialize:function(){this.L={},this.on(r.DATA_LOADED,this.k)},getAll:function(){return a.safeReference(i.values(this.L))},getPagesMap:function(){return a.safeReference(this.L)},get:function(e){return a.safeReference(this.L[e])},getByApiName:function(e){return a.safeReference(i.find(i.values(this.L),{apiName:e}))},getNumberOfPages:function(){return i.keys(this.L).length},getAllViewsForActivationType:function(e){return i.filter(i.values(this.L),{activationType:e})},k:function(e){i.isEmpty(e.data.views)||(i.each(e.data.views,i.bind((function(e){a.deepFreeze(e),this.L[e.id]=e}),this)),this.emitChange())}}}),(function(e,t,n){var i=n(2),r=n(7),a=n(19);e.exports={initialize:function(){this.L={profile:{},metadata:{}},this.on(r.SET_VISITOR_ATTRIBUTES,this.st),this.on(r.LOAD_EXISTING_VISITOR_PROFILE,this.ut)},getVisitorProfile:function(){return this.L.profile},getVisitorProfileMetadata:function(){return this.L.metadata},getAttribute:function(e){var t=this.L.profile;return i.cloneDeep(a.getFieldValue(t,e))},getAttributeMetadata:function(e){return i.cloneDeep(this.L.metadata[e])},ut:function(e){this.L.profile=e.profile,this.L.metadata=e.metadata,this.emitChange()},st:function(e){i.each(e.attributes,i.bind((function(e){var t=e.key;a.setFieldValue(this.L.profile,t,e.value),e.metadata&&i.forOwn(e.metadata,i.bind((function(e,n){a.setFieldValue(this.L.metadata,t.concat(n),e)}),this))}),this)),this.emitChange()}}}),(function(e,t,n){var i=n(2),r=n(7);e.exports={initialize:function(){this.L={},this.on(r.DATA_LOADED,this.ct)},getCustomBehavioralAttributes:function(){return i.filter(this.L,(function(e){return!!e.rule_json}))},getVisitorAttribute:function(e){var t=i.values(this.L);if(e.datasourceId&&(t=i.filter(t,{dcp_datasource_id:String(e.datasourceId)})),e.attributeName&&e.attributeId)throw new Error("Must not specify both attribute name and attribute ID");if(e.attributeId){var n=this.L[e.attributeId];if(!n)throw new Error("Unrecognized attribute ID: "+e.attributeId);return n}if(e.attributeName){var r=i.filter(t,{name:e.attributeName});if(!r.length)throw new Error("Unrecognized attribute name: "+e.attributeName);if(r.length>1)throw new Error("Too many attributes with name: "+e.attributeName);return r[0]}throw new Error("Must specify attribute name or attribute ID")},ct:function(e){i.isEmpty(e.data.visitorAttributes)||(i.each(e.data.visitorAttributes,i.bind((function(e){this.L[e.id]=e}),this)),this.emitChange())}}}),(function(e,t,n){var i=(n(2),n(7));n(61).Event;e.exports={initialize:function(){this.L={events:[],foreignEvents:{},foreignEventQueues:{}},this.on(i.SET_VISITOR_EVENTS,this.k),this.on(i.SET_FOREIGN_VISITOR_EVENTS,this.dt),this.on(i.SET_FOREIGN_VISITOR_EVENT_QUEUE,this.ft)},getEvents:function(){return this.L.events},getForeignEvents:function(){return this.L.foreignEvents},getForeignEventQueues:function(){return this.L.foreignEventQueues},k:function(e){this.L.events=e,this.emitChange()},dt:function(e){this.L.foreignEvents[e.key]=e.value},ft:function(e){this.L.foreignEventQueues[e.key]=e.value}}}),(function(e,t,n){function i(e,t,n,i,r){this[o.FIELDS.NAME]=e,this[o.FIELDS.TYPE]=t,a.isString(n)&&n.trim().length>0&&(this[o.FIELDS.CATEGORY]=n),i&&a.keys(i).length>0&&(this[o.FIELDS.OPTIONS]=i),a.isUndefined(r)||(this[o.FIELDS.REVENUE]=r)}function r(e,t,n,i){this.eventBase=e,this[o.FIELDS.TIME]=t,a.isUndefined(n)||(this[o.FIELDS.SESSION_ID]=n),a.isUndefined(i)||(this[o.FIELDS.SESSION_INDEX]=i)}var a=n(2),o=n(62),s=n(19).getFieldValue,u=n(63);t.EventBase=i,i.prototype.digest=function(){var e=function(e,t){return encodeURIComponent(e)+"="+encodeURIComponent(t)},t=[];if(t.push(e(o.FIELDS.NAME,this[o.FIELDS.NAME])),t.push(e(o.FIELDS.TYPE,this[o.FIELDS.TYPE])),this[o.FIELDS.CATEGORY]&&t.push(e(o.FIELDS.CATEGORY,this[o.FIELDS.CATEGORY])),this[o.FIELDS.REVENUE]&&t.push(e(o.FIELDS.REVENUE,this[o.FIELDS.REVENUE])),!this[o.FIELDS.OPTIONS])return t.join("&");var n=this[o.FIELDS.OPTIONS]||{},i=a.filter(a.keys(n),(function(e){return n.hasOwnProperty(e)}));i=i.sort();for(var r=0;r >>16).toString(16)+(65535&n).toString(16)},u=function(e,t){var n=i(e,t);return(n>>>0)/a},c=function(e){var t=String.fromCharCode;return e.replace(/[\S\s]/gi,(function(e){e=e.charCodeAt(0);var n=t(255&e);return e>255&&(n=t(e>>>8&255)+n),e>65535&&(n=t(e>>>16)+n),n}))};e.exports={Seed:r,hashToHex:s,hashToInt:o,hashToReal:u,toByteString:c}}),(function(e,t,n){!(function(){function t(e,t){for(var n,i=e.length,r=t^i,a=0;i>=4;)n=255&e.charCodeAt(a)|(255&e.charCodeAt(++a))<<8|(255&e.charCodeAt(++a))<<16|(255&e.charCodeAt(++a))<<24,n=1540483477*(65535&n)+((1540483477*(n>>>16)&65535)<<16),n^=n>>>24,n=1540483477*(65535&n)+((1540483477*(n>>>16)&65535)<<16),r=1540483477*(65535&r)+((1540483477*(r>>>16)&65535)<<16)^n,i-=4,++a;switch(i){case 3:r^=(255&e.charCodeAt(a+2))<<16;case 2:r^=(255&e.charCodeAt(a+1))<<8;case 1:r^=255&e.charCodeAt(a),r=1540483477*(65535&r)+((1540483477*(r>>>16)&65535)<<16)}return r^=r>>>13,r=1540483477*(65535&r)+((1540483477*(r>>>16)&65535)<<16),r^=r>>>15,r>>>0}function n(e,t){var n,i,r,a,o,s,u,c;for(n=3&e.length,i=e.length-n,r=t,o=3432918353,s=461845907,c=0;c>>16)*o&65535)<<16)&4294967295,u=u<<15|u>>>17,u=(65535&u)*s+(((u>>>16)*s&65535)<<16)&4294967295,r^=u,r=r<<13|r>>>19,a=5*(65535&r)+((5*(r>>>16)&65535)<<16)&4294967295,r=(65535&a)+27492+(((a>>>16)+58964&65535)<<16);switch(u=0,n){case 3:u^=(255&e.charCodeAt(c+2))<<16;case 2:u^=(255&e.charCodeAt(c+1))<<8;case 1:u^=255&e.charCodeAt(c),u=(65535&u)*o+(((u>>>16)*o&65535)<<16)&4294967295,u=u<<15|u>>>17,u=(65535&u)*s+(((u>>>16)*s&65535)<<16)&4294967295,r^=u}return r^=e.length,r^=r>>>16,r=2246822507*(65535&r)+((2246822507*(r>>>16)&65535)<<16)&4294967295,r^=r>>>13,r=3266489909*(65535&r)+((3266489909*(r>>>16)&65535)<<16)&4294967295,r^=r>>>16,r>>>0}var i=n;i.v2=t,i.v3=n;e.exports=i})()}),(function(e,t,n){var i=n(7);e.exports={initialize:function(){this.L={baseMap:{},eventQueue:[],lastEvent:null,initialized:!1,cleared:!1},this.on(i.UPDATE_BEHAVIOR_STORE,this.pt)},getBaseMap:function(){return this.L.baseMap},getEventQueue:function(){return this.L.eventQueue},getLastEvent:function(){return this.L.lastEvent},getCleared:function(){return this.L.cleared},getInitialized:function(){return this.L.initialized},pt:function(e){this.L[e.key]=e.value}}}),(function(e,t,n){var i=n(2),r=n(7);e.exports={initialize:function(){this.L={randomId:null},this.on(r.SET_VISITOR_ID,this.k)},getBucketingId:function(){return this.getRandomId()},getRandomId:function(){return this.L.randomId},k:function(e){i.extend(this.L,e),this.emitChange()}}}),(function(e,t,n){var i=n(2),r=n(7),a=n(26);e.exports={initialize:function(){this.L={variationIdMap:{},preferredLayerMap:{}},this.on(r.UPDATE_VARIATION_ID_MAP,this.ht),this.on(r.MERGE_VARIATION_ID_MAP,this._t),this.on(r.UPDATE_PREFERRED_LAYER_MAP,this.vt),this.on(r.MERGE_PREFERRED_LAYER_MAP,this.Et)},getVariationIdMap:function(){return i.cloneDeep(this.L.variationIdMap)},getVariationIdMapString:function(){return a.stringify(this.L.variationIdMap)},ht:function(e){var t=this.L.variationIdMap,n=t[e.layerId]||{};n[e.experimentId]!==e.variationId&&(n[e.experimentId]=e.variationId,this.L.variationIdMap[e.layerId]=n,this.emitChange())},_t:function(e){var t=this.getVariationIdMap(),n=e.variationIdMap;i.each(t||{},(function(e,t){n[t]?i.assign(n[t],e):n[t]=e})),this.L.variationIdMap=n,this.emitChange()},getPreferredLayerMap:function(){return i.cloneDeep(this.L.preferredLayerMap)},getPreferredLayerMapString:function(){return a.stringify(this.L.preferredLayerMap)},getPreferredLayerId:function(e){return this.L.preferredLayerMap[e]},vt:function(e){this.L.preferredLayerMap[e.groupId]!==e.layerId&&(this.L.preferredLayerMap[e.groupId]=e.layerId,this.emitChange())},Et:function(e){var t=this.getPreferredLayerMap(),n=e.preferredLayerMap;i.assign(n,t),this.L.preferredLayerMap=n,this.emitChange()}}}),(function(e,t,n){var i=n(2),r=n(7);e.exports={initialize:function(){this.L={frames:[],defaultFrame:null,messages:[],subscribers:[],canonicalOrigins:null,disabled:!1},this.on(r.XDOMAIN_SET_DEFAULT_FRAME,this.mt),this.on(r.XDOMAIN_ADD_FRAME,this.It),this.on(r.XDOMAIN_SET_MESSAGE,this.yt),this.on(r.XDOMAIN_ADD_SUBSCRIBER,this.St),this.on(r.XDOMAIN_SET_CANONICAL_ORIGINS,this.Tt),this.on(r.XDOMAIN_SET_DISABLED,this.At)},getMessages:function(){return i.cloneDeep(this.L.messages)},getNextMessageId:function(){return this.L.messages.length},getMessageById:function(e){return this.L.messages[e]},getSubscribers:function(){return this.L.subscribers},getFrames:function(){return this.L.frames},getNextFrameId:function(){return this.L.frames.length},getDefaultFrame:function(){return this.L.defaultFrame},getCanonicalOrigins:function(){return i.cloneDeep(this.L.canonicalOrigins)},isDisabled:function(){return this.L.disabled},mt:function(e){this.L.defaultFrame=e},It:function(e){this.L.frames.push(e)},yt:function(e){this.L.messages[e.messageId]=e.message},St:function(e){this.L.subscribers.push(e.subscriber)},Tt:function(e){this.L.canonicalOrigins=e.canonicalOrigins},At:function(e){this.L.disabled=e.disabled}}}),(function(e,t,n){var i=n(2),r=n(7),a=n(22);e.exports={initialize:function(){this.L={},this.on(r.DATA_LOADED,this.k)},k:function(e){i.isEmpty(e.data.groups)||(i.each(e.data.groups,i.bind((function(e){a.deepFreeze(e),this.L[e.id]=e}),this)),this.emitChange())},getAll:function(){return a.safeReference(i.values(this.L))},getGroupsMap:function(){return a.safeReference(this.L)},get:function(e){return a.safeReference(this.L[e])}}}),(function(e,t,n){var i=n(71);t.initializeStore=i.initialize,t.addEvent=i.addEvent,t.getEvents=i.getEvents,t.usageInBytes=i.usageInBytes}),(function(e,t,n){function i(e){I.dispatch(v.SET_VISITOR_EVENTS,e)}function r(e){I.dispatch(v.UPDATE_BEHAVIOR_STORE,{key:"baseMap",value:e})}function a(e){I.dispatch(v.UPDATE_BEHAVIOR_STORE,{key:"eventQueue",value:e})}function o(e){I.dispatch(v.UPDATE_BEHAVIOR_STORE,{key:"lastEvent",value:e})}function s(e){I.dispatch(v.UPDATE_BEHAVIOR_STORE,{key:"cleared",value:e})}function u(){I.dispatch(v.UPDATE_BEHAVIOR_STORE,{key:"initialized",value:!0})}function c(){return O.getEvents()}function l(){return N.getBaseMap()}function d(){return N.getEventQueue()}function f(){return N.getLastEvent()}function p(){return N.getCleared()}function g(){return N.getInitialized()}function h(){return i(c().concat(d())),a([]),c().length>P&&(i(c().slice(-P)),!0)}var _=n(2),v=n(7),E=n(24),m=n(72),I=n(9),y=n(23),S=n(73),T=t,A=n(61).Event,b=n(62),w=n(61).EventBase,D=n(87),R=n(16),O=R.get("stores/visitor_events"),N=R.get("stores/visitor_events_manager"),C={EVENTBASE:"eb",HASH:"h",TIMEBASE:"tb",TIMESTAMPS:"ts",DELTA:"d",INDEX:"i"},P=1e3;t.initialize=function(e,t){if(!g()){T.bt(e,t);var n=c();n.length>0&&o(n[n.length-1]);var i=d();i.length>0&&o(i[i.length-1]),u()}},t.addEvent=function(e){y.debug("Behavior store: adding event",e);var t=T.wt(e);o(t),a(d().concat(t)),D.reindexIfNecessary(f(),c(),d()),T.Dt(d())},t.getEvents=function(){return d().length>0&&(h()&&D.sessionize(c()),T.Rt(c()),T.Dt(d())),c()},T.bt=function(e,t){T.Ot(e,t)&&(T.Rt(c()),T.Dt(d())),D.sessionize(c())},T.Ot=function(e,t){if(0===e.length&&0===t.length)return i([]),a([]),!1;var n=!1,r=e[0]||t[0];return C.EVENTBASE in r?(i(T.Nt(e)),a(T.Nt(t))):(n=!0,i(T.Ct(e)),a(T.Ct(t))),d().length>0&&(h(),n=!0),i(T._updateBaseMapAndMaybeDedupe(c())),T._migrateEventBasesAndUpdateStore()&&(n=!0),n},T.Ct=function(e){for(var t=[],n=0;n =a||n===V.AttributionTypes.LAST_TOUCH&&a>=i||w.isUndefined(i)&&a)&&(s.data=s.data||{},s.data[t]=e,a&&(s.metadata=s.metadata||{},s.metadata[t]=s.metadata[t]||{},s.metadata[t].lastModified=a))})),s}function E(e,t){return e.indexOf(t)>0}function m(){var e=W.getVisitorProfile(),t=W.getVisitorProfileMetadata(),n=H.getAllPlugins(V.PluginTypes.visitorProfileProviders);if(n){var i=w.reduce(n,(function(e,t){return t.provides&&(e[t.provides]=t),e}),{});e=w.omitBy(e,(function(e,t){var n=i[t];return n&&n.isTransient}))}return{profile:e,metadata:t}}function I(e,t){O.initializeStore(e,t)}function y(e){D.dispatch(R.LOAD_PERSISTED_LAYER_STATES,{layerStates:w.filter(e,(function(e){return!!e.decision}))})}function S(e){e=w.extend({lastSessionTimestamp:0,sessionId:null},e),D.dispatch(R.LOAD_SESSION_STATE,e)}function T(){return"oeu"+P.now()+"r"+Math.random()}function A(e){var t,n,i=H.getAllPlugins(V.PluginTypes.visitorProfileProviders),r=w.filter(i,(function(e){return w.isFunction(e.restorer)}));e.profile&&e.metadata?(t=e.profile,n=e.metadata):(t=e,n={}),t=w.reduce(t,(function(e,t,n){var i=t,a=w.find(r,{provides:n});return a&&(i=a.restorer(t)),e[n]=i,e}),{}),D.dispatch(R.LOAD_EXISTING_VISITOR_PROFILE,{profile:t,metadata:n})}function b(e){try{return x.parse(e)}catch(t){return M.debug("Failed to parse: ",e,t),null}}var w=n(2),D=n(9),R=n(7),O=n(70),N=n(71),C=n(74),P=n(24),L=n(16),V=n(25),x=n(26),k=n(19),F=n(80).LocalStorage,M=n(23),U=n(12).Promise,G=n(25).VisitorStorageKeys,B=L.get("stores/cookie_options"),z=L.get("stores/global"),j=L.get("stores/layer"),H=L.get("stores/plugins"),Y=L.get("stores/session"),K=L.get("stores/visitor_id"),q=L.get("stores/visitor_bucketing"),W=L.get("stores/visitor"),X=L.get("stores/provider_status");t.getIdFromCookies=function(){var e=t.getCurrentId();return e||(e=T()),{randomId:e}},t.getCurrentId=function(){return C.get(V.COOKIES.VISITOR_ID)},t.hasSomeData=function(){return F.keys().length>0},t.setId=function(e){var n=K.getBucketingId();D.dispatch(R.SET_VISITOR_ID,e),K.getBucketingId()!==n&&t.loadData();try{t.maybePersistVisitorId(e)}catch(e){if(M.error("Visitor / Unable to persist visitorId, disabling tracking"),D.dispatch(R.LOAD_DIRECTIVE,{trackingDisabled:!0}),e instanceof C.MismatchError)throw M.error("Visitor / Cookie not set to correct value:",e),new Error("Cookie mismatch error while persisting visitorId");throw e}t.refreshSession()},t.getVariationIdMap=function(){return u(G.VARIATION_MAP)||{}},t.updateVariationIdMap=function(e,t,n){D.dispatch(R.UPDATE_VARIATION_ID_MAP,{layerId:e,experimentId:t,variationId:n})},t.persistVariationIdMap=function(){var e=q.getVariationIdMapString();p(G.VARIATION_MAP,e,!0)},t.getPreferredLayerMap=i,t.updatePreferredLayerMap=r,t.persistTrackerOptimizelyData=function(e){p(G.TRACKER_OPTIMIZELY,e)},t.refreshSession=function(){D.dispatch(R.REFRESH_SESSION)},t.populateEagerVisitorData=function(e,n){var i=w.filter(e,(function(e){return!e.isLazy})),r=t.populateVisitorData(i,n);return r},t.populateLazyVisitorData=function(e,n){var i=w.filter(e,(function(e){return e.isLazy}));return t.populateVisitorData(i,n)},t.populateVisitorData=function(e,t){t=t||{};var n=w.partial(s,t),i=w(e).filter({isAsync:!0}).map(n).filter().value();return w.forEach(w.filter(e,(function(e){return!e.isAsync})),n),i.length>0?U.all(i):U.resolve()},t.loadData=function(){I(u(G.EVENTS)||[],u(G.EVENT_QUEUE)||[]);var e=d(G.LAYER_STATES);w.forEach(e,(function(e){e.item=w.map(e.item,l)})),y(c(e)),S(u(G.SESSION_STATE)||{}),A(u(G.VISITOR_PROFILE)||{});var n=u(G.TRACKER_OPTIMIZELY);n&&o(n),t.loadForeignData(),t.removeLegacySessionStateCookies()},t.persistBehaviorEvents=function(e){p(G.EVENTS,e)},t.persistBehaviorEventQueue=function(e){p(G.EVENT_QUEUE,e)},t.persistLayerStates=function(){var e=j.getLayerStates(t.getNamespace());e=w.map(e,(function(e){return w.omit(e,"namespace")})),p(G.LAYER_STATES,e)},t.persistSessionState=function(){p(G.SESSION_STATE,Y.getState())},t.persistVisitorProfile=function(){p(G.VISITOR_PROFILE,m())},t.persistVisitorBucketingStore=function(){t.persistVariationIdMap(),a()},t.getUserIdFromKey=function(e,n){var i;return w.includes(e,n)&&w.includes(e,"_")&&w.includes(e,"$$")&&w.includes(e.slice(e.indexOf("$$")),t.getNamespace())&&(i=e.slice(e.indexOf("_")+1,e.indexOf("$$"))),i},t.maybePersistVisitorId=function(e){C.remove(V.COOKIES.VISITOR_UUID),e.randomId&&(B.getAutoRefresh()||t.getCurrentId()!==e.randomId?(C.set(V.COOKIES.VISITOR_ID,e.randomId),M.log("Persisting visitorId:",e.randomId)):M.log("Not persisting visitorId: value is not changed and also auto-refresh is disabled"))},t.getAttribute=function(e){return W.getAttribute(e)},t.getPendingAttributeValue=function(e){return X.getPendingAttributeValue(e)},t.loadForeignData=function(){w.each(F.keys(),(function(e){var t=F.getItem(e);t&&_(e,t)}))},t.getNamespace=function(){return z.getNamespace()},t.serializeFieldKey=function(e){return w.isArray(e)?e.join("$$"):e},t.removeLegacySessionStateCookies=function(){var e=C.getAll();w.forEach(w.keys(e),(function(e){0===e.indexOf(V.COOKIES.SESSION_STATE+"$$")&&C.remove(e)}))}}),(function(e,t,n){function i(e,n){n!==!1&&(n=!0);for(var i,a,o=e.hostname.split("."),s=[],u=null,l=o.length-1;l>=0;l--)if(s.unshift(o[l]),i=s.join("."),!r.includes(h,i)){a={domain:n?"."+i:i};try{t.set(_,Math.random().toString(),a),t.remove(_,a),u=a.domain;break}catch(e){}}return d.dispatch(c.SET_COOKIE_DOMAIN,u),u}var r=n(2),a=n(75).create,o=n(24),s=n(79),u=n(39),c=n(7),l=n(16),d=n(9),f=l.get("stores/cookie_options"),p=t.SetError=a("CookieSetError"),g=t.MismatchError=a("CookieMismatchError");t.getAll=function(e){r.isUndefined(e)&&(e=!0);var n,i,a,o,u;n=s.getCookieString().split(/\s*;\s*/);var c={};for(a=0;a 0&&(u=t.safeDecodeURIComponent(i.substring(0,o)),void 0===c[u])){var l=i.substring(o+1);e&&(l=t.safeDecodeURIComponent(l)),c[u]=l}return c},t.safeDecodeURIComponent=function(e){try{return decodeURIComponent(e)}catch(t){return e}},t.get=function(e,n){var i=t.getAll(n);return i[e]},t.set=function(e,n,a,c){a=r.extend({encodeValue:!0},a),c!==!1&&(c=!0);var l=[];if(r.isUndefined(a.domain)){var d=f.getCurrentDomain();d||(d=i(u.getLocation(),!0)),a.domain=d}if(a.domain&&l.push("domain="+a.domain),r.isUndefined(a.path)&&(a.path="/"),a.path&&l.push("path="+a.path),r.isUndefined(a.expires)){var h=r.isUndefined(a.maxAge)?f.getDefaultAgeInSeconds():a.maxAge;a.expires=new Date(o.now()+1e3*h)}if(r.isUndefined(a.expires)||l.push("expires="+a.expires.toUTCString()),a.secure&&l.push("secure"),l=l.join(";"),s.setCookie(e+"="+(a.encodeValue?encodeURIComponent(n):n)+";"+l),c){var _=a.encodeValue,v=t.get(e,_);if(v!==n){if(!v)throw new p('Failed to set cookie "'+e+'"');throw new g('Expected "'+n+'" for "'+e+'", got "'+v+'"')}}},t.remove=function(e,n){for(var i=u.getLocation().hostname.split(".");i.length>0;)t.set(e,null,r.extend({},n,{domain:"."+i.join("."),expires:new Date(0)}),!1),i.shift()};var h=["optimizely.test"],_="optimizelyDomainTestCookie"}),(function(e,t,n){var i=n(76),r=i("InternalError");t.BaseError=r,t.create=function(e){return i(e,r)}}),(function(e,t,n){function i(e,t){function n(t){if(!(this instanceof n))return new n(t);try{throw new Error(t)}catch(t){t.name=e,this.stack=t.stack}r&&this.stack&&(this.stack=a(this.stack,e,t)),this.message=t||"",this.name=e}return n.prototype=new(t||Error),n.prototype.constructor=n,n.prototype.inspect=function(){return this.message?"["+e+": "+this.message+"]":"["+e+"]"},n.prototype.name=e,n}var r=n(77)(),a=n(78);e.exports=i}),(function(e,t){"use strict";e.exports=function(){var e=new Error("yep");return!!e.stack&&"Error: yep\n"===e.stack.substr(0,11)}}),(function(e,t){"use strict";e.exports=function(e,t,n){var i=t;return n&&(i+=": "+n),e=i+e.slice(e.indexOf("\n"))}}),(function(e,t,n){function i(){return"loading"===t.getReadyState()}var r=n(16),a=r.get("stores/global");t.getDocumentElement=function(){return document.documentElement},t.getCookieString=function(){return document.cookie||""},t.setCookie=function(e){document.cookie=e},t.querySelector=function(e){return document.querySelector(e)},t.querySelectorAll=function(e){return document.querySelectorAll(e)},t.childrenOf=function(e){return Array.prototype.slice.call(e.querySelectorAll("*"))},t.createElement=function(e){return document.createElement(e)},t.isReady=function(){return a.domContentLoadedHasFired()||"interactive"===document.readyState||"complete"===document.readyState},t.isLoaded=function(){return"complete"===document.readyState},t.addReadyHandler=function(e){return document.addEventListener("DOMContentLoaded",e),function(){t.removeReadyHandler(e)}},t.removeReadyHandler=function(e){return function(){document.removeEventListener("DOMContentLoaded",e)}},t.getReferrer=function(){return document.referrer},t.getReadyState=function(){return document.readyState},t.write=function(e){if(!i())throw new Error("Aborting attempt to write to already-loaded document");document.write(e)},t.appendToHead=function(e){return t.appendTo(document.head,e)},t.appendTo=function(e,t){e.appendChild(t)},t.addEventListener=function(e,t,n){return document.addEventListener(e,t,n),function(){document.removeEventListener(e,t,n)}},t.getCurrentScript=function(){if(document.currentScript)return document.currentScript},t.parentElement=function(e){for(var t=e.parentNode;t.nodeType!==Node.ELEMENT_NODE;)t=t.parentNode;return t}}),(function(e,t,n){var i,r,a="optimizely_data",o=n(75).create,s=n(81),u=n(39),c=t.Error=o("StorageError");try{r=u.getGlobal("localStorage")}catch(e){throw new c("Unable to read localStorage: "+e.toString())}if(!r)throw new c("localStorage is undefined");i=s.create(r,a),t.LocalStorage=i}),(function(e,t,n){function i(e,t){this.Mt=e,this.Ut=t}var r=n(2),a=n(23),o="$$";i.prototype.Gt=function(e){return[this.Ut,e].join(o)},i.prototype.Bt=function(e){return e.replace(this.Ut+o,"")},i.prototype.setItem=function(e,t){try{this.Mt.setItem(this.Gt(e),t)}catch(t){a.warn("Failed to save",e,"to localStorage:",t)}},i.prototype.removeItem=function(e){this.Mt.removeItem(this.Gt(e))},i.prototype.getItem=function(e){var t=null;try{t=this.Mt.getItem(this.Gt(e))}catch(e){}return t},i.prototype.keys=function(){var e=r.keys(this.Mt);return r.map(r.filter(e,r.bind((function(e){return r.includes(e,this.Ut)}),this)),r.bind(this.Bt,this))},i.prototype.allKeys=function(){return r.keys(this.Mt)},i.prototype.allValues=function(){return r.values(this.Mt)},e.exports={create:function(e,t){return new i(e,t)},mockStorage:{keys:function(){},getItem:function(e){},removeItem:function(e){},setItem:function(e,t){}}}}),(function(e,t,n){function i(){return u.getGlobal("performance")}var r=n(7),a=n(75).create,o=n(24),s=n(9),u=n(39),c=n(16),l=c.get("stores/rum"),d="optimizely:",f=t.Error=a("PerformanceError");t.time=function(e){if(l.getSampleRum()){var t=i();if(t&&t.mark){var n=d+e;t.clearMarks(n+"Begin"),t.mark(n+"Begin")}}},t.timeEnd=function(e){if(l.getSampleRum()){var t=i();if(t&&t.mark){var n=d+e,a=t.getEntriesByName(n+"Begin");if(0===a.length)throw new f("Called timeEnd without matching time: "+e);t.clearMarks(n+"End"),t.mark(n+"End");var o=t.getEntriesByName(n+"End"),u=e+"Time",c=o[0].startTime-a[0].startTime;s.dispatch(r.SET_PERFORMANCE_MARKS_DATA,{name:u,data:{startTime:Math.round(1e3*a[0].startTime)/1e3,duration:Math.round(1e3*c)/1e3}})}}},t.now=function(){var e=i();return e?e.now():o.now()}}),(function(e,t,n){function i(e){var t;if(!o.find(I.getFrames(),{origin:e.origin}))return void m.debug("XDomain","No frame found for origin: "+e.origin);try{t=h.parse(e.data)}catch(t){return void m.debug("XDomain","Ignoring malformed message event:",e)}if("ERROR"===t.type)l.dispatch(u.XDOMAIN_SET_DISABLED,{disabled:!0}),d.emitInternalError(new y("Xdomain Error: "+t.response));else if("SYNC"===t.type)o.each(I.getSubscribers(),(function(e){e(t.response.key,t.response.value)}));else{var n=I.getMessageById(t.id);if(!n){if(m.warn("XDomain","No stored message found for ID",t.id),o.isNumber(t.id)){var i=I.getNextMessageId();t.id>=i?d.emitInternalError(new y("Message ID is greater than expected maximum ID ("+t.id+">"+i+")")):t.id<0?d.emitInternalError(new y("Message ID is < 0: "+t.id)):d.emitInternalError(new y("No stored message found for message ID: "+t.id))}else d.emitInternalError(new y("Message ID is not a number: "+t.id));return}n.resolver(t.response),l.dispatch(u.XDOMAIN_SET_MESSAGE,{messageId:t.id,message:o.extend({},n,{endTime:p.now(),response:t.response})})}}function r(e,t){return t||(t=I.getDefaultFrame()),new s(function(n){var i={data:o.extend({},e,{id:I.getNextMessageId()}),resolver:n};t?I.isDisabled()||a(i,t):l.dispatch(u.XDOMAIN_SET_MESSAGE,{messageId:i.data.id,message:i})})}function a(e,t){var n=e.data;l.dispatch(u.XDOMAIN_SET_MESSAGE,{messageId:e.data.id,message:o.extend({},e,{startTime:p.now()})}),t.target.postMessage(h.stringify(n),t.origin)}var o=n(2),s=n(12).Promise,u=n(7),c=n(16),l=n(9),d=n(84),f=n(75).create,p=n(24),g=n(79),h=n(26),_=n(86),v=n(73),E=n(39),m=n(23),I=c.get("stores/xdomain"),y=t.Error=f("XDomainStorageError");t.setItem=function(e,t,n){return r({type:"PUT",key:e,value:t},n)},t.getItem=function(e,t){return r({type:"GET",key:e},t)},t.fetchAll=function(e){return r({type:"GETALL"},e)},t.subscribe=function(e){l.dispatch(u.XDOMAIN_ADD_SUBSCRIBER,{subscriber:e})},t.loadIframe=function(e,t){return new s(function(n){var i=g.createElement("iframe");i.src=e+t,i.hidden=!0,i.setAttribute("aria-hidden","true"),i.setAttribute("tabindex","-1"),i.style.display="none",i.height=0,i.width=0,i.onload=function(){var r={id:I.getNextFrameId(),target:i.contentWindow,origin:e,path:t};l.dispatch(u.XDOMAIN_ADD_FRAME,r),n(r)},g.appendTo(g.querySelector("body"),i)})},t.loadCanonicalOrigins=function(e){l.dispatch(u.XDOMAIN_SET_CANONICAL_ORIGINS,{canonicalOrigins:e})},t.getXDomainUserId=function(e,t){var n,i={};return o.each(t,(function(t){i[t]=[],o.each(o.keys(e),(function(e){var r=v.getUserIdFromKey(e,t);!n&&r&&(n=r),r&&!o.includes(i[t],r)&&i[t].push(r)}))})),m.debug("XDomain: Found userIds:",i),n},t.load=function(e,n){E.addEventListener("message",i);var r=function(){return!!g.querySelector("body")},s=function(){return t.loadIframe(e,n)};return _.pollFor(r).then(s).then((function(e){l.dispatch(u.XDOMAIN_SET_DEFAULT_FRAME,e),I.isDisabled()||o.each(I.getMessages(),(function(t){t.startTime||a(t,e)}))}))}}),(function(e,t,n){var i=n(85);t.emitError=function(e,t,n){var r=!0;i.emit({type:"error",name:e.name||"Error",data:{error:e,metadata:t}},n||!1,r)},t.emitInternalError=function(e,n){t.emitError(e,n,!0)},t.emitAnalyticsEvent=function(e,t){var n={type:"analytics",name:"trackEvent",data:e};i.emit(n,t)}}),(function(e,t,n){var i=n(2),r=n(5),a=n(7),o=n(84),s=n(16),u=n(9),c=n(23),l=s.get("stores/event_emitter");t.on=function(e){return e.token||(e.token=r.generate()),u.dispatch(a.ADD_EMITTER_HANDLER,e),e.token},t.off=function(e){u.dispatch(a.REMOVE_EMITTER_HANDLER,{token:e})},t.emit=function(e,t,n){var r=l.getHandlers(e,t);i.each(r,(function(i){try{i.handler.call({$di:s},e)}catch(r){!n&&i.emitErrors?(c.error("Error in handler for event:",e,r),o.emitError(r,null,t)):c.warn("Suppressed error in handler for event:",e,r)}}))}}),(function(e,t,n){var i=n(2),r=n(12).Promise,a=n(39),o=100,s=50;t.pollFor=function(e,t,n){var u,c;return i.isFunction(n)?c=n:(u=n||o,c=function(){return u--,u<-1}),t=t||s,new r(function(n,i){!(function r(){var o;if(!c()){try{var s=e();if(s)return n(s)}catch(e){o=e}return a.setTimeout(r,t)}i(o||new Error("Poll timed out"))})()})}}),(function(e,t,n){function i(e,n){var i;i=t.isInSameSession(e,n)?e.getValueOrDefault([s.FIELDS.SESSION_ID]):n.getValueOrDefault([s.FIELDS.TIME]),n.setFieldValue(s.FIELDS.SESSION_ID,i)}function r(e,n,i){var r,a=e.getValueOrDefault([s.FIELDS.SESSION_INDEX]);r=t.isInSameSession(n,e)?a:i?a+1:a-1,n.setFieldValue(s.FIELDS.SESSION_INDEX,r)}var a=n(61).Event,o=n(24),s=n(62),u=n(61).EventBase;t.CURRENT_SESSION_INDEX=0;var c=18e5;t.isInSameSession=function(e,t){var n=e.getValueOrDefault([s.FIELDS.TIME],0),i=t.getValueOrDefault([s.FIELDS.TIME],0);return Math.abs(n-i) c&&(u+=1),e[n-1].setFieldValue(s.FIELDS.SESSION_INDEX,u);for(var a=n-1;a>0;a--)r(e[a],e[a-1],!0)}},t.reindexIfNecessary=function(e,t,n){function i(e){for(var t=0;t =l?(o.dispatch(r.REMOVE_PENDING_EVENT,{id:n}),u.warn("Event ",f," could not be sent after ",l," attempts.")):(f.retryCount++,o.dispatch(r.SET_PENDING_EVENT,f),u.debug("Event ",f," failed to send, with error ",e," It will be retried ",l-s," times.")),e}))},t.sendBeacon=t.request}),(function(e,t,n){var i=n(2),r=n(7),a=n(24),o=n(16),s=n(79),u=n(25),c=n(9),l=n(23),d=o.get("stores/sandbox"),f=n(39);t.shouldSandbox=function(){return!1},t.get=function(e){if(!e)throw new Error("Name is required");if(t.shouldSandbox()){d.isInitialized()||p();var n=d.get(e);if(n)return n}return f.getGlobal(e)};var p=function(){try{var e="optimizely_"+a.now(),t=s.createElement("iframe");t.name=e,t.style.display="none",s.appendToHead(t);var n=t.contentWindow,o=t.contentDocument;o.write(""),o.close();var d=i.mapValues(u.SandboxedFunctions,(function(e){return n[e]}));c.dispatch(r.SANDBOXED_FUNCTIONS_ADDED,{sandboxedFunctions:d}),t.parentNode.removeChild(t)}catch(e){l.warn("Unable to create a sandbox: ",e)}}}),(function(e,t,n){var i=n(2),r=n(23),a=n(91),o=n(16),s=o.get("stores/plugins"),u=n(7),c=n(25),l=n(9),d=[n(105),n(106),n(125)],f=["disable","load","optOut"];t.push=function(e,t){var n,a,o,s;if(!i.isArray(e)&&i.isObject(e))s=i.isUndefined(e.version)?1:e.version,n=e.type,o=[e];else if(i.isArray(e))s=0,n=e[0],o=e.slice(1);else{if(!i.isString(e))return r.warn("API / Ignoring non-array/object/string argument:",e),!1;s=0,n=e,o=[]}if(d[s]&&(a=d[s][n]),t&&f.indexOf(n)===-1)return r.debug("API / Ignoring non high priority function:",n,o),!1;if(!a)return r.warn('API / No function found for "'+n+'" (v'+s+") with arguments:",o),!1;r.log('API / Executing: "'+n,'" with arguments:',o);try{a.apply(null,o),l.dispatch(u.RECORD_API_USAGE,{methodName:s?"v"+s+"."+n:n})}catch(e){r.error(e)}return!0},t.get=function(e){r.log('API / Getting module: "'+e+'"');var t=a[e];return t?i.isArray(t)&&(t=o.evaluate(t)):t=s.getPlugin(c.PluginTypes.apiModules,e),t?(l.dispatch(u.RECORD_API_USAGE,{methodName:"get."+e}),t):void r.warn('Module "'+e+'" not found.')}}),(function(e,t,n){function i(e,t,n,i){var r=e.getLayerState(i),a=t.get(i),s=n.get();if(!r||!a)return s?{layer:{name:s.layerName,id:s.layerId,policy:s.layerPolicy,integrationStringVersion:s.integrationStringVersion},experiment:{name:s.experimentName,id:s.experimentId},variation:{name:s.variationName,id:s.variationId},isLayerHoldback:!1}:null;if(d.isSingleExperimentPolicy(a.policy)&&r.decision.isLayerHoldback)return null;var u=r.decision.experimentId,c=r.decision.variationId;if(!u||!c)return null;var l,f;return(l=o.find(a.experiments,{id:u}))?(f=o.find(l.variations,{id:c}),f?{layer:{name:a.name,id:a.id,policy:a.policy,integrationStringVersion:a.integrationStringVersion},experiment:{name:l.name,id:l.id},variation:{name:f.name,id:f.id},isLayerHoldback:r.decision.isLayerHoldback}:null):null}function r(e,t,n,i,r,s){var u=[],c=e.getLayerStates();s.onlySingleExperiments&&(c=o.filter(c,(function(e){var n=t.get(e.layerId);return n&&d.isSingleExperimentPolicy(n.policy)})));var l=o.map(c,(function(e){var t=!!e.decision.variationId,n=e.decisionActivationId&&e.decisionActivationId===i.getActivationId(),r=f.getExperimentAndVariation(),a=r?r.variationId:null,s=t&&e.decision.variationId===a;return o.extend(e,{isActive:t&&n||s,visitorRedirected:s})})),p=r?o.filter(l,r):l;return o.each(p,(function(e){var i=a(e,t,n,s.includeOfferConsistency);i&&u.push(i)})),u}function a(e,t,n,i){var r,a,s=e.layerId,u=t.get(s)||{},c=o.map(u.experiments,(function(e){return o.pick(e,["id","name"])}));if(i||!u.decisionMetadata||!u.decisionMetadata.offerConsistency){var l={id:s,campaignName:u.name||null,experiment:null,allExperiments:c,variation:null,reason:e.decision.reason,isActive:e.isActive,visitorRedirected:e.visitorRedirected,isInCampaignHoldback:e.decision.isLayerHoldback};e.decision&&e.decision.experimentId&&(r=o.find(u.experiments,{id:e.decision.experimentId})),r&&(l.experiment=o.pick(r,["id","name","campaignName"])),r&&e.decision.variationId&&(a=o.find(r.variations,{id:e.decision.variationId})),a&&(l.variation=o.pick(a,["id","name"]));var d=o.map(e.decisionTicket.audienceIds,(function(e){return o.pick(n.get(e),["id","name"])}));return l.audiences=d,u.decisionMetadata&&u.decisionMetadata.offerConsistency&&(l.pageId=e.pageId),l}}var o=n(2),s=n(92),u=n(93),c=n(94),l=n(96),d=n(43),f=n(97);t.data=["stores/audience_data","stores/event_data","stores/layer_data","stores/view_data","stores/group_data","stores/global",function(e,t,n,i,r,a){var u={},d={},f={},p={audiences:e.getAudiencesMap(),events:t.getEventsMap(),campaigns:u,pages:i.getPagesMap(),experiments:d,variations:f,projectId:a.getProjectId(),snippetId:a.getSnippetId(),accountId:a.getAccountId(),dcpServiceId:a.getDCPServiceId(),revision:a.getRevision(),clientVersion:s.VERSION},g=l.dereferenceChangeId;return o.each(n.getAll(),(function(e){c.defineProperty(u,e.id,(function(){var t=o.extend({},e);return c.defineProperty(t,"changes",(function(){return o.map(e.changes,g)}),"campaign"),c.defineProperty(t,"experiments",(function(){return o.map(e.experiments,(function(e){return d[e.id]}))}),"campaign"),t}),"campaignMap","byId"),o.each(e.experiments,(function(e){c.defineProperty(d,e.id,(function(){var t=o.extend({},e);return c.defineProperty(t,"changes",(function(){return o.map(e.changes,g)}),"experiment"),c.defineProperty(t,"variations",(function(){return o.map(e.variations,(function(e){return f[e.id]}))}),"experiment"),t}),"experimentMap","byId"),o.each(e.variations,(function(e){c.defineProperty(f,e.id,(function(){var t=o.extend({},e);return c.defineProperty(t,"actions",(function(){return o.map(e.actions,(function(e){return o.extend({},e,{changes:o.map(e.changes,g)})}))}),"variation"),t}),"variationMap","byId")}))}))})),p.groups=r.getGroupsMap(),p}],t.session=["stores/session",function(e){return e.getState()}],t.visitor=["stores/visitor",function(e){return o.cloneDeep(e.getVisitorProfile())}],t.visitor_id=["stores/visitor_id",function(e){return{randomId:e.getRandomId()}}],t.state=["stores/audience_data","stores/layer_data","stores/layer","stores/view_data","stores/view","stores/global","stores/observed_redirect",function(e,t,n,a,s,c,l){return{getCampaignStates:function(i){var a={},s=r(n,t,e,c,i,{includeOfferConsistency:!1});return o.each(s,(function(e){a[e.id]=e})),a},getExperimentStates:function(i){var a=r(n,t,e,c,i,{includeOfferConsistency:!1,onlySingleExperiments:!0}),s=["audiences","variation","reason","visitorRedirected","isActive"],u=o.reduce(a,(function(e,t){var n=t.allExperiments[0];return e[n.id]=o.extend({},o.pick(t,s),{id:n.id,experimentName:n.name,isInExperimentHoldback:t.isInCampaignHoldback}),e}),{});return u},getCampaignStateLists:function(i){var a={},s=r(n,t,e,c,i,{includeOfferConsistency:!0});return o.each(s,(function(e){var t=e.id;a[t]||(a[t]=[]),a[t].push(e)})),a},getPageStates:function(e){var t=s.getAll(),n=o.reduce(t,(function(e,t){var n=a.get(t.id);return e[t.id]=o.extend({},o.pick(n,["id","name","apiName","category","staticConditions","tags"]),o.pick(t,["isActive","metadata"])),e}),{});return e?o.pickBy(n,e):n},isGlobalHoldback:function(){return c.isGlobalHoldback()},getActivationId:function(){return c.getActivationId()},getVariationMap:function(){var e=n.getLayerStates(),i={};return o.each(e,(function(e){var n=t.get(e.layerId);if(e.decision&&e.decision.experimentId&&(i[e.decision.experimentId]={id:e.decision.variationId,name:null,index:null},n)){var r=o.find(n.experiments,{id:e.decision.experimentId});if(r&&e.decision.variationId)var a=o.find(r.variations,{id:e.decision.variationId}),s=o.findIndex(r.variations,{id:e.decision.variationId});a&&(i[e.decision.experimentId]={id:e.decision.variationId,name:a.name,index:s})}})),i},getActiveExperimentIds:function(){var e={};return o.each(this.getCampaignStateLists({isActive:!0}),(function(t){o.each(t,(function(t){e[t.experiment.id]=!0}))})),o.keys(e)},getRedirectInfo:function(){var e=f.getExperimentAndVariation();return e&&(e.referrer=f.getReferrer()),e},getDecisionString:function(e){if(!e)throw new Error("Must pass a config to getDecisionString");e=o.extend({maxLength:255,shouldCleanString:!1},e);var r=i(n,t,l,e.campaignId);return r?u.generateAnalyticsString(r.layer,r.experiment,r.variation,r.isLayerHoldback,e.maxLength,e.shouldCleanString):null},getDecisionObject:function(e){if(!e)throw new Error("Must pass a config to getDecisionObject");e=o.extend({maxLength:255,shouldCleanString:!1},e);var r=i(n,t,l,e.campaignId);if(!r)return null;var a=u.formatNamesAndIdsForAnalytics(r.layer,r.experiment,r.variation,e.shouldCleanString),s=o.mapValues(a.names,(function(t,n){return u.combineAndTruncateIdAndName(t,a.idStrings[n],e.maxLength)})),c={experiment:s.experiment,variation:s.variation};return d.isSingleExperimentPolicy(r.layer.policy)||o.extend(c,{campaign:s.layer,holdback:r.isLayerHoldback}),c}}}],t.utils=n(98).create(),t.jquery=["env/jquery",function(e){return e}],t.event_emitter=n(104)}),(function(e,t,n){t.VERSION="0.113.0",t.ENGINE="js"}),(function(e,t,n){function i(e){return e.replace(/[^a-zA-Z0-9\.\~\!\*\(\)\']+/g,"_")}function r(e){return!u.isEmpty(e)&&u.includes(["and","or","not"],e[0])}function a(e,t){var n="";return u.isEmpty(t)?n=d:(n=u.reduce(t,(function(t,n){var r=e.get(n);return r?t+i(r.name?r.name:r.id)+",":t}),""),n=n.slice(0,-1)),n}function o(e,n,i,r,a,o){if(!_.isSingleExperimentPolicy(e.policy)||!r){var s=!_.isSingleExperimentPolicy(e.policy)&&r,c=t.formatNamesAndIdsForAnalytics(e,n,i,o),d=[c.names.experiment,c.names.variation],p=[c.idStrings.experiment,c.idStrings.variation];_.isSingleExperimentPolicy(e.policy)||(d.unshift(c.names.layer),p.unshift(c.idStrings.layer));var g=u.reduce(p,(function(e,t){return e+t.length}),0),h=d.length-1+(s?1:0),v=h*l.length,E=g+v;if(s&&(E+=f.length),E>a)throw new Error("The analytics string size is too low to send the entity IDs.");for(var m=a-E,I=d.length,y=[],S=d.length-1;S>=0;S--){var T=d[S],A=Math.min(T.length,Math.floor(m/I));m-=A,I--,y.unshift(T.substring(0,A))}var b=u.map(y,(function(e,t){return e+p[t]}));return s&&b.push(f),b.join(l)}}function s(e,n,i,r,a,o){var s=r?f:p,c=3*l.length,d=t.formatNamesAndIdsForAnalytics(e,n,i,o),g=d.names,h=d.idStrings,v=u.reduce(h,(function(e,t){return e+t.length}),0);if(v+c+s.length>a)throw new Error("The analytics string size is too low to send the campaign, experiment, and variation IDs.");var E=a-v-c-s.length,m={}; m.variation=Math.min(g.variation.length,Math.floor(E/3)),E-=m.variation,m.experiment=Math.min(g.experiment.length,Math.floor(E/2)),E-=m.experiment,m.layer=E;var I={};u.each(g,(function(e,t){I[t]=e.substring(0,m[t])}));var y=[];return _.isSingleExperimentPolicy(e.policy)||y.push(I.layer+h.layer),y=y.concat([I.experiment+h.experiment,I.variation+h.variation,s]),y.join(l)}var u=n(2),c=n(16),l=":",d="everyone_else",f="holdback",p="treatment",g="",h=n(23),_=n(43);t.formatNamesAndIdsForAnalytics=function(e,t,n,o){var s={layer:e.name||g,experiment:t.name||g,variation:n.name||g};if(o&&(s=u.mapValues(s,i)),s.experiment===g&&(!e.integrationStringVersion||1===e.integrationStringVersion))if(r(t.audienceIds))s.experiment="Exp";else{var l=c.get("stores/audience_data");s.experiment=a(l,t.audienceIds)}var d={layer:"("+i(e.id)+")",experiment:"("+i(t.id)+")",variation:"("+i(n.id)+")"};return{names:s,idStrings:d}},t.combineAndTruncateIdAndName=function(e,t,n){var i=n-t.length;if(i<0&&(h.warn("maxLength must be at least long enough to fit the entity ID, which is length"+t.length+". Defaulting to only use entity ID as name."),e=g),e===g)return t;if(e.length>i){var r=Math.min(e.length,i);return e=e.substring(0,r),e+t}return e+" "+t},t.generateAnalyticsString=function(e,t,n,i,r,a){return e.integrationStringVersion&&2===e.integrationStringVersion?o(e,t,n,i,r,a):s(e,t,n,i,r,a)}}),(function(e,t,n){var i=n(95),r=n(7),a=n(9),o=n(23);t.defineProperty=function(e,t,n,s,u){i(e,t,(function(){var e=["prop",s,u||t].join(".");return o.debug('Evaluating getter: "'+e+'"'),a.dispatch(r.RECORD_API_USAGE,{methodName:e}),n()}),!0)}}),(function(e,t){"use strict";function n(e,t,n,i){Object.defineProperty(e,t,{get:function(){var e=n.call(this);return Object.defineProperty(this,t,{value:e,enumerable:!!i,writable:!0}),e},set:function(e){return Object.defineProperty(this,t,{value:e,enumerable:!!i,writable:!0}),e},enumerable:!!i,configurable:!0})}e.exports=n}),(function(e,t,n){function i(e){var n=r.cloneDeep(e);return n.changes&&(n.changes=r.map(n.changes,t.dereferenceChangeId)),n.experiments&&r.each(n.experiments,(function(e){e.changes&&(e.changes=r.map(e.changes,t.dereferenceChangeId)),e.variations&&r.each(e.variations,(function(e){e.actions&&r.each(e.actions,(function(e){e.changes&&(e.changes=r.map(e.changes,t.dereferenceChangeId))}))}))})),n}var r=n(2),a=n(16),o=n(22),s=n(94),u=a.get("stores/change_data");t.translateDecisionToCampaignDecision=function(e){return c(r.cloneDeep(e),{layerId:"campaignId",isLayerHoldback:"isCampaignHoldback"})},t.translateLayerEventToCampaignEvent=function(e){var t={};return s.defineProperty(t,"campaign",(function(){var t=i(e.data.layer);return t}),"campaignEvent"),t.decisionTicket=e.data.decisionTicket,t.decision=this.translateDecisionToCampaignDecision(e.data.decision),t.audiences=e.data.audiences,{type:"lifecycle",name:"campaignDecided",data:t}},t.translateViewActivatedToPageActivated=function(e){return{type:"lifecycle",name:"pageActivated",data:{page:e.data.view}}},t.dereferenceChangeId=function(e){var t=u.getChange(e);return t?o.safeReference(t):e};var c=function(e,t){var n=r.omit(e,r.keys(t));return r.each(t,(function(t,i){n[t]=e[i]})),n}}),(function(e,t,n){var i=n(2),r=n(16),a=r.get("stores/global_state"),o=r.get("stores/layer_data"),s=r.get("stores/observed_redirect");t.getReferrer=function(){var e=s.get();return e?e.referrer:i.isString(a.getEffectiveReferrer())?a.getEffectiveReferrer():null},t.getExperimentAndVariation=function(){var e=s.get();if(e&&i.isString(e.variationId))return i.pick(e,["experimentId","variationId"]);if(i.isString(a.getEffectiveVariationId())){var t=a.getEffectiveVariationId(),n=o.getExperimentByVariationId(t),r=n?n.id:null;return{experimentId:r,variationId:t}}return null}}),(function(e,t,n){var i=n(12).Promise,r=n(99).observeSelector,a=n(100).poll,o=n(102).waitForElement,s=n(103).waitUntil;t.create=function(){return{observeSelector:r,poll:a,Promise:i,waitForElement:o,waitUntil:s}}}),(function(e,t,n){function i(){if(f.shouldObserveChangesIndefinitely()){var e={attributes:!0,childList:!0,subtree:!0,characterData:!0},t=p.getDocumentElement(),n=new MutationObserver(function(){this.disconnect(),l.each(l.keys(E),a),this.observe(t,e)});return function(i){var r=E[i];n.observe(t,e),r.cancelObservation=function(){delete E[i],l.isEmpty(E)&&n.disconnect()}}}return function(e){var t=h.poll(l.partial(a,e));E[e].cancelObservation=function(){t(),delete E[e]}}}function r(e){var t=E[e];t&&t.cancelObservation&&t.cancelObservation()}function a(e){if(E[e]){if(o(E[e]))return 0===E[e].matchedCount&&l.isFunction(E[e].options.onTimeout)&&E[e].options.onTimeout(),void r(e);var t=document.querySelectorAll(E[e].selector);t.length&&(l.each(t,(function(t){t.zt&&t.zt[e]||E[e].callbackQueue.push(t)})),s(e))}}function o(e){var t=e.options.timeout;if(null!==t)if("function"==typeof t)try{return t()}catch(e){}else if(Date.now()-e.startTime>t)return!0;return!1}function s(e){for(;E[e]&&E[e].callbackQueue.length;){var t=E[e].callbackQueue.shift();if(u(t,e),E[e].matchedCount=E[e].matchedCount+1,E[e].callback(t),E[e]&&E[e].options.once)return void r(e)}}function u(e,t){e.zt||(e.zt={}),e.zt[t]=!0}function c(e){try{document.querySelector(e)}catch(e){return!1}return!0}var l=n(2),d=(n(7),n(16)),f=d.get("stores/directive"),p=n(79),g=(n(25),n(9),n(5).generate),h=n(100),_=n(39),v=(d.get("stores/rum"),{once:!1,onTimeout:null,timeout:null}),E={},m=function(e){(m=i())(e)};t.observeSelector=function(e,t,n){if(!c(e))throw new Error("observeSelector expects a valid css selector as its first argument");if(!l.isFunction(t))throw new Error("observeSelector expects a function as its second argument");if(n&&(!l.isObject(n)||l.isFunction(n)))throw new Error("observeSelector expects an object as its third argument");var i=g();return n=l.assign({},v,n||{}),E[i]={callback:t,callbackQueue:[],matchedCount:0,options:n,selector:e,startTime:Date.now()},m(i),_.setTimeout(l.bind(a,null,i),0),l.partial(r,i)}}),(function(e,t,n){function i(e){l[e]&&a.each(l[e].callbacks,(function(e){e.call(null)}))}function r(e,t){l[t]&&l[t].callbacks[e]&&(delete l[t].callbacks[e],a.some(l[t].callbacks)||(clearInterval(l[t].id),delete l[t]))}var a=n(2),o=(n(7),n(16)),s=(n(25),n(9),n(5).generate),u=n(39),c=n(101).DEFAULT_INTERVAL,l=(o.get("stores/rum"),{});t.poll=function(e,t){a.isNumber(t)||(t=c),l[t]||(l[t]={callbacks:{},id:u.setInterval(a.partial(i,t),t)});var n=s();return l[t].callbacks[n]=e,a.partial(r,n,t)},t.cancelAll=function(){a.each(l,(function(e,t){clearInterval(e.id),delete l[t]}))}}),(function(e,t){e.exports={DEFAULT_INTERVAL:20}}),(function(e,t,n){var i=n(12).Promise,r=n(99).observeSelector;t.waitForElement=function(e){return new i(function(t,n){r(e,t,{once:!0})})}}),(function(e,t,n){var i=n(12).Promise,r=n(100).poll;t.waitUntil=function(e){return new i(function(t,n){if(e())return void t();var i=r((function(){e()&&(i(),t())}))})}}),(function(e,t,n){var i=n(85);t.on=function(e){return e.publicOnly=!0,i.on(e)},t.off=i.off,t.emit=function(e){i.emit(e)}}),(function(e,t,n){function i(e){var t,n={};if(e)if(r(e))t=Number(e);else{if("object"!=typeof e)throw new Error("tracker","Revenue argument",e,"not a number.");if(n=a.extend({},e),"revenue"in n){if(!r(n["revenue"]))throw new Error("tracker","Revenue value",n["revenue"],"not a number.");t=Number(n["revenue"]),delete n["revenue"]}}return a.isUndefined(t)||(n.revenue=t),n}function r(e){return a.isNumber(e)||a.isString(e)&&Number(e)==e}var a=n(2),o=n(106);t.activateGeoDelayedExperiments=function(e,t){t||(t=e.lists?"odds":"cdn3"),o.dataFromSource({data:e,source:t})},t.activateSiteCatalyst=function(e){e&&e.sVariable&&o.integrationSettings({id:"adobe_analytics",settings:{sVariableReference:e.sVariable}})},t.bucketUser=t.bucketVisitor=function(e,t){if(e&&t){var n={experimentId:String(e)};t>256?n.variationId=String(t):n.variationIndex=String(t),o.bucketVisitor(n)}},t.disable=function(e){o.disable({scope:e})},t.log=function(e){a.isUndefined(e)&&(e=!0),o.log({level:e?"INFO":"OFF"})},t.optOut=function(e){a.isUndefined(e)&&(e=!0),o.optOut({isOptOut:e})},t.setCookieDomain=function(e){o.cookieDomain({cookieDomain:e})},t.setCookieExpiration=function(e){o.cookieExpiration({cookieExpirationDays:e})},t.setDimensionValue=function(e,t){var n={};n[e]=t,o.user({attributes:n})},t.setUserId=function(e){o.user({userId:e})},t.storeThirdPartyData=function(e,t){o.dataFromSource({source:e,data:t})},t.trackEvent=function(e,t){o.event({eventName:e,tags:i(t)})}}),(function(e,t,n){var i=n(2),r=n(7),a=n(90),o=n(91),s=n(107),u=n(25),c=n(108),l=n(115),d=n(6),f=n(75).create,p=n(24),g=n(116),h=n(85),_=n(9),v=n(26),E=n(23),m=n(119),I=n(120),y=n(73),S=n(83),T=n(16),A=T.get("stores/dimension_data"),b=T.get("stores/view_data"),w=T.get("stores/visitor_id"),D=T.get("stores/layer_data"),R=T.get("stores/directive"),O=86400,N=90,C=t.ApiListenerError=f("ApiListenerError");t.event=function(e){I.updateAllViewTags();var t=function(){var t=c.trackCustomEvent(e.eventName,e.tags);t?E.log("API / Tracking custom event:",e.eventName,e.tags):E.log("API / Not tracking custom event:",e.eventName)};w.getBucketingId()?t():_.dispatch(r.ADD_CLEANUP_FN,{lifecycle:u.Lifecycle.postActivate,cleanupFn:t})},t.page=function(e){var t=b.getByApiName(e.pageName);if(!t)throw new Error('Unknown page "'+e.pageName+'"');var n=!e.hasOwnProperty("isActive")||e.isActive,i=function(){n?I.activateViaAPI(t,e.tags):(I.deactivate(t),E.log("API / Deactivated Page",I.description(t)))};w.getBucketingId()?i():_.dispatch(r.ADD_CLEANUP_FN,{lifecycle:u.Lifecycle.postViewsActivated,cleanupFn:i})},t.tags=function(e){I.setGlobalTags(e.tags)},t.user=function(e){E.log("API / Setting visitor attributes:",e.attributes),i.each(e.attributes,(function(e,t){var n,i=t,a=A.getById(t)||A.getByApiName(t);a&&(i=a.id,n=a.segmentId||a.id);var o=function(){_.dispatch(r.SET_VISITOR_ATTRIBUTES,{attributes:[{key:["custom",i],value:{id:n,value:e},metadata:{lastModified:p.now()}}]})};w.getBucketingId()?o():_.dispatch(r.ADD_CLEANUP_FN,{lifecycle:u.Lifecycle.postVisitorProfileLoad,cleanupFn:o})}))},t.optOut=function(e){var t=!e.hasOwnProperty("isOptOut")||e.isOptOut;g.setOptOut(t)},t.cookieExpiration=function(e){var t=e.cookieExpirationDays;t 0&&(a=s[0]),s.length>1&&(o=s[1]),n.push([a,o])}return n},t.getQueryParamValue=function(e){for(var n=t.getQueryParams(),i=0;i ');var s=i.querySelector("#"+o);if(!s)throw new Error("Document.write failed to append script");s.onload=n,s.onerror=function(i){r.warn("Failed to load script ("+e+") synchronously:",i),t.addScriptAsync(e,n)}}catch(i){r.debug("Document.write failed for "+e+": "+i.message);var u=function(e){var t=new Function(e.responseText);t(),n&&n()};return a.request({url:e,async:!1,contentType:"text/plain",success:u})["catch"]((function(i){r.error("Failed to load "+e+" via synchronous XHR: "+i.message),t.addScriptAsync(e,n)}))}}}),(function(e,t,n){function i(){var e=null;w.isNumber(e)&&0===ve.getCount()?(Q.log("Activating after delay of",e,"ms because no Experiments are running"),K.dispatch(C.SET_RUM_DATA,{data:{activateDfd:!0}}),ue.setTimeout(L.emitActivateEvent,e)):L.emitActivateEvent()}function r(e){Re.handleError(e.data.error,e.data.metadata)}function a(){w.isArray(window.optimizely)&&(window.optimizely=w.filter(window.optimizely,(function(e){var t=!0;return!De.push(e,t)})))}function o(e){return w.each(e,(function(e,t){X.setItem(t,e)})),e}function s(){var e=he.getAccountId(),t="https://a526710254.cdn.optimizely.com".replace("__SUBDOMAIN__","a"+e+"."),n="/client_storage/a"+e+".html";ce.subscribe(w.bind(X.setItem,X));var i=ce.fetchAll().then((function(e){var t=we.getCanonicalOrigins();if(t){var n=ce.getXDomainUserId(e,t);n&&(Q.log("Syncing cross-origin visitor randomId:",n),se.maybePersistVisitorId({randomId:n}))}return e})).then(o),r=!!se.getCurrentId(),a=!!r&&se.hasSomeData();return r?a?Q.log("xd / Existing visitor; has data on this origin"):Q.log("xd / Existing visitor; new to this origin"):Q.log("xd / New visitor"),te.all([ce.load(t,n)["catch"]((function(e){throw Q.debug("xd / Failed to load iframe:",e),r&&!a&&u(!1,e),e})),i.then((function(e){if(se.loadForeignData(),r&&!a){var t=!w.isEmpty(e);Q.debug("xd / Loaded foreign data? ",t),u(t)}}),(function(e){throw r&&!a&&(Q.debug("xd / Failed to load foreign data:",e),u(!1,e)),e})).then((function(){Q.log("Loaded visitor data from foreign origins"),L.emitOriginsSyncedEvent()}),(function(e){Q.debug("xd / Ignored error syncing foreign data (expected if waitForOriginSync used:",e.message),Q.debug("xd / Enqueuing sync to happen after visitorId set."),K.dispatch(C.ADD_CLEANUP_FN,{lifecycle:z.Lifecycle.postVisitorProfileLoad,cleanupFn:L.emitOriginsSyncedEvent})}))])}function u(e,t){K.dispatch(C.SET_RUM_DATA,{data:{extras:{xdAttempt:e,xdError:t?t.toString():void 0}}})}function c(e){var t=ye.getVisitorProfile();return se.populateEagerVisitorData(e,t)}function l(e,t,n){e=e||[];var i=Ie.getAllPlugins(z.PluginTypes.visitorProfileProviders),r=he.getGlobalHoldbackThreshold(),a=ye.getVisitorProfile();se.populateLazyVisitorData(i,a);var o=Ae.getBucketingId();if(!o)throw new Error("bucketingId not set");var s,u=ye.getVisitorProfile();if(t){var c=be.getVariationIdMap();s=c[t.id]}var l={bucketingId:o,visitorProfile:u,audiences:e,globalHoldback:r,preferredVariationMap:s,layer:t};return t&&n&&U.isPageIdRelevant(t)?w.map(n,(function(e){return U.createTicket(w.extend({},l,{pageId:e}))})):[U.createTicket(l)]}function d(e){return{bucketingId:Ae.getBucketingId(),preferredLayerId:be.getPreferredLayerMap()[e.id]}}function f(e){var t=ve.getAllByPageIds(e),n=ge.getForceVariationIds(),i=ge.getForceAudienceIds(),r=w.reduce(t,(function(e,t){return t.groupId?e.groups[t.groupId]||(e.groups[t.groupId]=_e.get(t.groupId)):e.individual.push(t),e}),{groups:{},individual:[]});Q.log("Deciding Campaigns/Experiments for Page(s)",e);var a=w.map(r.groups,q.description).join(", ");Q.log("Groups:",a);var o=w.map(r.individual,W.description).join(", ");Q.log("Campaigns/Experiments not in Groups (by Campaign id):",o);var s=w.map(r.groups,w.partial(p,n,i,e))||[],u=w.map(r.individual,(function(t){var r=w.filter(t.pageIds,w.partial(w.includes,e));return g(n,i,r,t)})),c=s.concat(u);return te.all(c).then((function(t){var n=w.filter(t,(function(e){return!!e}));return Q.log("All Campaigns/Experiments for Page(s) (by Campaign id)",e,"resolved:",w.map(n,W.description).join(", ")),n}))}function p(e,n,i,r){try{var a=d(r),o=U.decideGroup(r,a);if(o.reason)return Q.debug("Not activating Group",q.description(r),"; reason:",o.reason),te.resolve();var s=ve.get(o.layerId);if(!s)return Q.debug("Visitor was bucketed into a Campaign ("+o.layerId+") which is not in this snippet"),te.resolve();var u=w.filter(s.pageIds,w.partial(w.includes,i));return w.isEmpty(u)?(Q.debug("Not activating Group",q.description(r),"; reason: visitor was bucketed into a Campaign/Experiment not related to the currently-activating Page(s)"),te.resolve()):t.decideAndExecuteLayerASAP(e,n,u,s)}catch(e){return Q.error("Error getting decision for Group",q.description(r),"; ",e),te.reject(e)}}function g(e,t,n,i){return new te(function(r,a){try{E(i,e,t,n,(function(a){w.each(a,(function(r){var a=r.pageId?[r.pageId]:n;Q.debug("Deciding layer: ",i,"with decisionTicket: ",r,"and actionViewIds: ",a),h(i,e,t,a,r)})),r(i)}))}catch(e){Q.error("Error getting decision for Campaign: "+W.description(i),e),a(e)}})}function h(e,t,n,i,r){var a=W.description(e);Q.log("Activating Campaign",a,"on Page(s)",i),n.length&&(Q.log("Applying force audienceIds:",n,"to Campaign",a),r=w.cloneDeep(r),r.audienceIds=n);var o=S(e,r,t),s=!(!t.length&&!n.length),u=A(e,o,s)||[],c=b(u,i);if(_(c,e,o,i),w.forEach(i,(function(){P.trackDecisionEvent(o,r)})),L.emitLayerDecided({layer:e,decisionTicket:r,decision:o}),o.error)throw o.error;return U.isInCohort(o)?void v(c,e,o,i):void Q.log("Not activating Campaign: "+W.description(e)+"; not in the cohort because:",o.reason)}function _(e,t,n,i){var r=W.description(t);Q.log("Preparing actions",e,"for Campaign",r,"on Page(s)",i),w.forEach(e,N.prepareAction)}function v(e,t,n,i){var r=W.description(t);return Q.log("Executing actions",e,"for Campaign",r,"on Page(s)",i),te.all(w.map(e,(function(e){return N.executePreparedAction(e).then(w.partial(L.emitActionAppliedEvent,e))}))).then((function(){Q.log("All page actions for",n,"applied:",e),L.emitActionsForDecisionAppliedEvent(n,e)}))["catch"]((function(e){Q.warn("Error evaluating page actions for decision",n,"because:",e)}))}function E(e,t,n,i,r){if(t.length||n.length)return void r(l([],void 0,i));var a=W.relatedAudienceIds(e),o=w.reduce(a,(function(e,t){var n=de.get(t);return n&&e.push(n),e}),[]);y(o,W.getActivationTimeout(e),(function(){var t=l(o,e,i);w.map(t,(function(t){m(t,o,e)})),r(t)}))}function m(e,t,n){var i=w.map(e.audienceIds,w.bind(de.get,de)),r=w.filter(t,(function(t){return!w.includes(e.audienceIds,t.id)}));Q.log("When deciding Campaign",W.description(n),"visitor is in audiences:",I(i),"and not in audiences:",I(r))}function I(e){var t=[];return w.each(e,(function(e){t.push(e.name,e)})),t}function y(e,t,n){var i=Ie.getAllPlugins(z.PluginTypes.audienceMatchers),r=w.reduce(e,(function(e,t){return w.extend(e,V.requiredAudienceFieldsForConditions(t.conditions,i))}),{}),a=w.reduce(r,(function(e,t){if(w.isUndefined(se.getAttribute(t))){var n=se.getPendingAttributeValue(t);w.isUndefined(n)||e.push(n)}return e}),[]);if(0===a.length)return n();var o=[].concat(e),s=ne.firstToResolve(w.map(a,(function(e){return te.resolve(e).then((function(){var e=ye.getVisitorProfile();if(o=w.filter(o,(function(t){return w.isUndefined(V.isInAudience(e,t,i))})),!w.isEmpty(o))throw new Error("At least one audience is still pending")}))})));te.race([s,new te(function(e,n){ue.setTimeout(n,t)})]).then((function(){Q.log("Activating Campaign after pending Audiences resolved",e),n()}),(function(){Q.log("Activating Campaign after timeout on Audiences",e),n()}))}function S(e,t,n){var i,r=W.description(e);return i=n.length?U.getDummyLayerDecision(e,n):U.decideLayer(e,t),Q.log("Recording decision for Campaign",r,t,"->",i),W.recordLayerDecision(e.id,t,i),i.variationId&&i.experimentId&&se.updateVariationIdMap(e.id,i.experimentId,i.variationId),e.groupId&&se.updatePreferredLayerMap(e.groupId,e.id),i}function T(e){var t=pe.getCleanupFns(e);if(t.length>0){for(;t.length>0;)t.shift()();K.dispatch(C.CLEAR_CLEANUP_FN,{lifecycle:e})}}function A(e,t,n){var i=W.description(e),r="NOT applying changes for Campaign";if(!n&&he.isGlobalHoldback())return Q.log(r,i,"(visitor is in global holdback)"),null;if(t.isLayerHoldback)return Q.log(r,i,"(visitor is in layer holdback)"),null;if(!t.experimentId||!t.variationId)return Q.log(r,i,"(visitor is not eligible for any Experiments)"),null;var a=[].concat(fe.getLayerActions(t.layerId)||[],fe.getExperimentActions(t.experimentId)||[],fe.getExperimentVariationActions(t.experimentId,t.variationId)||[]);return Q.log("Got Actions for Campaign:",i,a),a}function b(e,t){return w.filter(e,(function(e){return w.isUndefined(e.pageId)||w.includes(t,e.pageId)}))}var w=n(2),D=n(75).create,R=t.ActivationCodeError=D("ActivationCodeError"),O=t.ProjectJSError=D("ProjectJSError"),N=n(131),C=n(7),P=n(108),L=n(115),V=n(135),x=n(74),k=n(84),F=n(107),M=n(24),U=n(136),G=n(16),B=n(79),z=n(25),j=n(85),H=n(109),Y=n(141),K=n(9),q=n(140),W=n(111),X=n(80).LocalStorage,Q=n(23),$=n(142),J=n(82),Z=n(119),ee=n(86),te=n(12).Promise,ne=n(143),ie=n(112),re=n(114),ae=n(133),oe=n(120),se=n(73),ue=n(39),ce=n(83),G=n(16),le=G.get("stores/session"),de=G.get("stores/audience_data"),fe=G.get("stores/action_data"),pe=G.get("stores/cleanup"),ge=G.get("stores/directive"),he=G.get("stores/global"),_e=G.get("stores/group_data"),ve=G.get("stores/layer_data"),Ee=G.get("stores/layer"),me=G.get("stores/pending_events"),Ie=G.get("stores/plugins"),ye=G.get("stores/visitor"),Se=G.get("stores/view_data"),Te=G.get("stores/view"),Ae=G.get("stores/visitor_id"),be=G.get("stores/visitor_bucketing"),we=G.get("stores/xdomain"),De=n(90),Re=n(144),Oe=1e3,Ne=!1,Ce=1e3,Pe=t;t.initialize=function(e){var n=e.clientData;if(F.normalizeClientData(e.clientData),j.on({filter:{type:"error"},handler:r}),K.dispatch(C.DATA_LOADED,{data:n}),Q.log("Initialized with DATA:",n),a(),ge.isDisabled()||ge.shouldOptOut())return void Q.log("Controller / Is disabled");B.isReady()?K.dispatch(C.SET_DOMCONTENTLOADED):B.addReadyHandler((function(){K.dispatch(C.SET_DOMCONTENTLOADED)}));var o=!1,s=x.get(z.COOKIES.REDIRECT);if(s){var u=s.match(/^(\d+)\|(.*)/);if(u){Q.debug("Found legacy redirect data:",s);var c=u[1],l=u[2];K.dispatch(C.INITIALIZE_STATE,{effectiveVariationId:c,effectiveReferrer:l}),o=!0}}J.time("projectJS");var d=he.getProjectJS();if(w.isFunction(d))try{Y.apply(d)}catch(e){Q.error("Error while executing projectJS: ",e),k.emitError(new O(e))}J.timeEnd("projectJS"),w.each(e.plugins||[],(function(e){try{e(Z)}catch(e){k.emitInternalError(e)}})),w.each(he.getPlugins()||[],(function(e){try{Y.apply(e,[Z])}catch(e){k.emitError(e)}})),o||ie.load();var f=j.on({filter:{type:"lifecycle",name:"activated"},handler:function(){ye.observe(se.persistVisitorProfile),Ee.observe(se.persistLayerStates),le.observe(se.persistSessionState),me.observe($.persistPendingEvents),be.observe(se.persistVisitorBucketingStore),j.off(f)}});j.on({filter:{type:"lifecycle",name:"viewsActivated"},handler:t.onViewsActivated}),j.on({filter:{type:"lifecycle",name:"pageDeactivated"},handler:t.onPageDeactivated}),t.initializeApi();var p=$.getPendingEvents();if(p&&(K.dispatch(C.LOAD_PENDING_EVENTS,{events:p}),$.retryPendingEvents(p)),j.on({filter:{type:"lifecycle",name:"activate"},handler:t.activate}),L.emitInitializedEvent(),!ge.shouldActivate())return te.resolve();var g=[];if(we.isDisabled())i();else{var h=t.initializeXDomainStorage();if(g.push(h),we.getCanonicalOrigins()){var _=re.makeTimeoutPromise(Ce);te.race([h,_])["catch"]((function(e){Q.error("Failed to initialize xDomain storage: ",e)})).then(i)["catch"](Re.handleError)}else i()}return te.all(g)},t.activate=function(){try{var e=[];Q.log("Activated client"),w.forEach(Te.getActiveViewStates(),(function(e){oe.deactivate(Se.get(e.id))})),T(z.Lifecycle.preActivate);var t=M.now();K.dispatch(C.ACTIVATE,{activationId:String(t),activationTimestamp:t});var n=Se.getAll();oe.registerViews(n),se.setId(se.getIdFromCookies()),e.push(P.trackPostRedirectDecisionEvent()),K.dispatch(C.MERGE_VARIATION_ID_MAP,{variationIdMap:se.getVariationIdMap()}),K.dispatch(C.MERGE_PREFERRED_LAYER_MAP,{preferredLayerMap:se.getPreferredLayerMap()}),T(z.Lifecycle.postVisitorProfileLoad),e.push(c(Ie.getAllPlugins(z.PluginTypes.visitorProfileProviders)).then((function(){Q.log("Populated visitor profile")})));var i=l(),r=U.decideGlobal(i);Q.log("Made global decision",i,"->",r),K.dispatch(C.RECORD_GLOBAL_DECISION,r);var a=P.trackClientActivation();a?Q.log("Tracked activation event",a):Q.log("Not tracking activation event");var o=Pe.setUpViewActivation(n);return Ne?oe.activateMultiple(o):w.each(o,(function(e){oe.activateMultiple([e])})),T(z.Lifecycle.postViewsActivated),T(z.Lifecycle.postActivate),L.emitActivatedEvent(),te.all(e).then((function(){j.emit({type:H.TYPES.LIFECYCLE,name:"activateDeferredDone"}),Q.log("All immediate effects of activation resolved")}),k.emitError)}catch(e){return k.emitError(e),te.reject(e)}},Pe.setUpViewActivation=function(e){var t=[];return w.each(e,(function(e){oe.shouldTriggerImmediately(e.activationType)?t.push(e):e.activationType===z.ViewActivationTypes.callback?(Q.debug("Setting up conditional activation for Page",oe.description(e)),Pe.activateViewOnCallback(e)):e.activationType===z.ViewActivationTypes.polling?(Q.debug("Setting up polling activation for Page",oe.description(e)),ee.pollFor(w.partial(Y.apply,e.activationCode),null,w.partial(ae.isTimedOut,M.now())).then((function(){oe.activateMultiple([e])}))["catch"]((function(t){Q.warn("Failed to activate view ",e,t)}))):e.activationType!==z.ViewActivationTypes.manual&&k.emitError(new Error("Unknown view activationType: "+e.activationType))})),t},Pe.activateViewOnCallback=function(e){var t=function(t){var n=w.extend({},t,{pageName:e.apiName,type:"page"});De.push(n)},n={pageId:e.id};Object.defineProperty(n,"isActive",{get:function(){return Te.isViewActive(e.id)}});try{Y.apply(e.activationCode,[t,n])}catch(t){var i=new R("("+t.toString()+") in activationCode for "+oe.description(e));k.emitError(i,{originalError:t,userError:!0})}},t.onViewsActivated=function(e){var t,n=e.data.views,i=w.map(n,"id");try{if(!Ae.getBucketingId())throw new Error("View activated with no visitorId set");var r=f(i)["catch"](k.emitError);return t=te.all(w.map(n,(function(e){var t=function(){oe.parseViewTags(e);var t=P.trackViewActivation(e);t?Q.log("Tracked activation for Page",oe.description(e),t):Q.log("Not Tracking activation for Page",oe.description(e))};return B.isReady()?te.resolve(t()):ee.pollFor(B.isReady,Oe).then(t)}))),te.all([r,t])}catch(e){k.emitError(e)}},t.onPageDeactivated=function(e){var t=e.data.page,n=fe.getAllActionIdsByPageId(t.id);w.each(n,(function(e){var n=fe.getActionState(e);n&&(w.each(n,(function(e,n){if(e.cancel)try{e.cancel(),Q.debug("Controller / Canceled change",n,"observation due to deactivation of page:",t)}catch(e){Q.error("Controller / Error canceling change",n,"observation upon deactivation of page.",e)}if(t.undoOnDeactivation&&e.undo)try{e.undo(),Q.debug("Controller / Undid change",n,"due to deactivation of page:",t)}catch(e){Q.error("Controller / Error undoing change upon deactivation of page.",e)}})),K.dispatch(C.REMOVE_ACTION_STATE,{actionId:e}),Q.debug("Controller / Undid changes and/or canceled change observation due to deactivation of page:",t,e))}))},t.initializeApi=function(){var e={get:De.get,push:De.push},t=window.optimizely;w.isArray(t)&&w.each(t,(function(t){e.push(t)})),e.data={note:"Obsolete, use optimizely.get('data') instead"},e.state={},window.optimizely=e},t.initializeXDomainStorage=s,t.decideAndExecuteLayerASAP=g}),(function(e,t,n){function i(e,t,n){var i=v.getActionState(t.id);if(!i)return void p.warn("Action / Attempted to prepare change for inactive action: ",t);var r=v.getChangeApplier(e.id,t.id);if(!a.isUndefined(r))return void p.warn("Action / Attempted to prepare a change which is already being applied: ",e);var s={changeId:e.id,actionId:t.id,changeApplier:I.create(e,t,n)};f.dispatch(o.SET_CHANGE_APPLIER,s)}function r(e,t,n,o){if(a.includes(o,t))return void p.error("Change with id "+t+" has circular dependencies: "+o.concat(t));if(!e[t]){var c=E.getChange(t);if(!c){var d="Change with id "+t+" is absent";return o.length&&(d+=" but listed as a dependency for "+o[o.length-1]),void p.warn(d)}e[t]=new g(function(d){var f=a.map(c.dependencies||[],(function(i){return r(e,i,n,o.concat([t]))}));if(c.src){var _="change_"+c.src,m=u.makeAsyncRequest(_,(function(){return h.addScriptAsync("https://cdn.optimizely.com/public/526710254/data"+c.src,(function(){u.resolveRequest(_)}))})).then((function(){var e=E.getChange(c.id);e||s.emitError(new S("Failed to load async change from src: "+c.src)),i(e,n,l.now())}));f.push(m)}g.all(f).then((function(){var e=l.now(),i=v.getChangeApplier(t,n.id);return i?(p.debug("Action / Applying change:",c),i.apply().then((function(t){t?p.log(t):p.debug("Action / Applied change for the first time in "+(l.now()-e)+"ms:",c),d()}))):(p.debug("Action / Not applying change ",t," - No changeApplier found."),void d())}))["catch"]((function(e){p.error("Action / Failed to apply change:",c,e),d()}))})}return e[t]}var a=n(2),o=n(7),s=n(84),u=n(6),c=n(75).create,l=n(24),d=n(16),f=n(9),p=n(23),g=n(12).Promise,h=n(129),_=d.get("stores/global"),v=d.get("stores/action_data"),E=d.get("stores/change_data"),m=d.get("stores/session"),I=n(132),y=n(133);y.initialize();var S=c("ActionError");t.prepareAction=function(e){p.debug("Action / Preparing:",e),f.dispatch(o.ACTION_EXECUTED,{actionId:e.id,sessionId:m.getSessionId(),layerId:e.layerId,pageId:e.pageId,timestamp:l.now(),activationId:_.getActivationId()});var t=l.now();a.forEach(e.changeSet,(function(n){var r=a.isObject(n)?n.id:n,s=E.getChange(r);s||(f.dispatch(o.ADD_CHANGE,n),s=E.getChange(n.id)),s.src||i(s,e,t)}))},t.executePreparedAction=function(e){p.debug("Action / Executing:",e);var t={},n=a.map(e.changeSet,(function(n){var i=a.isObject(n)?n.id:n;return r(t,i,e,[])}));return g.all(n).then((function(){p.debug("changes for action id="+e.id+" applied")}))}}),(function(e,t,n){var i=n(13).Promise,r=n(24),a=n(16),o=a.get("stores/plugins"),s=n(25),u=n(23);t.create=function(e,t,n){var a={identifier:e.id,action:t,startTime:n||r.now()};try{var c=o.getPlugin(s.PluginTypes.changeAppliers,e.type);if(!c)throw new Error("Unrecognized change type "+e.type);return new c(e,a)}catch(e){u.error("Change applier was never properly constructed:",e);var l={apply:function(){return i.reject(e)}};return l}}}),(function(e,t,n){function i(){"interactive"!==document.readyState&&"complete"!==document.readyState||(t.domReadyTime=Date.now())}var r=n(134),a=n(16).get("stores/directive");t.domReadyTime=null,t.initialize=function(){i(),document.addEventListener("readystatechange",i,!0)},t.isTimedOut=function(e){var n=Date.now();if(!t.domReadyTime||!e)return!1;var i=Math.max(e,t.domReadyTime);return a.isEditor()&&(i=t.domReadyTime),!(n-i -1)return{experimentId:e.experiments[n].id,variationId:e.experiments[n].variations[i].id};return null}function a(e){var t=m.getPlugin(g.PluginTypes.deciders,e);if(s.isEmpty(t))throw new Error("No deciders found for policy: "+e);return t}function o(e,t){var n=m.getAllPlugins(g.PluginTypes.audienceMatchers);return s.reduce(t,(function(t,i){return c.isInAudience(e,i,n)&&t.push(i.id),t}),[])}var s=n(2),u=n(84),c=n(135),l=n(137),d=n(138),f=n(139).DecisionError,p=n(16),g=n(25),h=n(140),_=n(111),v=n(23),E=n(43),m=p.get("stores/plugins"),I=p.get("stores/global"),y=p.get("stores/layer_data");t.isPageIdRelevant=function(e){if(!e)return!1;var t=a(e.policy);return s.isFunction(t.includePageIdInDecisionTicket)?t.includePageIdInDecisionTicket(e):t.includePageIdInDecisionTicket===!0},t.createTicket=function(e){var t=s.pick(e,["bucketingId","globalHoldback","preferredVariationMap","pageId"]);return s.extend(t,{audienceIds:o(e.visitorProfile,e.audiences),activationId:I.getActivationId()}),t},t.decideGlobal=function(e){var t=l.isHoldback(e.bucketingId,{id:null,holdback:e.globalHoldback});return{isGlobalHoldback:t}},t.decideGroup=i,t.decideLayer=function(e,t){v.debug("Deciding: ",e,t);var n,i,r=a(e.policy),o={layerId:e.id,experimentId:null,variationId:null,isLayerHoldback:l.isHoldback(t.bucketingId,e)};if(s.isEmpty(e.experiments))throw new f("No experiments in layer.");try{if(r.decideLayer){v.debug("Decision / Using decider's custom decideLayer.");var c=r.decideLayer(e,t);n=c.experiment,i=c.variation}else v.debug("Decision / Using default decideLayer behavior."),n=r.selectExperiment(e,t.audienceIds,t.bucketingId),i=d.selectVariation(n,t.audienceIds,t.bucketingId,t.activationId,t.preferredVariationMap)}catch(e){e instanceof f?o.reason=e.message:o.error=e}return o.experimentId=n?n.id:null,o.variationId=i?i.id:null,o.error&&(o.error.name="DecisionEngineError",u.emitError(o.error)),o},t.getDummyLayerDecision=function(e,t){var n,i=r(e,t);return i?(v.log("Decision / Applying force variation:",i.variationId,"to Campaign",_.description(e)),n={layerId:e.id,variationId:i.variationId,experimentId:i.experimentId,isLayerHoldback:!1,reason:"force"}):(v.log("No variation matches ids:",t,"in Campaign",_.description(e)),n={layerId:e.id,variationId:null,experimentId:null,isLayerHoldback:!1,reason:"force"}),n},t.isInCohort=function(e){if(!e.experimentId||!e.variationId)return!1;var t=y.get(e.layerId);return!(E.isSingleExperimentPolicy(t.policy)&&e.isLayerHoldback)}}),(function(e,t,n){var i=n(63),r=t.TOTAL_POINTS=1e4;t.bucketingNumber=function(e,t,n){var a=i.hashToInt(e+t,n,r);return a},t.isHoldback=function(e,n){return t.bucketingNumber(e,n.id,i.Seed.IGNORING)<(n.holdback||0)},t.chooseWeightedCandidate=function(e,n,r){for(var a=t.bucketingNumber(e,n,i.Seed.BUCKETING),o=0;o a)return r[o].entityId;throw new Error("Unable to choose candidate")}}),(function(e,t,n){var i=n(2),r=n(137),a=n(121),o=n(139).DecisionError,s=n(23),u="impression";t.isValidExperiment=function(e,t){var n,r=i.partial(i.includes,e);return s.groupCollapsed("Decision / Evaluating audiences for experiment:",t,e),n=!t.audienceIds||a.evaluate(t.audienceIds,r),s.groupEnd(),s.debug("Decision / Experiment",t,"is valid?",n),n},t.selectVariation=function(e,t,n,a,c){if(!e.variations||0===e.variations.length)throw new o('No variations in selected experiment "'+e.id+'"');if(!e.weightDistributions&&e.variations.length>1)throw new o('On selected experiment "'+e.id+'", weightDistributions must be defined if # variations > 1');var l;if(e.bucketingStrategy&&e.bucketingStrategy===u)if(1===e.variations.length)l=e.variations[0].id;else{var d=a;l=r.chooseWeightedCandidate(n+d,e.id,e.weightDistributions)}else if(c&&c[e.id]){s.debug("Decision / Using preferredVariationMap to select variation for experiment:",e.id);var f=c[e.id];if(!i.find(e.variations,{id:f}))return s.debug("Decision / Preferred variation:",f,"not found on experiment:",e.id,". Visitor not bucketed."),null;l=f}else l=1===e.variations.length?e.variations[0].id:r.chooseWeightedCandidate(n,e.id,e.weightDistributions);var p=i.find(e.variations,{id:l});if(p)return s.debug("Decision / Selected variation:",p),p;throw new o('Unable to find selected variation: "'+l+'".')},t.getExperimentById=function(e,t){var n=i.find(e.experiments,{id:t});if(n)return n;throw new o("Unable to find selected experiment.")},t.hasVariationActionsOnView=function(e,t){return s.debug("Decision / Checking variation:",e,"for actions on pageId:",t),!!i.find(e.actions,(function(e){return e.pageId===t&&!i.isEmpty(e.changes)}))}}),(function(e,t){function n(e){this.message=e}n.prototype=new Error,t.DecisionError=n}),(function(e,t,n){function i(e){return r.map(e.weightDistributions,"entityId")}var r=n(2);t.description=function(e){var t=!!e.name,n=t?'"'+e.name+'" ':"",r=i(e).join(", ");return n+"(id "+e.id+", campaigns: "+r+")"}}),(function(module,exports,__webpack_require__){var createError=__webpack_require__(76),di=__webpack_require__(16),Logger=__webpack_require__(23),CSP_MODE=!1,EXEC_WITH_JQUERY=!0,ExecError=exports.Error=createError("ExecError");exports.apply=function(e,t){t=t||[],EXEC_WITH_JQUERY&&(t=t.concat(di.get("env/jquery")));try{return e.apply(void 0,t)}catch(n){throw Logger.warn("Error applying function",e,"with args:",t,n),new ExecError(n)}},exports.eval=function(str){if(CSP_MODE)throw new ExecError("eval is not supported in CSP mode");try{return EXEC_WITH_JQUERY&&(str="var $ = optimizely.get('jquery');"+str),eval(str)}catch(e){throw Logger.warn("Error executing JS:",str,e),new ExecError(e)}}}),(function(e,t,n){var i=n(2),r=n(84),a=n(25),o=n(26),s=n(80).LocalStorage,u=n(23),c=n(88),l=n(16),d=l.get("stores/pending_events"),f=a.StorageKeys.PENDING_EVENTS;t.persistPendingEvents=function(){try{var e=d.getEventsString();s.setItem(f,e),n(83).setItem(f,e)}catch(e){u.warn("PendingEvents / Unable to set localStorage key, error was: ",e),r.emitInternalError(e)}},t.getPendingEvents=function(){try{return o.parse(s.getItem(f))}catch(e){return null}},t.retryPendingEvents=function(e){i.forOwn(e,(function(e,t){c.retryableRequest(e.data,t,e.retryCount)})),i.isEmpty(e)||u.log("Retried pending events: ",e)}}),(function(e,t,n){var i=n(2),r=n(12).Promise;t.firstToResolve=function(e){return new r(function(t){i.each(e,(function(e){r.resolve(e).then(t,(function(){}))}))})}}),(function(e,t,n){var i=n(2),r=n(92),a=n(75).BaseError,o=n(24),s=n(16),u=n(79),c=n(23),l=n(39),d=n(88),f=s.get("stores/global"),p="https://errors.client.optimizely.com";t.handleError=function(e,t){function n(){return d.request({url:p+"/log",method:"POST",data:_,contentType:"application/json"}).then((function(e){c.log("Error Monitor / Logged error with response: ",e)}),(function(e){c.error("Failed to log error, response was: ",e)}))}var s=e.name||"Error",g=e.message,h=e.stack||null;e instanceof a&&(g instanceof Error?(g=g.message,h=e.message.stack):h=null);var _={timestamp:o.now(),clientEngine:r.ENGINE,clientVersion:r.VERSION,accountId:f.getAccountId(),projectId:f.getProjectId(),errorClass:s,message:g,stacktrace:h},v=i.map(f.getExperimental(),(function(e,t){return{key:"exp_"+t,value:String(e)}}));t&&i.forEach(t,(function(e,t){i.isObject(e)||v.push({key:t,value:String(e)})}),[]),i.isEmpty(v)||(_.metadata=v),c.error("Logging error",_),u.isLoaded()?n():l.addEventListener("load",n)}}),(function(e,t,n){function i(e){var t=!1;if(a.isArray(window.optimizely)&&a.each(window.optimizely,(function(n){a.isArray(n)&&"verifyPreviewProject"===n[0]&&String(n[1])===e&&(t=!0)})),!t)throw new Error("Preview projectId: "+e+" does not match expected")}function r(){s.on({filter:{type:u.TYPES.ANALYTICS,name:"trackEvent"},handler:f}),s.on({filter:{type:u.TYPES.LIFECYCLE,name:"viewActivated"},handler:f}),s.on({filter:{type:u.TYPES.LIFECYCLE,name:"layerDecided"},handler:f}),s.on({filter:{type:"error"},publicOnly:!0,handler:f})}var a=n(2),o=n(16),s=n(85),u=n(109),c=n(39),l=o.get("stores/directive"),d="optimizelyPreview",f=function(e){var t=c.getGlobal(d);t.push(e)};t.initialize=function(e){l.isSlave()&&i(e),r()},t.setupPreviewGlobal=function(){c.getGlobal(d)||c.setGlobal(d,[])},t.pushToPreviewGlobal=function(e){f(e)}}),(function(e,t,n){e.exports=function(e){e.registerVisitorProfileProvider(n(147))}}),(function(e,t){e.exports={provides:"visitorId",getter:["stores/visitor_id",function(e){return e.getRandomId()}]}}),(function(e,t,n){e.exports=function(e){e.registerVisitorProfileProvider(n(149)),e.registerAudienceMatcher("behavior",n(151))}}),(function(e,t,n){var i=n(150);e.exports={provides:"events",isTransient:!0,getter:[function(){return i.getEvents()}]}}),(function(e,t,n){var i=n(2),r=n(71),a=n(16),o=a.get("stores/visitor_events"),s=1e3;t.getEvents=function(){var e=r.getEvents(),t=[].concat.apply([],i.values(o.getForeignEvents())),n=[].concat.apply([],i.values(o.getForeignEventQueues())),a=r.mergeAllEvents([e,t,n]);return a.slice(a.length-s)}}),(function(e,t,n){var i=n(2),r=n(26),a=n(152),o=n(153);e.exports={fieldsNeeded:["events"],match:function(e,t){var n=[],s=r.parse(t.value);return n=i.isUndefined(s.version)?[s]:a.buildFromSpecV0_1(s),i.every(n,(function(t){return o.isSatisfied(t,e.events)}))}}}),(function(e,t,n){function i(e){return e=(e||"").toString().trim(),p[e]||e}function r(e,t,n){var i={where:t};if(e.count&&(i["limit"]=e.count),e.modifier===s.FREQUENCY_FILTERS.MOST_FREQUENT){var r=s.getFieldKeyPathForSource(e.name,n),a=s.aggregate("count"),o=s.aggregateField("count"),l=s.groupField(r);return u.extend(i,{select:[{field:l}],groupBy:s.groupBy([r]),aggregate:[a],orderBy:[{field:o,direction:"DESC"}]})}return u.extend(i,{orderBy:[{field:[c.FIELDS.TIME],direction:"DESC"}]})}function a(e){var t=[];if(u.isUndefined(e))throw new Error("rule is undefined");if(!u.isObject(e))throw new Error("rule is not an Object");"0.2"!==e["version"]&&t.push('version: not "0.2"'),e["filter"]&&(u.isArray(e["filter"])?u.each(e["filter"],(function(e,n){var i=s.validateFieldKeyPathV0_2(e["field"],s.FieldPurpose.FILTER);i&&t.push("filter["+n+"]: "+i);var r=s.validateComparatorAndValue(e["comparator"],e["value"]);r&&t.push("filter["+n+"]: "+r)})):t.push("filter: not an array"));var n=[],i=[];if(e["sort"]&&(e["reduce"]&&e["reduce"]["aggregator"]&&"nth"!==e["reduce"]["aggregator"]&&t.push("sort: superfluous because we can apply aggregator "+l.stringify(e["reduce"]["aggregator"])+" to unsorted items"),u.isArray(e["sort"])?u.each(e["sort"],(function(e,r){var a=s.validateFieldKeyPathV0_2(e["field"],s.FieldPurpose.SORT);a&&t.push("sort["+r+"]: "+a),e["field"]&&"frequency"===e["field"][0]?n.push(e):i.push(e);var u=o(e["direction"]);u&&t.push("sort["+r+"]: "+u)})):t.push("sort: not an array"),n.length&&i.length&&t.push('sort: sorting by non-["frequency"] field is pointless because we are going to sort the picked values by ["frequency"]'),n.length&&!e["pick"]&&t.push('sort: sorting by ["frequency"] is impossible because no values have been picked')),e["pick"]){e["reduce"]&&"count"===e["reduce"]["aggregator"]&&t.push('pick: superfluous because we can apply aggregator "count" to raw events');var r=s.validateFieldKeyPathV0_2(e["pick"]["field"]);r&&t.push("pick: "+r)}if(e["reduce"]){var a=e["reduce"]["aggregator"],c="aggregator "+(l.stringify(a)||String(a)),d=e["reduce"]["n"],f="index "+(l.stringify(d)||String(d));u.includes(["sum","avg","max","min","count","nth"],a)||t.push("reduce: "+c+" is unknown"),u.includes(["sum","avg","max","min"],a)&&(e["pick"]||t.push("reduce: "+c+" is impossible to use because no values have been picked")),"nth"===a?((!u.isNumber(d)||isNaN(d)||parseInt(d,10)!==d||d<0)&&t.push("reduce: "+f+" is not a non-negative integer (mandated by "+c+")"),e["sort"]||t.push('reduce: aggregator "nth" is meaningless without a specific sort order')):u.isUndefined(d)||t.push("reduce: "+f+" is defined (not mandated by "+c+")")}if(t.length)throw new Error(t.join("\n"))}function o(e){var t="direction "+(l.stringify(e)||String(e));if(!u.includes(["ascending","descending"],e))return t+' is not "ascending" or "descending"'}var s=t,u=n(2),c={FIELDS:n(62).FIELDS,FIELDS_V0_2:n(62).FIELDS_V0_2},l=n(26),d=n(23),f=n(153);s.MILLIS_IN_A_DAY=864e5,s.aggregateField=function(e,t){return u.isString(t)&&(t=[t]),t=t||f.DEFAULT_FIELD,[f.generateAlias(e,t)]},s.groupField=function(e){return u.isString(e)&&(e=[e]),e=e||f.DEFAULT_FIELD,[e.join(".")]};var p={"<":"lt","<=":"lte",">":"gt",">=":"gte","=":"eq","==":"eq"};s.fieldComparison=function(e,t,n){return e=i(e),u.isString(t)&&(t=[t]),"exists"===e?{op:e,args:[{field:t}]}:{op:e,args:[{field:t},{value:n}]}},s.relativeTimeComparison=function(e,t){return{op:i(e),args:[{op:"-",args:[{eval:"now"},{field:[c.FIELDS.TIME]}]},{value:t*s.MILLIS_IN_A_DAY}]}},s.rangeTimeComparison=function(e){return u.isArray(e)?{op:"between",args:[{field:[c.FIELDS.TIME]},{value:[e[0]||+new Date(0),e[1]||+new Date]}]}:(d.error("Rule builder","rangeTimeComparison passed invalid range",e),null)},s.groupBy=function(e){for(var t=[],n=0;n 0)throw new Error('A "pick" clause must not be specified with "count" or "most_recent", "most_frequent" modifiers'+l.stringify(e));return[r(e.pick,t,e.source)]}return n.length>0?n:[{where:t}]},s.buildFromSpecV0_2=function(e){a(e);var t={where:{op:"and",args:u.map(e["filter"]||[],(function(e){return"age"===e["field"][0]?s.relativeTimeComparison(e["comparator"]||"eq",e["value"]/s.MILLIS_IN_A_DAY):s.fieldComparison(e["comparator"]||"eq",s.convertFieldKeyPathFromSpecV0_2(e["field"]),e["value"])}))}};if(e["reduce"]&&"count"===e["reduce"]["aggregator"])return u.extend(t,{aggregate:[{op:"count",args:[{field:["*"]}]}],select:[{field:["_count_*"]}]});var n=[],i=[];if(e["sort"]&&(u.each(e["sort"],(function(e){u.includes(["ascending","descending"],e["direction"])&&(u.includes(["time","age"],e["field"][0])&&i.push(e),"frequency"===e["field"][0]&&n.push(e))})),i.length&&!n.length&&(t["orderBy"]=u.filter(u.map(i,(function(e){return"time"===e["field"][0]?{field:s.convertFieldKeyPathFromSpecV0_2(["time"]),direction:"ascending"===e["direction"]?"ASC":"DESC"}:"age"===e["field"][0]?{field:s.convertFieldKeyPathFromSpecV0_2(["time"]),direction:"ascending"===e["direction"]?"DESC":"ASC"}:void 0}))))),e["pick"]&&e["pick"]["field"]){var r=s.convertFieldKeyPathFromSpecV0_2(e["pick"]["field"]);if(e["reduce"]&&u.includes(["avg","max","min","sum"],e["reduce"]["aggregator"]))return u.extend(t,{aggregate:[{op:e["reduce"]["aggregator"],args:[{field:r}]}],select:[{field:[f.generateAlias(e["reduce"]["aggregator"],r)]}]});t=n.length?u.extend(t,{groupBy:[{field:r}],aggregate:[{op:"count",args:[{field:["*"]}]}],orderBy:[{field:["_count_*"],direction:"ascending"===n[0]["direction"]?"ASC":"DESC"}],select:[{field:[r.join(".")]}]}):u.extend(t,{select:[{field:r}]})}if(e["reduce"]&&"nth"===e["reduce"]["aggregator"]){var o=e["reduce"]["n"];if(u.isNumber(o)&&o>=0&&Number(o)===Math.floor(Number(o)))return u.extend(t,{offset:o,limit:1})}return t},s.convertFieldKeyPathFromSpecV0_2=function(e){return"tags"===e[0]&&"revenue"===e[1]?["r"]:[c.FIELDS_V0_2[e[0]]].concat(e.slice(1))},s.FieldPurpose={FILTER:"filter",SORT:"sort",PICK:"pick"},s.validateFieldKeyPathV0_2=function(e,t){var n="field "+(l.stringify(e)||String(e));if(!u.isArray(e)||!u.every(e,u.isString))return n+" is not an array of strings";if("tags"===e[0]&&e.length>2||"tags"!==e[0]&&e.length>1)return n+" includes too many strings";if("tags"===e[0]&&e.length<2)return n+" does not specify an exact tag";if(e.length<1)return n+" does not specify a top-level field";var i=u.keys(c.FIELDS_V0_2),r=["age","frequency"];return t===s.FieldPurpose.FILTER&&(i.push("age"),r=["frequency"]),t===s.FieldPurpose.SORT&&(i=["time","age","frequency"],r=["name","type","category","tags"]),u.includes(r,e[0])?n+" is not supported here":u.includes(i,e[0])?void 0:n+" is unknown"},s.validateComparatorAndValue=function(e,t){var n="comparator "+(l.stringify(e)||String(e)),i="value "+(l.stringify(t)||String(t));if(!u.isString(e)&&!u.isUndefined(e))return n+" is not a string";switch(e){case void 0:case"eq":case"is":case"contains":break;case"lt":case"gt":case"lte":case"gte":if(!u.isNumber(t))return i+" is not a number (mandated by "+n+")";break;case"in":if(!u.isArray(t))return i+" is not an array (mandated by "+n+")";break;case"between":if(!(u.isArray(t)&&2===t.length&&u.isNumber(t[0])&&u.isNumber(t[1])&&t[0]<=t[1]))return i+" is not a pair of increasing numbers (mandated by "+n+")";break;case"regex":if(!(u.isString(t)||u.isArray(t)&&2===t.length&&u.isString(t[0])&&u.isString(t[1])))return i+" is not a pattern string or a [pattern string, flags string] array (mandated by "+n+")";break;case"exists":if(!u.isUndefined(t))return i+" is not undefined (mandated by "+n+")";break;default:return n+" is unknown"}}}),(function(e,t,n){var i=n(2),r=n(25),a=n(23),o=i.bind(a.log,a),s=n(24),u=n(19).getFieldValue,c=n(26),l=function(e,t,n){if(e.getValueOrDefault)return e.getValueOrDefault(t,n);if(!i.isArray(t))return n;var r=u(e,t);return"undefined"==typeof r&&(r=n),r},d=function(e){return"string"==typeof e?e.trim().toLowerCase():e};t.clause={WHERE:"where",GROUP_BY:"groupBy",AGGREGATE:"aggregate",HAVING:"having",ORDER_BY:"orderBy",SELECT:"select",OFFSET:"offset",LIMIT:"limit",FROM:"from"},t.DEFAULT_FIELD=["*"],t.booleanOperators={eq:function(e){var t=i.map(e,d);return t[0]==t[1]},is:function(e){return e[0]===e[1]},gt:function(e){return e[0]>e[1]},lt:function(e){return e[0] =e[1]},lte:function(e){return e[0]<=e[1]},"in":function(e){var t=i.map(e[1]||[],d);return i.includes(t,d(e[0]))},between:function(e){return e[1][0]<=e[0]&&e[0]<=e[1][1]},contains:function(e){var t=i.map(e,(function(e){return"string"==typeof e?e.toLowerCase():e}));return(t[0]||"").indexOf(t[1])!==-1},regex:function(e){try{var t,n;return i.isString(e[1])?(t=e[1],n="i"):(t=e[1][0]||"",n=e[1][1]||""),new RegExp(t,n).test(e[0])}catch(e){return a.error("Rules",'In operator "regex", error: '+(e.message||"invalid RegExp /"+[t,n].join("/"))),!1}},exists:function(e){return"undefined"!=typeof e[0]},and:function(e){return i.every(e,(function(e){return e}))},or:function(e){return i.some(e,(function(e){return e}))},not:function(e){return!e[0]}},t.arithmeticOperators={"+":function(e){return(e[0]||0)+(e[1]||0)},"-":function(e){return(e[0]||0)-(e[1]||0)},"/":function(e){return(e[0]||0)/(e[1]||1)},"%":function(e){return(e[0]||0)%(e[1]||1)}},t.aggregateOperators={sum:function(e,n){for(var i=e[0]||t.DEFAULT_FIELD,r=0,a=0;a c)return o}return 0})):(o("Rules","groupBy rule must be an array"),t)};t.rewrite=function(e){function n(e,s){if(i.isArray(e)&&("and"!==e[0]&&"or"!==e[0]&&"not"!==e[0]&&a.error("Rules","Unexpected operation "+e[0]+". Continuing optimistically."),e={op:e[0],args:e.slice(1)}),e.hasOwnProperty("field")||e.hasOwnProperty("value")||e.hasOwnProperty("eval"))return e;if(s&&e["op"]in t.aggregateOperators){var u=(e["args"]&&e["args"][0]||{})["field"]||t.DEFAULT_FIELD,c=t.generateAlias(e["op"],u);return c in o||(r.push({op:e["op"],args:e["args"]}),o[c]=!0),{field:[c]}}for(var l=[],d=e["args"]||[],f=0;f 0)&&(s[t.clause.AGGREGATE]=(e[t.clause.AGGREGATE]||[]).concat(r));for(var u=[t.clause.GROUP_BY,t.clause.ORDER_BY,t.clause.SELECT,t.clause.OFFSET,t.clause.LIMIT],c=0;c 0&&(r=i.map(r,(function(e){return"Sub-rule "+n+": "+e}))),e.hasOwnProperty(t.clause.FROM)&&(r=r.concat(m(e[t.clause.FROM],n+1))),r},I=function(e,t){return i.map(t,(function(t){return i.map(e,(function(e){return g(t,e)}))}))},y=function(e,n){var r=n;if(e.hasOwnProperty(t.clause.FROM)&&(a.debug("Evaluating FROM clause:",e[t.clause.FROM]),r=y(e[t.clause.FROM],r),a.debug("Results after FROM:",r)),a.debug("Evaluating WHERE clause:",e[t.clause.WHERE]),r=i.filter(r,(function(n){return g(n,e[t.clause.WHERE])})),a.debug("Results after WHERE:",r),e.hasOwnProperty(t.clause.AGGREGATE)){a.debug("Evaluating AGGREGATE clause:",e[t.clause.AGGREGATE]);var o=h(e[t.clause.GROUP_BY],r),s=_(e[t.clause.AGGREGATE],o);r=v(o,s),a.debug("Results after AGGREGATE:",r)}e.hasOwnProperty(t.clause.HAVING)&&(a.debug("Evaluating HAVING clause:",e[t.clause.HAVING]),r=i.filter(r,(function(n){return g(n,e[t.clause.HAVING])})),a.debug("Results after HAVING:",r)),e.hasOwnProperty(t.clause.ORDER_BY)&&(a.debug("Evaluating ORDER_BY clause:",e[t.clause.ORDER_BY]),r=E(e[t.clause.ORDER_BY],r),a.debug("Results after ORDER_BY:",r));var u=0;e.hasOwnProperty(t.clause.OFFSET)&&(a.debug("Evaluating OFFSET clause:",e[t.clause.OFFSET]),u=Number(e[t.clause.OFFSET]));var c;return e.hasOwnProperty(t.clause.LIMIT)&&(a.debug("Evaluating LIMIT clause:",e[t.clause.LIMIT]),c=u+Number(e[t.clause.LIMIT])),(u>0||!i.isUndefined(c))&&(r=r.slice(u,c),a.debug("Results after OFFSET/LIMIT:",r)),e.hasOwnProperty(t.clause.SELECT)&&(a.debug("Evaluating SELECT clause:",e[t.clause.SELECT]),r=I(e[t.clause.SELECT],r),a.debug("Results after SELECT:",r)),r};t.execute=function(e,n){e=t.rewrite(e),a.shouldLog(r.LogLevel.DEBUG)&&a.groupCollapsed("Evaluating Behavioral Rule"),a.debug("Rule:",e,c.stringify(e)),a.debug("Events:",n);var i=m(e);if(i.length>0)throw new Error("Rule "+c.stringify(e)+" has violations: "+i.join("\n"));var o=y(e,n);return a.debug("Rule result:",o),a.shouldLog(r.LogLevel.DEBUG)&&a.groupEnd(),o},t.isSatisfied=function(e,n){try{return t.execute(e,n).length>0}catch(t){return a.error("Rules","Error "+t.toString()+" while evaluating rule "+c.stringify(e)),!1}}}),(function(e,t,n){e.exports=function(e){e.registerVisitorProfileProvider(n(155))}}),(function(e,t,n){var i=n(2),r=n(156),a=n(150),o=n(26),s=n(152);e.exports={provides:"customBehavior",shouldTrack:!0,isLazy:!1,getter:["stores/global","stores/visitor_attribute_entity",function(e,t){var n=e.getProjectId(),u=i.filter(i.map(t.getCustomBehavioralAttributes(n),(function(e){try{return{id:e.id,granularity:r.GRANULARITY.ALL,rule:s.buildFromSpecV0_2(o.parse(e.rule_json))}}catch(e){return}}))),c=a.getEvents();return r.evaluate(u,c)}]}}),(function(e,t,n){function i(e){if(0===e.length)return[];for(var t=e.length-1,n=o.FIELDS.SESSION_ID,i=e[t][n];t>0&&i===e[t-1][n];)t--;return e.slice(t)}function r(e,t){if(0===e.length||t<=0)return[];var n=+new Date-t*s.MILLIS_IN_A_DAY;n-=n%s.MILLIS_IN_A_DAY;for(var i=e.length;i>0&&n<=e[i-1][o.FIELDS.TIME];)i--;return e.slice(i)}var a=n(23),o={FIELDS:n(62).FIELDS},s=n(152),u=n(153);t.GRANULARITY={ALL:"all",CURRENT_SESSION:"current_session",LAST_30_DAYS:"last_30_days",LAST_60_DAYS:"last_60_days"},t.evaluate=function(e,n){var o={};if(0===n.length){for(var s=0;s 0){var t=e[0],n=a(t,[i.FIELDS.SESSION_INDEX]);return n===o}return!0}]}}),(function(e,t){e.exports={fieldsNeeded:["first_session"],match:function(e){return!!e.first_session}}}),(function(e,t,n){e.exports=function(e){e.registerApiModule("behavior",n(161))}}),(function(e,t,n){function i(e,t){var n=d.buildFromSpecV0_1(t);if(1!==n.length)throw new Error("Invalid query descriptor; verify that no aggregators are specified");return f.execute(n[0],e)}function r(e,t){return c.map(e,(function(e){return c.isFunction(e.toObject)?e.toObject(t):e}))}function a(e,t){if(!e)return["Descriptor not defined"];var n=[];return e.count&&n.push('Unexpected "count" clause specified'),e.pick&&e.pick.modifier&&t.indexOf(e.pick.modifier)===-1&&n.push('Invalid "pick" modifier "'+e.pick.modifier+'"'),c.each(e.filters,(function(e){c.isUndefined(e.modifier)||n.push('Unexpected "filter" modifier "'+e.modifier+'"')})), n.length>0?n:void 0}function o(e,t){var n,o={revenueAsTag:!1,timeAsTimestamp:!0};if(c.isUndefined(t))return n=l.getEvents(e),r(n,o);if(c.isNumber(t)){if(t<=0)throw new Error("Count must be a positive integer, got "+t);return n=l.getEvents(e),r(n.slice(-t),o)}var s=a(t,c.values(d.RECENCY_FILTERS));if(s)throw new Error(s.join("\n"));return n=l.getEvents(e),r(i(n,t),o)}function s(e,t){if(t=c.cloneDeep(t)||{},!t.pick)throw new Error('No "pick" clause provided in query descriptor');if(!t.pick.name)throw new Error('No field name provided in "pick" clause');t.pick.modifier=t.pick.modifier||d.FREQUENCY_FILTERS.MOST_FREQUENT;var n=a(t,c.values(d.FREQUENCY_FILTERS));if(n)throw new Error(n.join("\n"));var r=l.getEvents(e);return i(r,t)}function u(e,t){var n=d.buildFromSpecV0_2(t),i=l.getEvents(e),a=r(f.execute(n,i),{revenueAsTag:!0,timeAsTimestamp:!1});return(t.pick||t.reduce&&"count"===t.reduce.aggregator)&&(a=c.flatten(a)),t.reduce&&(a=a[0]),a}var c=n(2),l=n(150),d=n(152),f=n(153);e.exports=["stores/visitor_events",function(e){return{getEvents:c.partial(o,e),getByFrequency:c.partial(s,e),query:c.partial(u,e)}}]}),(function(e,t,n){e.exports=function(e){e.registerDependency("sources/browser_id",n(163)),e.registerVisitorProfileProvider(n(168)),e.registerVisitorProfileProvider(n(169)),e.registerAudienceMatcher("browser_version",n(170))}}),(function(e,t,n){var i=n(164);t.getId=function(){return i.get().browser.id},t.getVersion=function(){return i.get().browser.version}}),(function(e,t,n){var i=n(2),r=n(165),a=n(39),o=n(7),s=n(16),u=n(9),c=s.get("stores/ua_data");t.get=function(){var e=c.get();return i.isEmpty(e)&&(e=r.parseUA(a.getUserAgent()),u.dispatch(o.SET_UA_DATA,{data:e})),e}}),(function(e,t,n){function i(e){if(e=(e||"").toLowerCase(),e in u)return e;var t=a.keys(u);return a.find(t,(function(t){var n=u[t];return a.includes(n,e)}))||"unknown"}function r(e,t,n){return t?t:"unknown"===e?"unknown":n?"mobile":"desktop_laptop"}var a=n(2),o=n(166);t.parseUA=function(e){var t=new o(e),n=t.getBrowser(),a=t.getOS(),u=t.getDevice(),l=(a.name||"unknown").toLowerCase(),d=(n.name||"unknown").toLowerCase(),f=s(u.type,d,l);return{browser:{id:i(n.name),version:n.version},platform:{name:l,version:a.version},device:{model:c[u.model]||"unknown",type:r(d,u.type,f),isMobile:f}}};var s=function(e,t,n){if(a.includes(["mobile","tablet"],e))return!0;if(a.includes(["opera mini"],t))return!0;var i=["android","blackberry","ios","windows phone"];return!!a.includes(i,n)},u={gc:["chrome","chromium","silk","yandex","maxthon"],edge:["edge"],ie:["internet explorer","iemobile"],ff:["firefox","iceweasel"],opera:["opera","opera mini","opera tablet"],safari:["safari","mobile safari","webkit"],ucbrowser:["uc browser"]},c={iPhone:"iphone",iPad:"ipad"}}),(function(e,t,n){var i;!(function(r,a){"use strict";var o="0.7.17",s="",u="?",c="function",l="undefined",d="object",f="string",p="major",g="model",h="name",_="type",v="vendor",E="version",m="architecture",I="console",y="mobile",S="tablet",T="smarttv",A="wearable",b="embedded",w={extend:function(e,t){var n={};for(var i in e)t[i]&&t[i].length%2===0?n[i]=t[i].concat(e[i]):n[i]=e[i];return n},has:function(e,t){return"string"==typeof e&&t.toLowerCase().indexOf(e.toLowerCase())!==-1},lowerize:function(e){return e.toLowerCase()},major:function(e){return typeof e===f?e.replace(/[^\d\.]/g,"").split(".")[0]:a},trim:function(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}},D={rgx:function(e,t){for(var n,i,r,o,s,u,l=0;l 0?2==o.length?typeof o[1]==c?this[o[0]]=o[1].call(this,u):this[o[0]]=o[1]:3==o.length?typeof o[1]!==c||o[1].exec&&o[1].test?this[o[0]]=u?u.replace(o[1],o[2]):a:this[o[0]]=u?o[1].call(this,u,o[2]):a:4==o.length&&(this[o[0]]=u?o[3].call(this,u.replace(o[1],o[2])):a):this[o]=u?u:a;l+=2}},str:function(e,t){for(var n in t)if(typeof t[n]===d&&t[n].length>0){for(var i=0;i Number(n[a]))return 1}}return 0}}),(function(e,t,n){e.exports=function(e){e.registerVisitorProfileProvider(n(173)),e.registerAudienceMatcher("campaign",n(174))}}),(function(e,t,n){var i=n(117);e.exports={provides:"campaign",shouldTrack:!0,isSticky:!0,getter:[function(){return i.getQueryParamValue("utm_campaign")}]}}),(function(e,t,n){var i=n(20);e.exports={fieldsNeeded:["campaign"],match:function(e,t){return i.hasMatch(t.value,t.match,e.campaign)}}}),(function(e,t,n){e.exports=function(e){e.registerAudienceMatcher("code",n(176))}}),(function(e,t,n){var i=n(2),r=n(141);t.fieldsNeeded=[],t.match=function(e,t){if(i.isUndefined(t.value))return!0;if("function"==typeof t.value)try{return Boolean(r.apply(t.value))}catch(e){return!1}else try{return Boolean(r.eval(t.value))}catch(e){return!1}return!1}}),(function(e,t,n){e.exports=function(e){e.registerVisitorProfileProvider(n(178));var t=n(179);e.registerAudienceMatcher("custom_attribute",t),e.registerAudienceMatcher("custom_dimension",t)}}),(function(e,t,n){var i=n(2),r=n(25),a=n(23),o=n(16),s=o.get("stores/dimension_data");e.exports={provides:"custom",attributionType:r.AttributionTypes.LAST_TOUCH,restorer:function(e){return i.reduce(e,(function(e,t,n){var r=t,o=n,u=s.getByApiName(n),c=s.getById(n);return i.isObject(t)&&!t.id&&(u&&!c?(o=u.id,r={id:u.segmentId||u.id,value:t.value}):c||a.warn("Unable to determine ID for custom attribute:",n,"; segmentation is disabled.")),e[o]=r,e}),{})},shouldTrack:!0}}),(function(e,t,n){var i=n(2),r=n(20);t.match=function(e,t){var n;return e.custom&&(n=e.custom[t.name]),i.isObject(n)&&(n=n.value),r.hasMatch(t.value,t.match,n)}}),(function(e,t,n){e.exports=function(e){e.registerDependency("sources/device",n(181)),e.registerVisitorProfileProvider(n(182)),e.registerAudienceMatcher("device",n(183))}}),(function(e,t,n){var i=n(164);t.getDevice=function(){var e=i.get().device;return"unknown"!==e.model?e.model:"tablet"===e.type?"tablet":e.isMobile?"mobile":"desktop"}}),(function(e,t){e.exports={provides:"device",shouldTrack:!0,isSticky:!0,getter:["sources/device",function(e){return e.getDevice()}]}}),(function(e,t){e.exports={fieldsNeeded:["device"],match:function(e,t){return e.device===t.value}}}),(function(e,t,n){e.exports=function(e){e.registerVisitorProfileProvider(n(185)),e.registerAudienceMatcher("device_type",n(186))}}),(function(e,t,n){var i=n(164);e.exports={provides:"device_type",shouldTrack:!0,isSticky:!0,getter:[function(){var e=i.get().device;switch(e.type){case"mobile":return"phone";case"tablet":case"desktop_laptop":return e.type;default:return"other"}}]}}),(function(e,t){e.exports={fieldsNeeded:["device_type"],match:function(e,t){return e.device_type===t.value}}}),(function(e,t,n){e.exports=function(e){e.registerVisitorProfileProvider(n(188)),e.registerAudienceMatcher("referrer",n(189))}}),(function(e,t,n){var i=n(79),r=n(97);e.exports={provides:"referrer",shouldTrack:!0,isSticky:!0,getter:[function(){var e=r.getReferrer()||i.getReferrer();return""===e&&(e=null),e}]}}),(function(e,t,n){var i=n(190);t.fieldsNeeded=["referrer"],t.match=function(e,t){return null!==e.referrer&&i(e.referrer,t)}}),(function(e,t,n){function i(e){var t=e.indexOf("?");return t!==-1&&(e=e.substring(0,t)),t=e.indexOf("#"),t!==-1&&(e=e.substring(0,t)),e}function r(e){return a(i(e))}function a(e,t){e=e.replace("/?","?"),e=e.toLowerCase().replace(/[\/&?]+$/,"");var n=l.slice(0);t||(n=n.concat(u));for(var i=n.length,r=0;r0&&(t[1]="?"+o.join("&")),r&&(t[1]+="#"+r),t.join("")}return e}var s=n(2);e.exports=function(e,t){e=o(e);var n=t.value;switch(t.match){case"exact":return e=a(e),e===a(n);case"regex":try{return Boolean(e.match(n))}catch(e){}return!1;case"simple":return e=r(e),n=r(n),e===n;case"substring":return e=a(e,!0),n=a(n,!0),e.indexOf(n)!==-1;default:return!1}};var u=["www."],c="optimizely_",l=["https?://.*?.?optimizelyedit.(com|test)/","https?://.*.?optimizelypreview.(com|test)/","https?://(edit|preview)(-hrd|-devel)?.optimizely.(com|test)/","https?://.*?.?optimizelyedit(-hrd)?.appspot.com/","https?://"]}),(function(e,t,n){e.exports=function(e){e.registerVisitorProfileProvider(n(192)),e.registerAudienceMatcher("source_type",n(194))}}),(function(e,t,n){var i=n(117),r=n(79),a=n(97),o=n(193),s=["google\\.\\w{2,3}(\\.\\w{2,3})?/(search|url)","https://(www)?\\.google\\..*?/$","bing\\.\\w{2,3}(\\.\\w{2,3})?/(search|url)","yahoo\\.\\w{2,3}(\\.\\w{2,3})?/search","baidu\\.\\w{2,3}(\\.\\w{2,3})?/s?"];e.exports={provides:"source_type",shouldTrack:!0,isSticky:!1,getter:[function(){return function(e,t){var n=function(){if(i.getQueryParamValue("utm_source")||i.getQueryParamValue("gclid")||i.getQueryParamValue("otm_source"))return"campaign";for(var e=a.getReferrer()||r.getReferrer(),t=0;t =s&&c<=u&&a.includes(o.days,l)}}),(function(e,t,n){function i(e){function t(e,t,n){try{u(t),e[n]=t}catch(e){C.emitError(new X("Bad value for eventTags["+n+"]: "+e.message))}return e}var n=N.keys(ne),i=N.omit(e,n),r=N.pick(e,n),a=N.reduce(i,t,{}),o=N.reduce(r,(function(e,n,i){var r=ne[i];r.excludeFeature||t(a,n,i);try{r.validate(n),e[i]=r.sanitize(n),a[i]=e[i]}catch(e){C.emitError(new X("Bad value for eventMetrics["+i+"]: "+e.message))}return e}),{});return o.tags=a,o}function r(e){var t=N.extend({entity_id:e.pageId,key:e.pageId,timestamp:e.timestamp,uuid:e.eventId,type:J},i(e.eventTags));return t}function a(e){return N.extend({entity_id:e.event.id,key:e.event.apiName,timestamp:e.timestamp,uuid:e.eventId,type:e.event.category},i(e.eventTags))}function o(e){return N.extend({entity_id:e.eventEntityId,key:e.eventApiName,timestamp:e.timestamp,uuid:e.eventId,type:e.eventCategory},i(e.eventTags))}function s(e){return{entity_id:null,type:Q,uuid:e.eventId,timestamp:e.timestamp}}function u(e){if(null==e)throw new Error("Feature value is null");if("object"==typeof e){var t;try{t=k.stringify(e)}catch(e){}throw new Error('Feature value is complex: "'+t||'[object]"')}}function c(e){if(null==e)throw new Error("Metric value is null");if(!N.isNumber(e))throw new Error("Metric value is not numeric")}function l(e){return N.reduce(e,(function(e,t){try{u(t.value),e.push({entity_id:t.id||null,key:t.name,type:t.type,value:t.value})}catch(e){F.warn("Error evaluating user feature",t,e)}return e}),[])}function d(e,t,n){K.dispatch(V.REGISTER_TRACKER_EVENT,{event:e,decisions:n}),f(t),D()}function f(e){var t=l(e);K.dispatch(V.UPDATE_TRACKER_VISITOR_ATTRIBUTES,{attributes:t})}function p(e){var t=l(e.userFeatures),n={account_id:e.accountId,anonymize_ip:e.anonymizeIP,client_name:e.clientEngine,client_version:e.clientVersion,project_id:e.projectId,visitors:[{session_id:h(e.sessionId),visitor_id:e.visitorId,attributes:t,snapshots:[{decisions:[{campaign_id:e.layerId,experiment_id:e.experimentId,variation_id:e.variationId,is_campaign_holdback:e.isLayerHoldback}],events:[{uuid:e.decisionId,entity_id:e.layerId,timestamp:e.timestamp,type:$}]}]}]};K.dispatch(V.REGISTER_PREVIOUS_BATCH,n),D()}function g(e){var t=N.isNull(q.getAnonymizeIP())?void 0:q.getAnonymizeIP(),n={account_id:e.accountId,anonymize_ip:t,client_name:e.clientEngine,client_version:e.clientVersion,project_id:e.projectId,visitors:[]};n.revision=e.revision;var i={session_id:h(e.sessionId),visitor_id:e.visitorId,attributes:[],snapshots:[]},r=R(e.layerStates);K.dispatch(V.REGISTER_TRACKER_VISITOR,{data:n,visitor:i,decisions:r}),D()}function h(e){return oe?ae:e}function _(e){var t={entity_id:e.layerId,type:$,uuid:e.decisionId,timestamp:e.timestamp};K.dispatch(V.REGISTER_TRACKER_DECISION,{decisionEvent:t,decisions:R(e.layerStates)}),f(e.userFeatures),D()}function v(){if(!W.canSend())return void F.debug("Not sending events (holding)");var e=W.hasEventsToSend(),t=W.hasPreviousBatchesToSend();return e||t?(t&&(N.each(W.getPreviousBatches(),E),K.dispatch(V.RESET_TRACKER_PREVIOUS_BATCHES)),void(e&&(K.dispatch(V.FINALIZE_BATCH_SNAPSHOT),E(W.getEventBatch()),K.dispatch(V.RESET_TRACKER_EVENTS)))):void F.debug("Not sending events because there are no events to send")}function E(e){F.debug("Sending ticket:",e);var t=P.generate();B.retryableRequest({url:L,method:"POST",data:m(e)},t)}function m(e){var t=N.extend({},N.pick(e,["account_id","anonymize_ip","client_name","client_version","project_id","revision"]),{visitors:N.map(e.visitors,I)});return t}function I(e){return{visitor_id:e.visitor_id,session_id:ae,attributes:N.map(e.attributes,y),snapshots:N.map(e.snapshots,S)}}function y(e){return w(e,{entity_id:"e",key:"k",type:"t",value:"v"})}function S(e){var t=e.events;return t=T(t),{activationTimestamp:q.getActivationTimestamp(),decisions:N.map(e.decisions,A),events:N.map(t,b)}}function T(e){var t=N.reduce(e,(function(e,t){var n;if(n=t.type!==J||!N.isEmpty(t.tags)||!N.isEmpty(N.pick(t,N.keys(ne)))||t.key&&t.entity_id!==t.key?t.uuid:t.type,e[n]){var i=e[n].timestamp;t.timestamp>i&&(i=t.timestamp),e[n]=N.extend({},e[n],{key:Z,entity_id:e[n].entity_id+"-"+t.entity_id,timestamp:i})}else e[n]=t;return e}),{});return N.values(t)}function A(e){return w(e,{campaign_id:"c",experiment_id:"x",is_campaign_holdback:"h",variation_id:"v"})}function b(e){return e.key===$&&(e.type=$,delete e.key),w(e,{entity_id:"e",key:"k",quantity:"q",revenue:"$",tags:"a",timestamp:"t",uuid:"u",value:"v",type:"y"})}function w(e,t){return N.reduce(e,(function(e,n,i){return i in t&&(e[t[i]||i]=n),e}),{})}function D(){function e(){var t=!ie||j.isLoaded();t&&v(),W.isPolling()&&G.setTimeout(e,te)}return W.shouldBatch()?void(W.isPolling()||(G.setTimeout(e,te),K.dispatch(V.SET_TRACKER_POLLING,!0),G.setTimeout((function(){K.dispatch(V.SET_TRACKER_BATCHING,!1),K.dispatch(V.SET_TRACKER_POLLING,!1)}),ee))):void v()}function R(e){return N.map(e,(function(e){return{campaign_id:e.layerId,experiment_id:e.decision.experimentId,variation_id:e.decision.variationId,is_campaign_holdback:e.decision.isLayerHoldback}}))}function O(){var e=W.getPersistableState();if(e)try{F.debug("Persisting pending batch:",e),U.persistTrackerOptimizelyData(e),K.dispatch(V.SET_TRACKER_DIRTY,!1)}catch(e){F.debug("Failed to persist pending batch:",e)}}var N=n(2),C=n(84),P=n(5),L="https://logx.optimizely.com/v1/events",V=n(7),x=n(75).create,k=n(26),F=n(23),M=n(113),U=n(73),G=n(39),B=n(88),z=n(16),j=n(79),H=n(85),Y=n(109),K=n(9),q=z.get("stores/global"),W=z.get("stores/tracker_optimizely"),X=t.Error=x("OptimizelyTrackerError"),Q="client_activation",$="campaign_activated",J="view_activated",Z="multi-event",ee=1e4,te=1e3,ne={revenue:{validate:c,sanitize:Math.floor,excludeFeature:!0},quantity:{validate:c,sanitize:Math.floor,excludeFeature:!0},value:{validate:c,sanitize:N.identity}},ie=!1,re=!1,ae="AUTO",oe=!0,se=[function(){return function(e){_(N.extend(e,e.decision))}}],ue=function(e){e.timing===M.TrackLayerDecisionTimingFlags.postRedirectPolicy?p(e):_(e)},ce=[function(){return function(e){d(r(e),e.userFeatures,R(e.layerStates))}}],le=[function(){return function(e){g(e),d(s(e),e.userFeatures,R(e.layerStates))}}],de=[function(){return function(e){d(o(e),e.userFeatures,R(e.layerStates))}}],fe=[function(){return function(e){d(a(e),e.userFeatures,R(e.layerStates))}}],pe={onLayerDecision:se,trackLayerDecision:ue,postRedirectPolicy:M.PostRedirectPolicies.TRACK_AFTER_SYNC,nonRedirectPolicy:M.NonRedirectPolicies.TRACK_IMMEDIATELY,onPageActivated:ce,onClientActivation:le,onClickEvent:fe,onCustomEvent:de};e.exports=function(e){e.registerAnalyticsTracker("optimizely",pe),H.on({filter:{type:Y.TYPES.ANALYTICS,name:"sendEvents"},handler:function(){K.dispatch(V.SET_TRACKER_SEND_EVENTS,!0),W.isPolling()||v()}}),H.on({filter:{type:Y.TYPES.ANALYTICS,name:"holdEvents"},handler:function(){K.dispatch(V.SET_TRACKER_SEND_EVENTS,!1)}}),K.dispatch(V.SET_TRACKER_SEND_EVENTS,!re);var t=H.on({filter:{type:"lifecycle",name:"activated"},handler:function(){W.observe(O),H.off(t)}})}}),(function(e,t,n){e.exports=function(e){e.registerViewProvider(n(202)),e.registerViewMatcher("url",n(203))}}),(function(e,t,n){var i=n(117);e.exports={provides:"url",getter:[function(){return i.getUrl()}]}}),(function(e,t,n){var i=n(190);e.exports={fieldsNeeded:["url"],match:function(e,t){return i(e.url,t)}}}),(function(e,t,n){var i=n(141),r="custom_code",a={match:function(e,t){return i.apply(t.value)}};e.exports=function(e){e.registerViewMatcher(r,a)}}),(function(e,t,n){var i="element_present",r={match:function(e,t){return!!document.querySelector(t.value)}};e.exports=function(e){e.registerViewMatcher(i,r)}}),(function(e,t,n){function i(e){return"apiName: "+e.apiName+", selector: "+e.eventFilter.selector}var r=n(108),a=n(207),o=n(23),s=n(120);e.exports=function(e){var t=new a(function(e){s.updateAllViewTags();var t=r.trackClickEvent(e);t?o.log("Tracking click event:",e):o.log("Not tracking click event:",e)});e.registerEventImplementation("click",{attach:function(e){t.hasEvents()||t.listen(),t.addEvent(e),o.debug("Started listening for click event ("+i(e)+"):",e)},detach:function(e){t.removeEvent(e),t.hasEvents()||t.unlisten(),o.debug("Stopped listening for click event ("+i(e)+"):",e)}})}}),(function(e,t,n){function i(e){this.handler=e,this.events=[],this.unlistenFn=null,this.clickHandler=a.bind((function(e){a.forEach(this.events,a.bind((function(t){try{ var n=t.config&&t.config.selector?t.config.selector:t.eventFilter.selector;r(e,n,t)&&this.handler(t)}catch(e){o.emitError(new l("Unable to handle click for selector"+n+":"+e.message))}}),this))}),this)}function r(e,t,n){for(var i=e.target,r=0;i;){var s;try{s=c(i,t)}catch(s){var u={typeofElementValue:typeof i,nodeName:a.result(i,["nodeName"],null),nodeType:a.result(i,["nodeType"],null),targetName:a.result(e,["target","nodeName"],null),targetType:a.result(e,["target","nodeType"],null),numParentsTraversed:r,selector:t,errorMessage:s.message,eventId:n.id};return o.emitError(new l("Unable to evaluate match for element"),u),!1}if(s)return!0;i=i.parentElement,r++}return!1}var a=n(2),o=n(84),s=n(75).create,u=n(79),c=n(208),l=t.Error=s("ClickDelegateError");i.prototype.listen=function(){this.unlistenFn=u.addEventListener("click",this.clickHandler,!0)},i.prototype.unlisten=function(){this.unlistenFn&&(this.unlistenFn(),this.unlistenFn=null)},i.prototype.hasEvents=function(){return this.events.length>0},i.prototype.addEvent=function(e){this.events.push(e)},i.prototype.removeEvent=function(e){this.events=a.filter(this.events,(function(t){return t.apiName!==e.apiName}))},e.exports=i}),(function(e,t,n){e.exports=n(209)}),(function(e,t){"use strict";function n(e,t){if(r)return r.call(e,t);for(var n=e.parentNode.querySelectorAll(t),i=0;i