Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

launchdarkly-js-client-sdk

Package Overview
Dependencies
Maintainers
1
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

launchdarkly-js-client-sdk - npm Package Compare versions

Comparing version 2.16.3 to 2.17.0

LICENSE.txt

10

CHANGELOG.md

@@ -5,2 +5,12 @@ # Change log

## [2.17.0] - 2020-02-14
Note: if you are using the LaunchDarkly Relay Proxy to forward events, update the Relay to version 5.10.0 or later before updating to this Node SDK version.
### Added:
- The SDK now periodically sends diagnostic data to LaunchDarkly, describing the version and configuration of the SDK, the architecture and version of the runtime platform, and performance statistics. No credentials, hostnames, or other identifiable values are included. This behavior can be disabled with the `diagnosticOptOut` option, or configured with `diagnosticRecordingInterval`.
### Fixed:
- When using secure mode in conjunction with streaming mode, if an application specified a new `hash` parameter while changing the current user with `identify()`, the SDK was not using the new `hash` value when recomputing the stream URL, causing the stream to fail. (Thanks, [andrao](https://github.com/launchdarkly/js-sdk-common/issues/13)!)
- The `LICENSE.txt` file was accidentally replaced with an incomplete license in an earlier release. The standard Apache 2.0 license file has been restored. ([#202](https://github.com/launchdarkly/js-client-sdk/issues/202))
## [2.16.3] - 2020-02-05

@@ -7,0 +17,0 @@ ### Fixed:

2

dist/ldclient.cjs.js

@@ -1,2 +0,2 @@

"use strict";function e(n){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(n)}function n(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function t(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})),t.push.apply(t,r)}return t}function r(r){for(var e=1;e<arguments.length;e++){var o=null!=arguments[e]?arguments[e]:{};e%2?t(o,!0).forEach(function(e){n(r,e,o[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(o)):t(o).forEach(function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(o,e))})}return r}function o(e){function n(e,n){Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.message=e,this.code=n}return(n.prototype=new Error).name=e,n.prototype.constructor=n}Object.defineProperty(exports,"__esModule",{value:!0});var i=o("LaunchDarklyUnexpectedResponseError"),a=o("LaunchDarklyInvalidEnvironmentIdError"),u=o("LaunchDarklyInvalidUserError"),c=o("LaunchDarklyInvalidEventKeyError"),s=o("LaunchDarklyInvalidArgumentError"),l=o("LaunchDarklyFlagFetchError");function f(e){return!(400<=e&&e<500)||400===e||408===e||429===e}for(var v=Object.freeze({__proto__:null,LDUnexpectedResponseError:i,LDInvalidEnvironmentIdError:a,LDInvalidUserError:u,LDInvalidEventKeyError:c,LDInvalidArgumentError:s,LDFlagFetchError:l,isHttpErrorRecoverable:f}),d=function(e){for(var n,t=e.length,r=t%3,o=[],i=0,a=t-r;i<a;i+=16383)o.push(b(e,i,a<i+16383?a:i+16383));return 1==r?(n=e[t-1],o.push(g[n>>2]+g[n<<4&63]+"==")):2==r&&(n=(e[t-2]<<8)+e[t-1],o.push(g[n>>10]+g[n>>4&63]+g[n<<2&63]+"=")),o.join("")},g=[],p=[],m="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",y=0,h=m.length;y<h;++y)g[y]=m[y],p[m.charCodeAt(y)]=y;function b(e,n,t){for(var r,o,i=[],a=n;a<t;a+=3)r=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),i.push(g[(o=r)>>18&63]+g[o>>12&63]+g[o>>6&63]+g[63&o]);return i.join("")}p["-".charCodeAt(0)]=62,p["_".charCodeAt(0)]=63;var k=Array.isArray,E=Object.keys,w=Object.prototype.hasOwnProperty,S=["key","secondary","ip","country","email","firstName","lastName","avatar","name"];function O(e){var n=unescape(encodeURIComponent(e));return d(function(e){for(var n=[],t=0;t<e.length;t++)n.push(e.charCodeAt(t));return n}(n))}function D(e){return O(e).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function P(e){return JSON.parse(JSON.stringify(e))}function U(e,n){return function e(n,t){if(n===t)return!0;if(n&&t&&"object"==typeof n&&"object"==typeof t){var r,o,i,a=k(n),u=k(t);if(a&&u){if((o=n.length)!=t.length)return!1;for(r=o;0!=r--;)if(!e(n[r],t[r]))return!1;return!0}if(a!=u)return!1;var c=n instanceof Date,s=t instanceof Date;if(c!=s)return!1;if(c&&s)return n.getTime()==t.getTime();var l=n instanceof RegExp,f=t instanceof RegExp;if(l!=f)return!1;if(l&&f)return n.toString()==t.toString();var v=E(n);if((o=v.length)!==E(t).length)return!1;for(r=o;0!=r--;)if(!w.call(t,v[r]))return!1;for(r=o;0!=r--;)if(!e(n[i=v[r]],t[i]))return!1;return!0}return n!=n&&t!=t}(e,n)}function j(e){setTimeout(e,0)}function R(e,n){var t=e.then(function(e){return n&&setTimeout(function(){n(null,e)},0),e},function(e){if(!n)return Promise.reject(e);setTimeout(function(){n(e,null)},0)});return n?void 0:t}function I(e){var n={};for(var t in e)e.hasOwnProperty(t)&&(n[t]={value:e[t],version:0});return n}function N(e){var n={};for(var t in e)e.hasOwnProperty(t)&&(n[t]=e[t].value);return n}function T(e,n){for(var t,r=n.slice(0),o=[],i=e;0<r.length;){for(t=[];0<i;){var a=r.shift();if(!a)break;(i-=D(JSON.stringify(a)).length)<0&&0<t.length?r.unshift(a):t.push(a)}i=e,o.push(t)}return o}function F(e){var n=e.version||"3.1.2";return e.userAgent+"/"+n}function L(e,n){if(n&&!n.sendLDHeaders)return{};var t={"X-LaunchDarkly-User-Agent":F(e)};return n&&n.wrapperName&&(t["X-LaunchDarkly-Wrapper"]=n.wrapperVersion?n.wrapperName+"/"+n.wrapperVersion:n.wrapperName),t}function C(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];return n.reduce(function(e,n){return r({},e,{},n)},{})}function A(e){if(!e)return e;var n;for(var t in S){var o=S[t],i=e[o];void 0!==i&&"string"!=typeof i&&((n=n||r({},e))[o]=String(i))}return n||e}for(var x=Object.freeze({__proto__:null,btoa:O,base64URLEncode:D,clone:P,deepEquals:U,onNextTick:j,wrapPromiseCallback:R,transformValuesToVersionedValues:I,transformVersionedValuesToValues:N,chunkUserEventsForUrl:T,getLDUserAgentString:F,getLDHeaders:L,extend:C,sanitizeUser:A}),q=function(e,n){return function(e){var n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(n){var t=new Uint8Array(16);e.exports=function(){return n(t),t}}else{var r=new Array(16);e.exports=function(){for(var e,n=0;n<16;n++)0==(3&n)&&(e=4294967296*Math.random()),r[n]=e>>>((3&n)<<3)&255;return r}}}(n={exports:{}}),n.exports}(),V=[],_=0;_<256;++_)V[_]=(_+256).toString(16).substr(1);var J,z,K=function(e,n){var t=n||0,r=V;return[r[e[t++]],r[e[t++]],r[e[t++]],r[e[t++]],"-",r[e[t++]],r[e[t++]],"-",r[e[t++]],r[e[t++]],"-",r[e[t++]],r[e[t++]],"-",r[e[t++]],r[e[t++]],r[e[t++]],r[e[t++]],r[e[t++]],r[e[t++]]].join("")},$=0,M=0,H=function(e,n,t){var r=n&&t||0,o=n||[],i=(e=e||{}).node||J,a=void 0!==e.clockseq?e.clockseq:z;if(null==i||null==a){var u=q();null==i&&(i=J=[1|u[0],u[1],u[2],u[3],u[4],u[5]]),null==a&&(a=z=16383&(u[6]<<8|u[7]))}var c=void 0!==e.msecs?e.msecs:(new Date).getTime(),s=void 0!==e.nsecs?e.nsecs:M+1,l=c-$+(s-M)/1e4;if(l<0&&void 0===e.clockseq&&(a=a+1&16383),(l<0||$<c)&&void 0===e.nsecs&&(s=0),1e4<=s)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");$=c,z=a;var f=(1e4*(268435455&(c+=122192928e5))+(M=s))%4294967296;o[r++]=f>>>24&255,o[r++]=f>>>16&255,o[r++]=f>>>8&255,o[r++]=255&f;var v=c/4294967296*1e4&268435455;o[r++]=v>>>8&255,o[r++]=255&v,o[r++]=v>>>24&15|16,o[r++]=v>>>16&255,o[r++]=a>>>8|128,o[r++]=255&a;for(var d=0;d<6;++d)o[r+d]=i[d];return n||K(o)};function B(s,l,e,v){var d=l+"/events/bulk/"+e,g=l+"/a/"+e+".gif",p=s.httpFallbackPing,n={};return n.sendEvents=function(e){if(!s.httpRequest)return Promise.resolve();var n,t,r,o,i,a=s.httpAllowsPost();n=a?[e]:T(2e3-l.length,e);for(var u=[],c=0;c<n.length;c++)u.push((t=n[c],r=a,void 0,o=JSON.stringify(t),i=H(),r?function n(t){var e=C({"Content-Type":"application/json","X-LaunchDarkly-Event-Schema":"3","X-LaunchDarkly-Payload-ID":i},L(s,v));return s.httpRequest("POST",d,e,o).promise.then(function(e){if(e)return 400<=e.status&&f(e.status)&&t?n(!1):function(e){var n={status:e.status},t=e.header("date");if(t){var r=Date.parse(t);r&&(n.serverTime=r)}return n}(e)}).catch(function(){return t?n(!1):Promise.reject()})}(!0).catch(function(){}):(p&&p(g+"?d="+D(o)),Promise.resolve())));return Promise.all(u)},n}function X(){var e={},a=0,u=0,c={};return e.summarizeEvent=function(e){if("feature"===e.kind){var n=e.key+":"+(null!==e.variation&&void 0!==e.variation?e.variation:"")+":"+(null!==e.version&&void 0!==e.version?e.version:""),t=c[n];t?t.count=t.count+1:c[n]={count:1,key:e.key,variation:e.variation,version:e.version,value:e.value,default:e.default},(0===a||e.creationDate<a)&&(a=e.creationDate),e.creationDate>u&&(u=e.creationDate)}},e.getSummary=function(){var e={},n=!0;for(var t in c){var r=c[t],o=e[r.key];o||(o={default:r.default,counters:[]},e[r.key]=o);var i={value:r.value,count:r.count};void 0!==r.variation&&null!==r.variation&&(i.variation=r.variation),r.version?i.version=r.version:i.unknown=!0,o.counters.push(i),n=!1}return n?null:{startDate:a,endDate:u,features:e}},e.clearSummary=function(){u=a=0,c={}},e}function G(e){var n={},c=e.allAttributesPrivate,s=e.privateAttributeNames||[],l={key:!0,custom:!0,anonymous:!0},f={key:!0,secondary:!0,ip:!0,country:!0,email:!0,firstName:!0,lastName:!0,avatar:!0,name:!0,anonymous:!0,custom:!0};return n.filterUser=function(e){if(!e)return null;function n(o,i){return Object.keys(o).reduce(function(e,n){var t,r=e;return i(n)&&(l[t=n]||!c&&-1===a.indexOf(t)&&-1===s.indexOf(t)?r[0][n]=o[n]:r[1][n]=!0),r},[{},{}])}var a=e.privateAttributeNames||[],t=n(e,function(e){return f[e]}),r=t[0],o=t[1];if(e.custom){var i=n(e.custom,function(){return!0});r.custom=i[0],o=C({},o,i[1])}var u=Object.keys(o);return u.length&&(u.sort(),r.privateAttrs=u),r},n}function W(e){return e&&e.message?e.message:"string"==typeof e||e instanceof String?e:JSON.stringify(e)}var Q=function(){return"LaunchDarkly client initialized"},Y=" Please see https://docs.launchdarkly.com/docs/js-sdk-reference#section-initializing-the-client for instructions on SDK initialization.",Z=function(){return"Exceeded event queue capacity. Increase capacity to avoid dropping events."},ee=function(){return"Be sure to call `identify` in the LaunchDarkly client: https://docs.launchdarkly.com/docs/js-sdk-reference#section-analytics-events"},ne=function(e){return'Expected application/json content type but got "'+e+'"'},te=function(){return"localStorage is unavailable"},re=function(){return"localStorage is unavailable, so anonymous user ID cannot be cached"},oe=function(e){return"network error"+(e?" ("+e+")":"")},ie=function(e){return'Custom event "'+e+'" does not exist'},ae=function(){return"Environment not found. Double check that you specified a valid environment/client-side ID."+Y},ue=function(){return"No environment/client-side ID was specified."+Y},ce=function(e){return"Error fetching flag settings: "+W(e)},se=function(){return"No user specified."+Y},le=function(){return"Invalid user specified."+Y},fe=function(){return"LaunchDarkly client was initialized with bootstrap data that did not include flag metadata. Events may not be sent correctly."+Y},ve=function(){return"LaunchDarkly bootstrap data is not available because the back end could not read the flags."},de=function(e,n){return n?'"'+e+'" is deprecated, please use "'+n+'"':'"'+e+'" is deprecated'},ge=function(e,n,t){return"Received error "+e+(401===e?" (invalid SDK key)":"")+" for "+n+" - "+(f(e)?t:"giving up permanently")},pe=function(){return"Cannot make HTTP requests in this environment."+Y},me=function(){return"identify() has no effect here; it must be called on the main client instance"},ye=function(){return"Closing stream connection"},he=function(e){return"Opening stream connection to "+e},be=function(e,n){return"Error on stream connection: "+W(e)+", will continue retrying every "+n+" milliseconds."},ke=function(e){return'Ignoring unknown config option "'+e+'"'},Ee=function(e,n,t){return'Config option "'+e+'" should be of type '+n+", got "+t+", using default value"},we=function(e,n){return'Config option "'+e+'" should be a boolean, got '+n+", converting to boolean"},Se=function(e,n,t){return'Config option "'+e+'" was set to '+n+", changing to minimum value of "+t},Oe=function(e){return"polling for feature flags at "+e},De=function(){return"received ping message from stream"},Pe=function(){return"received streaming update for all flags"},Ue=function(e){return'received streaming update for flag "'+e+'"'},je=function(e){return'received streaming update for flag "'+e+'" but ignored due to version check'},Re=function(e){return'received streaming deletion for flag "'+e+'"'},Ie=function(e){return'received streaming deletion for flag "'+e+'" but ignored due to version check'},Ne=function(e){return'enqueueing "'+e+'" event'},Te=function(e){return"sending "+e+" events"},Fe=Object.freeze({__proto__:null,clientInitialized:Q,clientNotReady:function(){return"LaunchDarkly client is not ready"},eventCapacityExceeded:Z,eventWithoutUser:ee,invalidContentType:ne,invalidKey:function(){return"Event key must be a string"},localStorageUnavailable:te,localStorageUnavailableForUserId:re,networkError:oe,unknownCustomEventKey:ie,environmentNotFound:ae,environmentNotSpecified:ue,errorFetchingFlags:ce,userNotSpecified:se,invalidUser:le,bootstrapOldFormat:fe,bootstrapInvalid:ve,deprecated:de,httpErrorMessage:ge,httpUnavailable:pe,identifyDisabled:me,streamClosing:ye,streamConnecting:he,streamError:be,unknownOption:ke,wrongOptionType:Ee,wrongOptionTypeBoolean:we,optionBelowMinimum:Se,debugPolling:Oe,debugStreamPing:De,debugStreamPut:Pe,debugStreamPatch:Ue,debugStreamPatchIgnored:je,debugStreamDelete:Re,debugStreamDeleteIgnored:Ie,debugEnqueueingEvent:Ne,debugPostingEvents:Te});function Le(n){var e={},o={};return e.on=function(e,n,t){o[e]=o[e]||[],o[e]=o[e].concat({handler:n,context:t})},e.off=function(e,n,t){if(o[e])for(var r=0;r<o[e].length;r++)o[e][r].handler===n&&o[e][r].context===t&&(o[e]=o[e].slice(0,r).concat(o[e].slice(r+1)))},e.emit=function(e){if(o[e])for(var n=0;n<o[e].length;n++)o[e][n].handler.apply(o[e][n].context,Array.prototype.slice.call(arguments,1))},e.getEvents=function(){return Object.keys(o)},e.getEventListenerCount=function(e){return o[e]?o[e].length:0},e.maybeReportError=function(e){e&&(o.error?this.emit("error",e):(n||console).error(e.message))},e}function Ce(t,r,o,i,a){var u={};function c(){var e="",n=i.getUser();return n&&(e=o||O(JSON.stringify(n))),"ld:"+r+":"+e}return u.loadFlags=function(){return t.get(c()).then(function(e){if(null==e)return null;try{var n=JSON.parse(e);if(n){var t=n.$schema;void 0===t||t<1?n=I(n):delete n.$schema}return n}catch(e){return u.clearFlags().then(function(){return Promise.reject(e)})}}).catch(function(e){return a.warn("localStorage is unavailable"),Promise.reject(e)})},u.saveFlags=function(e){var n=C({},e,{$schema:1});return t.set(c(),JSON.stringify(n)).catch(function(e){return a.warn("localStorage is unavailable"),Promise.reject(e)})},u.clearFlags=function(){return t.clear(c()).catch(function(e){return a.warn("localStorage is unavailable"),Promise.reject(e)})},u}function Ae(p,m,u){var c=m.baseUrl,s=m.useReport,f=m.evaluationReasons,v=m.logger,e={},h={};function d(e,n){if(!p.httpRequest)return new Promise(function(e,n){n(new l(pe()))});var t=n?"REPORT":"GET",r=L(p,m);n&&(r["Content-Type"]="application/json");var o,i,u,c,s,f,v=h[e];v||(o=function(){delete h[e]},(f={addPromise:function(n,e){i=n,u&&u(),u=e,n.then(function(e){i===n&&(c(e),o())},function(e){i===n&&(s(e),o())})}}).resultPromise=new Promise(function(e,n){c=e,s=n}),v=f,h[e]=v);var d=p.httpRequest(t,e,r,n),g=d.promise.then(function(e){if(200!==e.status)return Promise.reject(404===(n=e).status?new a(ae()):new l(ce(n.statusText||String(n.status))));if(e.header("content-type")&&0===e.header("content-type").lastIndexOf("application/json"))return JSON.parse(e.body);var n,t=ne(e.header("content-type")||"");return Promise.reject(new l(t))},function(e){return Promise.reject(new l(oe(e)))});return v.addPromise(g,function(){d.cancel&&d.cancel()}),v.resultPromise}return e.fetchJSON=function(e){return d(c+e,null)},e.fetchFlagSettings=function(e,n){var t,r,o,i="";return s?(r=[c,"/sdk/evalx/",u,"/user"].join(""),o=JSON.stringify(e)):(t=D(JSON.stringify(e)),r=[c,"/sdk/evalx/",u,"/users/",t].join("")),n&&(i="h="+n),f&&(i=i+(i?"&":"")+"withReasons=true"),r=r+(i?"?":"")+i,v.debug(Oe(r)),d(r,o)},e}function xe(o,i){var e={};return e.validateUser=function(e){if(!e)return Promise.reject(new u(se()));var r=P(e);return null!==r.key&&void 0!==r.key?(r.key=r.key.toString(),Promise.resolve(r)):r.anonymous?(o?o.get("ld:$anonUserId").catch(function(){return null}):Promise.resolve(null)).then(function(e){if(e)return r.key=e,r;var n,t=H();return r.key=t,(n=t,o?o.set("ld:$anonUserId",n).catch(function(){i.warn("localStorage is unavailable, so anonymous user ID cannot be cached")}):Promise.resolve()).then(function(){return r})}):Promise.reject(new u(le()))},e}var qe={baseUrl:{default:"https://app.launchdarkly.com"},streamUrl:{default:"https://clientstream.launchdarkly.com"},eventsUrl:{default:"https://events.launchdarkly.com"},sendEvents:{default:!0},streaming:{type:"boolean"},sendLDHeaders:{default:!0},inlineUsersInEvents:{default:!1},allowFrequentDuplicateEvents:{default:!1},sendEventsOnlyForVariation:{default:!1},useReport:{default:!1},evaluationReasons:{default:!1},eventCapacity:{default:100,minimum:1},flushInterval:{default:2e3,minimum:2e3},samplingInterval:{default:0,minimum:0},streamReconnectDelay:{default:1e3,minimum:0},allAttributesPrivate:{default:!1},privateAttributeNames:{default:[]},bootstrap:{type:"string|object"},wrapperName:{type:"string"},wrapperVersion:{type:"string"},stateProvider:{type:"object"}};function Ve(e,n){var o,i=["debug","info","warn","error"];o=null!=n?""===n?"":n+" ":"LD: ";var a=0;e&&(a="none"===e?100:i.indexOf(e));var t={};function r(e,n,t){if(a<=e){var r=e<i.length?i[e]:"?";n(o+"["+r+"] "+t)}}return t.debug=function(e){return r(0,console.log,e)},t.info=function(e){return r(1,console.info,e)},t.warn=function(e){return r(2,console.warn,e)},t.error=function(e){return r(3,console.error,e)},t}function _e(n,t,o,u,v){var d,g,p,m,h,y,w,b,k,E,S,O,T,I,x,F,q,_,z,V,J,M,H,$,K,W,Y,Q,Z,ee,ne,te,re,oe=o&&o.logger?o.logger:v&&v.logger&&v.logger.default||Ve("warn"),ae=Le(oe),se=($=o,K=ae,Y=C({logger:{default:W=oe}},qe,v),Q={all_attributes_private:"allAttributesPrivate",private_attribute_names:"privateAttributeNames",samplingInterval:null},re=C({},$||{}),te=re,Object.keys(Q).forEach(function(e){if(void 0!==te[e]){var n=Q[e];W&&W.warn(de(e,n)),n&&(void 0===te[n]&&(te[n]=te[e]),delete te[e])}}),ne=C({},re),Object.keys(Y).forEach(function(e){void 0!==ne[e]&&null!==ne[e]||(ne[e]=Y[e]&&Y[e].default)}),Z=re=ne,ee=C({},Z),Object.keys(Z).forEach(function(e){var n=Z[e];if(null!=n){var t=Y[e];if(void 0===t)We(ke(e));else{var r=t.type||Ye(t.default);if("any"!==r){var o=r.split("|"),i=Ye(n);o.indexOf(i)<0?"boolean"===r?(ee[e]=!!n,We(we(e,i))):(We(Ee(e,r,i)),ee[e]=t.default):"number"===i&&void 0!==t.minimum&&n<t.minimum&&(We(Se(e,n,t.minimum)),ee[e]=t.minimum)}}}}),ee),le=se.hash,ve=se.sendEvents,pe=n,me=(w=u,k=pe,E=le,S=(b=se).streamUrl,O=b.logger,T={},I=S+"/eval/"+k,x=b.useReport,F=b.evaluationReasons,q=b.streamReconnectDelay,_=L(w,b),z=!1,H=M=J=V=null,T.connect=function(e,t){function n(n){H[n]=function(e){z=!1,t[n]&&t[n](e)}}for(var r in M=e,H={},t||{})n(r);Ke()},T.disconnect=function(){clearTimeout(J),J=null,Be()},T.isConnected=function(){return!!(V&&w.eventSourceIsActive&&w.eventSourceIsActive(V))},T),ye=se.eventProcessor||function(e,n,t,r,o){var a,u=3<arguments.length&&void 0!==r?r:null,c={},s=(4<arguments.length&&void 0!==o?o:null)||B(e,n.eventsUrl,t,n),l=X(),v=G(n),d=n.inlineUsersInEvents,g=n.samplingInterval,p=n.eventCapacity,m=n.flushInterval,h=n.logger,y=[],w=0,b=!1,k=!1;function E(){return 0===g||0===Math.floor(Math.random()*g)}function S(e){y.length<p?(y.push(e),k=!1):k||(k=!0,h.warn("Exceeded event queue capacity. Increase capacity to avoid dropping events."))}return c.enqueue=function(e){if(!b){var n=!1,t=!1;if(l.summarizeEvent(e),"feature"===e.kind?E()&&(n=!!e.trackEvents,t=function(e){return!!e.debugEventsUntilDate&&e.debugEventsUntilDate>w&&e.debugEventsUntilDate>(new Date).getTime()}(e)):n=E(),n&&S(function(e){var n=C({},e);return d||"identify"===e.kind?n.user=v.filterUser(e.user):(n.userKey=e.user.key,delete n.user),"feature"===e.kind&&(delete n.trackEvents,delete n.debugEventsUntilDate),n}(e)),t){var r=C({},e,{kind:"debug"});delete r.trackEvents,delete r.debugEventsUntilDate,delete r.variation,S(r)}}},c.flush=function(){if(b)return Promise.resolve();var e=y,n=l.getSummary();return l.clearSummary(),n&&(n.kind="summary",e.push(n)),0===e.length?Promise.resolve():(y=[],h.debug(Te(e.length)),s.sendEvents(e).then(function(e){e&&(e.serverTime&&(w=e.serverTime),f(e.status)||(b=!0),400<=e.status&&j(function(){u.maybeReportError(new i(ge(e.status,"event posting","some events were dropped")))}))}))},c.start=function(){a=setTimeout(function e(){c.flush(),a=setTimeout(e,m)},m)},c.stop=function(){clearTimeout(a)},c}(u,se,pe,ae),Oe=Ae(u,se,pe),Pe={},De={},Fe=se.streaming,_e=!1,ze=!1,Je=!0,Me=se.stateProvider,He=(h=function(e){Me||e&&Qe({kind:"identify",key:e.key,user:e,creationDate:(new Date).getTime()})},{setUser:function(e){(y=A(e))&&h&&h(P(y))},getUser:function(){return y?P(y):null}}),$e=xe(u.localStorage,oe);function Ge(e){z||(O.warn(be(e,q)),z=!0),Be(),Ke(q)}function Ke(e){J||(e?J=setTimeout(Xe,e):Xe())}function Xe(){var e;J=null;var n="",t={headers:_};if(w.eventSourceFactory){for(var r in null!=E&&(n="h="+E),x?w.eventSourceAllowsReport?(e=I,t.method="REPORT",t.headers["Content-Type"]="application/json",t.body=JSON.stringify(M)):(e=S+"/ping/"+k,n=""):e=I+"/"+D(JSON.stringify(M)),F&&(n=n+(n?"&":"")+"withReasons=true"),e=e+(n?"?":"")+n,Be(),O.info(he(e)),V=w.eventSourceFactory(e,t),H)H.hasOwnProperty(r)&&V.addEventListener(r,H[r]);V.onerror=Ge}}function Be(){V&&(O.info("Closing stream connection"),V.close(),V=null)}function We(e){j(function(){K&&K.maybeReportError(new s(e))})}function Ye(n){if(null===n)return"any";if(void 0!==n){if(Array.isArray(n))return"array";var t=e(n);return"boolean"===t||"string"===t||"number"===t||"function"===t?t:"object"}}function Qe(e){pe&&(Me&&Me.enqueueEvent&&Me.enqueueEvent(e)||(e.user?(Je=!1,!ve||ze||u.isDoNotTrack()||(oe.debug(Ne(e.kind)),ye.enqueue(e))):Je&&(oe.warn("Be sure to call `identify` in the LaunchDarkly client: https://docs.launchdarkly.com/docs/js-sdk-reference#section-analytics-events"),Je=!1)))}function Ze(e,n,t,r){var o=He.getUser(),i=new Date,a=n?n.value:null;if(!se.allowFrequentDuplicateEvents){var u=JSON.stringify(a)+(o&&o.key?o.key:"")+e,c=Pe[u];if(c&&i-c<3e5)return;Pe[u]=i}var s={kind:"feature",key:e,user:o,value:a,variation:n?n.variationIndex:null,default:t,creationDate:i.getTime()},l=De[e];l&&(s.version=l.flagVersion?l.flagVersion:l.version,s.trackEvents=l.trackEvents,s.debugEventsUntilDate=l.debugEventsUntilDate),(r||l&&l.trackReason)&&n&&(s.reason=n.reason),Qe(s)}function en(e,n,t,r){var o;if(De&&De.hasOwnProperty(e)&&De[e]&&!De[e].deleted){var i=De[e];o=nn(i),null!==i.value&&void 0!==i.value||(o.value=n)}else o={value:n,variationIndex:null,reason:{kind:"ERROR",errorKind:"FLAG_NOT_FOUND"}};return t&&Ze(e,o,n,r),o}function nn(e){return{value:e.value,variationIndex:void 0===e.variation?null:e.variation,reason:e.reason||null}}function tn(){g=!0,He.getUser()&&me.connect(He.getUser(),{ping:function(){oe.debug("received ping message from stream"),Oe.fetchFlagSettings(He.getUser(),le).then(function(e){return on(e||{})}).catch(function(e){ae.maybeReportError(new l(ce(e)))})},put:function(e){var n=JSON.parse(e.data);oe.debug("received streaming update for all flags"),on(n)},patch:function(e){var n=JSON.parse(e.data),t=De[n.key];if(!t||!t.version||!n.version||t.version<n.version){oe.debug(Ue(n.key));var r={},o=C({},n);delete o.key;var i=nn(De[n.key]=o);r[n.key]=t?{previous:t.value,current:i}:{current:i},an(r)}else oe.debug(je(n.key))},delete:function(e){var n=JSON.parse(e.data);if(!De[n.key]||De[n.key].version<n.version){oe.debug(Re(n.key));var t={};De[n.key]&&!De[n.key].deleted&&(t[n.key]={previous:De[n.key].value}),De[n.key]={version:n.version,deleted:!0},an(t)}else oe.debug(Ie(n.key))}})}function rn(){g&&(me.disconnect(),g=!1)}function on(e){var n={};if(!e)return Promise.resolve();for(var t in De)De.hasOwnProperty(t)&&De[t]&&(e[t]&&!U(e[t].value,De[t].value)?n[t]={previous:De[t].value,current:nn(e[t])}:e[t]&&!e[t].deleted||(n[t]={previous:De[t].value}));for(var o in e)e.hasOwnProperty(o)&&e[o]&&(!De[o]||De[o].deleted)&&(n[o]={current:nn(e[o])});return De=r({},e),an(n).catch(function(){})}function an(o){var e=Object.keys(o);if(0<e.length){var i={};e.forEach(function(e){var n=o[e].current,t=n?n.value:void 0,r=o[e].previous;ae.emit("change:"+e,t,r),i[e]=n?{current:t,previous:r}:{previous:r}}),ae.emit("change",i),ae.emit("internal-change",De),se.sendEventsOnlyForVariation||Me||e.forEach(function(e){Ze(e,o[e].current)})}return d&&m?m.saveFlags(De).catch(function(){return null}):Promise.resolve()}function un(){var e=Fe||p&&void 0===Fe;e&&!g?tn():!e&&g&&rn()}function cn(e){return"change"===e||"change:"===e.substr(0,"change".length+1)}u.localStorage&&(m=new Ce(u.localStorage,pe,le,He,oe));var sn=new Promise(function(e){var n=ae.on("ready",function(){ae.off("ready",n),e()})}),ln=new Promise(function(e,n){var t=ae.on("initialized",function(){ae.off("initialized",t),e()}),r=ae.on("failed",function(e){ae.off("failed",r),n(e)})});if("string"==typeof se.bootstrap&&"LOCALSTORAGE"===se.bootstrap.toUpperCase()&&(m?d=!0:oe.warn("localStorage is unavailable")),"object"===e(se.bootstrap)&&(De=function(t){var e=Object.keys(t),r=t.$flagsState;!r&&e.length&&oe.warn(fe()),!1===t.$valid&&oe.warn("LaunchDarkly bootstrap data is not available because the back end could not read the flags.");var o={};return e.forEach(function(e){if("$flagsState"!==e&&"$valid"!==e){var n={value:t[e]};r&&r[e]?n=C(n,r[e]):n.version=0,o[e]=n}}),o}(se.bootstrap)),Me){var fn=Me.getInitialState();fn?vn(fn):Me.on("init",vn),Me.on("update",function(e){e.user&&He.setUser(e.user),e.flags&&on(e.flags)})}else(n?$e.validateUser(t).then(function(n){return He.setUser(n),"object"===e(se.bootstrap)?dn():d?m.loadFlags().catch(function(){return null}).then(function(e){return null==e?(De={},Oe.fetchFlagSettings(He.getUser(),le).then(function(e){return on(e||{})}).then(dn).catch(function(e){gn(new l(ce(e)))})):(De=e,j(dn),Oe.fetchFlagSettings(He.getUser(),le).then(function(e){return on(e)}).catch(function(e){return ae.maybeReportError(e)}))}):Oe.fetchFlagSettings(He.getUser(),le).then(function(e){De=e||{},dn()}).catch(function(e){De={},gn(e)})}):Promise.reject(new a(ue()))).catch(function(e){return ae.maybeReportError(e)});function vn(e){pe=e.environment,He.setUser(e.user),De=r({},e.flags),j(dn)}function dn(){oe.info("LaunchDarkly client initialized"),_e=!0,un(),ae.emit("ready"),ae.emit("initialized")}function gn(e){ae.maybeReportError(e),ae.emit("failed",e),ae.emit("ready")}return{client:{waitForInitialization:function(){return ln},waitUntilReady:function(){return sn},identify:function(e,n,t){return ze?R(Promise.resolve({}),t):Me?(oe.warn("identify() has no effect here; it must be called on the main client instance"),R(Promise.resolve(N(De)),t)):R((d&&m?m.clearFlags():Promise.resolve()).then(function(){return $e.validateUser(e)}).then(function(t){return Oe.fetchFlagSettings(t,n).then(function(e){var n=N(e);return He.setUser(t),e?on(e).then(function(){return n}):n})}).then(function(e){return g&&tn(),e}).catch(function(e){return ae.maybeReportError(e),Promise.reject(e)}),t)},getUser:function(){return He.getUser()},variation:function(e,n){return en(e,n,!0,!1).value},variationDetail:function(e,n){return en(e,n,!0,!0)},track:function(e,n,t){if("string"==typeof e){u.customEventFilter&&!u.customEventFilter(e)&&oe.warn(ie(e));var r={kind:"custom",key:e,user:He.getUser(),url:u.getCurrentUrl(),creationDate:(new Date).getTime()};null!=n&&(r.data=n),null!=t&&(r.metricValue=t),Qe(r)}else ae.maybeReportError(new c(ie(e)))},on:function(e,n,t){cn(e)?(p=!0,_e&&un(),ae.on(e,n,t)):ae.on.apply(ae,arguments)},off:function(e){if(ae.off.apply(ae,arguments),cn(e)){var n=!1;ae.getEvents().forEach(function(e){cn(e)&&0<ae.getEventListenerCount(e)&&(n=!0)}),n||(p=!1,g&&void 0===Fe&&rn())}},setStreaming:function(e){var n=null===e?void 0:e;n!==Fe&&(Fe=n,un())},flush:function(e){return R(ve?ye.flush():Promise.resolve(),e)},allFlags:function(){var e={};if(!De)return e;for(var n in De)De.hasOwnProperty(n)&&(e[n]=en(n,null,!se.sendEventsOnlyForVariation).value);return e},close:function(e){if(ze)return R(Promise.resolve(),e);function n(){ze=!0,De={}}return R(Promise.resolve().then(function(){if(rn(),ve)return ye.stop(),ye.flush()}).then(n).catch(n),e)}},options:se,emitter:ae,ident:He,logger:oe,requestor:Oe,start:function(){ve&&ye.start()},enqueueEvent:Qe,getFlagsInternal:function(){return De},getEnvironmentId:function(){return pe},internalChangeEventName:"internal-change"}}function _defineProperty(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function ownKeys(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})),t.push.apply(t,r)}return t}function _objectSpread2(n){for(var e=1;e<arguments.length;e++){var t=null!=arguments[e]?arguments[e]:{};e%2?ownKeys(t,!0).forEach(function(e){_defineProperty(n,e,t[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ownKeys(t).forEach(function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(t,e))})}return n}function isSyncXhrSupported(){var e=window.navigator&&window.navigator.userAgent;if(e){var n=e.match(/Chrom(e|ium)\/([0-9]+)\./);if(n)return parseInt(n[2],10)<73}return!0}var emptyResult={promise:Promise.resolve({status:200,header:function(){return null},body:null})};function newHttpRequest(e,n,t,r,o){if(o&&!isSyncXhrSupported())return emptyResult;var i=new window.XMLHttpRequest;for(var a in i.open(e,n,!o),t||{})t.hasOwnProperty(a)&&i.setRequestHeader(a,t[a]);if(o)return i.send(r),emptyResult;var u;return{promise:new Promise(function(e,n){i.addEventListener("load",function(){u||e({status:i.status,header:function(e){return i.getResponseHeader(e)},body:i.responseText})}),i.addEventListener("error",function(){u||n(new Error)}),i.send(r)}),cancel:function(){u=!0,i.abort()}}}function makeBrowserPlatform(e){var n,i={};i.synchronousFlush=!1,window.XMLHttpRequest&&(i.httpRequest=function(e,n,t,r){var o=i.synchronousFlush;return i.synchronousFlush=!1,newHttpRequest(e,n,t,r,o)}),i.httpAllowsPost=function(){return void 0===n&&(n=!!window.XMLHttpRequest&&"withCredentials"in new window.XMLHttpRequest),n},i.httpFallbackPing=function(e){(new window.Image).src=e};var r,t=e&&e.eventUrlTransformer;i.getCurrentUrl=function(){return t?t(window.location.href):window.location.href},i.isDoNotTrack=function(){var e;return 1===(e=window.navigator&&void 0!==window.navigator.doNotTrack?window.navigator.doNotTrack:window.navigator&&void 0!==window.navigator.msDoNotTrack?window.navigator.msDoNotTrack:window.doNotTrack)||!0===e||"1"===e||"yes"===e};try{window.localStorage&&(i.localStorage={get:function(n){return new Promise(function(e){e(window.localStorage.getItem(n))})},set:function(n,t){return new Promise(function(e){window.localStorage.setItem(n,t),e()})},clear:function(n){return new Promise(function(e){window.localStorage.removeItem(n),e()})}})}catch(e){i.localStorage=null}var o=e&&e.useReport;if(r=o&&"function"==typeof window.EventSourcePolyfill&&window.EventSourcePolyfill.supportedOptions&&window.EventSourcePolyfill.supportedOptions.method?(i.eventSourceAllowsReport=!0,window.EventSourcePolyfill):(i.eventSourceAllowsReport=!1,window.EventSource),window.EventSource){i.eventSourceFactory=function(e,n){var t=_objectSpread2({},{heartbeatTimeout:3e5,silentTimeout:3e5,skipDefaultHeaders:!0},{},n);return new r(e,t)},i.eventSourceIsActive=function(e){return e.readyState===window.EventSource.OPEN||e.readyState===window.EventSource.CONNECTING}}return i.userAgent="JSClient",i}var matchOperatorsRe=/[|\\{}()[\]^$+*?.]/g,escapeStringRegexp=function(e){if("string"!=typeof e)throw new TypeError("Expected a string");return e.replace(matchOperatorsRe,"\\$&")};function doesUrlMatch(e,n,t,r){var o,i,a=n.replace(t,"").replace(r,"");switch(e.kind){case"exact":i=n,o=new RegExp("^"+escapeStringRegexp(e.url)+"/?$");break;case"canonical":i=a,o=new RegExp("^"+escapeStringRegexp(e.url)+"/?$");break;case"substring":i=a,o=new RegExp(".*"+escapeStringRegexp(e.substring)+".*$");break;case"regex":i=a,o=new RegExp(e.pattern);break;default:return!1}return o.test(i)}function findGoalsForClick(e,n){for(var t=[],r=0;r<n.length;r++)for(var o=e.target,i=n[r],a=i.selector,u=document.querySelectorAll(a);o&&0<u.length;){for(var c=0;c<u.length;c++)o===u[c]&&t.push(i);o=o.parentNode}return t}function GoalTracker(e,r){for(var n={},t=null,o=[],i=0;i<e.length;i++)for(var a=e[i],u=a.urls||[],c=0;c<u.length;c++)if(doesUrlMatch(u[c],window.location.href,window.location.search,window.location.hash)){"pageview"===a.kind?r("pageview",a):(o.push(a),r("click_pageview",a));break}return 0<o.length&&(t=function(e){for(var n=findGoalsForClick(e,o),t=0;t<n.length;t++)r("click",n[t])},document.addEventListener("click",t)),n.dispose=function(){document.removeEventListener("click",t)},n}var locationWatcherInterval=300;function GoalManager(r,n){var t,o,e={};function i(){o&&o.dispose(),t&&t.length&&(o=GoalTracker(t,a))}function a(e,n){var t={kind:e,key:n.key,data:null,url:window.location.href,user:r.ident.getUser(),creationDate:(new Date).getTime()};return"click"===e&&(t.selector=n.selector),r.enqueueEvent(t)}function u(e,n){var t,r=window.location.href;function o(){(t=window.location.href)!==r&&(r=t,n())}!function e(n,t){n(),setTimeout(function(){e(n,t)},t)}(o,e),window.history&&window.history.pushState?window.addEventListener("popstate",o):window.addEventListener("hashchange",o)}return e.goalKeyExists=function(e){if(!t)return!0;for(var n=0;n<t.length;n++)if("custom"===t[n].kind&&t[n].key===e)return!0;return!1},r.requestor.fetchJSON("/sdk/goals/"+r.getEnvironmentId()).then(function(e){e&&0<e.length&&(o=GoalTracker(t=e,a),u(locationWatcherInterval,i)),n()}).catch(function(e){r.emitter.maybeReportError(new v.LDUnexpectedResponseError((e&&e.message,e.message))),n()}),e}var goalsEvent="goalsReady",extraOptionDefs={fetchGoals:{default:!0},hash:{type:"string"},eventUrlTransformer:{type:"function"}};function initialize(e,n){var t=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},r=makeBrowserPlatform(t),o=_e(e,n,t,r,extraOptionDefs),i=o.client,a=o.options,u=o.emitter,c=new Promise(function(e){var n=u.on(goalsEvent,function(){u.off(goalsEvent,n),e()})});if(i.waitUntilGoalsReady=function(){return c},a.fetchGoals){var s=GoalManager(o,function(){return u.emit(goalsEvent)});r.customEventFilter=s.goalKeyExists}else u.emit(goalsEvent);"complete"!==document.readyState?window.addEventListener("load",o.start):o.start();function l(){r.synchronousFlush=!0,i.flush().catch(function(){}),r.synchronousFlush=!1}return window.addEventListener("beforeunload",l),window.addEventListener("unload",l),i}var createConsoleLogger=Ve,version="2.16.3";function deprecatedInitialize(e,n){var t=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};return console&&console.warn&&console.warn(Fe.deprecated("default export","named LDClient export")),initialize(e,n,t)}var index={initialize:deprecatedInitialize,version:version};exports.createConsoleLogger=createConsoleLogger,exports.default=index,exports.initialize=initialize,exports.version=version;
"use strict";function e(n){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(n)}function n(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function t(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})),t.push.apply(t,r)}return t}function r(r){for(var e=1;e<arguments.length;e++){var o=null!=arguments[e]?arguments[e]:{};e%2?t(o,!0).forEach(function(e){n(r,e,o[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(o)):t(o).forEach(function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(o,e))})}return r}function i(e){function n(e,n){Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.message=e,this.code=n}return(n.prototype=new Error).name=e,n.prototype.constructor=n}Object.defineProperty(exports,"__esModule",{value:!0});var o=i("LaunchDarklyUnexpectedResponseError"),a=i("LaunchDarklyInvalidEnvironmentIdError"),u=i("LaunchDarklyInvalidUserError"),s=i("LaunchDarklyInvalidEventKeyError"),c=i("LaunchDarklyInvalidArgumentError"),l=i("LaunchDarklyFlagFetchError");function f(e){return!(400<=e&&e<500)||400===e||408===e||429===e}for(var v=Object.freeze({__proto__:null,LDUnexpectedResponseError:o,LDInvalidEnvironmentIdError:a,LDInvalidUserError:u,LDInvalidEventKeyError:s,LDInvalidArgumentError:c,LDFlagFetchError:l,isHttpErrorRecoverable:f}),d=function(e){for(var n,t=e.length,r=t%3,o=[],i=0,a=t-r;i<a;i+=16383)o.push(b(e,i,a<i+16383?a:i+16383));return 1==r?(n=e[t-1],o.push(g[n>>2]+g[n<<4&63]+"==")):2==r&&(n=(e[t-2]<<8)+e[t-1],o.push(g[n>>10]+g[n>>4&63]+g[n<<2&63]+"=")),o.join("")},g=[],p=[],m="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",h=0,y=m.length;h<y;++h)g[h]=m[h],p[m.charCodeAt(h)]=h;function b(e,n,t){for(var r,o,i=[],a=n;a<t;a+=3)r=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),i.push(g[(o=r)>>18&63]+g[o>>12&63]+g[o>>6&63]+g[63&o]);return i.join("")}p["-".charCodeAt(0)]=62,p["_".charCodeAt(0)]=63;var k=Array.isArray,E=Object.keys,w=Object.prototype.hasOwnProperty,D=["key","secondary","ip","country","email","firstName","lastName","avatar","name"];function S(e){var n=unescape(encodeURIComponent(e));return d(function(e){for(var n=[],t=0;t<e.length;t++)n.push(e.charCodeAt(t));return n}(n))}function O(e){return S(e).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function P(e){return JSON.parse(JSON.stringify(e))}function U(e,n){return function e(n,t){if(n===t)return!0;if(n&&t&&"object"==typeof n&&"object"==typeof t){var r,o,i,a=k(n),u=k(t);if(a&&u){if((o=n.length)!=t.length)return!1;for(r=o;0!=r--;)if(!e(n[r],t[r]))return!1;return!0}if(a!=u)return!1;var s=n instanceof Date,c=t instanceof Date;if(s!=c)return!1;if(s&&c)return n.getTime()==t.getTime();var l=n instanceof RegExp,f=t instanceof RegExp;if(l!=f)return!1;if(l&&f)return n.toString()==t.toString();var v=E(n);if((o=v.length)!==E(t).length)return!1;for(r=o;0!=r--;)if(!w.call(t,v[r]))return!1;for(r=o;0!=r--;)if(!e(n[i=v[r]],t[i]))return!1;return!0}return n!=n&&t!=t}(e,n)}function I(e){setTimeout(e,0)}function j(e,n){var t=e.then(function(e){return n&&setTimeout(function(){n(null,e)},0),e},function(e){if(!n)return Promise.reject(e);setTimeout(function(){n(e,null)},0)});return n?void 0:t}function R(e){var n={};for(var t in e)e.hasOwnProperty(t)&&(n[t]={value:e[t],version:0});return n}function T(e){var n={};for(var t in e)e.hasOwnProperty(t)&&(n[t]=e[t].value);return n}function N(e,n){for(var t,r=n.slice(0),o=[],i=e;0<r.length;){for(t=[];0<i;){var a=r.shift();if(!a)break;(i-=O(JSON.stringify(a)).length)<0&&0<t.length?r.unshift(a):t.push(a)}i=e,o.push(t)}return o}function F(e){var n=e.version||"3.2.2";return e.userAgent+"/"+n}function C(e,n){if(n&&!n.sendLDHeaders)return{};var t={"X-LaunchDarkly-User-Agent":F(e)};return n&&n.wrapperName&&(t["X-LaunchDarkly-Wrapper"]=n.wrapperVersion?n.wrapperName+"/"+n.wrapperVersion:n.wrapperName),t}function L(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];return n.reduce(function(e,n){return r({},e,{},n)},{})}function A(e){if(!e)return e;var n;for(var t in D){var o=D[t],i=e[o];void 0!==i&&"string"!=typeof i&&((n=n||r({},e))[o]=String(i))}return n||e}for(var x=Object.freeze({__proto__:null,btoa:S,base64URLEncode:O,clone:P,deepEquals:U,onNextTick:I,wrapPromiseCallback:j,transformValuesToVersionedValues:R,transformVersionedValuesToValues:T,chunkUserEventsForUrl:N,getLDUserAgentString:F,getLDHeaders:C,extend:L,sanitizeUser:A}),V=function(e,n){return function(e){var n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(n){var t=new Uint8Array(16);e.exports=function(){return n(t),t}}else{var r=new Array(16);e.exports=function(){for(var e,n=0;n<16;n++)0==(3&n)&&(e=4294967296*Math.random()),r[n]=e>>>((3&n)<<3)&255;return r}}}(n={exports:{}}),n.exports}(),q=[],_=0;_<256;++_)q[_]=(_+256).toString(16).substr(1);var J,z,M=function(e,n){var t=n||0,r=q;return[r[e[t++]],r[e[t++]],r[e[t++]],r[e[t++]],"-",r[e[t++]],r[e[t++]],"-",r[e[t++]],r[e[t++]],"-",r[e[t++]],r[e[t++]],"-",r[e[t++]],r[e[t++]],r[e[t++]],r[e[t++]],r[e[t++]],r[e[t++]]].join("")},B=0,K=0,$=function(e,n,t){var r=n&&t||0,o=n||[],i=(e=e||{}).node||J,a=void 0!==e.clockseq?e.clockseq:z;if(null==i||null==a){var u=V();null==i&&(i=J=[1|u[0],u[1],u[2],u[3],u[4],u[5]]),null==a&&(a=z=16383&(u[6]<<8|u[7]))}var s=void 0!==e.msecs?e.msecs:(new Date).getTime(),c=void 0!==e.nsecs?e.nsecs:K+1,l=s-B+(c-K)/1e4;if(l<0&&void 0===e.clockseq&&(a=a+1&16383),(l<0||B<s)&&void 0===e.nsecs&&(c=0),1e4<=c)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");B=s,z=a;var f=(1e4*(268435455&(s+=122192928e5))+(K=c))%4294967296;o[r++]=f>>>24&255,o[r++]=f>>>16&255,o[r++]=f>>>8&255,o[r++]=255&f;var v=s/4294967296*1e4&268435455;o[r++]=v>>>8&255,o[r++]=255&v,o[r++]=v>>>24&15|16,o[r++]=v>>>16&255,o[r++]=a>>>8|128,o[r++]=255&a;for(var d=0;d<6;++d)o[r+d]=i[d];return n||M(o)};function G(u,e,n){var t="/a/"+e+".gif",s=L({"Content-Type":"application/json"},C(u,n)),c=u.httpFallbackPing,l={sendChunk:function(e,r,o,n){var i=JSON.stringify(e),a=o?null:$();return n?function n(t){var e=o?s:L({},s,{"X-LaunchDarkly-Event-Schema":"3","X-LaunchDarkly-Payload-ID":a});return u.httpRequest("POST",r,e,i).promise.then(function(e){if(e)return 400<=e.status&&f(e.status)&&t?n(!1):function(e){var n={status:e.status},t=e.header("date");if(t){var r=Date.parse(t);r&&(n.serverTime=r)}return n}(e)}).catch(function(){return t?n(!1):Promise.reject()})}(!0).catch(function(){}):(c&&c(r+t+"?d="+O(i)),Promise.resolve())},sendEvents:function(e,n,t){if(!u.httpRequest)return Promise.resolve();var r,o=u.httpAllowsPost();r=o?[e]:N(2e3-n.length,e);for(var i=[],a=0;a<r.length;a++)i.push(l.sendChunk(r[a],n,t,o));return Promise.all(i)}};return l}function H(){var e={},a=0,u=0,s={};return e.summarizeEvent=function(e){if("feature"===e.kind){var n=e.key+":"+(null!==e.variation&&void 0!==e.variation?e.variation:"")+":"+(null!==e.version&&void 0!==e.version?e.version:""),t=s[n];t?t.count=t.count+1:s[n]={count:1,key:e.key,variation:e.variation,version:e.version,value:e.value,default:e.default},(0===a||e.creationDate<a)&&(a=e.creationDate),e.creationDate>u&&(u=e.creationDate)}},e.getSummary=function(){var e={},n=!0;for(var t in s){var r=s[t],o=e[r.key];o||(o={default:r.default,counters:[]},e[r.key]=o);var i={value:r.value,count:r.count};void 0!==r.variation&&null!==r.variation&&(i.variation=r.variation),r.version?i.version=r.version:i.unknown=!0,o.counters.push(i),n=!1}return n?null:{startDate:a,endDate:u,features:e}},e.clearSummary=function(){u=a=0,s={}},e}function X(e){var n={},s=e.allAttributesPrivate,c=e.privateAttributeNames||[],l={key:!0,custom:!0,anonymous:!0},f={key:!0,secondary:!0,ip:!0,country:!0,email:!0,firstName:!0,lastName:!0,avatar:!0,name:!0,anonymous:!0,custom:!0};return n.filterUser=function(e){if(!e)return null;function n(o,i){return Object.keys(o).reduce(function(e,n){var t,r=e;return i(n)&&(l[t=n]||!s&&-1===a.indexOf(t)&&-1===c.indexOf(t)?r[0][n]=o[n]:r[1][n]=!0),r},[{},{}])}var a=e.privateAttributeNames||[],t=n(e,function(e){return f[e]}),r=t[0],o=t[1];if(e.custom){var i=n(e.custom,function(){return!0});r.custom=i[0],o=L({},o,i[1])}var u=Object.keys(o);return u.length&&(u.sort(),r.privateAttrs=u),r},n}function W(e){return e&&e.message?e.message:"string"==typeof e||e instanceof String?e:JSON.stringify(e)}var Q=function(){return"LaunchDarkly client initialized"},Y=" Please see https://docs.launchdarkly.com/docs/js-sdk-reference#section-initializing-the-client for instructions on SDK initialization.",Z=function(){return"Exceeded event queue capacity. Increase capacity to avoid dropping events."},ee=function(){return"Be sure to call `identify` in the LaunchDarkly client: https://docs.launchdarkly.com/docs/js-sdk-reference#section-analytics-events"},ne=function(e){return'Expected application/json content type but got "'+e+'"'},te=function(){return"localStorage is unavailable"},re=function(){return"localStorage is unavailable, so anonymous user ID cannot be cached"},ie=function(e){return"network error"+(e?" ("+e+")":"")},oe=function(e){return'Custom event "'+e+'" does not exist'},ae=function(){return"Environment not found. Double check that you specified a valid environment/client-side ID."+Y},ue=function(){return"No environment/client-side ID was specified."+Y},se=function(e){return"Error fetching flag settings: "+W(e)},ce=function(){return"No user specified."+Y},le=function(){return"Invalid user specified."+Y},fe=function(){return"LaunchDarkly client was initialized with bootstrap data that did not include flag metadata. Events may not be sent correctly."+Y},ve=function(){return"LaunchDarkly bootstrap data is not available because the back end could not read the flags."},de=function(e,n){return n?'"'+e+'" is deprecated, please use "'+n+'"':'"'+e+'" is deprecated'},ge=function(e,n,t){return"Received error "+e+(401===e?" (invalid SDK key)":"")+" for "+n+" - "+(f(e)?t:"giving up permanently")},pe=function(){return"Cannot make HTTP requests in this environment."+Y},me=function(){return"identify() has no effect here; it must be called on the main client instance"},he=function(){return"Closing stream connection"},ye=function(e){return"Opening stream connection to "+e},be=function(e,n){return"Error on stream connection: "+W(e)+", will continue retrying every "+n+" milliseconds."},ke=function(e){return'Ignoring unknown config option "'+e+'"'},Ee=function(e,n,t){return'Config option "'+e+'" should be of type '+n+", got "+t+", using default value"},we=function(e,n){return'Config option "'+e+'" should be a boolean, got '+n+", converting to boolean"},De=function(e,n,t){return'Config option "'+e+'" was set to '+n+", changing to minimum value of "+t},Se=function(e){return"polling for feature flags at "+e},Oe=function(){return"received ping message from stream"},Pe=function(){return"received streaming update for all flags"},Ue=function(e){return'received streaming update for flag "'+e+'"'},Ie=function(e){return'received streaming update for flag "'+e+'" but ignored due to version check'},je=function(e){return'received streaming deletion for flag "'+e+'"'},Re=function(e){return'received streaming deletion for flag "'+e+'" but ignored due to version check'},Te=function(e){return'enqueueing "'+e+'" event'},Ne=function(e){return"sending "+e+" events"},Fe=Object.freeze({__proto__:null,clientInitialized:Q,clientNotReady:function(){return"LaunchDarkly client is not ready"},eventCapacityExceeded:Z,eventWithoutUser:ee,invalidContentType:ne,invalidKey:function(){return"Event key must be a string"},localStorageUnavailable:te,localStorageUnavailableForUserId:re,networkError:ie,unknownCustomEventKey:oe,environmentNotFound:ae,environmentNotSpecified:ue,errorFetchingFlags:se,userNotSpecified:ce,invalidUser:le,bootstrapOldFormat:fe,bootstrapInvalid:ve,deprecated:de,httpErrorMessage:ge,httpUnavailable:pe,identifyDisabled:me,streamClosing:he,streamConnecting:ye,streamError:be,unknownOption:ke,wrongOptionType:Ee,wrongOptionTypeBoolean:we,optionBelowMinimum:De,debugPolling:Se,debugStreamPing:Oe,debugStreamPut:Pe,debugStreamPatch:Ue,debugStreamPatchIgnored:Ie,debugStreamDelete:je,debugStreamDeleteIgnored:Re,debugEnqueueingEvent:Te,debugPostingEvents:Ne,debugPostingDiagnosticEvent:function(e){return"sending diagnostic event ("+e.kind+")"}});function Ce(n){var e={},o={};return e.on=function(e,n,t){o[e]=o[e]||[],o[e]=o[e].concat({handler:n,context:t})},e.off=function(e,n,t){if(o[e])for(var r=0;r<o[e].length;r++)o[e][r].handler===n&&o[e][r].context===t&&(o[e]=o[e].slice(0,r).concat(o[e].slice(r+1)))},e.emit=function(e){if(o[e])for(var n=0;n<o[e].length;n++)o[e][n].handler.apply(o[e][n].context,Array.prototype.slice.call(arguments,1))},e.getEvents=function(){return Object.keys(o)},e.getEventListenerCount=function(e){return o[e]?o[e].length:0},e.maybeReportError=function(e){e&&(o.error?this.emit("error",e):(n||console).error(e.message))},e}function Le(t,r,o,i,a){var u={};function s(){var e="",n=i.getUser();return n&&(e=o||S(JSON.stringify(n))),"ld:"+r+":"+e}return u.loadFlags=function(){return t.get(s()).then(function(e){if(null==e)return null;try{var n=JSON.parse(e);if(n){var t=n.$schema;void 0===t||t<1?n=R(n):delete n.$schema}return n}catch(e){return u.clearFlags().then(function(){return Promise.reject(e)})}}).catch(function(e){return a.warn("localStorage is unavailable"),Promise.reject(e)})},u.saveFlags=function(e){var n=L({},e,{$schema:1});return t.set(s(),JSON.stringify(n)).catch(function(e){return a.warn("localStorage is unavailable"),Promise.reject(e)})},u.clearFlags=function(){return t.clear(s()).catch(function(e){return a.warn("localStorage is unavailable"),Promise.reject(e)})},u}function Ae(o,e,i,n){var a,u=e.streamUrl,s=e.logger,t={},c=u+"/eval/"+i,l=e.useReport,f=e.evaluationReasons,r=e.streamReconnectDelay,v=C(o,e),d=!1,g=null,p=null,m=null,h=null,y=null;function w(e){d||(s.warn(be(e,r)),d=!0),S(!1),E(),b(r)}function b(e){p||(e?p=setTimeout(k,e):k())}function k(){var e;p=null;var n="",t={headers:v};if(o.eventSourceFactory){for(var r in null!=h&&(n="h="+h),l?o.eventSourceAllowsReport?(e=c,t.method="REPORT",t.headers["Content-Type"]="application/json",t.body=JSON.stringify(m)):(e=u+"/ping/"+i,n=""):e=c+"/"+O(JSON.stringify(m)),f&&(n=n+(n?"&":"")+"withReasons=true"),e=e+(n?"?":"")+n,E(),s.info(ye(e)),a=(new Date).getTime(),g=o.eventSourceFactory(e,t),y)y.hasOwnProperty(r)&&g.addEventListener(r,y[r]);g.onerror=w}}function E(){g&&(s.info("Closing stream connection"),g.close(),g=null)}function S(e){a&&n&&n.recordStreamInit(a,!e,(new Date).getTime()-a),a=null}return t.connect=function(e,n,t){m=e,h=n,y={};function r(n){y[n]=function(e){S(!(d=!1)),t[n]&&t[n](e)}}for(var o in t||{})r(o);b()},t.disconnect=function(){clearTimeout(p),p=null,E()},t.isConnected=function(){return!!(g&&o.eventSourceIsActive&&o.eventSourceIsActive(g))},t}function xe(p,m,u){var s=m.baseUrl,c=m.useReport,f=m.evaluationReasons,v=m.logger,e={},h={};function d(e,n){if(!p.httpRequest)return new Promise(function(e,n){n(new l(pe()))});var t=n?"REPORT":"GET",r=C(p,m);n&&(r["Content-Type"]="application/json");var o,i,u,s,c,f,v=h[e];v||(o=function(){delete h[e]},(f={addPromise:function(n,e){i=n,u&&u(),u=e,n.then(function(e){i===n&&(s(e),o())},function(e){i===n&&(c(e),o())})}}).resultPromise=new Promise(function(e,n){s=e,c=n}),v=f,h[e]=v);var d=p.httpRequest(t,e,r,n),g=d.promise.then(function(e){if(200!==e.status)return Promise.reject(404===(n=e).status?new a(ae()):new l(se(n.statusText||String(n.status))));if(e.header("content-type")&&0===e.header("content-type").lastIndexOf("application/json"))return JSON.parse(e.body);var n,t=ne(e.header("content-type")||"");return Promise.reject(new l(t))},function(e){return Promise.reject(new l(ie(e)))});return v.addPromise(g,function(){d.cancel&&d.cancel()}),v.resultPromise}return e.fetchJSON=function(e){return d(s+e,null)},e.fetchFlagSettings=function(e,n){var t,r,o,i="";return c?(r=[s,"/sdk/evalx/",u,"/user"].join(""),o=JSON.stringify(e)):(t=O(JSON.stringify(e)),r=[s,"/sdk/evalx/",u,"/users/",t].join("")),n&&(i="h="+n),f&&(i=i+(i?"&":"")+"withReasons=true"),r=r+(i?"?":"")+i,v.debug(Se(r)),d(r,o)},e}function Ve(o,i){var e={};return e.validateUser=function(e){if(!e)return Promise.reject(new u(ce()));var r=P(e);return null!==r.key&&void 0!==r.key?(r.key=r.key.toString(),Promise.resolve(r)):r.anonymous?(o?o.get("ld:$anonUserId").catch(function(){return null}):Promise.resolve(null)).then(function(e){if(e)return r.key=e,r;var n,t=$();return r.key=t,(n=t,o?o.set("ld:$anonUserId",n).catch(function(){i.warn("localStorage is unavailable, so anonymous user ID cannot be cached")}):Promise.resolve()).then(function(){return r})}):Promise.reject(new u(le()))},e}var qe={baseUrl:{default:"https://app.launchdarkly.com"},streamUrl:{default:"https://clientstream.launchdarkly.com"},eventsUrl:{default:"https://events.launchdarkly.com"},sendEvents:{default:!0},streaming:{type:"boolean"},sendLDHeaders:{default:!0},inlineUsersInEvents:{default:!1},allowFrequentDuplicateEvents:{default:!1},sendEventsOnlyForVariation:{default:!1},useReport:{default:!1},evaluationReasons:{default:!1},eventCapacity:{default:100,minimum:1},flushInterval:{default:2e3,minimum:2e3},samplingInterval:{default:0,minimum:0},streamReconnectDelay:{default:1e3,minimum:0},allAttributesPrivate:{default:!1},privateAttributeNames:{default:[]},bootstrap:{type:"string|object"},diagnosticRecordingInterval:{default:9e5,minimum:2e3},diagnosticOptOut:{default:!1},wrapperName:{type:"string"},wrapperVersion:{type:"string"},stateProvider:{type:"object"}};function _e(n,t,r,o){var a=L({logger:{default:o}},qe,r),i={all_attributes_private:"allAttributesPrivate",private_attribute_names:"privateAttributeNames",samplingInterval:null};function u(e){I(function(){t&&t.maybeReportError(new c(e))})}var s,l,f,v,d=L({},n||{});return v=d,Object.keys(i).forEach(function(e){if(void 0!==v[e]){var n=i[e];o&&o.warn(de(e,n)),n&&(void 0===v[n]&&(v[n]=v[e]),delete v[e])}}),f=L({},d),Object.keys(a).forEach(function(e){void 0!==f[e]&&null!==f[e]||(f[e]=a[e]&&a[e].default)}),s=d=f,l=L({},s),Object.keys(s).forEach(function(e){var n=s[e];if(null!=n){var t=a[e];if(void 0===t)u(ke(e));else{var r=t.type||g(t.default);if("any"!==r){var o=r.split("|"),i=g(n);o.indexOf(i)<0?"boolean"===r?(l[e]=!!n,u(we(e,i))):(u(Ee(e,r,i)),l[e]=t.default):"number"===i&&void 0!==t.minimum&&n<t.minimum&&(u(De(e,n,t.minimum)),l[e]=t.minimum)}}}}),l;function g(n){if(null===n)return"any";if(void 0!==n){if(Array.isArray(n))return"array";var t=e(n);return"boolean"===t||"string"===t||"number"===t||"function"===t?t:"object"}}}var Je=Object.freeze({__proto__:null,baseOptionDefs:qe,validate:_e}).baseOptionDefs,ze=function(e){var n={diagnosticId:$()};return e&&(n.sdkKeySuffix=6<e.length?e.substring(e.length-6):e),n},Me=function(e){var n,t,r,o;function i(e){n=e,r=t=0,o=[]}return i(e),{getProps:function(){return{dataSinceDate:n,droppedEvents:t,eventsInLastBatch:r,streamInits:o}},setProps:function(e){n=e.dataSinceDate,t=e.droppedEvents||0,r=e.eventsInLastBatch||0,o=e.streamInits||[]},incrementDroppedEvents:function(){t++},setEventsInLastBatch:function(e){r=e},recordStreamInit:function(e,n,t){var r={timestamp:e,failed:n,durationMillis:t};o.push(r)},reset:i}},Be=function(o,e,n,t,i,a){var u,s,c=!!o.diagnosticUseCombinedEvent,l="ld:"+t+":$diagnostics",f=i.eventsUrl+"/events/diagnostic/"+t,v=i.diagnosticRecordingInterval,d=e,g=!!i.streaming,p={};function m(){return{sdk:function(){var e=r({},o.diagnosticSdkData);return i.wrapperName&&(e.wrapperName=i.wrapperName),i.wrapperVersion&&(e.wrapperVersion=i.wrapperVersion),e}(),configuration:(e={customBaseURI:i.baseUrl!==Je.baseUrl.default,customStreamURI:i.streamUrl!==Je.streamUrl.default,customEventsURI:i.eventsUrl!==Je.eventsUrl.default,eventsCapacity:i.eventCapacity,eventsFlushIntervalMillis:i.flushInterval,reconnectTimeMillis:i.streamReconnectDelay,streamingDisabled:!g,allAttributesPrivate:!!i.allAttributesPrivate,inlineUsersInEvents:!!i.inlineUsersInEvents,diagnosticRecordingIntervalMillis:i.diagnosticRecordingInterval,usingSecureMode:!!i.hash,bootstrapMode:!!i.bootstrap,fetchGoalsDisabled:!i.fetchGoals,allowFrequentDuplicateEvents:!!i.allowFrequentDuplicateEvents,sendEventsOnlyForVariation:!!i.sendEventsOnlyForVariation},e),platform:o.diagnosticPlatformData};var e}function h(e){i.logger&&i.logger.debug(Fe.debugPostingDiagnosticEvent(e)),n.sendEvents(e,f,!0).then(function(){}).catch(function(){})}function y(){var e,n;h((e=(new Date).getTime(),n=r({kind:c?"diagnostic-combined":"diagnostic",id:a,creationDate:e},d.getProps()),c&&(n=r({},n,{},m())),d.reset(e),n)),s=setTimeout(y,v),u=(new Date).getTime(),c&&function(){if(o.localStorage){var e=r({},d.getProps());o.localStorage.set(l,JSON.stringify(e),function(){})}}()}return p.start=function(){c?function(t){if(!o.localStorage)return t(!1);o.localStorage.get(l).then(function(e){if(e)try{var n=JSON.parse(e);d.setProps(n),u=n.dataSinceDate}catch(e){}t(!0)}).catch(function(){t(!1)})}(function(e){if(e){var n=(u||0)+v,t=(new Date).getTime();n<=t?y():s=setTimeout(y,n-t)}else 0===Math.floor(4*Math.random())?y():s=setTimeout(y,v)}):(h(r({kind:"diagnostic-init",id:a,creationDate:d.getProps().dataSinceDate},m())),s=setTimeout(y,v))},p.stop=function(){s&&clearTimeout(s)},p.setStreaming=function(e){g=e},p};function Ke(e,n){var o,i=["debug","info","warn","error"];o=null!=n?""===n?"":n+" ":"LD: ";var a=0;e&&(a="none"===e?100:i.indexOf(e));var t={};function r(e,n,t){if(a<=e){var r=e<i.length?i[e]:"?";n(o+"["+r+"] "+t)}}return t.debug=function(e){return r(0,console.log,e)},t.info=function(e){return r(1,console.info,e)},t.warn=function(e){return r(2,console.warn,e)},t.error=function(e){return r(3,console.error,e)},t}function $e(n,t,i,u,c){var v=i&&i.logger?i.logger:c&&c.logger&&c.logger.default||Ke("warn"),d=Ce(v),g=_e(i,d,c,v),p=g.sendEvents,m=n,h=g.hash,y=G(u,m,g),w=g.sendEvents&&!g.diagnosticOptOut,b=w?ze(m):null,k=w?Me((new Date).getTime()):null,E=w?Be(u,k,y,m,g,b):null;E&&E.start();var S,D,O,R,N,C,x=Ae(u,g,m,k),F=g.eventProcessor||function(e,n,t,r,i,a){var u,s=3<arguments.length&&void 0!==r?r:null,c=4<arguments.length&&void 0!==i?i:null,l={},v=(5<arguments.length&&void 0!==a?a:null)||G(e,t,n),d=n.eventsUrl+"/events/bulk/"+t,g=H(),p=X(n),m=n.inlineUsersInEvents,h=n.samplingInterval,y=n.eventCapacity,w=n.flushInterval,b=n.logger,k=[],E=0,S=!1,P=!1;function D(){return 0===h||0===Math.floor(Math.random()*h)}function O(e){k.length<y?(k.push(e),P=!1):(P||(P=!0,b.warn("Exceeded event queue capacity. Increase capacity to avoid dropping events.")),s&&s.incrementDroppedEvents())}return l.enqueue=function(e){if(!S){var n=!1,t=!1;if(g.summarizeEvent(e),"feature"===e.kind?D()&&(n=!!e.trackEvents,t=function(e){return!!e.debugEventsUntilDate&&e.debugEventsUntilDate>E&&e.debugEventsUntilDate>(new Date).getTime()}(e)):n=D(),n&&O(function(e){var n=L({},e);return m||"identify"===e.kind?n.user=p.filterUser(e.user):(n.userKey=e.user.key,delete n.user),"feature"===e.kind&&(delete n.trackEvents,delete n.debugEventsUntilDate),n}(e)),t){var r=L({},e,{kind:"debug"});delete r.trackEvents,delete r.debugEventsUntilDate,delete r.variation,O(r)}}},l.flush=function(){if(S)return Promise.resolve();var e=k,n=g.getSummary();return g.clearSummary(),n&&(n.kind="summary",e.push(n)),s&&s.setEventsInLastBatch(e.length),0===e.length?Promise.resolve():(k=[],b.debug(Ne(e.length)),v.sendEvents(e,d).then(function(e){e&&(e.serverTime&&(E=e.serverTime),f(e.status)||(S=!0),400<=e.status&&I(function(){c.maybeReportError(new o(ge(e.status,"event posting","some events were dropped")))}))}))},l.start=function(){u=setTimeout(function e(){l.flush(),u=setTimeout(e,w)},w)},l.stop=function(){clearTimeout(u)},l}(u,g,m,k,d,y),q=xe(u,g,m),_={},z={},J=g.streaming,V=!1,M=!1,K=!0,$=g.stateProvider,B=(N=function(e){$||e&&Y({kind:"identify",key:e.key,user:e,creationDate:(new Date).getTime()})},{setUser:function(e){(C=A(e))&&N&&N(P(C))},getUser:function(){return C?P(C):null}}),W=Ve(u.localStorage,v);function Y(e){m&&($&&$.enqueueEvent&&$.enqueueEvent(e)||(e.user?(K=!1,!p||M||u.isDoNotTrack()||(v.debug(Te(e.kind)),F.enqueue(e))):K&&(v.warn("Be sure to call `identify` in the LaunchDarkly client: https://docs.launchdarkly.com/docs/js-sdk-reference#section-analytics-events"),K=!1)))}function Q(e,n,t,r){var o=B.getUser(),i=new Date,a=n?n.value:null;if(!g.allowFrequentDuplicateEvents){var u=JSON.stringify(a)+(o&&o.key?o.key:"")+e,s=_[u];if(s&&i-s<3e5)return;_[u]=i}var c={kind:"feature",key:e,user:o,value:a,variation:n?n.variationIndex:null,default:t,creationDate:i.getTime()},l=z[e];l&&(c.version=l.flagVersion?l.flagVersion:l.version,c.trackEvents=l.trackEvents,c.debugEventsUntilDate=l.debugEventsUntilDate),(r||l&&l.trackReason)&&n&&(c.reason=n.reason),Y(c)}function Z(e,n,t,r){var o;if(z&&z.hasOwnProperty(e)&&z[e]&&!z[e].deleted){var i=z[e];o=ee(i),null!==i.value&&void 0!==i.value||(o.value=n)}else o={value:n,variationIndex:null,reason:{kind:"ERROR",errorKind:"FLAG_NOT_FOUND"}};return t&&Q(e,o,n,r),o}function ee(e){return{value:e.value,variationIndex:void 0===e.variation?null:e.variation,reason:e.reason||null}}function ne(){D=!0,B.getUser()&&x.connect(B.getUser(),h,{ping:function(){v.debug("received ping message from stream"),q.fetchFlagSettings(B.getUser(),h).then(function(e){return re(e||{})}).catch(function(e){d.maybeReportError(new l(se(e)))})},put:function(e){var n=JSON.parse(e.data);v.debug("received streaming update for all flags"),re(n)},patch:function(e){var n=JSON.parse(e.data),t=z[n.key];if(!t||!t.version||!n.version||t.version<n.version){v.debug(Ue(n.key));var r={},o=L({},n);delete o.key;var i=ee(z[n.key]=o);r[n.key]=t?{previous:t.value,current:i}:{current:i},ie(r)}else v.debug(Ie(n.key))},delete:function(e){var n=JSON.parse(e.data);if(!z[n.key]||z[n.key].version<n.version){v.debug(je(n.key));var t={};z[n.key]&&!z[n.key].deleted&&(t[n.key]={previous:z[n.key].value}),z[n.key]={version:n.version,deleted:!0},ie(t)}else v.debug(Re(n.key))}})}function te(){D&&(x.disconnect(),D=!1)}function re(e){var n={};if(!e)return Promise.resolve();for(var t in z)z.hasOwnProperty(t)&&z[t]&&(e[t]&&!U(e[t].value,z[t].value)?n[t]={previous:z[t].value,current:ee(e[t])}:e[t]&&!e[t].deleted||(n[t]={previous:z[t].value}));for(var o in e)e.hasOwnProperty(o)&&e[o]&&(!z[o]||z[o].deleted)&&(n[o]={current:ee(e[o])});return z=r({},e),ie(n).catch(function(){})}function ie(o){var e=Object.keys(o);if(0<e.length){var i={};e.forEach(function(e){var n=o[e].current,t=n?n.value:void 0,r=o[e].previous;d.emit("change:"+e,t,r),i[e]=n?{current:t,previous:r}:{previous:r}}),d.emit("change",i),d.emit("internal-change",z),g.sendEventsOnlyForVariation||$||e.forEach(function(e){Q(e,o[e].current)})}return S&&R?R.saveFlags(z).catch(function(){return null}):Promise.resolve()}function ae(){var e=J||O&&void 0===J;e&&!D?ne():!e&&D&&te(),E&&E.setStreaming(e)}function ce(e){return"change"===e||"change:"===e.substr(0,"change".length+1)}u.localStorage&&(R=new Le(u.localStorage,m,h,B,v));var le=new Promise(function(e){var n=d.on("ready",function(){d.off("ready",n),e()})}),ve=new Promise(function(e,n){var t=d.on("initialized",function(){d.off("initialized",t),e()}),r=d.on("failed",function(e){d.off("failed",r),n(e)})});if("string"==typeof g.bootstrap&&"LOCALSTORAGE"===g.bootstrap.toUpperCase()&&(R?S=!0:v.warn("localStorage is unavailable")),"object"===e(g.bootstrap)&&(z=function(t){var e=Object.keys(t),r=t.$flagsState;!r&&e.length&&v.warn(fe()),!1===t.$valid&&v.warn("LaunchDarkly bootstrap data is not available because the back end could not read the flags.");var o={};return e.forEach(function(e){if("$flagsState"!==e&&"$valid"!==e){var n={value:t[e]};r&&r[e]?n=L(n,r[e]):n.version=0,o[e]=n}}),o}(g.bootstrap)),$){var de=$.getInitialState();de?pe(de):$.on("init",pe),$.on("update",function(e){e.user&&B.setUser(e.user),e.flags&&re(e.flags)})}else(n?W.validateUser(t).then(function(n){return B.setUser(n),"object"===e(g.bootstrap)?me():S?R.loadFlags().catch(function(){return null}).then(function(e){return null==e?(z={},q.fetchFlagSettings(B.getUser(),h).then(function(e){return re(e||{})}).then(me).catch(function(e){he(new l(se(e)))})):(z=e,I(me),q.fetchFlagSettings(B.getUser(),h).then(function(e){return re(e)}).catch(function(e){return d.maybeReportError(e)}))}):q.fetchFlagSettings(B.getUser(),h).then(function(e){z=e||{},me()}).catch(function(e){z={},he(e)})}):Promise.reject(new a(ue()))).catch(function(e){return d.maybeReportError(e)});function pe(e){m=e.environment,B.setUser(e.user),z=r({},e.flags),I(me)}function me(){v.info("LaunchDarkly client initialized"),V=!0,ae(),d.emit("ready"),d.emit("initialized")}function he(e){d.maybeReportError(e),d.emit("failed",e),d.emit("ready")}return{client:{waitForInitialization:function(){return ve},waitUntilReady:function(){return le},identify:function(e,r,n){return M?j(Promise.resolve({}),n):$?(v.warn("identify() has no effect here; it must be called on the main client instance"),j(Promise.resolve(T(z)),n)):j((S&&R?R.clearFlags():Promise.resolve()).then(function(){return W.validateUser(e)}).then(function(t){return q.fetchFlagSettings(t,r).then(function(e){var n=T(e);return B.setUser(t),h=r,e?re(e).then(function(){return n}):n})}).then(function(e){return D&&ne(),e}).catch(function(e){return d.maybeReportError(e),Promise.reject(e)}),n)},getUser:function(){return B.getUser()},variation:function(e,n){return Z(e,n,!0,!1).value},variationDetail:function(e,n){return Z(e,n,!0,!0)},track:function(e,n,t){if("string"==typeof e){u.customEventFilter&&!u.customEventFilter(e)&&v.warn(oe(e));var r={kind:"custom",key:e,user:B.getUser(),url:u.getCurrentUrl(),creationDate:(new Date).getTime()};null!=n&&(r.data=n),null!=t&&(r.metricValue=t),Y(r)}else d.maybeReportError(new s(oe(e)))},on:function(e,n,t){ce(e)?(O=!0,V&&ae(),d.on(e,n,t)):d.on.apply(d,arguments)},off:function(e){if(d.off.apply(d,arguments),ce(e)){var n=!1;d.getEvents().forEach(function(e){ce(e)&&0<d.getEventListenerCount(e)&&(n=!0)}),n||(O=!1,D&&void 0===J&&te())}},setStreaming:function(e){var n=null===e?void 0:e;n!==J&&(J=n,ae())},flush:function(e){return j(p?F.flush():Promise.resolve(),e)},allFlags:function(){var e={};if(!z)return e;for(var n in z)z.hasOwnProperty(n)&&(e[n]=Z(n,null,!g.sendEventsOnlyForVariation).value);return e},close:function(e){if(M)return j(Promise.resolve(),e);function n(){M=!0,z={}}return j(Promise.resolve().then(function(){if(te(),E&&E.stop(),p)return F.stop(),F.flush()}).then(n).catch(n),e)}},options:g,emitter:d,ident:B,logger:v,requestor:q,start:function(){p&&(E&&E.start(),F.start())},enqueueEvent:Y,getFlagsInternal:function(){return z},getEnvironmentId:function(){return m},internalChangeEventName:"internal-change"}}function _defineProperty(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function ownKeys(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})),t.push.apply(t,r)}return t}function _objectSpread2(n){for(var e=1;e<arguments.length;e++){var t=null!=arguments[e]?arguments[e]:{};e%2?ownKeys(t,!0).forEach(function(e){_defineProperty(n,e,t[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ownKeys(t).forEach(function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(t,e))})}return n}function isSyncXhrSupported(){var e=window.navigator&&window.navigator.userAgent;if(e){var n=e.match(/Chrom(e|ium)\/([0-9]+)\./);if(n)return parseInt(n[2],10)<73}return!0}var emptyResult={promise:Promise.resolve({status:200,header:function(){return null},body:null})};function newHttpRequest(e,n,t,r,o){if(o&&!isSyncXhrSupported())return emptyResult;var i=new window.XMLHttpRequest;for(var a in i.open(e,n,!o),t||{})t.hasOwnProperty(a)&&i.setRequestHeader(a,t[a]);if(o)return i.send(r),emptyResult;var u;return{promise:new Promise(function(e,n){i.addEventListener("load",function(){u||e({status:i.status,header:function(e){return i.getResponseHeader(e)},body:i.responseText})}),i.addEventListener("error",function(){u||n(new Error)}),i.send(r)}),cancel:function(){u=!0,i.abort()}}}function makeBrowserPlatform(e){var n,i={};i.synchronousFlush=!1,window.XMLHttpRequest&&(i.httpRequest=function(e,n,t,r){var o=i.synchronousFlush;return i.synchronousFlush=!1,newHttpRequest(e,n,t,r,o)}),i.httpAllowsPost=function(){return void 0===n&&(n=!!window.XMLHttpRequest&&"withCredentials"in new window.XMLHttpRequest),n},i.httpFallbackPing=function(e){(new window.Image).src=e};var r,t=e&&e.eventUrlTransformer;i.getCurrentUrl=function(){return t?t(window.location.href):window.location.href},i.isDoNotTrack=function(){var e;return 1===(e=window.navigator&&void 0!==window.navigator.doNotTrack?window.navigator.doNotTrack:window.navigator&&void 0!==window.navigator.msDoNotTrack?window.navigator.msDoNotTrack:window.doNotTrack)||!0===e||"1"===e||"yes"===e};try{window.localStorage&&(i.localStorage={get:function(n){return new Promise(function(e){e(window.localStorage.getItem(n))})},set:function(n,t){return new Promise(function(e){window.localStorage.setItem(n,t),e()})},clear:function(n){return new Promise(function(e){window.localStorage.removeItem(n),e()})}})}catch(e){i.localStorage=null}var o=e&&e.useReport;if(r=o&&"function"==typeof window.EventSourcePolyfill&&window.EventSourcePolyfill.supportedOptions&&window.EventSourcePolyfill.supportedOptions.method?(i.eventSourceAllowsReport=!0,window.EventSourcePolyfill):(i.eventSourceAllowsReport=!1,window.EventSource),window.EventSource){i.eventSourceFactory=function(e,n){var t=_objectSpread2({},{heartbeatTimeout:3e5,silentTimeout:3e5,skipDefaultHeaders:!0},{},n);return new r(e,t)},i.eventSourceIsActive=function(e){return e.readyState===window.EventSource.OPEN||e.readyState===window.EventSource.CONNECTING}}return i.userAgent="JSClient",i.version="2.17.0",i.diagnosticSdkData={name:"js-client-sdk",version:"2.17.0"},i.diagnosticPlatformData={name:"JS"},i.diagnosticUseCombinedEvent=!0,i}var matchOperatorsRe=/[|\\{}()[\]^$+*?.]/g,escapeStringRegexp=function(e){if("string"!=typeof e)throw new TypeError("Expected a string");return e.replace(matchOperatorsRe,"\\$&")};function doesUrlMatch(e,n,t,r){var o,i,a=n.replace(t,"").replace(r,"");switch(e.kind){case"exact":i=n,o=new RegExp("^"+escapeStringRegexp(e.url)+"/?$");break;case"canonical":i=a,o=new RegExp("^"+escapeStringRegexp(e.url)+"/?$");break;case"substring":i=a,o=new RegExp(".*"+escapeStringRegexp(e.substring)+".*$");break;case"regex":i=a,o=new RegExp(e.pattern);break;default:return!1}return o.test(i)}function findGoalsForClick(e,n){for(var t=[],r=0;r<n.length;r++)for(var o=e.target,i=n[r],a=i.selector,u=document.querySelectorAll(a);o&&0<u.length;){for(var s=0;s<u.length;s++)o===u[s]&&t.push(i);o=o.parentNode}return t}function GoalTracker(e,r){for(var n={},t=null,o=[],i=0;i<e.length;i++)for(var a=e[i],u=a.urls||[],s=0;s<u.length;s++)if(doesUrlMatch(u[s],window.location.href,window.location.search,window.location.hash)){"pageview"===a.kind?r("pageview",a):(o.push(a),r("click_pageview",a));break}return 0<o.length&&(t=function(e){for(var n=findGoalsForClick(e,o),t=0;t<n.length;t++)r("click",n[t])},document.addEventListener("click",t)),n.dispose=function(){document.removeEventListener("click",t)},n}var locationWatcherInterval=300;function GoalManager(r,n){var t,o,e={};function i(){o&&o.dispose(),t&&t.length&&(o=GoalTracker(t,a))}function a(e,n){var t={kind:e,key:n.key,data:null,url:window.location.href,user:r.ident.getUser(),creationDate:(new Date).getTime()};return"click"===e&&(t.selector=n.selector),r.enqueueEvent(t)}function u(e,n){var t,r=window.location.href;function o(){(t=window.location.href)!==r&&(r=t,n())}!function e(n,t){n(),setTimeout(function(){e(n,t)},t)}(o,e),window.history&&window.history.pushState?window.addEventListener("popstate",o):window.addEventListener("hashchange",o)}return e.goalKeyExists=function(e){if(!t)return!0;for(var n=0;n<t.length;n++)if("custom"===t[n].kind&&t[n].key===e)return!0;return!1},r.requestor.fetchJSON("/sdk/goals/"+r.getEnvironmentId()).then(function(e){e&&0<e.length&&(o=GoalTracker(t=e,a),u(locationWatcherInterval,i)),n()}).catch(function(e){r.emitter.maybeReportError(new v.LDUnexpectedResponseError((e&&e.message,e.message))),n()}),e}var goalsEvent="goalsReady",extraOptionDefs={fetchGoals:{default:!0},hash:{type:"string"},eventProcessor:{type:"object"},eventUrlTransformer:{type:"function"}};function initialize(e,n){var t=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},r=makeBrowserPlatform(t),o=$e(e,n,t,r,extraOptionDefs),i=o.client,a=o.options,u=o.emitter,s=new Promise(function(e){var n=u.on(goalsEvent,function(){u.off(goalsEvent,n),e()})});if(i.waitUntilGoalsReady=function(){return s},a.fetchGoals){var c=GoalManager(o,function(){return u.emit(goalsEvent)});r.customEventFilter=c.goalKeyExists}else u.emit(goalsEvent);"complete"!==document.readyState?window.addEventListener("load",o.start):o.start();function l(){r.synchronousFlush=!0,i.flush().catch(function(){}),r.synchronousFlush=!1}return window.addEventListener("beforeunload",l),window.addEventListener("unload",l),i}var createConsoleLogger=Ke,version="2.17.0";function deprecatedInitialize(e,n){var t=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};return console&&console.warn&&console.warn(Fe.deprecated("default export","named LDClient export")),initialize(e,n,t)}var index={initialize:deprecatedInitialize,version:version};exports.createConsoleLogger=createConsoleLogger,exports.default=index,exports.initialize=initialize,exports.version=version;
//# sourceMappingURL=ldclient.cjs.js.map

@@ -1,2 +0,2 @@

function e(n){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(n)}function n(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function t(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function r(e){for(var r=1;r<arguments.length;r++){var o=null!=arguments[r]?arguments[r]:{};r%2?t(o,!0).forEach((function(t){n(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):t(o).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(o,n))}))}return e}function o(e){function n(e,n){Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.message=e,this.code=n}return n.prototype=new Error,n.prototype.name=e,n.prototype.constructor=n,n}var i=o("LaunchDarklyUnexpectedResponseError"),a=o("LaunchDarklyInvalidEnvironmentIdError"),u=o("LaunchDarklyInvalidUserError"),c=o("LaunchDarklyInvalidEventKeyError"),s=o("LaunchDarklyInvalidArgumentError"),l=o("LaunchDarklyFlagFetchError");function f(e){return!(e>=400&&e<500)||400===e||408===e||429===e}for(var v=Object.freeze({__proto__:null,LDUnexpectedResponseError:i,LDInvalidEnvironmentIdError:a,LDInvalidUserError:u,LDInvalidEventKeyError:c,LDInvalidArgumentError:s,LDFlagFetchError:l,isHttpErrorRecoverable:f}),d=function(e){for(var n,t=e.length,r=t%3,o=[],i=0,a=t-r;i<a;i+=16383)o.push(w(e,i,i+16383>a?a:i+16383));return 1===r?(n=e[t-1],o.push(g[n>>2]+g[n<<4&63]+"==")):2===r&&(n=(e[t-2]<<8)+e[t-1],o.push(g[n>>10]+g[n>>4&63]+g[n<<2&63]+"=")),o.join("")},g=[],p=[],m="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",h=0,y=m.length;h<y;++h)g[h]=m[h],p[m.charCodeAt(h)]=h;function w(e,n,t){for(var r,o,i=[],a=n;a<t;a+=3)r=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),i.push(g[(o=r)>>18&63]+g[o>>12&63]+g[o>>6&63]+g[63&o]);return i.join("")}p["-".charCodeAt(0)]=62,p["_".charCodeAt(0)]=63;var b=Array.isArray,k=Object.keys,E=Object.prototype.hasOwnProperty,S=["key","secondary","ip","country","email","firstName","lastName","avatar","name"];function O(e){var n=unescape(encodeURIComponent(e));return d(function(e){for(var n=[],t=0;t<e.length;t++)n.push(e.charCodeAt(t));return n}(n))}function P(e){return O(e).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function D(e){return JSON.parse(JSON.stringify(e))}function U(e,n){return function e(n,t){if(n===t)return!0;if(n&&t&&"object"==typeof n&&"object"==typeof t){var r,o,i,a=b(n),u=b(t);if(a&&u){if((o=n.length)!=t.length)return!1;for(r=o;0!=r--;)if(!e(n[r],t[r]))return!1;return!0}if(a!=u)return!1;var c=n instanceof Date,s=t instanceof Date;if(c!=s)return!1;if(c&&s)return n.getTime()==t.getTime();var l=n instanceof RegExp,f=t instanceof RegExp;if(l!=f)return!1;if(l&&f)return n.toString()==t.toString();var v=k(n);if((o=v.length)!==k(t).length)return!1;for(r=o;0!=r--;)if(!E.call(t,v[r]))return!1;for(r=o;0!=r--;)if(!e(n[i=v[r]],t[i]))return!1;return!0}return n!=n&&t!=t}(e,n)}function j(e){setTimeout(e,0)}function R(e,n){var t=e.then((function(e){return n&&setTimeout((function(){n(null,e)}),0),e}),(function(e){if(!n)return Promise.reject(e);setTimeout((function(){n(e,null)}),0)}));return n?void 0:t}function T(e){var n={};for(var t in e)e.hasOwnProperty(t)&&(n[t]={value:e[t],version:0});return n}function N(e){var n={};for(var t in e)e.hasOwnProperty(t)&&(n[t]=e[t].value);return n}function I(e,n){for(var t,r=n.slice(0),o=[],i=e;r.length>0;){for(t=[];i>0;){var a=r.shift();if(!a)break;(i-=P(JSON.stringify(a)).length)<0&&t.length>0?r.unshift(a):t.push(a)}i=e,o.push(t)}return o}function L(e){var n=e.version||"3.1.2";return e.userAgent+"/"+n}function F(e,n){if(n&&!n.sendLDHeaders)return{};var t={"X-LaunchDarkly-User-Agent":L(e)};return n&&n.wrapperName&&(t["X-LaunchDarkly-Wrapper"]=n.wrapperVersion?n.wrapperName+"/"+n.wrapperVersion:n.wrapperName),t}function x(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];return n.reduce((function(e,n){return r({},e,{},n)}),{})}function C(e){if(!e)return e;var n;for(var t in S){var o=S[t],i=e[o];void 0!==i&&"string"!=typeof i&&((n=n||r({},e))[o]=String(i))}return n||e}Object.freeze({__proto__:null,btoa:O,base64URLEncode:P,clone:D,deepEquals:U,onNextTick:j,wrapPromiseCallback:R,transformValuesToVersionedValues:T,transformVersionedValuesToValues:N,chunkUserEventsForUrl:I,getLDUserAgentString:L,getLDHeaders:F,extend:x,sanitizeUser:C});for(var A=function(e,n){return function(e){var n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(n){var t=new Uint8Array(16);e.exports=function(){return n(t),t}}else{var r=new Array(16);e.exports=function(){for(var e,n=0;n<16;n++)0==(3&n)&&(e=4294967296*Math.random()),r[n]=e>>>((3&n)<<3)&255;return r}}}(n={exports:{}}),n.exports}(),q=[],J=0;J<256;++J)q[J]=(J+256).toString(16).substr(1);var _,V,z=0,$=0,H=function(e,n,t){var r=n&&t||0,o=n||[],i=(e=e||{}).node||_,a=void 0!==e.clockseq?e.clockseq:V;if(null==i||null==a){var u=A();null==i&&(i=_=[1|u[0],u[1],u[2],u[3],u[4],u[5]]),null==a&&(a=V=16383&(u[6]<<8|u[7]))}var c=void 0!==e.msecs?e.msecs:(new Date).getTime(),s=void 0!==e.nsecs?e.nsecs:$+1,l=c-z+(s-$)/1e4;if(l<0&&void 0===e.clockseq&&(a=a+1&16383),(l<0||c>z)&&void 0===e.nsecs&&(s=0),s>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");z=c,$=s,V=a;var f=(1e4*(268435455&(c+=122192928e5))+s)%4294967296;o[r++]=f>>>24&255,o[r++]=f>>>16&255,o[r++]=f>>>8&255,o[r++]=255&f;var v=c/4294967296*1e4&268435455;o[r++]=v>>>8&255,o[r++]=255&v,o[r++]=v>>>24&15|16,o[r++]=v>>>16&255,o[r++]=a>>>8|128,o[r++]=255&a;for(var d=0;d<6;++d)o[r+d]=i[d];return n||function(e,n){var t=n||0,r=q;return[r[e[t++]],r[e[t++]],r[e[t++]],r[e[t++]],"-",r[e[t++]],r[e[t++]],"-",r[e[t++]],r[e[t++]],"-",r[e[t++]],r[e[t++]],"-",r[e[t++]],r[e[t++]],r[e[t++]],r[e[t++]],r[e[t++]],r[e[t++]]].join("")}(o)};function K(e,n,t,r){var o=n+"/events/bulk/"+t,i=n+"/a/"+t+".gif",a=e.httpFallbackPing,u={};function c(n,t){var u=JSON.stringify(n),c=H();return t?function n(t){var i=x({"Content-Type":"application/json","X-LaunchDarkly-Event-Schema":"3","X-LaunchDarkly-Payload-ID":c},F(e,r));return e.httpRequest("POST",o,i,u).promise.then((function(e){if(e)return e.status>=400&&f(e.status)&&t?n(!1):function(e){var n={status:e.status},t=e.header("date");if(t){var r=Date.parse(t);r&&(n.serverTime=r)}return n}(e)})).catch((function(){return t?n(!1):Promise.reject()}))}(!0).catch((function(){})):(a&&a(i+"?d="+P(u)),Promise.resolve())}return u.sendEvents=function(t){if(!e.httpRequest)return Promise.resolve();var r,o=e.httpAllowsPost();r=o?[t]:I(2e3-n.length,t);for(var i=[],a=0;a<r.length;a++)i.push(c(r[a],o));return Promise.all(i)},u}function M(){var e={},n=0,t=0,r={};return e.summarizeEvent=function(e){if("feature"===e.kind){var o=e.key+":"+(null!==e.variation&&void 0!==e.variation?e.variation:"")+":"+(null!==e.version&&void 0!==e.version?e.version:""),i=r[o];i?i.count=i.count+1:r[o]={count:1,key:e.key,variation:e.variation,version:e.version,value:e.value,default:e.default},(0===n||e.creationDate<n)&&(n=e.creationDate),e.creationDate>t&&(t=e.creationDate)}},e.getSummary=function(){var e={},o=!0;for(var i in r){var a=r[i],u=e[a.key];u||(u={default:a.default,counters:[]},e[a.key]=u);var c={value:a.value,count:a.count};void 0!==a.variation&&null!==a.variation&&(c.variation=a.variation),a.version?c.version=a.version:c.unknown=!0,u.counters.push(c),o=!1}return o?null:{startDate:n,endDate:t,features:e}},e.clearSummary=function(){n=0,t=0,r={}},e}function X(e){var n={},t=e.allAttributesPrivate,r=e.privateAttributeNames||[],o={key:!0,custom:!0,anonymous:!0},i={key:!0,secondary:!0,ip:!0,country:!0,email:!0,firstName:!0,lastName:!0,avatar:!0,name:!0,anonymous:!0,custom:!0};return n.filterUser=function(e){if(!e)return null;var n=e.privateAttributeNames||[],a=function(e,i){return Object.keys(e).reduce((function(a,u){var c=a;return i(u)&&(function(e){return!o[e]&&(t||-1!==n.indexOf(e)||-1!==r.indexOf(e))}(u)?c[1][u]=!0:c[0][u]=e[u]),c}),[{},{}])},u=a(e,(function(e){return i[e]})),c=u[0],s=u[1];if(e.custom){var l=a(e.custom,(function(){return!0}));c.custom=l[0],s=x({},s,l[1])}var f=Object.keys(s);return f.length&&(f.sort(),c.privateAttrs=f),c},n}function G(e){return e&&e.message?e.message:"string"==typeof e||e instanceof String?e:JSON.stringify(e)}var B=" Please see https://docs.launchdarkly.com/docs/js-sdk-reference#section-initializing-the-client for instructions on SDK initialization.",W=function(e){return'Expected application/json content type but got "'+e+'"'},Q=function(e){return"network error"+(e?" ("+e+")":"")},Y=function(e){return'Custom event "'+e+'" does not exist'},Z=function(){return"Environment not found. Double check that you specified a valid environment/client-side ID."+B},ee=function(){return"No environment/client-side ID was specified."+B},ne=function(e){return"Error fetching flag settings: "+G(e)},te=function(){return"No user specified."+B},re=function(){return"Invalid user specified."+B},oe=function(){return"LaunchDarkly client was initialized with bootstrap data that did not include flag metadata. Events may not be sent correctly."+B},ie=function(e,n){return n?'"'+e+'" is deprecated, please use "'+n+'"':'"'+e+'" is deprecated'},ae=function(e,n,t){return"Received error "+e+(401===e?" (invalid SDK key)":"")+" for "+n+" - "+(f(e)?t:"giving up permanently")},ue=function(){return"Cannot make HTTP requests in this environment."+B},ce=function(e){return"Opening stream connection to "+e},se=function(e,n){return"Error on stream connection: "+G(e)+", will continue retrying every "+n+" milliseconds."},le=function(e){return'Ignoring unknown config option "'+e+'"'},fe=function(e,n,t){return'Config option "'+e+'" should be of type '+n+", got "+t+", using default value"},ve=function(e,n){return'Config option "'+e+'" should be a boolean, got '+n+", converting to boolean"},de=function(e,n,t){return'Config option "'+e+'" was set to '+n+", changing to minimum value of "+t},ge=function(e){return"polling for feature flags at "+e},pe=function(e){return'received streaming update for flag "'+e+'"'},me=function(e){return'received streaming update for flag "'+e+'" but ignored due to version check'},he=function(e){return'received streaming deletion for flag "'+e+'"'},ye=function(e){return'received streaming deletion for flag "'+e+'" but ignored due to version check'},we=function(e){return'enqueueing "'+e+'" event'},be=function(e){return"sending "+e+" events"},ke=Object.freeze({__proto__:null,clientInitialized:function(){return"LaunchDarkly client initialized"},clientNotReady:function(){return"LaunchDarkly client is not ready"},eventCapacityExceeded:function(){return"Exceeded event queue capacity. Increase capacity to avoid dropping events."},eventWithoutUser:function(){return"Be sure to call `identify` in the LaunchDarkly client: https://docs.launchdarkly.com/docs/js-sdk-reference#section-analytics-events"},invalidContentType:W,invalidKey:function(){return"Event key must be a string"},localStorageUnavailable:function(){return"localStorage is unavailable"},localStorageUnavailableForUserId:function(){return"localStorage is unavailable, so anonymous user ID cannot be cached"},networkError:Q,unknownCustomEventKey:Y,environmentNotFound:Z,environmentNotSpecified:ee,errorFetchingFlags:ne,userNotSpecified:te,invalidUser:re,bootstrapOldFormat:oe,bootstrapInvalid:function(){return"LaunchDarkly bootstrap data is not available because the back end could not read the flags."},deprecated:ie,httpErrorMessage:ae,httpUnavailable:ue,identifyDisabled:function(){return"identify() has no effect here; it must be called on the main client instance"},streamClosing:function(){return"Closing stream connection"},streamConnecting:ce,streamError:se,unknownOption:le,wrongOptionType:fe,wrongOptionTypeBoolean:ve,optionBelowMinimum:de,debugPolling:ge,debugStreamPing:function(){return"received ping message from stream"},debugStreamPut:function(){return"received streaming update for all flags"},debugStreamPatch:pe,debugStreamPatchIgnored:me,debugStreamDelete:he,debugStreamDeleteIgnored:ye,debugEnqueueingEvent:we,debugPostingEvents:be});function Ee(e,n,t,r,o){var i={};function a(){var e="",o=r.getUser();return o&&(e=t||O(JSON.stringify(o))),"ld:"+n+":"+e}return i.loadFlags=function(){return e.get(a()).then((function(e){if(null==e)return null;try{var n=JSON.parse(e);if(n){var t=n.$schema;void 0===t||t<1?n=T(n):delete n.$schema}return n}catch(e){return i.clearFlags().then((function(){return Promise.reject(e)}))}})).catch((function(e){return o.warn("localStorage is unavailable"),Promise.reject(e)}))},i.saveFlags=function(n){var t=x({},n,{$schema:1});return e.set(a(),JSON.stringify(t)).catch((function(e){return o.warn("localStorage is unavailable"),Promise.reject(e)}))},i.clearFlags=function(){return e.clear(a()).catch((function(e){return o.warn("localStorage is unavailable"),Promise.reject(e)}))},i}function Se(e,n,t){var r=n.baseUrl,o=n.useReport,i=n.evaluationReasons,u=n.logger,c={},s={};function f(t,r){if(!e.httpRequest)return new Promise((function(e,n){n(new l(ue()))}));var o=r?"REPORT":"GET",i=F(e,n);r&&(i["Content-Type"]="application/json");var u=s[t];u||(u=function(e){var n,t,r,o,i={addPromise:function(i,a){n=i,t&&t(),t=a,i.then((function(t){n===i&&(r(t),e&&e())}),(function(t){n===i&&(o(t),e&&e())}))}};return i.resultPromise=new Promise((function(e,n){r=e,o=n})),i}((function(){delete s[t]})),s[t]=u);var c=e.httpRequest(o,t,i,r),f=c.promise.then((function(e){if(200===e.status){if(e.header("content-type")&&0===e.header("content-type").lastIndexOf("application/json"))return JSON.parse(e.body);var n=W(e.header("content-type")||"");return Promise.reject(new l(n))}return Promise.reject(function(e){return 404===e.status?new a(Z()):new l(ne(e.statusText||String(e.status)))}(e))}),(function(e){return Promise.reject(new l(Q(e)))}));return u.addPromise(f,(function(){c.cancel&&c.cancel()})),u.resultPromise}return c.fetchJSON=function(e){return f(r+e,null)},c.fetchFlagSettings=function(e,n){var a,c,s,l="";return o?(c=[r,"/sdk/evalx/",t,"/user"].join(""),s=JSON.stringify(e)):(a=P(JSON.stringify(e)),c=[r,"/sdk/evalx/",t,"/users/",a].join("")),n&&(l="h="+n),i&&(l=l+(l?"&":"")+"withReasons=true"),c=c+(l?"?":"")+l,u.debug(ge(c)),f(c,s)},c}function Oe(e,n){var t={validateUser:function(t){if(!t)return Promise.reject(new u(te()));var r=D(t);return null!==r.key&&void 0!==r.key?(r.key=r.key.toString(),Promise.resolve(r)):r.anonymous?(e?e.get("ld:$anonUserId").catch((function(){return null})):Promise.resolve(null)).then((function(t){if(t)return r.key=t,r;var o=H();return r.key=o,function(t){return e?e.set("ld:$anonUserId",t).catch((function(){n.warn("localStorage is unavailable, so anonymous user ID cannot be cached")})):Promise.resolve()}(o).then((function(){return r}))})):Promise.reject(new u(re()))}};return t}var Pe={baseUrl:{default:"https://app.launchdarkly.com"},streamUrl:{default:"https://clientstream.launchdarkly.com"},eventsUrl:{default:"https://events.launchdarkly.com"},sendEvents:{default:!0},streaming:{type:"boolean"},sendLDHeaders:{default:!0},inlineUsersInEvents:{default:!1},allowFrequentDuplicateEvents:{default:!1},sendEventsOnlyForVariation:{default:!1},useReport:{default:!1},evaluationReasons:{default:!1},eventCapacity:{default:100,minimum:1},flushInterval:{default:2e3,minimum:2e3},samplingInterval:{default:0,minimum:0},streamReconnectDelay:{default:1e3,minimum:0},allAttributesPrivate:{default:!1},privateAttributeNames:{default:[]},bootstrap:{type:"string|object"},wrapperName:{type:"string"},wrapperVersion:{type:"string"},stateProvider:{type:"object"}};function De(e,n){var t,r=["debug","info","warn","error"];t=null!=n?""===n?"":n+" ":"LD: ";var o=0;e&&(o="none"===e?100:r.indexOf(e));var i={};function a(e,n,i){if(e>=o){var a=e<r.length?r[e]:"?";n(t+"["+a+"] "+i)}}return i.debug=function(e){return a(0,console.log,e)},i.info=function(e){return a(1,console.info,e)},i.warn=function(e){return a(2,console.warn,e)},i.error=function(e){return a(3,console.error,e)},i}function Ue(n,t,o,u,v){var d,g,p,m,h=o&&o.logger?o.logger:v&&v.logger&&v.logger.default||De("warn"),y=function(e){var n={},t={};return n.on=function(e,n,r){t[e]=t[e]||[],t[e]=t[e].concat({handler:n,context:r})},n.off=function(e,n,r){if(t[e])for(var o=0;o<t[e].length;o++)t[e][o].handler===n&&t[e][o].context===r&&(t[e]=t[e].slice(0,o).concat(t[e].slice(o+1)))},n.emit=function(e){if(t[e])for(var n=0;n<t[e].length;n++)t[e][n].handler.apply(t[e][n].context,Array.prototype.slice.call(arguments,1))},n.getEvents=function(){return Object.keys(t)},n.getEventListenerCount=function(e){return t[e]?t[e].length:0},n.maybeReportError=function(n){n&&(t.error?this.emit("error",n):(e||console).error(n.message))},n}(h),w=function(n,t,r,o){var i=x({logger:{default:o}},Pe,r),a={all_attributes_private:"allAttributesPrivate",private_attribute_names:"privateAttributeNames",samplingInterval:null};function u(e){j((function(){t&&t.maybeReportError(new s(e))}))}var c=x({},n||{});return function(e){var n=e;Object.keys(a).forEach((function(e){if(void 0!==n[e]){var t=a[e];o&&o.warn(ie(e,t)),t&&(void 0===n[t]&&(n[t]=n[e]),delete n[e])}}))}(c),function(n){var t=x({},n),r=function(n){if(null===n)return"any";if(void 0!==n){if(Array.isArray(n))return"array";var t=e(n);return"boolean"===t||"string"===t||"number"===t||"function"===t?t:"object"}};return Object.keys(n).forEach((function(e){var o=n[e];if(null!=o){var a=i[e];if(void 0===a)u(le(e));else{var c=a.type||r(a.default);if("any"!==c){var s=c.split("|"),l=r(o);s.indexOf(l)<0?"boolean"===c?(t[e]=!!o,u(ve(e,l))):(u(fe(e,c,l)),t[e]=a.default):"number"===l&&void 0!==a.minimum&&o<a.minimum&&(u(de(e,o,a.minimum)),t[e]=a.minimum)}}}})),t}(c=function(e){var n=x({},e);return Object.keys(i).forEach((function(e){void 0!==n[e]&&null!==n[e]||(n[e]=i[e]&&i[e].default)})),n}(c))}(o,y,v,h),b=w.hash,k=w.sendEvents,E=n,S=function(e,n,t,r){var o=n.streamUrl,i=n.logger,a={},u=o+"/eval/"+t,c=n.useReport,s=n.evaluationReasons,l=n.streamReconnectDelay,f=F(e,n),v=!1,d=null,g=null,p=null,m=null;function h(e){v||(i.warn(se(e,l)),v=!0),b(),y(l)}function y(e){g||(e?g=setTimeout(w,e):w())}function w(){var n;g=null;var a="",l={headers:f};if(e.eventSourceFactory){for(var v in null!=r&&(a="h="+r),c?e.eventSourceAllowsReport?(n=u,l.method="REPORT",l.headers["Content-Type"]="application/json",l.body=JSON.stringify(p)):(n=o+"/ping/"+t,a=""):n=u+"/"+P(JSON.stringify(p)),s&&(a=a+(a?"&":"")+"withReasons=true"),n=n+(a?"?":"")+a,b(),i.info(ce(n)),d=e.eventSourceFactory(n,l),m)m.hasOwnProperty(v)&&d.addEventListener(v,m[v]);d.onerror=h}}function b(){d&&(i.info("Closing stream connection"),d.close(),d=null)}return a.connect=function(e,n){p=e,m={};var t=function(e){m[e]=function(t){v=!1,n[e]&&n[e](t)}};for(var r in n||{})t(r);y()},a.disconnect=function(){clearTimeout(g),g=null,b()},a.isConnected=function(){return!!(d&&e.eventSourceIsActive&&e.eventSourceIsActive(d))},a}(u,w,E,b),O=w.eventProcessor||function(e,n,t){var r,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,u={},c=a||K(e,n.eventsUrl,t,n),s=M(),l=X(n),v=n.inlineUsersInEvents,d=n.samplingInterval,g=n.eventCapacity,p=n.flushInterval,m=n.logger,h=[],y=0,w=!1,b=!1;function k(){return 0===d||0===Math.floor(Math.random()*d)}function E(e){return!!e.debugEventsUntilDate&&e.debugEventsUntilDate>y&&e.debugEventsUntilDate>(new Date).getTime()}function S(e){var n=x({},e);return v||"identify"===e.kind?n.user=l.filterUser(e.user):(n.userKey=e.user.key,delete n.user),"feature"===e.kind&&(delete n.trackEvents,delete n.debugEventsUntilDate),n}function O(e){h.length<g?(h.push(e),b=!1):b||(b=!0,m.warn("Exceeded event queue capacity. Increase capacity to avoid dropping events."))}return u.enqueue=function(e){if(!w){var n=!1,t=!1;if(s.summarizeEvent(e),"feature"===e.kind?k()&&(n=!!e.trackEvents,t=E(e)):n=k(),n&&O(S(e)),t){var r=x({},e,{kind:"debug"});delete r.trackEvents,delete r.debugEventsUntilDate,delete r.variation,O(r)}}},u.flush=function(){if(w)return Promise.resolve();var e=h,n=s.getSummary();return s.clearSummary(),n&&(n.kind="summary",e.push(n)),0===e.length?Promise.resolve():(h=[],m.debug(be(e.length)),c.sendEvents(e).then((function(e){e&&(e.serverTime&&(y=e.serverTime),f(e.status)||(w=!0),e.status>=400&&j((function(){o.maybeReportError(new i(ae(e.status,"event posting","some events were dropped")))})))})))},u.start=function(){r=setTimeout((function e(){u.flush(),r=setTimeout(e,p)}),p)},u.stop=function(){clearTimeout(r)},u}(u,w,E,y),T=Se(u,w,E),I={},L={},A=w.streaming,q=!1,J=!1,_=!0,V=w.stateProvider,z=function(e,n){var t,r={setUser:function(e){(t=C(e))&&n&&n(D(t))},getUser:function(){return t?D(t):null}};return r}(0,(function(e){V||e&&H({kind:"identify",key:e.key,user:e,creationDate:(new Date).getTime()})})),$=Oe(u.localStorage,h);function H(e){E&&(V&&V.enqueueEvent&&V.enqueueEvent(e)||(e.user?(_=!1,!k||J||u.isDoNotTrack()||(h.debug(we(e.kind)),O.enqueue(e))):_&&(h.warn("Be sure to call `identify` in the LaunchDarkly client: https://docs.launchdarkly.com/docs/js-sdk-reference#section-analytics-events"),_=!1)))}function G(e,n,t,r){var o=z.getUser(),i=new Date,a=n?n.value:null;if(!w.allowFrequentDuplicateEvents){var u=JSON.stringify(a)+(o&&o.key?o.key:"")+e,c=I[u];if(c&&i-c<3e5)return;I[u]=i}var s={kind:"feature",key:e,user:o,value:a,variation:n?n.variationIndex:null,default:t,creationDate:i.getTime()},l=L[e];l&&(s.version=l.flagVersion?l.flagVersion:l.version,s.trackEvents=l.trackEvents,s.debugEventsUntilDate=l.debugEventsUntilDate),(r||l&&l.trackReason)&&n&&(s.reason=n.reason),H(s)}function B(e,n,t,r){var o;if(L&&L.hasOwnProperty(e)&&L[e]&&!L[e].deleted){var i=L[e];o=W(i),null!==i.value&&void 0!==i.value||(o.value=n)}else o={value:n,variationIndex:null,reason:{kind:"ERROR",errorKind:"FLAG_NOT_FOUND"}};return t&&G(e,o,n,r),o}function W(e){return{value:e.value,variationIndex:void 0===e.variation?null:e.variation,reason:e.reason||null}}function Q(){g=!0,z.getUser()&&S.connect(z.getUser(),{ping:function(){h.debug("received ping message from stream"),T.fetchFlagSettings(z.getUser(),b).then((function(e){return te(e||{})})).catch((function(e){y.maybeReportError(new l(ne(e)))}))},put:function(e){var n=JSON.parse(e.data);h.debug("received streaming update for all flags"),te(n)},patch:function(e){var n=JSON.parse(e.data),t=L[n.key];if(!t||!t.version||!n.version||t.version<n.version){h.debug(pe(n.key));var r={},o=x({},n);delete o.key,L[n.key]=o;var i=W(o);r[n.key]=t?{previous:t.value,current:i}:{current:i},re(r)}else h.debug(me(n.key))},delete:function(e){var n=JSON.parse(e.data);if(!L[n.key]||L[n.key].version<n.version){h.debug(he(n.key));var t={};L[n.key]&&!L[n.key].deleted&&(t[n.key]={previous:L[n.key].value}),L[n.key]={version:n.version,deleted:!0},re(t)}else h.debug(ye(n.key))}})}function Z(){g&&(S.disconnect(),g=!1)}function te(e){var n={};if(!e)return Promise.resolve();for(var t in L)L.hasOwnProperty(t)&&L[t]&&(e[t]&&!U(e[t].value,L[t].value)?n[t]={previous:L[t].value,current:W(e[t])}:e[t]&&!e[t].deleted||(n[t]={previous:L[t].value}));for(var o in e)e.hasOwnProperty(o)&&e[o]&&(!L[o]||L[o].deleted)&&(n[o]={current:W(e[o])});return L=r({},e),re(n).catch((function(){}))}function re(e){var n=Object.keys(e);if(n.length>0){var t={};n.forEach((function(n){var r=e[n].current,o=r?r.value:void 0,i=e[n].previous;y.emit("change:"+n,o,i),t[n]=r?{current:o,previous:i}:{previous:i}})),y.emit("change",t),y.emit("internal-change",L),w.sendEventsOnlyForVariation||V||n.forEach((function(n){G(n,e[n].current)}))}return d&&m?m.saveFlags(L).catch((function(){return null})):Promise.resolve()}function ue(){var e=A||p&&void 0===A;e&&!g?Q():!e&&g&&Z()}function ge(e){return"change"===e||"change:"===e.substr(0,"change".length+1)}u.localStorage&&(m=new Ee(u.localStorage,E,b,z,h));var ke=new Promise((function(e){var n=y.on("ready",(function(){y.off("ready",n),e()}))})),Ue=new Promise((function(e,n){var t=y.on("initialized",(function(){y.off("initialized",t),e()})),r=y.on("failed",(function(e){y.off("failed",r),n(e)}))}));if("string"==typeof w.bootstrap&&"LOCALSTORAGE"===w.bootstrap.toUpperCase()&&(m?d=!0:h.warn("localStorage is unavailable")),"object"===e(w.bootstrap)&&(L=function(e){var n=Object.keys(e),t=e.$flagsState;!t&&n.length&&h.warn(oe()),!1===e.$valid&&h.warn("LaunchDarkly bootstrap data is not available because the back end could not read the flags.");var r={};return n.forEach((function(n){if("$flagsState"!==n&&"$valid"!==n){var o={value:e[n]};t&&t[n]?o=x(o,t[n]):o.version=0,r[n]=o}})),r}(w.bootstrap)),V){var je=V.getInitialState();je?Re(je):V.on("init",Re),V.on("update",(function(e){e.user&&z.setUser(e.user),e.flags&&te(e.flags)}))}else(n?$.validateUser(t).then((function(n){return z.setUser(n),"object"===e(w.bootstrap)?Te():d?m.loadFlags().catch((function(){return null})).then((function(e){return null==e?(L={},T.fetchFlagSettings(z.getUser(),b).then((function(e){return te(e||{})})).then(Te).catch((function(e){Ne(new l(ne(e)))}))):(L=e,j(Te),T.fetchFlagSettings(z.getUser(),b).then((function(e){return te(e)})).catch((function(e){return y.maybeReportError(e)})))})):T.fetchFlagSettings(z.getUser(),b).then((function(e){L=e||{},Te()})).catch((function(e){L={},Ne(e)}))})):Promise.reject(new a(ee()))).catch((function(e){return y.maybeReportError(e)}));function Re(e){E=e.environment,z.setUser(e.user),L=r({},e.flags),j(Te)}function Te(){h.info("LaunchDarkly client initialized"),q=!0,ue(),y.emit("ready"),y.emit("initialized")}function Ne(e){y.maybeReportError(e),y.emit("failed",e),y.emit("ready")}return{client:{waitForInitialization:function(){return Ue},waitUntilReady:function(){return ke},identify:function(e,n,t){return J?R(Promise.resolve({}),t):V?(h.warn("identify() has no effect here; it must be called on the main client instance"),R(Promise.resolve(N(L)),t)):R((d&&m?m.clearFlags():Promise.resolve()).then((function(){return $.validateUser(e)})).then((function(e){return T.fetchFlagSettings(e,n).then((function(n){var t=N(n);return z.setUser(e),n?te(n).then((function(){return t})):t}))})).then((function(e){return g&&Q(),e})).catch((function(e){return y.maybeReportError(e),Promise.reject(e)})),t)},getUser:function(){return z.getUser()},variation:function(e,n){return B(e,n,!0,!1).value},variationDetail:function(e,n){return B(e,n,!0,!0)},track:function(e,n,t){if("string"==typeof e){u.customEventFilter&&!u.customEventFilter(e)&&h.warn(Y(e));var r={kind:"custom",key:e,user:z.getUser(),url:u.getCurrentUrl(),creationDate:(new Date).getTime()};null!=n&&(r.data=n),null!=t&&(r.metricValue=t),H(r)}else y.maybeReportError(new c(Y(e)))},on:function(e,n,t){ge(e)?(p=!0,q&&ue(),y.on(e,n,t)):y.on.apply(y,arguments)},off:function(e){if(y.off.apply(y,arguments),ge(e)){var n=!1;y.getEvents().forEach((function(e){ge(e)&&y.getEventListenerCount(e)>0&&(n=!0)})),n||(p=!1,g&&void 0===A&&Z())}},setStreaming:function(e){var n=null===e?void 0:e;n!==A&&(A=n,ue())},flush:function(e){return R(k?O.flush():Promise.resolve(),e)},allFlags:function(){var e={};if(!L)return e;for(var n in L)L.hasOwnProperty(n)&&(e[n]=B(n,null,!w.sendEventsOnlyForVariation).value);return e},close:function(e){if(J)return R(Promise.resolve(),e);var n=function(){J=!0,L={}};return R(Promise.resolve().then((function(){if(Z(),k)return O.stop(),O.flush()})).then(n).catch(n),e)}},options:w,emitter:y,ident:z,logger:h,requestor:T,start:function(){k&&O.start()},enqueueEvent:H,getFlagsInternal:function(){return L},getEnvironmentId:function(){return E},internalChangeEventName:"internal-change"}}function je(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function Re(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}var Te={promise:Promise.resolve({status:200,header:function(){return null},body:null})};function Ne(e,n,t,r,o){if(o&&!function(){var e=window.navigator&&window.navigator.userAgent;if(e){var n=e.match(/Chrom(e|ium)\/([0-9]+)\./);if(n)return parseInt(n[2],10)<73}return!0}())return Te;var i=new window.XMLHttpRequest;for(var a in i.open(e,n,!o),t||{})t.hasOwnProperty(a)&&i.setRequestHeader(a,t[a]);if(o)return i.send(r),Te;var u;return{promise:new Promise((function(e,n){i.addEventListener("load",(function(){u||e({status:i.status,header:function(e){return i.getResponseHeader(e)},body:i.responseText})})),i.addEventListener("error",(function(){u||n(new Error)})),i.send(r)})),cancel:function(){u=!0,i.abort()}}}function Ie(e){var n,t={};t.synchronousFlush=!1,window.XMLHttpRequest&&(t.httpRequest=function(e,n,r,o){var i=t.synchronousFlush;return t.synchronousFlush=!1,Ne(e,n,r,o,i)}),t.httpAllowsPost=function(){return void 0===n&&(n=!!window.XMLHttpRequest&&"withCredentials"in new window.XMLHttpRequest),n},t.httpFallbackPing=function(e){(new window.Image).src=e};var r,o=e&&e.eventUrlTransformer;t.getCurrentUrl=function(){return o?o(window.location.href):window.location.href},t.isDoNotTrack=function(){var e;return 1===(e=window.navigator&&void 0!==window.navigator.doNotTrack?window.navigator.doNotTrack:window.navigator&&void 0!==window.navigator.msDoNotTrack?window.navigator.msDoNotTrack:window.doNotTrack)||!0===e||"1"===e||"yes"===e};try{window.localStorage&&(t.localStorage={get:function(e){return new Promise((function(n){n(window.localStorage.getItem(e))}))},set:function(e,n){return new Promise((function(t){window.localStorage.setItem(e,n),t()}))},clear:function(e){return new Promise((function(n){window.localStorage.removeItem(e),n()}))}})}catch(e){t.localStorage=null}if(e&&e.useReport&&"function"==typeof window.EventSourcePolyfill&&window.EventSourcePolyfill.supportedOptions&&window.EventSourcePolyfill.supportedOptions.method?(t.eventSourceAllowsReport=!0,r=window.EventSourcePolyfill):(t.eventSourceAllowsReport=!1,r=window.EventSource),window.EventSource){t.eventSourceFactory=function(e,n){var t=function(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Re(t,!0).forEach((function(n){je(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Re(t).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}({},{heartbeatTimeout:3e5,silentTimeout:3e5,skipDefaultHeaders:!0},{},n);return new r(e,t)},t.eventSourceIsActive=function(e){return e.readyState===window.EventSource.OPEN||e.readyState===window.EventSource.CONNECTING}}return t.userAgent="JSClient",t}var Le=/[|\\{}()[\]^$+*?.]/g,Fe=function(e){if("string"!=typeof e)throw new TypeError("Expected a string");return e.replace(Le,"\\$&")};function xe(e,n,t,r){var o,i,a=n.replace(t,"").replace(r,"");switch(e.kind){case"exact":i=n,o=new RegExp("^"+Fe(e.url)+"/?$");break;case"canonical":i=a,o=new RegExp("^"+Fe(e.url)+"/?$");break;case"substring":i=a,o=new RegExp(".*"+Fe(e.substring)+".*$");break;case"regex":i=a,o=new RegExp(e.pattern);break;default:return!1}return o.test(i)}function Ce(e,n){for(var t={},r=null,o=[],i=0;i<e.length;i++)for(var a=e[i],u=a.urls||[],c=0;c<u.length;c++)if(xe(u[c],window.location.href,window.location.search,window.location.hash)){"pageview"===a.kind?n("pageview",a):(o.push(a),n("click_pageview",a));break}return o.length>0&&(r=function(e){for(var t=function(e,n){for(var t=[],r=0;r<n.length;r++)for(var o=e.target,i=n[r],a=i.selector,u=document.querySelectorAll(a);o&&u.length>0;){for(var c=0;c<u.length;c++)o===u[c]&&t.push(i);o=o.parentNode}return t}(e,o),r=0;r<t.length;r++)n("click",t[r])},document.addEventListener("click",r)),t.dispose=function(){document.removeEventListener("click",r)},t}var Ae=300;function qe(e,n){var t,r,o={};function i(){r&&r.dispose(),t&&t.length&&(r=Ce(t,a))}function a(n,t){var r={kind:n,key:t.key,data:null,url:window.location.href,user:e.ident.getUser(),creationDate:(new Date).getTime()};return"click"===n&&(r.selector=t.selector),e.enqueueEvent(r)}return o.goalKeyExists=function(e){if(!t)return!0;for(var n=0;n<t.length;n++)if("custom"===t[n].kind&&t[n].key===e)return!0;return!1},e.requestor.fetchJSON("/sdk/goals/"+e.getEnvironmentId()).then((function(e){e&&e.length>0&&(r=Ce(t=e,a),function(e,n){var t,r=window.location.href;function o(){(t=window.location.href)!==r&&(r=t,n())}!function e(n,t){n(),setTimeout((function(){e(n,t)}),t)}(o,e),window.history&&window.history.pushState?window.addEventListener("popstate",o):window.addEventListener("hashchange",o)}(Ae,i)),n()})).catch((function(t){e.emitter.maybeReportError(new v.LDUnexpectedResponseError((t&&t.message,t.message))),n()})),o}var Je="goalsReady",_e={fetchGoals:{default:!0},hash:{type:"string"},eventUrlTransformer:{type:"function"}};function Ve(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=Ie(t),o=Ue(e,n,t,r,_e),i=o.client,a=o.options,u=o.emitter,c=new Promise((function(e){var n=u.on(Je,(function(){u.off(Je,n),e()}))}));if(i.waitUntilGoalsReady=function(){return c},a.fetchGoals){var s=qe(o,(function(){return u.emit(Je)}));r.customEventFilter=s.goalKeyExists}else u.emit(Je);"complete"!==document.readyState?window.addEventListener("load",o.start):o.start();var l=function(){r.synchronousFlush=!0,i.flush().catch((function(){})),r.synchronousFlush=!1};return window.addEventListener("beforeunload",l),window.addEventListener("unload",l),i}var ze=De,$e="2.16.3";var He={initialize:function(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return console&&console.warn&&console.warn(ke.deprecated("default export","named LDClient export")),Ve(e,n,t)},version:"2.16.3"};export default He;export{ze as createConsoleLogger,Ve as initialize,$e as version};
function e(n){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(n)}function n(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function t(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function r(e){for(var r=1;r<arguments.length;r++){var o=null!=arguments[r]?arguments[r]:{};r%2?t(o,!0).forEach((function(t){n(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):t(o).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(o,n))}))}return e}function o(e){function n(e,n){Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.message=e,this.code=n}return n.prototype=new Error,n.prototype.name=e,n.prototype.constructor=n,n}var i=o("LaunchDarklyUnexpectedResponseError"),a=o("LaunchDarklyInvalidEnvironmentIdError"),u=o("LaunchDarklyInvalidUserError"),s=o("LaunchDarklyInvalidEventKeyError"),c=o("LaunchDarklyInvalidArgumentError"),l=o("LaunchDarklyFlagFetchError");function f(e){return!(e>=400&&e<500)||400===e||408===e||429===e}for(var v=Object.freeze({__proto__:null,LDUnexpectedResponseError:i,LDInvalidEnvironmentIdError:a,LDInvalidUserError:u,LDInvalidEventKeyError:s,LDInvalidArgumentError:c,LDFlagFetchError:l,isHttpErrorRecoverable:f}),d=function(e){for(var n,t=e.length,r=t%3,o=[],i=0,a=t-r;i<a;i+=16383)o.push(w(e,i,i+16383>a?a:i+16383));return 1===r?(n=e[t-1],o.push(g[n>>2]+g[n<<4&63]+"==")):2===r&&(n=(e[t-2]<<8)+e[t-1],o.push(g[n>>10]+g[n>>4&63]+g[n<<2&63]+"=")),o.join("")},g=[],p=[],m="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",h=0,y=m.length;h<y;++h)g[h]=m[h],p[m.charCodeAt(h)]=h;function w(e,n,t){for(var r,o,i=[],a=n;a<t;a+=3)r=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),i.push(g[(o=r)>>18&63]+g[o>>12&63]+g[o>>6&63]+g[63&o]);return i.join("")}p["-".charCodeAt(0)]=62,p["_".charCodeAt(0)]=63;var b=Array.isArray,E=Object.keys,k=Object.prototype.hasOwnProperty,S=["key","secondary","ip","country","email","firstName","lastName","avatar","name"];function D(e){var n=unescape(encodeURIComponent(e));return d(function(e){for(var n=[],t=0;t<e.length;t++)n.push(e.charCodeAt(t));return n}(n))}function P(e){return D(e).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function O(e){return JSON.parse(JSON.stringify(e))}function U(e,n){return function e(n,t){if(n===t)return!0;if(n&&t&&"object"==typeof n&&"object"==typeof t){var r,o,i,a=b(n),u=b(t);if(a&&u){if((o=n.length)!=t.length)return!1;for(r=o;0!=r--;)if(!e(n[r],t[r]))return!1;return!0}if(a!=u)return!1;var s=n instanceof Date,c=t instanceof Date;if(s!=c)return!1;if(s&&c)return n.getTime()==t.getTime();var l=n instanceof RegExp,f=t instanceof RegExp;if(l!=f)return!1;if(l&&f)return n.toString()==t.toString();var v=E(n);if((o=v.length)!==E(t).length)return!1;for(r=o;0!=r--;)if(!k.call(t,v[r]))return!1;for(r=o;0!=r--;)if(!e(n[i=v[r]],t[i]))return!1;return!0}return n!=n&&t!=t}(e,n)}function R(e){setTimeout(e,0)}function I(e,n){var t=e.then((function(e){return n&&setTimeout((function(){n(null,e)}),0),e}),(function(e){if(!n)return Promise.reject(e);setTimeout((function(){n(e,null)}),0)}));return n?void 0:t}function j(e){var n={};for(var t in e)e.hasOwnProperty(t)&&(n[t]={value:e[t],version:0});return n}function T(e){var n={};for(var t in e)e.hasOwnProperty(t)&&(n[t]=e[t].value);return n}function N(e,n){for(var t,r=n.slice(0),o=[],i=e;r.length>0;){for(t=[];i>0;){var a=r.shift();if(!a)break;(i-=P(JSON.stringify(a)).length)<0&&t.length>0?r.unshift(a):t.push(a)}i=e,o.push(t)}return o}function L(e){var n=e.version||"3.2.2";return e.userAgent+"/"+n}function F(e,n){if(n&&!n.sendLDHeaders)return{};var t={"X-LaunchDarkly-User-Agent":L(e)};return n&&n.wrapperName&&(t["X-LaunchDarkly-Wrapper"]=n.wrapperVersion?n.wrapperName+"/"+n.wrapperVersion:n.wrapperName),t}function C(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];return n.reduce((function(e,n){return r({},e,{},n)}),{})}function x(e){if(!e)return e;var n;for(var t in S){var o=S[t],i=e[o];void 0!==i&&"string"!=typeof i&&((n=n||r({},e))[o]=String(i))}return n||e}Object.freeze({__proto__:null,btoa:D,base64URLEncode:P,clone:O,deepEquals:U,onNextTick:R,wrapPromiseCallback:I,transformValuesToVersionedValues:j,transformVersionedValuesToValues:T,chunkUserEventsForUrl:N,getLDUserAgentString:L,getLDHeaders:F,extend:C,sanitizeUser:x});for(var A=function(e,n){return function(e){var n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(n){var t=new Uint8Array(16);e.exports=function(){return n(t),t}}else{var r=new Array(16);e.exports=function(){for(var e,n=0;n<16;n++)0==(3&n)&&(e=4294967296*Math.random()),r[n]=e>>>((3&n)<<3)&255;return r}}}(n={exports:{}}),n.exports}(),q=[],V=0;V<256;++V)q[V]=(V+256).toString(16).substr(1);var _,J,z=0,M=0,$=function(e,n,t){var r=n&&t||0,o=n||[],i=(e=e||{}).node||_,a=void 0!==e.clockseq?e.clockseq:J;if(null==i||null==a){var u=A();null==i&&(i=_=[1|u[0],u[1],u[2],u[3],u[4],u[5]]),null==a&&(a=J=16383&(u[6]<<8|u[7]))}var s=void 0!==e.msecs?e.msecs:(new Date).getTime(),c=void 0!==e.nsecs?e.nsecs:M+1,l=s-z+(c-M)/1e4;if(l<0&&void 0===e.clockseq&&(a=a+1&16383),(l<0||s>z)&&void 0===e.nsecs&&(c=0),c>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");z=s,M=c,J=a;var f=(1e4*(268435455&(s+=122192928e5))+c)%4294967296;o[r++]=f>>>24&255,o[r++]=f>>>16&255,o[r++]=f>>>8&255,o[r++]=255&f;var v=s/4294967296*1e4&268435455;o[r++]=v>>>8&255,o[r++]=255&v,o[r++]=v>>>24&15|16,o[r++]=v>>>16&255,o[r++]=a>>>8|128,o[r++]=255&a;for(var d=0;d<6;++d)o[r+d]=i[d];return n||function(e,n){var t=n||0,r=q;return[r[e[t++]],r[e[t++]],r[e[t++]],r[e[t++]],"-",r[e[t++]],r[e[t++]],"-",r[e[t++]],r[e[t++]],"-",r[e[t++]],r[e[t++]],"-",r[e[t++]],r[e[t++]],r[e[t++]],r[e[t++]],r[e[t++]],r[e[t++]]].join("")}(o)};function H(e,n,t){var r="/a/"+n+".gif",o=C({"Content-Type":"application/json"},F(e,t)),i=e.httpFallbackPing,a={sendChunk:function(n,t,a,u){var s=JSON.stringify(n),c=a?null:$();return u?function n(r){var i=a?o:C({},o,{"X-LaunchDarkly-Event-Schema":"3","X-LaunchDarkly-Payload-ID":c});return e.httpRequest("POST",t,i,s).promise.then((function(e){if(e)return e.status>=400&&f(e.status)&&r?n(!1):function(e){var n={status:e.status},t=e.header("date");if(t){var r=Date.parse(t);r&&(n.serverTime=r)}return n}(e)})).catch((function(){return r?n(!1):Promise.reject()}))}(!0).catch((function(){})):(i&&i(t+r+"?d="+P(s)),Promise.resolve())},sendEvents:function(n,t,r){if(!e.httpRequest)return Promise.resolve();var o,i=e.httpAllowsPost();o=i?[n]:N(2e3-t.length,n);for(var u=[],s=0;s<o.length;s++)u.push(a.sendChunk(o[s],t,r,i));return Promise.all(u)}};return a}function K(){var e={},n=0,t=0,r={};return e.summarizeEvent=function(e){if("feature"===e.kind){var o=e.key+":"+(null!==e.variation&&void 0!==e.variation?e.variation:"")+":"+(null!==e.version&&void 0!==e.version?e.version:""),i=r[o];i?i.count=i.count+1:r[o]={count:1,key:e.key,variation:e.variation,version:e.version,value:e.value,default:e.default},(0===n||e.creationDate<n)&&(n=e.creationDate),e.creationDate>t&&(t=e.creationDate)}},e.getSummary=function(){var e={},o=!0;for(var i in r){var a=r[i],u=e[a.key];u||(u={default:a.default,counters:[]},e[a.key]=u);var s={value:a.value,count:a.count};void 0!==a.variation&&null!==a.variation&&(s.variation=a.variation),a.version?s.version=a.version:s.unknown=!0,u.counters.push(s),o=!1}return o?null:{startDate:n,endDate:t,features:e}},e.clearSummary=function(){n=0,t=0,r={}},e}function B(e){var n={},t=e.allAttributesPrivate,r=e.privateAttributeNames||[],o={key:!0,custom:!0,anonymous:!0},i={key:!0,secondary:!0,ip:!0,country:!0,email:!0,firstName:!0,lastName:!0,avatar:!0,name:!0,anonymous:!0,custom:!0};return n.filterUser=function(e){if(!e)return null;var n=e.privateAttributeNames||[],a=function(e,i){return Object.keys(e).reduce((function(a,u){var s=a;return i(u)&&(function(e){return!o[e]&&(t||-1!==n.indexOf(e)||-1!==r.indexOf(e))}(u)?s[1][u]=!0:s[0][u]=e[u]),s}),[{},{}])},u=a(e,(function(e){return i[e]})),s=u[0],c=u[1];if(e.custom){var l=a(e.custom,(function(){return!0}));s.custom=l[0],c=C({},c,l[1])}var f=Object.keys(c);return f.length&&(f.sort(),s.privateAttrs=f),s},n}function G(e){return e&&e.message?e.message:"string"==typeof e||e instanceof String?e:JSON.stringify(e)}var X=" Please see https://docs.launchdarkly.com/docs/js-sdk-reference#section-initializing-the-client for instructions on SDK initialization.",W=function(e){return'Expected application/json content type but got "'+e+'"'},Q=function(e){return"network error"+(e?" ("+e+")":"")},Y=function(e){return'Custom event "'+e+'" does not exist'},Z=function(){return"Environment not found. Double check that you specified a valid environment/client-side ID."+X},ee=function(){return"No environment/client-side ID was specified."+X},ne=function(e){return"Error fetching flag settings: "+G(e)},te=function(){return"No user specified."+X},re=function(){return"Invalid user specified."+X},oe=function(){return"LaunchDarkly client was initialized with bootstrap data that did not include flag metadata. Events may not be sent correctly."+X},ie=function(e,n){return n?'"'+e+'" is deprecated, please use "'+n+'"':'"'+e+'" is deprecated'},ae=function(e,n,t){return"Received error "+e+(401===e?" (invalid SDK key)":"")+" for "+n+" - "+(f(e)?t:"giving up permanently")},ue=function(){return"Cannot make HTTP requests in this environment."+X},se=function(e){return"Opening stream connection to "+e},ce=function(e,n){return"Error on stream connection: "+G(e)+", will continue retrying every "+n+" milliseconds."},le=function(e){return'Ignoring unknown config option "'+e+'"'},fe=function(e,n,t){return'Config option "'+e+'" should be of type '+n+", got "+t+", using default value"},ve=function(e,n){return'Config option "'+e+'" should be a boolean, got '+n+", converting to boolean"},de=function(e,n,t){return'Config option "'+e+'" was set to '+n+", changing to minimum value of "+t},ge=function(e){return"polling for feature flags at "+e},pe=function(e){return'received streaming update for flag "'+e+'"'},me=function(e){return'received streaming update for flag "'+e+'" but ignored due to version check'},he=function(e){return'received streaming deletion for flag "'+e+'"'},ye=function(e){return'received streaming deletion for flag "'+e+'" but ignored due to version check'},we=function(e){return'enqueueing "'+e+'" event'},be=function(e){return"sending "+e+" events"},Ee=Object.freeze({__proto__:null,clientInitialized:function(){return"LaunchDarkly client initialized"},clientNotReady:function(){return"LaunchDarkly client is not ready"},eventCapacityExceeded:function(){return"Exceeded event queue capacity. Increase capacity to avoid dropping events."},eventWithoutUser:function(){return"Be sure to call `identify` in the LaunchDarkly client: https://docs.launchdarkly.com/docs/js-sdk-reference#section-analytics-events"},invalidContentType:W,invalidKey:function(){return"Event key must be a string"},localStorageUnavailable:function(){return"localStorage is unavailable"},localStorageUnavailableForUserId:function(){return"localStorage is unavailable, so anonymous user ID cannot be cached"},networkError:Q,unknownCustomEventKey:Y,environmentNotFound:Z,environmentNotSpecified:ee,errorFetchingFlags:ne,userNotSpecified:te,invalidUser:re,bootstrapOldFormat:oe,bootstrapInvalid:function(){return"LaunchDarkly bootstrap data is not available because the back end could not read the flags."},deprecated:ie,httpErrorMessage:ae,httpUnavailable:ue,identifyDisabled:function(){return"identify() has no effect here; it must be called on the main client instance"},streamClosing:function(){return"Closing stream connection"},streamConnecting:se,streamError:ce,unknownOption:le,wrongOptionType:fe,wrongOptionTypeBoolean:ve,optionBelowMinimum:de,debugPolling:ge,debugStreamPing:function(){return"received ping message from stream"},debugStreamPut:function(){return"received streaming update for all flags"},debugStreamPatch:pe,debugStreamPatchIgnored:me,debugStreamDelete:he,debugStreamDeleteIgnored:ye,debugEnqueueingEvent:we,debugPostingEvents:be,debugPostingDiagnosticEvent:function(e){return"sending diagnostic event ("+e.kind+")"}});function ke(e,n,t,r,o){var i={};function a(){var e="",o=r.getUser();return o&&(e=t||D(JSON.stringify(o))),"ld:"+n+":"+e}return i.loadFlags=function(){return e.get(a()).then((function(e){if(null==e)return null;try{var n=JSON.parse(e);if(n){var t=n.$schema;void 0===t||t<1?n=j(n):delete n.$schema}return n}catch(e){return i.clearFlags().then((function(){return Promise.reject(e)}))}})).catch((function(e){return o.warn("localStorage is unavailable"),Promise.reject(e)}))},i.saveFlags=function(n){var t=C({},n,{$schema:1});return e.set(a(),JSON.stringify(t)).catch((function(e){return o.warn("localStorage is unavailable"),Promise.reject(e)}))},i.clearFlags=function(){return e.clear(a()).catch((function(e){return o.warn("localStorage is unavailable"),Promise.reject(e)}))},i}function Se(e,n,t,r){var o,i=n.streamUrl,a=n.logger,u={},s=i+"/eval/"+t,c=n.useReport,l=n.evaluationReasons,f=n.streamReconnectDelay,v=F(e,n),d=!1,g=null,p=null,m=null,h=null,y=null;function w(e){d||(a.warn(ce(e,f)),d=!0),S(!1),k(),b(f)}function b(e){p||(e?p=setTimeout(E,e):E())}function E(){var n;p=null;var r="",u={headers:v};if(e.eventSourceFactory){for(var f in null!=h&&(r="h="+h),c?e.eventSourceAllowsReport?(n=s,u.method="REPORT",u.headers["Content-Type"]="application/json",u.body=JSON.stringify(m)):(n=i+"/ping/"+t,r=""):n=s+"/"+P(JSON.stringify(m)),l&&(r=r+(r?"&":"")+"withReasons=true"),n=n+(r?"?":"")+r,k(),a.info(se(n)),o=(new Date).getTime(),g=e.eventSourceFactory(n,u),y)y.hasOwnProperty(f)&&g.addEventListener(f,y[f]);g.onerror=w}}function k(){g&&(a.info("Closing stream connection"),g.close(),g=null)}function S(e){o&&r&&r.recordStreamInit(o,!e,(new Date).getTime()-o),o=null}return u.connect=function(e,n,t){m=e,h=n,y={};var r=function(e){y[e]=function(n){d=!1,S(!0),t[e]&&t[e](n)}};for(var o in t||{})r(o);b()},u.disconnect=function(){clearTimeout(p),p=null,k()},u.isConnected=function(){return!!(g&&e.eventSourceIsActive&&e.eventSourceIsActive(g))},u}function De(e,n,t){var r=n.baseUrl,o=n.useReport,i=n.evaluationReasons,u=n.logger,s={},c={};function f(t,r){if(!e.httpRequest)return new Promise((function(e,n){n(new l(ue()))}));var o=r?"REPORT":"GET",i=F(e,n);r&&(i["Content-Type"]="application/json");var u=c[t];u||(u=function(e){var n,t,r,o,i={addPromise:function(i,a){n=i,t&&t(),t=a,i.then((function(t){n===i&&(r(t),e&&e())}),(function(t){n===i&&(o(t),e&&e())}))}};return i.resultPromise=new Promise((function(e,n){r=e,o=n})),i}((function(){delete c[t]})),c[t]=u);var s=e.httpRequest(o,t,i,r),f=s.promise.then((function(e){if(200===e.status){if(e.header("content-type")&&0===e.header("content-type").lastIndexOf("application/json"))return JSON.parse(e.body);var n=W(e.header("content-type")||"");return Promise.reject(new l(n))}return Promise.reject(function(e){return 404===e.status?new a(Z()):new l(ne(e.statusText||String(e.status)))}(e))}),(function(e){return Promise.reject(new l(Q(e)))}));return u.addPromise(f,(function(){s.cancel&&s.cancel()})),u.resultPromise}return s.fetchJSON=function(e){return f(r+e,null)},s.fetchFlagSettings=function(e,n){var a,s,c,l="";return o?(s=[r,"/sdk/evalx/",t,"/user"].join(""),c=JSON.stringify(e)):(a=P(JSON.stringify(e)),s=[r,"/sdk/evalx/",t,"/users/",a].join("")),n&&(l="h="+n),i&&(l=l+(l?"&":"")+"withReasons=true"),s=s+(l?"?":"")+l,u.debug(ge(s)),f(s,c)},s}function Pe(e,n){var t={validateUser:function(t){if(!t)return Promise.reject(new u(te()));var r=O(t);return null!==r.key&&void 0!==r.key?(r.key=r.key.toString(),Promise.resolve(r)):r.anonymous?(e?e.get("ld:$anonUserId").catch((function(){return null})):Promise.resolve(null)).then((function(t){if(t)return r.key=t,r;var o=$();return r.key=o,function(t){return e?e.set("ld:$anonUserId",t).catch((function(){n.warn("localStorage is unavailable, so anonymous user ID cannot be cached")})):Promise.resolve()}(o).then((function(){return r}))})):Promise.reject(new u(re()))}};return t}var Oe={baseUrl:{default:"https://app.launchdarkly.com"},streamUrl:{default:"https://clientstream.launchdarkly.com"},eventsUrl:{default:"https://events.launchdarkly.com"},sendEvents:{default:!0},streaming:{type:"boolean"},sendLDHeaders:{default:!0},inlineUsersInEvents:{default:!1},allowFrequentDuplicateEvents:{default:!1},sendEventsOnlyForVariation:{default:!1},useReport:{default:!1},evaluationReasons:{default:!1},eventCapacity:{default:100,minimum:1},flushInterval:{default:2e3,minimum:2e3},samplingInterval:{default:0,minimum:0},streamReconnectDelay:{default:1e3,minimum:0},allAttributesPrivate:{default:!1},privateAttributeNames:{default:[]},bootstrap:{type:"string|object"},diagnosticRecordingInterval:{default:9e5,minimum:2e3},diagnosticOptOut:{default:!1},wrapperName:{type:"string"},wrapperVersion:{type:"string"},stateProvider:{type:"object"}};function Ue(n,t,r,o){var i=C({logger:{default:o}},Oe,r),a={all_attributes_private:"allAttributesPrivate",private_attribute_names:"privateAttributeNames",samplingInterval:null};function u(e){R((function(){t&&t.maybeReportError(new c(e))}))}var s=C({},n||{});return function(e){var n=e;Object.keys(a).forEach((function(e){if(void 0!==n[e]){var t=a[e];o&&o.warn(ie(e,t)),t&&(void 0===n[t]&&(n[t]=n[e]),delete n[e])}}))}(s),function(n){var t=C({},n),r=function(n){if(null===n)return"any";if(void 0!==n){if(Array.isArray(n))return"array";var t=e(n);return"boolean"===t||"string"===t||"number"===t||"function"===t?t:"object"}};return Object.keys(n).forEach((function(e){var o=n[e];if(null!=o){var a=i[e];if(void 0===a)u(le(e));else{var s=a.type||r(a.default);if("any"!==s){var c=s.split("|"),l=r(o);c.indexOf(l)<0?"boolean"===s?(t[e]=!!o,u(ve(e,l))):(u(fe(e,s,l)),t[e]=a.default):"number"===l&&void 0!==a.minimum&&o<a.minimum&&(u(de(e,o,a.minimum)),t[e]=a.minimum)}}}})),t}(s=function(e){var n=C({},e);return Object.keys(i).forEach((function(e){void 0!==n[e]&&null!==n[e]||(n[e]=i[e]&&i[e].default)})),n}(s))}var Re=Object.freeze({__proto__:null,baseOptionDefs:Oe,validate:Ue}).baseOptionDefs,Ie=function(e){var n={diagnosticId:$()};return e&&(n.sdkKeySuffix=e.length>6?e.substring(e.length-6):e),n},je=function(e){var n,t,r,o;function i(e){n=e,t=0,r=0,o=[]}return i(e),{getProps:function(){return{dataSinceDate:n,droppedEvents:t,eventsInLastBatch:r,streamInits:o}},setProps:function(e){n=e.dataSinceDate,t=e.droppedEvents||0,r=e.eventsInLastBatch||0,o=e.streamInits||[]},incrementDroppedEvents:function(){t++},setEventsInLastBatch:function(e){r=e},recordStreamInit:function(e,n,t){var r={timestamp:e,failed:n,durationMillis:t};o.push(r)},reset:i}},Te=function(e,n,t,o,i,a){var u,s,c=!!e.diagnosticUseCombinedEvent,l="ld:"+o+":$diagnostics",f=i.eventsUrl+"/events/diagnostic/"+o,v=i.diagnosticRecordingInterval,d=n,g=!!i.streaming,p={};function m(){return{sdk:w(),configuration:(n={customBaseURI:i.baseUrl!==Re.baseUrl.default,customStreamURI:i.streamUrl!==Re.streamUrl.default,customEventsURI:i.eventsUrl!==Re.eventsUrl.default,eventsCapacity:i.eventCapacity,eventsFlushIntervalMillis:i.flushInterval,reconnectTimeMillis:i.streamReconnectDelay,streamingDisabled:!g,allAttributesPrivate:!!i.allAttributesPrivate,inlineUsersInEvents:!!i.inlineUsersInEvents,diagnosticRecordingIntervalMillis:i.diagnosticRecordingInterval,usingSecureMode:!!i.hash,bootstrapMode:!!i.bootstrap,fetchGoalsDisabled:!i.fetchGoals,allowFrequentDuplicateEvents:!!i.allowFrequentDuplicateEvents,sendEventsOnlyForVariation:!!i.sendEventsOnlyForVariation},n),platform:e.diagnosticPlatformData};var n}function h(e){i.logger&&i.logger.debug(Ee.debugPostingDiagnosticEvent(e)),t.sendEvents(e,f,!0).then((function(){})).catch((function(){}))}function y(){var n,t;h((n=(new Date).getTime(),t=r({kind:c?"diagnostic-combined":"diagnostic",id:a,creationDate:n},d.getProps()),c&&(t=r({},t,{},m())),d.reset(n),t)),s=setTimeout(y,v),u=(new Date).getTime(),c&&function(){if(e.localStorage){var n=r({},d.getProps());e.localStorage.set(l,JSON.stringify(n),(function(){}))}}()}function w(){var n=r({},e.diagnosticSdkData);return i.wrapperName&&(n.wrapperName=i.wrapperName),i.wrapperVersion&&(n.wrapperVersion=i.wrapperVersion),n}return p.start=function(){c?function(n){if(!e.localStorage)return n(!1);e.localStorage.get(l).then((function(e){if(e)try{var t=JSON.parse(e);d.setProps(t),u=t.dataSinceDate}catch(e){}n(!0)})).catch((function(){n(!1)}))}((function(e){if(e){var n=(u||0)+v,t=(new Date).getTime();t>=n?y():s=setTimeout(y,n-t)}else 0===Math.floor(4*Math.random())?y():s=setTimeout(y,v)})):(h(r({kind:"diagnostic-init",id:a,creationDate:d.getProps().dataSinceDate},m())),s=setTimeout(y,v))},p.stop=function(){s&&clearTimeout(s)},p.setStreaming=function(e){g=e},p};function Ne(e,n){var t,r=["debug","info","warn","error"];t=null!=n?""===n?"":n+" ":"LD: ";var o=0;e&&(o="none"===e?100:r.indexOf(e));var i={};function a(e,n,i){if(e>=o){var a=e<r.length?r[e]:"?";n(t+"["+a+"] "+i)}}return i.debug=function(e){return a(0,console.log,e)},i.info=function(e){return a(1,console.info,e)},i.warn=function(e){return a(2,console.warn,e)},i.error=function(e){return a(3,console.error,e)},i}function Le(n,t,o,u,c){var v=o&&o.logger?o.logger:c&&c.logger&&c.logger.default||Ne("warn"),d=function(e){var n={},t={};return n.on=function(e,n,r){t[e]=t[e]||[],t[e]=t[e].concat({handler:n,context:r})},n.off=function(e,n,r){if(t[e])for(var o=0;o<t[e].length;o++)t[e][o].handler===n&&t[e][o].context===r&&(t[e]=t[e].slice(0,o).concat(t[e].slice(o+1)))},n.emit=function(e){if(t[e])for(var n=0;n<t[e].length;n++)t[e][n].handler.apply(t[e][n].context,Array.prototype.slice.call(arguments,1))},n.getEvents=function(){return Object.keys(t)},n.getEventListenerCount=function(e){return t[e]?t[e].length:0},n.maybeReportError=function(n){n&&(t.error?this.emit("error",n):(e||console).error(n.message))},n}(v),g=Ue(o,d,c,v),p=g.sendEvents,m=n,h=g.hash,y=H(u,m,g),w=g.sendEvents&&!g.diagnosticOptOut,b=w?Ie(m):null,E=w?je((new Date).getTime()):null,k=w?Te(u,E,y,m,g,b):null;k&&k.start();var S,D,P,j,N=Se(u,g,m,E),L=g.eventProcessor||function(e,n,t){var r,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,u=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,s={},c=u||H(e,t,n),l=n.eventsUrl+"/events/bulk/"+t,v=K(),d=B(n),g=n.inlineUsersInEvents,p=n.samplingInterval,m=n.eventCapacity,h=n.flushInterval,y=n.logger,w=[],b=0,E=!1,k=!1;function S(){return 0===p||0===Math.floor(Math.random()*p)}function D(e){return!!e.debugEventsUntilDate&&e.debugEventsUntilDate>b&&e.debugEventsUntilDate>(new Date).getTime()}function P(e){var n=C({},e);return g||"identify"===e.kind?n.user=d.filterUser(e.user):(n.userKey=e.user.key,delete n.user),"feature"===e.kind&&(delete n.trackEvents,delete n.debugEventsUntilDate),n}function O(e){w.length<m?(w.push(e),k=!1):(k||(k=!0,y.warn("Exceeded event queue capacity. Increase capacity to avoid dropping events.")),o&&o.incrementDroppedEvents())}return s.enqueue=function(e){if(!E){var n=!1,t=!1;if(v.summarizeEvent(e),"feature"===e.kind?S()&&(n=!!e.trackEvents,t=D(e)):n=S(),n&&O(P(e)),t){var r=C({},e,{kind:"debug"});delete r.trackEvents,delete r.debugEventsUntilDate,delete r.variation,O(r)}}},s.flush=function(){if(E)return Promise.resolve();var e=w,n=v.getSummary();return v.clearSummary(),n&&(n.kind="summary",e.push(n)),o&&o.setEventsInLastBatch(e.length),0===e.length?Promise.resolve():(w=[],y.debug(be(e.length)),c.sendEvents(e,l).then((function(e){e&&(e.serverTime&&(b=e.serverTime),f(e.status)||(E=!0),e.status>=400&&R((function(){a.maybeReportError(new i(ae(e.status,"event posting","some events were dropped")))})))})))},s.start=function(){r=setTimeout((function e(){s.flush(),r=setTimeout(e,h)}),h)},s.stop=function(){clearTimeout(r)},s}(u,g,m,E,d,y),F=De(u,g,m),A={},q={},V=g.streaming,_=!1,J=!1,z=!0,M=g.stateProvider,$=function(e,n){var t,r={setUser:function(e){(t=x(e))&&n&&n(O(t))},getUser:function(){return t?O(t):null}};return r}(0,(function(e){M||e&&X({kind:"identify",key:e.key,user:e,creationDate:(new Date).getTime()})})),G=Pe(u.localStorage,v);function X(e){m&&(M&&M.enqueueEvent&&M.enqueueEvent(e)||(e.user?(z=!1,!p||J||u.isDoNotTrack()||(v.debug(we(e.kind)),L.enqueue(e))):z&&(v.warn("Be sure to call `identify` in the LaunchDarkly client: https://docs.launchdarkly.com/docs/js-sdk-reference#section-analytics-events"),z=!1)))}function W(e,n,t,r){var o=$.getUser(),i=new Date,a=n?n.value:null;if(!g.allowFrequentDuplicateEvents){var u=JSON.stringify(a)+(o&&o.key?o.key:"")+e,s=A[u];if(s&&i-s<3e5)return;A[u]=i}var c={kind:"feature",key:e,user:o,value:a,variation:n?n.variationIndex:null,default:t,creationDate:i.getTime()},l=q[e];l&&(c.version=l.flagVersion?l.flagVersion:l.version,c.trackEvents=l.trackEvents,c.debugEventsUntilDate=l.debugEventsUntilDate),(r||l&&l.trackReason)&&n&&(c.reason=n.reason),X(c)}function Q(e,n,t,r){var o;if(q&&q.hasOwnProperty(e)&&q[e]&&!q[e].deleted){var i=q[e];o=Z(i),null!==i.value&&void 0!==i.value||(o.value=n)}else o={value:n,variationIndex:null,reason:{kind:"ERROR",errorKind:"FLAG_NOT_FOUND"}};return t&&W(e,o,n,r),o}function Z(e){return{value:e.value,variationIndex:void 0===e.variation?null:e.variation,reason:e.reason||null}}function te(){D=!0,$.getUser()&&N.connect($.getUser(),h,{ping:function(){v.debug("received ping message from stream"),F.fetchFlagSettings($.getUser(),h).then((function(e){return ie(e||{})})).catch((function(e){d.maybeReportError(new l(ne(e)))}))},put:function(e){var n=JSON.parse(e.data);v.debug("received streaming update for all flags"),ie(n)},patch:function(e){var n=JSON.parse(e.data),t=q[n.key];if(!t||!t.version||!n.version||t.version<n.version){v.debug(pe(n.key));var r={},o=C({},n);delete o.key,q[n.key]=o;var i=Z(o);r[n.key]=t?{previous:t.value,current:i}:{current:i},ue(r)}else v.debug(me(n.key))},delete:function(e){var n=JSON.parse(e.data);if(!q[n.key]||q[n.key].version<n.version){v.debug(he(n.key));var t={};q[n.key]&&!q[n.key].deleted&&(t[n.key]={previous:q[n.key].value}),q[n.key]={version:n.version,deleted:!0},ue(t)}else v.debug(ye(n.key))}})}function re(){D&&(N.disconnect(),D=!1)}function ie(e){var n={};if(!e)return Promise.resolve();for(var t in q)q.hasOwnProperty(t)&&q[t]&&(e[t]&&!U(e[t].value,q[t].value)?n[t]={previous:q[t].value,current:Z(e[t])}:e[t]&&!e[t].deleted||(n[t]={previous:q[t].value}));for(var o in e)e.hasOwnProperty(o)&&e[o]&&(!q[o]||q[o].deleted)&&(n[o]={current:Z(e[o])});return q=r({},e),ue(n).catch((function(){}))}function ue(e){var n=Object.keys(e);if(n.length>0){var t={};n.forEach((function(n){var r=e[n].current,o=r?r.value:void 0,i=e[n].previous;d.emit("change:"+n,o,i),t[n]=r?{current:o,previous:i}:{previous:i}})),d.emit("change",t),d.emit("internal-change",q),g.sendEventsOnlyForVariation||M||n.forEach((function(n){W(n,e[n].current)}))}return S&&j?j.saveFlags(q).catch((function(){return null})):Promise.resolve()}function se(){var e=V||P&&void 0===V;e&&!D?te():!e&&D&&re(),k&&k.setStreaming(e)}function ce(e){return"change"===e||"change:"===e.substr(0,"change".length+1)}u.localStorage&&(j=new ke(u.localStorage,m,h,$,v));var le=new Promise((function(e){var n=d.on("ready",(function(){d.off("ready",n),e()}))})),fe=new Promise((function(e,n){var t=d.on("initialized",(function(){d.off("initialized",t),e()})),r=d.on("failed",(function(e){d.off("failed",r),n(e)}))}));if("string"==typeof g.bootstrap&&"LOCALSTORAGE"===g.bootstrap.toUpperCase()&&(j?S=!0:v.warn("localStorage is unavailable")),"object"===e(g.bootstrap)&&(q=function(e){var n=Object.keys(e),t=e.$flagsState;!t&&n.length&&v.warn(oe()),!1===e.$valid&&v.warn("LaunchDarkly bootstrap data is not available because the back end could not read the flags.");var r={};return n.forEach((function(n){if("$flagsState"!==n&&"$valid"!==n){var o={value:e[n]};t&&t[n]?o=C(o,t[n]):o.version=0,r[n]=o}})),r}(g.bootstrap)),M){var ve=M.getInitialState();ve?de(ve):M.on("init",de),M.on("update",(function(e){e.user&&$.setUser(e.user),e.flags&&ie(e.flags)}))}else(n?G.validateUser(t).then((function(n){return $.setUser(n),"object"===e(g.bootstrap)?ge():S?j.loadFlags().catch((function(){return null})).then((function(e){return null==e?(q={},F.fetchFlagSettings($.getUser(),h).then((function(e){return ie(e||{})})).then(ge).catch((function(e){Ee(new l(ne(e)))}))):(q=e,R(ge),F.fetchFlagSettings($.getUser(),h).then((function(e){return ie(e)})).catch((function(e){return d.maybeReportError(e)})))})):F.fetchFlagSettings($.getUser(),h).then((function(e){q=e||{},ge()})).catch((function(e){q={},Ee(e)}))})):Promise.reject(new a(ee()))).catch((function(e){return d.maybeReportError(e)}));function de(e){m=e.environment,$.setUser(e.user),q=r({},e.flags),R(ge)}function ge(){v.info("LaunchDarkly client initialized"),_=!0,se(),d.emit("ready"),d.emit("initialized")}function Ee(e){d.maybeReportError(e),d.emit("failed",e),d.emit("ready")}return{client:{waitForInitialization:function(){return fe},waitUntilReady:function(){return le},identify:function(e,n,t){return J?I(Promise.resolve({}),t):M?(v.warn("identify() has no effect here; it must be called on the main client instance"),I(Promise.resolve(T(q)),t)):I((S&&j?j.clearFlags():Promise.resolve()).then((function(){return G.validateUser(e)})).then((function(e){return F.fetchFlagSettings(e,n).then((function(t){var r=T(t);return $.setUser(e),h=n,t?ie(t).then((function(){return r})):r}))})).then((function(e){return D&&te(),e})).catch((function(e){return d.maybeReportError(e),Promise.reject(e)})),t)},getUser:function(){return $.getUser()},variation:function(e,n){return Q(e,n,!0,!1).value},variationDetail:function(e,n){return Q(e,n,!0,!0)},track:function(e,n,t){if("string"==typeof e){u.customEventFilter&&!u.customEventFilter(e)&&v.warn(Y(e));var r={kind:"custom",key:e,user:$.getUser(),url:u.getCurrentUrl(),creationDate:(new Date).getTime()};null!=n&&(r.data=n),null!=t&&(r.metricValue=t),X(r)}else d.maybeReportError(new s(Y(e)))},on:function(e,n,t){ce(e)?(P=!0,_&&se(),d.on(e,n,t)):d.on.apply(d,arguments)},off:function(e){if(d.off.apply(d,arguments),ce(e)){var n=!1;d.getEvents().forEach((function(e){ce(e)&&d.getEventListenerCount(e)>0&&(n=!0)})),n||(P=!1,D&&void 0===V&&re())}},setStreaming:function(e){var n=null===e?void 0:e;n!==V&&(V=n,se())},flush:function(e){return I(p?L.flush():Promise.resolve(),e)},allFlags:function(){var e={};if(!q)return e;for(var n in q)q.hasOwnProperty(n)&&(e[n]=Q(n,null,!g.sendEventsOnlyForVariation).value);return e},close:function(e){if(J)return I(Promise.resolve(),e);var n=function(){J=!0,q={}};return I(Promise.resolve().then((function(){if(re(),k&&k.stop(),p)return L.stop(),L.flush()})).then(n).catch(n),e)}},options:g,emitter:d,ident:$,logger:v,requestor:F,start:function(){p&&(k&&k.start(),L.start())},enqueueEvent:X,getFlagsInternal:function(){return q},getEnvironmentId:function(){return m},internalChangeEventName:"internal-change"}}function Fe(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function Ce(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}var xe={promise:Promise.resolve({status:200,header:function(){return null},body:null})};function Ae(e,n,t,r,o){if(o&&!function(){var e=window.navigator&&window.navigator.userAgent;if(e){var n=e.match(/Chrom(e|ium)\/([0-9]+)\./);if(n)return parseInt(n[2],10)<73}return!0}())return xe;var i=new window.XMLHttpRequest;for(var a in i.open(e,n,!o),t||{})t.hasOwnProperty(a)&&i.setRequestHeader(a,t[a]);if(o)return i.send(r),xe;var u;return{promise:new Promise((function(e,n){i.addEventListener("load",(function(){u||e({status:i.status,header:function(e){return i.getResponseHeader(e)},body:i.responseText})})),i.addEventListener("error",(function(){u||n(new Error)})),i.send(r)})),cancel:function(){u=!0,i.abort()}}}function qe(e){var n,t={};t.synchronousFlush=!1,window.XMLHttpRequest&&(t.httpRequest=function(e,n,r,o){var i=t.synchronousFlush;return t.synchronousFlush=!1,Ae(e,n,r,o,i)}),t.httpAllowsPost=function(){return void 0===n&&(n=!!window.XMLHttpRequest&&"withCredentials"in new window.XMLHttpRequest),n},t.httpFallbackPing=function(e){(new window.Image).src=e};var r,o=e&&e.eventUrlTransformer;t.getCurrentUrl=function(){return o?o(window.location.href):window.location.href},t.isDoNotTrack=function(){var e;return 1===(e=window.navigator&&void 0!==window.navigator.doNotTrack?window.navigator.doNotTrack:window.navigator&&void 0!==window.navigator.msDoNotTrack?window.navigator.msDoNotTrack:window.doNotTrack)||!0===e||"1"===e||"yes"===e};try{window.localStorage&&(t.localStorage={get:function(e){return new Promise((function(n){n(window.localStorage.getItem(e))}))},set:function(e,n){return new Promise((function(t){window.localStorage.setItem(e,n),t()}))},clear:function(e){return new Promise((function(n){window.localStorage.removeItem(e),n()}))}})}catch(e){t.localStorage=null}if(e&&e.useReport&&"function"==typeof window.EventSourcePolyfill&&window.EventSourcePolyfill.supportedOptions&&window.EventSourcePolyfill.supportedOptions.method?(t.eventSourceAllowsReport=!0,r=window.EventSourcePolyfill):(t.eventSourceAllowsReport=!1,r=window.EventSource),window.EventSource){t.eventSourceFactory=function(e,n){var t=function(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Ce(t,!0).forEach((function(n){Fe(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Ce(t).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}({},{heartbeatTimeout:3e5,silentTimeout:3e5,skipDefaultHeaders:!0},{},n);return new r(e,t)},t.eventSourceIsActive=function(e){return e.readyState===window.EventSource.OPEN||e.readyState===window.EventSource.CONNECTING}}return t.userAgent="JSClient",t.version="2.17.0",t.diagnosticSdkData={name:"js-client-sdk",version:"2.17.0"},t.diagnosticPlatformData={name:"JS"},t.diagnosticUseCombinedEvent=!0,t}var Ve=/[|\\{}()[\]^$+*?.]/g,_e=function(e){if("string"!=typeof e)throw new TypeError("Expected a string");return e.replace(Ve,"\\$&")};function Je(e,n,t,r){var o,i,a=n.replace(t,"").replace(r,"");switch(e.kind){case"exact":i=n,o=new RegExp("^"+_e(e.url)+"/?$");break;case"canonical":i=a,o=new RegExp("^"+_e(e.url)+"/?$");break;case"substring":i=a,o=new RegExp(".*"+_e(e.substring)+".*$");break;case"regex":i=a,o=new RegExp(e.pattern);break;default:return!1}return o.test(i)}function ze(e,n){for(var t={},r=null,o=[],i=0;i<e.length;i++)for(var a=e[i],u=a.urls||[],s=0;s<u.length;s++)if(Je(u[s],window.location.href,window.location.search,window.location.hash)){"pageview"===a.kind?n("pageview",a):(o.push(a),n("click_pageview",a));break}return o.length>0&&(r=function(e){for(var t=function(e,n){for(var t=[],r=0;r<n.length;r++)for(var o=e.target,i=n[r],a=i.selector,u=document.querySelectorAll(a);o&&u.length>0;){for(var s=0;s<u.length;s++)o===u[s]&&t.push(i);o=o.parentNode}return t}(e,o),r=0;r<t.length;r++)n("click",t[r])},document.addEventListener("click",r)),t.dispose=function(){document.removeEventListener("click",r)},t}var Me=300;function $e(e,n){var t,r,o={};function i(){r&&r.dispose(),t&&t.length&&(r=ze(t,a))}function a(n,t){var r={kind:n,key:t.key,data:null,url:window.location.href,user:e.ident.getUser(),creationDate:(new Date).getTime()};return"click"===n&&(r.selector=t.selector),e.enqueueEvent(r)}return o.goalKeyExists=function(e){if(!t)return!0;for(var n=0;n<t.length;n++)if("custom"===t[n].kind&&t[n].key===e)return!0;return!1},e.requestor.fetchJSON("/sdk/goals/"+e.getEnvironmentId()).then((function(e){e&&e.length>0&&(r=ze(t=e,a),function(e,n){var t,r=window.location.href;function o(){(t=window.location.href)!==r&&(r=t,n())}!function e(n,t){n(),setTimeout((function(){e(n,t)}),t)}(o,e),window.history&&window.history.pushState?window.addEventListener("popstate",o):window.addEventListener("hashchange",o)}(Me,i)),n()})).catch((function(t){e.emitter.maybeReportError(new v.LDUnexpectedResponseError((t&&t.message,t.message))),n()})),o}var He="goalsReady",Ke={fetchGoals:{default:!0},hash:{type:"string"},eventProcessor:{type:"object"},eventUrlTransformer:{type:"function"}};function Be(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=qe(t),o=Le(e,n,t,r,Ke),i=o.client,a=o.options,u=o.emitter,s=new Promise((function(e){var n=u.on(He,(function(){u.off(He,n),e()}))}));if(i.waitUntilGoalsReady=function(){return s},a.fetchGoals){var c=$e(o,(function(){return u.emit(He)}));r.customEventFilter=c.goalKeyExists}else u.emit(He);"complete"!==document.readyState?window.addEventListener("load",o.start):o.start();var l=function(){r.synchronousFlush=!0,i.flush().catch((function(){})),r.synchronousFlush=!1};return window.addEventListener("beforeunload",l),window.addEventListener("unload",l),i}var Ge=Ne,Xe="2.17.0";var We={initialize:function(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return console&&console.warn&&console.warn(Ee.deprecated("default export","named LDClient export")),Be(e,n,t)},version:"2.17.0"};export default We;export{Ge as createConsoleLogger,Be as initialize,Xe as version};
//# sourceMappingURL=ldclient.es.js.map

@@ -1,2 +0,2 @@

!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e=e||self).LDClient={})}(this,function(e){"use strict";function Oe(e){return(Oe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function n(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})),t.push.apply(t,r)}return t}function Pe(o){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?n(i,!0).forEach(function(e){var n,t,r;n=o,r=i[t=e],t in n?Object.defineProperty(n,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):n[t]=r}):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(i)):n(i).forEach(function(e){Object.defineProperty(o,e,Object.getOwnPropertyDescriptor(i,e))})}return o}function t(e){function n(e,n){Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.message=e,this.code=n}return(n.prototype=new Error).name=e,n.prototype.constructor=n}var De=t("LaunchDarklyUnexpectedResponseError"),je=t("LaunchDarklyInvalidEnvironmentIdError"),a=t("LaunchDarklyInvalidUserError"),Ue=t("LaunchDarklyInvalidEventKeyError"),Re=t("LaunchDarklyInvalidArgumentError"),Te=t("LaunchDarklyFlagFetchError");function Le(e){return!(400<=e&&e<500)||400===e||408===e||429===e}for(var c=Object.freeze({__proto__:null,LDUnexpectedResponseError:De,LDInvalidEnvironmentIdError:je,LDInvalidUserError:a,LDInvalidEventKeyError:Ue,LDInvalidArgumentError:Re,LDFlagFetchError:Te,isHttpErrorRecoverable:Le}),r=function(e){for(var n,t=e.length,r=t%3,o=[],i=0,a=t-r;i<a;i+=16383)o.push(f(e,i,a<i+16383?a:i+16383));return 1==r?(n=e[t-1],o.push(u[n>>2]+u[n<<4&63]+"==")):2==r&&(n=(e[t-2]<<8)+e[t-1],o.push(u[n>>10]+u[n>>4&63]+u[n<<2&63]+"=")),o.join("")},u=[],o=[],i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,l=i.length;s<l;++s)u[s]=i[s],o[i.charCodeAt(s)]=s;function f(e,n,t){for(var r,o,i=[],a=n;a<t;a+=3)r=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),i.push(u[(o=r)>>18&63]+u[o>>12&63]+u[o>>6&63]+u[63&o]);return i.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63;var d=Array.isArray,g=Object.keys,p=Object.prototype.hasOwnProperty,v=["key","secondary","ip","country","email","firstName","lastName","avatar","name"];function m(e){var n=unescape(encodeURIComponent(e));return r(function(e){for(var n=[],t=0;t<e.length;t++)n.push(e.charCodeAt(t));return n}(n))}function Ne(e){return m(e).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function Ie(e){return JSON.parse(JSON.stringify(e))}function Fe(e,n){return function e(n,t){if(n===t)return!0;if(n&&t&&"object"==typeof n&&"object"==typeof t){var r,o,i,a=d(n),u=d(t);if(a&&u){if((o=n.length)!=t.length)return!1;for(r=o;0!=r--;)if(!e(n[r],t[r]))return!1;return!0}if(a!=u)return!1;var c=n instanceof Date,s=t instanceof Date;if(c!=s)return!1;if(c&&s)return n.getTime()==t.getTime();var l=n instanceof RegExp,f=t instanceof RegExp;if(l!=f)return!1;if(l&&f)return n.toString()==t.toString();var v=g(n);if((o=v.length)!==g(t).length)return!1;for(r=o;0!=r--;)if(!p.call(t,v[r]))return!1;for(r=o;0!=r--;)if(!e(n[i=v[r]],t[i]))return!1;return!0}return n!=n&&t!=t}(e,n)}function xe(e){setTimeout(e,0)}function Ce(e,n){var t=e.then(function(e){return n&&setTimeout(function(){n(null,e)},0),e},function(e){if(!n)return Promise.reject(e);setTimeout(function(){n(e,null)},0)});return n?void 0:t}function h(e){var n={};for(var t in e)e.hasOwnProperty(t)&&(n[t]={value:e[t],version:0});return n}function Ae(e){var n={};for(var t in e)e.hasOwnProperty(t)&&(n[t]=e[t].value);return n}function y(e,n){for(var t,r=n.slice(0),o=[],i=e;0<r.length;){for(t=[];0<i;){var a=r.shift();if(!a)break;(i-=Ne(JSON.stringify(a)).length)<0&&0<t.length?r.unshift(a):t.push(a)}i=e,o.push(t)}return o}function w(e){var n=e.version||"3.1.2";return e.userAgent+"/"+n}function qe(e,n){if(n&&!n.sendLDHeaders)return{};var t={"X-LaunchDarkly-User-Agent":w(e)};return n&&n.wrapperName&&(t["X-LaunchDarkly-Wrapper"]=n.wrapperVersion?n.wrapperName+"/"+n.wrapperVersion:n.wrapperName),t}function _e(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];return n.reduce(function(e,n){return Pe({},e,{},n)},{})}function Je(e){if(!e)return e;var n;for(var t in v){var r=v[t],o=e[r];void 0!==o&&"string"!=typeof o&&((n=n||Pe({},e))[r]=String(o))}return n||e}Object.freeze({__proto__:null,btoa:m,base64URLEncode:Ne,clone:Ie,deepEquals:Fe,onNextTick:xe,wrapPromiseCallback:Ce,transformValuesToVersionedValues:h,transformVersionedValuesToValues:Ae,chunkUserEventsForUrl:y,getLDUserAgentString:w,getLDHeaders:qe,extend:_e,sanitizeUser:Je});for(var b,k=(b=void 0,function(e){var n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(n){var t=new Uint8Array(16);e.exports=function(){return n(t),t}}else{var r=new Array(16);e.exports=function(){for(var e,n=0;n<16;n++)0==(3&n)&&(e=4294967296*Math.random()),r[n]=e>>>((3&n)<<3)&255;return r}}}(b={exports:{}}),b.exports),E=[],S=0;S<256;++S)E[S]=(S+256).toString(16).substr(1);var O,P,D=0,j=0,U=function(e,n,t){var r=n&&t||0,o=n||[],i=(e=e||{}).node||O,a=void 0!==e.clockseq?e.clockseq:P;if(null==i||null==a){var u=k();null==i&&(i=O=[1|u[0],u[1],u[2],u[3],u[4],u[5]]),null==a&&(a=P=16383&(u[6]<<8|u[7]))}var c=void 0!==e.msecs?e.msecs:(new Date).getTime(),s=void 0!==e.nsecs?e.nsecs:j+1,l=c-D+(s-j)/1e4;if(l<0&&void 0===e.clockseq&&(a=a+1&16383),(l<0||D<c)&&void 0===e.nsecs&&(s=0),1e4<=s)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");D=c,P=a;var f=(1e4*(268435455&(c+=122192928e5))+(j=s))%4294967296;o[r++]=f>>>24&255,o[r++]=f>>>16&255,o[r++]=f>>>8&255,o[r++]=255&f;var v=c/4294967296*1e4&268435455;o[r++]=v>>>8&255,o[r++]=255&v,o[r++]=v>>>24&15|16,o[r++]=v>>>16&255,o[r++]=a>>>8|128,o[r++]=255&a;for(var d=0;d<6;++d)o[r+d]=i[d];return n||function(e,n){var t=n||0,r=E;return[r[e[t++]],r[e[t++]],r[e[t++]],r[e[t++]],"-",r[e[t++]],r[e[t++]],"-",r[e[t++]],r[e[t++]],"-",r[e[t++]],r[e[t++]],"-",r[e[t++]],r[e[t++]],r[e[t++]],r[e[t++]],r[e[t++]],r[e[t++]]].join("")}(o)};function Ve(s,l,e,f){var v=l+"/events/bulk/"+e,d=l+"/a/"+e+".gif",g=s.httpFallbackPing,n={};return n.sendEvents=function(e){if(!s.httpRequest)return Promise.resolve();var n,t,r,o,i,a=s.httpAllowsPost();n=a?[e]:y(2e3-l.length,e);for(var u=[],c=0;c<n.length;c++)u.push((t=n[c],r=a,void 0,o=JSON.stringify(t),i=U(),r?function n(t){var e=_e({"Content-Type":"application/json","X-LaunchDarkly-Event-Schema":"3","X-LaunchDarkly-Payload-ID":i},qe(s,f));return s.httpRequest("POST",v,e,o).promise.then(function(e){if(e)return 400<=e.status&&Le(e.status)&&t?n(!1):function(e){var n={status:e.status},t=e.header("date");if(t){var r=Date.parse(t);r&&(n.serverTime=r)}return n}(e)}).catch(function(){return t?n(!1):Promise.reject()})}(!0).catch(function(){}):(g&&g(d+"?d="+Ne(o)),Promise.resolve())));return Promise.all(u)},n}function ze(e){var n={},c=e.allAttributesPrivate,s=e.privateAttributeNames||[],l={key:!0,custom:!0,anonymous:!0},f={key:!0,secondary:!0,ip:!0,country:!0,email:!0,firstName:!0,lastName:!0,avatar:!0,name:!0,anonymous:!0,custom:!0};return n.filterUser=function(e){if(!e)return null;function n(o,i){return Object.keys(o).reduce(function(e,n){var t,r=e;return i(n)&&(l[t=n]||!c&&-1===a.indexOf(t)&&-1===s.indexOf(t)?r[0][n]=o[n]:r[1][n]=!0),r},[{},{}])}var a=e.privateAttributeNames||[],t=n(e,function(e){return f[e]}),r=t[0],o=t[1];if(e.custom){var i=n(e.custom,function(){return!0});r.custom=i[0],o=_e({},o,i[1])}var u=Object.keys(o);return u.length&&(u.sort(),r.privateAttrs=u),r},n}function R(e){return e&&e.message?e.message:"string"==typeof e||e instanceof String?e:JSON.stringify(e)}var T=" Please see https://docs.launchdarkly.com/docs/js-sdk-reference#section-initializing-the-client for instructions on SDK initialization.",L=function(e){return'Expected application/json content type but got "'+e+'"'},N=function(e){return"network error"+(e?" ("+e+")":"")},$e=function(e){return'Custom event "'+e+'" does not exist'},I=function(){return"Environment not found. Double check that you specified a valid environment/client-side ID."+T},He=function(){return"No environment/client-side ID was specified."+T},Me=function(e){return"Error fetching flag settings: "+R(e)},F=function(){return"No user specified."+T},x=function(){return"Invalid user specified."+T},Ke=function(){return"LaunchDarkly client was initialized with bootstrap data that did not include flag metadata. Events may not be sent correctly."+T},Xe=function(e,n){return n?'"'+e+'" is deprecated, please use "'+n+'"':'"'+e+'" is deprecated'},Ge=function(e,n,t){return"Received error "+e+(401===e?" (invalid SDK key)":"")+" for "+n+" - "+(Le(e)?t:"giving up permanently")},C=function(){return"Cannot make HTTP requests in this environment."+T},Be=function(e){return"Opening stream connection to "+e},We=function(e,n){return"Error on stream connection: "+R(e)+", will continue retrying every "+n+" milliseconds."},Qe=function(e){return'Ignoring unknown config option "'+e+'"'},Ye=function(e,n,t){return'Config option "'+e+'" should be of type '+n+", got "+t+", using default value"},Ze=function(e,n){return'Config option "'+e+'" should be a boolean, got '+n+", converting to boolean"},en=function(e,n,t){return'Config option "'+e+'" was set to '+n+", changing to minimum value of "+t},A=function(e){return"polling for feature flags at "+e},nn=function(e){return'received streaming update for flag "'+e+'"'},tn=function(e){return'received streaming update for flag "'+e+'" but ignored due to version check'},rn=function(e){return'received streaming deletion for flag "'+e+'"'},on=function(e){return'received streaming deletion for flag "'+e+'" but ignored due to version check'},an=function(e){return'enqueueing "'+e+'" event'},un=function(e){return"sending "+e+" events"},q=Object.freeze({__proto__:null,clientInitialized:function(){return"LaunchDarkly client initialized"},clientNotReady:function(){return"LaunchDarkly client is not ready"},eventCapacityExceeded:function(){return"Exceeded event queue capacity. Increase capacity to avoid dropping events."},eventWithoutUser:function(){return"Be sure to call `identify` in the LaunchDarkly client: https://docs.launchdarkly.com/docs/js-sdk-reference#section-analytics-events"},invalidContentType:L,invalidKey:function(){return"Event key must be a string"},localStorageUnavailable:function(){return"localStorage is unavailable"},localStorageUnavailableForUserId:function(){return"localStorage is unavailable, so anonymous user ID cannot be cached"},networkError:N,unknownCustomEventKey:$e,environmentNotFound:I,environmentNotSpecified:He,errorFetchingFlags:Me,userNotSpecified:F,invalidUser:x,bootstrapOldFormat:Ke,bootstrapInvalid:function(){return"LaunchDarkly bootstrap data is not available because the back end could not read the flags."},deprecated:Xe,httpErrorMessage:Ge,httpUnavailable:C,identifyDisabled:function(){return"identify() has no effect here; it must be called on the main client instance"},streamClosing:function(){return"Closing stream connection"},streamConnecting:Be,streamError:We,unknownOption:Qe,wrongOptionType:Ye,wrongOptionTypeBoolean:Ze,optionBelowMinimum:en,debugPolling:A,debugStreamPing:function(){return"received ping message from stream"},debugStreamPut:function(){return"received streaming update for all flags"},debugStreamPatch:nn,debugStreamPatchIgnored:tn,debugStreamDelete:rn,debugStreamDeleteIgnored:on,debugEnqueueingEvent:an,debugPostingEvents:un});function cn(t,r,o,i,a){var u={};function c(){var e="",n=i.getUser();return n&&(e=o||m(JSON.stringify(n))),"ld:"+r+":"+e}return u.loadFlags=function(){return t.get(c()).then(function(e){if(null==e)return null;try{var n=JSON.parse(e);if(n){var t=n.$schema;void 0===t||t<1?n=h(n):delete n.$schema}return n}catch(e){return u.clearFlags().then(function(){return Promise.reject(e)})}}).catch(function(e){return a.warn("localStorage is unavailable"),Promise.reject(e)})},u.saveFlags=function(e){var n=_e({},e,{$schema:1});return t.set(c(),JSON.stringify(n)).catch(function(e){return a.warn("localStorage is unavailable"),Promise.reject(e)})},u.clearFlags=function(){return t.clear(c()).catch(function(e){return a.warn("localStorage is unavailable"),Promise.reject(e)})},u}function sn(d,g,a){var u=g.baseUrl,c=g.useReport,s=g.evaluationReasons,l=g.logger,e={},p={};function f(e,n){if(!d.httpRequest)return new Promise(function(e,n){n(new Te(C()))});var t=n?"REPORT":"GET",r=qe(d,g);n&&(r["Content-Type"]="application/json");var o,i,a,u,c,s,l=p[e];l||(o=function(){delete p[e]},(s={addPromise:function(n,e){i=n,a&&a(),a=e,n.then(function(e){i===n&&(u(e),o())},function(e){i===n&&(c(e),o())})}}).resultPromise=new Promise(function(e,n){u=e,c=n}),l=s,p[e]=l);var f=d.httpRequest(t,e,r,n),v=f.promise.then(function(e){if(200!==e.status)return Promise.reject(404===(n=e).status?new je(I()):new Te(Me(n.statusText||String(n.status))));if(e.header("content-type")&&0===e.header("content-type").lastIndexOf("application/json"))return JSON.parse(e.body);var n,t=L(e.header("content-type")||"");return Promise.reject(new Te(t))},function(e){return Promise.reject(new Te(N(e)))});return l.addPromise(v,function(){f.cancel&&f.cancel()}),l.resultPromise}return e.fetchJSON=function(e){return f(u+e,null)},e.fetchFlagSettings=function(e,n){var t,r,o,i="";return c?(r=[u,"/sdk/evalx/",a,"/user"].join(""),o=JSON.stringify(e)):(t=Ne(JSON.stringify(e)),r=[u,"/sdk/evalx/",a,"/users/",t].join("")),n&&(i="h="+n),s&&(i=i+(i?"&":"")+"withReasons=true"),r=r+(i?"?":"")+i,l.debug(A(r)),f(r,o)},e}function ln(o,i){var e={};return e.validateUser=function(e){if(!e)return Promise.reject(new a(F()));var r=Ie(e);return null!==r.key&&void 0!==r.key?(r.key=r.key.toString(),Promise.resolve(r)):r.anonymous?(o?o.get("ld:$anonUserId").catch(function(){return null}):Promise.resolve(null)).then(function(e){if(e)return r.key=e,r;var n,t=U();return r.key=t,(n=t,o?o.set("ld:$anonUserId",n).catch(function(){i.warn("localStorage is unavailable, so anonymous user ID cannot be cached")}):Promise.resolve()).then(function(){return r})}):Promise.reject(new a(x()))},e}var fn={baseUrl:{default:"https://app.launchdarkly.com"},streamUrl:{default:"https://clientstream.launchdarkly.com"},eventsUrl:{default:"https://events.launchdarkly.com"},sendEvents:{default:!0},streaming:{type:"boolean"},sendLDHeaders:{default:!0},inlineUsersInEvents:{default:!1},allowFrequentDuplicateEvents:{default:!1},sendEventsOnlyForVariation:{default:!1},useReport:{default:!1},evaluationReasons:{default:!1},eventCapacity:{default:100,minimum:1},flushInterval:{default:2e3,minimum:2e3},samplingInterval:{default:0,minimum:0},streamReconnectDelay:{default:1e3,minimum:0},allAttributesPrivate:{default:!1},privateAttributeNames:{default:[]},bootstrap:{type:"string|object"},wrapperName:{type:"string"},wrapperVersion:{type:"string"},stateProvider:{type:"object"}};function vn(e,n){var o,i=["debug","info","warn","error"];o=null!=n?""===n?"":n+" ":"LD: ";var a=0;e&&(a="none"===e?100:i.indexOf(e));var t={};function r(e,n,t){if(a<=e){var r=e<i.length?i[e]:"?";n(o+"["+r+"] "+t)}}return t.debug=function(e){return r(0,console.log,e)},t.info=function(e){return r(1,console.info,e)},t.warn=function(e){return r(2,console.warn,e)},t.error=function(e){return r(3,console.error,e)},t}function _(e,n,t,o,r){var a,i,u,c,s,l,f,v,d,g,p,m,h,y,w,b,k,E,S,O,P,D,j,U,R,T,L,N,I,F,x,C,A,q=t&&t.logger?t.logger:r&&r.logger&&r.logger.default||vn("warn"),_=function(n){var e={},o={};return e.on=function(e,n,t){o[e]=o[e]||[],o[e]=o[e].concat({handler:n,context:t})},e.off=function(e,n,t){if(o[e])for(var r=0;r<o[e].length;r++)o[e][r].handler===n&&o[e][r].context===t&&(o[e]=o[e].slice(0,r).concat(o[e].slice(r+1)))},e.emit=function(e){if(o[e])for(var n=0;n<o[e].length;n++)o[e][n].handler.apply(o[e][n].context,Array.prototype.slice.call(arguments,1))},e.getEvents=function(){return Object.keys(o)},e.getEventListenerCount=function(e){return o[e]?o[e].length:0},e.maybeReportError=function(e){e&&(o.error?this.emit("error",e):(n||console).error(e.message))},e}(q),J=(U=t,R=_,L=_e({logger:{default:T=q}},fn,r),N={all_attributes_private:"allAttributesPrivate",private_attribute_names:"privateAttributeNames",samplingInterval:null},A=_e({},U||{}),C=A,Object.keys(N).forEach(function(e){if(void 0!==C[e]){var n=N[e];T&&T.warn(Xe(e,n)),n&&(void 0===C[n]&&(C[n]=C[e]),delete C[e])}}),x=_e({},A),Object.keys(L).forEach(function(e){void 0!==x[e]&&null!==x[e]||(x[e]=L[e]&&L[e].default)}),I=A=x,F=_e({},I),Object.keys(I).forEach(function(e){var n=I[e];if(null!=n){var t=L[e];if(void 0===t)ae(Qe(e));else{var r=t.type||ue(t.default);if("any"!==r){var o=r.split("|"),i=ue(n);o.indexOf(i)<0?"boolean"===r?(F[e]=!!n,ae(Ze(e,i))):(ae(Ye(e,r,i)),F[e]=t.default):"number"===i&&void 0!==t.minimum&&n<t.minimum&&(ae(en(e,n,t.minimum)),F[e]=t.minimum)}}}}),F),V=J.hash,z=J.sendEvents,$=e,H=(f=o,d=$,g=V,p=(v=J).streamUrl,m=v.logger,h={},y=p+"/eval/"+d,w=v.useReport,b=v.evaluationReasons,k=v.streamReconnectDelay,E=qe(f,v),S=!1,j=D=P=O=null,h.connect=function(e,t){function n(n){j[n]=function(e){S=!1,t[n]&&t[n](e)}}for(var r in D=e,j={},t||{})n(r);re()},h.disconnect=function(){clearTimeout(P),P=null,ie()},h.isConnected=function(){return!!(O&&f.eventSourceIsActive&&f.eventSourceIsActive(O))},h),M=J.eventProcessor||function(e,n,t,r,o){var i,a=3<arguments.length&&void 0!==r?r:null,u={},c=(4<arguments.length&&void 0!==o?o:null)||Ve(e,n.eventsUrl,t,n),s=function(){var e={},a=0,u=0,c={};return e.summarizeEvent=function(e){if("feature"===e.kind){var n=e.key+":"+(null!==e.variation&&void 0!==e.variation?e.variation:"")+":"+(null!==e.version&&void 0!==e.version?e.version:""),t=c[n];t?t.count=t.count+1:c[n]={count:1,key:e.key,variation:e.variation,version:e.version,value:e.value,default:e.default},(0===a||e.creationDate<a)&&(a=e.creationDate),e.creationDate>u&&(u=e.creationDate)}},e.getSummary=function(){var e={},n=!0;for(var t in c){var r=c[t],o=e[r.key];o||(o={default:r.default,counters:[]},e[r.key]=o);var i={value:r.value,count:r.count};void 0!==r.variation&&null!==r.variation&&(i.variation=r.variation),r.version?i.version=r.version:i.unknown=!0,o.counters.push(i),n=!1}return n?null:{startDate:a,endDate:u,features:e}},e.clearSummary=function(){u=a=0,c={}},e}(),l=ze(n),f=n.inlineUsersInEvents,v=n.samplingInterval,d=n.eventCapacity,g=n.flushInterval,p=n.logger,m=[],h=0,y=!1,w=!1;function b(){return 0===v||0===Math.floor(Math.random()*v)}function k(e){m.length<d?(m.push(e),w=!1):w||(w=!0,p.warn("Exceeded event queue capacity. Increase capacity to avoid dropping events."))}return u.enqueue=function(e){if(!y){var n=!1,t=!1;if(s.summarizeEvent(e),"feature"===e.kind?b()&&(n=!!e.trackEvents,t=function(e){return!!e.debugEventsUntilDate&&e.debugEventsUntilDate>h&&e.debugEventsUntilDate>(new Date).getTime()}(e)):n=b(),n&&k(function(e){var n=_e({},e);return f||"identify"===e.kind?n.user=l.filterUser(e.user):(n.userKey=e.user.key,delete n.user),"feature"===e.kind&&(delete n.trackEvents,delete n.debugEventsUntilDate),n}(e)),t){var r=_e({},e,{kind:"debug"});delete r.trackEvents,delete r.debugEventsUntilDate,delete r.variation,k(r)}}},u.flush=function(){if(y)return Promise.resolve();var e=m,n=s.getSummary();return s.clearSummary(),n&&(n.kind="summary",e.push(n)),0===e.length?Promise.resolve():(m=[],p.debug(un(e.length)),c.sendEvents(e).then(function(e){e&&(e.serverTime&&(h=e.serverTime),Le(e.status)||(y=!0),400<=e.status&&xe(function(){a.maybeReportError(new De(Ge(e.status,"event posting","some events were dropped")))}))}))},u.start=function(){i=setTimeout(function e(){u.flush(),i=setTimeout(e,g)},g)},u.stop=function(){clearTimeout(i)},u}(o,J,$,_),K=sn(o,J,$),X={},G={},B=J.streaming,W=!1,Q=!1,Y=!0,Z=J.stateProvider,ee=(s=function(e){Z||e&&ce({kind:"identify",key:e.key,user:e,creationDate:(new Date).getTime()})},{setUser:function(e){(l=Je(e))&&s&&s(Ie(l))},getUser:function(){return l?Ie(l):null}}),ne=ln(o.localStorage,q);function te(e){S||(m.warn(We(e,k)),S=!0),ie(),re(k)}function re(e){P||(e?P=setTimeout(oe,e):oe())}function oe(){var e;P=null;var n="",t={headers:E};if(f.eventSourceFactory){for(var r in null!=g&&(n="h="+g),w?f.eventSourceAllowsReport?(e=y,t.method="REPORT",t.headers["Content-Type"]="application/json",t.body=JSON.stringify(D)):(e=p+"/ping/"+d,n=""):e=y+"/"+Ne(JSON.stringify(D)),b&&(n=n+(n?"&":"")+"withReasons=true"),e=e+(n?"?":"")+n,ie(),m.info(Be(e)),O=f.eventSourceFactory(e,t),j)j.hasOwnProperty(r)&&O.addEventListener(r,j[r]);O.onerror=te}}function ie(){O&&(m.info("Closing stream connection"),O.close(),O=null)}function ae(e){xe(function(){R&&R.maybeReportError(new Re(e))})}function ue(e){if(null===e)return"any";if(void 0!==e){if(Array.isArray(e))return"array";var n=Oe(e);return"boolean"===n||"string"===n||"number"===n||"function"===n?n:"object"}}function ce(e){$&&(Z&&Z.enqueueEvent&&Z.enqueueEvent(e)||(e.user?(Y=!1,!z||Q||o.isDoNotTrack()||(q.debug(an(e.kind)),M.enqueue(e))):Y&&(q.warn("Be sure to call `identify` in the LaunchDarkly client: https://docs.launchdarkly.com/docs/js-sdk-reference#section-analytics-events"),Y=!1)))}function se(e,n,t,r){var o=ee.getUser(),i=new Date,a=n?n.value:null;if(!J.allowFrequentDuplicateEvents){var u=JSON.stringify(a)+(o&&o.key?o.key:"")+e,c=X[u];if(c&&i-c<3e5)return;X[u]=i}var s={kind:"feature",key:e,user:o,value:a,variation:n?n.variationIndex:null,default:t,creationDate:i.getTime()},l=G[e];l&&(s.version=l.flagVersion?l.flagVersion:l.version,s.trackEvents=l.trackEvents,s.debugEventsUntilDate=l.debugEventsUntilDate),(r||l&&l.trackReason)&&n&&(s.reason=n.reason),ce(s)}function le(e,n,t,r){var o;if(G&&G.hasOwnProperty(e)&&G[e]&&!G[e].deleted){var i=G[e];o=fe(i),null!==i.value&&void 0!==i.value||(o.value=n)}else o={value:n,variationIndex:null,reason:{kind:"ERROR",errorKind:"FLAG_NOT_FOUND"}};return t&&se(e,o,n,r),o}function fe(e){return{value:e.value,variationIndex:void 0===e.variation?null:e.variation,reason:e.reason||null}}function ve(){i=!0,ee.getUser()&&H.connect(ee.getUser(),{ping:function(){q.debug("received ping message from stream"),K.fetchFlagSettings(ee.getUser(),V).then(function(e){return ge(e||{})}).catch(function(e){_.maybeReportError(new Te(Me(e)))})},put:function(e){var n=JSON.parse(e.data);q.debug("received streaming update for all flags"),ge(n)},patch:function(e){var n=JSON.parse(e.data),t=G[n.key];if(!t||!t.version||!n.version||t.version<n.version){q.debug(nn(n.key));var r={},o=_e({},n);delete o.key;var i=fe(G[n.key]=o);r[n.key]=t?{previous:t.value,current:i}:{current:i},pe(r)}else q.debug(tn(n.key))},delete:function(e){var n=JSON.parse(e.data);if(!G[n.key]||G[n.key].version<n.version){q.debug(rn(n.key));var t={};G[n.key]&&!G[n.key].deleted&&(t[n.key]={previous:G[n.key].value}),G[n.key]={version:n.version,deleted:!0},pe(t)}else q.debug(on(n.key))}})}function de(){i&&(H.disconnect(),i=!1)}function ge(e){var n={};if(!e)return Promise.resolve();for(var t in G)G.hasOwnProperty(t)&&G[t]&&(e[t]&&!Fe(e[t].value,G[t].value)?n[t]={previous:G[t].value,current:fe(e[t])}:e[t]&&!e[t].deleted||(n[t]={previous:G[t].value}));for(var r in e)e.hasOwnProperty(r)&&e[r]&&(!G[r]||G[r].deleted)&&(n[r]={current:fe(e[r])});return G=Pe({},e),pe(n).catch(function(){})}function pe(o){var e=Object.keys(o);if(0<e.length){var i={};e.forEach(function(e){var n=o[e].current,t=n?n.value:void 0,r=o[e].previous;_.emit("change:"+e,t,r),i[e]=n?{current:t,previous:r}:{previous:r}}),_.emit("change",i),_.emit("internal-change",G),J.sendEventsOnlyForVariation||Z||e.forEach(function(e){se(e,o[e].current)})}return a&&c?c.saveFlags(G).catch(function(){return null}):Promise.resolve()}function me(){var e=B||u&&void 0===B;e&&!i?ve():!e&&i&&de()}function he(e){return"change"===e||"change:"===e.substr(0,"change".length+1)}o.localStorage&&(c=new cn(o.localStorage,$,V,ee,q));var ye=new Promise(function(e){var n=_.on("ready",function(){_.off("ready",n),e()})}),we=new Promise(function(e,n){var t=_.on("initialized",function(){_.off("initialized",t),e()}),r=_.on("failed",function(e){_.off("failed",r),n(e)})});if("string"==typeof J.bootstrap&&"LOCALSTORAGE"===J.bootstrap.toUpperCase()&&(c?a=!0:q.warn("localStorage is unavailable")),"object"===Oe(J.bootstrap)&&(G=function(t){var e=Object.keys(t),r=t.$flagsState;!r&&e.length&&q.warn(Ke()),!1===t.$valid&&q.warn("LaunchDarkly bootstrap data is not available because the back end could not read the flags.");var o={};return e.forEach(function(e){if("$flagsState"!==e&&"$valid"!==e){var n={value:t[e]};r&&r[e]?n=_e(n,r[e]):n.version=0,o[e]=n}}),o}(J.bootstrap)),Z){var be=Z.getInitialState();be?ke(be):Z.on("init",ke),Z.on("update",function(e){e.user&&ee.setUser(e.user),e.flags&&ge(e.flags)})}else(e?ne.validateUser(n).then(function(e){return ee.setUser(e),"object"===Oe(J.bootstrap)?Ee():a?c.loadFlags().catch(function(){return null}).then(function(e){return null==e?(G={},K.fetchFlagSettings(ee.getUser(),V).then(function(e){return ge(e||{})}).then(Ee).catch(function(e){Se(new Te(Me(e)))})):(G=e,xe(Ee),K.fetchFlagSettings(ee.getUser(),V).then(function(e){return ge(e)}).catch(function(e){return _.maybeReportError(e)}))}):K.fetchFlagSettings(ee.getUser(),V).then(function(e){G=e||{},Ee()}).catch(function(e){G={},Se(e)})}):Promise.reject(new je(He()))).catch(function(e){return _.maybeReportError(e)});function ke(e){$=e.environment,ee.setUser(e.user),G=Pe({},e.flags),xe(Ee)}function Ee(){q.info("LaunchDarkly client initialized"),W=!0,me(),_.emit("ready"),_.emit("initialized")}function Se(e){_.maybeReportError(e),_.emit("failed",e),_.emit("ready")}return{client:{waitForInitialization:function(){return we},waitUntilReady:function(){return ye},identify:function(e,n,t){return Q?Ce(Promise.resolve({}),t):Z?(q.warn("identify() has no effect here; it must be called on the main client instance"),Ce(Promise.resolve(Ae(G)),t)):Ce((a&&c?c.clearFlags():Promise.resolve()).then(function(){return ne.validateUser(e)}).then(function(t){return K.fetchFlagSettings(t,n).then(function(e){var n=Ae(e);return ee.setUser(t),e?ge(e).then(function(){return n}):n})}).then(function(e){return i&&ve(),e}).catch(function(e){return _.maybeReportError(e),Promise.reject(e)}),t)},getUser:function(){return ee.getUser()},variation:function(e,n){return le(e,n,!0,!1).value},variationDetail:function(e,n){return le(e,n,!0,!0)},track:function(e,n,t){if("string"==typeof e){o.customEventFilter&&!o.customEventFilter(e)&&q.warn($e(e));var r={kind:"custom",key:e,user:ee.getUser(),url:o.getCurrentUrl(),creationDate:(new Date).getTime()};null!=n&&(r.data=n),null!=t&&(r.metricValue=t),ce(r)}else _.maybeReportError(new Ue($e(e)))},on:function(e,n,t){he(e)?(u=!0,W&&me(),_.on(e,n,t)):_.on.apply(_,arguments)},off:function(e){if(_.off.apply(_,arguments),he(e)){var n=!1;_.getEvents().forEach(function(e){he(e)&&0<_.getEventListenerCount(e)&&(n=!0)}),n||(u=!1,i&&void 0===B&&de())}},setStreaming:function(e){var n=null===e?void 0:e;n!==B&&(B=n,me())},flush:function(e){return Ce(z?M.flush():Promise.resolve(),e)},allFlags:function(){var e={};if(!G)return e;for(var n in G)G.hasOwnProperty(n)&&(e[n]=le(n,null,!J.sendEventsOnlyForVariation).value);return e},close:function(e){if(Q)return Ce(Promise.resolve(),e);function n(){Q=!0,G={}}return Ce(Promise.resolve().then(function(){if(de(),z)return M.stop(),M.flush()}).then(n).catch(n),e)}},options:J,emitter:_,ident:ee,logger:q,requestor:K,start:function(){z&&M.start()},enqueueEvent:ce,getFlagsInternal:function(){return G},getEnvironmentId:function(){return $},internalChangeEventName:"internal-change"}}function J(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})),t.push.apply(t,r)}return t}function V(o){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?J(i,!0).forEach(function(e){var n,t,r;n=o,r=i[t=e],t in n?Object.defineProperty(n,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):n[t]=r}):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(i)):J(i).forEach(function(e){Object.defineProperty(o,e,Object.getOwnPropertyDescriptor(i,e))})}return o}var z={promise:Promise.resolve({status:200,header:function(){return null},body:null})};function $(e,n,t,r,o){if(o&&!function(){var e=window.navigator&&window.navigator.userAgent;if(e){var n=e.match(/Chrom(e|ium)\/([0-9]+)\./);if(n)return parseInt(n[2],10)<73}return!0}())return z;var i=new window.XMLHttpRequest;for(var a in i.open(e,n,!o),t||{})t.hasOwnProperty(a)&&i.setRequestHeader(a,t[a]);if(o)return i.send(r),z;var u;return{promise:new Promise(function(e,n){i.addEventListener("load",function(){u||e({status:i.status,header:function(e){return i.getResponseHeader(e)},body:i.responseText})}),i.addEventListener("error",function(){u||n(new Error)}),i.send(r)}),cancel:function(){u=!0,i.abort()}}}var H=/[|\\{}()[\]^$+*?.]/g,M=function(e){if("string"!=typeof e)throw new TypeError("Expected a string");return e.replace(H,"\\$&")};function K(e,n,t,r){var o,i,a=n.replace(t,"").replace(r,"");switch(e.kind){case"exact":i=n,o=new RegExp("^"+M(e.url)+"/?$");break;case"canonical":i=a,o=new RegExp("^"+M(e.url)+"/?$");break;case"substring":i=a,o=new RegExp(".*"+M(e.substring)+".*$");break;case"regex":i=a,o=new RegExp(e.pattern);break;default:return!1}return o.test(i)}function X(e,r){for(var n={},t=null,o=[],i=0;i<e.length;i++)for(var a=e[i],u=a.urls||[],c=0;c<u.length;c++)if(K(u[c],window.location.href,window.location.search,window.location.hash)){"pageview"===a.kind?r("pageview",a):(o.push(a),r("click_pageview",a));break}return 0<o.length&&(t=function(e){for(var n=function(e,n){for(var t=[],r=0;r<n.length;r++)for(var o=e.target,i=n[r],a=i.selector,u=document.querySelectorAll(a);o&&0<u.length;){for(var c=0;c<u.length;c++)o===u[c]&&t.push(i);o=o.parentNode}return t}(e,o),t=0;t<n.length;t++)r("click",n[t])},document.addEventListener("click",t)),n.dispose=function(){document.removeEventListener("click",t)},n}var G=300;function B(r,n){var t,o,e={};function i(){o&&o.dispose(),t&&t.length&&(o=X(t,a))}function a(e,n){var t={kind:e,key:n.key,data:null,url:window.location.href,user:r.ident.getUser(),creationDate:(new Date).getTime()};return"click"===e&&(t.selector=n.selector),r.enqueueEvent(t)}function u(e,n){var t,r=window.location.href;function o(){(t=window.location.href)!==r&&(r=t,n())}!function e(n,t){n(),setTimeout(function(){e(n,t)},t)}(o,e),window.history&&window.history.pushState?window.addEventListener("popstate",o):window.addEventListener("hashchange",o)}return e.goalKeyExists=function(e){if(!t)return!0;for(var n=0;n<t.length;n++)if("custom"===t[n].kind&&t[n].key===e)return!0;return!1},r.requestor.fetchJSON("/sdk/goals/"+r.getEnvironmentId()).then(function(e){e&&0<e.length&&(o=X(t=e,a),u(G,i)),n()}).catch(function(e){r.emitter.maybeReportError(new c.LDUnexpectedResponseError((e&&e.message,e.message))),n()}),e}var W="goalsReady",Q={fetchGoals:{default:!0},hash:{type:"string"},eventUrlTransformer:{type:"function"}};function Y(e,n){var t=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},r=function(e){var n,i={synchronousFlush:!1};window.XMLHttpRequest&&(i.httpRequest=function(e,n,t,r){var o=i.synchronousFlush;return i.synchronousFlush=!1,$(e,n,t,r,o)}),i.httpAllowsPost=function(){return void 0===n&&(n=!!window.XMLHttpRequest&&"withCredentials"in new window.XMLHttpRequest),n},i.httpFallbackPing=function(e){(new window.Image).src=e};var r,t=e&&e.eventUrlTransformer;i.getCurrentUrl=function(){return t?t(window.location.href):window.location.href},i.isDoNotTrack=function(){var e;return 1===(e=window.navigator&&void 0!==window.navigator.doNotTrack?window.navigator.doNotTrack:window.navigator&&void 0!==window.navigator.msDoNotTrack?window.navigator.msDoNotTrack:window.doNotTrack)||!0===e||"1"===e||"yes"===e};try{window.localStorage&&(i.localStorage={get:function(n){return new Promise(function(e){e(window.localStorage.getItem(n))})},set:function(n,t){return new Promise(function(e){window.localStorage.setItem(n,t),e()})},clear:function(n){return new Promise(function(e){window.localStorage.removeItem(n),e()})}})}catch(e){i.localStorage=null}var o=e&&e.useReport;if(r=o&&"function"==typeof window.EventSourcePolyfill&&window.EventSourcePolyfill.supportedOptions&&window.EventSourcePolyfill.supportedOptions.method?(i.eventSourceAllowsReport=!0,window.EventSourcePolyfill):(i.eventSourceAllowsReport=!1,window.EventSource),window.EventSource){i.eventSourceFactory=function(e,n){var t=V({},{heartbeatTimeout:3e5,silentTimeout:3e5,skipDefaultHeaders:!0},{},n);return new r(e,t)},i.eventSourceIsActive=function(e){return e.readyState===window.EventSource.OPEN||e.readyState===window.EventSource.CONNECTING}}return i.userAgent="JSClient",i}(t),o=_(e,n,t,r,Q),i=o.client,a=o.options,u=o.emitter,c=new Promise(function(e){var n=u.on(W,function(){u.off(W,n),e()})});if(i.waitUntilGoalsReady=function(){return c},a.fetchGoals){var s=B(o,function(){return u.emit(W)});r.customEventFilter=s.goalKeyExists}else u.emit(W);"complete"!==document.readyState?window.addEventListener("load",o.start):o.start();function l(){r.synchronousFlush=!0,i.flush().catch(function(){}),r.synchronousFlush=!1}return window.addEventListener("beforeunload",l),window.addEventListener("unload",l),i}var Z=vn;var ee={initialize:function(e,n){var t=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};return console&&console.warn&&console.warn(q.deprecated("default export","named LDClient export")),Y(e,n,t)},version:"2.16.3"};e.createConsoleLogger=Z,e.default=ee,e.initialize=Y,e.version="2.16.3",Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e=e||self).LDClient={})}(this,function(e){"use strict";function W(e){return(W="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function n(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})),t.push.apply(t,r)}return t}function Q(o){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?n(i,!0).forEach(function(e){var n,t,r;n=o,r=i[t=e],t in n?Object.defineProperty(n,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):n[t]=r}):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(i)):n(i).forEach(function(e){Object.defineProperty(o,e,Object.getOwnPropertyDescriptor(i,e))})}return o}function t(e){function n(e,n){Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.message=e,this.code=n}return(n.prototype=new Error).name=e,n.prototype.constructor=n}var Y=t("LaunchDarklyUnexpectedResponseError"),Z=t("LaunchDarklyInvalidEnvironmentIdError"),a=t("LaunchDarklyInvalidUserError"),ee=t("LaunchDarklyInvalidEventKeyError"),d=t("LaunchDarklyInvalidArgumentError"),ne=t("LaunchDarklyFlagFetchError");function te(e){return!(400<=e&&e<500)||400===e||408===e||429===e}for(var s=Object.freeze({__proto__:null,LDUnexpectedResponseError:Y,LDInvalidEnvironmentIdError:Z,LDInvalidUserError:a,LDInvalidEventKeyError:ee,LDInvalidArgumentError:d,LDFlagFetchError:ne,isHttpErrorRecoverable:te}),r=function(e){for(var n,t=e.length,r=t%3,o=[],i=0,a=t-r;i<a;i+=16383)o.push(f(e,i,a<i+16383?a:i+16383));return 1==r?(n=e[t-1],o.push(u[n>>2]+u[n<<4&63]+"==")):2==r&&(n=(e[t-2]<<8)+e[t-1],o.push(u[n>>10]+u[n>>4&63]+u[n<<2&63]+"=")),o.join("")},u=[],o=[],i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",c=0,l=i.length;c<l;++c)u[c]=i[c],o[i.charCodeAt(c)]=c;function f(e,n,t){for(var r,o,i=[],a=n;a<t;a+=3)r=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),i.push(u[(o=r)>>18&63]+u[o>>12&63]+u[o>>6&63]+u[63&o]);return i.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63;var g=Array.isArray,p=Object.keys,m=Object.prototype.hasOwnProperty,v=["key","secondary","ip","country","email","firstName","lastName","avatar","name"];function h(e){var n=unescape(encodeURIComponent(e));return r(function(e){for(var n=[],t=0;t<e.length;t++)n.push(e.charCodeAt(t));return n}(n))}function D(e){return h(e).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function re(e){return JSON.parse(JSON.stringify(e))}function oe(e,n){return function e(n,t){if(n===t)return!0;if(n&&t&&"object"==typeof n&&"object"==typeof t){var r,o,i,a=g(n),u=g(t);if(a&&u){if((o=n.length)!=t.length)return!1;for(r=o;0!=r--;)if(!e(n[r],t[r]))return!1;return!0}if(a!=u)return!1;var s=n instanceof Date,c=t instanceof Date;if(s!=c)return!1;if(s&&c)return n.getTime()==t.getTime();var l=n instanceof RegExp,f=t instanceof RegExp;if(l!=f)return!1;if(l&&f)return n.toString()==t.toString();var v=p(n);if((o=v.length)!==p(t).length)return!1;for(r=o;0!=r--;)if(!m.call(t,v[r]))return!1;for(r=o;0!=r--;)if(!e(n[i=v[r]],t[i]))return!1;return!0}return n!=n&&t!=t}(e,n)}function ie(e){setTimeout(e,0)}function ae(e,n){var t=e.then(function(e){return n&&setTimeout(function(){n(null,e)},0),e},function(e){if(!n)return Promise.reject(e);setTimeout(function(){n(e,null)},0)});return n?void 0:t}function y(e){var n={};for(var t in e)e.hasOwnProperty(t)&&(n[t]={value:e[t],version:0});return n}function ue(e){var n={};for(var t in e)e.hasOwnProperty(t)&&(n[t]=e[t].value);return n}function w(e,n){for(var t,r=n.slice(0),o=[],i=e;0<r.length;){for(t=[];0<i;){var a=r.shift();if(!a)break;(i-=D(JSON.stringify(a)).length)<0&&0<t.length?r.unshift(a):t.push(a)}i=e,o.push(t)}return o}function b(e){var n=e.version||"3.2.2";return e.userAgent+"/"+n}function P(e,n){if(n&&!n.sendLDHeaders)return{};var t={"X-LaunchDarkly-User-Agent":b(e)};return n&&n.wrapperName&&(t["X-LaunchDarkly-Wrapper"]=n.wrapperVersion?n.wrapperName+"/"+n.wrapperVersion:n.wrapperName),t}function se(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];return n.reduce(function(e,n){return Q({},e,{},n)},{})}function ce(e){if(!e)return e;var n;for(var t in v){var r=v[t],o=e[r];void 0!==o&&"string"!=typeof o&&((n=n||Q({},e))[r]=String(o))}return n||e}Object.freeze({__proto__:null,btoa:h,base64URLEncode:D,clone:re,deepEquals:oe,onNextTick:ie,wrapPromiseCallback:ae,transformValuesToVersionedValues:y,transformVersionedValuesToValues:ue,chunkUserEventsForUrl:w,getLDUserAgentString:b,getLDHeaders:P,extend:se,sanitizeUser:ce});for(var E,k=(E=void 0,function(e){var n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(n){var t=new Uint8Array(16);e.exports=function(){return n(t),t}}else{var r=new Array(16);e.exports=function(){for(var e,n=0;n<16;n++)0==(3&n)&&(e=4294967296*Math.random()),r[n]=e>>>((3&n)<<3)&255;return r}}}(E={exports:{}}),E.exports),S=[],O=0;O<256;++O)S[O]=(O+256).toString(16).substr(1);var U,R,I=0,j=0,T=function(e,n,t){var r=n&&t||0,o=n||[],i=(e=e||{}).node||U,a=void 0!==e.clockseq?e.clockseq:R;if(null==i||null==a){var u=k();null==i&&(i=U=[1|u[0],u[1],u[2],u[3],u[4],u[5]]),null==a&&(a=R=16383&(u[6]<<8|u[7]))}var s=void 0!==e.msecs?e.msecs:(new Date).getTime(),c=void 0!==e.nsecs?e.nsecs:j+1,l=s-I+(c-j)/1e4;if(l<0&&void 0===e.clockseq&&(a=a+1&16383),(l<0||I<s)&&void 0===e.nsecs&&(c=0),1e4<=c)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");I=s,R=a;var f=(1e4*(268435455&(s+=122192928e5))+(j=c))%4294967296;o[r++]=f>>>24&255,o[r++]=f>>>16&255,o[r++]=f>>>8&255,o[r++]=255&f;var v=s/4294967296*1e4&268435455;o[r++]=v>>>8&255,o[r++]=255&v,o[r++]=v>>>24&15|16,o[r++]=v>>>16&255,o[r++]=a>>>8|128,o[r++]=255&a;for(var d=0;d<6;++d)o[r+d]=i[d];return n||function(e,n){var t=n||0,r=S;return[r[e[t++]],r[e[t++]],r[e[t++]],r[e[t++]],"-",r[e[t++]],r[e[t++]],"-",r[e[t++]],r[e[t++]],"-",r[e[t++]],r[e[t++]],"-",r[e[t++]],r[e[t++]],r[e[t++]],r[e[t++]],r[e[t++]],r[e[t++]]].join("")}(o)};function le(u,e,n){var t="/a/"+e+".gif",s=se({"Content-Type":"application/json"},P(u,n)),c=u.httpFallbackPing,l={sendChunk:function(e,r,o,n){var i=JSON.stringify(e),a=o?null:T();return n?function n(t){var e=o?s:se({},s,{"X-LaunchDarkly-Event-Schema":"3","X-LaunchDarkly-Payload-ID":a});return u.httpRequest("POST",r,e,i).promise.then(function(e){if(e)return 400<=e.status&&te(e.status)&&t?n(!1):function(e){var n={status:e.status},t=e.header("date");if(t){var r=Date.parse(t);r&&(n.serverTime=r)}return n}(e)}).catch(function(){return t?n(!1):Promise.reject()})}(!0).catch(function(){}):(c&&c(r+t+"?d="+D(i)),Promise.resolve())},sendEvents:function(e,n,t){if(!u.httpRequest)return Promise.resolve();var r,o=u.httpAllowsPost();r=o?[e]:w(2e3-n.length,e);for(var i=[],a=0;a<r.length;a++)i.push(l.sendChunk(r[a],n,t,o));return Promise.all(i)}};return l}function fe(e){var n={},s=e.allAttributesPrivate,c=e.privateAttributeNames||[],l={key:!0,custom:!0,anonymous:!0},f={key:!0,secondary:!0,ip:!0,country:!0,email:!0,firstName:!0,lastName:!0,avatar:!0,name:!0,anonymous:!0,custom:!0};return n.filterUser=function(e){if(!e)return null;function n(o,i){return Object.keys(o).reduce(function(e,n){var t,r=e;return i(n)&&(l[t=n]||!s&&-1===a.indexOf(t)&&-1===c.indexOf(t)?r[0][n]=o[n]:r[1][n]=!0),r},[{},{}])}var a=e.privateAttributeNames||[],t=n(e,function(e){return f[e]}),r=t[0],o=t[1];if(e.custom){var i=n(e.custom,function(){return!0});r.custom=i[0],o=se({},o,i[1])}var u=Object.keys(o);return u.length&&(u.sort(),r.privateAttrs=u),r},n}function N(e){return e&&e.message?e.message:"string"==typeof e||e instanceof String?e:JSON.stringify(e)}var L=" Please see https://docs.launchdarkly.com/docs/js-sdk-reference#section-initializing-the-client for instructions on SDK initialization.",F=function(e){return'Expected application/json content type but got "'+e+'"'},C=function(e){return"network error"+(e?" ("+e+")":"")},ve=function(e){return'Custom event "'+e+'" does not exist'},x=function(){return"Environment not found. Double check that you specified a valid environment/client-side ID."+L},de=function(){return"No environment/client-side ID was specified."+L},ge=function(e){return"Error fetching flag settings: "+N(e)},A=function(){return"No user specified."+L},q=function(){return"Invalid user specified."+L},pe=function(){return"LaunchDarkly client was initialized with bootstrap data that did not include flag metadata. Events may not be sent correctly."+L},_=function(e,n){return n?'"'+e+'" is deprecated, please use "'+n+'"':'"'+e+'" is deprecated'},me=function(e,n,t){return"Received error "+e+(401===e?" (invalid SDK key)":"")+" for "+n+" - "+(te(e)?t:"giving up permanently")},V=function(){return"Cannot make HTTP requests in this environment."+L},J=function(e){return"Opening stream connection to "+e},z=function(e,n){return"Error on stream connection: "+N(e)+", will continue retrying every "+n+" milliseconds."},M=function(e){return'Ignoring unknown config option "'+e+'"'},$=function(e,n,t){return'Config option "'+e+'" should be of type '+n+", got "+t+", using default value"},H=function(e,n){return'Config option "'+e+'" should be a boolean, got '+n+", converting to boolean"},K=function(e,n,t){return'Config option "'+e+'" was set to '+n+", changing to minimum value of "+t},B=function(e){return"polling for feature flags at "+e},he=function(e){return'received streaming update for flag "'+e+'"'},ye=function(e){return'received streaming update for flag "'+e+'" but ignored due to version check'},we=function(e){return'received streaming deletion for flag "'+e+'"'},be=function(e){return'received streaming deletion for flag "'+e+'" but ignored due to version check'},Ee=function(e){return'enqueueing "'+e+'" event'},ke=function(e){return"sending "+e+" events"},G=Object.freeze({__proto__:null,clientInitialized:function(){return"LaunchDarkly client initialized"},clientNotReady:function(){return"LaunchDarkly client is not ready"},eventCapacityExceeded:function(){return"Exceeded event queue capacity. Increase capacity to avoid dropping events."},eventWithoutUser:function(){return"Be sure to call `identify` in the LaunchDarkly client: https://docs.launchdarkly.com/docs/js-sdk-reference#section-analytics-events"},invalidContentType:F,invalidKey:function(){return"Event key must be a string"},localStorageUnavailable:function(){return"localStorage is unavailable"},localStorageUnavailableForUserId:function(){return"localStorage is unavailable, so anonymous user ID cannot be cached"},networkError:C,unknownCustomEventKey:ve,environmentNotFound:x,environmentNotSpecified:de,errorFetchingFlags:ge,userNotSpecified:A,invalidUser:q,bootstrapOldFormat:pe,bootstrapInvalid:function(){return"LaunchDarkly bootstrap data is not available because the back end could not read the flags."},deprecated:_,httpErrorMessage:me,httpUnavailable:V,identifyDisabled:function(){return"identify() has no effect here; it must be called on the main client instance"},streamClosing:function(){return"Closing stream connection"},streamConnecting:J,streamError:z,unknownOption:M,wrongOptionType:$,wrongOptionTypeBoolean:H,optionBelowMinimum:K,debugPolling:B,debugStreamPing:function(){return"received ping message from stream"},debugStreamPut:function(){return"received streaming update for all flags"},debugStreamPatch:he,debugStreamPatchIgnored:ye,debugStreamDelete:we,debugStreamDeleteIgnored:be,debugEnqueueingEvent:Ee,debugPostingEvents:ke,debugPostingDiagnosticEvent:function(e){return"sending diagnostic event ("+e.kind+")"}});function Se(t,r,o,i,a){var u={};function s(){var e="",n=i.getUser();return n&&(e=o||h(JSON.stringify(n))),"ld:"+r+":"+e}return u.loadFlags=function(){return t.get(s()).then(function(e){if(null==e)return null;try{var n=JSON.parse(e);if(n){var t=n.$schema;void 0===t||t<1?n=y(n):delete n.$schema}return n}catch(e){return u.clearFlags().then(function(){return Promise.reject(e)})}}).catch(function(e){return a.warn("localStorage is unavailable"),Promise.reject(e)})},u.saveFlags=function(e){var n=se({},e,{$schema:1});return t.set(s(),JSON.stringify(n)).catch(function(e){return a.warn("localStorage is unavailable"),Promise.reject(e)})},u.clearFlags=function(){return t.clear(s()).catch(function(e){return a.warn("localStorage is unavailable"),Promise.reject(e)})},u}function De(o,e,i,n){var a,u=e.streamUrl,s=e.logger,t={},c=u+"/eval/"+i,l=e.useReport,f=e.evaluationReasons,r=e.streamReconnectDelay,v=P(o,e),d=!1,g=null,p=null,m=null,h=null,y=null;function w(e){d||(s.warn(z(e,r)),d=!0),S(!1),k(),b(r)}function b(e){p||(e?p=setTimeout(E,e):E())}function E(){var e;p=null;var n="",t={headers:v};if(o.eventSourceFactory){for(var r in null!=h&&(n="h="+h),l?o.eventSourceAllowsReport?(e=c,t.method="REPORT",t.headers["Content-Type"]="application/json",t.body=JSON.stringify(m)):(e=u+"/ping/"+i,n=""):e=c+"/"+D(JSON.stringify(m)),f&&(n=n+(n?"&":"")+"withReasons=true"),e=e+(n?"?":"")+n,k(),s.info(J(e)),a=(new Date).getTime(),g=o.eventSourceFactory(e,t),y)y.hasOwnProperty(r)&&g.addEventListener(r,y[r]);g.onerror=w}}function k(){g&&(s.info("Closing stream connection"),g.close(),g=null)}function S(e){a&&n&&n.recordStreamInit(a,!e,(new Date).getTime()-a),a=null}return t.connect=function(e,n,t){m=e,h=n,y={};function r(n){y[n]=function(e){S(!(d=!1)),t[n]&&t[n](e)}}for(var o in t||{})r(o);b()},t.disconnect=function(){clearTimeout(p),p=null,k()},t.isConnected=function(){return!!(g&&o.eventSourceIsActive&&o.eventSourceIsActive(g))},t}function Pe(d,g,a){var u=g.baseUrl,s=g.useReport,c=g.evaluationReasons,l=g.logger,e={},p={};function f(e,n){if(!d.httpRequest)return new Promise(function(e,n){n(new ne(V()))});var t=n?"REPORT":"GET",r=P(d,g);n&&(r["Content-Type"]="application/json");var o,i,a,u,s,c,l=p[e];l||(o=function(){delete p[e]},(c={addPromise:function(n,e){i=n,a&&a(),a=e,n.then(function(e){i===n&&(u(e),o())},function(e){i===n&&(s(e),o())})}}).resultPromise=new Promise(function(e,n){u=e,s=n}),l=c,p[e]=l);var f=d.httpRequest(t,e,r,n),v=f.promise.then(function(e){if(200!==e.status)return Promise.reject(404===(n=e).status?new Z(x()):new ne(ge(n.statusText||String(n.status))));if(e.header("content-type")&&0===e.header("content-type").lastIndexOf("application/json"))return JSON.parse(e.body);var n,t=F(e.header("content-type")||"");return Promise.reject(new ne(t))},function(e){return Promise.reject(new ne(C(e)))});return l.addPromise(v,function(){f.cancel&&f.cancel()}),l.resultPromise}return e.fetchJSON=function(e){return f(u+e,null)},e.fetchFlagSettings=function(e,n){var t,r,o,i="";return s?(r=[u,"/sdk/evalx/",a,"/user"].join(""),o=JSON.stringify(e)):(t=D(JSON.stringify(e)),r=[u,"/sdk/evalx/",a,"/users/",t].join("")),n&&(i="h="+n),c&&(i=i+(i?"&":"")+"withReasons=true"),r=r+(i?"?":"")+i,l.debug(B(r)),f(r,o)},e}function Oe(o,i){var e={};return e.validateUser=function(e){if(!e)return Promise.reject(new a(A()));var r=re(e);return null!==r.key&&void 0!==r.key?(r.key=r.key.toString(),Promise.resolve(r)):r.anonymous?(o?o.get("ld:$anonUserId").catch(function(){return null}):Promise.resolve(null)).then(function(e){if(e)return r.key=e,r;var n,t=T();return r.key=t,(n=t,o?o.set("ld:$anonUserId",n).catch(function(){i.warn("localStorage is unavailable, so anonymous user ID cannot be cached")}):Promise.resolve()).then(function(){return r})}):Promise.reject(new a(q()))},e}var X={baseUrl:{default:"https://app.launchdarkly.com"},streamUrl:{default:"https://clientstream.launchdarkly.com"},eventsUrl:{default:"https://events.launchdarkly.com"},sendEvents:{default:!0},streaming:{type:"boolean"},sendLDHeaders:{default:!0},inlineUsersInEvents:{default:!1},allowFrequentDuplicateEvents:{default:!1},sendEventsOnlyForVariation:{default:!1},useReport:{default:!1},evaluationReasons:{default:!1},eventCapacity:{default:100,minimum:1},flushInterval:{default:2e3,minimum:2e3},samplingInterval:{default:0,minimum:0},streamReconnectDelay:{default:1e3,minimum:0},allAttributesPrivate:{default:!1},privateAttributeNames:{default:[]},bootstrap:{type:"string|object"},diagnosticRecordingInterval:{default:9e5,minimum:2e3},diagnosticOptOut:{default:!1},wrapperName:{type:"string"},wrapperVersion:{type:"string"},stateProvider:{type:"object"}};function Ue(e,n,t,r){var a=se({logger:{default:r}},X,t),o={all_attributes_private:"allAttributesPrivate",private_attribute_names:"privateAttributeNames",samplingInterval:null};function u(e){ie(function(){n&&n.maybeReportError(new d(e))})}var s,c,i,l,f=se({},e||{});return l=f,Object.keys(o).forEach(function(e){if(void 0!==l[e]){var n=o[e];r&&r.warn(_(e,n)),n&&(void 0===l[n]&&(l[n]=l[e]),delete l[e])}}),i=se({},f),Object.keys(a).forEach(function(e){void 0!==i[e]&&null!==i[e]||(i[e]=a[e]&&a[e].default)}),s=f=i,c=se({},s),Object.keys(s).forEach(function(e){var n=s[e];if(null!=n){var t=a[e];if(void 0===t)u(M(e));else{var r=t.type||v(t.default);if("any"!==r){var o=r.split("|"),i=v(n);o.indexOf(i)<0?"boolean"===r?(c[e]=!!n,u(H(e,i))):(u($(e,r,i)),c[e]=t.default):"number"===i&&void 0!==t.minimum&&n<t.minimum&&(u(K(e,n,t.minimum)),c[e]=t.minimum)}}}}),c;function v(e){if(null===e)return"any";if(void 0!==e){if(Array.isArray(e))return"array";var n=W(e);return"boolean"===n||"string"===n||"number"===n||"function"===n?n:"object"}}}var Re=Object.freeze({__proto__:null,baseOptionDefs:X,validate:Ue}).baseOptionDefs,Ie=function(e){var n={diagnosticId:T()};return e&&(n.sdkKeySuffix=6<e.length?e.substring(e.length-6):e),n},je=function(e){var n,t,r,o;function i(e){n=e,r=t=0,o=[]}return i(e),{getProps:function(){return{dataSinceDate:n,droppedEvents:t,eventsInLastBatch:r,streamInits:o}},setProps:function(e){n=e.dataSinceDate,t=e.droppedEvents||0,r=e.eventsInLastBatch||0,o=e.streamInits||[]},incrementDroppedEvents:function(){t++},setEventsInLastBatch:function(e){r=e},recordStreamInit:function(e,n,t){var r={timestamp:e,failed:n,durationMillis:t};o.push(r)},reset:i}},Te=function(r,e,n,t,o,i){var a,u,s=!!r.diagnosticUseCombinedEvent,c="ld:"+t+":$diagnostics",l=o.eventsUrl+"/events/diagnostic/"+t,f=o.diagnosticRecordingInterval,v=e,d=!!o.streaming,g={};function p(){return{sdk:function(){var e=Q({},r.diagnosticSdkData);return o.wrapperName&&(e.wrapperName=o.wrapperName),o.wrapperVersion&&(e.wrapperVersion=o.wrapperVersion),e}(),configuration:(e={customBaseURI:o.baseUrl!==Re.baseUrl.default,customStreamURI:o.streamUrl!==Re.streamUrl.default,customEventsURI:o.eventsUrl!==Re.eventsUrl.default,eventsCapacity:o.eventCapacity,eventsFlushIntervalMillis:o.flushInterval,reconnectTimeMillis:o.streamReconnectDelay,streamingDisabled:!d,allAttributesPrivate:!!o.allAttributesPrivate,inlineUsersInEvents:!!o.inlineUsersInEvents,diagnosticRecordingIntervalMillis:o.diagnosticRecordingInterval,usingSecureMode:!!o.hash,bootstrapMode:!!o.bootstrap,fetchGoalsDisabled:!o.fetchGoals,allowFrequentDuplicateEvents:!!o.allowFrequentDuplicateEvents,sendEventsOnlyForVariation:!!o.sendEventsOnlyForVariation},e),platform:r.diagnosticPlatformData};var e}function m(e){o.logger&&o.logger.debug(G.debugPostingDiagnosticEvent(e)),n.sendEvents(e,l,!0).then(function(){}).catch(function(){})}function h(){var e,n;m((e=(new Date).getTime(),n=Q({kind:s?"diagnostic-combined":"diagnostic",id:i,creationDate:e},v.getProps()),s&&(n=Q({},n,{},p())),v.reset(e),n)),u=setTimeout(h,f),a=(new Date).getTime(),s&&function(){if(r.localStorage){var e=Q({},v.getProps());r.localStorage.set(c,JSON.stringify(e),function(){})}}()}return g.start=function(){s?function(t){if(!r.localStorage)return t(!1);r.localStorage.get(c).then(function(e){if(e)try{var n=JSON.parse(e);v.setProps(n),a=n.dataSinceDate}catch(e){}t(!0)}).catch(function(){t(!1)})}(function(e){if(e){var n=(a||0)+f,t=(new Date).getTime();n<=t?h():u=setTimeout(h,n-t)}else 0===Math.floor(4*Math.random())?h():u=setTimeout(h,f)}):(m(Q({kind:"diagnostic-init",id:i,creationDate:v.getProps().dataSinceDate},p())),u=setTimeout(h,f))},g.stop=function(){u&&clearTimeout(u)},g.setStreaming=function(e){d=e},g};function Ne(e,n){var o,i=["debug","info","warn","error"];o=null!=n?""===n?"":n+" ":"LD: ";var a=0;e&&(a="none"===e?100:i.indexOf(e));var t={};function r(e,n,t){if(a<=e){var r=e<i.length?i[e]:"?";n(o+"["+r+"] "+t)}}return t.debug=function(e){return r(0,console.log,e)},t.info=function(e){return r(1,console.info,e)},t.warn=function(e){return r(2,console.warn,e)},t.error=function(e){return r(3,console.error,e)},t}function Le(e,n,t,o,r){var a=t&&t.logger?t.logger:r&&r.logger&&r.logger.default||Ne("warn"),u=function(n){var e={},o={};return e.on=function(e,n,t){o[e]=o[e]||[],o[e]=o[e].concat({handler:n,context:t})},e.off=function(e,n,t){if(o[e])for(var r=0;r<o[e].length;r++)o[e][r].handler===n&&o[e][r].context===t&&(o[e]=o[e].slice(0,r).concat(o[e].slice(r+1)))},e.emit=function(e){if(o[e])for(var n=0;n<o[e].length;n++)o[e][n].handler.apply(o[e][n].context,Array.prototype.slice.call(arguments,1))},e.getEvents=function(){return Object.keys(o)},e.getEventListenerCount=function(e){return o[e]?o[e].length:0},e.maybeReportError=function(e){e&&(o.error?this.emit("error",e):(n||console).error(e.message))},e}(a),f=Ue(t,u,r,a),i=f.sendEvents,s=e,c=f.hash,l=le(o,s,f),v=f.sendEvents&&!f.diagnosticOptOut,d=v?Ie(s):null,g=v?je((new Date).getTime()):null,p=v?Te(o,g,l,s,f,d):null;p&&p.start();var m,h,y,w,b,E,k=De(o,f,s,g),S=f.eventProcessor||function(e,n,t,r,o,i){var a,u=3<arguments.length&&void 0!==r?r:null,s=4<arguments.length&&void 0!==o?o:null,c={},l=(5<arguments.length&&void 0!==i?i:null)||le(e,t,n),f=n.eventsUrl+"/events/bulk/"+t,v=function(){var e={},a=0,u=0,s={};return e.summarizeEvent=function(e){if("feature"===e.kind){var n=e.key+":"+(null!==e.variation&&void 0!==e.variation?e.variation:"")+":"+(null!==e.version&&void 0!==e.version?e.version:""),t=s[n];t?t.count=t.count+1:s[n]={count:1,key:e.key,variation:e.variation,version:e.version,value:e.value,default:e.default},(0===a||e.creationDate<a)&&(a=e.creationDate),e.creationDate>u&&(u=e.creationDate)}},e.getSummary=function(){var e={},n=!0;for(var t in s){var r=s[t],o=e[r.key];o||(o={default:r.default,counters:[]},e[r.key]=o);var i={value:r.value,count:r.count};void 0!==r.variation&&null!==r.variation&&(i.variation=r.variation),r.version?i.version=r.version:i.unknown=!0,o.counters.push(i),n=!1}return n?null:{startDate:a,endDate:u,features:e}},e.clearSummary=function(){u=a=0,s={}},e}(),d=fe(n),g=n.inlineUsersInEvents,p=n.samplingInterval,m=n.eventCapacity,h=n.flushInterval,y=n.logger,w=[],b=0,E=!1,k=!1;function S(){return 0===p||0===Math.floor(Math.random()*p)}function D(e){w.length<m?(w.push(e),k=!1):(k||(k=!0,y.warn("Exceeded event queue capacity. Increase capacity to avoid dropping events.")),u&&u.incrementDroppedEvents())}return c.enqueue=function(e){if(!E){var n=!1,t=!1;if(v.summarizeEvent(e),"feature"===e.kind?S()&&(n=!!e.trackEvents,t=function(e){return!!e.debugEventsUntilDate&&e.debugEventsUntilDate>b&&e.debugEventsUntilDate>(new Date).getTime()}(e)):n=S(),n&&D(function(e){var n=se({},e);return g||"identify"===e.kind?n.user=d.filterUser(e.user):(n.userKey=e.user.key,delete n.user),"feature"===e.kind&&(delete n.trackEvents,delete n.debugEventsUntilDate),n}(e)),t){var r=se({},e,{kind:"debug"});delete r.trackEvents,delete r.debugEventsUntilDate,delete r.variation,D(r)}}},c.flush=function(){if(E)return Promise.resolve();var e=w,n=v.getSummary();return v.clearSummary(),n&&(n.kind="summary",e.push(n)),u&&u.setEventsInLastBatch(e.length),0===e.length?Promise.resolve():(w=[],y.debug(ke(e.length)),l.sendEvents(e,f).then(function(e){e&&(e.serverTime&&(b=e.serverTime),te(e.status)||(E=!0),400<=e.status&&ie(function(){s.maybeReportError(new Y(me(e.status,"event posting","some events were dropped")))}))}))},c.start=function(){a=setTimeout(function e(){c.flush(),a=setTimeout(e,h)},h)},c.stop=function(){clearTimeout(a)},c}(o,f,s,g,u,l),D=Pe(o,f,s),P={},O={},U=f.streaming,R=!1,I=!1,j=!0,T=f.stateProvider,N=(b=function(e){T||e&&F({kind:"identify",key:e.key,user:e,creationDate:(new Date).getTime()})},{setUser:function(e){(E=ce(e))&&b&&b(re(E))},getUser:function(){return E?re(E):null}}),L=Oe(o.localStorage,a);function F(e){s&&(T&&T.enqueueEvent&&T.enqueueEvent(e)||(e.user?(j=!1,!i||I||o.isDoNotTrack()||(a.debug(Ee(e.kind)),S.enqueue(e))):j&&(a.warn("Be sure to call `identify` in the LaunchDarkly client: https://docs.launchdarkly.com/docs/js-sdk-reference#section-analytics-events"),j=!1)))}function C(e,n,t,r){var o=N.getUser(),i=new Date,a=n?n.value:null;if(!f.allowFrequentDuplicateEvents){var u=JSON.stringify(a)+(o&&o.key?o.key:"")+e,s=P[u];if(s&&i-s<3e5)return;P[u]=i}var c={kind:"feature",key:e,user:o,value:a,variation:n?n.variationIndex:null,default:t,creationDate:i.getTime()},l=O[e];l&&(c.version=l.flagVersion?l.flagVersion:l.version,c.trackEvents=l.trackEvents,c.debugEventsUntilDate=l.debugEventsUntilDate),(r||l&&l.trackReason)&&n&&(c.reason=n.reason),F(c)}function x(e,n,t,r){var o;if(O&&O.hasOwnProperty(e)&&O[e]&&!O[e].deleted){var i=O[e];o=A(i),null!==i.value&&void 0!==i.value||(o.value=n)}else o={value:n,variationIndex:null,reason:{kind:"ERROR",errorKind:"FLAG_NOT_FOUND"}};return t&&C(e,o,n,r),o}function A(e){return{value:e.value,variationIndex:void 0===e.variation?null:e.variation,reason:e.reason||null}}function q(){h=!0,N.getUser()&&k.connect(N.getUser(),c,{ping:function(){a.debug("received ping message from stream"),D.fetchFlagSettings(N.getUser(),c).then(function(e){return V(e||{})}).catch(function(e){u.maybeReportError(new ne(ge(e)))})},put:function(e){var n=JSON.parse(e.data);a.debug("received streaming update for all flags"),V(n)},patch:function(e){var n=JSON.parse(e.data),t=O[n.key];if(!t||!t.version||!n.version||t.version<n.version){a.debug(he(n.key));var r={},o=se({},n);delete o.key;var i=A(O[n.key]=o);r[n.key]=t?{previous:t.value,current:i}:{current:i},J(r)}else a.debug(ye(n.key))},delete:function(e){var n=JSON.parse(e.data);if(!O[n.key]||O[n.key].version<n.version){a.debug(we(n.key));var t={};O[n.key]&&!O[n.key].deleted&&(t[n.key]={previous:O[n.key].value}),O[n.key]={version:n.version,deleted:!0},J(t)}else a.debug(be(n.key))}})}function _(){h&&(k.disconnect(),h=!1)}function V(e){var n={};if(!e)return Promise.resolve();for(var t in O)O.hasOwnProperty(t)&&O[t]&&(e[t]&&!oe(e[t].value,O[t].value)?n[t]={previous:O[t].value,current:A(e[t])}:e[t]&&!e[t].deleted||(n[t]={previous:O[t].value}));for(var r in e)e.hasOwnProperty(r)&&e[r]&&(!O[r]||O[r].deleted)&&(n[r]={current:A(e[r])});return O=Q({},e),J(n).catch(function(){})}function J(o){var e=Object.keys(o);if(0<e.length){var i={};e.forEach(function(e){var n=o[e].current,t=n?n.value:void 0,r=o[e].previous;u.emit("change:"+e,t,r),i[e]=n?{current:t,previous:r}:{previous:r}}),u.emit("change",i),u.emit("internal-change",O),f.sendEventsOnlyForVariation||T||e.forEach(function(e){C(e,o[e].current)})}return m&&w?w.saveFlags(O).catch(function(){return null}):Promise.resolve()}function z(){var e=U||y&&void 0===U;e&&!h?q():!e&&h&&_(),p&&p.setStreaming(e)}function M(e){return"change"===e||"change:"===e.substr(0,"change".length+1)}o.localStorage&&(w=new Se(o.localStorage,s,c,N,a));var $=new Promise(function(e){var n=u.on("ready",function(){u.off("ready",n),e()})}),H=new Promise(function(e,n){var t=u.on("initialized",function(){u.off("initialized",t),e()}),r=u.on("failed",function(e){u.off("failed",r),n(e)})});if("string"==typeof f.bootstrap&&"LOCALSTORAGE"===f.bootstrap.toUpperCase()&&(w?m=!0:a.warn("localStorage is unavailable")),"object"===W(f.bootstrap)&&(O=function(t){var e=Object.keys(t),r=t.$flagsState;!r&&e.length&&a.warn(pe()),!1===t.$valid&&a.warn("LaunchDarkly bootstrap data is not available because the back end could not read the flags.");var o={};return e.forEach(function(e){if("$flagsState"!==e&&"$valid"!==e){var n={value:t[e]};r&&r[e]?n=se(n,r[e]):n.version=0,o[e]=n}}),o}(f.bootstrap)),T){var K=T.getInitialState();K?B(K):T.on("init",B),T.on("update",function(e){e.user&&N.setUser(e.user),e.flags&&V(e.flags)})}else(e?L.validateUser(n).then(function(e){return N.setUser(e),"object"===W(f.bootstrap)?G():m?w.loadFlags().catch(function(){return null}).then(function(e){return null==e?(O={},D.fetchFlagSettings(N.getUser(),c).then(function(e){return V(e||{})}).then(G).catch(function(e){X(new ne(ge(e)))})):(O=e,ie(G),D.fetchFlagSettings(N.getUser(),c).then(function(e){return V(e)}).catch(function(e){return u.maybeReportError(e)}))}):D.fetchFlagSettings(N.getUser(),c).then(function(e){O=e||{},G()}).catch(function(e){O={},X(e)})}):Promise.reject(new Z(de()))).catch(function(e){return u.maybeReportError(e)});function B(e){s=e.environment,N.setUser(e.user),O=Q({},e.flags),ie(G)}function G(){a.info("LaunchDarkly client initialized"),R=!0,z(),u.emit("ready"),u.emit("initialized")}function X(e){u.maybeReportError(e),u.emit("failed",e),u.emit("ready")}return{client:{waitForInitialization:function(){return H},waitUntilReady:function(){return $},identify:function(e,r,n){return I?ae(Promise.resolve({}),n):T?(a.warn("identify() has no effect here; it must be called on the main client instance"),ae(Promise.resolve(ue(O)),n)):ae((m&&w?w.clearFlags():Promise.resolve()).then(function(){return L.validateUser(e)}).then(function(t){return D.fetchFlagSettings(t,r).then(function(e){var n=ue(e);return N.setUser(t),c=r,e?V(e).then(function(){return n}):n})}).then(function(e){return h&&q(),e}).catch(function(e){return u.maybeReportError(e),Promise.reject(e)}),n)},getUser:function(){return N.getUser()},variation:function(e,n){return x(e,n,!0,!1).value},variationDetail:function(e,n){return x(e,n,!0,!0)},track:function(e,n,t){if("string"==typeof e){o.customEventFilter&&!o.customEventFilter(e)&&a.warn(ve(e));var r={kind:"custom",key:e,user:N.getUser(),url:o.getCurrentUrl(),creationDate:(new Date).getTime()};null!=n&&(r.data=n),null!=t&&(r.metricValue=t),F(r)}else u.maybeReportError(new ee(ve(e)))},on:function(e,n,t){M(e)?(y=!0,R&&z(),u.on(e,n,t)):u.on.apply(u,arguments)},off:function(e){if(u.off.apply(u,arguments),M(e)){var n=!1;u.getEvents().forEach(function(e){M(e)&&0<u.getEventListenerCount(e)&&(n=!0)}),n||(y=!1,h&&void 0===U&&_())}},setStreaming:function(e){var n=null===e?void 0:e;n!==U&&(U=n,z())},flush:function(e){return ae(i?S.flush():Promise.resolve(),e)},allFlags:function(){var e={};if(!O)return e;for(var n in O)O.hasOwnProperty(n)&&(e[n]=x(n,null,!f.sendEventsOnlyForVariation).value);return e},close:function(e){if(I)return ae(Promise.resolve(),e);function n(){I=!0,O={}}return ae(Promise.resolve().then(function(){if(_(),p&&p.stop(),i)return S.stop(),S.flush()}).then(n).catch(n),e)}},options:f,emitter:u,ident:N,logger:a,requestor:D,start:function(){i&&(p&&p.start(),S.start())},enqueueEvent:F,getFlagsInternal:function(){return O},getEnvironmentId:function(){return s},internalChangeEventName:"internal-change"}}function Fe(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})),t.push.apply(t,r)}return t}function Ce(o){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?Fe(i,!0).forEach(function(e){var n,t,r;n=o,r=i[t=e],t in n?Object.defineProperty(n,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):n[t]=r}):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(i)):Fe(i).forEach(function(e){Object.defineProperty(o,e,Object.getOwnPropertyDescriptor(i,e))})}return o}var xe={promise:Promise.resolve({status:200,header:function(){return null},body:null})};function Ae(e,n,t,r,o){if(o&&!function(){var e=window.navigator&&window.navigator.userAgent;if(e){var n=e.match(/Chrom(e|ium)\/([0-9]+)\./);if(n)return parseInt(n[2],10)<73}return!0}())return xe;var i=new window.XMLHttpRequest;for(var a in i.open(e,n,!o),t||{})t.hasOwnProperty(a)&&i.setRequestHeader(a,t[a]);if(o)return i.send(r),xe;var u;return{promise:new Promise(function(e,n){i.addEventListener("load",function(){u||e({status:i.status,header:function(e){return i.getResponseHeader(e)},body:i.responseText})}),i.addEventListener("error",function(){u||n(new Error)}),i.send(r)}),cancel:function(){u=!0,i.abort()}}}var qe=/[|\\{}()[\]^$+*?.]/g,_e=function(e){if("string"!=typeof e)throw new TypeError("Expected a string");return e.replace(qe,"\\$&")};function Ve(e,n,t,r){var o,i,a=n.replace(t,"").replace(r,"");switch(e.kind){case"exact":i=n,o=new RegExp("^"+_e(e.url)+"/?$");break;case"canonical":i=a,o=new RegExp("^"+_e(e.url)+"/?$");break;case"substring":i=a,o=new RegExp(".*"+_e(e.substring)+".*$");break;case"regex":i=a,o=new RegExp(e.pattern);break;default:return!1}return o.test(i)}function Je(e,r){for(var n={},t=null,o=[],i=0;i<e.length;i++)for(var a=e[i],u=a.urls||[],s=0;s<u.length;s++)if(Ve(u[s],window.location.href,window.location.search,window.location.hash)){"pageview"===a.kind?r("pageview",a):(o.push(a),r("click_pageview",a));break}return 0<o.length&&(t=function(e){for(var n=function(e,n){for(var t=[],r=0;r<n.length;r++)for(var o=e.target,i=n[r],a=i.selector,u=document.querySelectorAll(a);o&&0<u.length;){for(var s=0;s<u.length;s++)o===u[s]&&t.push(i);o=o.parentNode}return t}(e,o),t=0;t<n.length;t++)r("click",n[t])},document.addEventListener("click",t)),n.dispose=function(){document.removeEventListener("click",t)},n}var ze=300;function Me(r,n){var t,o,e={};function i(){o&&o.dispose(),t&&t.length&&(o=Je(t,a))}function a(e,n){var t={kind:e,key:n.key,data:null,url:window.location.href,user:r.ident.getUser(),creationDate:(new Date).getTime()};return"click"===e&&(t.selector=n.selector),r.enqueueEvent(t)}function u(e,n){var t,r=window.location.href;function o(){(t=window.location.href)!==r&&(r=t,n())}!function e(n,t){n(),setTimeout(function(){e(n,t)},t)}(o,e),window.history&&window.history.pushState?window.addEventListener("popstate",o):window.addEventListener("hashchange",o)}return e.goalKeyExists=function(e){if(!t)return!0;for(var n=0;n<t.length;n++)if("custom"===t[n].kind&&t[n].key===e)return!0;return!1},r.requestor.fetchJSON("/sdk/goals/"+r.getEnvironmentId()).then(function(e){e&&0<e.length&&(o=Je(t=e,a),u(ze,i)),n()}).catch(function(e){r.emitter.maybeReportError(new s.LDUnexpectedResponseError((e&&e.message,e.message))),n()}),e}var $e="goalsReady",He={fetchGoals:{default:!0},hash:{type:"string"},eventProcessor:{type:"object"},eventUrlTransformer:{type:"function"}};function Ke(e,n){var t=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},r=function(e){var n,i={synchronousFlush:!1};window.XMLHttpRequest&&(i.httpRequest=function(e,n,t,r){var o=i.synchronousFlush;return i.synchronousFlush=!1,Ae(e,n,t,r,o)}),i.httpAllowsPost=function(){return void 0===n&&(n=!!window.XMLHttpRequest&&"withCredentials"in new window.XMLHttpRequest),n},i.httpFallbackPing=function(e){(new window.Image).src=e};var r,t=e&&e.eventUrlTransformer;i.getCurrentUrl=function(){return t?t(window.location.href):window.location.href},i.isDoNotTrack=function(){var e;return 1===(e=window.navigator&&void 0!==window.navigator.doNotTrack?window.navigator.doNotTrack:window.navigator&&void 0!==window.navigator.msDoNotTrack?window.navigator.msDoNotTrack:window.doNotTrack)||!0===e||"1"===e||"yes"===e};try{window.localStorage&&(i.localStorage={get:function(n){return new Promise(function(e){e(window.localStorage.getItem(n))})},set:function(n,t){return new Promise(function(e){window.localStorage.setItem(n,t),e()})},clear:function(n){return new Promise(function(e){window.localStorage.removeItem(n),e()})}})}catch(e){i.localStorage=null}var o=e&&e.useReport;if(r=o&&"function"==typeof window.EventSourcePolyfill&&window.EventSourcePolyfill.supportedOptions&&window.EventSourcePolyfill.supportedOptions.method?(i.eventSourceAllowsReport=!0,window.EventSourcePolyfill):(i.eventSourceAllowsReport=!1,window.EventSource),window.EventSource){i.eventSourceFactory=function(e,n){var t=Ce({},{heartbeatTimeout:3e5,silentTimeout:3e5,skipDefaultHeaders:!0},{},n);return new r(e,t)},i.eventSourceIsActive=function(e){return e.readyState===window.EventSource.OPEN||e.readyState===window.EventSource.CONNECTING}}return i.userAgent="JSClient",i.version="2.17.0",i.diagnosticSdkData={name:"js-client-sdk",version:"2.17.0"},i.diagnosticPlatformData={name:"JS"},i.diagnosticUseCombinedEvent=!0,i}(t),o=Le(e,n,t,r,He),i=o.client,a=o.options,u=o.emitter,s=new Promise(function(e){var n=u.on($e,function(){u.off($e,n),e()})});if(i.waitUntilGoalsReady=function(){return s},a.fetchGoals){var c=Me(o,function(){return u.emit($e)});r.customEventFilter=c.goalKeyExists}else u.emit($e);"complete"!==document.readyState?window.addEventListener("load",o.start):o.start();function l(){r.synchronousFlush=!0,i.flush().catch(function(){}),r.synchronousFlush=!1}return window.addEventListener("beforeunload",l),window.addEventListener("unload",l),i}var Be=Ne;var Ge={initialize:function(e,n){var t=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};return console&&console.warn&&console.warn(G.deprecated("default export","named LDClient export")),Ke(e,n,t)},version:"2.17.0"};e.createConsoleLogger=Be,e.default=Ge,e.initialize=Ke,e.version="2.17.0",Object.defineProperty(e,"__esModule",{value:!0})});
//# sourceMappingURL=ldclient.min.js.map
{
"name": "launchdarkly-js-client-sdk",
"version": "2.16.3",
"version": "2.17.0",
"description": "LaunchDarkly SDK for JavaScript",

@@ -83,3 +83,3 @@ "author": "LaunchDarkly <team@launchdarkly.com>",

"escape-string-regexp": "^1.0.5",
"launchdarkly-js-sdk-common": "3.1.2"
"launchdarkly-js-sdk-common": "3.2.2"
},

@@ -86,0 +86,0 @@ "repository": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc