(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="";function Qr(e){var t=e.split(` `);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||\/).*?)(?::(\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;_=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=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=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>>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 `),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.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;r0){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;so:(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)?i0?(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-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=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;n3&&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})({}); //# sourceMappingURL=optimizely-1ffbd2b0.js.map