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.15.1 to 2.15.2

4

CHANGELOG.md

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

## [2.15.2] - 2019-11-15
### Fixed:
- Releases after 2.14.1 were continuing to report the `version` property as "2.14.1". This property will now once again be consistent with the actual release version.
## [2.15.1] - 2019-11-06

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

2

dist/ldclient.cjs.js

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

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _typeof="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};function e(n){return(e="function"==typeof Symbol&&"symbol"==_typeof(Symbol.iterator)?function(e){return void 0===e?"undefined":_typeof(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":void 0===e?"undefined":_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(b(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=[],m=[],p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",h=0,y=p.length;h<y;++h)g[h]=p[h],m[p.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("")}m["-".charCodeAt(0)]=62,m["_".charCodeAt(0)]=63;var k=Array.isArray,E=Object.keys,w=Object.prototype.hasOwnProperty,S=function e(n,t){if(n===t)return!0;if(n&&t&&"object"==(void 0===n?"undefined":_typeof(n))&&"object"==(void 0===t?"undefined":_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},P=["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 U(e){return JSON.parse(JSON.stringify(e))}function j(e,n){return S(e,n)}function I(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 N(e){var n={};for(var t in e)e.hasOwnProperty(t)&&(n[t]={value:e[t],version:0});return n}function F(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;r.length>0;){for(t=[];i>0;){var a=r.shift();if(!a)break;(i-=D(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||"2.14.1";return e.userAgent+"/"+n}function A(e){return{"X-LaunchDarkly-User-Agent":L(e)}}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 P){var o=P[t],i=e[o];void 0!==i&&"string"!=typeof i&&((n=n||r({},e))[o]=String(i))}return n||e}var q=Object.freeze({__proto__:null,btoa:O,base64URLEncode:D,clone:U,deepEquals:j,onNextTick:I,wrapPromiseCallback:R,transformValuesToVersionedValues:N,transformVersionedValuesToValues:F,chunkUserEventsForUrl:T,getLDUserAgentString:L,getLDHeaders:A,extend:C,sanitizeUser:x}),_=2e3;function J(e,n,t,r){var o=n+"/events/bulk/"+t,i=n+"/a/"+t+".gif",a={};function u(e){(new window.Image).src=e}function s(n,t){var a=r||u,s=JSON.stringify(n);return t?function n(t){var r=C({"Content-Type":"application/json","X-LaunchDarkly-Event-Schema":"3"},A(e));return e.httpRequest("POST",o,r,s).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(i+"?d="+D(s)),Promise.resolve())}return a.sendEvents=function(t){if(!e.httpRequest)return Promise.resolve();var r,o=e.httpAllowsPost();r=o?[t]:T(_-n.length,t);for(var i=[],a=0;a<r.length;a++)i.push(s(r[a],o));return Promise.all(i)},a}function V(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 z(e){return e&&e.message?e.message:"string"==typeof e||e instanceof String?e:JSON.stringify(e)}var K=function(){return"LaunchDarkly client initialized"},$=" Please see https://docs.launchdarkly.com/docs/js-sdk-reference#section-initializing-the-client for instructions on SDK initialization.",M=function(){return"Be sure to call `identify` in the LaunchDarkly client: https://docs.launchdarkly.com/docs/js-sdk-reference#section-analytics-events"},H=function(e){return'Expected application/json content type but got "'+e+'"'},G=function(){return"localStorage is unavailable"},X=function(){return"localStorage is unavailable, so anonymous user ID cannot be cached"},B=function(e){return"network error"+(e?" ("+e+")":"")},W=function(e){return'Custom event "'+e+'" does not exist'},Q=function(){return"Environment not found. Double check that you specified a valid environment/client-side ID."+$},Y=function(){return"No environment/client-side ID was specified."+$},Z=function(e){return"Error fetching flag settings: "+z(e)},ee=function(){return"No user specified."+$},ne=function(){return"Invalid user specified."+$},te=function(){return"LaunchDarkly client was initialized with bootstrap data that did not include flag metadata. Events may not be sent correctly."+$},re=function(){return"LaunchDarkly bootstrap data is not available because the back end could not read the flags."},oe=function(e,n){return n?'[LaunchDarkly] "'+e+'" is deprecated, please use "'+n+'"':'[LaunchDarkly] "'+e+'" is deprecated'},ie=function(e,n,t){return"Received error "+e+(401===e?" (invalid SDK key)":"")+" for "+n+" - "+(f(e)?t:"giving up permanently")},ae=function(){return"Cannot make HTTP requests in this environment."+$},ue=function(){return"identify() has no effect here; it must be called on the main client instance"},se=function(){return"Closing stream connection"},ce=function(e){return"Opening stream connection to "+e},le=function(e,n){return"Error on stream connection: "+z(e)+", will continue retrying every "+n+" milliseconds."},fe=function(e){return"polling for feature flags at "+e},ve=function(){return"received ping message from stream"},de=function(){return"received streaming update for all flags"},ge=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'},pe=function(e){return'received streaming deletion for flag "'+e+'"'},he=function(e){return'received streaming deletion for flag "'+e+'" but ignored due to version check'},ye=function(e){return'enqueueing "'+e+'" event'},be=function(e){return"sending "+e+" events"},ke=Object.freeze({__proto__:null,clientInitialized:K,clientNotReady:function(){return"LaunchDarkly client is not ready"},eventWithoutUser:M,invalidContentType:H,invalidKey:function(){return"Event key must be a string"},localStorageUnavailable:G,localStorageUnavailableForUserId:X,networkError:B,unknownCustomEventKey:W,environmentNotFound:Q,environmentNotSpecified:Y,errorFetchingFlags:Z,userNotSpecified:ee,invalidUser:ne,bootstrapOldFormat:te,bootstrapInvalid:re,deprecated:oe,httpErrorMessage:ie,httpUnavailable:ae,identifyDisabled:ue,streamClosing:se,streamConnecting:ce,streamError:le,debugPolling:fe,debugStreamPing:ve,debugStreamPut:de,debugStreamPatch:ge,debugStreamPatchIgnored:me,debugStreamDelete:pe,debugStreamDeleteIgnored:he,debugEnqueueingEvent:ye,debugPostingEvents:be});function Ee(e,n,t){var r,o,a,u,s,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,l=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,v={},d=l||J(e,n.eventsUrl,t),g=(o=0,a=0,u={},(r={}).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=u[n];t?t.count=t.count+1:u[n]={count:1,key:e.key,variation:e.variation,version:e.version,value:e.value,default:e.default},(0===o||e.creationDate<o)&&(o=e.creationDate),e.creationDate>a&&(a=e.creationDate)}},r.getSummary=function(){var e={},n=!0;for(var t in u){var r=u[t],i=e[r.key];i||(i={default:r.default,counters:[]},e[r.key]=i);var s={value:r.value,count:r.count};void 0!==r.variation&&null!==r.variation&&(s.variation=r.variation),r.version?s.version=r.version:s.unknown=!0,i.counters.push(s),n=!1}return n?null:{startDate:o,endDate:a,features:e}},r.clearSummary=function(){o=0,a=0,u={}},r),p=V(n),h=n.inlineUsersInEvents,m=n.samplingInterval,y=n.flushInterval,w=n.logger,b=[],k=0,E=!1;function S(){return 0===m||0===Math.floor(Math.random()*m)}return v.enqueue=function(e){if(!E){var n,t=!1,r=!1;if(g.summarizeEvent(e),"feature"===e.kind?S()&&(t=!!e.trackEvents,r=!!(n=e).debugEventsUntilDate&&n.debugEventsUntilDate>k&&n.debugEventsUntilDate>(new Date).getTime()):t=S(),t&&b.push(function(e){var n=C({},e);return h||"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)),r){var o=C({},e,{kind:"debug"});delete o.trackEvents,delete o.debugEventsUntilDate,delete o.variation,b.push(o)}}},v.flush=function(){if(E)return Promise.resolve();var e=b,n=g.getSummary();return g.clearSummary(),n&&(n.kind="summary",e.push(n)),0===e.length?Promise.resolve():(b=[],w.debug(be(e.length)),d.sendEvents(e).then(function(e){e&&(e.serverTime&&(k=e.serverTime),f(e.status)||(E=!0),e.status>=400&&I(function(){c.maybeReportError(new i(ie(e.status,"event posting","some events were dropped")))}))}))},v.start=function(){s=setTimeout(function e(){v.flush(),s=setTimeout(e,y)},y)},v.stop=function(){clearTimeout(s)},v}function we(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}function Se(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=N(n):delete n.$schema}return n}catch(e){return i.clearFlags().then(function(){return Promise.reject(e)})}}).catch(function(e){return o.warn(G()),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(G()),Promise.reject(e)})},i.clearFlags=function(){return e.clear(a()).catch(function(e){return o.warn(G()),Promise.reject(e)})},i}var Pe="application/json";function Oe(e,n,t){var r=n.baseUrl,o=n.useReport,i=n.evaluationReasons,u=n.sendLDHeaders,s=n.logger,c={},f={};function v(n,t){if(!e.httpRequest)return new Promise(function(e,n){n(new l(ae()))});var r=t?"REPORT":"GET",o=u?A(e):{};t&&(o["Content-Type"]="application/json");var i=f[n];i||(i=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 f[n]}),f[n]=i);var s=e.httpRequest(r,n,o,t),c=s.promise.then(function(e){if(200===e.status){if(e.header("content-type")&&0===e.header("content-type").lastIndexOf(Pe))return JSON.parse(e.body);var n=H(e.header("content-type")||"");return Promise.reject(new l(n))}return Promise.reject(function(e){return 404===e.status?new a(Q()):new l(Z(e.statusText||String(e.status)))}(e))},function(e){return Promise.reject(new l(B(e)))});return i.addPromise(c,function(){s.cancel&&s.cancel()}),i.resultPromise}return c.fetchJSON=function(e){return v(r+e,null)},c.fetchFlagSettings=function(e,n){var a,u,c,l="";return o?(u=[r,"/sdk/evalx/",t,"/user"].join(""),c=JSON.stringify(e)):(a=D(JSON.stringify(e)),u=[r,"/sdk/evalx/",t,"/users/",a].join("")),n&&(l="h="+n),i&&(l=l+(l?"&":"")+"withReasons=true"),u=u+(l?"?":"")+l,s.debug(fe(u)),v(u,c)},c}for(var De=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}(),Ue=[],je=0;je<256;++je)Ue[je]=(je+256).toString(16).substr(1);var Ie,Re,Ne=function(e,n){var t=n||0,r=Ue;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("")},Fe=0,Te=0,Le=function(e,n,t){var r=n&&t||0,o=n||[],i=(e=e||{}).node||Ie,a=void 0!==e.clockseq?e.clockseq:Re;if(null==i||null==a){var u=De();null==i&&(i=Ie=[1|u[0],u[1],u[2],u[3],u[4],u[5]]),null==a&&(a=Re=16383&(u[6]<<8|u[7]))}var s=void 0!==e.msecs?e.msecs:(new Date).getTime(),c=void 0!==e.nsecs?e.nsecs:Te+1,l=s-Fe+(c-Te)/1e4;if(l<0&&void 0===e.clockseq&&(a=a+1&16383),(l<0||s>Fe)&&void 0===e.nsecs&&(c=0),c>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");Fe=s,Te=c,Re=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||Ne(o)},Ae="ld:$anonUserId";function Ce(e,n){var t={validateUser:function(t){if(!t)return Promise.reject(new u(ee()));var r=U(t);return null!==r.key&&void 0!==r.key?(r.key=r.key.toString(),Promise.resolve(r)):r.anonymous?(e?e.get(Ae).catch(function(){return null}):Promise.resolve(null)).then(function(t){if(t)return r.key=t,r;var o=Le();return r.key=o,function(t){return e?e.set(Ae,t).catch(function(){n.warn(X())}):Promise.resolve()}(o).then(function(){return r})}):Promise.reject(new u(ne()))}};return t}function xe(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}var qe="ready",_e="initialized",Je="failed",Ve="change",ze="internal-change";function Ke(n,t,o,i,u){var f,v,d,g,p=o&&o.logger?o.logger:u&&u.logger||xe("warn"),h=we(p),m=function(e,n,t,r){var o=C({logger:r},{baseUrl:"https://app.launchdarkly.com",streamUrl:"https://clientstream.launchdarkly.com",eventsUrl:"https://events.launchdarkly.com",sendEvents:!0,sendLDHeaders:!0,inlineUsersInEvents:!1,allowFrequentDuplicateEvents:!1,sendEventsOnlyForVariation:!1,useReport:!1,evaluationReasons:!1,flushInterval:2e3,samplingInterval:0,streamReconnectDelay:1e3,allAttributesPrivate:!1,privateAttributeNames:[]},t),i={all_attributes_private:"allAttributesPrivate",private_attribute_names:"privateAttributeNames",samplingInterval:null};function a(e){I(function(){n&&n.maybeReportError(new c(e))})}var u=C({},e||{});return function(e){var n=u;Object.keys(i).forEach(function(e){if(void 0!==n[e]){var t=i[e];r&&r.warn(oe(e,t)),t&&(void 0===n[t]&&(n[t]=n[e]),delete n[e])}})}(),u=function(e,n){var t=C({},u);return Object.keys(n).forEach(function(e){void 0!==t[e]&&null!==t[e]||(t[e]=n[e])}),t}(0,o),(isNaN(u.flushInterval)||u.flushInterval<2e3)&&(u.flushInterval=2e3,a("Invalid flush interval configured. Must be an integer >= 2000 (milliseconds).")),(isNaN(u.samplingInterval)||u.samplingInterval<0)&&(u.samplingInterval=0,a("Invalid sampling interval configured. Sampling interval must be an integer >= 0.")),u}(o,h,u,p),y=m.hash,w=m.sendEvents,b=n,k=function(e,n,t,r){var o=n.streamUrl,i=n.logger,a={},u=o+"/eval/"+t,s=n.useReport,c=n.evaluationReasons,l=n.streamReconnectDelay,f=!1,v=null,d=null,g=null,p=null;function h(e){f||(i.warn(le(e,l)),f=!0),w(),m(l)}function m(e){d||(e?d=setTimeout(y,e):y())}function y(){var n;d=null;var a="",l={};if(e.eventSourceFactory){for(var f in null!=r&&(a="h="+r),s?e.eventSourceAllowsReport?(n=u,l.method="REPORT",l.headers={"Content-Type":"application/json"},l.body=JSON.stringify(g)):(n=o+"/ping/"+t,a=""):n=u+"/"+D(JSON.stringify(g)),c&&(a=a+(a?"&":"")+"withReasons=true"),n=n+(a?"?":"")+a,w(),i.info(ce(n)),v=e.eventSourceFactory(n,l),p)p.hasOwnProperty(f)&&v.addEventListener(f,p[f]);v.onerror=h}}function w(){v&&(i.info(se()),v.close(),v=null)}return a.connect=function(e,n){g=e,p={};var t=function(e){p[e]=function(t){f=!1,n[e]&&n[e](t)}};for(var r in n||{})t(r);m()},a.disconnect=function(){clearTimeout(d),d=null,w()},a.isConnected=function(){return!!(v&&e.eventSourceIsActive&&e.eventSourceIsActive(v))},a}(i,m,b,y),E=m.eventProcessor||Ee(i,m,b,h),S=Oe(i,m,b),P={},O={},T=m.streaming,N=!1,L=!1,A=!0,q=m.stateProvider,_=function(e,n){var t,r={setUser:function(e){(t=x(e))&&n&&n(U(t))},getUser:function(){return t?U(t):null}};return r}(0,function(e){q||e&&J({kind:"identify",key:e.key,user:e,creationDate:(new Date).getTime()})}),z=Ce(i.localStorage,p);function J(e){b&&(q&&q.enqueueEvent&&q.enqueueEvent(e)||(e.user?(A=!1,!w||L||i.isDoNotTrack()||(p.debug(ye(e.kind)),E.enqueue(e))):A&&(p.warn(M()),A=!1)))}function V(e,n,t,r){var o=_.getUser(),i=new Date,a=n?n.value:null;if(!m.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),J(c)}function $(e,n,t,r){var o;if(O&&O.hasOwnProperty(e)&&O[e]&&!O[e].deleted){var i=O[e];o=H(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&&V(e,o,n,r),o}function H(e){return{value:e.value,variationIndex:void 0===e.variation?null:e.variation,reason:e.reason||null}}function X(){v=!0,_.getUser()&&k.connect(_.getUser(),{ping:function(){p.debug(ve()),S.fetchFlagSettings(_.getUser(),y).then(function(e){return Q(e||{})}).catch(function(e){h.maybeReportError(new l(Z(e)))})},put:function(e){var n=JSON.parse(e.data);p.debug(de()),Q(n)},patch:function(e){var n=JSON.parse(e.data),t=O[n.key];if(!t||!t.version||!n.version||t.version<n.version){p.debug(ge(n.key));var r={},o=C({},n);delete o.key,O[n.key]=o;var i=H(o);r[n.key]=t?{previous:t.value,current:i}:{current:i},ee(r)}else p.debug(me(n.key))},delete:function(e){var n=JSON.parse(e.data);if(!O[n.key]||O[n.key].version<n.version){p.debug(pe(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},ee(t)}else p.debug(he(n.key))}})}function B(){v&&(k.disconnect(),v=!1)}function Q(e){var n={};if(!e)return Promise.resolve();for(var t in O)O.hasOwnProperty(t)&&O[t]&&(e[t]&&!j(e[t].value,O[t].value)?n[t]={previous:O[t].value,current:H(e[t])}:e[t]&&!e[t].deleted||(n[t]={previous:O[t].value}));for(var o in e)e.hasOwnProperty(o)&&e[o]&&(!O[o]||O[o].deleted)&&(n[o]={current:H(e[o])});return O=r({},e),ee(n).catch(function(){})}function ee(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;h.emit(Ve+":"+n,o,i),t[n]=r?{current:o,previous:i}:{previous:i}}),h.emit(Ve,t),h.emit(ze,O),m.sendEventsOnlyForVariation||q||n.forEach(function(n){V(n,e[n].current)})}return f&&g?g.saveFlags(O).catch(function(){return null}):Promise.resolve()}function ne(){var e=T||d&&void 0===T;e&&!v?X():!e&&v&&B()}function ie(e){return e===Ve||e.substr(0,Ve.length+1)===Ve+":"}i.localStorage&&(g=new Se(i.localStorage,b,y,_,p));var ae=new Promise(function(e){var n=h.on(qe,function(){h.off(qe,n),e()})}),fe=new Promise(function(e,n){var t=h.on(_e,function(){h.off(_e,t),e()}),r=h.on(Je,function(e){h.off(Je,r),n(e)})});if("string"==typeof m.bootstrap&&"LOCALSTORAGE"===m.bootstrap.toUpperCase()&&(g?f=!0:p.warn(G())),"object"===e(m.bootstrap)&&(O=function(e){var n=Object.keys(e),t=e.$flagsState;!t&&n.length&&p.warn(te()),!1===e.$valid&&p.warn(re());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}(m.bootstrap)),q){var be=q.getInitialState();be?ke(be):q.on("init",ke),q.on("update",function(e){e.user&&_.setUser(e.user),e.flags&&Q(e.flags)})}else(n?z.validateUser(t).then(function(n){return _.setUser(n),"object"===e(m.bootstrap)?Pe():f?g.loadFlags().catch(function(){return null}).then(function(e){return null==e?(O={},S.fetchFlagSettings(_.getUser(),y).then(function(e){return Q(e||{})}).then(Pe).catch(function(e){De(new l(Z(e)))})):(O=e,I(Pe),S.fetchFlagSettings(_.getUser(),y).then(function(e){return Q(e)}).catch(function(e){return h.maybeReportError(e)}))}):S.fetchFlagSettings(_.getUser(),y).then(function(e){O=e||{},Pe()}).catch(function(e){O={},De(e)})}):Promise.reject(new a(Y()))).catch(function(e){return h.maybeReportError(e)});function ke(e){b=e.environment,_.setUser(e.user),O=r({},e.flags),I(Pe)}function Pe(){p.info(K()),N=!0,ne(),h.emit(qe),h.emit(_e)}function De(e){h.maybeReportError(e),h.emit(Je,e),h.emit(qe)}return{client:{waitForInitialization:function(){return fe},waitUntilReady:function(){return ae},identify:function(e,n,t){return L?R(Promise.resolve({}),t):q?(p.warn(ue()),R(Promise.resolve(F(O)),t)):R((f&&g?g.clearFlags():Promise.resolve()).then(function(){return z.validateUser(e)}).then(function(e){return _.setUser(e)}).then(function(){return S.fetchFlagSettings(_.getUser(),n)}).then(function(e){var n=F(e);return e?Q(e).then(function(){return n}):n}).then(function(e){return v&&X(),e}).catch(function(e){return h.maybeReportError(e),Promise.reject(e)}),t)},getUser:function(){return _.getUser()},variation:function(e,n){return $(e,n,!0,!1).value},variationDetail:function(e,n){return $(e,n,!0,!0)},track:function(e,n,t){if("string"==typeof e){i.customEventFilter&&!i.customEventFilter(e)&&p.warn(W(e));var r={kind:"custom",key:e,user:_.getUser(),url:i.getCurrentUrl(),creationDate:(new Date).getTime()};null!=n&&(r.data=n),null!=t&&(r.metricValue=t),J(r)}else h.maybeReportError(new s(W(e)))},on:function(e,n,t){ie(e)?(d=!0,N&&ne(),h.on(e,n,t)):h.on.apply(h,arguments)},off:function(e){if(h.off.apply(h,arguments),ie(e)){var n=!1;h.getEvents().forEach(function(e){ie(e)&&h.getEventListenerCount(e)>0&&(n=!0)}),n||(d=!1,v&&void 0===T&&B())}},setStreaming:function(e){var n=null===e?void 0:e;n!==T&&(T=n,ne())},flush:function(e){return R(w?E.flush():Promise.resolve(),e)},allFlags:function(){var e={};if(!O)return e;for(var n in O)O.hasOwnProperty(n)&&(e[n]=$(n,null,!m.sendEventsOnlyForVariation).value);return e},close:function(e){if(L)return R(Promise.resolve(),e);var n=function(){L=!0,O={}};return R(Promise.resolve().then(function(){if(B(),w)return E.stop(),E.flush()}).then(n).catch(n),e)}},options:m,emitter:h,ident:_,logger:p,requestor:S,start:function(){w&&E.start()},enqueueEvent:J,getFlagsInternal:function(){return O},getEnvironmentId:function(){return b},internalChangeEventName:ze}}var $e="2.14.1";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=void 0;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 _extends=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e};function makeBrowserPlatform(e){var n={synchronousFlush:!1};window.XMLHttpRequest&&(n.httpRequest=function(e,t,r,o){var i=n.synchronousFlush;return n.synchronousFlush=!1,newHttpRequest(e,t,r,o,i)});var t=void 0;n.httpAllowsPost=function(){return void 0===t&&(t=!!window.XMLHttpRequest&&"withCredentials"in new window.XMLHttpRequest),t};var r=e&&e.eventUrlTransformer;n.getCurrentUrl=function(){return r?r(window.location.href):window.location.href},n.isDoNotTrack=function(){var e=void 0;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&&(n.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){n.localStorage=null}var o=void 0;if(e&&e.useReport&&"function"==typeof window.EventSourcePolyfill&&window.EventSourcePolyfill.supportedOptions&&window.EventSourcePolyfill.supportedOptions.method?(n.eventSourceAllowsReport=!0,o=window.EventSourcePolyfill):(n.eventSourceAllowsReport=!1,o=window.EventSource),window.EventSource){n.eventSourceFactory=function(e,n){var t=_extends({},{heartbeatTimeout:3e5,silentTimeout:3e5,skipDefaultHeaders:!0},n);return new o(e,t)},n.eventSourceIsActive=function(e){return e.readyState===window.EventSource.OPEN||e.readyState===window.EventSource.CONNECTING}}return n.userAgent="JSClient",n}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=n.replace(t,"").replace(r,""),i=void 0,a=void 0;switch(e.kind){case"exact":a=n,i=new RegExp("^"+escapeStringRegexp(e.url)+"/?$");break;case"canonical":a=o,i=new RegExp("^"+escapeStringRegexp(e.url)+"/?$");break;case"substring":a=o,i=new RegExp(".*"+escapeStringRegexp(e.substring)+".*$");break;case"regex":a=o,i=new RegExp(e.pattern);break;default:return!1}return i.test(a)}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&&u.length>0;){for(var s=0;s<u.length;s++)o===u[s]&&t.push(i);o=o.parentNode}return t}function GoalTracker(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(doesUrlMatch(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=findGoalsForClick(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 locationWatcherInterval=300;function GoalManager(e,n){var t=void 0,r=void 0,o={};function i(){r&&r.dispose(),t&&t.length&&(r=GoalTracker(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=GoalTracker(t=e,a),function(e,n){var t=window.location.href,r=void 0;function o(){(r=window.location.href)!==t&&(t=r,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)}(locationWatcherInterval,i)),n()}).catch(function(t){e.emitter.maybeReportError(new v.LDUnexpectedResponseError((t&&t.message,t.message))),n()}),o}var goalsEvent="goalsReady",extraDefaults={fetchGoals:!0};function initialize(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=makeBrowserPlatform(t),o=Ke(e,n,t,r,extraDefaults),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();var l=function(){r.synchronousFlush=!0,i.flush().catch(function(){})};return window.addEventListener("beforeunload",l),window.addEventListener("unload",l),i}var createConsoleLogger=xe,version=$e;function deprecatedInitialize(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")),initialize(e,n,t)}var index={initialize:deprecatedInitialize,version:version};exports.initialize=initialize,exports.createConsoleLogger=createConsoleLogger,exports.version=version,exports.default=index;
"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"),s=o("LaunchDarklyInvalidEventKeyError"),c=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: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=[],m=[],p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",h=0,y=p.length;h<y;++h)g[h]=p[h],m[p.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("")}m["-".charCodeAt(0)]=62,m["_".charCodeAt(0)]=63;var k=Array.isArray,E=Object.keys,w=Object.prototype.hasOwnProperty,S=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},P=["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 U(e){return JSON.parse(JSON.stringify(e))}function j(e,n){return S(e,n)}function I(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 N(e){var n={};for(var t in e)e.hasOwnProperty(t)&&(n[t]={value:e[t],version:0});return n}function F(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 L(e){var n=e.version||"2.14.1";return e.userAgent+"/"+n}function A(e){return{"X-LaunchDarkly-User-Agent":L(e)}}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 P){var o=P[t],i=e[o];void 0!==i&&"string"!=typeof i&&((n=n||r({},e))[o]=String(i))}return n||e}var q=Object.freeze({__proto__:null,btoa:O,base64URLEncode:D,clone:U,deepEquals:j,onNextTick:I,wrapPromiseCallback:R,transformValuesToVersionedValues:N,transformVersionedValuesToValues:F,chunkUserEventsForUrl:T,getLDUserAgentString:L,getLDHeaders:A,extend:C,sanitizeUser:x}),_=2e3;function J(c,l,e,v){var d=l+"/events/bulk/"+e,g=l+"/a/"+e+".gif",n={};function p(e){(new window.Image).src=e}return n.sendEvents=function(e){if(!c.httpRequest)return Promise.resolve();var n,t,r,o,i,a=c.httpAllowsPost();n=a?[e]:T(_-l.length,e);for(var u=[],s=0;s<n.length;s++)u.push((t=n[s],r=a,o=void 0,o=v||p,i=JSON.stringify(t),r?function n(t){var e=C({"Content-Type":"application/json","X-LaunchDarkly-Event-Schema":"3"},A(c));return c.httpRequest("POST",d,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(){}):(o(g+"?d="+D(i)),Promise.resolve())));return Promise.all(u)},n}function V(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=C({},o,i[1])}var u=Object.keys(o);return u.length&&(u.sort(),r.privateAttrs=u),r},n}function z(e){return e&&e.message?e.message:"string"==typeof e||e instanceof String?e:JSON.stringify(e)}var K=function(){return"LaunchDarkly client initialized"},$=" Please see https://docs.launchdarkly.com/docs/js-sdk-reference#section-initializing-the-client for instructions on SDK initialization.",M=function(){return"Be sure to call `identify` in the LaunchDarkly client: https://docs.launchdarkly.com/docs/js-sdk-reference#section-analytics-events"},H=function(e){return'Expected application/json content type but got "'+e+'"'},G=function(){return"localStorage is unavailable"},X=function(){return"localStorage is unavailable, so anonymous user ID cannot be cached"},B=function(e){return"network error"+(e?" ("+e+")":"")},W=function(e){return'Custom event "'+e+'" does not exist'},Q=function(){return"Environment not found. Double check that you specified a valid environment/client-side ID."+$},Y=function(){return"No environment/client-side ID was specified."+$},Z=function(e){return"Error fetching flag settings: "+z(e)},ee=function(){return"No user specified."+$},ne=function(){return"Invalid user specified."+$},te=function(){return"LaunchDarkly client was initialized with bootstrap data that did not include flag metadata. Events may not be sent correctly."+$},re=function(){return"LaunchDarkly bootstrap data is not available because the back end could not read the flags."},oe=function(e,n){return n?'[LaunchDarkly] "'+e+'" is deprecated, please use "'+n+'"':'[LaunchDarkly] "'+e+'" is deprecated'},ie=function(e,n,t){return"Received error "+e+(401===e?" (invalid SDK key)":"")+" for "+n+" - "+(f(e)?t:"giving up permanently")},ae=function(){return"Cannot make HTTP requests in this environment."+$},ue=function(){return"identify() has no effect here; it must be called on the main client instance"},se=function(){return"Closing stream connection"},ce=function(e){return"Opening stream connection to "+e},le=function(e,n){return"Error on stream connection: "+z(e)+", will continue retrying every "+n+" milliseconds."},fe=function(e){return"polling for feature flags at "+e},ve=function(){return"received ping message from stream"},de=function(){return"received streaming update for all flags"},ge=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'},pe=function(e){return'received streaming deletion for flag "'+e+'"'},he=function(e){return'received streaming deletion for flag "'+e+'" but ignored due to version check'},ye=function(e){return'enqueueing "'+e+'" event'},be=function(e){return"sending "+e+" events"},ke=Object.freeze({__proto__:null,clientInitialized:K,clientNotReady:function(){return"LaunchDarkly client is not ready"},eventWithoutUser:M,invalidContentType:H,invalidKey:function(){return"Event key must be a string"},localStorageUnavailable:G,localStorageUnavailableForUserId:X,networkError:B,unknownCustomEventKey:W,environmentNotFound:Q,environmentNotSpecified:Y,errorFetchingFlags:Z,userNotSpecified:ee,invalidUser:ne,bootstrapOldFormat:te,bootstrapInvalid:re,deprecated:oe,httpErrorMessage:ie,httpUnavailable:ae,identifyDisabled:ue,streamClosing:se,streamConnecting:ce,streamError:le,debugPolling:fe,debugStreamPing:ve,debugStreamPut:de,debugStreamPatch:ge,debugStreamPatchIgnored:me,debugStreamDelete:pe,debugStreamDeleteIgnored:he,debugEnqueueingEvent:ye,debugPostingEvents:be});function Ee(e,n,t){var r,a,u,s,o,c=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null,l={},v=(4<arguments.length&&void 0!==arguments[4]?arguments[4]:null)||J(e,n.eventsUrl,t),d=(u=a=0,s={},(r={}).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)}},r.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}},r.clearSummary=function(){u=a=0,s={}},r),g=V(n),p=n.inlineUsersInEvents,h=n.samplingInterval,m=n.flushInterval,y=n.logger,w=[],b=0,k=!1;function E(){return 0===h||0===Math.floor(Math.random()*h)}return l.enqueue=function(e){if(!k){var n,t=!1,r=!1;if(d.summarizeEvent(e),"feature"===e.kind?E()&&(t=!!e.trackEvents,r=!!(n=e).debugEventsUntilDate&&n.debugEventsUntilDate>b&&n.debugEventsUntilDate>(new Date).getTime()):t=E(),t&&w.push((a=C({},i=e),p||"identify"===i.kind?a.user=g.filterUser(i.user):(a.userKey=i.user.key,delete a.user),"feature"===i.kind&&(delete a.trackEvents,delete a.debugEventsUntilDate),a)),r){var o=C({},e,{kind:"debug"});delete o.trackEvents,delete o.debugEventsUntilDate,delete o.variation,w.push(o)}}var i,a},l.flush=function(){if(k)return Promise.resolve();var e=w,n=d.getSummary();return d.clearSummary(),n&&(n.kind="summary",e.push(n)),0===e.length?Promise.resolve():(w=[],y.debug(be(e.length)),v.sendEvents(e).then(function(e){e&&(e.serverTime&&(b=e.serverTime),f(e.status)||(k=!0),400<=e.status&&I(function(){c.maybeReportError(new i(ie(e.status,"event posting","some events were dropped")))}))}))},l.start=function(){o=setTimeout(function e(){l.flush(),o=setTimeout(e,m)},m)},l.stop=function(){clearTimeout(o)},l}function we(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 Se(t,r,o,i,a){var u={};function s(){var e="",n=i.getUser();return n&&(e=o||O(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=N(n):delete n.$schema}return n}catch(e){return u.clearFlags().then(function(){return Promise.reject(e)})}}).catch(function(e){return a.warn(G()),Promise.reject(e)})},u.saveFlags=function(e){var n=C({},e,{$schema:1});return t.set(s(),JSON.stringify(n)).catch(function(e){return a.warn(G()),Promise.reject(e)})},u.clearFlags=function(){return t.clear(s()).catch(function(e){return a.warn(G()),Promise.reject(e)})},u}var Pe="application/json";function Oe(p,e,u){var s=e.baseUrl,c=e.useReport,f=e.evaluationReasons,h=e.sendLDHeaders,v=e.logger,n={},m={};function d(e,n){if(!p.httpRequest)return new Promise(function(e,n){n(new l(ae()))});var t=n?"REPORT":"GET",r=h?A(p):{};n&&(r["Content-Type"]="application/json");var o,i,u,s,c,f,v=m[e];v||(o=function(){delete m[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,m[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(Q()):new l(Z(n.statusText||String(n.status))));if(e.header("content-type")&&0===e.header("content-type").lastIndexOf(Pe))return JSON.parse(e.body);var n,t=H(e.header("content-type")||"");return Promise.reject(new l(t))},function(e){return Promise.reject(new l(B(e)))});return v.addPromise(g,function(){d.cancel&&d.cancel()}),v.resultPromise}return n.fetchJSON=function(e){return d(s+e,null)},n.fetchFlagSettings=function(e,n){var t,r,o,i="";return c?(r=[s,"/sdk/evalx/",u,"/user"].join(""),o=JSON.stringify(e)):(t=D(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(fe(r)),d(r,o)},n}for(var De=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}(),Ue=[],je=0;je<256;++je)Ue[je]=(je+256).toString(16).substr(1);var Ie,Re,Ne=function(e,n){var t=n||0,r=Ue;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("")},Fe=0,Te=0,Le=function(e,n,t){var r=n&&t||0,o=n||[],i=(e=e||{}).node||Ie,a=void 0!==e.clockseq?e.clockseq:Re;if(null==i||null==a){var u=De();null==i&&(i=Ie=[1|u[0],u[1],u[2],u[3],u[4],u[5]]),null==a&&(a=Re=16383&(u[6]<<8|u[7]))}var s=void 0!==e.msecs?e.msecs:(new Date).getTime(),c=void 0!==e.nsecs?e.nsecs:Te+1,l=s-Fe+(c-Te)/1e4;if(l<0&&void 0===e.clockseq&&(a=a+1&16383),(l<0||Fe<s)&&void 0===e.nsecs&&(c=0),1e4<=c)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");Fe=s,Re=a;var f=(1e4*(268435455&(s+=122192928e5))+(Te=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||Ne(o)},Ae="ld:$anonUserId";function Ce(o,i){var e={};return e.validateUser=function(e){if(!e)return Promise.reject(new u(ee()));var r=U(e);return null!==r.key&&void 0!==r.key?(r.key=r.key.toString(),Promise.resolve(r)):r.anonymous?(o?o.get(Ae).catch(function(){return null}):Promise.resolve(null)).then(function(e){if(e)return r.key=e,r;var n,t=Le();return r.key=t,(n=t,o?o.set(Ae,n).catch(function(){i.warn(X())}):Promise.resolve()).then(function(){return r})}):Promise.reject(new u(ne()))},e}function xe(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}var qe="ready",_e="initialized",Je="failed",Ve="change",ze="internal-change";function Ke(n,t,o,i,u){var f,v,d,g,p,h,m,y,w,b,k,E,S,P,O,T,N,L,A,q,_,z,J,V,$,H,X,B,Q,ee,ne,ie=o&&o.logger?o.logger:u&&u.logger||xe("warn"),ae=we(ie),fe=(J=o,V=ae,H=C({logger:$=ie},{baseUrl:"https://app.launchdarkly.com",streamUrl:"https://clientstream.launchdarkly.com",eventsUrl:"https://events.launchdarkly.com",sendEvents:!0,sendLDHeaders:!0,inlineUsersInEvents:!1,allowFrequentDuplicateEvents:!1,sendEventsOnlyForVariation:!1,useReport:!1,evaluationReasons:!1,flushInterval:2e3,samplingInterval:0,streamReconnectDelay:1e3,allAttributesPrivate:!1,privateAttributeNames:[]},u),X={all_attributes_private:"allAttributesPrivate",private_attribute_names:"privateAttributeNames",samplingInterval:null},ne=C({},J||{}),ee=ne,Object.keys(X).forEach(function(e){if(void 0!==ee[e]){var n=X[e];$&&$.warn(oe(e,n)),n&&(void 0===ee[n]&&(ee[n]=ee[e]),delete ee[e])}}),B=H,Q=C({},ne),Object.keys(B).forEach(function(e){void 0!==Q[e]&&null!==Q[e]||(Q[e]=B[e])}),ne=Q,(isNaN(ne.flushInterval)||ne.flushInterval<2e3)&&(ne.flushInterval=2e3,We("Invalid flush interval configured. Must be an integer >= 2000 (milliseconds).")),(isNaN(ne.samplingInterval)||ne.samplingInterval<0)&&(ne.samplingInterval=0,We("Invalid sampling interval configured. Sampling interval must be an integer >= 0.")),ne),be=fe.hash,ke=fe.sendEvents,Pe=n,De=(m=i,w=Pe,b=be,k=(y=fe).streamUrl,E=y.logger,S={},P=k+"/eval/"+w,O=y.useReport,T=y.evaluationReasons,N=y.streamReconnectDelay,L=!1,z=_=q=A=null,S.connect=function(e,t){function n(n){z[n]=function(e){L=!1,t[n]&&t[n](e)}}for(var r in _=e,z={},t||{})n(r);Me()},S.disconnect=function(){clearTimeout(q),q=null,Xe()},S.isConnected=function(){return!!(A&&m.eventSourceIsActive&&m.eventSourceIsActive(A))},S),Re=fe.eventProcessor||Ee(i,fe,Pe,ae),Ue=Oe(i,fe,Pe),je={},Ie={},Te=fe.streaming,Ne=!1,Le=!1,Fe=!0,Ae=fe.stateProvider,Ge=(p=function(e){Ae||e&&Be({kind:"identify",key:e.key,user:e,creationDate:(new Date).getTime()})},{setUser:function(e){(h=x(e))&&p&&p(U(h))},getUser:function(){return h?U(h):null}}),$e=Ce(i.localStorage,ie);function Ke(e){L||(E.warn(le(e,N)),L=!0),Xe(),Me(N)}function Me(e){q||(e?q=setTimeout(He,e):He())}function He(){var e;q=null;var n="",t={};if(m.eventSourceFactory){for(var r in null!=b&&(n="h="+b),O?m.eventSourceAllowsReport?(e=P,t.method="REPORT",t.headers={"Content-Type":"application/json"},t.body=JSON.stringify(_)):(e=k+"/ping/"+w,n=""):e=P+"/"+D(JSON.stringify(_)),T&&(n=n+(n?"&":"")+"withReasons=true"),e=e+(n?"?":"")+n,Xe(),E.info(ce(e)),A=m.eventSourceFactory(e,t),z)z.hasOwnProperty(r)&&A.addEventListener(r,z[r]);A.onerror=Ke}}function Xe(){A&&(E.info(se()),A.close(),A=null)}function We(e){I(function(){V&&V.maybeReportError(new c(e))})}function Be(e){Pe&&(Ae&&Ae.enqueueEvent&&Ae.enqueueEvent(e)||(e.user?(Fe=!1,!ke||Le||i.isDoNotTrack()||(ie.debug(ye(e.kind)),Re.enqueue(e))):Fe&&(ie.warn(M()),Fe=!1)))}function Ze(e,n,t,r){var o=Ge.getUser(),i=new Date,a=n?n.value:null;if(!fe.allowFrequentDuplicateEvents){var u=JSON.stringify(a)+(o&&o.key?o.key:"")+e,s=je[u];if(s&&i-s<3e5)return;je[u]=i}var c={kind:"feature",key:e,user:o,value:a,variation:n?n.variationIndex:null,default:t,creationDate:i.getTime()},l=Ie[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),Be(c)}function Qe(e,n,t,r){var o;if(Ie&&Ie.hasOwnProperty(e)&&Ie[e]&&!Ie[e].deleted){var i=Ie[e];o=Ye(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 Ye(e){return{value:e.value,variationIndex:void 0===e.variation?null:e.variation,reason:e.reason||null}}function en(){v=!0,Ge.getUser()&&De.connect(Ge.getUser(),{ping:function(){ie.debug(ve()),Ue.fetchFlagSettings(Ge.getUser(),be).then(function(e){return tn(e||{})}).catch(function(e){ae.maybeReportError(new l(Z(e)))})},put:function(e){var n=JSON.parse(e.data);ie.debug(de()),tn(n)},patch:function(e){var n=JSON.parse(e.data),t=Ie[n.key];if(!t||!t.version||!n.version||t.version<n.version){ie.debug(ge(n.key));var r={},o=C({},n);delete o.key;var i=Ye(Ie[n.key]=o);r[n.key]=t?{previous:t.value,current:i}:{current:i},rn(r)}else ie.debug(me(n.key))},delete:function(e){var n=JSON.parse(e.data);if(!Ie[n.key]||Ie[n.key].version<n.version){ie.debug(pe(n.key));var t={};Ie[n.key]&&!Ie[n.key].deleted&&(t[n.key]={previous:Ie[n.key].value}),Ie[n.key]={version:n.version,deleted:!0},rn(t)}else ie.debug(he(n.key))}})}function nn(){v&&(De.disconnect(),v=!1)}function tn(e){var n={};if(!e)return Promise.resolve();for(var t in Ie)Ie.hasOwnProperty(t)&&Ie[t]&&(e[t]&&!j(e[t].value,Ie[t].value)?n[t]={previous:Ie[t].value,current:Ye(e[t])}:e[t]&&!e[t].deleted||(n[t]={previous:Ie[t].value}));for(var o in e)e.hasOwnProperty(o)&&e[o]&&(!Ie[o]||Ie[o].deleted)&&(n[o]={current:Ye(e[o])});return Ie=r({},e),rn(n).catch(function(){})}function rn(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(Ve+":"+e,t,r),i[e]=n?{current:t,previous:r}:{previous:r}}),ae.emit(Ve,i),ae.emit(ze,Ie),fe.sendEventsOnlyForVariation||Ae||e.forEach(function(e){Ze(e,o[e].current)})}return f&&g?g.saveFlags(Ie).catch(function(){return null}):Promise.resolve()}function on(){var e=Te||d&&void 0===Te;e&&!v?en():!e&&v&&nn()}function an(e){return e===Ve||e.substr(0,Ve.length+1)===Ve+":"}i.localStorage&&(g=new Se(i.localStorage,Pe,be,Ge,ie));var un=new Promise(function(e){var n=ae.on(qe,function(){ae.off(qe,n),e()})}),sn=new Promise(function(e,n){var t=ae.on(_e,function(){ae.off(_e,t),e()}),r=ae.on(Je,function(e){ae.off(Je,r),n(e)})});if("string"==typeof fe.bootstrap&&"LOCALSTORAGE"===fe.bootstrap.toUpperCase()&&(g?f=!0:ie.warn(G())),"object"===e(fe.bootstrap)&&(Ie=function(t){var e=Object.keys(t),r=t.$flagsState;!r&&e.length&&ie.warn(te()),!1===t.$valid&&ie.warn(re());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}(fe.bootstrap)),Ae){var cn=Ae.getInitialState();cn?ln(cn):Ae.on("init",ln),Ae.on("update",function(e){e.user&&Ge.setUser(e.user),e.flags&&tn(e.flags)})}else(n?$e.validateUser(t).then(function(n){return Ge.setUser(n),"object"===e(fe.bootstrap)?fn():f?g.loadFlags().catch(function(){return null}).then(function(e){return null==e?(Ie={},Ue.fetchFlagSettings(Ge.getUser(),be).then(function(e){return tn(e||{})}).then(fn).catch(function(e){vn(new l(Z(e)))})):(Ie=e,I(fn),Ue.fetchFlagSettings(Ge.getUser(),be).then(function(e){return tn(e)}).catch(function(e){return ae.maybeReportError(e)}))}):Ue.fetchFlagSettings(Ge.getUser(),be).then(function(e){Ie=e||{},fn()}).catch(function(e){Ie={},vn(e)})}):Promise.reject(new a(Y()))).catch(function(e){return ae.maybeReportError(e)});function ln(e){Pe=e.environment,Ge.setUser(e.user),Ie=r({},e.flags),I(fn)}function fn(){ie.info(K()),Ne=!0,on(),ae.emit(qe),ae.emit(_e)}function vn(e){ae.maybeReportError(e),ae.emit(Je,e),ae.emit(qe)}return{client:{waitForInitialization:function(){return sn},waitUntilReady:function(){return un},identify:function(e,n,t){return Le?R(Promise.resolve({}),t):Ae?(ie.warn(ue()),R(Promise.resolve(F(Ie)),t)):R((f&&g?g.clearFlags():Promise.resolve()).then(function(){return $e.validateUser(e)}).then(function(e){return Ge.setUser(e)}).then(function(){return Ue.fetchFlagSettings(Ge.getUser(),n)}).then(function(e){var n=F(e);return e?tn(e).then(function(){return n}):n}).then(function(e){return v&&en(),e}).catch(function(e){return ae.maybeReportError(e),Promise.reject(e)}),t)},getUser:function(){return Ge.getUser()},variation:function(e,n){return Qe(e,n,!0,!1).value},variationDetail:function(e,n){return Qe(e,n,!0,!0)},track:function(e,n,t){if("string"==typeof e){i.customEventFilter&&!i.customEventFilter(e)&&ie.warn(W(e));var r={kind:"custom",key:e,user:Ge.getUser(),url:i.getCurrentUrl(),creationDate:(new Date).getTime()};null!=n&&(r.data=n),null!=t&&(r.metricValue=t),Be(r)}else ae.maybeReportError(new s(W(e)))},on:function(e,n,t){an(e)?(d=!0,Ne&&on(),ae.on(e,n,t)):ae.on.apply(ae,arguments)},off:function(e){if(ae.off.apply(ae,arguments),an(e)){var n=!1;ae.getEvents().forEach(function(e){an(e)&&0<ae.getEventListenerCount(e)&&(n=!0)}),n||(d=!1,v&&void 0===Te&&nn())}},setStreaming:function(e){var n=null===e?void 0:e;n!==Te&&(Te=n,on())},flush:function(e){return R(ke?Re.flush():Promise.resolve(),e)},allFlags:function(){var e={};if(!Ie)return e;for(var n in Ie)Ie.hasOwnProperty(n)&&(e[n]=Qe(n,null,!fe.sendEventsOnlyForVariation).value);return e},close:function(e){if(Le)return R(Promise.resolve(),e);function n(){Le=!0,Ie={}}return R(Promise.resolve().then(function(){if(nn(),ke)return Re.stop(),Re.flush()}).then(n).catch(n),e)}},options:fe,emitter:ae,ident:Ge,logger:ie,requestor:Ue,start:function(){ke&&Re.start()},enqueueEvent:Be,getFlagsInternal:function(){return Ie},getEnvironmentId:function(){return Pe},internalChangeEventName:ze}}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};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 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",extraDefaults={fetchGoals:!0};function initialize(e,n){var t=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},r=makeBrowserPlatform(t),o=Ke(e,n,t,r,extraDefaults),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(){})}return window.addEventListener("beforeunload",l),window.addEventListener("unload",l),i}var createConsoleLogger=xe,version="2.15.2";function deprecatedInitialize(e,n){var t=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};return console&&console.warn&&console.warn(ke.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 @@

var _typeof="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};function e(n){return(e="function"==typeof Symbol&&"symbol"==_typeof(Symbol.iterator)?function(e){return void 0===e?"undefined":_typeof(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":void 0===e?"undefined":_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(b(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=[],m=[],p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",h=0,y=p.length;h<y;++h)g[h]=p[h],m[p.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("")}m["-".charCodeAt(0)]=62,m["_".charCodeAt(0)]=63;var k=Array.isArray,E=Object.keys,w=Object.prototype.hasOwnProperty,S=function e(n,t){if(n===t)return!0;if(n&&t&&"object"==(void 0===n?"undefined":_typeof(n))&&"object"==(void 0===t?"undefined":_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},P=["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 U(e){return JSON.parse(JSON.stringify(e))}function j(e,n){return S(e,n)}function I(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 N(e){var n={};for(var t in e)e.hasOwnProperty(t)&&(n[t]={value:e[t],version:0});return n}function F(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;r.length>0;){for(t=[];i>0;){var a=r.shift();if(!a)break;(i-=D(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||"2.14.1";return e.userAgent+"/"+n}function A(e){return{"X-LaunchDarkly-User-Agent":L(e)}}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 P){var o=P[t],i=e[o];void 0!==i&&"string"!=typeof i&&((n=n||r({},e))[o]=String(i))}return n||e}var q=Object.freeze({__proto__:null,btoa:O,base64URLEncode:D,clone:U,deepEquals:j,onNextTick:I,wrapPromiseCallback:R,transformValuesToVersionedValues:N,transformVersionedValuesToValues:F,chunkUserEventsForUrl:T,getLDUserAgentString:L,getLDHeaders:A,extend:C,sanitizeUser:x}),_=2e3;function J(e,n,t,r){var o=n+"/events/bulk/"+t,i=n+"/a/"+t+".gif",a={};function u(e){(new window.Image).src=e}function s(n,t){var a=r||u,s=JSON.stringify(n);return t?function n(t){var r=C({"Content-Type":"application/json","X-LaunchDarkly-Event-Schema":"3"},A(e));return e.httpRequest("POST",o,r,s).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(i+"?d="+D(s)),Promise.resolve())}return a.sendEvents=function(t){if(!e.httpRequest)return Promise.resolve();var r,o=e.httpAllowsPost();r=o?[t]:T(_-n.length,t);for(var i=[],a=0;a<r.length;a++)i.push(s(r[a],o));return Promise.all(i)},a}function V(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 z(e){return e&&e.message?e.message:"string"==typeof e||e instanceof String?e:JSON.stringify(e)}var K=function(){return"LaunchDarkly client initialized"},$=" Please see https://docs.launchdarkly.com/docs/js-sdk-reference#section-initializing-the-client for instructions on SDK initialization.",M=function(){return"Be sure to call `identify` in the LaunchDarkly client: https://docs.launchdarkly.com/docs/js-sdk-reference#section-analytics-events"},H=function(e){return'Expected application/json content type but got "'+e+'"'},G=function(){return"localStorage is unavailable"},X=function(){return"localStorage is unavailable, so anonymous user ID cannot be cached"},B=function(e){return"network error"+(e?" ("+e+")":"")},W=function(e){return'Custom event "'+e+'" does not exist'},Q=function(){return"Environment not found. Double check that you specified a valid environment/client-side ID."+$},Y=function(){return"No environment/client-side ID was specified."+$},Z=function(e){return"Error fetching flag settings: "+z(e)},ee=function(){return"No user specified."+$},ne=function(){return"Invalid user specified."+$},te=function(){return"LaunchDarkly client was initialized with bootstrap data that did not include flag metadata. Events may not be sent correctly."+$},re=function(){return"LaunchDarkly bootstrap data is not available because the back end could not read the flags."},oe=function(e,n){return n?'[LaunchDarkly] "'+e+'" is deprecated, please use "'+n+'"':'[LaunchDarkly] "'+e+'" is deprecated'},ie=function(e,n,t){return"Received error "+e+(401===e?" (invalid SDK key)":"")+" for "+n+" - "+(f(e)?t:"giving up permanently")},ae=function(){return"Cannot make HTTP requests in this environment."+$},ue=function(){return"identify() has no effect here; it must be called on the main client instance"},se=function(){return"Closing stream connection"},ce=function(e){return"Opening stream connection to "+e},le=function(e,n){return"Error on stream connection: "+z(e)+", will continue retrying every "+n+" milliseconds."},fe=function(e){return"polling for feature flags at "+e},ve=function(){return"received ping message from stream"},de=function(){return"received streaming update for all flags"},ge=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'},pe=function(e){return'received streaming deletion for flag "'+e+'"'},he=function(e){return'received streaming deletion for flag "'+e+'" but ignored due to version check'},ye=function(e){return'enqueueing "'+e+'" event'},be=function(e){return"sending "+e+" events"},ke=Object.freeze({__proto__:null,clientInitialized:K,clientNotReady:function(){return"LaunchDarkly client is not ready"},eventWithoutUser:M,invalidContentType:H,invalidKey:function(){return"Event key must be a string"},localStorageUnavailable:G,localStorageUnavailableForUserId:X,networkError:B,unknownCustomEventKey:W,environmentNotFound:Q,environmentNotSpecified:Y,errorFetchingFlags:Z,userNotSpecified:ee,invalidUser:ne,bootstrapOldFormat:te,bootstrapInvalid:re,deprecated:oe,httpErrorMessage:ie,httpUnavailable:ae,identifyDisabled:ue,streamClosing:se,streamConnecting:ce,streamError:le,debugPolling:fe,debugStreamPing:ve,debugStreamPut:de,debugStreamPatch:ge,debugStreamPatchIgnored:me,debugStreamDelete:pe,debugStreamDeleteIgnored:he,debugEnqueueingEvent:ye,debugPostingEvents:be});function Ee(e,n,t){var r,o,a,u,s,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,l=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,v={},d=l||J(e,n.eventsUrl,t),g=(o=0,a=0,u={},(r={}).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=u[n];t?t.count=t.count+1:u[n]={count:1,key:e.key,variation:e.variation,version:e.version,value:e.value,default:e.default},(0===o||e.creationDate<o)&&(o=e.creationDate),e.creationDate>a&&(a=e.creationDate)}},r.getSummary=function(){var e={},n=!0;for(var t in u){var r=u[t],i=e[r.key];i||(i={default:r.default,counters:[]},e[r.key]=i);var s={value:r.value,count:r.count};void 0!==r.variation&&null!==r.variation&&(s.variation=r.variation),r.version?s.version=r.version:s.unknown=!0,i.counters.push(s),n=!1}return n?null:{startDate:o,endDate:a,features:e}},r.clearSummary=function(){o=0,a=0,u={}},r),p=V(n),h=n.inlineUsersInEvents,m=n.samplingInterval,y=n.flushInterval,w=n.logger,b=[],k=0,E=!1;function S(){return 0===m||0===Math.floor(Math.random()*m)}return v.enqueue=function(e){if(!E){var n,t=!1,r=!1;if(g.summarizeEvent(e),"feature"===e.kind?S()&&(t=!!e.trackEvents,r=!!(n=e).debugEventsUntilDate&&n.debugEventsUntilDate>k&&n.debugEventsUntilDate>(new Date).getTime()):t=S(),t&&b.push(function(e){var n=C({},e);return h||"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)),r){var o=C({},e,{kind:"debug"});delete o.trackEvents,delete o.debugEventsUntilDate,delete o.variation,b.push(o)}}},v.flush=function(){if(E)return Promise.resolve();var e=b,n=g.getSummary();return g.clearSummary(),n&&(n.kind="summary",e.push(n)),0===e.length?Promise.resolve():(b=[],w.debug(be(e.length)),d.sendEvents(e).then(function(e){e&&(e.serverTime&&(k=e.serverTime),f(e.status)||(E=!0),e.status>=400&&I(function(){c.maybeReportError(new i(ie(e.status,"event posting","some events were dropped")))}))}))},v.start=function(){s=setTimeout(function e(){v.flush(),s=setTimeout(e,y)},y)},v.stop=function(){clearTimeout(s)},v}function we(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}function Se(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=N(n):delete n.$schema}return n}catch(e){return i.clearFlags().then(function(){return Promise.reject(e)})}}).catch(function(e){return o.warn(G()),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(G()),Promise.reject(e)})},i.clearFlags=function(){return e.clear(a()).catch(function(e){return o.warn(G()),Promise.reject(e)})},i}var Pe="application/json";function Oe(e,n,t){var r=n.baseUrl,o=n.useReport,i=n.evaluationReasons,u=n.sendLDHeaders,s=n.logger,c={},f={};function v(n,t){if(!e.httpRequest)return new Promise(function(e,n){n(new l(ae()))});var r=t?"REPORT":"GET",o=u?A(e):{};t&&(o["Content-Type"]="application/json");var i=f[n];i||(i=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 f[n]}),f[n]=i);var s=e.httpRequest(r,n,o,t),c=s.promise.then(function(e){if(200===e.status){if(e.header("content-type")&&0===e.header("content-type").lastIndexOf(Pe))return JSON.parse(e.body);var n=H(e.header("content-type")||"");return Promise.reject(new l(n))}return Promise.reject(function(e){return 404===e.status?new a(Q()):new l(Z(e.statusText||String(e.status)))}(e))},function(e){return Promise.reject(new l(B(e)))});return i.addPromise(c,function(){s.cancel&&s.cancel()}),i.resultPromise}return c.fetchJSON=function(e){return v(r+e,null)},c.fetchFlagSettings=function(e,n){var a,u,c,l="";return o?(u=[r,"/sdk/evalx/",t,"/user"].join(""),c=JSON.stringify(e)):(a=D(JSON.stringify(e)),u=[r,"/sdk/evalx/",t,"/users/",a].join("")),n&&(l="h="+n),i&&(l=l+(l?"&":"")+"withReasons=true"),u=u+(l?"?":"")+l,s.debug(fe(u)),v(u,c)},c}for(var De=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}(),Ue=[],je=0;je<256;++je)Ue[je]=(je+256).toString(16).substr(1);var Ie,Re,Ne=function(e,n){var t=n||0,r=Ue;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("")},Fe=0,Te=0,Le=function(e,n,t){var r=n&&t||0,o=n||[],i=(e=e||{}).node||Ie,a=void 0!==e.clockseq?e.clockseq:Re;if(null==i||null==a){var u=De();null==i&&(i=Ie=[1|u[0],u[1],u[2],u[3],u[4],u[5]]),null==a&&(a=Re=16383&(u[6]<<8|u[7]))}var s=void 0!==e.msecs?e.msecs:(new Date).getTime(),c=void 0!==e.nsecs?e.nsecs:Te+1,l=s-Fe+(c-Te)/1e4;if(l<0&&void 0===e.clockseq&&(a=a+1&16383),(l<0||s>Fe)&&void 0===e.nsecs&&(c=0),c>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");Fe=s,Te=c,Re=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||Ne(o)},Ae="ld:$anonUserId";function Ce(e,n){var t={validateUser:function(t){if(!t)return Promise.reject(new u(ee()));var r=U(t);return null!==r.key&&void 0!==r.key?(r.key=r.key.toString(),Promise.resolve(r)):r.anonymous?(e?e.get(Ae).catch(function(){return null}):Promise.resolve(null)).then(function(t){if(t)return r.key=t,r;var o=Le();return r.key=o,function(t){return e?e.set(Ae,t).catch(function(){n.warn(X())}):Promise.resolve()}(o).then(function(){return r})}):Promise.reject(new u(ne()))}};return t}function xe(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}var qe="ready",_e="initialized",Je="failed",Ve="change",ze="internal-change";function Ke(n,t,o,i,u){var f,v,d,g,p=o&&o.logger?o.logger:u&&u.logger||xe("warn"),h=we(p),m=function(e,n,t,r){var o=C({logger:r},{baseUrl:"https://app.launchdarkly.com",streamUrl:"https://clientstream.launchdarkly.com",eventsUrl:"https://events.launchdarkly.com",sendEvents:!0,sendLDHeaders:!0,inlineUsersInEvents:!1,allowFrequentDuplicateEvents:!1,sendEventsOnlyForVariation:!1,useReport:!1,evaluationReasons:!1,flushInterval:2e3,samplingInterval:0,streamReconnectDelay:1e3,allAttributesPrivate:!1,privateAttributeNames:[]},t),i={all_attributes_private:"allAttributesPrivate",private_attribute_names:"privateAttributeNames",samplingInterval:null};function a(e){I(function(){n&&n.maybeReportError(new c(e))})}var u=C({},e||{});return function(e){var n=u;Object.keys(i).forEach(function(e){if(void 0!==n[e]){var t=i[e];r&&r.warn(oe(e,t)),t&&(void 0===n[t]&&(n[t]=n[e]),delete n[e])}})}(),u=function(e,n){var t=C({},u);return Object.keys(n).forEach(function(e){void 0!==t[e]&&null!==t[e]||(t[e]=n[e])}),t}(0,o),(isNaN(u.flushInterval)||u.flushInterval<2e3)&&(u.flushInterval=2e3,a("Invalid flush interval configured. Must be an integer >= 2000 (milliseconds).")),(isNaN(u.samplingInterval)||u.samplingInterval<0)&&(u.samplingInterval=0,a("Invalid sampling interval configured. Sampling interval must be an integer >= 0.")),u}(o,h,u,p),y=m.hash,w=m.sendEvents,b=n,k=function(e,n,t,r){var o=n.streamUrl,i=n.logger,a={},u=o+"/eval/"+t,s=n.useReport,c=n.evaluationReasons,l=n.streamReconnectDelay,f=!1,v=null,d=null,g=null,p=null;function h(e){f||(i.warn(le(e,l)),f=!0),w(),m(l)}function m(e){d||(e?d=setTimeout(y,e):y())}function y(){var n;d=null;var a="",l={};if(e.eventSourceFactory){for(var f in null!=r&&(a="h="+r),s?e.eventSourceAllowsReport?(n=u,l.method="REPORT",l.headers={"Content-Type":"application/json"},l.body=JSON.stringify(g)):(n=o+"/ping/"+t,a=""):n=u+"/"+D(JSON.stringify(g)),c&&(a=a+(a?"&":"")+"withReasons=true"),n=n+(a?"?":"")+a,w(),i.info(ce(n)),v=e.eventSourceFactory(n,l),p)p.hasOwnProperty(f)&&v.addEventListener(f,p[f]);v.onerror=h}}function w(){v&&(i.info(se()),v.close(),v=null)}return a.connect=function(e,n){g=e,p={};var t=function(e){p[e]=function(t){f=!1,n[e]&&n[e](t)}};for(var r in n||{})t(r);m()},a.disconnect=function(){clearTimeout(d),d=null,w()},a.isConnected=function(){return!!(v&&e.eventSourceIsActive&&e.eventSourceIsActive(v))},a}(i,m,b,y),E=m.eventProcessor||Ee(i,m,b,h),S=Oe(i,m,b),P={},O={},T=m.streaming,N=!1,L=!1,A=!0,q=m.stateProvider,_=function(e,n){var t,r={setUser:function(e){(t=x(e))&&n&&n(U(t))},getUser:function(){return t?U(t):null}};return r}(0,function(e){q||e&&z({kind:"identify",key:e.key,user:e,creationDate:(new Date).getTime()})}),J=Ce(i.localStorage,p);function z(e){b&&(q&&q.enqueueEvent&&q.enqueueEvent(e)||(e.user?(A=!1,!w||L||i.isDoNotTrack()||(p.debug(ye(e.kind)),E.enqueue(e))):A&&(p.warn(M()),A=!1)))}function V(e,n,t,r){var o=_.getUser(),i=new Date,a=n?n.value:null;if(!m.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),z(c)}function $(e,n,t,r){var o;if(O&&O.hasOwnProperty(e)&&O[e]&&!O[e].deleted){var i=O[e];o=H(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&&V(e,o,n,r),o}function H(e){return{value:e.value,variationIndex:void 0===e.variation?null:e.variation,reason:e.reason||null}}function X(){v=!0,_.getUser()&&k.connect(_.getUser(),{ping:function(){p.debug(ve()),S.fetchFlagSettings(_.getUser(),y).then(function(e){return Q(e||{})}).catch(function(e){h.maybeReportError(new l(Z(e)))})},put:function(e){var n=JSON.parse(e.data);p.debug(de()),Q(n)},patch:function(e){var n=JSON.parse(e.data),t=O[n.key];if(!t||!t.version||!n.version||t.version<n.version){p.debug(ge(n.key));var r={},o=C({},n);delete o.key,O[n.key]=o;var i=H(o);r[n.key]=t?{previous:t.value,current:i}:{current:i},ee(r)}else p.debug(me(n.key))},delete:function(e){var n=JSON.parse(e.data);if(!O[n.key]||O[n.key].version<n.version){p.debug(pe(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},ee(t)}else p.debug(he(n.key))}})}function B(){v&&(k.disconnect(),v=!1)}function Q(e){var n={};if(!e)return Promise.resolve();for(var t in O)O.hasOwnProperty(t)&&O[t]&&(e[t]&&!j(e[t].value,O[t].value)?n[t]={previous:O[t].value,current:H(e[t])}:e[t]&&!e[t].deleted||(n[t]={previous:O[t].value}));for(var o in e)e.hasOwnProperty(o)&&e[o]&&(!O[o]||O[o].deleted)&&(n[o]={current:H(e[o])});return O=r({},e),ee(n).catch(function(){})}function ee(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;h.emit(Ve+":"+n,o,i),t[n]=r?{current:o,previous:i}:{previous:i}}),h.emit(Ve,t),h.emit(ze,O),m.sendEventsOnlyForVariation||q||n.forEach(function(n){V(n,e[n].current)})}return f&&g?g.saveFlags(O).catch(function(){return null}):Promise.resolve()}function ne(){var e=T||d&&void 0===T;e&&!v?X():!e&&v&&B()}function ie(e){return e===Ve||e.substr(0,Ve.length+1)===Ve+":"}i.localStorage&&(g=new Se(i.localStorage,b,y,_,p));var ae=new Promise(function(e){var n=h.on(qe,function(){h.off(qe,n),e()})}),fe=new Promise(function(e,n){var t=h.on(_e,function(){h.off(_e,t),e()}),r=h.on(Je,function(e){h.off(Je,r),n(e)})});if("string"==typeof m.bootstrap&&"LOCALSTORAGE"===m.bootstrap.toUpperCase()&&(g?f=!0:p.warn(G())),"object"===e(m.bootstrap)&&(O=function(e){var n=Object.keys(e),t=e.$flagsState;!t&&n.length&&p.warn(te()),!1===e.$valid&&p.warn(re());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}(m.bootstrap)),q){var be=q.getInitialState();be?ke(be):q.on("init",ke),q.on("update",function(e){e.user&&_.setUser(e.user),e.flags&&Q(e.flags)})}else(n?J.validateUser(t).then(function(n){return _.setUser(n),"object"===e(m.bootstrap)?Pe():f?g.loadFlags().catch(function(){return null}).then(function(e){return null==e?(O={},S.fetchFlagSettings(_.getUser(),y).then(function(e){return Q(e||{})}).then(Pe).catch(function(e){De(new l(Z(e)))})):(O=e,I(Pe),S.fetchFlagSettings(_.getUser(),y).then(function(e){return Q(e)}).catch(function(e){return h.maybeReportError(e)}))}):S.fetchFlagSettings(_.getUser(),y).then(function(e){O=e||{},Pe()}).catch(function(e){O={},De(e)})}):Promise.reject(new a(Y()))).catch(function(e){return h.maybeReportError(e)});function ke(e){b=e.environment,_.setUser(e.user),O=r({},e.flags),I(Pe)}function Pe(){p.info(K()),N=!0,ne(),h.emit(qe),h.emit(_e)}function De(e){h.maybeReportError(e),h.emit(Je,e),h.emit(qe)}return{client:{waitForInitialization:function(){return fe},waitUntilReady:function(){return ae},identify:function(e,n,t){return L?R(Promise.resolve({}),t):q?(p.warn(ue()),R(Promise.resolve(F(O)),t)):R((f&&g?g.clearFlags():Promise.resolve()).then(function(){return J.validateUser(e)}).then(function(e){return _.setUser(e)}).then(function(){return S.fetchFlagSettings(_.getUser(),n)}).then(function(e){var n=F(e);return e?Q(e).then(function(){return n}):n}).then(function(e){return v&&X(),e}).catch(function(e){return h.maybeReportError(e),Promise.reject(e)}),t)},getUser:function(){return _.getUser()},variation:function(e,n){return $(e,n,!0,!1).value},variationDetail:function(e,n){return $(e,n,!0,!0)},track:function(e,n,t){if("string"==typeof e){i.customEventFilter&&!i.customEventFilter(e)&&p.warn(W(e));var r={kind:"custom",key:e,user:_.getUser(),url:i.getCurrentUrl(),creationDate:(new Date).getTime()};null!=n&&(r.data=n),null!=t&&(r.metricValue=t),z(r)}else h.maybeReportError(new s(W(e)))},on:function(e,n,t){ie(e)?(d=!0,N&&ne(),h.on(e,n,t)):h.on.apply(h,arguments)},off:function(e){if(h.off.apply(h,arguments),ie(e)){var n=!1;h.getEvents().forEach(function(e){ie(e)&&h.getEventListenerCount(e)>0&&(n=!0)}),n||(d=!1,v&&void 0===T&&B())}},setStreaming:function(e){var n=null===e?void 0:e;n!==T&&(T=n,ne())},flush:function(e){return R(w?E.flush():Promise.resolve(),e)},allFlags:function(){var e={};if(!O)return e;for(var n in O)O.hasOwnProperty(n)&&(e[n]=$(n,null,!m.sendEventsOnlyForVariation).value);return e},close:function(e){if(L)return R(Promise.resolve(),e);var n=function(){L=!0,O={}};return R(Promise.resolve().then(function(){if(B(),w)return E.stop(),E.flush()}).then(n).catch(n),e)}},options:m,emitter:h,ident:_,logger:p,requestor:S,start:function(){w&&E.start()},enqueueEvent:z,getFlagsInternal:function(){return O},getEnvironmentId:function(){return b},internalChangeEventName:ze}}var $e="2.14.1";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=void 0;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 _extends=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e};function makeBrowserPlatform(e){var n={synchronousFlush:!1};window.XMLHttpRequest&&(n.httpRequest=function(e,t,r,o){var i=n.synchronousFlush;return n.synchronousFlush=!1,newHttpRequest(e,t,r,o,i)});var t=void 0;n.httpAllowsPost=function(){return void 0===t&&(t=!!window.XMLHttpRequest&&"withCredentials"in new window.XMLHttpRequest),t};var r=e&&e.eventUrlTransformer;n.getCurrentUrl=function(){return r?r(window.location.href):window.location.href},n.isDoNotTrack=function(){var e=void 0;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&&(n.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){n.localStorage=null}var o=void 0;if(e&&e.useReport&&"function"==typeof window.EventSourcePolyfill&&window.EventSourcePolyfill.supportedOptions&&window.EventSourcePolyfill.supportedOptions.method?(n.eventSourceAllowsReport=!0,o=window.EventSourcePolyfill):(n.eventSourceAllowsReport=!1,o=window.EventSource),window.EventSource){n.eventSourceFactory=function(e,n){var t=_extends({},{heartbeatTimeout:3e5,silentTimeout:3e5,skipDefaultHeaders:!0},n);return new o(e,t)},n.eventSourceIsActive=function(e){return e.readyState===window.EventSource.OPEN||e.readyState===window.EventSource.CONNECTING}}return n.userAgent="JSClient",n}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=n.replace(t,"").replace(r,""),i=void 0,a=void 0;switch(e.kind){case"exact":a=n,i=new RegExp("^"+escapeStringRegexp(e.url)+"/?$");break;case"canonical":a=o,i=new RegExp("^"+escapeStringRegexp(e.url)+"/?$");break;case"substring":a=o,i=new RegExp(".*"+escapeStringRegexp(e.substring)+".*$");break;case"regex":a=o,i=new RegExp(e.pattern);break;default:return!1}return i.test(a)}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&&u.length>0;){for(var s=0;s<u.length;s++)o===u[s]&&t.push(i);o=o.parentNode}return t}function GoalTracker(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(doesUrlMatch(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=findGoalsForClick(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 locationWatcherInterval=300;function GoalManager(e,n){var t=void 0,r=void 0,o={};function i(){r&&r.dispose(),t&&t.length&&(r=GoalTracker(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=GoalTracker(t=e,a),function(e,n){var t=window.location.href,r=void 0;function o(){(r=window.location.href)!==t&&(t=r,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)}(locationWatcherInterval,i)),n()}).catch(function(t){e.emitter.maybeReportError(new v.LDUnexpectedResponseError((t&&t.message,t.message))),n()}),o}var goalsEvent="goalsReady",extraDefaults={fetchGoals:!0};function initialize(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=makeBrowserPlatform(t),o=Ke(e,n,t,r,extraDefaults),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();var l=function(){r.synchronousFlush=!0,i.flush().catch(function(){})};return window.addEventListener("beforeunload",l),window.addEventListener("unload",l),i}var createConsoleLogger=xe,version=$e;function deprecatedInitialize(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")),initialize(e,n,t)}var index={initialize:deprecatedInitialize,version:$e};export default index;export{initialize,createConsoleLogger,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"),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=[],h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",m=0,y=h.length;m<y;++m)g[m]=h[m],p[h.charCodeAt(m)]=m;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=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},P=["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 U(e){return JSON.parse(JSON.stringify(e))}function R(e,n){return S(e,n)}function j(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 N(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 L(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-=D(JSON.stringify(a)).length)<0&&t.length>0?r.unshift(a):t.push(a)}i=e,o.push(t)}return o}function F(e){var n=e.version||"2.14.1";return e.userAgent+"/"+n}function x(e){return{"X-LaunchDarkly-User-Agent":F(e)}}function A(){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 P){var o=P[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:D,clone:U,deepEquals:R,onNextTick:j,wrapPromiseCallback:I,transformValuesToVersionedValues:N,transformVersionedValuesToValues:T,chunkUserEventsForUrl:L,getLDUserAgentString:F,getLDHeaders:x,extend:A,sanitizeUser:C});var q=2e3;function J(e){return e&&e.message?e.message:"string"==typeof e||e instanceof String?e:JSON.stringify(e)}var _=function(){return"LaunchDarkly client initialized"},V=" Please see https://docs.launchdarkly.com/docs/js-sdk-reference#section-initializing-the-client for instructions on SDK initialization.",z=function(){return"Be sure to call `identify` in the LaunchDarkly client: https://docs.launchdarkly.com/docs/js-sdk-reference#section-analytics-events"},H=function(e){return'Expected application/json content type but got "'+e+'"'},$=function(){return"localStorage is unavailable"},K=function(){return"localStorage is unavailable, so anonymous user ID cannot be cached"},M=function(e){return"network error"+(e?" ("+e+")":"")},G=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."+V},B=function(){return"No environment/client-side ID was specified."+V},W=function(e){return"Error fetching flag settings: "+J(e)},Q=function(){return"No user specified."+V},Y=function(){return"Invalid user specified."+V},Z=function(){return"LaunchDarkly client was initialized with bootstrap data that did not include flag metadata. Events may not be sent correctly."+V},ee=function(){return"LaunchDarkly bootstrap data is not available because the back end could not read the flags."},ne=function(e,n){return n?'[LaunchDarkly] "'+e+'" is deprecated, please use "'+n+'"':'[LaunchDarkly] "'+e+'" is deprecated'},te=function(e,n,t){return"Received error "+e+(401===e?" (invalid SDK key)":"")+" for "+n+" - "+(f(e)?t:"giving up permanently")},re=function(){return"Cannot make HTTP requests in this environment."+V},oe=function(){return"identify() has no effect here; it must be called on the main client instance"},ie=function(){return"Closing stream connection"},ae=function(e){return"Opening stream connection to "+e},ue=function(e,n){return"Error on stream connection: "+J(e)+", will continue retrying every "+n+" milliseconds."},ce=function(e){return"polling for feature flags at "+e},se=function(){return"received ping message from stream"},le=function(){return"received streaming update for all flags"},fe=function(e){return'received streaming update for flag "'+e+'"'},ve=function(e){return'received streaming update for flag "'+e+'" but ignored due to version check'},de=function(e){return'received streaming deletion for flag "'+e+'"'},ge=function(e){return'received streaming deletion for flag "'+e+'" but ignored due to version check'},pe=function(e){return'enqueueing "'+e+'" event'},he=function(e){return"sending "+e+" events"},me=Object.freeze({__proto__:null,clientInitialized:_,clientNotReady:function(){return"LaunchDarkly client is not ready"},eventWithoutUser:z,invalidContentType:H,invalidKey:function(){return"Event key must be a string"},localStorageUnavailable:$,localStorageUnavailableForUserId:K,networkError:M,unknownCustomEventKey:G,environmentNotFound:X,environmentNotSpecified:B,errorFetchingFlags:W,userNotSpecified:Q,invalidUser:Y,bootstrapOldFormat:Z,bootstrapInvalid:ee,deprecated:ne,httpErrorMessage:te,httpUnavailable:re,identifyDisabled:oe,streamClosing:ie,streamConnecting:ae,streamError:ue,debugPolling:ce,debugStreamPing:se,debugStreamPut:le,debugStreamPatch:fe,debugStreamPatchIgnored:ve,debugStreamDelete:de,debugStreamDeleteIgnored:ge,debugEnqueueingEvent:pe,debugPostingEvents:he});function ye(e,n,t){var r,o,a,u,c,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,l=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,v={},d=l||function(e,n,t,r){var o=n+"/events/bulk/"+t,i=n+"/a/"+t+".gif",a={};function u(e){(new window.Image).src=e}function c(n,t){var a=r||u,c=JSON.stringify(n);return t?function n(t){var r=A({"Content-Type":"application/json","X-LaunchDarkly-Event-Schema":"3"},x(e));return e.httpRequest("POST",o,r,c).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(i+"?d="+D(c)),Promise.resolve())}return a.sendEvents=function(t){if(!e.httpRequest)return Promise.resolve();var r,o=e.httpAllowsPost();r=o?[t]:L(q-n.length,t);for(var i=[],a=0;a<r.length;a++)i.push(c(r[a],o));return Promise.all(i)},a}(e,n.eventsUrl,t),g=(o=0,a=0,u={},(r={}).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=u[n];t?t.count=t.count+1:u[n]={count:1,key:e.key,variation:e.variation,version:e.version,value:e.value,default:e.default},(0===o||e.creationDate<o)&&(o=e.creationDate),e.creationDate>a&&(a=e.creationDate)}},r.getSummary=function(){var e={},n=!0;for(var t in u){var r=u[t],i=e[r.key];i||(i={default:r.default,counters:[]},e[r.key]=i);var c={value:r.value,count:r.count};void 0!==r.variation&&null!==r.variation&&(c.variation=r.variation),r.version?c.version=r.version:c.unknown=!0,i.counters.push(c),n=!1}return n?null:{startDate:o,endDate:a,features:e}},r.clearSummary=function(){o=0,a=0,u={}},r),p=function(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=A({},s,l[1])}var f=Object.keys(s);return f.length&&(f.sort(),c.privateAttrs=f),c},n}(n),h=n.inlineUsersInEvents,m=n.samplingInterval,y=n.flushInterval,w=n.logger,b=[],k=0,E=!1;function S(){return 0===m||0===Math.floor(Math.random()*m)}return v.enqueue=function(e){if(!E){var n,t=!1,r=!1;if(g.summarizeEvent(e),"feature"===e.kind?S()&&(t=!!e.trackEvents,r=!!(n=e).debugEventsUntilDate&&n.debugEventsUntilDate>k&&n.debugEventsUntilDate>(new Date).getTime()):t=S(),t&&b.push(function(e){var n=A({},e);return h||"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)),r){var o=A({},e,{kind:"debug"});delete o.trackEvents,delete o.debugEventsUntilDate,delete o.variation,b.push(o)}}},v.flush=function(){if(E)return Promise.resolve();var e=b,n=g.getSummary();return g.clearSummary(),n&&(n.kind="summary",e.push(n)),0===e.length?Promise.resolve():(b=[],w.debug(he(e.length)),d.sendEvents(e).then((function(e){e&&(e.serverTime&&(k=e.serverTime),f(e.status)||(E=!0),e.status>=400&&j((function(){s.maybeReportError(new i(te(e.status,"event posting","some events were dropped")))})))})))},v.start=function(){c=setTimeout((function e(){v.flush(),c=setTimeout(e,y)}),y)},v.stop=function(){clearTimeout(c)},v}function we(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=N(n):delete n.$schema}return n}catch(e){return i.clearFlags().then((function(){return Promise.reject(e)}))}})).catch((function(e){return o.warn($()),Promise.reject(e)}))},i.saveFlags=function(n){var t=A({},n,{$schema:1});return e.set(a(),JSON.stringify(t)).catch((function(e){return o.warn($()),Promise.reject(e)}))},i.clearFlags=function(){return e.clear(a()).catch((function(e){return o.warn($()),Promise.reject(e)}))},i}var be="application/json";function ke(e,n,t){var r=n.baseUrl,o=n.useReport,i=n.evaluationReasons,u=n.sendLDHeaders,c=n.logger,s={},f={};function v(n,t){if(!e.httpRequest)return new Promise((function(e,n){n(new l(re()))}));var r=t?"REPORT":"GET",o=u?x(e):{};t&&(o["Content-Type"]="application/json");var i=f[n];i||(i=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 f[n]})),f[n]=i);var c=e.httpRequest(r,n,o,t),s=c.promise.then((function(e){if(200===e.status){if(e.header("content-type")&&0===e.header("content-type").lastIndexOf(be))return JSON.parse(e.body);var n=H(e.header("content-type")||"");return Promise.reject(new l(n))}return Promise.reject(function(e){return 404===e.status?new a(X()):new l(W(e.statusText||String(e.status)))}(e))}),(function(e){return Promise.reject(new l(M(e)))}));return i.addPromise(s,(function(){c.cancel&&c.cancel()})),i.resultPromise}return s.fetchJSON=function(e){return v(r+e,null)},s.fetchFlagSettings=function(e,n){var a,u,s,l="";return o?(u=[r,"/sdk/evalx/",t,"/user"].join(""),s=JSON.stringify(e)):(a=D(JSON.stringify(e)),u=[r,"/sdk/evalx/",t,"/users/",a].join("")),n&&(l="h="+n),i&&(l=l+(l?"&":"")+"withReasons=true"),u=u+(l?"?":"")+l,c.debug(ce(u)),v(u,s)},s}for(var Ee=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}(),Se=[],Pe=0;Pe<256;++Pe)Se[Pe]=(Pe+256).toString(16).substr(1);var Oe,De,Ue=0,Re=0,je=function(e,n,t){var r=n&&t||0,o=n||[],i=(e=e||{}).node||Oe,a=void 0!==e.clockseq?e.clockseq:De;if(null==i||null==a){var u=Ee();null==i&&(i=Oe=[1|u[0],u[1],u[2],u[3],u[4],u[5]]),null==a&&(a=De=16383&(u[6]<<8|u[7]))}var c=void 0!==e.msecs?e.msecs:(new Date).getTime(),s=void 0!==e.nsecs?e.nsecs:Re+1,l=c-Ue+(s-Re)/1e4;if(l<0&&void 0===e.clockseq&&(a=a+1&16383),(l<0||c>Ue)&&void 0===e.nsecs&&(s=0),s>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");Ue=c,Re=s,De=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=Se;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)},Ie="ld:$anonUserId";function Ne(e,n){var t={validateUser:function(t){if(!t)return Promise.reject(new u(Q()));var r=U(t);return null!==r.key&&void 0!==r.key?(r.key=r.key.toString(),Promise.resolve(r)):r.anonymous?(e?e.get(Ie).catch((function(){return null})):Promise.resolve(null)).then((function(t){if(t)return r.key=t,r;var o=je();return r.key=o,function(t){return e?e.set(Ie,t).catch((function(){n.warn(K())})):Promise.resolve()}(o).then((function(){return r}))})):Promise.reject(new u(Y()))}};return t}function Te(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}var Le="ready",Fe="initialized",xe="failed",Ae="change",Ce="internal-change";function qe(n,t,o,i,u){var f,v,d,g,p=o&&o.logger?o.logger:u&&u.logger||Te("warn"),h=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}(p),m=function(e,n,t,r){var o=A({logger:r},{baseUrl:"https://app.launchdarkly.com",streamUrl:"https://clientstream.launchdarkly.com",eventsUrl:"https://events.launchdarkly.com",sendEvents:!0,sendLDHeaders:!0,inlineUsersInEvents:!1,allowFrequentDuplicateEvents:!1,sendEventsOnlyForVariation:!1,useReport:!1,evaluationReasons:!1,flushInterval:2e3,samplingInterval:0,streamReconnectDelay:1e3,allAttributesPrivate:!1,privateAttributeNames:[]},t),i={all_attributes_private:"allAttributesPrivate",private_attribute_names:"privateAttributeNames",samplingInterval:null};function a(e){j((function(){n&&n.maybeReportError(new s(e))}))}var u=A({},e||{});return function(e){var n=e;Object.keys(i).forEach((function(e){if(void 0!==n[e]){var t=i[e];r&&r.warn(ne(e,t)),t&&(void 0===n[t]&&(n[t]=n[e]),delete n[e])}}))}(u),u=function(e,n){var t=A({},e);return Object.keys(n).forEach((function(e){void 0!==t[e]&&null!==t[e]||(t[e]=n[e])})),t}(u,o),(isNaN(u.flushInterval)||u.flushInterval<2e3)&&(u.flushInterval=2e3,a("Invalid flush interval configured. Must be an integer >= 2000 (milliseconds).")),(isNaN(u.samplingInterval)||u.samplingInterval<0)&&(u.samplingInterval=0,a("Invalid sampling interval configured. Sampling interval must be an integer >= 0.")),u}(o,h,u,p),y=m.hash,w=m.sendEvents,b=n,k=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=!1,v=null,d=null,g=null,p=null;function h(e){f||(i.warn(ue(e,l)),f=!0),w(),m(l)}function m(e){d||(e?d=setTimeout(y,e):y())}function y(){var n;d=null;var a="",l={};if(e.eventSourceFactory){for(var f in null!=r&&(a="h="+r),c?e.eventSourceAllowsReport?(n=u,l.method="REPORT",l.headers={"Content-Type":"application/json"},l.body=JSON.stringify(g)):(n=o+"/ping/"+t,a=""):n=u+"/"+D(JSON.stringify(g)),s&&(a=a+(a?"&":"")+"withReasons=true"),n=n+(a?"?":"")+a,w(),i.info(ae(n)),v=e.eventSourceFactory(n,l),p)p.hasOwnProperty(f)&&v.addEventListener(f,p[f]);v.onerror=h}}function w(){v&&(i.info(ie()),v.close(),v=null)}return a.connect=function(e,n){g=e,p={};var t=function(e){p[e]=function(t){f=!1,n[e]&&n[e](t)}};for(var r in n||{})t(r);m()},a.disconnect=function(){clearTimeout(d),d=null,w()},a.isConnected=function(){return!!(v&&e.eventSourceIsActive&&e.eventSourceIsActive(v))},a}(i,m,b,y),E=m.eventProcessor||ye(i,m,b,h),S=ke(i,m,b),P={},O={},N=m.streaming,L=!1,F=!1,x=!0,q=m.stateProvider,J=function(e,n){var t,r={setUser:function(e){(t=C(e))&&n&&n(U(t))},getUser:function(){return t?U(t):null}};return r}(0,(function(e){q||e&&H({kind:"identify",key:e.key,user:e,creationDate:(new Date).getTime()})})),V=Ne(i.localStorage,p);function H(e){b&&(q&&q.enqueueEvent&&q.enqueueEvent(e)||(e.user?(x=!1,!w||F||i.isDoNotTrack()||(p.debug(pe(e.kind)),E.enqueue(e))):x&&(p.warn(z()),x=!1)))}function K(e,n,t,r){var o=J.getUser(),i=new Date,a=n?n.value:null;if(!m.allowFrequentDuplicateEvents){var u=JSON.stringify(a)+(o&&o.key?o.key:"")+e,c=P[u];if(c&&i-c<3e5)return;P[u]=i}var s={kind:"feature",key:e,user:o,value:a,variation:n?n.variationIndex:null,default:t,creationDate:i.getTime()},l=O[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 M(e,n,t,r){var o;if(O&&O.hasOwnProperty(e)&&O[e]&&!O[e].deleted){var i=O[e];o=X(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&&K(e,o,n,r),o}function X(e){return{value:e.value,variationIndex:void 0===e.variation?null:e.variation,reason:e.reason||null}}function Q(){v=!0,J.getUser()&&k.connect(J.getUser(),{ping:function(){p.debug(se()),S.fetchFlagSettings(J.getUser(),y).then((function(e){return te(e||{})})).catch((function(e){h.maybeReportError(new l(W(e)))}))},put:function(e){var n=JSON.parse(e.data);p.debug(le()),te(n)},patch:function(e){var n=JSON.parse(e.data),t=O[n.key];if(!t||!t.version||!n.version||t.version<n.version){p.debug(fe(n.key));var r={},o=A({},n);delete o.key,O[n.key]=o;var i=X(o);r[n.key]=t?{previous:t.value,current:i}:{current:i},re(r)}else p.debug(ve(n.key))},delete:function(e){var n=JSON.parse(e.data);if(!O[n.key]||O[n.key].version<n.version){p.debug(de(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},re(t)}else p.debug(ge(n.key))}})}function Y(){v&&(k.disconnect(),v=!1)}function te(e){var n={};if(!e)return Promise.resolve();for(var t in O)O.hasOwnProperty(t)&&O[t]&&(e[t]&&!R(e[t].value,O[t].value)?n[t]={previous:O[t].value,current:X(e[t])}:e[t]&&!e[t].deleted||(n[t]={previous:O[t].value}));for(var o in e)e.hasOwnProperty(o)&&e[o]&&(!O[o]||O[o].deleted)&&(n[o]={current:X(e[o])});return O=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;h.emit(Ae+":"+n,o,i),t[n]=r?{current:o,previous:i}:{previous:i}})),h.emit(Ae,t),h.emit(Ce,O),m.sendEventsOnlyForVariation||q||n.forEach((function(n){K(n,e[n].current)}))}return f&&g?g.saveFlags(O).catch((function(){return null})):Promise.resolve()}function ce(){var e=N||d&&void 0===N;e&&!v?Q():!e&&v&&Y()}function he(e){return e===Ae||e.substr(0,Ae.length+1)===Ae+":"}i.localStorage&&(g=new we(i.localStorage,b,y,J,p));var me=new Promise((function(e){var n=h.on(Le,(function(){h.off(Le,n),e()}))})),be=new Promise((function(e,n){var t=h.on(Fe,(function(){h.off(Fe,t),e()})),r=h.on(xe,(function(e){h.off(xe,r),n(e)}))}));if("string"==typeof m.bootstrap&&"LOCALSTORAGE"===m.bootstrap.toUpperCase()&&(g?f=!0:p.warn($())),"object"===e(m.bootstrap)&&(O=function(e){var n=Object.keys(e),t=e.$flagsState;!t&&n.length&&p.warn(Z()),!1===e.$valid&&p.warn(ee());var r={};return n.forEach((function(n){if("$flagsState"!==n&&"$valid"!==n){var o={value:e[n]};t&&t[n]?o=A(o,t[n]):o.version=0,r[n]=o}})),r}(m.bootstrap)),q){var Ee=q.getInitialState();Ee?Se(Ee):q.on("init",Se),q.on("update",(function(e){e.user&&J.setUser(e.user),e.flags&&te(e.flags)}))}else(n?V.validateUser(t).then((function(n){return J.setUser(n),"object"===e(m.bootstrap)?Pe():f?g.loadFlags().catch((function(){return null})).then((function(e){return null==e?(O={},S.fetchFlagSettings(J.getUser(),y).then((function(e){return te(e||{})})).then(Pe).catch((function(e){Oe(new l(W(e)))}))):(O=e,j(Pe),S.fetchFlagSettings(J.getUser(),y).then((function(e){return te(e)})).catch((function(e){return h.maybeReportError(e)})))})):S.fetchFlagSettings(J.getUser(),y).then((function(e){O=e||{},Pe()})).catch((function(e){O={},Oe(e)}))})):Promise.reject(new a(B()))).catch((function(e){return h.maybeReportError(e)}));function Se(e){b=e.environment,J.setUser(e.user),O=r({},e.flags),j(Pe)}function Pe(){p.info(_()),L=!0,ce(),h.emit(Le),h.emit(Fe)}function Oe(e){h.maybeReportError(e),h.emit(xe,e),h.emit(Le)}return{client:{waitForInitialization:function(){return be},waitUntilReady:function(){return me},identify:function(e,n,t){return F?I(Promise.resolve({}),t):q?(p.warn(oe()),I(Promise.resolve(T(O)),t)):I((f&&g?g.clearFlags():Promise.resolve()).then((function(){return V.validateUser(e)})).then((function(e){return J.setUser(e)})).then((function(){return S.fetchFlagSettings(J.getUser(),n)})).then((function(e){var n=T(e);return e?te(e).then((function(){return n})):n})).then((function(e){return v&&Q(),e})).catch((function(e){return h.maybeReportError(e),Promise.reject(e)})),t)},getUser:function(){return J.getUser()},variation:function(e,n){return M(e,n,!0,!1).value},variationDetail:function(e,n){return M(e,n,!0,!0)},track:function(e,n,t){if("string"==typeof e){i.customEventFilter&&!i.customEventFilter(e)&&p.warn(G(e));var r={kind:"custom",key:e,user:J.getUser(),url:i.getCurrentUrl(),creationDate:(new Date).getTime()};null!=n&&(r.data=n),null!=t&&(r.metricValue=t),H(r)}else h.maybeReportError(new c(G(e)))},on:function(e,n,t){he(e)?(d=!0,L&&ce(),h.on(e,n,t)):h.on.apply(h,arguments)},off:function(e){if(h.off.apply(h,arguments),he(e)){var n=!1;h.getEvents().forEach((function(e){he(e)&&h.getEventListenerCount(e)>0&&(n=!0)})),n||(d=!1,v&&void 0===N&&Y())}},setStreaming:function(e){var n=null===e?void 0:e;n!==N&&(N=n,ce())},flush:function(e){return I(w?E.flush():Promise.resolve(),e)},allFlags:function(){var e={};if(!O)return e;for(var n in O)O.hasOwnProperty(n)&&(e[n]=M(n,null,!m.sendEventsOnlyForVariation).value);return e},close:function(e){if(F)return I(Promise.resolve(),e);var n=function(){F=!0,O={}};return I(Promise.resolve().then((function(){if(Y(),w)return E.stop(),E.flush()})).then(n).catch(n),e)}},options:m,emitter:h,ident:J,logger:p,requestor:S,start:function(){w&&E.start()},enqueueEvent:H,getFlagsInternal:function(){return O},getEnvironmentId:function(){return b},internalChangeEventName:Ce}}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 _e(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 Ve={promise:Promise.resolve({status:200,header:function(){return null},body:null})};function ze(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 Ve;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),Ve;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 He(e){var n,t={};t.synchronousFlush=!1,window.XMLHttpRequest&&(t.httpRequest=function(e,n,r,o){var i=t.synchronousFlush;return t.synchronousFlush=!1,ze(e,n,r,o,i)}),t.httpAllowsPost=function(){return void 0===n&&(n=!!window.XMLHttpRequest&&"withCredentials"in new window.XMLHttpRequest),n};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?_e(t,!0).forEach((function(n){Je(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):_e(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 $e=/[|\\{}()[\]^$+*?.]/g,Ke=function(e){if("string"!=typeof e)throw new TypeError("Expected a string");return e.replace($e,"\\$&")};function Me(e,n,t,r){var o,i,a=n.replace(t,"").replace(r,"");switch(e.kind){case"exact":i=n,o=new RegExp("^"+Ke(e.url)+"/?$");break;case"canonical":i=a,o=new RegExp("^"+Ke(e.url)+"/?$");break;case"substring":i=a,o=new RegExp(".*"+Ke(e.substring)+".*$");break;case"regex":i=a,o=new RegExp(e.pattern);break;default:return!1}return o.test(i)}function Ge(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(Me(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 Xe=300;function Be(e,n){var t,r,o={};function i(){r&&r.dispose(),t&&t.length&&(r=Ge(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=Ge(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)}(Xe,i)),n()})).catch((function(t){e.emitter.maybeReportError(new v.LDUnexpectedResponseError((t&&t.message,t.message))),n()})),o}var We="goalsReady",Qe={fetchGoals:!0};function Ye(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=He(t),o=qe(e,n,t,r,Qe),i=o.client,a=o.options,u=o.emitter,c=new Promise((function(e){var n=u.on(We,(function(){u.off(We,n),e()}))}));if(i.waitUntilGoalsReady=function(){return c},a.fetchGoals){var s=Be(o,(function(){return u.emit(We)}));r.customEventFilter=s.goalKeyExists}else u.emit(We);"complete"!==document.readyState?window.addEventListener("load",o.start):o.start();var l=function(){r.synchronousFlush=!0,i.flush().catch((function(){}))};return window.addEventListener("beforeunload",l),window.addEventListener("unload",l),i}var Ze=Te,en="2.15.2";var nn={initialize:function(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return console&&console.warn&&console.warn(me.deprecated("default export","named LDClient export")),Ye(e,n,t)},version:"2.15.2"};export default nn;export{Ze as createConsoleLogger,Ye as initialize,en 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.LDClient={})}(this,function(e){"use strict";var n="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};function t(e){return(t="function"==typeof Symbol&&"symbol"==n(Symbol.iterator)?function(e){return void 0===e?"undefined":n(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":void 0===e?"undefined":n(e)})(e)}function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(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 i(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?o(t,!0).forEach(function(n){r(e,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):o(t).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})}return e}function a(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 u=a("LaunchDarklyUnexpectedResponseError"),s=a("LaunchDarklyInvalidEnvironmentIdError"),c=a("LaunchDarklyInvalidUserError"),l=a("LaunchDarklyInvalidEventKeyError"),f=a("LaunchDarklyInvalidArgumentError"),v=a("LaunchDarklyFlagFetchError");function d(e){return!(e>=400&&e<500)||400===e||408===e||429===e}for(var g=Object.freeze({__proto__:null,LDUnexpectedResponseError:u,LDInvalidEnvironmentIdError:s,LDInvalidUserError:c,LDInvalidEventKeyError:l,LDInvalidArgumentError:f,LDFlagFetchError:v,isHttpErrorRecoverable:d}),p=function(e){for(var n,t=e.length,r=t%3,o=[],i=0,a=t-r;i<a;i+=16383)o.push(k(e,i,i+16383>a?a:i+16383));return 1===r?(n=e[t-1],o.push(m[n>>2]+m[n<<4&63]+"==")):2===r&&(n=(e[t-2]<<8)+e[t-1],o.push(m[n>>10]+m[n>>4&63]+m[n<<2&63]+"=")),o.join("")},m=[],h=[],y="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",w=0,b=y.length;w<b;++w)m[w]=y[w],h[y.charCodeAt(w)]=w;function k(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(m[(o=r)>>18&63]+m[o>>12&63]+m[o>>6&63]+m[63&o]);return i.join("")}h["-".charCodeAt(0)]=62,h["_".charCodeAt(0)]=63;var E=Array.isArray,S=Object.keys,P=Object.prototype.hasOwnProperty,O=function e(t,r){if(t===r)return!0;if(t&&r&&"object"==(void 0===t?"undefined":n(t))&&"object"==(void 0===r?"undefined":n(r))){var o,i,a,u=E(t),s=E(r);if(u&&s){if((i=t.length)!=r.length)return!1;for(o=i;0!=o--;)if(!e(t[o],r[o]))return!1;return!0}if(u!=s)return!1;var c=t instanceof Date,l=r instanceof Date;if(c!=l)return!1;if(c&&l)return t.getTime()==r.getTime();var f=t instanceof RegExp,v=r instanceof RegExp;if(f!=v)return!1;if(f&&v)return t.toString()==r.toString();var d=S(t);if((i=d.length)!==S(r).length)return!1;for(o=i;0!=o--;)if(!P.call(r,d[o]))return!1;for(o=i;0!=o--;)if(!e(t[a=d[o]],r[a]))return!1;return!0}return t!=t&&r!=r},D=["key","secondary","ip","country","email","firstName","lastName","avatar","name"];function U(e){var n=unescape(encodeURIComponent(e));return p(function(e){for(var n=[],t=0;t<e.length;t++)n.push(e.charCodeAt(t));return n}(n))}function R(e){return U(e).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function j(e){return JSON.parse(JSON.stringify(e))}function I(e,n){return O(e,n)}function N(e){setTimeout(e,0)}function T(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 L(e){var n={};for(var t in e)e.hasOwnProperty(t)&&(n[t]={value:e[t],version:0});return n}function F(e){var n={};for(var t in e)e.hasOwnProperty(t)&&(n[t]=e[t].value);return n}function x(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-=R(JSON.stringify(a)).length)<0&&t.length>0?r.unshift(a):t.push(a)}i=e,o.push(t)}return o}function A(e){var n=e.version||"2.14.1";return e.userAgent+"/"+n}function C(e){return{"X-LaunchDarkly-User-Agent":A(e)}}function q(){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 i({},e,{},n)},{})}function _(e){if(!e)return e;var n;for(var t in D){var r=D[t],o=e[r];void 0!==o&&"string"!=typeof o&&((n=n||i({},e))[r]=String(o))}return n||e}Object.freeze({__proto__:null,btoa:U,base64URLEncode:R,clone:j,deepEquals:I,onNextTick:N,wrapPromiseCallback:T,transformValuesToVersionedValues:L,transformVersionedValuesToValues:F,chunkUserEventsForUrl:x,getLDUserAgentString:A,getLDHeaders:C,extend:q,sanitizeUser:_});var J=2e3;function V(e){return e&&e.message?e.message:"string"==typeof e||e instanceof String?e:JSON.stringify(e)}var z=function(){return"LaunchDarkly client initialized"},H=" Please see https://docs.launchdarkly.com/docs/js-sdk-reference#section-initializing-the-client for instructions on SDK initialization.",$=function(){return"Be sure to call `identify` in the LaunchDarkly client: https://docs.launchdarkly.com/docs/js-sdk-reference#section-analytics-events"},M=function(e){return'Expected application/json content type but got "'+e+'"'},K=function(){return"localStorage is unavailable"},G=function(){return"localStorage is unavailable, so anonymous user ID cannot be cached"},X=function(e){return"network error"+(e?" ("+e+")":"")},B=function(e){return'Custom event "'+e+'" does not exist'},W=function(){return"Environment not found. Double check that you specified a valid environment/client-side ID."+H},Q=function(){return"No environment/client-side ID was specified."+H},Y=function(e){return"Error fetching flag settings: "+V(e)},Z=function(){return"No user specified."+H},ee=function(){return"Invalid user specified."+H},ne=function(){return"LaunchDarkly client was initialized with bootstrap data that did not include flag metadata. Events may not be sent correctly."+H},te=function(){return"LaunchDarkly bootstrap data is not available because the back end could not read the flags."},re=function(e,n){return n?'[LaunchDarkly] "'+e+'" is deprecated, please use "'+n+'"':'[LaunchDarkly] "'+e+'" is deprecated'},oe=function(e,n,t){return"Received error "+e+(401===e?" (invalid SDK key)":"")+" for "+n+" - "+(d(e)?t:"giving up permanently")},ie=function(){return"Cannot make HTTP requests in this environment."+H},ae=function(){return"identify() has no effect here; it must be called on the main client instance"},ue=function(){return"Closing stream connection"},se=function(e){return"Opening stream connection to "+e},ce=function(e,n){return"Error on stream connection: "+V(e)+", will continue retrying every "+n+" milliseconds."},le=function(e){return"polling for feature flags at "+e},fe=function(){return"received ping message from stream"},ve=function(){return"received streaming update for all flags"},de=function(e){return'received streaming update for flag "'+e+'"'},ge=function(e){return'received streaming update for flag "'+e+'" but ignored due to version check'},pe=function(e){return'received streaming deletion for flag "'+e+'"'},me=function(e){return'received streaming deletion for flag "'+e+'" but ignored due to version check'},he=function(e){return'enqueueing "'+e+'" event'},ye=function(e){return"sending "+e+" events"},we=Object.freeze({__proto__:null,clientInitialized:z,clientNotReady:function(){return"LaunchDarkly client is not ready"},eventWithoutUser:$,invalidContentType:M,invalidKey:function(){return"Event key must be a string"},localStorageUnavailable:K,localStorageUnavailableForUserId:G,networkError:X,unknownCustomEventKey:B,environmentNotFound:W,environmentNotSpecified:Q,errorFetchingFlags:Y,userNotSpecified:Z,invalidUser:ee,bootstrapOldFormat:ne,bootstrapInvalid:te,deprecated:re,httpErrorMessage:oe,httpUnavailable:ie,identifyDisabled:ae,streamClosing:ue,streamConnecting:se,streamError:ce,debugPolling:le,debugStreamPing:fe,debugStreamPut:ve,debugStreamPatch:de,debugStreamPatchIgnored:ge,debugStreamDelete:pe,debugStreamDeleteIgnored:me,debugEnqueueingEvent:he,debugPostingEvents:ye});function be(e,n,t){var r,o,i,a,s,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,l=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,f={},v=l||function(e,n,t,r){var o=n+"/events/bulk/"+t,i=n+"/a/"+t+".gif",a={};function u(e){(new window.Image).src=e}function s(n,t){var a=r||u,s=JSON.stringify(n);return t?function n(t){var r=q({"Content-Type":"application/json","X-LaunchDarkly-Event-Schema":"3"},C(e));return e.httpRequest("POST",o,r,s).promise.then(function(e){if(e)return e.status>=400&&d(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(i+"?d="+R(s)),Promise.resolve())}return a.sendEvents=function(t){if(!e.httpRequest)return Promise.resolve();var r,o=e.httpAllowsPost();r=o?[t]:x(J-n.length,t);for(var i=[],a=0;a<r.length;a++)i.push(s(r[a],o));return Promise.all(i)},a}(e,n.eventsUrl,t),g=(o=0,i=0,a={},(r={}).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=a[n];t?t.count=t.count+1:a[n]={count:1,key:e.key,variation:e.variation,version:e.version,value:e.value,default:e.default},(0===o||e.creationDate<o)&&(o=e.creationDate),e.creationDate>i&&(i=e.creationDate)}},r.getSummary=function(){var e={},n=!0;for(var t in a){var r=a[t],u=e[r.key];u||(u={default:r.default,counters:[]},e[r.key]=u);var s={value:r.value,count:r.count};void 0!==r.variation&&null!==r.variation&&(s.variation=r.variation),r.version?s.version=r.version:s.unknown=!0,u.counters.push(s),n=!1}return n?null:{startDate:o,endDate:i,features:e}},r.clearSummary=function(){o=0,i=0,a={}},r),p=function(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=q({},c,l[1])}var f=Object.keys(c);return f.length&&(f.sort(),s.privateAttrs=f),s},n}(n),m=n.inlineUsersInEvents,h=n.samplingInterval,y=n.flushInterval,w=n.logger,b=[],k=0,E=!1;function S(){return 0===h||0===Math.floor(Math.random()*h)}return f.enqueue=function(e){if(!E){var n,t=!1,r=!1;if(g.summarizeEvent(e),"feature"===e.kind?S()&&(t=!!e.trackEvents,r=!!(n=e).debugEventsUntilDate&&n.debugEventsUntilDate>k&&n.debugEventsUntilDate>(new Date).getTime()):t=S(),t&&b.push(function(e){var n=q({},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)),r){var o=q({},e,{kind:"debug"});delete o.trackEvents,delete o.debugEventsUntilDate,delete o.variation,b.push(o)}}},f.flush=function(){if(E)return Promise.resolve();var e=b,n=g.getSummary();return g.clearSummary(),n&&(n.kind="summary",e.push(n)),0===e.length?Promise.resolve():(b=[],w.debug(ye(e.length)),v.sendEvents(e).then(function(e){e&&(e.serverTime&&(k=e.serverTime),d(e.status)||(E=!0),e.status>=400&&N(function(){c.maybeReportError(new u(oe(e.status,"event posting","some events were dropped")))}))}))},f.start=function(){s=setTimeout(function e(){f.flush(),s=setTimeout(e,y)},y)},f.stop=function(){clearTimeout(s)},f}function ke(e,n,t,r,o){var i={};function a(){var e="",o=r.getUser();return o&&(e=t||U(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=L(n):delete n.$schema}return n}catch(e){return i.clearFlags().then(function(){return Promise.reject(e)})}}).catch(function(e){return o.warn(K()),Promise.reject(e)})},i.saveFlags=function(n){var t=q({},n,{$schema:1});return e.set(a(),JSON.stringify(t)).catch(function(e){return o.warn(K()),Promise.reject(e)})},i.clearFlags=function(){return e.clear(a()).catch(function(e){return o.warn(K()),Promise.reject(e)})},i}var Ee="application/json";function Se(e,n,t){var r=n.baseUrl,o=n.useReport,i=n.evaluationReasons,a=n.sendLDHeaders,u=n.logger,c={},l={};function f(n,t){if(!e.httpRequest)return new Promise(function(e,n){n(new v(ie()))});var r=t?"REPORT":"GET",o=a?C(e):{};t&&(o["Content-Type"]="application/json");var i=l[n];i||(i=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 l[n]}),l[n]=i);var u=e.httpRequest(r,n,o,t),c=u.promise.then(function(e){if(200===e.status){if(e.header("content-type")&&0===e.header("content-type").lastIndexOf(Ee))return JSON.parse(e.body);var n=M(e.header("content-type")||"");return Promise.reject(new v(n))}return Promise.reject(function(e){return 404===e.status?new s(W()):new v(Y(e.statusText||String(e.status)))}(e))},function(e){return Promise.reject(new v(X(e)))});return i.addPromise(c,function(){u.cancel&&u.cancel()}),i.resultPromise}return c.fetchJSON=function(e){return f(r+e,null)},c.fetchFlagSettings=function(e,n){var a,s,c,l="";return o?(s=[r,"/sdk/evalx/",t,"/user"].join(""),c=JSON.stringify(e)):(a=R(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(le(s)),f(s,c)},c}for(var Pe=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}(),Oe=[],De=0;De<256;++De)Oe[De]=(De+256).toString(16).substr(1);var Ue,Re,je=0,Ie=0,Ne=function(e,n,t){var r=n&&t||0,o=n||[],i=(e=e||{}).node||Ue,a=void 0!==e.clockseq?e.clockseq:Re;if(null==i||null==a){var u=Pe();null==i&&(i=Ue=[1|u[0],u[1],u[2],u[3],u[4],u[5]]),null==a&&(a=Re=16383&(u[6]<<8|u[7]))}var s=void 0!==e.msecs?e.msecs:(new Date).getTime(),c=void 0!==e.nsecs?e.nsecs:Ie+1,l=s-je+(c-Ie)/1e4;if(l<0&&void 0===e.clockseq&&(a=a+1&16383),(l<0||s>je)&&void 0===e.nsecs&&(c=0),c>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");je=s,Ie=c,Re=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=Oe;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)},Te="ld:$anonUserId";function Le(e,n){var t={validateUser:function(t){if(!t)return Promise.reject(new c(Z()));var r=j(t);return null!==r.key&&void 0!==r.key?(r.key=r.key.toString(),Promise.resolve(r)):r.anonymous?(e?e.get(Te).catch(function(){return null}):Promise.resolve(null)).then(function(t){if(t)return r.key=t,r;var o=Ne();return r.key=o,function(t){return e?e.set(Te,t).catch(function(){n.warn(G())}):Promise.resolve()}(o).then(function(){return r})}):Promise.reject(new c(ee()))}};return t}function Fe(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}var xe="ready",Ae="initialized",Ce="failed",qe="change",_e="internal-change";function Je(e,n,r,o,a){var u,c,d,g,p=r&&r.logger?r.logger:a&&a.logger||Fe("warn"),m=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}(p),h=function(e,n,t,r){var o=q({logger:r},{baseUrl:"https://app.launchdarkly.com",streamUrl:"https://clientstream.launchdarkly.com",eventsUrl:"https://events.launchdarkly.com",sendEvents:!0,sendLDHeaders:!0,inlineUsersInEvents:!1,allowFrequentDuplicateEvents:!1,sendEventsOnlyForVariation:!1,useReport:!1,evaluationReasons:!1,flushInterval:2e3,samplingInterval:0,streamReconnectDelay:1e3,allAttributesPrivate:!1,privateAttributeNames:[]},t),i={all_attributes_private:"allAttributesPrivate",private_attribute_names:"privateAttributeNames",samplingInterval:null};function a(e){N(function(){n&&n.maybeReportError(new f(e))})}var u=q({},e||{});return function(e){var n=u;Object.keys(i).forEach(function(e){if(void 0!==n[e]){var t=i[e];r&&r.warn(re(e,t)),t&&(void 0===n[t]&&(n[t]=n[e]),delete n[e])}})}(),u=function(e,n){var t=q({},u);return Object.keys(n).forEach(function(e){void 0!==t[e]&&null!==t[e]||(t[e]=n[e])}),t}(0,o),(isNaN(u.flushInterval)||u.flushInterval<2e3)&&(u.flushInterval=2e3,a("Invalid flush interval configured. Must be an integer >= 2000 (milliseconds).")),(isNaN(u.samplingInterval)||u.samplingInterval<0)&&(u.samplingInterval=0,a("Invalid sampling interval configured. Sampling interval must be an integer >= 0.")),u}(r,m,a,p),y=h.hash,w=h.sendEvents,b=e,k=function(e,n,t,r){var o=n.streamUrl,i=n.logger,a={},u=o+"/eval/"+t,s=n.useReport,c=n.evaluationReasons,l=n.streamReconnectDelay,f=!1,v=null,d=null,g=null,p=null;function m(e){f||(i.warn(ce(e,l)),f=!0),w(),h(l)}function h(e){d||(e?d=setTimeout(y,e):y())}function y(){var n;d=null;var a="",l={};if(e.eventSourceFactory){for(var f in null!=r&&(a="h="+r),s?e.eventSourceAllowsReport?(n=u,l.method="REPORT",l.headers={"Content-Type":"application/json"},l.body=JSON.stringify(g)):(n=o+"/ping/"+t,a=""):n=u+"/"+R(JSON.stringify(g)),c&&(a=a+(a?"&":"")+"withReasons=true"),n=n+(a?"?":"")+a,w(),i.info(se(n)),v=e.eventSourceFactory(n,l),p)p.hasOwnProperty(f)&&v.addEventListener(f,p[f]);v.onerror=m}}function w(){v&&(i.info(ue()),v.close(),v=null)}return a.connect=function(e,n){g=e,p={};var t=function(e){p[e]=function(t){f=!1,n[e]&&n[e](t)}};for(var r in n||{})t(r);h()},a.disconnect=function(){clearTimeout(d),d=null,w()},a.isConnected=function(){return!!(v&&e.eventSourceIsActive&&e.eventSourceIsActive(v))},a}(o,h,b,y),E=h.eventProcessor||be(o,h,b,m),S=Se(o,h,b),P={},O={},D=h.streaming,U=!1,L=!1,x=!0,A=h.stateProvider,C=function(e,n){var t,r={setUser:function(e){(t=_(e))&&n&&n(j(t))},getUser:function(){return t?j(t):null}};return r}(0,function(e){A||e&&V({kind:"identify",key:e.key,user:e,creationDate:(new Date).getTime()})}),J=Le(o.localStorage,p);function V(e){b&&(A&&A.enqueueEvent&&A.enqueueEvent(e)||(e.user?(x=!1,!w||L||o.isDoNotTrack()||(p.debug(he(e.kind)),E.enqueue(e))):x&&(p.warn($()),x=!1)))}function H(e,n,t,r){var o=C.getUser(),i=new Date,a=n?n.value:null;if(!h.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),V(c)}function M(e,n,t,r){var o;if(O&&O.hasOwnProperty(e)&&O[e]&&!O[e].deleted){var i=O[e];o=G(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&&H(e,o,n,r),o}function G(e){return{value:e.value,variationIndex:void 0===e.variation?null:e.variation,reason:e.reason||null}}function X(){c=!0,C.getUser()&&k.connect(C.getUser(),{ping:function(){p.debug(fe()),S.fetchFlagSettings(C.getUser(),y).then(function(e){return Z(e||{})}).catch(function(e){m.maybeReportError(new v(Y(e)))})},put:function(e){var n=JSON.parse(e.data);p.debug(ve()),Z(n)},patch:function(e){var n=JSON.parse(e.data),t=O[n.key];if(!t||!t.version||!n.version||t.version<n.version){p.debug(de(n.key));var r={},o=q({},n);delete o.key,O[n.key]=o;var i=G(o);r[n.key]=t?{previous:t.value,current:i}:{current:i},ee(r)}else p.debug(ge(n.key))},delete:function(e){var n=JSON.parse(e.data);if(!O[n.key]||O[n.key].version<n.version){p.debug(pe(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},ee(t)}else p.debug(me(n.key))}})}function W(){c&&(k.disconnect(),c=!1)}function Z(e){var n={};if(!e)return Promise.resolve();for(var t in O)O.hasOwnProperty(t)&&O[t]&&(e[t]&&!I(e[t].value,O[t].value)?n[t]={previous:O[t].value,current:G(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:G(e[r])});return O=i({},e),ee(n).catch(function(){})}function ee(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;m.emit(qe+":"+n,o,i),t[n]=r?{current:o,previous:i}:{previous:i}}),m.emit(qe,t),m.emit(_e,O),h.sendEventsOnlyForVariation||A||n.forEach(function(n){H(n,e[n].current)})}return u&&g?g.saveFlags(O).catch(function(){return null}):Promise.resolve()}function oe(){var e=D||d&&void 0===D;e&&!c?X():!e&&c&&W()}function ie(e){return e===qe||e.substr(0,qe.length+1)===qe+":"}o.localStorage&&(g=new ke(o.localStorage,b,y,C,p));var le=new Promise(function(e){var n=m.on(xe,function(){m.off(xe,n),e()})}),ye=new Promise(function(e,n){var t=m.on(Ae,function(){m.off(Ae,t),e()}),r=m.on(Ce,function(e){m.off(Ce,r),n(e)})});if("string"==typeof h.bootstrap&&"LOCALSTORAGE"===h.bootstrap.toUpperCase()&&(g?u=!0:p.warn(K())),"object"===t(h.bootstrap)&&(O=function(e){var n=Object.keys(e),t=e.$flagsState;!t&&n.length&&p.warn(ne()),!1===e.$valid&&p.warn(te());var r={};return n.forEach(function(n){if("$flagsState"!==n&&"$valid"!==n){var o={value:e[n]};t&&t[n]?o=q(o,t[n]):o.version=0,r[n]=o}}),r}(h.bootstrap)),A){var we=A.getInitialState();we?Ee(we):A.on("init",Ee),A.on("update",function(e){e.user&&C.setUser(e.user),e.flags&&Z(e.flags)})}else(e?J.validateUser(n).then(function(e){return C.setUser(e),"object"===t(h.bootstrap)?Pe():u?g.loadFlags().catch(function(){return null}).then(function(e){return null==e?(O={},S.fetchFlagSettings(C.getUser(),y).then(function(e){return Z(e||{})}).then(Pe).catch(function(e){Oe(new v(Y(e)))})):(O=e,N(Pe),S.fetchFlagSettings(C.getUser(),y).then(function(e){return Z(e)}).catch(function(e){return m.maybeReportError(e)}))}):S.fetchFlagSettings(C.getUser(),y).then(function(e){O=e||{},Pe()}).catch(function(e){O={},Oe(e)})}):Promise.reject(new s(Q()))).catch(function(e){return m.maybeReportError(e)});function Ee(e){b=e.environment,C.setUser(e.user),O=i({},e.flags),N(Pe)}function Pe(){p.info(z()),U=!0,oe(),m.emit(xe),m.emit(Ae)}function Oe(e){m.maybeReportError(e),m.emit(Ce,e),m.emit(xe)}return{client:{waitForInitialization:function(){return ye},waitUntilReady:function(){return le},identify:function(e,n,t){return L?T(Promise.resolve({}),t):A?(p.warn(ae()),T(Promise.resolve(F(O)),t)):T((u&&g?g.clearFlags():Promise.resolve()).then(function(){return J.validateUser(e)}).then(function(e){return C.setUser(e)}).then(function(){return S.fetchFlagSettings(C.getUser(),n)}).then(function(e){var n=F(e);return e?Z(e).then(function(){return n}):n}).then(function(e){return c&&X(),e}).catch(function(e){return m.maybeReportError(e),Promise.reject(e)}),t)},getUser:function(){return C.getUser()},variation:function(e,n){return M(e,n,!0,!1).value},variationDetail:function(e,n){return M(e,n,!0,!0)},track:function(e,n,t){if("string"==typeof e){o.customEventFilter&&!o.customEventFilter(e)&&p.warn(B(e));var r={kind:"custom",key:e,user:C.getUser(),url:o.getCurrentUrl(),creationDate:(new Date).getTime()};null!=n&&(r.data=n),null!=t&&(r.metricValue=t),V(r)}else m.maybeReportError(new l(B(e)))},on:function(e,n,t){ie(e)?(d=!0,U&&oe(),m.on(e,n,t)):m.on.apply(m,arguments)},off:function(e){if(m.off.apply(m,arguments),ie(e)){var n=!1;m.getEvents().forEach(function(e){ie(e)&&m.getEventListenerCount(e)>0&&(n=!0)}),n||(d=!1,c&&void 0===D&&W())}},setStreaming:function(e){var n=null===e?void 0:e;n!==D&&(D=n,oe())},flush:function(e){return T(w?E.flush():Promise.resolve(),e)},allFlags:function(){var e={};if(!O)return e;for(var n in O)O.hasOwnProperty(n)&&(e[n]=M(n,null,!h.sendEventsOnlyForVariation).value);return e},close:function(e){if(L)return T(Promise.resolve(),e);var n=function(){L=!0,O={}};return T(Promise.resolve().then(function(){if(W(),w)return E.stop(),E.flush()}).then(n).catch(n),e)}},options:h,emitter:m,ident:C,logger:p,requestor:S,start:function(){w&&E.start()},enqueueEvent:V,getFlagsInternal:function(){return O},getEnvironmentId:function(){return b},internalChangeEventName:_e}}var Ve={promise:Promise.resolve({status:200,header:function(){return null},body:null})};function ze(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 Ve;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),Ve;var u=void 0;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 He=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e};var $e=/[|\\{}()[\]^$+*?.]/g,Me=function(e){if("string"!=typeof e)throw new TypeError("Expected a string");return e.replace($e,"\\$&")};function Ke(e,n,t,r){var o=n.replace(t,"").replace(r,""),i=void 0,a=void 0;switch(e.kind){case"exact":a=n,i=new RegExp("^"+Me(e.url)+"/?$");break;case"canonical":a=o,i=new RegExp("^"+Me(e.url)+"/?$");break;case"substring":a=o,i=new RegExp(".*"+Me(e.substring)+".*$");break;case"regex":a=o,i=new RegExp(e.pattern);break;default:return!1}return i.test(a)}function Ge(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(Ke(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 Xe=300;function Be(e,n){var t=void 0,r=void 0,o={};function i(){r&&r.dispose(),t&&t.length&&(r=Ge(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=Ge(t=e,a),function(e,n){var t=window.location.href,r=void 0;function o(){(r=window.location.href)!==t&&(t=r,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)}(Xe,i)),n()}).catch(function(t){e.emitter.maybeReportError(new g.LDUnexpectedResponseError((t&&t.message,t.message))),n()}),o}var We="goalsReady",Qe={fetchGoals:!0};function Ye(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=function(e){var n={synchronousFlush:!1};window.XMLHttpRequest&&(n.httpRequest=function(e,t,r,o){var i=n.synchronousFlush;return n.synchronousFlush=!1,ze(e,t,r,o,i)});var t=void 0;n.httpAllowsPost=function(){return void 0===t&&(t=!!window.XMLHttpRequest&&"withCredentials"in new window.XMLHttpRequest),t};var r=e&&e.eventUrlTransformer;n.getCurrentUrl=function(){return r?r(window.location.href):window.location.href},n.isDoNotTrack=function(){var e=void 0;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&&(n.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){n.localStorage=null}var o=void 0;e&&e.useReport&&"function"==typeof window.EventSourcePolyfill&&window.EventSourcePolyfill.supportedOptions&&window.EventSourcePolyfill.supportedOptions.method?(n.eventSourceAllowsReport=!0,o=window.EventSourcePolyfill):(n.eventSourceAllowsReport=!1,o=window.EventSource),window.EventSource&&(n.eventSourceFactory=function(e,n){var t=He({},{heartbeatTimeout:3e5,silentTimeout:3e5,skipDefaultHeaders:!0},n);return new o(e,t)},n.eventSourceIsActive=function(e){return e.readyState===window.EventSource.OPEN||e.readyState===window.EventSource.CONNECTING});return n.userAgent="JSClient",n}(t),o=Je(e,n,t,r,Qe),i=o.client,a=o.options,u=o.emitter,s=new Promise(function(e){var n=u.on(We,function(){u.off(We,n),e()})});if(i.waitUntilGoalsReady=function(){return s},a.fetchGoals){var c=Be(o,function(){return u.emit(We)});r.customEventFilter=c.goalKeyExists}else u.emit(We);"complete"!==document.readyState?window.addEventListener("load",o.start):o.start();var l=function(){r.synchronousFlush=!0,i.flush().catch(function(){})};return window.addEventListener("beforeunload",l),window.addEventListener("unload",l),i}var Ze=Fe;var en={initialize:function(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return console&&console.warn&&console.warn(we.deprecated("default export","named LDClient export")),Ye(e,n,t)},version:"2.14.1"};e.initialize=Ye,e.createConsoleLogger=Ze,e.version="2.14.1",e.default=en,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 ke(e){return(ke="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 Ee(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 S=t("LaunchDarklyUnexpectedResponseError"),Se=t("LaunchDarklyInvalidEnvironmentIdError"),a=t("LaunchDarklyInvalidUserError"),Pe=t("LaunchDarklyInvalidEventKeyError"),Oe=t("LaunchDarklyInvalidArgumentError"),De=t("LaunchDarklyFlagFetchError");function P(e){return!(400<=e&&e<500)||400===e||408===e||429===e}for(var s=Object.freeze({__proto__:null,LDUnexpectedResponseError:S,LDInvalidEnvironmentIdError:Se,LDInvalidUserError:a,LDInvalidEventKeyError:Pe,LDInvalidArgumentError:Oe,LDFlagFetchError:De,isHttpErrorRecoverable:P}),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 d=Array.isArray,g=Object.keys,p=Object.prototype.hasOwnProperty,v=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 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=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},h=["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 Ue(e){return m(e).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function Re(e){return JSON.parse(JSON.stringify(e))}function je(e,n){return v(e,n)}function Ie(e){setTimeout(e,0)}function Ne(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 Te(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-=Ue(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||"2.14.1";return e.userAgent+"/"+n}function k(e){return{"X-LaunchDarkly-User-Agent":b(e)}}function Le(){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 Ee({},e,{},n)},{})}function Fe(e){if(!e)return e;var n;for(var t in h){var r=h[t],o=e[r];void 0!==o&&"string"!=typeof o&&((n=n||Ee({},e))[r]=String(o))}return n||e}Object.freeze({__proto__:null,btoa:m,base64URLEncode:Ue,clone:Re,deepEquals:je,onNextTick:Ie,wrapPromiseCallback:Ne,transformValuesToVersionedValues:y,transformVersionedValuesToValues:Te,chunkUserEventsForUrl:w,getLDUserAgentString:b,getLDHeaders:k,extend:Le,sanitizeUser:Fe});var E=2e3;function O(c,l,e,f){var v=l+"/events/bulk/"+e,d=l+"/a/"+e+".gif",n={};function g(e){(new window.Image).src=e}return n.sendEvents=function(e){if(!c.httpRequest)return Promise.resolve();var n,t,r,o,i,a=c.httpAllowsPost();n=a?[e]:w(E-l.length,e);for(var u=[],s=0;s<n.length;s++)u.push((t=n[s],r=a,o=void 0,o=f||g,i=JSON.stringify(t),r?function n(t){var e=Le({"Content-Type":"application/json","X-LaunchDarkly-Event-Schema":"3"},k(c));return c.httpRequest("POST",v,e,i).promise.then(function(e){if(e)return 400<=e.status&&P(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(){}):(o(d+"?d="+Ue(i)),Promise.resolve())));return Promise.all(u)},n}function D(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=Le({},o,i[1])}var u=Object.keys(o);return u.length&&(u.sort(),r.privateAttrs=u),r},n}function U(e){return e&&e.message?e.message:"string"==typeof e||e instanceof String?e:JSON.stringify(e)}var xe=function(){return"LaunchDarkly client initialized"},R=" Please see https://docs.launchdarkly.com/docs/js-sdk-reference#section-initializing-the-client for instructions on SDK initialization.",Ae=function(){return"Be sure to call `identify` in the LaunchDarkly client: https://docs.launchdarkly.com/docs/js-sdk-reference#section-analytics-events"},j=function(e){return'Expected application/json content type but got "'+e+'"'},Ce=function(){return"localStorage is unavailable"},I=function(){return"localStorage is unavailable, so anonymous user ID cannot be cached"},N=function(e){return"network error"+(e?" ("+e+")":"")},qe=function(e){return'Custom event "'+e+'" does not exist'},T=function(){return"Environment not found. Double check that you specified a valid environment/client-side ID."+R},_e=function(){return"No environment/client-side ID was specified."+R},Je=function(e){return"Error fetching flag settings: "+U(e)},L=function(){return"No user specified."+R},F=function(){return"Invalid user specified."+R},Ve=function(){return"LaunchDarkly client was initialized with bootstrap data that did not include flag metadata. Events may not be sent correctly."+R},ze=function(){return"LaunchDarkly bootstrap data is not available because the back end could not read the flags."},He=function(e,n){return n?'[LaunchDarkly] "'+e+'" is deprecated, please use "'+n+'"':'[LaunchDarkly] "'+e+'" is deprecated'},x=function(e,n,t){return"Received error "+e+(401===e?" (invalid SDK key)":"")+" for "+n+" - "+(P(e)?t:"giving up permanently")},A=function(){return"Cannot make HTTP requests in this environment."+R},$e=function(){return"identify() has no effect here; it must be called on the main client instance"},Me=function(){return"Closing stream connection"},Ke=function(e){return"Opening stream connection to "+e},Ge=function(e,n){return"Error on stream connection: "+U(e)+", will continue retrying every "+n+" milliseconds."},C=function(e){return"polling for feature flags at "+e},Xe=function(){return"received ping message from stream"},Be=function(){return"received streaming update for all flags"},We=function(e){return'received streaming update for flag "'+e+'"'},Qe=function(e){return'received streaming update for flag "'+e+'" but ignored due to version check'},Ye=function(e){return'received streaming deletion for flag "'+e+'"'},Ze=function(e){return'received streaming deletion for flag "'+e+'" but ignored due to version check'},en=function(e){return'enqueueing "'+e+'" event'},q=function(e){return"sending "+e+" events"},_=Object.freeze({__proto__:null,clientInitialized:xe,clientNotReady:function(){return"LaunchDarkly client is not ready"},eventWithoutUser:Ae,invalidContentType:j,invalidKey:function(){return"Event key must be a string"},localStorageUnavailable:Ce,localStorageUnavailableForUserId:I,networkError:N,unknownCustomEventKey:qe,environmentNotFound:T,environmentNotSpecified:_e,errorFetchingFlags:Je,userNotSpecified:L,invalidUser:F,bootstrapOldFormat:Ve,bootstrapInvalid:ze,deprecated:He,httpErrorMessage:x,httpUnavailable:A,identifyDisabled:$e,streamClosing:Me,streamConnecting:Ke,streamError:Ge,debugPolling:C,debugStreamPing:Xe,debugStreamPut:Be,debugStreamPatch:We,debugStreamPatchIgnored:Qe,debugStreamDelete:Ye,debugStreamDeleteIgnored:Ze,debugEnqueueingEvent:en,debugPostingEvents:q});function nn(e,n,t,r,o){var i,a,u,s,c,l=3<arguments.length&&void 0!==r?r:null,f={},v=(4<arguments.length&&void 0!==o?o:null)||O(e,n.eventsUrl,t),d=(u=a=0,s={},(i={}).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)}},i.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}},i.clearSummary=function(){u=a=0,s={}},i),g=D(n),p=n.inlineUsersInEvents,h=n.samplingInterval,m=n.flushInterval,y=n.logger,w=[],b=0,k=!1;function E(){return 0===h||0===Math.floor(Math.random()*h)}return f.enqueue=function(e){if(!k){var n,t=!1,r=!1;if(d.summarizeEvent(e),"feature"===e.kind?E()&&(t=!!e.trackEvents,r=!!(n=e).debugEventsUntilDate&&n.debugEventsUntilDate>b&&n.debugEventsUntilDate>(new Date).getTime()):t=E(),t&&w.push((a=Le({},i=e),p||"identify"===i.kind?a.user=g.filterUser(i.user):(a.userKey=i.user.key,delete a.user),"feature"===i.kind&&(delete a.trackEvents,delete a.debugEventsUntilDate),a)),r){var o=Le({},e,{kind:"debug"});delete o.trackEvents,delete o.debugEventsUntilDate,delete o.variation,w.push(o)}}var i,a},f.flush=function(){if(k)return Promise.resolve();var e=w,n=d.getSummary();return d.clearSummary(),n&&(n.kind="summary",e.push(n)),0===e.length?Promise.resolve():(w=[],y.debug(q(e.length)),v.sendEvents(e).then(function(e){e&&(e.serverTime&&(b=e.serverTime),P(e.status)||(k=!0),400<=e.status&&Ie(function(){l.maybeReportError(new S(x(e.status,"event posting","some events were dropped")))}))}))},f.start=function(){c=setTimeout(function e(){f.flush(),c=setTimeout(e,m)},m)},f.stop=function(){clearTimeout(c)},f}function tn(t,r,o,i,a){var u={};function s(){var e="",n=i.getUser();return n&&(e=o||m(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(Ce()),Promise.reject(e)})},u.saveFlags=function(e){var n=Le({},e,{$schema:1});return t.set(s(),JSON.stringify(n)).catch(function(e){return a.warn(Ce()),Promise.reject(e)})},u.clearFlags=function(){return t.clear(s()).catch(function(e){return a.warn(Ce()),Promise.reject(e)})},u}var J,V="application/json";function rn(d,e,a){var u=e.baseUrl,s=e.useReport,c=e.evaluationReasons,g=e.sendLDHeaders,l=e.logger,n={},p={};function f(e,n){if(!d.httpRequest)return new Promise(function(e,n){n(new De(A()))});var t=n?"REPORT":"GET",r=g?k(d):{};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 Se(T()):new De(Je(n.statusText||String(n.status))));if(e.header("content-type")&&0===e.header("content-type").lastIndexOf(V))return JSON.parse(e.body);var n,t=j(e.header("content-type")||"");return Promise.reject(new De(t))},function(e){return Promise.reject(new De(N(e)))});return l.addPromise(v,function(){f.cancel&&f.cancel()}),l.resultPromise}return n.fetchJSON=function(e){return f(u+e,null)},n.fetchFlagSettings=function(e,n){var t,r,o,i="";return s?(r=[u,"/sdk/evalx/",a,"/user"].join(""),o=JSON.stringify(e)):(t=Ue(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(C(r)),f(r,o)},n}for(var z=(J=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}}}(J={exports:{}}),J.exports),H=[],$=0;$<256;++$)H[$]=($+256).toString(16).substr(1);var M,K,G=0,X=0,B=function(e,n,t){var r=n&&t||0,o=n||[],i=(e=e||{}).node||M,a=void 0!==e.clockseq?e.clockseq:K;if(null==i||null==a){var u=z();null==i&&(i=M=[1|u[0],u[1],u[2],u[3],u[4],u[5]]),null==a&&(a=K=16383&(u[6]<<8|u[7]))}var s=void 0!==e.msecs?e.msecs:(new Date).getTime(),c=void 0!==e.nsecs?e.nsecs:X+1,l=s-G+(c-X)/1e4;if(l<0&&void 0===e.clockseq&&(a=a+1&16383),(l<0||G<s)&&void 0===e.nsecs&&(c=0),1e4<=c)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");G=s,K=a;var f=(1e4*(268435455&(s+=122192928e5))+(X=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=H;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)},W="ld:$anonUserId";function on(o,i){var e={};return e.validateUser=function(e){if(!e)return Promise.reject(new a(L()));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(W).catch(function(){return null}):Promise.resolve(null)).then(function(e){if(e)return r.key=e,r;var n,t=B();return r.key=t,(n=t,o?o.set(W,n).catch(function(){i.warn(I())}):Promise.resolve()).then(function(){return r})}):Promise.reject(new a(F()))},e}function an(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}var un="ready",sn="initialized",cn="failed",ln="change",fn="internal-change";function Q(e,n,t,o,r){var a,i,u,s,c,l,f,v,d,g,p,h,m,y,w,b,k,E,S,P,O,D,U,R,j,I,N,T,L,F,x,A=t&&t.logger?t.logger:r&&r.logger||an("warn"),C=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),q=(U=t,R=C,I=Le({logger:j=A},{baseUrl:"https://app.launchdarkly.com",streamUrl:"https://clientstream.launchdarkly.com",eventsUrl:"https://events.launchdarkly.com",sendEvents:!0,sendLDHeaders:!0,inlineUsersInEvents:!1,allowFrequentDuplicateEvents:!1,sendEventsOnlyForVariation:!1,useReport:!1,evaluationReasons:!1,flushInterval:2e3,samplingInterval:0,streamReconnectDelay:1e3,allAttributesPrivate:!1,privateAttributeNames:[]},r),N={all_attributes_private:"allAttributesPrivate",private_attribute_names:"privateAttributeNames",samplingInterval:null},x=Le({},U||{}),F=x,Object.keys(N).forEach(function(e){if(void 0!==F[e]){var n=N[e];j&&j.warn(He(e,n)),n&&(void 0===F[n]&&(F[n]=F[e]),delete F[e])}}),T=I,L=Le({},x),Object.keys(T).forEach(function(e){void 0!==L[e]&&null!==L[e]||(L[e]=T[e])}),x=L,(isNaN(x.flushInterval)||x.flushInterval<2e3)&&(x.flushInterval=2e3,oe("Invalid flush interval configured. Must be an integer >= 2000 (milliseconds).")),(isNaN(x.samplingInterval)||x.samplingInterval<0)&&(x.samplingInterval=0,oe("Invalid sampling interval configured. Sampling interval must be an integer >= 0.")),x),_=q.hash,J=q.sendEvents,V=e,z=(f=o,d=V,g=_,p=(v=q).streamUrl,h=v.logger,m={},y=p+"/eval/"+d,w=v.useReport,b=v.evaluationReasons,k=v.streamReconnectDelay,E=!1,D=O=P=S=null,m.connect=function(e,t){function n(n){D[n]=function(e){E=!1,t[n]&&t[n](e)}}for(var r in O=e,D={},t||{})n(r);ne()},m.disconnect=function(){clearTimeout(P),P=null,re()},m.isConnected=function(){return!!(S&&f.eventSourceIsActive&&f.eventSourceIsActive(S))},m),H=q.eventProcessor||nn(o,q,V,C),$=rn(o,q,V),M={},K={},G=q.streaming,X=!1,B=!1,W=!0,Q=q.stateProvider,Y=(c=function(e){Q||e&&ie({kind:"identify",key:e.key,user:e,creationDate:(new Date).getTime()})},{setUser:function(e){(l=Fe(e))&&c&&c(Re(l))},getUser:function(){return l?Re(l):null}}),Z=on(o.localStorage,A);function ee(e){E||(h.warn(Ge(e,k)),E=!0),re(),ne(k)}function ne(e){P||(e?P=setTimeout(te,e):te())}function te(){var e;P=null;var n="",t={};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(O)):(e=p+"/ping/"+d,n=""):e=y+"/"+Ue(JSON.stringify(O)),b&&(n=n+(n?"&":"")+"withReasons=true"),e=e+(n?"?":"")+n,re(),h.info(Ke(e)),S=f.eventSourceFactory(e,t),D)D.hasOwnProperty(r)&&S.addEventListener(r,D[r]);S.onerror=ee}}function re(){S&&(h.info(Me()),S.close(),S=null)}function oe(e){Ie(function(){R&&R.maybeReportError(new Oe(e))})}function ie(e){V&&(Q&&Q.enqueueEvent&&Q.enqueueEvent(e)||(e.user?(W=!1,!J||B||o.isDoNotTrack()||(A.debug(en(e.kind)),H.enqueue(e))):W&&(A.warn(Ae()),W=!1)))}function ae(e,n,t,r){var o=Y.getUser(),i=new Date,a=n?n.value:null;if(!q.allowFrequentDuplicateEvents){var u=JSON.stringify(a)+(o&&o.key?o.key:"")+e,s=M[u];if(s&&i-s<3e5)return;M[u]=i}var c={kind:"feature",key:e,user:o,value:a,variation:n?n.variationIndex:null,default:t,creationDate:i.getTime()},l=K[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),ie(c)}function ue(e,n,t,r){var o;if(K&&K.hasOwnProperty(e)&&K[e]&&!K[e].deleted){var i=K[e];o=se(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&&ae(e,o,n,r),o}function se(e){return{value:e.value,variationIndex:void 0===e.variation?null:e.variation,reason:e.reason||null}}function ce(){i=!0,Y.getUser()&&z.connect(Y.getUser(),{ping:function(){A.debug(Xe()),$.fetchFlagSettings(Y.getUser(),_).then(function(e){return fe(e||{})}).catch(function(e){C.maybeReportError(new De(Je(e)))})},put:function(e){var n=JSON.parse(e.data);A.debug(Be()),fe(n)},patch:function(e){var n=JSON.parse(e.data),t=K[n.key];if(!t||!t.version||!n.version||t.version<n.version){A.debug(We(n.key));var r={},o=Le({},n);delete o.key;var i=se(K[n.key]=o);r[n.key]=t?{previous:t.value,current:i}:{current:i},ve(r)}else A.debug(Qe(n.key))},delete:function(e){var n=JSON.parse(e.data);if(!K[n.key]||K[n.key].version<n.version){A.debug(Ye(n.key));var t={};K[n.key]&&!K[n.key].deleted&&(t[n.key]={previous:K[n.key].value}),K[n.key]={version:n.version,deleted:!0},ve(t)}else A.debug(Ze(n.key))}})}function le(){i&&(z.disconnect(),i=!1)}function fe(e){var n={};if(!e)return Promise.resolve();for(var t in K)K.hasOwnProperty(t)&&K[t]&&(e[t]&&!je(e[t].value,K[t].value)?n[t]={previous:K[t].value,current:se(e[t])}:e[t]&&!e[t].deleted||(n[t]={previous:K[t].value}));for(var r in e)e.hasOwnProperty(r)&&e[r]&&(!K[r]||K[r].deleted)&&(n[r]={current:se(e[r])});return K=Ee({},e),ve(n).catch(function(){})}function ve(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;C.emit(ln+":"+e,t,r),i[e]=n?{current:t,previous:r}:{previous:r}}),C.emit(ln,i),C.emit(fn,K),q.sendEventsOnlyForVariation||Q||e.forEach(function(e){ae(e,o[e].current)})}return a&&s?s.saveFlags(K).catch(function(){return null}):Promise.resolve()}function de(){var e=G||u&&void 0===G;e&&!i?ce():!e&&i&&le()}function ge(e){return e===ln||e.substr(0,ln.length+1)===ln+":"}o.localStorage&&(s=new tn(o.localStorage,V,_,Y,A));var pe=new Promise(function(e){var n=C.on(un,function(){C.off(un,n),e()})}),he=new Promise(function(e,n){var t=C.on(sn,function(){C.off(sn,t),e()}),r=C.on(cn,function(e){C.off(cn,r),n(e)})});if("string"==typeof q.bootstrap&&"LOCALSTORAGE"===q.bootstrap.toUpperCase()&&(s?a=!0:A.warn(Ce())),"object"===ke(q.bootstrap)&&(K=function(t){var e=Object.keys(t),r=t.$flagsState;!r&&e.length&&A.warn(Ve()),!1===t.$valid&&A.warn(ze());var o={};return e.forEach(function(e){if("$flagsState"!==e&&"$valid"!==e){var n={value:t[e]};r&&r[e]?n=Le(n,r[e]):n.version=0,o[e]=n}}),o}(q.bootstrap)),Q){var me=Q.getInitialState();me?ye(me):Q.on("init",ye),Q.on("update",function(e){e.user&&Y.setUser(e.user),e.flags&&fe(e.flags)})}else(e?Z.validateUser(n).then(function(e){return Y.setUser(e),"object"===ke(q.bootstrap)?we():a?s.loadFlags().catch(function(){return null}).then(function(e){return null==e?(K={},$.fetchFlagSettings(Y.getUser(),_).then(function(e){return fe(e||{})}).then(we).catch(function(e){be(new De(Je(e)))})):(K=e,Ie(we),$.fetchFlagSettings(Y.getUser(),_).then(function(e){return fe(e)}).catch(function(e){return C.maybeReportError(e)}))}):$.fetchFlagSettings(Y.getUser(),_).then(function(e){K=e||{},we()}).catch(function(e){K={},be(e)})}):Promise.reject(new Se(_e()))).catch(function(e){return C.maybeReportError(e)});function ye(e){V=e.environment,Y.setUser(e.user),K=Ee({},e.flags),Ie(we)}function we(){A.info(xe()),X=!0,de(),C.emit(un),C.emit(sn)}function be(e){C.maybeReportError(e),C.emit(cn,e),C.emit(un)}return{client:{waitForInitialization:function(){return he},waitUntilReady:function(){return pe},identify:function(e,n,t){return B?Ne(Promise.resolve({}),t):Q?(A.warn($e()),Ne(Promise.resolve(Te(K)),t)):Ne((a&&s?s.clearFlags():Promise.resolve()).then(function(){return Z.validateUser(e)}).then(function(e){return Y.setUser(e)}).then(function(){return $.fetchFlagSettings(Y.getUser(),n)}).then(function(e){var n=Te(e);return e?fe(e).then(function(){return n}):n}).then(function(e){return i&&ce(),e}).catch(function(e){return C.maybeReportError(e),Promise.reject(e)}),t)},getUser:function(){return Y.getUser()},variation:function(e,n){return ue(e,n,!0,!1).value},variationDetail:function(e,n){return ue(e,n,!0,!0)},track:function(e,n,t){if("string"==typeof e){o.customEventFilter&&!o.customEventFilter(e)&&A.warn(qe(e));var r={kind:"custom",key:e,user:Y.getUser(),url:o.getCurrentUrl(),creationDate:(new Date).getTime()};null!=n&&(r.data=n),null!=t&&(r.metricValue=t),ie(r)}else C.maybeReportError(new Pe(qe(e)))},on:function(e,n,t){ge(e)?(u=!0,X&&de(),C.on(e,n,t)):C.on.apply(C,arguments)},off:function(e){if(C.off.apply(C,arguments),ge(e)){var n=!1;C.getEvents().forEach(function(e){ge(e)&&0<C.getEventListenerCount(e)&&(n=!0)}),n||(u=!1,i&&void 0===G&&le())}},setStreaming:function(e){var n=null===e?void 0:e;n!==G&&(G=n,de())},flush:function(e){return Ne(J?H.flush():Promise.resolve(),e)},allFlags:function(){var e={};if(!K)return e;for(var n in K)K.hasOwnProperty(n)&&(e[n]=ue(n,null,!q.sendEventsOnlyForVariation).value);return e},close:function(e){if(B)return Ne(Promise.resolve(),e);function n(){B=!0,K={}}return Ne(Promise.resolve().then(function(){if(le(),J)return H.stop(),H.flush()}).then(n).catch(n),e)}},options:q,emitter:C,ident:Y,logger:A,requestor:$,start:function(){J&&H.start()},enqueueEvent:ie,getFlagsInternal:function(){return K},getEnvironmentId:function(){return V},internalChangeEventName:fn}}function Y(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 Z(o){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?Y(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)):Y(i).forEach(function(e){Object.defineProperty(o,e,Object.getOwnPropertyDescriptor(i,e))})}return o}var ee={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 ee;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),ee;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 te=/[|\\{}()[\]^$+*?.]/g,re=function(e){if("string"!=typeof e)throw new TypeError("Expected a string");return e.replace(te,"\\$&")};function oe(e,n,t,r){var o,i,a=n.replace(t,"").replace(r,"");switch(e.kind){case"exact":i=n,o=new RegExp("^"+re(e.url)+"/?$");break;case"canonical":i=a,o=new RegExp("^"+re(e.url)+"/?$");break;case"substring":i=a,o=new RegExp(".*"+re(e.substring)+".*$");break;case"regex":i=a,o=new RegExp(e.pattern);break;default:return!1}return o.test(i)}function ie(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(oe(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 ae=300;function ue(r,n){var t,o,e={};function i(){o&&o.dispose(),t&&t.length&&(o=ie(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=ie(t=e,a),u(ae,i)),n()}).catch(function(e){r.emitter.maybeReportError(new s.LDUnexpectedResponseError((e&&e.message,e.message))),n()}),e}var se="goalsReady",ce={fetchGoals:!0};function le(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,ne(e,n,t,r,o)}),i.httpAllowsPost=function(){return void 0===n&&(n=!!window.XMLHttpRequest&&"withCredentials"in new window.XMLHttpRequest),n};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=Z({},{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=Q(e,n,t,r,ce),i=o.client,a=o.options,u=o.emitter,s=new Promise(function(e){var n=u.on(se,function(){u.off(se,n),e()})});if(i.waitUntilGoalsReady=function(){return s},a.fetchGoals){var c=ue(o,function(){return u.emit(se)});r.customEventFilter=c.goalKeyExists}else u.emit(se);"complete"!==document.readyState?window.addEventListener("load",o.start):o.start();function l(){r.synchronousFlush=!0,i.flush().catch(function(){})}return window.addEventListener("beforeunload",l),window.addEventListener("unload",l),i}var fe=an;var ve={initialize:function(e,n){var t=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};return console&&console.warn&&console.warn(_.deprecated("default export","named LDClient export")),le(e,n,t)},version:"2.15.2"};e.createConsoleLogger=fe,e.default=ve,e.initialize=le,e.version="2.15.2",Object.defineProperty(e,"__esModule",{value:!0})});
//# sourceMappingURL=ldclient.min.js.map
{
"name": "launchdarkly-js-client-sdk",
"version": "2.15.1",
"version": "2.15.2",
"description": "LaunchDarkly SDK for JavaScript",

@@ -44,8 +44,11 @@ "author": "LaunchDarkly <team@launchdarkly.com>",

"devDependencies": {
"babel-core": "6.26.0",
"babel-eslint": "8.2.2",
"babel-jest": "24.3.1",
"babel-polyfill": "6.26.0",
"babel-preset-env": "1.6.1",
"babel-preset-stage-1": "6.24.1",
"@babel/cli": "^7.6.4",
"@babel/core": "^7.6.4",
"@babel/plugin-transform-regenerator": "7.4.5",
"@babel/plugin-transform-runtime": "7.6.2",
"@babel/preset-env": "^7.6.3",
"@babel/runtime": "7.6.3",
"@rollup/plugin-replace": "^2.2.0",
"babel-eslint": "10.0.3",
"babel-jest": "^24.9.0",
"chai": "4.1.2",

@@ -59,19 +62,19 @@ "cross-env": "5.1.4",

"eslint-plugin-prettier": "2.6.0",
"jest": "^23.6",
"jest-junit": "3.6.0",
"jest-localstorage-mock": "2.2.0",
"jsdom": "11.11.0",
"jest": "^24.9.0",
"jest-junit": "^9.0.0",
"jest-localstorage-mock": "^2.4.0",
"jsdom": "^11.11.0",
"prettier": "1.11.1",
"readline-sync": "1.4.9",
"rimraf": "2.6.2",
"rollup": "0.66.6",
"rollup-plugin-babel": "3.0.3",
"rollup-plugin-commonjs": "9.1.0",
"rollup-plugin-filesize": "5.0.1",
"rollup-plugin-includepaths": "0.2.2",
"rollup-plugin-node-builtins": "2.1.2",
"rollup-plugin-node-globals": "1.2.0",
"rollup-plugin-node-resolve": "3.3.0",
"rollup-plugin-replace": "2.0.0",
"rollup-plugin-uglify": "3.0.0",
"rollup": "^1.26.0",
"rollup-plugin-babel": "^4.3.3",
"rollup-plugin-commonjs": "^10.1.0",
"rollup-plugin-filesize": "^6.2.1",
"rollup-plugin-includepaths": "^0.2.3",
"rollup-plugin-node-builtins": "^2.1.2",
"rollup-plugin-node-globals": "^1.4.0",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-terser": "^5.1.2",
"rollup-plugin-uglify": "^6.0.3",
"semver": "5.5.0",

@@ -78,0 +81,0 @@ "semver-compare": "1.0.0",

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