optimizely-b2d3c6c8.js 104 KB

1234
  1. (function($e){"use strict";var Wr=Object.defineProperty,zr=(e,t)=>Wr(e,"name",{value:t,configurable:!0});function St(){return typeof Blob=="function"&&typeof PerformanceObserver=="function"&&typeof Intl!="undefined"&&typeof MutationObserver!="undefined"&&typeof URLSearchParams!="undefined"&&typeof WebSocket!="undefined"&&typeof IntersectionObserver!="undefined"&&typeof AbortController!="undefined"&&typeof queueMicrotask!="undefined"&&typeof TextEncoder!="undefined"&&typeof TextDecoder!="undefined"&&typeof customElements!="undefined"&&typeof HTMLDetailsElement!="undefined"&&"fromEntries"in Object&&"entries"in FormData.prototype&&"toggleAttribute"in Element.prototype&&"flatMap"in Array.prototype&&"replaceChildren"in Element.prototype}zr(St,"capableBrowser");var Xr=Object.defineProperty,$r=(e,t)=>Xr(e,"name",{value:t,configurable:!0});function Lt(e){var t,r;const n=(r=(t=e.head)==null?void 0:t.querySelector('meta[name="expected-hostname"]'))==null?void 0:r.content;if(!n)return!1;const i=n.replace(/\.$/,"").split(".").slice(-2).join("."),a=e.location.hostname.replace(/\.$/,"").split(".").slice(-2).join(".");return i!==a}$r(Lt,"detectProxySite");let Je;function Ut(){return`${Math.round(Math.random()*(Math.pow(2,31)-1))}.${Math.round(Date.now()/1e3)}`}function Jr(e){const t=`GH1.1.${e}`,r=Date.now(),n=new Date(r+1*365*86400*1e3).toUTCString();let{domain:i}=document;i.endsWith(".github.com")&&(i="github.com"),document.cookie=`_octo=${t}; expires=${n}; path=/; domain=${i}; secure; samesite=lax`}function Zr(){let e;const r=document.cookie.match(/_octo=([^;]+)/g);if(!r)return;let n=[0,0];for(const i of r){const[,a]=i.split("="),[,o,...s]=a.split("."),u=o.split("-").map(Number);u>n&&(n=u,e=s.join("."))}return e}function Z(){try{const e=Zr();if(e)return e;const t=Ut();return Jr(t),t}catch(e){return Je||(Je=Ut()),Je}}var fe="<unknown>";function Qr(e){var t=e.split(`
  2. `);return t.reduce(function(r,n){var i=rn(n)||on(n)||un(n)||dn(n)||cn(n);return i&&r.push(i),r},[])}var en=/^\s*at (.*?) ?\(((?:file|https?|blob|chrome-extension|native|eval|webpack|<anonymous>|\/).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,tn=/\((\S*)(?::(\d+))(?::(\d+))\)/;function rn(e){var t=en.exec(e);if(!t)return null;var r=t[2]&&t[2].indexOf("native")===0,n=t[2]&&t[2].indexOf("eval")===0,i=tn.exec(t[2]);return n&&i!=null&&(t[2]=i[1],t[3]=i[2],t[4]=i[3]),{file:r?null:t[2],methodName:t[1]||fe,arguments:r?[t[2]]:[],lineNumber:t[3]?+t[3]:null,column:t[4]?+t[4]:null}}var nn=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i;function on(e){var t=nn.exec(e);return t?{file:t[2],methodName:t[1]||fe,arguments:[],lineNumber:+t[3],column:t[4]?+t[4]:null}:null}var an=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|\[native).*?|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i,sn=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i;function un(e){var t=an.exec(e);if(!t)return null;var r=t[3]&&t[3].indexOf(" > eval")>-1,n=sn.exec(t[3]);return r&&n!=null&&(t[3]=n[1],t[4]=n[2],t[5]=null),{file:t[3],methodName:t[1]||fe,arguments:t[2]?t[2].split(","):[],lineNumber:t[4]?+t[4]:null,column:t[5]?+t[5]:null}}var ln=/^\s*(?:([^@]*)(?:\((.*?)\))?@)?(\S.*?):(\d+)(?::(\d+))?\s*$/i;function cn(e){var t=ln.exec(e);return t?{file:t[3],methodName:t[1]||fe,arguments:[],lineNumber:+t[4],column:t[5]?+t[5]:null}:null}var fn=/^\s*at (?:((?:\[object object\])?[^\\/]+(?: \[as \S+\])?) )?\(?(.*?):(\d+)(?::(\d+))?\)?\s*$/i;function dn(e){var t=fn.exec(e);return t?{file:t[2],methodName:t[1]||fe,arguments:[],lineNumber:+t[3],column:t[4]?+t[4]:null}:null}var En=Object.defineProperty,me=(e,t)=>En(e,"name",{value:t,configurable:!0});function ye(e){const t=document.querySelectorAll(e);if(t.length>0)return t[t.length-1]}me(ye,"queryLast");function Dt(){const e=ye("meta[name=analytics-location]");return e?e.content:window.location.pathname}me(Dt,"pagePathname");function bt(){const e=ye("meta[name=analytics-location-query-strip]");let t="";e||(t=window.location.search);const r=ye("meta[name=analytics-location-params]");r&&(t+=(t?"&":"?")+r.content);for(const n of document.querySelectorAll("meta[name=analytics-param-rename]")){const i=n.content.split(":",2);t=t.replace(new RegExp(`(^|[?&])${i[0]}($|=)`,"g"),`$1${i[1]}$2`)}return t}me(bt,"pageQuery");function Ze(){return`${window.location.protocol}//${window.location.host}${Dt()+bt()}`}me(Ze,"requestUri");var gn=Object.defineProperty,Y=(e,t)=>gn(e,"name",{value:t,configurable:!0});let Ct=!1,Pt=0;const pn=Date.now();function _n(e){e.error&&Re(Oe(Te(e.error)))}Y(_n,"reportEvent");async function hn(e){if(!!e.promise)try{await e.promise}catch(t){t&&t.name!=="AbortError"&&!(t.response instanceof Response)&&Re(Oe(Te(t)))}}Y(hn,"reportPromiseRejectionEvent");function Vt(e,t={}){Re(Oe(Te(e),t))}Y(Vt,"reportError");async function Re(e){var t,r;if(!kt())return;const n=(r=(t=document.head)==null?void 0:t.querySelector('meta[name="browser-errors-url"]'))==null?void 0:r.content;if(!!n){if(Ft(e.error.stacktrace)){Ct=!0;return}Pt++;try{await fetch(n,{method:"post",body:JSON.stringify(e)})}catch(i){}}}Y(Re,"report");function Te(e){return{type:e.name,value:e.message,stacktrace:Qe(e)}}Y(Te,"formatError");function Oe(e,t={}){return Object.assign({error:e,sanitizedUrl:Ze()||window.location.href,readyState:document.readyState,referrer:document.referrer,timeSinceLoad:Math.round(Date.now()-pn),user:et()||void 0},t)}Y(Oe,"errorContext");function Qe(e){var t;const r=xt(e),n=(t=e.framesToPop)!=null?t:0;return n===0?r:r.slice(n)}Y(Qe,"stacktrace");function xt(e){return Qr(e.stack||"").map(t=>({filename:t.file||"",function:String(t.methodName),lineno:(t.lineNumber||0).toString(),colno:(t.column||0).toString()}))}Y(xt,"parseStackTrace");const Mt=/(chrome|moz|safari)-extension:\/\//;function Ft(e){return e.some(t=>Mt.test(t.filename)||Mt.test(t.function))}Y(Ft,"isExtensionError");function et(){var e,t;const r=(t=(e=document.head)==null?void 0:e.querySelector('meta[name="user-login"]'))==null?void 0:t.content;return r||`anonymous-${Z()}`}Y(et,"pageUser");let tt=!1;window.addEventListener("pageshow",()=>tt=!1),window.addEventListener("pagehide",()=>tt=!0);function kt(){return!tt&&!Ct&&Pt<10&&St()&&!Lt(document)}Y(kt,"reportable"),typeof BroadcastChannel=="function"&&new BroadcastChannel("shared-worker-error").addEventListener("message",t=>{Vt(t.data.error)});var w=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function C(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function b(e,t){return t={exports:{}},e(t,t.exports),t.exports}function vn(e){return e&&e.default||e}var Q=b(function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function s(){}return s.prototype.handleError=function(u){},s}();t.NoopErrorHandler=r;var n=new r;function i(s){n=s}t.setErrorHandler=i;function a(){return n}t.getErrorHandler=a;function o(){n=new r}t.resetErrorHandler=o});C(Q),Q.NoopErrorHandler,Q.setErrorHandler,Q.getErrorHandler,Q.resetErrorHandler;var D=b(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),function(r){r[r.NOTSET=0]="NOTSET",r[r.DEBUG=1]="DEBUG",r[r.INFO=2]="INFO",r[r.WARNING=3]="WARNING",r[r.ERROR=4]="ERROR"}(t.LogLevel||(t.LogLevel={}))});C(D),D.LogLevel;for(var In={},mn=Object.freeze({__proto__:null,default:In}),yn=vn(mn),wt=function(){return yn.randomBytes(16)},Bt=[],Ne=0;Ne<256;++Ne)Bt[Ne]=(Ne+256).toString(16).substr(1);function Rn(e,t){var r=t||0,n=Bt;return[n[e[r++]],n[e[r++]],n[e[r++]],n[e[r++]],"-",n[e[r++]],n[e[r++]],"-",n[e[r++]],n[e[r++]],"-",n[e[r++]],n[e[r++]],"-",n[e[r++]],n[e[r++]],n[e[r++]],n[e[r++]],n[e[r++]],n[e[r++]]].join("")}var Gt=Rn,Kt,rt,nt=0,it=0;function Tn(e,t,r){var n=t&&r||0,i=t||[];e=e||{};var a=e.node||Kt,o=e.clockseq!==void 0?e.clockseq:rt;if(a==null||o==null){var s=wt();a==null&&(a=Kt=[s[0]|1,s[1],s[2],s[3],s[4],s[5]]),o==null&&(o=rt=(s[6]<<8|s[7])&16383)}var u=e.msecs!==void 0?e.msecs:new Date().getTime(),l=e.nsecs!==void 0?e.nsecs:it+1,E=u-nt+(l-it)/1e4;if(E<0&&e.clockseq===void 0&&(o=o+1&16383),(E<0||u>nt)&&e.nsecs===void 0&&(l=0),l>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");nt=u,it=l,rt=o,u+=122192928e5;var g=((u&268435455)*1e4+l)%4294967296;i[n++]=g>>>24&255,i[n++]=g>>>16&255,i[n++]=g>>>8&255,i[n++]=g&255;var c=u/4294967296*1e4&268435455;i[n++]=c>>>8&255,i[n++]=c&255,i[n++]=c>>>24&15|16,i[n++]=c>>>16&255,i[n++]=o>>>8|128,i[n++]=o&255;for(var f=0;f<6;++f)i[n+f]=a[f];return t||Gt(i)}var On=Tn;function Nn(e,t,r){var n=t&&r||0;typeof e=="string"&&(t=e==="binary"?new Array(16):null,e=null),e=e||{};var i=e.random||(e.rng||wt)();if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,t)for(var a=0;a<16;++a)t[n+a]=i[a];return t||Gt(i)}var jt=Nn,ot=jt;ot.v1=On,ot.v4=jt;var Ht=ot,V=b(function(e,t){Object.defineProperty(t,"__esModule",{value:!0});function r(){return new Date().getTime()}t.getTimestamp=r;function n(){return Ht.v4()}t.generateUUID=n;function i(g,c){for(var f=!1,_=Object.keys(g),p=0;p<_.length;p++)if(c===g[_[p]]){f=!0;break}return f}t.isValidEnum=i;function a(g,c){var f={};return g.forEach(function(_){var p=c(_);f[p]=f[p]||[],f[p].push(_)}),o(f)}t.groupBy=a;function o(g){return Object.keys(g).map(function(c){return g[c]})}t.objectValues=o;function s(g){return Object.keys(g).map(function(c){return[c,g[c]]})}t.objectEntries=s;function u(g,c){for(var f,_=0,p=g;_<p.length;_++){var h=p[_];if(c(h)){f=h;break}}return f}t.find=u;function l(g,c){var f={};return g.forEach(function(_){var p=c(_);f[p]=_}),f}t.keyBy=l;function E(g){for(var c=[],f=1;f<arguments.length;f++)c[f-1]=arguments[f];var _=0;return g.replace(/%s/g,function(){var p=c[_++],h=typeof p;return h==="function"?p():h==="string"?p:String(p)})}t.sprintf=E,function(g){g.ACTIVATE="ACTIVATE:experiment, user_id,attributes, variation, event",g.DECISION="DECISION:type, userId, attributes, decisionInfo",g.LOG_EVENT="LOG_EVENT:logEvent",g.OPTIMIZELY_CONFIG_UPDATE="OPTIMIZELY_CONFIG_UPDATE",g.TRACK="TRACK:event_key, user_id, attributes, event_tags, event"}(t.NOTIFICATION_TYPES||(t.NOTIFICATION_TYPES={}))});C(V),V.getTimestamp,V.generateUUID,V.isValidEnum,V.groupBy;var ee=V.objectValues;V.objectEntries,V.find;var An=V.keyBy,d=V.sprintf,Sn=V.NOTIFICATION_TYPES,$=b(function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r={NOTSET:0,DEBUG:1,INFO:2,WARNING:3,ERROR:4};function n(p){return typeof p!="string"||(p=p.toUpperCase(),p==="WARN"&&(p="WARNING"),!r[p])?p:r[p]}var i=function(){function p(){this.defaultLoggerFacade=new u,this.loggers={}}return p.prototype.getLogger=function(h){return h?(this.loggers[h]||(this.loggers[h]=new u({messagePrefix:h})),this.loggers[h]):this.defaultLoggerFacade},p}(),a=function(){function p(h){h===void 0&&(h={}),this.logLevel=D.LogLevel.NOTSET,h.logLevel!==void 0&&V.isValidEnum(D.LogLevel,h.logLevel)&&this.setLogLevel(h.logLevel),this.logToConsole=h.logToConsole!==void 0?!!h.logToConsole:!0,this.prefix=h.prefix!==void 0?h.prefix:"[OPTIMIZELY]"}return p.prototype.log=function(h,I){if(!(!this.shouldLog(h)||!this.logToConsole)){var T=this.prefix+" - "+this.getLogLevelName(h)+" "+this.getTime()+" "+I;this.consoleLog(h,[T])}},p.prototype.setLogLevel=function(h){h=n(h),!V.isValidEnum(D.LogLevel,h)||h===void 0?this.logLevel=D.LogLevel.ERROR:this.logLevel=h},p.prototype.getTime=function(){return new Date().toISOString()},p.prototype.shouldLog=function(h){return h>=this.logLevel},p.prototype.getLogLevelName=function(h){switch(h){case D.LogLevel.DEBUG:return"DEBUG";case D.LogLevel.INFO:return"INFO ";case D.LogLevel.WARNING:return"WARN ";case D.LogLevel.ERROR:return"ERROR";default:return"NOTSET"}},p.prototype.consoleLog=function(h,I){switch(h){case D.LogLevel.DEBUG:console.log.apply(console,I);break;case D.LogLevel.INFO:console.info.apply(console,I);break;case D.LogLevel.WARNING:console.warn.apply(console,I);break;case D.LogLevel.ERROR:console.error.apply(console,I);break;default:console.log.apply(console,I)}},p}();t.ConsoleLogHandler=a;var o=D.LogLevel.NOTSET,s=null,u=function(){function p(h){h===void 0&&(h={}),this.messagePrefix="",h.messagePrefix&&(this.messagePrefix=h.messagePrefix)}return p.prototype.log=function(h,I){this.internalLog(n(h),{message:I,splat:[]})},p.prototype.info=function(h){for(var I=[],T=1;T<arguments.length;T++)I[T-1]=arguments[T];this.namedLog(D.LogLevel.INFO,h,I)},p.prototype.debug=function(h){for(var I=[],T=1;T<arguments.length;T++)I[T-1]=arguments[T];this.namedLog(D.LogLevel.DEBUG,h,I)},p.prototype.warn=function(h){for(var I=[],T=1;T<arguments.length;T++)I[T-1]=arguments[T];this.namedLog(D.LogLevel.WARNING,h,I)},p.prototype.error=function(h){for(var I=[],T=1;T<arguments.length;T++)I[T-1]=arguments[T];this.namedLog(D.LogLevel.ERROR,h,I)},p.prototype.format=function(h){return""+(this.messagePrefix?this.messagePrefix+": ":"")+V.sprintf.apply(void 0,[h.message].concat(h.splat))},p.prototype.internalLog=function(h,I){!s||h<o||(s.log(h,this.format(I)),I.error&&I.error instanceof Error&&Q.getErrorHandler().handleError(I.error))},p.prototype.namedLog=function(h,I,T){var X;if(I instanceof Error){X=I,I=X.message,this.internalLog(h,{error:X,message:I,splat:T});return}if(T.length===0){this.internalLog(h,{message:I,splat:T});return}var Ie=T[T.length-1];Ie instanceof Error&&(X=Ie,T.splice(-1)),this.internalLog(h,{message:I,error:X,splat:T})},p}(),l=new i;function E(p){return l.getLogger(p)}t.getLogger=E;function g(p){s=p}t.setLogHandler=g;function c(p){p=n(p),!V.isValidEnum(D.LogLevel,p)||p===void 0?o=D.LogLevel.ERROR:o=p}t.setLogLevel=c;function f(){return o}t.getLogLevel=f;function _(){l=new i,o=D.LogLevel.NOTSET}t.resetLogger=_});C($),$.ConsoleLogHandler,$.getLogger,$.setLogHandler,$.setLogLevel,$.getLogLevel,$.resetLogger;var j=b(function(e,t){function r(n){for(var i in n)t.hasOwnProperty(i)||(t[i]=n[i])}Object.defineProperty(t,"__esModule",{value:!0}),r(Q),r(D),r($)});C(j);var Ln=j.ConsoleLogHandler,Ae=j.getLogger,Se=j.setLogLevel,qt=j.LogLevel,at=j.setLogHandler,Un=j.setErrorHandler,Dn=j.getErrorHandler,Le=b(function(e,t){Object.defineProperty(t,"__esModule",{value:!0});function r(n,i){var a=n.context,o=i.context;return a.accountId===o.accountId&&a.projectId===o.projectId&&a.clientName===o.clientName&&a.clientVersion===o.clientVersion&&a.revision===o.revision&&a.anonymizeIP===o.anonymizeIP&&a.botFiltering===o.botFiltering}t.areEventContextsEqual=r});C(Le),Le.areEventContextsEqual;var de=b(function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r=j.getLogger("EventProcessor"),n=function(){function o(s){var u=s.timeout,l=s.callback;this.timeout=Math.max(u,0),this.callback=l}return o.prototype.start=function(){this.timeoutId=setTimeout(this.callback,this.timeout)},o.prototype.refresh=function(){this.stop(),this.start()},o.prototype.stop=function(){this.timeoutId&&clearTimeout(this.timeoutId)},o}(),i=function(){function o(s){var u=s.sink;this.sink=u}return o.prototype.start=function(){},o.prototype.stop=function(){return Promise.resolve()},o.prototype.enqueue=function(s){this.sink([s])},o}();t.SingleEventQueue=i;var a=function(){function o(s){var u=s.flushInterval,l=s.maxQueueSize,E=s.sink,g=s.batchComparator;this.buffer=[],this.maxQueueSize=Math.max(l,1),this.sink=E,this.batchComparator=g,this.timer=new n({callback:this.flush.bind(this),timeout:u}),this.started=!1}return o.prototype.start=function(){this.started=!0},o.prototype.stop=function(){this.started=!1;var s=this.sink(this.buffer);return this.buffer=[],this.timer.stop(),s},o.prototype.enqueue=function(s){if(!this.started){r.warn("Queue is stopped, not accepting event");return}var u=this.buffer[0];u&&!this.batchComparator(u,s)&&this.flush(),this.buffer.length===0&&this.timer.refresh(),this.buffer.push(s),this.buffer.length>=this.maxQueueSize&&this.flush()},o.prototype.flush=function(){this.sink(this.buffer),this.buffer=[],this.timer.stop()},o}();t.DefaultEventQueue=a});C(de),de.SingleEventQueue,de.DefaultEventQueue;var Yt=b(function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function n(){this.reqsInFlightCount=0,this.reqsCompleteResolvers=[]}return n.prototype.trackRequest=function(i){var a=this;this.reqsInFlightCount++;var o=function(){a.reqsInFlightCount--,a.reqsInFlightCount===0&&(a.reqsCompleteResolvers.forEach(function(s){return s()}),a.reqsCompleteResolvers=[])};i.then(o,o)},n.prototype.onRequestsComplete=function(){var i=this;return new Promise(function(a){i.reqsInFlightCount===0?a():i.reqsCompleteResolvers.push(a)})},n}();t.default=r});C(Yt);var Ue=b(function(e,t){var r=w&&w.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty(t,"__esModule",{value:!0});var n=r(Yt),i=j.getLogger("EventProcessor"),a=3e4,o=10,s=function(){function u(l){var E=l.dispatcher,g=l.flushInterval,c=g===void 0?3e4:g,f=l.maxQueueSize,_=f===void 0?3e3:f,p=l.notificationCenter,h=this;this.dispatcher=E,c<=0&&(i.warn("Invalid flushInterval "+c+", defaulting to "+a),c=a),_=Math.floor(_),_<1&&(i.warn("Invalid maxQueueSize "+_+", defaulting to "+o),_=o),_=Math.max(1,_),_>1?this.queue=new de.DefaultEventQueue({flushInterval:c,maxQueueSize:_,sink:function(I){return h.drainQueue(I)},batchComparator:Le.areEventContextsEqual}):this.queue=new de.SingleEventQueue({sink:function(I){return h.drainQueue(I)}}),this.notificationCenter=p,this.requestTracker=new n.default}return u.prototype.drainQueue=function(l){var E=this,g=new Promise(function(c){if(i.debug("draining queue with %s events",l.length),l.length===0){c();return}var f=E.formatEvents(l);E.dispatcher.dispatchEvent(f,function(){c()}),E.notificationCenter&&E.notificationCenter.sendNotifications(V.NOTIFICATION_TYPES.LOG_EVENT,f)});return this.requestTracker.trackRequest(g),g},u.prototype.process=function(l){this.queue.enqueue(l)},u.prototype.stop=function(){try{return this.queue.stop(),this.requestTracker.onRequestsComplete()}catch(l){i.error('Error stopping EventProcessor: "%s"',l.message,l)}return Promise.resolve()},u.prototype.start=function(){this.queue.start()},u}();t.AbstractEventProcessor=s});C(Ue),Ue.AbstractEventProcessor;var st=b(function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r=j.getLogger("EventProcessor"),n=function(){function i(a){var o=a.key,s=a.maxValues,u=s===void 0?1e3:s;this.LS_KEY=o,this.maxValues=u}return i.prototype.get=function(a){return this.getMap()[a]||null},i.prototype.set=function(a,o){var s=this.getMap();s[a]=o,this.replace(s)},i.prototype.remove=function(a){var o=this.getMap();delete o[a],this.replace(o)},i.prototype.values=function(){return V.objectValues(this.getMap())},i.prototype.clear=function(){this.replace({})},i.prototype.replace=function(a){try{window.localStorage&&localStorage.setItem(this.LS_KEY,JSON.stringify(a)),this.clean()}catch(o){r.error(o)}},i.prototype.clean=function(){var a=this.getMap(),o=Object.keys(a),s=o.length-this.maxValues;if(!(s<1)){var u=o.map(function(E){return{key:E,value:a[E]}});u.sort(function(E,g){return E.value.timestamp-g.value.timestamp});for(var l=0;l<s;l++)delete a[u[l].key];this.replace(a)}},i.prototype.getMap=function(){try{var a=window.localStorage&&localStorage.getItem(this.LS_KEY);if(a)return JSON.parse(a)||{}}catch(o){r.error(o)}return{}},i}();t.LocalStorageStore=n});C(st),st.LocalStorageStore;var De=b(function(e,t){var r=w&&w.__extends||function(){var o=function(s,u){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(l,E){l.__proto__=E}||function(l,E){for(var g in E)E.hasOwnProperty(g)&&(l[g]=E[g])},o(s,u)};return function(s,u){o(s,u);function l(){this.constructor=s}s.prototype=u===null?Object.create(u):(l.prototype=u.prototype,new l)}}();Object.defineProperty(t,"__esModule",{value:!0});var n=j.getLogger("EventProcessor"),i=function(){function o(s){var u=s.eventDispatcher,l=s.store;this.dispatcher=u,this.store=l}return o.prototype.dispatchEvent=function(s,u){this.send({uuid:V.generateUUID(),timestamp:V.getTimestamp(),request:s},u)},o.prototype.sendPendingEvents=function(){var s=this,u=this.store.values();n.debug("Sending %s pending events from previous page",u.length),u.forEach(function(l){try{s.send(l,function(){})}catch(E){}})},o.prototype.send=function(s,u){var l=this;this.store.set(s.uuid,s),this.dispatcher.dispatchEvent(s.request,function(E){l.store.remove(s.uuid),u(E)})},o}();t.PendingEventsDispatcher=i;var a=function(o){r(s,o);function s(u){var l=u.eventDispatcher;return o.call(this,{eventDispatcher:l,store:new st.LocalStorageStore({maxValues:100,key:"fs_optly_pending_events"})})||this}return s}(i);t.LocalStoragePendingEventsDispatcher=a});C(De),De.PendingEventsDispatcher,De.LocalStoragePendingEventsDispatcher;var ne=b(function(e,t){var r=w&&w.__assign||function(){return r=Object.assign||function(c){for(var f,_=1,p=arguments.length;_<p;_++){f=arguments[_];for(var h in f)Object.prototype.hasOwnProperty.call(f,h)&&(c[h]=f[h])}return c},r.apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0});var n="campaign_activated",i="custom",a="$opt_bot_filtering";function o(c){var f=[],_=c[0];return c.forEach(function(p){if(p.type==="conversion"||p.type==="impression"){var h=l(p);p.type==="impression"?h.snapshots.push(u(p)):p.type==="conversion"&&h.snapshots.push(s(p)),f.push(h)}}),{client_name:_.context.clientName,client_version:_.context.clientVersion,account_id:_.context.accountId,project_id:_.context.projectId,revision:_.context.revision,anonymize_ip:_.context.anonymizeIP,enrich_decisions:!0,visitors:f}}t.makeBatchedEventV1=o;function s(c){var f=r({},c.tags);delete f.revenue,delete f.value;var _={entity_id:c.event.id,key:c.event.key,timestamp:c.timestamp,uuid:c.uuid};return c.tags&&(_.tags=c.tags),c.value!=null&&(_.value=c.value),c.revenue!=null&&(_.revenue=c.revenue),{events:[_]}}function u(c){var f=c.layer,_=c.experiment,p=c.variation,h=f?f.id:null,I=_?_.id:null,T=p?p.id:null;return{decisions:[{campaign_id:h,experiment_id:I,variation_id:T}],events:[{entity_id:h,timestamp:c.timestamp,key:n,uuid:c.uuid}]}}function l(c){var f={snapshots:[],visitor_id:c.user.id,attributes:[]};return c.user.attributes.forEach(function(_){f.attributes.push({entity_id:_.entityId,key:_.key,type:"custom",value:_.value})}),typeof c.context.botFiltering=="boolean"&&f.attributes.push({entity_id:a,key:a,type:i,value:c.context.botFiltering}),f}function E(c){var f=l(c);return f.snapshots.push(u(c)),{client_name:c.context.clientName,client_version:c.context.clientVersion,account_id:c.context.accountId,project_id:c.context.projectId,revision:c.context.revision,anonymize_ip:c.context.anonymizeIP,enrich_decisions:!0,visitors:[f]}}t.buildImpressionEventV1=E;function g(c){var f=l(c);return f.snapshots.push(s(c)),{client_name:c.context.clientName,client_version:c.context.clientVersion,account_id:c.context.accountId,project_id:c.context.projectId,revision:c.context.revision,anonymize_ip:c.context.anonymizeIP,enrich_decisions:!0,visitors:[f]}}t.buildConversionEventV1=g});C(ne),ne.makeBatchedEventV1,ne.buildImpressionEventV1,ne.buildConversionEventV1;var ut=b(function(e,t){var r=w&&w.__extends||function(){var i=function(a,o){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,u){s.__proto__=u}||function(s,u){for(var l in u)u.hasOwnProperty(l)&&(s[l]=u[l])},i(a,o)};return function(a,o){i(a,o);function s(){this.constructor=a}a.prototype=o===null?Object.create(o):(s.prototype=o.prototype,new s)}}();Object.defineProperty(t,"__esModule",{value:!0});var n=function(i){r(a,i);function a(){return i!==null&&i.apply(this,arguments)||this}return a.prototype.formatEvents=function(o){return{url:"https://logx.optimizely.com/v1/events",httpVerb:"POST",params:ne.makeBatchedEventV1(o)}},a}(Ue.AbstractEventProcessor);t.LogTierV1EventProcessor=n});C(ut),ut.LogTierV1EventProcessor;var lt=b(function(e,t){function r(n){for(var i in n)t.hasOwnProperty(i)||(t[i]=n[i])}Object.defineProperty(t,"__esModule",{value:!0}),r(Le),r(Ue),r(De),r(ne),r(ut)});C(lt);var bn=lt.LogTierV1EventProcessor,Cn=lt.LocalStoragePendingEventsDispatcher,Pn=b(function(e){(function(){function t(i,a){for(var o=i.length,s=a^o,u=0,l;o>=4;)l=i.charCodeAt(u)&255|(i.charCodeAt(++u)&255)<<8|(i.charCodeAt(++u)&255)<<16|(i.charCodeAt(++u)&255)<<24,l=(l&65535)*1540483477+(((l>>>16)*1540483477&65535)<<16),l^=l>>>24,l=(l&65535)*1540483477+(((l>>>16)*1540483477&65535)<<16),s=(s&65535)*1540483477+(((s>>>16)*1540483477&65535)<<16)^l,o-=4,++u;switch(o){case 3:s^=(i.charCodeAt(u+2)&255)<<16;case 2:s^=(i.charCodeAt(u+1)&255)<<8;case 1:s^=i.charCodeAt(u)&255,s=(s&65535)*1540483477+(((s>>>16)*1540483477&65535)<<16)}return s^=s>>>13,s=(s&65535)*1540483477+(((s>>>16)*1540483477&65535)<<16),s^=s>>>15,s>>>0}function r(i,a){var o,s,u,l,E,g,c,f;for(o=i.length&3,s=i.length-o,u=a,E=3432918353,g=461845907,f=0;f<s;)c=i.charCodeAt(f)&255|(i.charCodeAt(++f)&255)<<8|(i.charCodeAt(++f)&255)<<16|(i.charCodeAt(++f)&255)<<24,++f,c=(c&65535)*E+(((c>>>16)*E&65535)<<16)&4294967295,c=c<<15|c>>>17,c=(c&65535)*g+(((c>>>16)*g&65535)<<16)&4294967295,u^=c,u=u<<13|u>>>19,l=(u&65535)*5+(((u>>>16)*5&65535)<<16)&4294967295,u=(l&65535)+27492+(((l>>>16)+58964&65535)<<16);switch(c=0,o){case 3:c^=(i.charCodeAt(f+2)&255)<<16;case 2:c^=(i.charCodeAt(f+1)&255)<<8;case 1:c^=i.charCodeAt(f)&255,c=(c&65535)*E+(((c>>>16)*E&65535)<<16)&4294967295,c=c<<15|c>>>17,c=(c&65535)*g+(((c>>>16)*g&65535)<<16)&4294967295,u^=c}return u^=i.length,u^=u>>>16,u=(u&65535)*2246822507+(((u>>>16)*2246822507&65535)<<16)&4294967295,u^=u>>>13,u=(u&65535)*3266489909+(((u>>>16)*3266489909&65535)<<16)&4294967295,u^=u>>>16,u>>>0}var n=r;n.v2=t,n.v3=r,e.exports=n})()}),G=b(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_UPDATE_INTERVAL=5*60*1e3,t.MIN_UPDATE_INTERVAL=1e3,t.DEFAULT_URL_TEMPLATE="https://cdn.optimizely.com/datafiles/%s.json",t.BACKOFF_BASE_WAIT_SECONDS_BY_ERROR_COUNT=[0,8,16,32,64,128,256,512],t.REQUEST_TIMEOUT_MS=60*1e3});C(G),G.DEFAULT_UPDATE_INTERVAL,G.MIN_UPDATE_INTERVAL,G.DEFAULT_URL_TEMPLATE,G.BACKOFF_BASE_WAIT_SECONDS_BY_ERROR_COUNT,G.REQUEST_TIMEOUT_MS;var ct=b(function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r=j.getLogger("DatafileManager"),n="GET",i=4;function a(u){var l=u.getAllResponseHeaders();if(l===null)return{};var E=l.split(`\r
  3. `),g={};return E.forEach(function(c){var f=c.indexOf(": ");if(f>-1){var _=c.slice(0,f),p=c.slice(f+2);p.length>0&&(g[_]=p)}}),g}function o(u,l){Object.keys(u).forEach(function(E){var g=u[E];l.setRequestHeader(E,g)})}function s(u,l){var E=new XMLHttpRequest,g=new Promise(function(c,f){E.open(n,u,!0),o(l,E),E.onreadystatechange=function(){if(E.readyState===i){var _=E.status;if(_===0){f(new Error("Request error"));return}var p=a(E),h={statusCode:E.status,body:E.responseText,headers:p};c(h)}},E.timeout=G.REQUEST_TIMEOUT_MS,E.ontimeout=function(){r.error("Request timed out")},E.send()});return{responsePromise:g,abort:function(){E.abort()}}}t.makeGetRequest=s});C(ct),ct.makeGetRequest;var Wt=b(function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function n(){this.listeners={},this.listenerId=1}return n.prototype.on=function(i,a){var o=this;this.listeners[i]||(this.listeners[i]={});var s=String(this.listenerId);return this.listenerId++,this.listeners[i][s]=a,function(){o.listeners[i]&&delete o.listeners[i][s]}},n.prototype.emit=function(i,a){var o=this.listeners[i];o&&Object.keys(o).forEach(function(s){var u=o[s];u(a)})},n.prototype.removeAllListeners=function(){this.listeners={}},n}();t.default=r});C(Wt);var zt=b(function(e,t){Object.defineProperty(t,"__esModule",{value:!0});function r(){return Math.round(Math.random()*1e3)}var n=function(){function i(){this.errorCount=0}return i.prototype.getDelay=function(){if(this.errorCount===0)return 0;var a=G.BACKOFF_BASE_WAIT_SECONDS_BY_ERROR_COUNT[Math.min(G.BACKOFF_BASE_WAIT_SECONDS_BY_ERROR_COUNT.length-1,this.errorCount)];return a*1e3+r()},i.prototype.countError=function(){this.errorCount<G.BACKOFF_BASE_WAIT_SECONDS_BY_ERROR_COUNT.length-1&&this.errorCount++},i.prototype.reset=function(){this.errorCount=0},i}();t.default=n});C(zt);var Xt=b(function(e,t){var r=w&&w.__assign||function(){return r=Object.assign||function(c){for(var f,_=1,p=arguments.length;_<p;_++){f=arguments[_];for(var h in f)Object.prototype.hasOwnProperty.call(f,h)&&(c[h]=f[h])}return c},r.apply(this,arguments)},n=w&&w.__importDefault||function(c){return c&&c.__esModule?c:{default:c}};Object.defineProperty(t,"__esModule",{value:!0});var i=n(Wt),a=n(zt),o=j.getLogger("DatafileManager"),s="update";function u(c){return c>=G.MIN_UPDATE_INTERVAL}function l(c){return c>=200&&c<400}var E={get:function(){return Promise.resolve(null)},set:function(){return Promise.resolve()},contains:function(){return Promise.resolve(!1)},remove:function(){return Promise.resolve()}},g=function(){function c(f){var _=this,p=r({},this.getConfigDefaults(),f),h=p.datafile,I=p.autoUpdate,T=I===void 0?!1:I,X=p.sdkKey,Ie=p.updateInterval,At=Ie===void 0?G.DEFAULT_UPDATE_INTERVAL:Ie,qr=p.urlTemplate,Ki=qr===void 0?G.DEFAULT_URL_TEMPLATE:qr,Yr=p.cache,ji=Yr===void 0?E:Yr;this.cache=ji,this.cacheKey="opt-datafile-"+X,this.isReadyPromiseSettled=!1,this.readyPromiseResolver=function(){},this.readyPromiseRejecter=function(){},this.readyPromise=new Promise(function(Hi,qi){_.readyPromiseResolver=Hi,_.readyPromiseRejecter=qi}),h?(this.currentDatafile=h,X||this.resolveReadyPromise()):this.currentDatafile=null,this.isStarted=!1,this.datafileUrl=V.sprintf(Ki,X),this.emitter=new i.default,this.autoUpdate=T,u(At)?this.updateInterval=At:(o.warn("Invalid updateInterval %s, defaulting to %s",At,G.DEFAULT_UPDATE_INTERVAL),this.updateInterval=G.DEFAULT_UPDATE_INTERVAL),this.currentTimeout=null,this.currentRequest=null,this.backoffController=new a.default,this.syncOnCurrentRequestComplete=!1}return c.prototype.get=function(){return this.currentDatafile},c.prototype.start=function(){this.isStarted||(o.debug("Datafile manager started"),this.isStarted=!0,this.backoffController.reset(),this.setDatafileFromCacheIfAvailable(),this.syncDatafile())},c.prototype.stop=function(){return o.debug("Datafile manager stopped"),this.isStarted=!1,this.currentTimeout&&(clearTimeout(this.currentTimeout),this.currentTimeout=null),this.emitter.removeAllListeners(),this.currentRequest&&(this.currentRequest.abort(),this.currentRequest=null),Promise.resolve()},c.prototype.onReady=function(){return this.readyPromise},c.prototype.on=function(f,_){return this.emitter.on(f,_)},c.prototype.onRequestRejected=function(f){!this.isStarted||(this.backoffController.countError(),f instanceof Error?o.error("Error fetching datafile: %s",f.message,f):typeof f=="string"?o.error("Error fetching datafile: %s",f):o.error("Error fetching datafile"))},c.prototype.onRequestResolved=function(f){if(!!this.isStarted){typeof f.statusCode!="undefined"&&l(f.statusCode)?this.backoffController.reset():this.backoffController.countError(),this.trySavingLastModified(f.headers);var _=this.getNextDatafileFromResponse(f);if(_!==null)if(o.info("Updating datafile from response"),this.currentDatafile=_,this.cache.set(this.cacheKey,_),!this.isReadyPromiseSettled)this.resolveReadyPromise();else{var p={datafile:_};this.emitter.emit(s,p)}}},c.prototype.onRequestComplete=function(){!this.isStarted||(this.currentRequest=null,!this.isReadyPromiseSettled&&!this.autoUpdate&&this.rejectReadyPromise(new Error("Failed to become ready")),this.autoUpdate&&this.syncOnCurrentRequestComplete&&this.syncDatafile(),this.syncOnCurrentRequestComplete=!1)},c.prototype.syncDatafile=function(){var f=this,_={};this.lastResponseLastModified&&(_["if-modified-since"]=this.lastResponseLastModified),o.debug("Making datafile request to url %s with headers: %s",this.datafileUrl,function(){return JSON.stringify(_)}),this.currentRequest=this.makeGetRequest(this.datafileUrl,_);var p=function(){f.onRequestComplete()},h=function(T){f.onRequestResolved(T)},I=function(T){f.onRequestRejected(T)};this.currentRequest.responsePromise.then(h,I).then(p,p),this.autoUpdate&&this.scheduleNextUpdate()},c.prototype.resolveReadyPromise=function(){this.readyPromiseResolver(),this.isReadyPromiseSettled=!0},c.prototype.rejectReadyPromise=function(f){this.readyPromiseRejecter(f),this.isReadyPromiseSettled=!0},c.prototype.scheduleNextUpdate=function(){var f=this,_=this.backoffController.getDelay(),p=Math.max(_,this.updateInterval);o.debug("Scheduling sync in %s ms",p),this.currentTimeout=setTimeout(function(){f.currentRequest?f.syncOnCurrentRequestComplete=!0:f.syncDatafile()},p)},c.prototype.getNextDatafileFromResponse=function(f){return o.debug("Response status code: %s",f.statusCode),typeof f.statusCode=="undefined"||f.statusCode===304?null:l(f.statusCode)?this.tryParsingBodyAsJSON(f.body):null},c.prototype.tryParsingBodyAsJSON=function(f){var _;try{_=JSON.parse(f)}catch(h){return o.error("Error parsing response body: %s",h.message,h),null}var p=null;return typeof _=="object"&&_!==null?p=_:o.error("Error parsing response body: was not an object"),p},c.prototype.trySavingLastModified=function(f){var _=f["last-modified"]||f["Last-Modified"];typeof _!="undefined"&&(this.lastResponseLastModified=_,o.debug("Saved last modified header value from response: %s",this.lastResponseLastModified))},c.prototype.setDatafileFromCacheIfAvailable=function(){var f=this;this.cache.get(this.cacheKey).then(function(_){f.isStarted&&!f.isReadyPromiseSettled&&_&&(o.debug("Using datafile from cache"),f.currentDatafile=_,f.resolveReadyPromise())})},c}();t.default=g});C(Xt);var $t=b(function(e,t){var r=w&&w.__extends||function(){var o=function(s,u){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(l,E){l.__proto__=E}||function(l,E){for(var g in E)E.hasOwnProperty(g)&&(l[g]=E[g])},o(s,u)};return function(s,u){o(s,u);function l(){this.constructor=s}s.prototype=u===null?Object.create(u):(l.prototype=u.prototype,new l)}}(),n=w&&w.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(t,"__esModule",{value:!0});var i=n(Xt),a=function(o){r(s,o);function s(){return o!==null&&o.apply(this,arguments)||this}return s.prototype.makeGetRequest=function(u,l){return ct.makeGetRequest(u,l)},s.prototype.getConfigDefaults=function(){return{autoUpdate:!1}},s}(i.default);t.default=a});C($t);var Jt=b(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.HttpPollingDatafileManager=$t.default});C(Jt);var Vn=Jt.HttpPollingDatafileManager,xn=Math.pow(2,53),ft=function(e){return typeof e=="number"&&Math.abs(e)<=xn},K=function(e){if(!e)return{};if(typeof Object.assign=="function")return Object.assign.apply(Object,arguments);for(var t=Object(e),r=1;r<arguments.length;r++){var n=arguments[r];if(n!=null)for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},be=function(){return Math.round(new Date().getTime())},J=ft,H=function(e,t){return e?An(e,function(r){return r[t]}):{}},Ce=function(){return Ht.v4()},ie=function(e){return typeof e=="number"},v={NOTSET:0,DEBUG:1,INFO:2,WARNING:3,ERROR:4},S={CONDITION_EVALUATOR_ERROR:"%s: Error evaluating audience condition of type %s: %s",DATAFILE_AND_SDK_KEY_MISSING:"%s: You must provide at least one of sdkKey or datafile. Cannot start Optimizely",EXPERIMENT_KEY_NOT_IN_DATAFILE:"%s: Experiment key %s is not in datafile.",FEATURE_NOT_IN_DATAFILE:"%s: Feature key %s is not in datafile.",IMPROPERLY_FORMATTED_EXPERIMENT:"%s: Experiment key %s is improperly formatted.",INVALID_ATTRIBUTES:"%s: Provided attributes are in an invalid format.",INVALID_BUCKETING_ID:"%s: Unable to generate hash for bucketing ID %s: %s",INVALID_DATAFILE:"%s: Datafile is invalid - property %s: %s",INVALID_DATAFILE_MALFORMED:"%s: Datafile is invalid because it is malformed.",INVALID_JSON:"%s: JSON object is not valid.",INVALID_ERROR_HANDLER:'%s: Provided "errorHandler" is in an invalid format.',INVALID_EVENT_DISPATCHER:'%s: Provided "eventDispatcher" is in an invalid format.',INVALID_EVENT_TAGS:"%s: Provided event tags are in an invalid format.",INVALID_EXPERIMENT_KEY:"%s: Experiment key %s is not in datafile. It is either invalid, paused, or archived.",INVALID_EXPERIMENT_ID:"%s: Experiment ID %s is not in datafile.",INVALID_GROUP_ID:"%s: Group ID %s is not in datafile.",INVALID_LOGGER:'%s: Provided "logger" is in an invalid format.',INVALID_ROLLOUT_ID:"%s: Invalid rollout ID %s attached to feature %s",INVALID_USER_ID:"%s: Provided user ID is in an invalid format.",INVALID_USER_PROFILE_SERVICE:"%s: Provided user profile service instance is in an invalid format: %s.",NO_DATAFILE_SPECIFIED:"%s: No datafile specified. Cannot start optimizely.",NO_JSON_PROVIDED:"%s: No JSON object to validate against schema.",NO_VARIATION_FOR_EXPERIMENT_KEY:"%s: No variation key %s defined in datafile for experiment %s.",UNDEFINED_ATTRIBUTE:"%s: Provided attribute: %s has an undefined value.",UNRECOGNIZED_ATTRIBUTE:"%s: Unrecognized attribute %s provided. Pruning before sending event to Optimizely.",UNABLE_TO_CAST_VALUE:"%s: Unable to cast value %s to type %s, returning null.",USER_NOT_IN_FORCED_VARIATION:"%s: User %s is not in the forced variation map. Cannot remove their forced variation.",USER_PROFILE_LOOKUP_ERROR:'%s: Error while looking up user profile for user ID "%s": %s.',USER_PROFILE_SAVE_ERROR:'%s: Error while saving user profile for user ID "%s": %s.',VARIABLE_KEY_NOT_IN_DATAFILE:'%s: Variable with key "%s" associated with feature with key "%s" is not in datafile.',VARIATION_ID_NOT_IN_DATAFILE:"%s: No variation ID %s defined in datafile for experiment %s.",VARIATION_ID_NOT_IN_DATAFILE_NO_EXPERIMENT:"%s: Variation ID %s is not in the datafile.",INVALID_INPUT_FORMAT:"%s: Provided %s is in an invalid format.",INVALID_DATAFILE_VERSION:"%s: This version of the JavaScript SDK does not support the given datafile version: %s",INVALID_VARIATION_KEY:"%s: Provided variation key is in an invalid format."},O={ACTIVATE_USER:"%s: Activating user %s in experiment %s.",DISPATCH_CONVERSION_EVENT:"%s: Dispatching conversion event to URL %s with params %s.",DISPATCH_IMPRESSION_EVENT:"%s: Dispatching impression event to URL %s with params %s.",DEPRECATED_EVENT_VALUE:"%s: Event value is deprecated in %s call.",EVENT_KEY_NOT_FOUND:"%s: Event key %s is not in datafile.",EXPERIMENT_NOT_RUNNING:"%s: Experiment %s is not running.",FEATURE_ENABLED_FOR_USER:"%s: Feature %s is enabled for user %s.",FEATURE_NOT_ENABLED_FOR_USER:"%s: Feature %s is not enabled for user %s.",FEATURE_HAS_NO_EXPERIMENTS:"%s: Feature %s is not attached to any experiments.",FAILED_TO_PARSE_VALUE:'%s: Failed to parse event value "%s" from event tags.',FAILED_TO_PARSE_REVENUE:'%s: Failed to parse revenue value "%s" from event tags.',FORCED_BUCKETING_FAILED:"%s: Variation key %s is not in datafile. Not activating user %s.",INVALID_OBJECT:"%s: Optimizely object is not valid. Failing %s.",INVALID_CLIENT_ENGINE:"%s: Invalid client engine passed: %s. Defaulting to node-sdk.",INVALID_VARIATION_ID:"%s: Bucketed into an invalid variation ID. Returning null.",NOTIFICATION_LISTENER_EXCEPTION:"%s: Notification listener for (%s) threw exception: %s",NO_ROLLOUT_EXISTS:"%s: There is no rollout of feature %s.",NOT_ACTIVATING_USER:"%s: Not activating user %s for experiment %s.",NOT_TRACKING_USER:"%s: Not tracking user %s.",PARSED_REVENUE_VALUE:'%s: Parsed revenue value "%s" from event tags.',PARSED_NUMERIC_VALUE:'%s: Parsed event value "%s" from event tags.',RETURNING_STORED_VARIATION:'%s: Returning previously activated variation "%s" of experiment "%s" for user "%s" from user profile.',ROLLOUT_HAS_NO_EXPERIMENTS:"%s: Rollout of feature %s has no experiments",SAVED_VARIATION:'%s: Saved variation "%s" of experiment "%s" for user "%s".',SAVED_VARIATION_NOT_FOUND:"%s: User %s was previously bucketed into variation with ID %s for experiment %s, but no matching variation was found.",SHOULD_NOT_DISPATCH_ACTIVATE:'%s: Experiment %s is not in "Running" state. Not activating user.',SKIPPING_JSON_VALIDATION:"%s: Skipping JSON schema validation.",TRACK_EVENT:"%s: Tracking event %s for user %s.",USER_ASSIGNED_TO_VARIATION_BUCKET:"%s: Assigned variation bucket %s to user %s.",USER_ASSIGNED_TO_EXPERIMENT_BUCKET:"%s: Assigned experiment bucket %s to user %s.",USER_BUCKETED_INTO_EXPERIMENT_IN_GROUP:"%s: User %s is in experiment %s of group %s.",USER_BUCKETED_INTO_TARGETING_RULE:"%s: User %s bucketed into targeting rule %s.",USER_IN_FEATURE_EXPERIMENT:"%s: User %s is in variation %s of experiment %s on the feature %s.",USER_IN_ROLLOUT:"%s: User %s is in rollout of feature %s.",USER_BUCKETED_INTO_EVERYONE_TARGETING_RULE:"%s: User %s bucketed into everyone targeting rule.",USER_NOT_BUCKETED_INTO_EVERYONE_TARGETING_RULE:"%s: User %s not bucketed into everyone targeting rule due to traffic allocation.",USER_NOT_BUCKETED_INTO_EXPERIMENT_IN_GROUP:"%s: User %s is not in experiment %s of group %s.",USER_NOT_BUCKETED_INTO_ANY_EXPERIMENT_IN_GROUP:"%s: User %s is not in any experiment of group %s.",USER_NOT_BUCKETED_INTO_TARGETING_RULE:"%s User %s not bucketed into targeting rule %s due to traffic allocation. Trying everyone rule.",USER_NOT_IN_FEATURE_EXPERIMENT:"%s: User %s is not in any experiment on the feature %s.",USER_NOT_IN_ROLLOUT:"%s: User %s is not in rollout of feature %s.",USER_FORCED_IN_VARIATION:"%s: User %s is forced in variation %s.",USER_MAPPED_TO_FORCED_VARIATION:"%s: Set variation %s for experiment %s and user %s in the forced variation map.",USER_DOESNT_MEET_CONDITIONS_FOR_TARGETING_RULE:"%s: User %s does not meet conditions for targeting rule %s.",USER_MEETS_CONDITIONS_FOR_TARGETING_RULE:"%s: User %s meets conditions for targeting rule %s.",USER_HAS_VARIATION:"%s: User %s is in variation %s of experiment %s.",USER_HAS_FORCED_VARIATION:"%s: Variation %s is mapped to experiment %s and user %s in the forced variation map.",USER_HAS_NO_VARIATION:"%s: User %s is in no variation of experiment %s.",USER_HAS_NO_FORCED_VARIATION:"%s: User %s is not in the forced variation map.",USER_HAS_NO_FORCED_VARIATION_FOR_EXPERIMENT:"%s: No experiment %s mapped to user %s in the forced variation map.",USER_NOT_IN_ANY_EXPERIMENT:"%s: User %s is not in any experiment of group %s.",USER_NOT_IN_EXPERIMENT:"%s: User %s does not meet conditions to be in experiment %s.",USER_RECEIVED_DEFAULT_VARIABLE_VALUE:'%s: User "%s" is not in any variation or rollout rule. Returning default value for variable "%s" of feature flag "%s".',FEATURE_NOT_ENABLED_RETURN_DEFAULT_VARIABLE_VALUE:'%s: Feature "%s" is not enabled for user %s. Returning default value for variable "%s".',VARIABLE_NOT_USED_RETURN_DEFAULT_VARIABLE_VALUE:'%s: Variable "%s" is not used in variation "%s". Returning default value.',USER_RECEIVED_VARIABLE_VALUE:'%s: Value for variable "%s" of feature flag "%s" is %s for user "%s"',VALID_DATAFILE:"%s: Datafile is valid.",VALID_USER_PROFILE_SERVICE:"%s: Valid user profile service provided.",VARIATION_REMOVED_FOR_USER:"%s: Variation mapped to experiment %s has been removed for user %s.",VARIABLE_REQUESTED_WITH_WRONG_TYPE:'%s: Requested variable type "%s", but variable is of type "%s". Use correct API to retrieve value. Returning None.',VALID_BUCKETING_ID:'%s: BucketingId is valid: "%s"',BUCKETING_ID_NOT_STRING:"%s: BucketingID attribute is not a string. Defaulted to userId",EVALUATING_AUDIENCE:'%s: Starting to evaluate audience "%s" with conditions: %s.',EVALUATING_AUDIENCES_COMBINED:'%s: Evaluating audiences for experiment "%s": %s.',AUDIENCE_EVALUATION_RESULT:'%s: Audience "%s" evaluated to %s.',AUDIENCE_EVALUATION_RESULT_COMBINED:"%s: Audiences for experiment %s collectively evaluated to %s.",MISSING_ATTRIBUTE_VALUE:'%s: Audience condition %s evaluated to UNKNOWN because no value was passed for user attribute "%s".',UNEXPECTED_CONDITION_VALUE:"%s: Audience condition %s evaluated to UNKNOWN because the condition value is not supported.",UNEXPECTED_TYPE:'%s: Audience condition %s evaluated to UNKNOWN because a value of type "%s" was passed for user attribute "%s".',UNEXPECTED_TYPE_NULL:'%s: Audience condition %s evaluated to UNKNOWN because a null value was passed for user attribute "%s".',UNKNOWN_CONDITION_TYPE:"%s: Audience condition %s has an unknown condition type. You may need to upgrade to a newer release of the Optimizely SDK.",UNKNOWN_MATCH_TYPE:"%s: Audience condition %s uses an unknown match type. You may need to upgrade to a newer release of the Optimizely SDK.",UPDATED_OPTIMIZELY_CONFIG:"%s: Updated Optimizely config to revision %s (project id %s)",OUT_OF_BOUNDS:'%s: Audience condition %s evaluated to UNKNOWN because the number value for user attribute "%s" is not in the range [-2^53, +2^53].',UNABLE_TO_ATTACH_UNLOAD:'%s: unable to bind optimizely.close() to page unload event: "%s"'},dt={REVENUE:"revenue",VALUE:"value"},Pe=Sn,Ve={BOOLEAN:"boolean",DOUBLE:"double",INTEGER:"integer",STRING:"string"},xe={V2:"2",V3:"3",V4:"4"},L={LOG_LEVEL:v,ERROR_MESSAGES:S,LOG_MESSAGES:O,RESERVED_EVENT_KEYWORDS:dt,CONTROL_ATTRIBUTES:{BOT_FILTERING:"$opt_bot_filtering",BUCKETING_ID:"$opt_bucketing_id",STICKY_BUCKETING_KEY:"$opt_experiment_bucket_map",USER_AGENT:"$opt_user_agent"},JAVASCRIPT_CLIENT_ENGINE:"javascript-sdk",NODE_CLIENT_ENGINE:"node-sdk",REACT_CLIENT_ENGINE:"react-sdk",NODE_CLIENT_VERSION:"4.0.0",VALID_CLIENT_ENGINES:["node-sdk","react-sdk","javascript-sdk"],NOTIFICATION_TYPES:Pe,DECISION_NOTIFICATION_TYPES:{AB_TEST:"ab-test",FEATURE:"feature",FEATURE_TEST:"feature-test",FEATURE_VARIABLE:"feature-variable"},DECISION_SOURCES:{FEATURE_TEST:"feature-test",ROLLOUT:"rollout"},FEATURE_VARIABLE_TYPES:Ve,DATAFILE_VERSIONS:xe},oe="CONFIG_VALIDATOR",Mn=[xe.V2,xe.V3,xe.V4],Fn=function(e){if(e.errorHandler&&typeof e.errorHandler.handleError!="function")throw new Error(d(S.INVALID_ERROR_HANDLER,oe));if(e.eventDispatcher&&typeof e.eventDispatcher.dispatchEvent!="function")throw new Error(d(S.INVALID_EVENT_DISPATCHER,oe));if(e.logger&&typeof e.logger.log!="function")throw new Error(d(S.INVALID_LOGGER,oe));return!0},Zt=function(e){if(!e)throw new Error(d(S.NO_DATAFILE_SPECIFIED,oe));if(typeof e=="string"||e instanceof String)try{e=JSON.parse(e)}catch(t){throw new Error(d(S.INVALID_DATAFILE_MALFORMED,oe))}if(Mn.indexOf(e.version)===-1)throw new Error(d(S.INVALID_DATAFILE_VERSION,oe,e.version));return!0},kn={handleError:function(){}},wn=function(e){return Object.keys(e).map(function(t){return encodeURIComponent(t)+"="+encodeURIComponent(e[t])}).join("&")},Qt={dispatchEvent:function(e,t){var r,n=e.url,i=e.params;e.httpVerb==="POST"?((r=new XMLHttpRequest).open("POST",n,!0),r.setRequestHeader("Content-Type","application/json"),r.onreadystatechange=function(){if(r.readyState===4&&t&&typeof t=="function")try{t(i)}catch(a){}},r.send(JSON.stringify(i))):(n+="?wxhr=true",i&&(n+="&"+wn(i)),(r=new XMLHttpRequest).open("GET",n,!0),r.onreadystatechange=function(){if(r.readyState===4&&t&&typeof t=="function")try{t()}catch(a){}},r.send())}};function er(){}er.prototype.log=function(){};var tr={createLogger:function(e){return new Ln(e)},createNoOpLogger:function(){return new er}},Bn=function(e){if(typeof e!="object"||Array.isArray(e)||e===null)throw new Error(d(S.INVALID_ATTRIBUTES,"ATTRIBUTES_VALIDATOR"));return Object.keys(e).forEach(function(t){if(e[t]===void 0)throw new Error(d(S.UNDEFINED_ATTRIBUTE,"ATTRIBUTES_VALIDATOR",t))}),!0},rr=function(e,t){return typeof e=="string"&&(typeof t=="string"||typeof t=="boolean"||ie(t)&&J(t))},Gn=Math.pow(2,32),Me={bucket:function(e){var t=e.experimentKeyMap[e.experimentKey].groupId;if(t){var r=e.groupIdMap[t];if(!r)throw new Error(d(S.INVALID_GROUP_ID,"BUCKETER",t));if(r.policy==="random"){var n=this.bucketUserIntoExperiment(r,e.bucketingId,e.userId,e.logger);if(n===null){var i=d(O.USER_NOT_IN_ANY_EXPERIMENT,"BUCKETER",e.userId,t);return e.logger.log(v.INFO,i),null}if(n!==e.experimentId){var a=d(O.USER_NOT_BUCKETED_INTO_EXPERIMENT_IN_GROUP,"BUCKETER",e.userId,e.experimentKey,t);return e.logger.log(v.INFO,a),null}var o=d(O.USER_BUCKETED_INTO_EXPERIMENT_IN_GROUP,"BUCKETER",e.userId,e.experimentKey,t);e.logger.log(v.INFO,o)}}var s=d("%s%s",e.bucketingId,e.experimentId),u=this._generateBucketValue(s),l=d(O.USER_ASSIGNED_TO_VARIATION_BUCKET,"BUCKETER",u,e.userId);e.logger.log(v.DEBUG,l);var E=this._findBucket(u,e.trafficAllocationConfig);if(E){if(!e.variationIdMap.hasOwnProperty(E)){var g=d(O.INVALID_VARIATION_ID,"BUCKETER");return e.logger.log(v.WARNING,g),null}var c=e.variationIdMap[E].key,f=d(O.USER_HAS_VARIATION,"BUCKETER",e.userId,c,e.experimentKey);e.logger.log(v.INFO,f)}else{var _=d(O.USER_HAS_NO_VARIATION,"BUCKETER",e.userId,e.experimentKey);e.logger.log(v.DEBUG,_)}return E},bucketUserIntoExperiment:function(e,t,r,n){var i=d("%s%s",t,e.id),a=this._generateBucketValue(i);n.log(v.DEBUG,d(O.USER_ASSIGNED_TO_EXPERIMENT_BUCKET,"BUCKETER",a,r));var o=e.trafficAllocation;return this._findBucket(a,o)},_findBucket:function(e,t){for(var r=0;r<t.length;r++)if(e<t[r].endOfRange)return t[r].entityId;return null},_generateBucketValue:function(e){try{var t=Pn.v3(e,1);return parseInt(1e4*(t/Gn),10)}catch(r){throw new Error(d(S.INVALID_BUCKETING_ID,"BUCKETER",e,r.message))}}},F="PROJECT_CONFIG",nr=function(e,t){return e.experimentFeatureMap.hasOwnProperty(t)},N={createProjectConfig:function(e){var t=function(r){var n=K({},r);return n.audiences=(r.audiences||[]).map(function(i){return K({},i)}),n.experiments=(r.experiments||[]).map(function(i){return K({},i)}),n.featureFlags=(r.featureFlags||[]).map(function(i){return K({},i)}),n.groups=(r.groups||[]).map(function(i){var a=K({},i);return a.experiments=(i.experiments||[]).map(function(o){return K({},o)}),a}),n.rollouts=(r.rollouts||[]).map(function(i){var a=K({},i);return a.experiments=(i.experiments||[]).map(function(o){return K({},o)}),a}),n}(e);return(t.audiences||[]).forEach(function(r){r.conditions=JSON.parse(r.conditions)}),t.audiencesById=H(t.audiences,"id"),K(t.audiencesById,H(t.typedAudiences,"id")),t.attributeKeyMap=H(t.attributes,"key"),t.eventKeyMap=H(t.events,"key"),t.groupIdMap=H(t.groups,"id"),Object.keys(t.groupIdMap||{}).forEach(function(r){(t.groupIdMap[r].experiments||[]).forEach(function(n){t.experiments.push(K(n,{groupId:r}))})}),t.rolloutIdMap=H(t.rollouts||[],"id"),ee(t.rolloutIdMap||{}).forEach(function(r){(r.experiments||[]).forEach(function(n){t.experiments.push(n),n.variationKeyMap=H(n.variations,"key")})}),t.experimentKeyMap=H(t.experiments,"key"),t.experimentIdMap=H(t.experiments,"id"),t.variationIdMap={},t.variationVariableUsageMap={},(t.experiments||[]).forEach(function(r){r.variationKeyMap=H(r.variations,"key"),K(t.variationIdMap,H(r.variations,"id")),ee(r.variationKeyMap||{}).forEach(function(n){n.variables&&(t.variationVariableUsageMap[n.id]=H(n.variables,"id"))})}),t.experimentFeatureMap={},t.featureKeyMap=H(t.featureFlags||[],"key"),ee(t.featureKeyMap||{}).forEach(function(r){r.variableKeyMap=H(r.variables,"key"),(r.experimentIds||[]).forEach(function(n){t.experimentFeatureMap[n]?t.experimentFeatureMap[n].push(r.id):t.experimentFeatureMap[n]=[r.id];var i=t.experimentIdMap[n];i.groupId&&!r.groupId&&(r.groupId=i.groupId)})}),t},getExperimentId:function(e,t){var r=e.experimentKeyMap[t];if(!r)throw new Error(d(S.INVALID_EXPERIMENT_KEY,F,t));return r.id},getLayerId:function(e,t){var r=e.experimentIdMap[t];if(!r)throw new Error(d(S.INVALID_EXPERIMENT_ID,F,t));return r.layerId},getAttributeId:function(e,t,r){var n=e.attributeKeyMap[t],i=t.indexOf("$opt_")===0;return n?(i&&r.log(v.WARN,d("Attribute %s unexpectedly has reserved prefix %s; using attribute ID instead of reserved attribute name.",t,"$opt_")),n.id):i?t:(r.log(v.DEBUG,d(S.UNRECOGNIZED_ATTRIBUTE,F,t)),null)},getEventId:function(e,t){var r=e.eventKeyMap[t];return r?r.id:null},getExperimentStatus:function(e,t){var r=e.experimentKeyMap[t];if(!r)throw new Error(d(S.INVALID_EXPERIMENT_KEY,F,t));return r.status},isActive:function(e,t){return this.getExperimentStatus(e,t)==="Running"},isRunning:function(e,t){return this.getExperimentStatus(e,t)==="Running"},getExperimentAudienceConditions:function(e,t){var r=e.experimentKeyMap[t];if(!r)throw new Error(d(S.INVALID_EXPERIMENT_KEY,F,t));return r.audienceConditions||r.audienceIds},getVariationKeyFromId:function(e,t){return e.variationIdMap.hasOwnProperty(t)?e.variationIdMap[t].key:null},getVariationIdFromExperimentAndVariationKey:function(e,t,r){var n=e.experimentKeyMap[t];return n.variationKeyMap.hasOwnProperty(r)?n.variationKeyMap[r].id:null},getExperimentFromKey:function(e,t){if(e.experimentKeyMap.hasOwnProperty(t)){var r=e.experimentKeyMap[t];if(r)return r}throw new Error(d(S.EXPERIMENT_KEY_NOT_IN_DATAFILE,F,t))},getTrafficAllocation:function(e,t){var r=e.experimentKeyMap[t];if(!r)throw new Error(d(S.INVALID_EXPERIMENT_KEY,F,t));return r.trafficAllocation},getExperimentFromId:function(e,t,r){if(e.experimentIdMap.hasOwnProperty(t)){var n=e.experimentIdMap[t];if(n)return n}return r.log(v.ERROR,d(S.INVALID_EXPERIMENT_ID,F,t)),null},getFeatureFromKey:function(e,t,r){if(e.featureKeyMap.hasOwnProperty(t)){var n=e.featureKeyMap[t];if(n)return n}return r.log(v.ERROR,d(S.FEATURE_NOT_IN_DATAFILE,F,t)),null},getVariableForFeature:function(e,t,r,n){var i=e.featureKeyMap[t];if(!i)return n.log(v.ERROR,d(S.FEATURE_NOT_IN_DATAFILE,F,t)),null;var a=i.variableKeyMap[r];return a||(n.log(v.ERROR,d(S.VARIABLE_KEY_NOT_IN_DATAFILE,F,r,t)),null)},getVariableValueForVariation:function(e,t,r,n){if(!t||!r)return null;if(!e.variationVariableUsageMap.hasOwnProperty(r.id))return n.log(v.ERROR,d(S.VARIATION_ID_NOT_IN_DATAFILE_NO_EXPERIMENT,F,r.id)),null;var i=e.variationVariableUsageMap[r.id][t.id];return i?i.value:null},getTypeCastValue:function(e,t,r){var n;switch(t){case Ve.BOOLEAN:e!=="true"&&e!=="false"?(r.log(v.ERROR,d(S.UNABLE_TO_CAST_VALUE,F,e,t)),n=null):n=e==="true";break;case Ve.INTEGER:n=parseInt(e,10),isNaN(n)&&(r.log(v.ERROR,d(S.UNABLE_TO_CAST_VALUE,F,e,t)),n=null);break;case Ve.DOUBLE:n=parseFloat(e),isNaN(n)&&(r.log(v.ERROR,d(S.UNABLE_TO_CAST_VALUE,F,e,t)),n=null);break;default:n=e}return n},getAudiencesById:function(e){return e.audiencesById},eventWithKeyExists:function(e,t){return e.eventKeyMap.hasOwnProperty(t)},isFeatureExperiment:nr,tryCreatingProjectConfig:function(e){return Zt(e.datafile),e.jsonSchemaValidator?(e.jsonSchemaValidator.validate(e.datafile),e.logger.log(v.INFO,d(O.VALID_DATAFILE,F))):e.logger.log(v.INFO,d(O.SKIPPING_JSON_VALIDATION,F)),this.createProjectConfig(e.datafile)}},Kn=["and","or","not"],Fe=function(e,t){if(Array.isArray(e)){var r=e[0],n=e.slice(1);switch(Kn.indexOf(r)===-1&&(r="or",n=e),r){case"and":return function(i,a){for(var o=!1,s=0;s<i.length;s++){var u=Fe(i[s],a);if(u===!1)return!1;u===null&&(o=!0)}return!o||null}(n,t);case"not":return function(i,a){if(i.length>0){var o=Fe(i[0],a);return o===null?null:!o}return null}(n,t);default:return function(i,a){for(var o=!1,s=0;s<i.length;s++){var u=Fe(i[s],a);if(u===!0)return!0;u===null&&(o=!0)}return!!o&&null}(n,t)}}return t(e)},ir=Fe,k="CUSTOM_ATTRIBUTE_CONDITION_EVALUATOR",jn=["exact","exists","gt","lt","substring"],ae={};ae.exact=ar,ae.exists=function(e,t){var r=t[e.name];return r!=null},ae.gt=function(e,t,r){var n=e.name,i=t[n],a=typeof i,o=e.value;return J(o)?i===null?(r.log(v.DEBUG,d(O.UNEXPECTED_TYPE_NULL,k,JSON.stringify(e),n)),null):ie(i)?J(i)?i>o:(r.log(v.WARNING,d(O.OUT_OF_BOUNDS,k,JSON.stringify(e),n)),null):(r.log(v.WARNING,d(O.UNEXPECTED_TYPE,k,JSON.stringify(e),a,n)),null):(r.log(v.WARNING,d(O.UNEXPECTED_CONDITION_VALUE,k,JSON.stringify(e))),null)},ae.lt=function(e,t,r){var n=e.name,i=t[e.name],a=typeof i,o=e.value;return J(o)?i===null?(r.log(v.DEBUG,d(O.UNEXPECTED_TYPE_NULL,k,JSON.stringify(e),n)),null):ie(i)?J(i)?i<o:(r.log(v.WARNING,d(O.OUT_OF_BOUNDS,k,JSON.stringify(e),n)),null):(r.log(v.WARNING,d(O.UNEXPECTED_TYPE,k,JSON.stringify(e),a,n)),null):(r.log(v.WARNING,d(O.UNEXPECTED_CONDITION_VALUE,k,JSON.stringify(e))),null)},ae.substring=function(e,t,r){var n=e.name,i=t[e.name],a=typeof i,o=e.value;return typeof o!="string"?(r.log(v.WARNING,d(O.UNEXPECTED_CONDITION_VALUE,k,JSON.stringify(e))),null):i===null?(r.log(v.DEBUG,d(O.UNEXPECTED_TYPE_NULL,k,JSON.stringify(e),n)),null):typeof i!="string"?(r.log(v.WARNING,d(O.UNEXPECTED_TYPE,k,JSON.stringify(e),a,n)),null):i.indexOf(o)!==-1};function or(e){return typeof e=="string"||typeof e=="boolean"||ie(e)}function ar(e,t,r){var n=e.value,i=typeof n,a=e.name,o=t[a],s=typeof o;return!or(n)||ie(n)&&!J(n)?(r.log(v.WARNING,d(O.UNEXPECTED_CONDITION_VALUE,k,JSON.stringify(e))),null):o===null?(r.log(v.DEBUG,d(O.UNEXPECTED_TYPE_NULL,k,JSON.stringify(e),a)),null):or(o)&&i===s?ie(o)&&!J(o)?(r.log(v.WARNING,d(O.OUT_OF_BOUNDS,k,JSON.stringify(e),a)),null):n===o:(r.log(v.WARNING,d(O.UNEXPECTED_TYPE,k,JSON.stringify(e),s,a)),null)}var Hn={evaluate:function(e,t,r){var n=e.match;if(n!==void 0&&jn.indexOf(n)===-1)return r.log(v.WARNING,d(O.UNKNOWN_MATCH_TYPE,k,JSON.stringify(e))),null;var i=e.name;return t.hasOwnProperty(i)||n=="exists"?(ae[n]||ar)(e,t,r):(r.log(v.DEBUG,d(O.MISSING_ATTRIBUTE_VALUE,k,JSON.stringify(e),i)),null)}},Ee=Ae();function Et(e){this.typeToEvaluatorMap=K({},e,{custom_attribute:Hn})}Et.prototype.evaluate=function(e,t,r){if(!e||e.length===0)return!0;r||(r={});var n=function(i){var a=t[i];if(a){Ee.log(v.DEBUG,d(O.EVALUATING_AUDIENCE,"AUDIENCE_EVALUATOR",i,JSON.stringify(a.conditions)));var o=ir(a.conditions,this.evaluateConditionWithUserAttributes.bind(this,r)),s=o===null?"UNKNOWN":o.toString().toUpperCase();return Ee.log(v.INFO,d(O.AUDIENCE_EVALUATION_RESULT,"AUDIENCE_EVALUATOR",i,s)),o}return null}.bind(this);return ir(e,n)||!1},Et.prototype.evaluateConditionWithUserAttributes=function(e,t){var r=this.typeToEvaluatorMap[t.type];if(!r)return Ee.log(v.WARNING,d(O.UNKNOWN_CONDITION_TYPE,"AUDIENCE_EVALUATOR",JSON.stringify(t))),null;try{return r.evaluate(t,e,Ee)}catch(n){Ee.log(v.ERROR,d(S.CONDITION_EVALUATOR_ERROR,"AUDIENCE_EVALUATOR",t.type,n.message))}return null};var sr=function(e){return typeof e=="string"&&e!==""},R="DECISION_SERVICE",W=L.ERROR_MESSAGES,m=L.LOG_LEVEL,A=L.LOG_MESSAGES,te=L.DECISION_SOURCES;function x(e){this.audienceEvaluator=new Et(e.UNSTABLE_conditionEvaluators),this.forcedVariationMap={},this.logger=e.logger,this.userProfileService=e.userProfileService||null}x.prototype.getVariation=function(e,t,r,n){var i=this._getBucketingId(r,n);if(!this.__checkIfExperimentIsActive(e,t))return null;var a=e.experimentKeyMap[t],o=this.getForcedVariation(e,t,r);if(o)return o;var s=this.__getWhitelistedVariation(a,r);if(s)return s.key;var u=this.__resolveExperimentBucketMap(r,n);if(s=this.__getStoredVariation(e,a,r,u))return this.logger.log(m.INFO,d(A.RETURNING_STORED_VARIATION,R,s.key,t,r)),s.key;if(!this.__checkIfUserIsInAudience(e,t,r,n))return null;var l=this.__buildBucketerParams(e,t,i,r),E=Me.bucket(l);return(s=e.variationIdMap[E])?(this.__saveUserProfile(a,s,r,u),s.key):null},x.prototype.__resolveExperimentBucketMap=function(e,t){t=t||{};var r=this.__getUserProfile(e)||{},n=t[L.CONTROL_ATTRIBUTES.STICKY_BUCKETING_KEY];return K({},r.experiment_bucket_map,n)},x.prototype.__checkIfExperimentIsActive=function(e,t){if(!N.isActive(e,t)){var r=d(A.EXPERIMENT_NOT_RUNNING,R,t);return this.logger.log(m.INFO,r),!1}return!0},x.prototype.__getWhitelistedVariation=function(e,t){if(e.forcedVariations&&e.forcedVariations.hasOwnProperty(t)){var r=e.forcedVariations[t];if(e.variationKeyMap.hasOwnProperty(r)){var n=d(A.USER_FORCED_IN_VARIATION,R,t,r);return this.logger.log(m.INFO,n),e.variationKeyMap[r]}var i=d(A.FORCED_BUCKETING_FAILED,R,r,t);return this.logger.log(m.ERROR,i),null}return null},x.prototype.__checkIfUserIsInAudience=function(e,t,r,n){var i=N.getExperimentAudienceConditions(e,t),a=N.getAudiencesById(e);this.logger.log(m.DEBUG,d(A.EVALUATING_AUDIENCES_COMBINED,R,t,JSON.stringify(i)));var o=this.audienceEvaluator.evaluate(i,a,n);if(this.logger.log(m.INFO,d(A.AUDIENCE_EVALUATION_RESULT_COMBINED,R,t,o.toString().toUpperCase())),!o){var s=d(A.USER_NOT_IN_EXPERIMENT,R,r,t);return this.logger.log(m.INFO,s),!1}return!0},x.prototype.__buildBucketerParams=function(e,t,r,n){var i={};return i.experimentKey=t,i.experimentId=N.getExperimentId(e,t),i.userId=n,i.trafficAllocationConfig=N.getTrafficAllocation(e,t),i.experimentKeyMap=e.experimentKeyMap,i.groupIdMap=e.groupIdMap,i.variationIdMap=e.variationIdMap,i.logger=this.logger,i.bucketingId=r,i},x.prototype.__getStoredVariation=function(e,t,r,n){if(n.hasOwnProperty(t.id)){var i=n[t.id],a=i.variation_id;if(e.variationIdMap.hasOwnProperty(a))return e.variationIdMap[i.variation_id];this.logger.log(m.INFO,d(A.SAVED_VARIATION_NOT_FOUND,R,r,a,t.key))}return null},x.prototype.__getUserProfile=function(e){var t={user_id:e,experiment_bucket_map:{}};if(!this.userProfileService)return t;try{return this.userProfileService.lookup(e)}catch(r){this.logger.log(m.ERROR,d(W.USER_PROFILE_LOOKUP_ERROR,R,e,r.message))}},x.prototype.__saveUserProfile=function(e,t,r,n){if(this.userProfileService)try{n[e.id]={variation_id:t.id},this.userProfileService.save({user_id:r,experiment_bucket_map:n}),this.logger.log(m.INFO,d(A.SAVED_VARIATION,R,t.key,e.key,r))}catch(i){this.logger.log(m.ERROR,d(W.USER_PROFILE_SAVE_ERROR,R,r,i.message))}},x.prototype.getVariationForFeature=function(e,t,r,n){var i=this._getVariationForFeatureExperiment(e,t,r,n);if(i.variation!==null)return this.logger.log(m.DEBUG,d(A.USER_IN_FEATURE_EXPERIMENT,R,r,i.variation.key,i.experiment.key,t.key)),i;this.logger.log(m.DEBUG,d(A.USER_NOT_IN_FEATURE_EXPERIMENT,R,r,t.key));var a=this._getVariationForRollout(e,t,r,n);return a.variation!==null?(this.logger.log(m.DEBUG,d(A.USER_IN_ROLLOUT,R,r,t.key)),a):(this.logger.log(m.DEBUG,d(A.USER_NOT_IN_ROLLOUT,R,r,t.key)),a)},x.prototype._getVariationForFeatureExperiment=function(e,t,r,n){var i=null,a=null;if(t.hasOwnProperty("groupId")){var o=e.groupIdMap[t.groupId];o&&(i=this._getExperimentInGroup(e,o,r))&&t.experimentIds.indexOf(i.id)!==-1&&(a=this.getVariation(e,i.key,r,n))}else t.experimentIds.length>0?(i=N.getExperimentFromId(e,t.experimentIds[0],this.logger))&&(a=this.getVariation(e,i.key,r,n)):this.logger.log(m.DEBUG,d(A.FEATURE_HAS_NO_EXPERIMENTS,R,t.key));var s=null;return a!==null&&i!==null&&(s=i.variationKeyMap[a]),{experiment:i,variation:s,decisionSource:te.FEATURE_TEST}},x.prototype._getExperimentInGroup=function(e,t,r){var n=Me.bucketUserIntoExperiment(t,r,r,this.logger);if(n){this.logger.log(m.INFO,d(A.USER_BUCKETED_INTO_EXPERIMENT_IN_GROUP,R,r,n,t.id));var i=N.getExperimentFromId(e,n,this.logger);if(i)return i}return this.logger.log(m.INFO,d(A.USER_NOT_BUCKETED_INTO_ANY_EXPERIMENT_IN_GROUP,R,r,t.id)),null},x.prototype._getVariationForRollout=function(e,t,r,n){if(!t.rolloutId)return this.logger.log(m.DEBUG,d(A.NO_ROLLOUT_EXISTS,R,t.key)),{experiment:null,variation:null,decisionSource:te.ROLLOUT};var i=e.rolloutIdMap[t.rolloutId];if(!i)return this.logger.log(m.ERROR,d(W.INVALID_ROLLOUT_ID,R,t.rolloutId,t.key)),{experiment:null,variation:null,decisionSource:te.ROLLOUT};if(i.experiments.length===0)return this.logger.log(m.ERROR,d(A.ROLLOUT_HAS_NO_EXPERIMENTS,R,t.rolloutId)),{experiment:null,variation:null,decisionSource:te.ROLLOUT};var a,o,s,u,l,E=this._getBucketingId(r,n),g=i.experiments.length-1;for(a=0;a<g;a++){if(o=e.experimentKeyMap[i.experiments[a].key],this.__checkIfUserIsInAudience(e,o.key,r,n)){if(this.logger.log(m.DEBUG,d(A.USER_MEETS_CONDITIONS_FOR_TARGETING_RULE,R,r,a+1)),s=this.__buildBucketerParams(e,o.key,E,r),u=Me.bucket(s),l=e.variationIdMap[u])return this.logger.log(m.DEBUG,d(A.USER_BUCKETED_INTO_TARGETING_RULE,R,r,a+1)),{experiment:o,variation:l,decisionSource:te.ROLLOUT};this.logger.log(m.DEBUG,d(A.USER_NOT_BUCKETED_INTO_TARGETING_RULE,R,r,a+1));break}this.logger.log(m.DEBUG,d(A.USER_DOESNT_MEET_CONDITIONS_FOR_TARGETING_RULE,R,r,a+1))}var c=e.experimentKeyMap[i.experiments[g].key];if(this.__checkIfUserIsInAudience(e,c.key,r,n)){if(s=this.__buildBucketerParams(e,c.key,E,r),u=Me.bucket(s),l=e.variationIdMap[u])return this.logger.log(m.DEBUG,d(A.USER_BUCKETED_INTO_EVERYONE_TARGETING_RULE,R,r)),{experiment:c,variation:l,decisionSource:te.ROLLOUT};this.logger.log(m.DEBUG,d(A.USER_NOT_BUCKETED_INTO_EVERYONE_TARGETING_RULE,R,r))}return{experiment:null,variation:null,decisionSource:te.ROLLOUT}},x.prototype._getBucketingId=function(e,t){var r=e;return t!=null&&typeof t=="object"&&t.hasOwnProperty(L.CONTROL_ATTRIBUTES.BUCKETING_ID)&&(typeof t[L.CONTROL_ATTRIBUTES.BUCKETING_ID]=="string"?(r=t[L.CONTROL_ATTRIBUTES.BUCKETING_ID],this.logger.log(m.DEBUG,d(A.VALID_BUCKETING_ID,R,r))):this.logger.log(m.WARNING,d(A.BUCKETING_ID_NOT_STRING,R))),r},x.prototype.removeForcedVariation=function(e,t,r){if(!e)throw new Error(d(W.INVALID_USER_ID,R));if(!this.forcedVariationMap.hasOwnProperty(e))throw new Error(d(W.USER_NOT_IN_FORCED_VARIATION,R,e));delete this.forcedVariationMap[e][t],this.logger.log(m.DEBUG,d(A.VARIATION_REMOVED_FOR_USER,R,r,e))},x.prototype.__setInForcedVariationMap=function(e,t,r){this.forcedVariationMap.hasOwnProperty(e)||(this.forcedVariationMap[e]={}),this.forcedVariationMap[e][t]=r,this.logger.log(m.DEBUG,d(A.USER_MAPPED_TO_FORCED_VARIATION,R,r,t,e))},x.prototype.getForcedVariation=function(e,t,r){var n,i=this.forcedVariationMap[r];if(!i)return this.logger.log(m.DEBUG,d(A.USER_HAS_NO_FORCED_VARIATION,R,r)),null;try{var a=N.getExperimentFromKey(e,t);if(!a.hasOwnProperty("id"))return this.logger.log(m.ERROR,d(W.IMPROPERLY_FORMATTED_EXPERIMENT,R,t)),null;n=a.id}catch(u){return this.logger.log(m.ERROR,u.message),null}var o=i[n];if(!o)return this.logger.log(m.DEBUG,d(A.USER_HAS_NO_FORCED_VARIATION_FOR_EXPERIMENT,R,t,r)),null;var s=N.getVariationKeyFromId(e,o);return s?this.logger.log(m.DEBUG,d(A.USER_HAS_FORCED_VARIATION,R,s,t,r)):this.logger.log(m.DEBUG,d(A.USER_HAS_NO_FORCED_VARIATION_FOR_EXPERIMENT,R,t,r)),s},x.prototype.setForcedVariation=function(e,t,r,n){if(n!=null&&!sr(n))return this.logger.log(m.ERROR,d(W.INVALID_VARIATION_KEY,R)),!1;var i;try{var a=N.getExperimentFromKey(e,t);if(!a.hasOwnProperty("id"))return this.logger.log(m.ERROR,d(W.IMPROPERLY_FORMATTED_EXPERIMENT,R,t)),!1;i=a.id}catch(s){return this.logger.log(m.ERROR,s.message),!1}if(n==null)try{return this.removeForcedVariation(r,i,t,this.logger),!0}catch(s){return this.logger.log(m.ERROR,s.message),!1}var o=N.getVariationIdFromExperimentAndVariationKey(e,t,n);if(!o)return this.logger.log(m.ERROR,d(W.NO_VARIATION_FOR_EXPERIMENT_KEY,R,n,t)),!1;try{return this.__setInForcedVariationMap(r,i,o),!0}catch(s){return this.logger.log(m.ERROR,s.message),!1}};var qn=function(e){return new x(e)},ur=dt.REVENUE,lr=dt.VALUE,cr=function(e,t){if(e&&e.hasOwnProperty(ur)){var r=e[ur],n=parseInt(r,10);return isNaN(n)?(t.log(v.INFO,d(O.FAILED_TO_PARSE_REVENUE,"EVENT_TAG_UTILS",r)),null):(t.log(v.INFO,d(O.PARSED_REVENUE_VALUE,"EVENT_TAG_UTILS",n)),n)}return null},fr=function(e,t){if(e&&e.hasOwnProperty(lr)){var r=e[lr],n=parseFloat(r);return isNaN(n)?(t.log(v.INFO,d(O.FAILED_TO_PARSE_VALUE,"EVENT_TAG_UTILS",r)),null):(t.log(v.INFO,d(O.PARSED_NUMERIC_VALUE,"EVENT_TAG_UTILS",n)),n)}return null},dr="https://logx.optimizely.com/v1/events";function Er(e){var t=e.attributes,r=e.configObj,n=r.anonymizeIP,i=r.botFiltering;n==null&&(n=!1);var a={snapshots:[],visitor_id:e.userId,attributes:[]},o={account_id:r.accountId,project_id:r.projectId,visitors:[a],revision:r.revision,client_name:e.clientEngine,client_version:e.clientVersion,anonymize_ip:n,enrich_decisions:!0};return Object.keys(t||{}).forEach(function(s){var u=t[s];if(rr(s,u)){var l=N.getAttributeId(e.configObj,s,e.logger);l&&o.visitors[0].attributes.push({entity_id:l,key:s,type:"custom",value:t[s]})}}),typeof i=="boolean"&&o.visitors[0].attributes.push({entity_id:L.CONTROL_ATTRIBUTES.BOT_FILTERING,key:L.CONTROL_ATTRIBUTES.BOT_FILTERING,type:"custom",value:i}),o}var Yn=function(e){var t={httpVerb:"POST"},r=Er(e);t.url=dr;var n,i,a,o=(n=e.configObj,i=e.experimentId,a=e.variationId,{decisions:[{campaign_id:N.getLayerId(n,i),experiment_id:i,variation_id:a}],events:[{entity_id:N.getLayerId(n,i),timestamp:be(),key:"campaign_activated",uuid:Ce()}]});return r.visitors[0].snapshots.push(o),t.params=r,t},Wn=function(e){var t={httpVerb:"POST"},r=Er(e);t.url=dr;var n=function(i,a,o,s){var u={events:[]},l={entity_id:N.getEventId(i,a),timestamp:be(),uuid:Ce(),key:a};if(o){var E=cr(o,s);E!==null&&(l[L.RESERVED_EVENT_KEYWORDS.REVENUE]=E);var g=fr(o,s);g!==null&&(l[L.RESERVED_EVENT_KEYWORDS.VALUE]=g),l.tags=o}return u.events.push(l),u}(e.configObj,e.eventKey,e.eventTags,e.logger);return r.visitors[0].snapshots=[n],t.params=r,t},gt=Ae("EVENT_BUILDER");function gr(e,t){var r=[];return Object.keys(t||{}).forEach(function(n){var i=t[n];if(rr(n,i)){var a=N.getAttributeId(e,n,gt);a&&r.push({entityId:a,key:n,value:t[n]})}}),r}var zn=function(e){if(typeof e!="object"||Array.isArray(e)||e===null)throw new Error(d(S.INVALID_EVENT_TAGS,"EVENT_TAGS_VALIDATOR"));return!0};function se(e){this.logger=e.logger,this.errorHandler=e.errorHandler,this.__notificationListeners={},ee(Pe).forEach(function(t){this.__notificationListeners[t]=[]}.bind(this)),this.__listenerId=1}se.prototype.addNotificationListener=function(e,t){try{if(!(ee(Pe).indexOf(e)>-1))return-1;this.__notificationListeners[e]||(this.__notificationListeners[e]=[]);var r=!1;if((this.__notificationListeners[e]||[]).forEach(function(i){if(i.callback===t)return r=!0,!1}),r)return-1;this.__notificationListeners[e].push({id:this.__listenerId,callback:t});var n=this.__listenerId;return this.__listenerId+=1,n}catch(i){return this.logger.log(v.ERROR,i.message),this.errorHandler.handleError(i),-1}},se.prototype.removeNotificationListener=function(e){try{var t,r;if(Object.keys(this.__notificationListeners).some(function(n){if((this.__notificationListeners[n]||[]).every(function(i,a){return i.id!==e||(t=a,r=n,!1)}),t!==void 0&&r!==void 0)return!0}.bind(this)),t!==void 0&&r!==void 0)return this.__notificationListeners[r].splice(t,1),!0}catch(n){this.logger.log(v.ERROR,n.message),this.errorHandler.handleError(n)}return!1},se.prototype.clearAllNotificationListeners=function(){try{ee(Pe).forEach(function(e){this.__notificationListeners[e]=[]}.bind(this))}catch(e){this.logger.log(v.ERROR,e.message),this.errorHandler.handleError(e)}},se.prototype.clearNotificationListeners=function(e){try{this.__notificationListeners[e]=[]}catch(t){this.logger.log(v.ERROR,t.message),this.errorHandler.handleError(t)}},se.prototype.sendNotifications=function(e,t){try{(this.__notificationListeners[e]||[]).forEach(function(r){var n=r.callback;try{n(t)}catch(i){this.logger.log(v.ERROR,d(O.NOTIFICATION_LISTENER_EXCEPTION,"NOTIFICATION_CENTER",e,i.message))}}.bind(this))}catch(r){this.logger.log(v.ERROR,r.message),this.errorHandler.handleError(r)}};var Xn=function(e){return new se(e)},$n=function(e){if(typeof e.lookup!="function")throw new Error(d(S.INVALID_USER_PROFILE_SERVICE,"USER_PROFILE_SERVICE_VALIDATOR","Missing function 'lookup'"));if(typeof e.save!="function")throw new Error(d(S.INVALID_USER_PROFILE_SERVICE,"USER_PROFILE_SERVICE_VALIDATOR","Missing function 'save'"));return!0};function Jn(e,t,r,n){var i=e.experimentFeatureMap[r],a={};if(i){var o=n[i],s=(t.variables||[]).reduce(function(u,l){return u[l.id]={id:l.id,value:l.value},u},{});a=(o||[]).reduce(function(u,l){var E=s[l.id],g=t.featureEnabled&&E?E.value:l.defaultValue;return u[l.key]={id:l.id,key:l.key,type:l.type,value:g},u},{})}return a}function Zn(e,t){return(e.featureFlags||[]).reduce(function(r,n){return r[n.key]={id:n.id,key:n.key,experimentsMap:(n.experimentIds||[]).reduce(function(i,a){var o=e.experimentIdMap[a].key;return i[o]=t[o],i},{}),variablesMap:(n.variables||[]).reduce(function(i,a){return i[a.key]={id:a.id,key:a.key,type:a.type,value:a.defaultValue},i},{})},r},{})}var pr=function(e){var t=function(r){var n=(r.rollouts||[]).reduce(function(a,o){return o.experiments.forEach(function(s){a[s.id]=!0}),a},{}),i=(r.featureFlags||[]).reduce(function(a,o){return a[o.id]=o.variables,a},{});return(r.experiments||[]).reduce(function(a,o){return n[o.id]||(a[o.key]={id:o.id,key:o.key,variationsMap:(o.variations||[]).reduce(function(s,u){return s[u.key]={id:u.id,key:u.key,variablesMap:Jn(r,u,o.id,i)},nr(r,o.id)&&(s[u.key].featureEnabled=u.featureEnabled),s},{})}),a},{})}(e);return{experimentsMap:t,featuresMap:Zn(e,t),revision:e.revision}},z=Ae();function ge(e,t){return e instanceof Error?e.message:t||"Unknown error"}function q(e){try{this.__initialize(e)}catch(t){z.error(t),this.__updateListeners=[],this.__configObj=null,this.__optimizelyConfigObj=null,this.__readyPromise=Promise.resolve({success:!1,reason:ge(t,"Error in initialize")})}}q.prototype.__initialize=function(e){if(this.__updateListeners=[],this.jsonSchemaValidator=e.jsonSchemaValidator,!e.datafile&&!e.sdkKey){this.__configObj=null;var t=new Error(d(S.DATAFILE_AND_SDK_KEY_MISSING,"PROJECT_CONFIG_MANAGER"));return this.__readyPromise=Promise.resolve({success:!1,reason:ge(t)}),void z.error(t)}var r,n=this.__getDatafileFromConfig(e);if(n)try{this.__configObj=N.tryCreatingProjectConfig({datafile:n,jsonSchemaValidator:this.jsonSchemaValidator,logger:z}),this.__optimizelyConfigObj=pr(this.__configObj)}catch(a){z.error(a),r=a,this.__configObj=null}else this.__configObj=null;if(e.sdkKey){var i={sdkKey:e.sdkKey};this.__validateDatafileOptions(e.datafileOptions)&&K(i,e.datafileOptions),n&&this.__configObj&&(i.datafile=n),this.datafileManager=new Vn(i),this.datafileManager.start(),this.__readyPromise=this.datafileManager.onReady().then(this.__onDatafileManagerReadyFulfill.bind(this),this.__onDatafileManagerReadyReject.bind(this)),this.datafileManager.on("update",this.__onDatafileManagerUpdate.bind(this))}else this.__configObj?this.__readyPromise=Promise.resolve({success:!0}):this.__readyPromise=Promise.resolve({success:!1,reason:ge(r,"Invalid datafile")})},q.prototype.__onDatafileManagerReadyFulfill=function(){var e,t=this.datafileManager.get();try{e=N.tryCreatingProjectConfig({datafile:t,jsonSchemaValidator:this.jsonSchemaValidator,logger:z})}catch(r){return z.error(r),{success:!1,reason:ge(r)}}return this.__handleNewConfigObj(e),{success:!0}},q.prototype.__onDatafileManagerReadyReject=function(e){return{success:!1,reason:ge(e,"Failed to become ready")}},q.prototype.__onDatafileManagerUpdate=function(){var e,t=this.datafileManager.get();try{e=N.tryCreatingProjectConfig({datafile:t,jsonSchemaValidator:this.jsonSchemaValidator,logger:z})}catch(r){z.error(r)}e&&this.__handleNewConfigObj(e)},q.prototype.__getDatafileFromConfig=function(e){var t=null;try{e.datafile&&(Zt(e.datafile),t=typeof e.datafile=="string"||e.datafile instanceof String?JSON.parse(e.datafile):e.datafile)}catch(r){z.error(r)}return t},q.prototype.__validateDatafileOptions=function(e){return e===void 0||typeof e=="object"&&e!==null},q.prototype.__handleNewConfigObj=function(e){var t=this.__configObj;(t?t.revision:"null")!==e.revision&&(this.__configObj=e,this.__optimizelyConfigObj=pr(e),this.__updateListeners.forEach(function(r){r(e)}))},q.prototype.getConfig=function(){return this.__configObj},q.prototype.getOptimizelyConfig=function(){return this.__optimizelyConfigObj},q.prototype.onReady=function(){return this.__readyPromise},q.prototype.onUpdate=function(e){return this.__updateListeners.push(e),function(){var t=this.__updateListeners.indexOf(e);t>-1&&this.__updateListeners.splice(t,1)}.bind(this)},q.prototype.stop=function(){this.datafileManager&&this.datafileManager.stop(),this.__updateListeners=[]};var Qn={ProjectConfigManager:q},pt=L.ERROR_MESSAGES,y=L.LOG_LEVEL,P=L.LOG_MESSAGES,_r=L.DECISION_SOURCES,ke=L.FEATURE_VARIABLE_TYPES,we=L.DECISION_NOTIFICATION_TYPES,ue=L.NOTIFICATION_TYPES;function U(e){var t=e.clientEngine;L.VALID_CLIENT_ENGINES.indexOf(t)===-1&&(e.logger.log(y.INFO,d(P.INVALID_CLIENT_ENGINE,"OPTIMIZELY",t)),t=L.NODE_CLIENT_ENGINE),this.clientEngine=t,this.clientVersion=e.clientVersion||L.NODE_CLIENT_VERSION,this.errorHandler=e.errorHandler,this.eventDispatcher=e.eventDispatcher,this.__isOptimizelyConfigValid=e.isValidInstance,this.logger=e.logger,this.projectConfigManager=new Qn.ProjectConfigManager({datafile:e.datafile,datafileOptions:e.datafileOptions,jsonSchemaValidator:e.jsonSchemaValidator,sdkKey:e.sdkKey}),this.__disposeOnUpdate=this.projectConfigManager.onUpdate(function(n){this.logger.log(y.INFO,d(P.UPDATED_OPTIMIZELY_CONFIG,"OPTIMIZELY",n.revision,n.projectId)),this.notificationCenter.sendNotifications(ue.OPTIMIZELY_CONFIG_UPDATE)}.bind(this)),this.__readyPromise=this.projectConfigManager.onReady();var r=null;if(e.userProfileService)try{$n(e.userProfileService)&&(r=e.userProfileService,this.logger.log(y.INFO,d(P.VALID_USER_PROFILE_SERVICE,"OPTIMIZELY")))}catch(n){this.logger.log(y.WARNING,n.message)}this.decisionService=qn({userProfileService:r,logger:this.logger,UNSTABLE_conditionEvaluators:e.UNSTABLE_conditionEvaluators}),this.notificationCenter=Xn({logger:this.logger,errorHandler:this.errorHandler}),this.eventProcessor=new bn({dispatcher:this.eventDispatcher,flushInterval:e.eventFlushInterval,maxQueueSize:e.eventBatchSize,notificationCenter:this.notificationCenter}),this.eventProcessor.start(),this.__readyTimeouts={},this.__nextReadyTimeoutId=0}U.prototype.__isValidInstance=function(){return this.__isOptimizelyConfigValid&&this.projectConfigManager.getConfig()},U.prototype.activate=function(e,t,r){try{if(!this.__isValidInstance())return this.logger.log(y.ERROR,d(P.INVALID_OBJECT,"OPTIMIZELY","activate")),null;if(!this.__validateInputs({experiment_key:e,user_id:t},r))return this.__notActivatingExperiment(e,t);var n=this.projectConfigManager.getConfig();if(!n)return null;try{var i=this.getVariation(e,t,r);if(i===null)return this.__notActivatingExperiment(e,t);if(!N.isRunning(n,e)){var a=d(P.SHOULD_NOT_DISPATCH_ACTIVATE,"OPTIMIZELY",e);return this.logger.log(y.DEBUG,a),i}return this._sendImpressionEvent(e,i,t,r),i}catch(s){this.logger.log(y.ERROR,s.message);var o=d(P.NOT_ACTIVATING_USER,"OPTIMIZELY",t,e);return this.logger.log(y.INFO,o),this.errorHandler.handleError(s),null}}catch(s){return this.logger.log(y.ERROR,s.message),this.errorHandler.handleError(s),null}},U.prototype._sendImpressionEvent=function(e,t,r,n){var i=this.projectConfigManager.getConfig();if(i){var a=function(o){var s=o.configObj,u=o.experimentKey,l=o.variationKey,E=o.userId,g=o.userAttributes,c=o.clientEngine,f=o.clientVersion,_=N.getVariationIdFromExperimentAndVariationKey(s,u,l),p=N.getExperimentId(s,u),h=N.getLayerId(s,p);return{type:"impression",timestamp:be(),uuid:Ce(),user:{id:E,attributes:gr(s,g)},context:{accountId:s.accountId,projectId:s.projectId,revision:s.revision,clientName:c,clientVersion:f,anonymizeIP:s.anonymizeIP||!1,botFiltering:s.botFiltering},layer:{id:h},experiment:{id:p,key:u},variation:{id:_,key:l}}}({experimentKey:e,variationKey:t,userId:r,userAttributes:n,clientEngine:this.clientEngine,clientVersion:this.clientVersion,configObj:i});this.eventProcessor.process(a),this.__emitNotificationCenterActivate(e,t,r,n)}},U.prototype.__emitNotificationCenterActivate=function(e,t,r,n){var i=this.projectConfigManager.getConfig();if(i){var a,o=N.getVariationIdFromExperimentAndVariationKey(i,e,t),s=N.getExperimentId(i,e),u={attributes:n,clientEngine:this.clientEngine,clientVersion:this.clientVersion,configObj:i,experimentId:s,userId:r,variationId:o,logger:this.logger},l=Yn(u),E=i.experimentKeyMap[e];E&&E.variationKeyMap&&(a=E.variationKeyMap[t]),this.notificationCenter.sendNotifications(ue.ACTIVATE,{experiment:E,userId:r,attributes:n,variation:a,logEvent:l})}},U.prototype.track=function(e,t,r,n){try{if(!this.__isValidInstance())return void this.logger.log(y.ERROR,d(P.INVALID_OBJECT,"OPTIMIZELY","track"));if(!this.__validateInputs({user_id:t,event_key:e},r,n))return;var i=this.projectConfigManager.getConfig();if(!i)return;if(!N.eventWithKeyExists(i,e))return this.logger.log(y.WARNING,d(L.LOG_MESSAGES.EVENT_KEY_NOT_FOUND,"OPTIMIZELY",e)),void this.logger.log(y.WARNING,d(P.NOT_TRACKING_USER,"OPTIMIZELY",t));var a=function(s){var u=s.configObj,l=s.userId,E=s.userAttributes,g=s.clientEngine,c=s.clientVersion,f=s.eventKey,_=s.eventTags,p=N.getEventId(u,f);return{type:"conversion",timestamp:be(),uuid:Ce(),user:{id:l,attributes:gr(u,E)},context:{accountId:u.accountId,projectId:u.projectId,revision:u.revision,clientName:g,clientVersion:c,anonymizeIP:u.anonymizeIP||!1,botFiltering:u.botFiltering},event:{id:p,key:f},revenue:cr(_,gt),value:fr(_,gt),tags:_}}({eventKey:e,eventTags:n=this.__filterEmptyValues(n),userId:t,userAttributes:r,clientEngine:this.clientEngine,clientVersion:this.clientVersion,configObj:i});this.logger.log(y.INFO,d(L.LOG_MESSAGES.TRACK_EVENT,"OPTIMIZELY",e,t)),this.eventProcessor.process(a),this.__emitNotificationCenterTrack(e,t,r,n)}catch(s){this.logger.log(y.ERROR,s.message),this.errorHandler.handleError(s);var o=d(P.NOT_TRACKING_USER,"OPTIMIZELY",t);this.logger.log(y.ERROR,o)}},U.prototype.__emitNotificationCenterTrack=function(e,t,r,n){try{var i=this.projectConfigManager.getConfig();if(!i)return;var a={attributes:r,clientEngine:this.clientEngine,clientVersion:this.clientVersion,configObj:i,eventKey:e,eventTags:n,logger:this.logger,userId:t},o=Wn(a);this.notificationCenter.sendNotifications(ue.TRACK,{eventKey:e,userId:t,attributes:r,eventTags:n,logEvent:o})}catch(s){this.logger.log(y.ERROR,s.message),this.errorHandler.handleError(s)}},U.prototype.getVariation=function(e,t,r){try{if(!this.__isValidInstance())return this.logger.log(y.ERROR,d(P.INVALID_OBJECT,"OPTIMIZELY","getVariation")),null;try{if(!this.__validateInputs({experiment_key:e,user_id:t},r))return null;var n=this.projectConfigManager.getConfig();if(!n)return null;var i=n.experimentKeyMap[e];if(!i)return this.logger.log(y.DEBUG,d(pt.INVALID_EXPERIMENT_KEY,"OPTIMIZELY",e)),null;var a=this.decisionService.getVariation(n,e,t,r),o=N.isFeatureExperiment(n,i.id)?we.FEATURE_TEST:we.AB_TEST;return this.notificationCenter.sendNotifications(ue.DECISION,{type:o,userId:t,attributes:r||{},decisionInfo:{experimentKey:e,variationKey:a}}),a}catch(s){return this.logger.log(y.ERROR,s.message),this.errorHandler.handleError(s),null}}catch(s){return this.logger.log(y.ERROR,s.message),this.errorHandler.handleError(s),null}},U.prototype.setForcedVariation=function(e,t,r){if(!this.__validateInputs({experiment_key:e,user_id:t}))return!1;var n=this.projectConfigManager.getConfig();if(!n)return!1;try{return this.decisionService.setForcedVariation(n,e,t,r)}catch(i){return this.logger.log(y.ERROR,i.message),this.errorHandler.handleError(i),!1}},U.prototype.getForcedVariation=function(e,t){if(!this.__validateInputs({experiment_key:e,user_id:t}))return null;var r=this.projectConfigManager.getConfig();if(!r)return null;try{return this.decisionService.getForcedVariation(r,e,t)}catch(n){return this.logger.log(y.ERROR,n.message),this.errorHandler.handleError(n),null}},U.prototype.__validateInputs=function(e,t,r){try{if(e.hasOwnProperty("user_id")){var n=e.user_id;if(typeof n!="string"||n===null||n==="undefined")throw new Error(d(pt.INVALID_INPUT_FORMAT,"OPTIMIZELY","user_id"));delete e.user_id}for(var i=Object.keys(e),a=0;a<i.length;a++){var o=i[a];if(!sr(e[o]))throw new Error(d(pt.INVALID_INPUT_FORMAT,"OPTIMIZELY",o))}return t&&Bn(t),r&&zn(r),!0}catch(s){return this.logger.log(y.ERROR,s.message),this.errorHandler.handleError(s),!1}},U.prototype.__notActivatingExperiment=function(e,t){var r=d(P.NOT_ACTIVATING_USER,"OPTIMIZELY",t,e);return this.logger.log(y.INFO,r),null},U.prototype.__filterEmptyValues=function(e){for(var t in e)!e.hasOwnProperty(t)||e[t]!==null&&e[t]!==void 0||delete e[t];return e},U.prototype.isFeatureEnabled=function(e,t,r){try{if(!this.__isValidInstance())return this.logger.log(y.ERROR,d(P.INVALID_OBJECT,"OPTIMIZELY","isFeatureEnabled")),!1;if(!this.__validateInputs({feature_key:e,user_id:t},r))return!1;var n=this.projectConfigManager.getConfig();if(!n)return!1;var i=N.getFeatureFromKey(n,e,this.logger);if(!i)return!1;var a=!1,o=this.decisionService.getVariationForFeature(n,i,t,r),s=o.variation,u={};s&&(a=s.featureEnabled,o.decisionSource===_r.FEATURE_TEST&&(u={experimentKey:o.experiment.key,variationKey:o.variation.key},this._sendImpressionEvent(o.experiment.key,o.variation.key,t,r))),a===!0?this.logger.log(y.INFO,d(P.FEATURE_ENABLED_FOR_USER,"OPTIMIZELY",e,t)):(this.logger.log(y.INFO,d(P.FEATURE_NOT_ENABLED_FOR_USER,"OPTIMIZELY",e,t)),a=!1);var l={featureKey:e,featureEnabled:a,source:o.decisionSource,sourceInfo:u};return this.notificationCenter.sendNotifications(ue.DECISION,{type:we.FEATURE,userId:t,attributes:r||{},decisionInfo:l}),a}catch(E){return this.logger.log(y.ERROR,E.message),this.errorHandler.handleError(E),!1}},U.prototype.getEnabledFeatures=function(e,t){try{var r=[];if(!this.__isValidInstance())return this.logger.log(y.ERROR,d(P.INVALID_OBJECT,"OPTIMIZELY","getEnabledFeatures")),r;if(!this.__validateInputs({user_id:e}))return r;var n=this.projectConfigManager.getConfig();return n&&ee(n.featureKeyMap).forEach(function(i){this.isFeatureEnabled(i.key,e,t)&&r.push(i.key)}.bind(this)),r}catch(i){return this.logger.log(y.ERROR,i.message),this.errorHandler.handleError(i),[]}},U.prototype.getFeatureVariable=function(e,t,r,n){try{return this._getFeatureVariableForType(e,t,null,r,n)}catch(i){return this.logger.log(y.ERROR,i.message),this.errorHandler.handleError(i),null}},U.prototype._getFeatureVariableForType=function(e,t,r,n,i){if(!this.__isValidInstance()){var a=r?"getFeatureVariable"+r.charAt(0).toUpperCase()+r.slice(1):"getFeatureVariable";return this.logger.log(y.ERROR,d(P.INVALID_OBJECT,"OPTIMIZELY",a)),null}if(!this.__validateInputs({feature_key:e,variable_key:t,user_id:n},i))return null;var o=this.projectConfigManager.getConfig();if(!o)return null;var s=N.getFeatureFromKey(o,e,this.logger);if(!s)return null;var u=N.getVariableForFeature(o,e,t,this.logger);if(!u)return null;if(r){if(u.type!==r)return this.logger.log(y.WARNING,d(P.VARIABLE_REQUESTED_WITH_WRONG_TYPE,"OPTIMIZELY",r,u.type)),null}else r=u.type;var l=!1,E=u.defaultValue,g=this.decisionService.getVariationForFeature(o,s,n,i);if(g.variation!==null){l=g.variation.featureEnabled;var c=N.getVariableValueForVariation(o,u,g.variation,this.logger);c!==null?l===!0?(E=c,this.logger.log(y.INFO,d(P.USER_RECEIVED_VARIABLE_VALUE,"OPTIMIZELY",t,s.key,E,n))):this.logger.log(y.INFO,d(P.FEATURE_NOT_ENABLED_RETURN_DEFAULT_VARIABLE_VALUE,"OPTIMIZELY",s.key,n,t)):this.logger.log(y.INFO,d(P.VARIABLE_NOT_USED_RETURN_DEFAULT_VARIABLE_VALUE,"OPTIMIZELY",t,g.variation.key))}else this.logger.log(y.INFO,d(P.USER_RECEIVED_DEFAULT_VARIABLE_VALUE,"OPTIMIZELY",n,t,s.key));var f={};g.decisionSource===_r.FEATURE_TEST&&(f={experimentKey:g.experiment.key,variationKey:g.variation.key});var _=N.getTypeCastValue(E,r,this.logger);return this.notificationCenter.sendNotifications(ue.DECISION,{type:we.FEATURE_VARIABLE,userId:n,attributes:i||{},decisionInfo:{featureKey:e,featureEnabled:l,source:g.decisionSource,variableKey:t,variableValue:_,variableType:r,sourceInfo:f}}),_},U.prototype.getFeatureVariableBoolean=function(e,t,r,n){try{return this._getFeatureVariableForType(e,t,ke.BOOLEAN,r,n)}catch(i){return this.logger.log(y.ERROR,i.message),this.errorHandler.handleError(i),null}},U.prototype.getFeatureVariableDouble=function(e,t,r,n){try{return this._getFeatureVariableForType(e,t,ke.DOUBLE,r,n)}catch(i){return this.logger.log(y.ERROR,i.message),this.errorHandler.handleError(i),null}},U.prototype.getFeatureVariableInteger=function(e,t,r,n){try{return this._getFeatureVariableForType(e,t,ke.INTEGER,r,n)}catch(i){return this.logger.log(y.ERROR,i.message),this.errorHandler.handleError(i),null}},U.prototype.getFeatureVariableString=function(e,t,r,n){try{return this._getFeatureVariableForType(e,t,ke.STRING,r,n)}catch(i){return this.logger.log(y.ERROR,i.message),this.errorHandler.handleError(i),null}},U.prototype.getOptimizelyConfig=function(){try{return this.projectConfigManager.getConfig()?this.projectConfigManager.getOptimizelyConfig():null}catch(e){return this.logger.log(y.ERROR,e.message),this.errorHandler.handleError(e),null}},U.prototype.close=function(){try{var e=this.eventProcessor.stop();return this.__disposeOnUpdate&&(this.__disposeOnUpdate(),this.__disposeOnUpdate=null),this.projectConfigManager&&this.projectConfigManager.stop(),Object.keys(this.__readyTimeouts).forEach(function(t){var r=this.__readyTimeouts[t];clearTimeout(r.readyTimeout),r.onClose()}.bind(this)),this.__readyTimeouts={},e.then(function(){return{success:!0}},function(t){return{success:!1,reason:String(t)}})}catch(t){return this.logger.log(y.ERROR,t.message),this.errorHandler.handleError(t),Promise.resolve({success:!1,reason:String(t)})}},U.prototype.onReady=function(e){var t,r;typeof e=="object"&&e!==null&&(t=e.timeout),J(t)||(t=3e4);var n=new Promise(function(s){r=s}),i=this.__nextReadyTimeoutId;this.__nextReadyTimeoutId++;var a=function(){delete this.__readyTimeouts[i],r({success:!1,reason:d("onReady timeout expired after %s ms",t)})}.bind(this),o=setTimeout(a,t);return this.__readyTimeouts[i]={readyTimeout:o,onClose:function(){r({success:!1,reason:"Instance closed"})}},this.__readyPromise.then(function(){clearTimeout(o),delete this.__readyTimeouts[i],r({success:!0})}.bind(this)),Promise.race([this.__readyPromise,n])};var ei=function(e){return ft(e)&&e>=1},ti=function(e){return ft(e)&&e>0},le=Ae();at(tr.createLogger()),Se(qt.INFO);var _t=!1,ri=function(e){try{(e=e||{}).errorHandler&&Un(e.errorHandler),e.logger&&(at(e.logger),Se(qt.NOTSET)),e.logLevel!==void 0&&Se(e.logLevel);try{Fn(e),e.isValidInstance=!0}catch(i){le.error(i),e.isValidInstance=!1}var t;e.eventDispatcher==null?(t=new Cn({eventDispatcher:Qt}),_t||(t.sendPendingEvents(),_t=!0)):t=e.eventDispatcher,e=K({clientEngine:L.JAVASCRIPT_CLIENT_ENGINE,eventBatchSize:10,eventFlushInterval:1e3},e,{eventDispatcher:t,logger:le,errorHandler:Dn()}),ei(e.eventBatchSize)||(le.warn("Invalid eventBatchSize %s, defaulting to %s",e.eventBatchSize,10),e.eventBatchSize=10),ti(e.eventFlushInterval)||(le.warn("Invalid eventFlushInterval %s, defaulting to %s",e.eventFlushInterval,1e3),e.eventFlushInterval=1e3);var r=new U(e);try{if(typeof window.addEventListener=="function"){var n="onpagehide"in window?"pagehide":"unload";window.addEventListener(n,function(){r.close()},!1)}}catch(i){le.error(L.LOG_MESSAGES.UNABLE_TO_ATTACH_UNLOAD,"INDEX_BROWSER",i.message)}return r}catch(i){return le.error(i),null}},ni=function(){_t=!1},ht={logging:tr,errorHandler:kn,eventDispatcher:Qt,enums:L,setLogger:at,setLogLevel:Se,createInstance:ri,__internalResetRetryState:ni},ii=Object.defineProperty,Be=(e,t)=>ii(e,"name",{value:t,configurable:!0});const oi={handleError(e){mr(e)}};function hr(){var e;vr();const t=(e=document.head.querySelector("meta[name=optimizely-datafile]"))==null?void 0:e.content;return ht.createInstance({datafile:t,errorHandler:oi})}Be(hr,"createInstance");function vr(){const e=Ir("optimizely.logLevel");e?ht.setLogLevel(e):ht.setLogger(null)}Be(vr,"configureLogger");function Ir(e){var t;try{return(t=window.localStorage)==null?void 0:t.getItem(e)}catch(r){return null}}Be(Ir,"localStorage");async function mr(e){var t,r;const n=(r=(t=document.head)==null?void 0:t.querySelector('meta[name="browser-optimizely-client-errors-url"]'))==null?void 0:r.content;if(!n)return;const i={message:e.message,stack:e.stack,stacktrace:Qe(e),sanitizedUrl:Ze()||window.location.href,user:et()||void 0};try{await fetch(n,{method:"post",body:JSON.stringify(i)})}catch(a){}}Be(mr,"reportError");var ai=Object.defineProperty,Ge=(e,t)=>ai(e,"name",{value:t,configurable:!0});function Ke(e){const t=[];for(const r of yr()){const[n,i]=r.trim().split("=");e===n&&typeof i!="undefined"&&t.push({key:n,value:i})}return t}Ge(Ke,"getCookies");function yr(){try{return document.cookie.split(";")}catch(e){return[]}}Ge(yr,"readCookies");function si(e,t,r=null,n=!1,i="lax"){let a=document.domain;if(a==null)throw new Error("Unable to get document domain");a.endsWith(".github.com")&&(a="github.com");const o=location.protocol==="https:"?"; secure":"",s=r?`; expires=${r}`:"";n===!1&&(a=`.${a}`);try{document.cookie=`${e}=${t}; path=/; domain=${a}${s}${o}; samesite=${i}`}catch(u){}}Ge(si,"setCookie");function ui(e,t=!1){let r=document.domain;if(r==null)throw new Error("Unable to get document domain");r.endsWith(".github.com")&&(r="github.com");const n=new Date().getTime(),i=new Date(n-1).toUTCString(),a=location.protocol==="https:"?"; secure":"",o=`; expires=${i}`;t===!1&&(r=`.${r}`);try{document.cookie=`${e}=''; path=/; domain=${r}${o}${a}`}catch(s){}}Ge(ui,"deleteCookie");function B(){if(!(this instanceof B))return new B;this.size=0,this.uid=0,this.selectors=[],this.indexes=Object.create(this.indexes),this.activeIndexes=[]}var pe=window.document.documentElement,li=pe.matches||pe.webkitMatchesSelector||pe.mozMatchesSelector||pe.oMatchesSelector||pe.msMatchesSelector;B.prototype.matchesSelector=function(e,t){return li.call(e,t)},B.prototype.querySelectorAll=function(e,t){return t.querySelectorAll(e)},B.prototype.indexes=[];var ci=/^#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/g;B.prototype.indexes.push({name:"ID",selector:function(t){var r;if(r=t.match(ci))return r[0].slice(1)},element:function(t){if(t.id)return[t.id]}});var fi=/^\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/g;B.prototype.indexes.push({name:"CLASS",selector:function(t){var r;if(r=t.match(fi))return r[0].slice(1)},element:function(t){var r=t.className;if(r){if(typeof r=="string")return r.split(/\s/);if(typeof r=="object"&&"baseVal"in r)return r.baseVal.split(/\s/)}}});var di=/^((?:[\w\u00c0-\uFFFF\-]|\\.)+)/g;B.prototype.indexes.push({name:"TAG",selector:function(t){var r;if(r=t.match(di))return r[0].toUpperCase()},element:function(t){return[t.nodeName.toUpperCase()]}}),B.prototype.indexes.default={name:"UNIVERSAL",selector:function(){return!0},element:function(){return[!0]}};var vt;typeof window.Map=="function"?vt=window.Map:vt=function(){function e(){this.map={}}return e.prototype.get=function(t){return this.map[t+" "]},e.prototype.set=function(t,r){this.map[t+" "]=r},e}();var Rr=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g;function Tr(e,t){e=e.slice(0).concat(e.default);var r=e.length,n,i,a,o,s=t,u,l,E=[];do if(Rr.exec(""),(a=Rr.exec(s))&&(s=a[3],a[2]||!s)){for(n=0;n<r;n++)if(l=e[n],u=l.selector(a[1])){for(i=E.length,o=!1;i--;)if(E[i].index===l&&E[i].key===u){o=!0;break}o||E.push({index:l,key:u});break}}while(a);return E}function Ei(e,t){var r,n,i;for(r=0,n=e.length;r<n;r++)if(i=e[r],t.isPrototypeOf(i))return i}B.prototype.logDefaultIndexUsed=function(){},B.prototype.add=function(e,t){var r,n,i,a,o,s,u,l,E=this.activeIndexes,g=this.selectors;if(typeof e=="string"){for(r={id:this.uid++,selector:e,data:t},u=Tr(this.indexes,e),n=0;n<u.length;n++)l=u[n],a=l.key,i=l.index,o=Ei(E,i),o||(o=Object.create(i),o.map=new vt,E.push(o)),i===this.indexes.default&&this.logDefaultIndexUsed(r),s=o.map.get(a),s||(s=[],o.map.set(a,s)),s.push(r);this.size++,g.push(e)}},B.prototype.remove=function(e,t){if(typeof e=="string"){var r,n,i,a,o,s,u,l,E=this.activeIndexes,g={},c=arguments.length===1;for(r=Tr(this.indexes,e),i=0;i<r.length;i++)for(n=r[i],a=E.length;a--;)if(s=E[a],n.index.isPrototypeOf(s)){if(u=s.map.get(n.key),u)for(o=u.length;o--;)l=u[o],l.selector===e&&(c||l.data===t)&&(u.splice(o,1),g[l.id]=!0);break}this.size-=Object.keys(g).length}};function Or(e,t){return e.id-t.id}B.prototype.queryAll=function(e){if(!this.selectors.length)return[];var t={},r=[],n=this.querySelectorAll(this.selectors.join(", "),e),i,a,o,s,u,l,E,g;for(i=0,o=n.length;i<o;i++)for(u=n[i],l=this.matches(u),a=0,s=l.length;a<s;a++)g=l[a],t[g.id]?E=t[g.id]:(E={id:g.id,selector:g.selector,data:g.data,elements:[]},t[g.id]=E,r.push(E)),E.elements.push(u);return r.sort(Or)},B.prototype.matches=function(e){if(!e)return[];var t,r,n,i,a,o,s,u,l,E,g,c=this.activeIndexes,f={},_=[];for(t=0,i=c.length;t<i;t++)if(s=c[t],u=s.element(e),u){for(r=0,a=u.length;r<a;r++)if(l=s.map.get(u[r]))for(n=0,o=l.length;n<o;n++)E=l[n],g=E.id,!f[g]&&this.matchesSelector(e,E.selector)&&(f[g]=!0,_.push(E))}return _.sort(Or)};var je=null,It=null,mt=[];function Nr(e,t){var r=[];function n(){var a=r;r=[],t(a)}function i(){for(var a=arguments.length,o=Array(a),s=0;s<a;s++)o[s]=arguments[s];r.push(o),r.length===1&&yt(e,n)}return i}function yt(e,t){It||(It=new MutationObserver(gi)),je||(je=e.createElement("div"),It.observe(je,{attributes:!0})),mt.push(t),je.setAttribute("data-twiddle",""+Date.now())}function gi(){var e=mt;mt=[];for(var t=0;t<e.length;t++)try{e[t]()}catch(r){setTimeout(function(){throw r},0)}}var Ar=new WeakMap,_e=new WeakMap,He=new WeakMap,re=new WeakMap;function qe(e,t){for(var r=0;r<t.length;r++){var n=t[r],i=n[0],a=n[1],o=n[2];i===Ye?(pi(o,a),_i(o,a)):i===Ur?Sr(o,a):i===We&&hi(e.observers,a)}}function pi(e,t){if(t instanceof e.elementConstructor){var r=Ar.get(t);if(r||(r=[],Ar.set(t,r)),r.indexOf(e.id)===-1){var n=void 0;if(e.initialize&&(n=e.initialize.call(void 0,t)),n){var i=_e.get(t);i||(i={},_e.set(t,i)),i[""+e.id]=n}r.push(e.id)}}}function _i(e,t){if(t instanceof e.elementConstructor){var r=re.get(t);if(r||(r=[],re.set(t,r)),r.indexOf(e.id)===-1){e.elements.push(t);var n=_e.get(t),i=n?n[""+e.id]:null;if(i&&i.add&&i.add.call(void 0,t),e.subscribe){var a=e.subscribe.call(void 0,t);if(a){var o=He.get(t);o||(o={},He.set(t,o)),o[""+e.id]=a}}e.add&&e.add.call(void 0,t),r.push(e.id)}}}function Sr(e,t){if(t instanceof e.elementConstructor){var r=re.get(t);if(!!r){var n=e.elements.indexOf(t);if(n!==-1&&e.elements.splice(n,1),n=r.indexOf(e.id),n!==-1){var i=_e.get(t),a=i?i[""+e.id]:null;if(a&&a.remove&&a.remove.call(void 0,t),e.subscribe){var o=He.get(t),s=o?o[""+e.id]:null;s&&s.unsubscribe&&s.unsubscribe()}e.remove&&e.remove.call(void 0,t),r.splice(n,1)}r.length===0&&re.delete(t)}}}function hi(e,t){var r=re.get(t);if(!!r){for(var n=r.slice(0),i=0;i<n.length;i++){var a=e[n[i]];if(!!a){var o=a.elements.indexOf(t);o!==-1&&a.elements.splice(o,1);var s=_e.get(t),u=s?s[""+a.id]:null;u&&u.remove&&u.remove.call(void 0,t);var l=He.get(t),E=l?l[""+a.id]:null;E&&E.unsubscribe&&E.unsubscribe(),a.remove&&a.remove.call(void 0,t)}}re.delete(t)}}var Rt=null;function vi(e){if(Rt===null){var t=e.createElement("div"),r=e.createElement("div"),n=e.createElement("div");t.appendChild(r),r.appendChild(n),t.innerHTML="",Rt=n.parentNode!==r}return Rt}function Lr(e){return"matches"in e||"webkitMatchesSelector"in e||"mozMatchesSelector"in e||"oMatchesSelector"in e||"msMatchesSelector"in e}var Ye=1,Ur=2,We=3;function Ii(e,t,r){for(var n=0;n<r.length;n++){var i=r[n];i.type==="childList"?(Dr(e,t,i.addedNodes),mi(e,t,i.removedNodes)):i.type==="attributes"&&ze(e,t,i.target)}vi(e.ownerDocument)&&Ti(e,t)}function Dr(e,t,r){for(var n=0;n<r.length;n++){var i=r[n];if(Lr(i))for(var a=e.selectorSet.matches(i),o=0;o<a.length;o++){var s=a[o].data;t.push([Ye,i,s])}if("querySelectorAll"in i)for(var u=e.selectorSet.queryAll(i),l=0;l<u.length;l++)for(var E=u[l],g=E.data,c=E.elements,f=0;f<c.length;f++)t.push([Ye,c[f],g])}}function mi(e,t,r){for(var n=0;n<r.length;n++){var i=r[n];if("querySelectorAll"in i){t.push([We,i]);for(var a=i.querySelectorAll("*"),o=0;o<a.length;o++)t.push([We,a[o]])}}}function ze(e,t,r){if(Lr(r))for(var n=e.selectorSet.matches(r),i=0;i<n.length;i++){var a=n[i].data;t.push([Ye,r,a])}if("querySelectorAll"in r){var o=re.get(r);if(o)for(var s=0;s<o.length;s++){var u=e.observers[o[s]];u&&(e.selectorSet.matchesSelector(r,u.selector)||t.push([Ur,r,u]))}}}function yi(e,t,r){if("querySelectorAll"in r){ze(e,t,r);for(var n=r.querySelectorAll("*"),i=0;i<n.length;i++)ze(e,t,n[i])}}function Ri(e,t,r){for(var n=0;n<r.length;n++)for(var i=r[n],a=i.form?i.form.elements:e.rootNode.querySelectorAll("input"),o=0;o<a.length;o++)ze(e,t,a[o])}function Ti(e,t){for(var r=0;r<e.observers.length;r++){var n=e.observers[r];if(n)for(var i=n.elements,a=0;a<i.length;a++){var o=i[a];o.parentNode||t.push([We,o])}}}function Oi(e,t){var r=e.readyState;r==="interactive"||r==="complete"?yt(e,t):e.addEventListener("DOMContentLoaded",yt(e,t))}var Ni=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ai=0;function he(e){this.rootNode=e.nodeType===9?e.documentElement:e,this.ownerDocument=e.nodeType===9?e:e.ownerDocument,this.observers=[],this.selectorSet=new B,this.mutationObserver=new MutationObserver(Ui.bind(this,this)),this._scheduleAddRootNodes=Nr(this.ownerDocument,Li.bind(this,this)),this._handleThrottledChangedTargets=Nr(this.ownerDocument,bi.bind(this,this)),this.rootNode.addEventListener("change",Di.bind(this,this),!1),Oi(this.ownerDocument,Si.bind(this,this))}he.prototype.disconnect=function(){this.mutationObserver.disconnect()},he.prototype.observe=function(e,t){var r=void 0;typeof t=="function"?r={selector:e,initialize:t}:(typeof t=="undefined"?"undefined":Ni(t))==="object"?(r=t,r.selector=e):r=e;var n=this,i={id:Ai++,selector:r.selector,initialize:r.initialize,add:r.add,remove:r.remove,subscribe:r.subscribe,elements:[],elementConstructor:r.hasOwnProperty("constructor")?r.constructor:this.ownerDocument.defaultView.Element,abort:function(){n._abortObserving(i)}};return this.selectorSet.add(i.selector,i),this.observers[i.id]=i,this._scheduleAddRootNodes(),i},he.prototype._abortObserving=function(e){for(var t=e.elements,r=0;r<t.length;r++)Sr(e,t[r]);this.selectorSet.remove(e.selector,e),delete this.observers[e.id]},he.prototype.triggerObservers=function(e){var t=[];yi(this,t,e),qe(this,t)};function Si(e){e.mutationObserver.observe(e.rootNode,{childList:!0,attributes:!0,subtree:!0}),e._scheduleAddRootNodes()}function Li(e){var t=[];Dr(e,t,[e.rootNode]),qe(e,t)}function Ui(e,t){var r=[];Ii(e,r,t),qe(e,r)}function Di(e,t){e._handleThrottledChangedTargets(t.target)}function bi(e,t){var r=[];Ri(e,r,t),qe(e,r)}var Tt=void 0;function Ci(){return Tt||(Tt=new he(window.document)),Tt}function Pi(){var e;return(e=Ci()).observe.apply(e,arguments)}var br={},Cr={},Ot=new WeakMap,Pr=new WeakMap,Nt=new WeakMap,Vr=Object.getOwnPropertyDescriptor(Event.prototype,"currentTarget");function xr(e,t,r){var n=e[t];return e[t]=function(){return r.apply(e,arguments),n.apply(e,arguments)},e}function Vi(e,t,r){var n=[],i=t;do{if(i.nodeType!==1)break;var a=e.matches(i);if(a.length){var o={node:i,observers:a};r?n.unshift(o):n.push(o)}}while(i=i.parentElement);return n}function xi(){Ot.set(this,!0)}function Mi(){Ot.set(this,!0),Pr.set(this,!0)}function Fi(){return Nt.get(this)||null}function Mr(e,t){!Vr||Object.defineProperty(e,"currentTarget",{configurable:!0,enumerable:!0,get:t||Vr.get})}function ki(e){try{return e.eventPhase,!0}catch(t){return!1}}function wi(e){if(!!ki(e)){var t=e.eventPhase===1?Cr:br,r=t[e.type];if(!!r){var n=Vi(r,e.target,e.eventPhase===1);if(!!n.length){xr(e,"stopPropagation",xi),xr(e,"stopImmediatePropagation",Mi),Mr(e,Fi);for(var i=0,a=n.length;i<a&&!Ot.get(e);i++){var o=n[i];Nt.set(e,o.node);for(var s=0,u=o.observers.length;s<u&&!Pr.get(e);s++)o.observers[s].data.call(o.node,e)}Nt.delete(e),Mr(e)}}}}function Fr(e,t,r){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},i=!!n.capture,a=i?Cr:br,o=a[e];o||(o=new B,a[e]=o,document.addEventListener(e,wi,i)),o.add(t,r)}var Bi=Object.defineProperty,ve=(e,t)=>Bi(e,"name",{value:t,configurable:!0}),kr,wr;let M;(async function(){M=hr(),await M.onReady()})();function Br(e){return e.toLowerCase().replace(/-(.)/g,function(t,r){return r.toUpperCase()})}ve(Br,"camelCase");function Xe(e){const t={};for(const{name:r,value:n}of e.attributes)if(r.startsWith("data-optimizely-meta-")){const i=r.replace("data-optimizely-meta-","");n&&n.trim().length&&(t[Br(i)]=n)}return t}ve(Xe,"getUserAttributes"),Fr("click","[data-optimizely-event]",function(e){if(!M)return;const t=e.currentTarget,r=t.getAttribute("data-optimizely-event")||"",[n,i]=r.trim().split(/\s*,\s*/),a=Xe(t);n&&i?M.track(n,i,a):n&&M.track(n,Z(),a)}),Pi("[data-optimizely-experiment]",e=>{if(!M)return;const t=e.getAttribute("data-optimizely-experiment");if(!t||e.hidden)return;const r=Xe(e),n=M.activate(t,Z(),r);if(!n)return;const i=e.querySelectorAll("[data-optimizely-variation]");for(const a of i){const o=a.getAttribute("data-optimizely-variation");a.hidden=o!==n}});const Gi=((wr=(kr=document.querySelector('meta[name="enabled-homepage-translation-languages"]'))==null?void 0:kr.getAttribute("content"))==null?void 0:wr.split(","))||[],Gr=Ke("_locale_experiment").length>0&&Ke("_locale_experiment")[0].value==="ko"&&Gi.includes("ko");Gr&&window.location.pathname==="/"&&Kr(),Gr&&window.location.pathname==="/join"&&jr();async function Kr(){var e,t;const r="ko_homepage_translation",n=Z(),i=(t=(e=Ke("_locale")[0])==null?void 0:e.value)==null?void 0:t.slice(0,2);M.setForcedVariation(r,n,i),M.activate(r,n);const a=document.querySelectorAll("[data-optimizely-variation]");for(const o of a)o.hidden=i!==o.getAttribute("data-optimizely-variation");for(const o of document.querySelectorAll('form[action^="/join"]'))o.addEventListener("submit",()=>{M.track("submit.homepage_signup",n)});for(const o of document.querySelectorAll('a[href^="/join"]'))o.addEventListener("click",()=>{M.track("click.homepage_signup",n)})}ve(Kr,"runKoreanHomepageExperiment");async function jr(){var e;(e=document.getElementById("signup-form"))==null||e.addEventListener("submit",()=>{const t="ko_homepage_translation",r=Z();M.activate(t,r),M.track("submit.create_account",r)})}ve(jr,"trackSignupsFromKoreanHomepage");const ce=document.querySelector('meta[name^="user-currency"]');ce&&window.location.pathname==="/pricing"&&Hr();async function Hr(){var e,t,r;const n=((t=(e=document.querySelector('meta[name^="supported-currencies"]'))==null?void 0:e.getAttribute("content"))==null?void 0:t.split(","))||[],i="local_currency_pricing",a="view.pricing_page",o="usd",s="localized_currency",u=Z(),l=(r=ce==null?void 0:ce.getAttribute("content"))==null?void 0:r.toUpperCase(),E=new URLSearchParams(window.location.search);if(l==="USD"||!l||!n.includes(l))return;E.has("currency")&&M.setForcedVariation(i,u,s);const c=M.activate(i,u)===o?"USD":l;M.track(a,u,{requestedCurrency:l});for(const f of document.querySelectorAll("[data-currency]"))f.hidden=f.getAttribute("data-currency")!==c}return ve(Hr,"runCurrencyExperiment"),Fr("click","#signup_button",function(){var e,t;if(!M||!ce)return;const r=new URLSearchParams(document.location.href);if(!(r.get("pricing_exp")&&((e=r.get("ref_page"))==null?void 0:e.startsWith("/pricing"))))return;const i="submit.create_account",a=(t=ce==null?void 0:ce.getAttribute("content"))==null?void 0:t.toUpperCase();M.track(i,Z(),{requestedCurrency:a})}),$e.getUserAttributes=Xe,Object.defineProperty($e,"__esModule",{value:!0}),$e})({});
  4. //# sourceMappingURL=optimizely-1ffbd2b0.js.map