@flarehr/apollo-benefits 2.89.56619 → 2.90.56957

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/config.json CHANGED
@@ -9,6 +9,5 @@
9
9
  "contentfulSpace": "hos0i9i3wvo7",
10
10
  "contentfulEnvironment": "__CONTENTFUL_ENVIRONMENT",
11
11
  "contentfulApiKey": "pZ8KQVJZ8iSqixnowan6aKl9xmpE61FDPJvyAB49bpY",
12
- "carsCalculatorUrl": "https://www.flarehr.com/cars/calculator",
13
- "splitAuthorizationKey": "__SPLIT_AUTHORIZATION_KEY"
12
+ "carsCalculatorUrl": "https://www.flarehr.com/cars/calculator"
14
13
  }
package/dist/index.html CHANGED
@@ -84,14 +84,13 @@
84
84
  }
85
85
  })();
86
86
  </script>
87
- <script type="module" crossorigin src="/benefits/app/assets/index-a3cf435b.js"></script>
87
+ <script type="module" crossorigin src="/benefits/app/assets/index-81650659.js"></script>
88
88
  <link rel="modulepreload" crossorigin href="/benefits/app/assets/lodash-5d893f8c.js">
89
- <link rel="modulepreload" crossorigin href="/benefits/app/assets/vendor-1c5ad091.js">
89
+ <link rel="modulepreload" crossorigin href="/benefits/app/assets/vendor-fefcaaa7.js">
90
90
  <link rel="modulepreload" crossorigin href="/benefits/app/assets/oidc-client-6f6e47c2.js">
91
- <link rel="modulepreload" crossorigin href="/benefits/app/assets/@splitsoftware-dc67820b.js">
92
- <link rel="modulepreload" crossorigin href="/benefits/app/assets/date-fns-20ad091e.js">
93
- <link rel="modulepreload" crossorigin href="/benefits/app/assets/framer-motion-04a96014.js">
94
- <link rel="modulepreload" crossorigin href="/benefits/app/assets/datadog-c27a43eb.js">
91
+ <link rel="modulepreload" crossorigin href="/benefits/app/assets/date-fns-1aaef347.js">
92
+ <link rel="modulepreload" crossorigin href="/benefits/app/assets/framer-motion-7d482d44.js">
93
+ <link rel="modulepreload" crossorigin href="/benefits/app/assets/datadog-eeb687f6.js">
95
94
  <link rel="stylesheet" href="/benefits/app/assets/index-dff3b0d2.css">
96
95
  </head>
97
96
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flarehr/apollo-benefits",
3
- "version": "2.89.56619",
3
+ "version": "2.90.56957",
4
4
  "license": "MIT",
5
5
  "description": "Flare Benefits",
6
6
  "files": [
@@ -36,7 +36,6 @@
36
36
  "@juggle/resize-observer": "^3.3.1",
37
37
  "@microsoft/applicationinsights-web": "^2.6.5",
38
38
  "@popperjs/core": "^2.9.3",
39
- "@splitsoftware/splitio-react": "^1.11.0",
40
39
  "@typeform/embed-react": "^3.9.0",
41
40
  "clsx": "^2.1.1",
42
41
  "contentful": "^9.1.13",
@@ -1,18 +0,0 @@
1
- import{_ as Oo,a as je,u as Fo,w as te,m as Lo,s as yt,b as Q}from"./vendor-1c5ad091.js";/*
2
- Adaptation of "object-assign" library (https://www.npmjs.com/package/object-assign)
3
- exported as an ES module instead of CommonJS, to avoid extra configuration steps when using
4
- the ESM build of the SDK with tools that doesn't support CommonJS by default (e.g. Rollup).
5
-
6
- object-assign
7
- (c) Sindre Sorhus
8
- @license MIT
9
- */var cn=Object.getOwnPropertySymbols,Mo=Object.prototype.hasOwnProperty,Do=Object.prototype.propertyIsEnumerable;function wo(e){if(e==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}function ko(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de",Object.getOwnPropertyNames(e)[0]==="5")return!1;for(var t={},r=0;r<10;r++)t["_"+String.fromCharCode(r)]=r;var n=Object.getOwnPropertyNames(t).map(function(a){return t[a]});if(n.join("")!=="0123456789")return!1;var i={};return"abcdefghijklmnopqrst".split("").forEach(function(a){i[a]=a}),Object.keys(Object.assign({},i)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}var P=ko()?Object.assign:function(e,t){for(var r,n=wo(e),i,a=1;a<arguments.length;a++){r=Object(arguments[a]);for(var s in r)Mo.call(r,s)&&(n[s]=r[s]);if(cn){i=cn(r);for(var o=0;o<i.length;o++)Do.call(r,i[o])&&(n[i[o]]=r[i[o]])}}return n},ii=0,ai=1,si=2,oi=3,ui=4,fi=5,ci=6,li=7,hi=8,vi=9,pi=10,di=11,gi=12,mi=13,Ei=14,Si=15,yi=16,Ti=17,Er=18,_i=19,Ri=20,Ni=21,Ci=22,Ii=23,Ai=24,bi=25,Oi=26,Fi=27,Li=28,Mi=29,Di=30,wi=31,ki=32,xi=33,Pi=34,Ui=35,Gi=36,Ki=37,Bi=38,Wi=39,Hi=100,Yi=101,qi=102,ji=103,zi=104,Vi=105,Qi=106,Xi=107,Zi=108,$i=109,Ji=110,ea=111,ta=112,ra=113,na=114,Ut=115,ia=116,aa=117,sa=118,oa=119,ua=120,fa=121,ca=122,la=123,ha=124,va=200,pa=201,da=202,ga=203,ma=204,Ea=205,Sa=206,ya=207,Ta=208,Sr=209,_a=210,Ra=211,Na=212,Ca=213,Ia=214,Aa=215,ba=216,Oa=217,Fa=218,La=219,Ma=220,Da=221,yr=222,Rt=223,wa=224,ka=225,xa=226,Pa=227,Ua=228,Ga=300,Ka=301,Ba=302,Wa=303,Ha=304,Ya=305,qa=306,ja=307,za=308,Va=309,Qa=310,Pr=311,Xa=312,Za=313,$a=314,ze=315,Ja=316,es=317,Ve=318,Qe=319,ts=320,Ur=321,rs=322,xo=323,Po=324,ns=325,is=326,as=327,ss=328,X="settings",nr="Factory instantiation",gt="engine",Nt=gt+":combiner: ",q=gt+":matcher: ",Tr=gt+":value: ",he="sync",ir=he+":sync-manager: ",os=he+":offline: ",ee=he+":streaming: ",Ge=he+":featureflag-changes: ",Uo=he+":my-segments: ",ar=he+":polling-manager: ",Lt=he+":submitter: ",ot="impressions-tracker: ",us="events-tracker: ",Go="unique-keys-tracker: ",ln="cleanup: ",hn="Global fetch API is not available.";function Ko(e,t){var r=e.log,n=e.core.authorizationKey,i=e.version,a=e.runtime,s=a.ip,o=a.hostname,f=t&&t();f||r.error(Wa,[hn]);var u={Accept:"application/json","Content-Type":"application/json",Authorization:"Bearer "+n,SplitSDKVersion:i};return s&&(u.SplitSDKMachineIP=s),o&&(u.SplitSDKMachineName=o),function(v,l,p,h){l===void 0&&(l={}),p===void 0&&(p=function(){}),h===void 0&&(h=!1);var E={headers:l.headers?P({},u,l.headers):u,method:l.method||"GET",body:l.body};return f?f(v,E).then(function(g){return g.ok?(p(),g):g.text().then(function(d){return Promise.reject({response:g,message:d})})}).catch(function(g){var d=g&&g.response,T="";if(d)switch(d.status){case 404:T="Invalid SDK key or resource not found.";break;default:T=g.message;break}else T=g.message||"Network Error";(!d||d.status!==403)&&r[h?"info":"error"](rs,[d?d.status:"NO_STATUS",v,T]);var _=new Error(T);throw _.statusCode=d&&d.status,p(_),_}):Promise.reject(new Error(hn))}}var ue="control",vn={treatment:ue,config:null},_r="IMPRESSION",Rr="EVENT",_e="DEBUG",pe="OPTIMIZED",Re="NONE",Me="localhost",Gr="standalone",Bo="producer",Kr="consumer",Br="consumer_partial",ut="MEMORY",Nr="LOCALSTORAGE",Ne="GRANTED",Xe="DECLINED",Wr="UNKNOWN",fs="getTreatment",Cr="getTreatments",cs="getTreatmentWithConfig",ls="getTreatmentsWithConfig",hs="getTreatmentsByFlagSet",vs="getTreatmentsByFlagSets",ps="getTreatmentsWithConfigByFlagSet",ds="getTreatmentsWithConfigByFlagSets",Oe="track",et="split",pn="splits",dn="names",Mt=0,Ir=1,gs=2,Wo=0,Ho=1,Yo=2,qo=0,jo=1,zo=2,ms="sp",Vo="im",Qo="ic",Xo="ev",Tt="te",Zo="to",$o="se",Es="ms",Jo="t",eu="ts",tu="tc",ru="tcs",nu="tf",iu="tfs",au="tcf",su="tcfs",ou="tr",uu=0,fu=10,cu=20,sr=30,lu=40,Ss=50,hu=60,gn=70,ys=80,vu=0,pu=1,du=1,gu=0,mu=1,Eu=2,or={headers:{"Cache-Control":"no-cache"}};function Su(e){return"users="+encodeURIComponent(e)}function yu(e,t,r){var n=e.urls,i=e.sync.__splitFiltersValidation&&e.sync.__splitFiltersValidation.queryString,a=e.sync.impressionsMode,s=Ko(e,t.getFetch);return{getSdkAPIHealthCheck:function(){var o=n.sdk+"/version";return s(o).then(function(){return!0}).catch(function(){return!1})},getEventsAPIHealthCheck:function(){var o=n.events+"/version";return s(o).then(function(){return!0}).catch(function(){return!1})},fetchAuth:function(o){var f=n.auth+"/v2/auth";if(o){var u=o.map(Su).join("&");u&&(f+="?"+u)}return s(f,void 0,r.trackHttp(Zo))},fetchSplitChanges:function(o,f,u){var c=n.sdk+"/splitChanges?since="+o+(u?"&till="+u:"")+(i||"");return s(c,f?or:void 0,r.trackHttp(ms)).catch(function(v){throw v.statusCode===414&&e.log.error(as),v})},fetchSegmentChanges:function(o,f,u,c){var v=n.sdk+"/segmentChanges/"+f+"?since="+o+(c?"&till="+c:"");return s(v,u?or:void 0,r.trackHttp($o))},fetchMySegments:function(o,f){var u=n.sdk+"/mySegments/"+encodeURIComponent(o);return s(u,f?or:void 0,r.trackHttp(Es))},postEventsBulk:function(o,f){var u=n.events+"/events/bulk";return s(u,{method:"POST",body:o,headers:f},r.trackHttp(Xo))},postTestImpressionsBulk:function(o,f){var u=n.events+"/testImpressions/bulk";return s(u,{method:"POST",body:o,headers:P({SplitSDKImpressionsMode:a},f)},r.trackHttp(Vo))},postTestImpressionsCount:function(o,f){var u=n.events+"/testImpressions/count";return s(u,{method:"POST",body:o,headers:f},r.trackHttp(Qo))},postUniqueKeysBulkCs:function(o,f){var u=n.telemetry+"/v1/keys/cs";return s(u,{method:"POST",body:o,headers:f},r.trackHttp(Tt))},postUniqueKeysBulkSs:function(o,f){var u=n.telemetry+"/v1/keys/ss";return s(u,{method:"POST",body:o,headers:f},r.trackHttp(Tt))},postMetricsConfig:function(o,f){var u=n.telemetry+"/v1/metrics/config";return s(u,{method:"POST",body:o,headers:f},r.trackHttp(Tt),!0)},postMetricsUsage:function(o,f){var u=n.telemetry+"/v1/metrics/usage";return s(u,{method:"POST",body:o,headers:f},r.trackHttp(Tt),!0)}}}function Gt(e,t,r,n){n===void 0&&(n="task");var i=0,a,s=!1,o=0,f,u;function c(){for(var l=[],p=0;p<arguments.length;p++)l[p]=arguments[p];return i++,e.debug(Ki,[n]),a=(a?a.then(function(){return t.apply(void 0,l)}):t.apply(void 0,l)).then(function(h){return i--,h}),a}function v(l){return c.apply(void 0,f).then(function(p){return s&&l===o&&(u=setTimeout(v,r,l)),p})}return{execute:c,isExecuting:function(){return i>0},start:function(){for(var l=[],p=0;p<arguments.length;p++)l[p]=arguments[p];if(!s)return s=!0,o++,f=l,e.debug(Gi,[n,r]),v(o)},stop:function(){s=!1,u&&(e.debug(Bi,[n]),clearTimeout(u),u=void 0)},isRunning:function(){return s}}}function He(e,t,r,n,i,a,s,o){s===void 0&&(s=0);var f=0,u;function c(){if(r.isEmpty()&&!u)return Promise.resolve();u=r.pop(u);var v=typeof u.length=="number"?u.length+" "+i:i;e[o?"debug":"info"](ia,[v]);var l=JSON.stringify(a?a(u):u);return s||(u=void 0),t(l).then(function(){f=0,u=void 0}).catch(function(p){s?f===s?(f=0,u=void 0,e[o?"debug":"warn"](Sr,[v,p])):(f++,e[o?"debug":"warn"](_a,[v,p])):e[o?"debug":"warn"](Sr,[v,p])})}return Gt(e,c,n,i+" submitter")}function Ts(e,t){var r=!1,n,i=e.start;e.start=function(){r=!0,n=setTimeout(i,t)};var a=e.stop;return e.stop=function(){r=!1,clearTimeout(n),a()},e.isRunning=function(){return r},e}var mn="events";function Tu(e){var t=e.settings,r=t.log,n=t.scheduler.eventsPushRate,i=t.startup.eventsFirstPushWindow,a=e.splitApi.postEventsBulk,s=e.storage.events,o=He(r,a,s,n,mn);return i>0&&(o=Ts(o,i)),s.setOnFullQueueCb(function(){o.isRunning()&&(r.info(Ut,[mn]),o.execute())}),o}function _u(e,t,r){return r===void 0&&(r=!1),G(e)&&G(t)?(r&&(e=e.toLowerCase(),t=t.toLowerCase()),e.slice(e.length-t.length)===t):!1}function Hr(e,t){var r;if(Z(e))for(var n=Object.keys(e),i=0;i<n.length&&!r;i++){var a=n[i],s=t(e[a],a,e);s&&(r=e[a])}else if(Array.isArray(e))for(var i=0;i<e.length&&!r;i++){var s=t(e[i],i,e);s&&(r=e[i])}return r}function Ie(e,t){if(Array.isArray(e)&&typeof t=="function"){for(var r=0;r<e.length;r++)if(t(e[r],r,e)===!0)return r}return-1}function oe(e,t){var r=Object.keys(e);return r.forEach(function(n){return t(e[n],n,e)}),e}function Ar(e,t,r){var n=r;try{var i=t.split("."),a=e;i.forEach(function(s){return a=a[s]}),typeof a<"u"&&(n=a)}catch{}return n}function Ru(e,t){var r={};if(Array.isArray(e)&&G(t))for(var n=0;n<e.length;n++){var i=e[n][t];G(i)&&(r[i]||(r[i]=[]),r[i].push(e[n]))}return r}function Yr(e){return e===!0||e===!1}function de(e){return e instanceof Number&&(e=e.valueOf()),typeof e=="number"?Number.isFinite?Number.isFinite(e):isFinite(e):!1}function br(e){return e instanceof Number&&(e=e.valueOf()),e!==e}function Z(e){return e!==null&&typeof e=="object"&&(e.constructor===Object||e.constructor!=null&&e.constructor.name==="Object")}function G(e){return typeof e=="string"||e instanceof String}function _s(e){return G(e)?e.toUpperCase():e}function Ct(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var i=e;if(Z(t)&&Object.keys(t).forEach(function(s){var o=t[s];Z(o)&&(i[s]&&Z(i[s])?o=Ct({},i[s],o):o=Ct({},o)),o!==void 0&&(i[s]=o)}),r&&r.length){var a=r.splice(0,1)[0];i=Ct.apply(void 0,Oo([i,a],r,!1))}return i}function Ye(e,t){return G(e)&&G(t)?e.slice(0,t.length)===t:!1}function Pe(e){if(typeof e=="number")return e;if(Z(e)&&typeof e.valueOf=="function"){var t=e.valueOf();e=Z(t)?t+"":t}return typeof e!="string"?e===0?e:+e:(e=e.replace(/^\s+|\s+$/g,""),+e)}function Rs(e){if(e==null)return"";if(typeof e=="string")return e;if(Array.isArray(e))return e.map(function(r){return G(r)?r:""})+"";var t=e+"";return t==="0"&&1/e===Number.NEGATIVE_INFINITY?"-0":t}function Kt(e){var t={};return e.filter(function(r){return Object.prototype.hasOwnProperty.call(t,r)?!1:t[r]=!0})}function Nu(e,t){t===void 0&&(t=JSON.stringify);var r={};return e.filter(function(n){var i=t(n);return Object.prototype.hasOwnProperty.call(r,i)?!1:r[i]=!0})}var En="impressions";function Ns(e,t){var r=Ru(t,"feature"),n=[];return oe(r,function(i,a){n.push({f:a,i:i.map(function(s){var o={k:s.keyName,t:s.treatment,m:s.time,c:s.changeNumber,r:e?s.label:void 0,b:s.bucketingKey?s.bucketingKey:void 0,pt:s.pt?s.pt:void 0};return o})})}),n}function Cu(e){var t=e.settings,r=t.log,n=t.scheduler.impressionsRefreshRate,i=t.core.labelsEnabled,a=e.splitApi.postTestImpressionsBulk,s=e.storage.impressions,o=He(r,a,s,n,En,Ns.bind(void 0,i),1);return s.setOnFullQueueCb(function(){o.isRunning()&&(r.info(Ut,[En]),o.execute())}),o}function Cs(e){for(var t=[],r=Object.keys(e),n=0;n<r.length;n++){var i=r[n].split("::");if(i.length===2){var a=i[0],s=i[1],o={f:a,m:Number(s),rc:e[r[n]]};t.push(o)}}return{pf:t}}var Iu=18e5;function Au(e){var t=e.settings.log,r=e.splitApi.postTestImpressionsCount,n=e.storage.impressionCounts;if(n)return He(t,r,n,Iu,"impression counts",Cs,1)}var Ce="state::splits-arrived",Bt="state::splits-cache-loaded",Ae="state::segments-arrived",It="init::timeout",Se="init::ready",Dt="init::cache-ready",Is="state::update";function bu(e,t){if(e==="localhost")return Me;if([Gr,Bo,Kr,Br].indexOf(t)===-1)throw Error("Invalid mode provided");return t}function Et(e){return Kr===e||Br===e}var Ou=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/;function qr(e,t,r,n){if(n===void 0&&(n="feature flag name"),t==null)e.error(ze,[r,n]);else if(!G(t))e.error(Ve,[r,n]);else{if(Ou.test(t)&&(e.warn(Ia,[r,n,t]),t=t.trim()),t.length>0)return t;e.error(Qe,[r,n])}return!1}function jr(e,t,r,n,i){if(n===void 0&&(n="feature flag names"),i===void 0&&(i="feature flag name"),Array.isArray(t)&&t.length>0){var a=[];if(t.forEach(function(s){var o=qr(e,s,r,i);o&&a.push(o)}),a.length)return Kt(a)}return e.error(ts,[r,n]),!1}var zr=[{type:"bySet",maxLength:50,queryParam:"sets="},{type:"byName",maxLength:400,queryParam:"names="},{type:"byPrefix",maxLength:50,queryParam:"prefixes="}],Sn=/^[a-z0-9][_a-z0-9]{0,49}$/,Fu=/[A-Z]/;function Lu(e){return zr.some(function(t){return t.type===e})}function Mu(e,t,r,n){var i=jr(e,r,X,t+" filter",t+" filter value");if(i){if(t==="bySet"&&(i=As(e,i,X)),i.length>n)throw new Error(n+" unique values can be specified at most for '"+t+"' filter. You passed "+i.length+". Please consider reducing the amount or using other filter.");i.sort()}return i||[]}function Du(e){var t=[];return zr.forEach(function(r){var n=r.type,i=r.queryParam,a=e[n];a.length>0&&t.push(i+a.map(function(s){return encodeURIComponent(s)}).join(","))}),t.length>0?"&"+t.join("&"):null}function As(e,t,r){var n=t.map(function(i){return Fu.test(i)&&(e.warn(xa,[r,i]),i=i.toLowerCase()),i}).filter(function(i){return Sn.test(i)?typeof i=="string":(e.warn(ka,[r,i,Sn,i]),!1)});return Kt(n)}function ur(e,t){return Hr(e,function(r){return r.type===t&&r.values.length>0})}function wu(e,t,r){var n={validFilters:[],queryString:null,groupedFilters:{bySet:[],byName:[],byPrefix:[]}};if(!t)return n;if(Et(r))return e.warn(La),n;if(!Array.isArray(t)||t.length===0)return e.warn(Da),n;n.validFilters=t.filter(function(a,s){return a&&Lu(a.type)&&Array.isArray(a.values)?(n.groupedFilters[a.type]=n.groupedFilters[a.type].concat(a.values),!0):(e.warn(Ma,[s]),!1)}),zr.forEach(function(a){var s=a.type,o=a.maxLength;n.groupedFilters[s].length>0&&(n.groupedFilters[s]=Mu(e,s,n.groupedFilters[s],o))});var i=ur(n.validFilters,"bySet");return i&&((ur(n.validFilters,"byName")||ur(n.validFilters,"byPrefix"))&&e.error(ss),P(n.groupedFilters,{byName:[],byPrefix:[]})),n.queryString=Du(n.groupedFilters),e.debug(Wi,[n.queryString]),n}function ku(e,t,r,n){var i=jr(e,r,t,"flag sets","flag set"),a=i?As(e,i,t):[];return n.length>0&&(a=a.filter(function(s){return n.indexOf(s)>-1?!0:(e.warn(Pa,[t,s]),!1)})),a}function xu(e,t){return t=_s(t),[_e,pe,Re].indexOf(t)>-1?t:(e.error(Ur,["impressionsMode",[_e,pe,Re],pe]),pe)}var yn=250;function fr(e,t,r,n){if(t==null)return e.error(ze,[r,n]),!1;if(de(t))return e.warn(Ca,[r,n,t]),Rs(t);if(G(t)){if(t=t.trim(),t.length>0&&t.length<=yn)return t;t.length===0?e.error(Qe,[r,n]):t.length>yn&&e.error(Ja,[r,n])}else e.error(Ve,[r,n]);return!1}function mt(e,t,r){if(Z(t)){var n=fr(e,t.matchingKey,r,"matchingKey"),i=fr(e,t.bucketingKey,r,"bucketingKey");return n&&i?{matchingKey:n,bucketingKey:i}:(e.error(es,[r]),!1)}else return fr(e,t,r,"key")}var Pu=/[A-Z]/,cr="traffic_type";function Wt(e,t,r){if(t==null)e.error(ze,[r,cr]);else if(!G(t))e.error(Ve,[r,cr]);else if(t.length===0)e.error(Qe,[r,cr]);else return Pu.test(t)&&(e.warn(ba,[r]),t=t.toLowerCase()),t;return!1}var Ue={mode:Gr,core:{authorizationKey:void 0,key:void 0,trafficType:void 0,labelsEnabled:!0,IPAddressesEnabled:void 0},scheduler:{featuresRefreshRate:60,segmentsRefreshRate:60,telemetryRefreshRate:3600,impressionsRefreshRate:300,offlineRefreshRate:15,eventsPushRate:60,eventsQueueSize:500,impressionsQueueSize:3e4,pushRetryBackoffBase:1},urls:{sdk:"https://sdk.split.io/api",events:"https://events.split.io/api",auth:"https://auth.split.io/api",streaming:"https://streaming.split.io",telemetry:"https://telemetry.split.io/api"},storage:void 0,debug:void 0,impressionListener:void 0,version:void 0,integrations:void 0,streamingEnabled:!0,sync:{splitFilters:void 0,impressionsMode:pe,localhostMode:void 0,enabled:!0},log:void 0};function le(e){return Math.round(e*1e3)}function Uu(e,t){var r=t.defaults,n=t.runtime,i=t.storage,a=t.integrations,s=t.logger,o=t.localhost,f=t.consent,u=Ct({},Ue,r,e),c=s(u);u.log=c,u.sync.impressionsMode=xu(c,u.sync.impressionsMode);function v(d,T,_){return T>=_?T:(c.error(is,[d,_]),_)}var l=u.scheduler,p=u.startup;l.featuresRefreshRate=le(l.featuresRefreshRate),l.segmentsRefreshRate=le(l.segmentsRefreshRate),l.offlineRefreshRate=le(l.offlineRefreshRate),l.eventsPushRate=le(l.eventsPushRate),l.telemetryRefreshRate=le(v("telemetryRefreshRate",l.telemetryRefreshRate,60)),Ar(e,"scheduler.impressionsRefreshRate")===void 0&&u.sync.impressionsMode===_e&&(l.impressionsRefreshRate=60),l.impressionsRefreshRate=le(l.impressionsRefreshRate),l.metricsRefreshRate&&c.warn("`metricsRefreshRate` will be deprecated soon. For configuring telemetry rates, update `telemetryRefreshRate` value in configs"),p.requestTimeoutBeforeReady=le(p.requestTimeoutBeforeReady),p.readyTimeout=le(p.readyTimeout),p.eventsFirstPushWindow=le(p.eventsFirstPushWindow),u.mode=bu(u.core.authorizationKey,u.mode),i&&(u.storage=i(u));var h=u.core.key;if(t.acceptKey){if(u.mode===Me&&h===void 0?u.core.key="localhost_key":u.core.key=mt(c,h,"Client instantiation"),t.acceptTT){var E=u.core.trafficType;E!==void 0&&(u.core.trafficType=Wt(c,E,"Client instantiation"))}}else h!==void 0&&c.warn("Provided `key` is ignored in server-side SDK."),u.core.key=void 0;u.runtime=n(u),a&&(u.integrations=a(u)),o&&(u.sync.localhostMode=o(u)),u.streamingEnabled!==!1&&(u.streamingEnabled=!0,l.pushRetryBackoffBase=le(l.pushRetryBackoffBase)),u.sync.enabled!==!1&&(u.sync.enabled=!0);var g=wu(c,u.sync.splitFilters,u.mode);return u.sync.splitFilters=g.validFilters,u.sync.__splitFiltersValidation=g,u.userConsent=f(u),u}var lr="sdk_key";function Gu(e,t){var r=!1;return t==null?e.error(ze,[nr,lr]):G(t)?t.length>0?r=t:e.error(Qe,[nr,lr]):e.error(Ve,[nr,lr]),r}var ae={};function Ku(e,t){var r=Gu(e,t);return r&&(ae[r]?(e.warn(yr,[ae[r]+" factory/ies with this SDK Key"]),ae[r]++):(ae[r]=1,Object.keys(ae).length>1&&e.warn(yr,["an instance of the Split factory"]))),r}function Bu(e){ae[e]&&ae[e]--,ae[e]===0&&delete ae[e]}function At(e){var t=e();return function(){return Math.round(e()-t)}}var tt,rt,nt,Wu=(tt={},tt[Gr]=Wo,tt[Kr]=Ho,tt[Br]=Yo,tt),Hu=(rt={},rt[pe]=qo,rt[_e]=jo,rt[Re]=zo,rt),Yu=(nt={},nt[Wr]=1,nt[Ne]=2,nt[Xe]=3,nt);function qu(){return Object.keys(ae).length}function ju(){return Object.keys(ae).reduce(function(e,t){return e+ae[t]-1},0)}function zu(e){var t=0;e.validFilters.forEach(function(i){i.type==="bySet"&&(t+=i.values.length)});var r=e.groupedFilters.bySet.length,n=t-r;return{flagSetsTotal:t,flagSetsIgnored:n}}function Vu(e,t){return{oM:Wu[e],st:t.toLowerCase(),aF:qu(),rF:ju()}}function Qu(e,t){return{isEmpty:function(){return!1},clear:function(){},pop:function(){var r=t.urls,n=t.scheduler,i=t.core.key!==void 0,a=zu(t.sync.__splitFiltersValidation),s=a.flagSetsTotal,o=a.flagSetsIgnored;return P(Vu(t.mode,t.storage.type),{sE:t.streamingEnabled,rR:{sp:n.featuresRefreshRate/1e3,se:i?void 0:n.segmentsRefreshRate/1e3,ms:i?n.segmentsRefreshRate/1e3:void 0,im:n.impressionsRefreshRate/1e3,ev:n.eventsPushRate/1e3,te:n.telemetryRefreshRate/1e3},uO:{s:r.sdk!==Ue.urls.sdk,e:r.events!==Ue.urls.events,a:r.auth!==Ue.urls.auth,st:r.streaming!==Ue.urls.streaming,t:r.telemetry!==Ue.urls.telemetry},iQ:n.impressionsQueueSize,eQ:n.eventsQueueSize,iM:Hu[t.sync.impressionsMode],iL:!!t.impressionListener,hP:!1,tR:e.getTimeUntilReady(),tC:e.getTimeUntilReadyFromCache(),nR:e.getNonReadyUsage(),t:e.popTags(),i:t.integrations&&t.integrations.map(function(f){return f.type}),uC:t.userConsent?Yu[t.userConsent]:0,fsT:s,fsI:o})}}}function Xu(e){var t=e.storage.telemetry,r=e.platform.now;if(!(!t||!r)){var n=e.settings,i=e.settings,a=i.log,s=i.scheduler.telemetryRefreshRate,o=e.splitApi,f=e.readiness,u=e.sdkReadinessManager,c=At(r),v=Ts(He(a,o.postMetricsUsage,t,s,"telemetry stats",void 0,0,!0),s);return f.gate.once(Dt,function(){t.recordTimeUntilReadyFromCache(c())}),u.incInternalReadyCbCount(),f.gate.once(Se,function(){if(t.recordTimeUntilReady(c()),v.isRunning()){var l=He(a,o.postMetricsConfig,Qu(t,n),0,"telemetry config",void 0,0,!0);l.execute()}}),v}}var Tn="unique keys",Zu=9e5;function $u(e){var t=e.settings,r=t.log,n=t.core.key,i=e.splitApi,a=i.postUniqueKeysBulkCs,s=i.postUniqueKeysBulkSs,o=e.storage.uniqueKeys,f=n!==void 0,u=f?a:s,c=He(r,u,o,Zu,Tn);return o.setOnFullQueueCb(function(){c.isRunning()&&(r.info(Ut,[Tn]),c.execute())}),c}function Ju(e){var t=[Cu(e),Tu(e)],r=Au(e);r&&t.push(r);var n=Xu(e);return e.storage.uniqueKeys&&t.push($u(e)),{start:function(i){i||t.forEach(function(a){return a.start()}),n&&n.start()},stop:function(i){t.forEach(function(a){return a.stop()}),!i&&n&&n.stop()},isRunning:function(){return t.some(function(i){return i.isRunning()})},execute:function(i){var a=i?[]:t.map(function(s){return s.execute()});return n&&a.push(n.execute()),Promise.all(a)},isExecuting:function(){return t.some(function(i){return i.isExecuting()})}}}var ef=600,ft="PUSH_NONRETRYABLE_ERROR",Or="PUSH_RETRYABLE_ERROR",ct="PUSH_SUBSYSTEM_UP",Ke="PUSH_SUBSYSTEM_DOWN",bs="MY_SEGMENTS_UPDATE",Os="MY_SEGMENTS_UPDATE_V2",Fs="SEGMENT_UPDATE",Ls="SPLIT_KILL",Ms="SPLIT_UPDATE",_n="CONTROL",Fr="OCCUPANCY",Te;(function(e){e.STREAMING_DISABLED="STREAMING_DISABLED",e.STREAMING_PAUSED="STREAMING_PAUSED",e.STREAMING_RESUMED="STREAMING_RESUMED",e.STREAMING_RESET="STREAMING_RESET"})(Te||(Te={}));function wt(e){var t=e.userConsent;return!t||t===Ne}function tf(e,t){return function(r){var n=r.settings,i=r.settings,a=i.log,s=i.streamingEnabled,o=i.sync.enabled,f=r.telemetryTracker,u=e&&e(r),c=o&&s&&u&&t?t(r,u):void 0,v=Ju(r);function l(){u.isRunning()?a.info(sa):(a.info(aa),u.start(),f.streamingEvent(gn,pu))}function p(){a.info(oa),u.isRunning()&&(u.stop(),f.streamingEvent(gn,vu)),u.syncAll()}c&&(c.on(ct,p),c.on(Ke,l));var h=!1,E=!0;return{pollingManager:u,pushManager:c,submitterManager:v,start:function(){h=!0,u&&(o?c?(E&&(u.syncAll(),E=!1),c.start()):u.start():E&&(u.syncAll(),E=!1)),v.start(!wt(n))},stop:function(){h=!1,c&&c.stop(),u&&u.isRunning()&&u.stop(),v.stop()},isRunning:function(){return h},flush:function(){return v.execute(!wt(n))},shared:function(g,d,T){if(u){var _=u.add(g,d,T);return{isRunning:_.isRunning,start:function(){o?c?(u.isRunning()?T.splits.usesSegments()&&_.start():_.execute(),c.add(g,_)):T.splits.usesSegments()&&_.start():d.isReady()||_.execute()},stop:function(){var S=u.get(g);S&&(c&&c.remove(g),S.isRunning()&&S.stop(),u.remove(g))},flush:function(){return Promise.resolve()}}}}}}}var Ht=function(){function e(t,r,n){this.baseMillis=e.__TEST__BASE_MILLIS||r||e.DEFAULT_BASE_MILLIS,this.maxMillis=e.__TEST__MAX_MILLIS||n||e.DEFAULT_MAX_MILLIS,this.attempts=0,this.cb=t}return e.prototype.scheduleCall=function(){var t=this,r=Math.min(this.baseMillis*Math.pow(2,this.attempts),this.maxMillis);return this.timeoutID&&clearTimeout(this.timeoutID),this.timeoutID=setTimeout(function(){t.timeoutID=void 0,t.cb()},r),this.attempts++,r},e.prototype.reset=function(){this.attempts=0,this.timeoutID&&(clearTimeout(this.timeoutID),this.timeoutID=void 0)},e.DEFAULT_BASE_MILLIS=1e3,e.DEFAULT_MAX_MILLIS=18e5,e}();function rf(e){return G(e.data)&&(e.parsedData=JSON.parse(e.data)),e}function nf(e){if(e.data){var t=JSON.parse(e.data);return t.parsedData=JSON.parse(t.data),t.name&&t.name==="[meta]occupancy"&&(t.parsedData.type=Fr),t}}var af=[/control_pri$/,/control_sec$/],sf=[fu,cu];function of(e,t){var r=af.map(function(s){return{regex:s,hasPublishers:!0,oTime:-1,cTime:-1}}),n=!0,i=!0;function a(){return r.some(function(s){return s.hasPublishers})}return{handleOpen:function(){t.streamingEvent(uu),e.emit(ct)},isStreamingUp:function(){return i&&n},handleOccupancyEvent:function(s,o,f){for(var u=0;u<r.length;u++){var c=r[u];if(c.regex.test(o)){if(t.streamingEvent(sf[u],s),f>c.oTime){c.oTime=f,c.hasPublishers=s!==0;var v=a();i&&(!v&&n?e.emit(Ke):v&&!n&&e.emit(ct)),n=v}return}}},handleControlEvent:function(s,o,f){if(s===Te.STREAMING_RESET){e.emit(s);return}for(var u=0;u<r.length;u++){var c=r[u];if(c.regex.test(o)){f>c.cTime&&(c.cTime=f,s===Te.STREAMING_DISABLED?(t.streamingEvent(sr,gu),e.emit(ft)):n&&(s===Te.STREAMING_PAUSED&&i?(t.streamingEvent(sr,Eu),e.emit(Ke)):s===Te.STREAMING_RESUMED&&!i&&(t.streamingEvent(sr,mu),e.emit(ct))),i=s===Te.STREAMING_RESUMED);return}}}}}function uf(e,t,r){var n=of(t,r);function i(a){if(a.parsedData&&a.parsedData.code){var s=a.parsedData.code;if(r.streamingEvent(hu,s),40140<=s&&s<=40149)return!0;if(4e4<=s&&s<=49999)return!1}else r.streamingEvent(lu,du);return!0}return{handleOpen:function(){n.handleOpen()},handleError:function(a){var s=a;try{s=rf(a)}catch(f){e.warn(Sa,[f])}var o=s.parsedData&&s.parsedData.message||s.message;e.error(Ya,[o]),i(s)?t.emit(Or):t.emit(ft)},handleMessage:function(a){var s;try{if(s=nf(a),!s)return}catch(v){e.warn(ya,[v]);return}var o=s.parsedData,f=s.data,u=s.channel,c=s.timestamp;if(e.debug(Ui,[f]),!(!n.isStreamingUp()&&[Fr,_n].indexOf(o.type)===-1))switch(o.type){case Ms:case Fs:case Os:case Ls:t.emit(o.type,o);break;case bs:t.emit(o.type,o,u);break;case Fr:n.handleOccupancyEvent(o.metrics.publishers,u,c);break;case _n:n.handleControlEvent(o.controlType,u,c);break}}}}function ff(e,t){var r=0,n=-1,i=!1,a,s,o=new Ht(f);function f(){if(a=!0,r>n){i=!1;var u=r;e.execute(s,!0).then(function(c){a&&(c!==!1&&(s&&t.trackUpdatesFromSSE(Es),n=Math.max(n,u)),i?f():o.scheduleCall())})}else a=!1}return{put:function(u,c){u<=n||u<=r||(r=u,i=!0,s=c,(o.timeoutID||!a)&&f(),o.reset())},stop:function(){a=!1,o.reset()}}}var Ds=1e4,ws=6e4,ks=10;function cf(e,t,r){function n(a){var s=0,o=!1,f,u,c=new Ht(v,Ds,ws);function v(){f=!0,s>r.getChangeNumber(a)?(o=!1,t.execute(!1,a,!0,u?s:void 0).then(function(){if(f)if(o)v();else{var l=c.attempts+1;if(s<=r.getChangeNumber(a)){e.debug("Refresh completed"+(u?" bypassing the CDN":"")+" in "+l+" attempts."),f=!1;return}if(l<ks){c.scheduleCall();return}u?(e.debug("No changes fetched after "+l+" attempts with CDN bypassed."),f=!1):(c.reset(),u=!0,v())}})):f=!1}return{put:function(l){var p=r.getChangeNumber(a);l<=p||l<=s||(s=l,o=!0,u=!1,(c.timeoutID||!f)&&v(),c.reset())},stop:function(){f=!1,c.reset()}}}var i={};return{put:function(a){var s=a.changeNumber,o=a.segmentName;i[o]||(i[o]=n(o)),i[o].put(s)},stop:function(){Object.keys(i).forEach(function(a){return i[a].stop()})}}}function lf(e,t,r,n,i,a){var s=0,o=!1,f,u,c,v=new Ht(l,Ds,ws);function l(){if(f=!0,s>t.getChangeNumber()){o=!1;var h=c?{payload:c,changeNumber:s}:void 0;r.execute(!0,u?s:void 0,h).then(function(){if(f)if(o)l();else{h&&i.trackUpdatesFromSSE(ms),a&&a.execute(!0);var E=v.attempts+1;if(s<=t.getChangeNumber()){e.debug("Refresh completed"+(u?" bypassing the CDN":"")+" in "+E+" attempts."),f=!1;return}if(E<ks){v.scheduleCall();return}u?(e.debug("No changes fetched after "+E+" attempts with CDN bypassed."),f=!1):(v.reset(),u=!0,l())}})}else f=!1}function p(h,E){var g=h.changeNumber,d=h.pcn,T=t.getChangeNumber();g<=T||g<=s||(s=g,o=!0,u=!1,c=void 0,E&&T===d&&(c=E),(v.timeoutID||!f)&&l(),v.reset())}return{put:p,killSplit:function(h){var E=h.changeNumber,g=h.splitName,d=h.defaultTreatment;t.killLocally(g,d,E)&&n.emit(Ce,!0),p({changeNumber:E})},stop:function(){f=!1,v.reset()}}}var xs="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function Vr(e){var t=String(e).replace(/[=]+$/,"");if(t.length%4===1)throw new Error("'atob' failed: The string to be decoded is not correctly encoded.");for(var r="",n=0,i=void 0,a=void 0,s=0;a=t.charAt(s++);~a&&(i=n%4?i*64+a:a,n++%4)?r+=String.fromCharCode(255&i>>(-2*n&6)):0)a=xs.indexOf(a);return r}function hf(e){for(var t=String(e),r="",n=void 0,i=void 0,a=0,s=xs;t.charAt(a|0)||(s="=",a%1);r+=s.charAt(63&n>>8-a%1*8)){if(i=t.charCodeAt(a+=3/4),i>255)throw new Error("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");n=n<<8|i}return r}function vf(e){var t=e.split(".")[1],r=t.replace(/-/g,"+").replace(/_/g,"/"),n=decodeURIComponent(Vr(r).split("").map(function(i){return"%"+("00"+i.charCodeAt(0).toString(16)).slice(-2)}).join(""));return JSON.parse(n)}function pf(e,t){var r=null;for(typeof e=="number"&&(r=e,e=function(){return null});r!==null||(r=e())!==null;)r<128?t(r&127):r<2048?(t(r>>6&31|192),t(r&63|128)):r<65536?(t(r>>12&15|224),t(r>>6&63|128),t(r&63|128)):(t(r>>18&7|240),t(r>>12&63|128),t(r>>6&63|128),t(r&63|128)),r=null}function df(e,t){for(var r,n=null;(r=n!==null?n:e())!==null;){if(r>=55296&&r<=57343&&(n=e())!==null&&n>=56320&&n<=57343){t((r-55296)*1024+n-56320+65536),n=null;continue}t(r)}n!==null&&t(n)}function gf(e,t){df(e,function(r){pf(r,t)})}var Rn=String.fromCharCode;function mf(e){if(typeof e!="string")throw TypeError("Illegal argument: "+typeof e);var t=0;return function(){return t>=e.length?null:e.charCodeAt(t++)}}function Ef(){var e=[],t=[];return function(){if(arguments.length===0)return t.join("")+Rn.apply(String,e);e.length+arguments.length>1024&&(t.push(Rn.apply(String,e)),e.length=0),Array.prototype.push.apply(e,arguments)}}function Ps(e){var t;return gf(mf(e),t=Ef()),t()}/*!
10
- * +----------------------------------------------------------------------------------+
11
- * | murmurHash3.js v3.0.0 (http://github.com/karanlyons/murmurHash3.js) |
12
- * | A TypeScript/JavaScript implementation of MurmurHash3's hashing algorithms. |
13
- * |----------------------------------------------------------------------------------|
14
- * | Copyright (c) 2012-2020 Karan Lyons. Freely distributable under the MIT license. |
15
- * +----------------------------------------------------------------------------------+
16
- */function Fe(e,t){return(e&65535)*t+(((e>>>16)*t&65535)<<16)}function hr(e,t){return e<<t|e>>>32-t}function Sf(e){return e^=e>>>16,e=Fe(e,2246822507),e^=e>>>13,e=Fe(e,3266489909),e^=e>>>16,e}function yf(e,t){e=e||"",t=t||0;for(var r=e.length%4,n=e.length-r,i=t,a=0,s=3432918353,o=461845907,f=0;f<n;f=f+4)a=e.charCodeAt(f)&255|(e.charCodeAt(f+1)&255)<<8|(e.charCodeAt(f+2)&255)<<16|(e.charCodeAt(f+3)&255)<<24,a=Fe(a,s),a=hr(a,15),a=Fe(a,o),i^=a,i=hr(i,13),i=Fe(i,5)+3864292196;switch(a=0,r){case 3:a^=(e.charCodeAt(f+2)&255)<<16;case 2:a^=(e.charCodeAt(f+1)&255)<<8;case 1:a^=e.charCodeAt(f)&255,a=Fe(a,s),a=hr(a,15),a=Fe(a,o),i^=a}return i^=e.length,i=Sf(i),i>>>0}function Yt(e,t){return yf(Ps(e),t>>>0)}function Us(e,t){return Math.abs(Yt(e,t)%100)+1}function Tf(e){return function(r){return e(r).then(function(n){return n.json()}).then(function(n){if(n.token){var i=vf(n.token);if(typeof i.iat!="number"||typeof i.exp!="number")throw new Error('token properties "issuedAt" (iat) or "expiration" (exp) are missing or invalid');var a=JSON.parse(i["x-ably-capability"]);return P({decodedToken:i,channels:a},n)}return n})}}function Nn(e){return hf(Yt(e,0).toString())}var _f="1.1",Rf=/^control_/;function Nf(e){var t={SplitSDKClientKey:G(e.core.authorizationKey)?e.core.authorizationKey.slice(-4):"",SplitSDKVersion:e.version},r=e.runtime,n=r.ip,i=r.hostname;return n&&(t.SplitSDKMachineIP=n),i&&(t.SplitSDKMachineName=i),t}var Cf=function(){function e(t,r,n){if(this.eventSource=n&&n(),!this.eventSource)throw new Error("EventSource API is not available. ");this.streamingUrl=t.urls.streaming+"/sse",this.useHeaders=r,this.headers=Nf(t)}return e.prototype.setEventHandler=function(t){this.handler=t},e.prototype.open=function(t){this.close();var r=Object.keys(t.channels).map(function(i){var a=Rf.test(i)?"[?occupancy=metrics.publishers]":"";return encodeURIComponent(a+i)}).join(","),n=this.streamingUrl+"?channels="+r+"&accessToken="+t.token+"&v="+_f+"&heartbeats=true";this.connection=new this.eventSource(this.useHeaders?n:n+("&SplitSDKVersion="+this.headers.SplitSDKVersion+"&SplitSDKClientKey="+this.headers.SplitSDKClientKey),this.useHeaders?{headers:this.headers}:void 0),this.handler&&(this.connection.addEventListener("open",this.handler.handleOpen),this.connection.addEventListener("message",this.handler.handleMessage),this.connection.addEventListener("error",this.handler.handleError))},e.prototype.close=function(){this.connection&&this.connection.close()},e}();function qe(e){return Z(e)?e.matchingKey:e}function If(e){return Z(e)?e.bucketingKey:void 0}function Gs(e){return Z(e)?{matchingKey:e.matchingKey,bucketingKey:e.bucketingKey}:{matchingKey:e,bucketingKey:e}}var Cn;(function(e){e[e.None=0]="None",e[e.Gzip=1]="Gzip",e[e.Zlib=2]="Zlib"})(Cn||(Cn={}));var lt;(function(e){e[e.UnboundedFetchRequest=0]="UnboundedFetchRequest",e[e.BoundedFetchRequest=1]="BoundedFetchRequest",e[e.KeyList=2]="KeyList",e[e.SegmentRemoval=3]="SegmentRemoval"})(lt||(lt={}));var _t=function(){if([typeof Uint8Array,typeof Uint16Array,typeof Uint32Array].some(function(y){return y!="function"}))return"global Uint8Array object is not available for gzip/zlib decompression";var t=Uint8Array,r=Uint16Array,n=Uint32Array,i=new t([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),a=new t([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),s=new t([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),o=function(y,C){for(var N=new r(31),F=0;F<31;++F)N[F]=C+=1<<y[F-1];for(var M=new n(N[30]),F=1;F<30;++F)for(var V=N[F];V<N[F+1];++V)M[V]=V-N[F]<<5|F;return[N,M]},f=o(i,2),u=f[0],c=f[1];u[28]=258,c[258]=28;for(var v=o(a,0),l=v[0],p=new r(32768),h=0;h<32768;++h){var E=(h&43690)>>>1|(h&21845)<<1;E=(E&52428)>>>2|(E&13107)<<2,E=(E&61680)>>>4|(E&3855)<<4,p[h]=((E&65280)>>>8|(E&255)<<8)>>>1}for(var g=function(y,C,N){for(var F=y.length,M=0,V=new r(C);M<F;++M)++V[y[M]-1];var ge=new r(C);for(M=0;M<C;++M)ge[M]=ge[M-1]+V[M-1]<<1;var se;if(N){se=new r(1<<C);var D=15-C;for(M=0;M<F;++M)if(y[M])for(var H=M<<4|y[M],fe=C-y[M],ve=ge[y[M]-1]++<<fe,be=ve|(1<<fe)-1;ve<=be;++ve)se[p[ve]>>>D]=H}else for(se=new r(F),M=0;M<F;++M)y[M]&&(se[M]=p[ge[y[M]-1]++]>>>15-y[M]);return se},d=new t(288),h=0;h<144;++h)d[h]=8;for(var h=144;h<256;++h)d[h]=9;for(var h=256;h<280;++h)d[h]=7;for(var h=280;h<288;++h)d[h]=8;for(var T=new t(32),h=0;h<32;++h)T[h]=5;var _=g(d,9,1),S=g(T,5,1),R=function(y){for(var C=y[0],N=1;N<y.length;++N)y[N]>C&&(C=y[N]);return C},m=function(y,C,N){var F=C/8|0;return(y[F]|y[F+1]<<8)>>(C&7)&N},I=function(y,C){var N=C/8|0;return(y[N]|y[N+1]<<8|y[N+2]<<16)>>(C&7)},O=function(y){return(y+7)/8|0},w=function(y,C,N){(C==null||C<0)&&(C=0),(N==null||N>y.length)&&(N=y.length);var F=new(y instanceof r?r:y instanceof n?n:t)(N-C);return F.set(y.subarray(C,N)),F},x=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],L=function(y,C,N){var F=new Error(C||x[y]);if(F.code=y,Error.captureStackTrace&&Error.captureStackTrace(F,L),!N)throw F;return F},b=function(y,C,N){var F=y.length;if(!F||N&&N.f&&!N.l)return C||new t(0);var M=!C||N,V=!N||N.i;N||(N={}),C||(C=new t(F*3));var ge=function(on){var un=C.length;if(on>un){var fn=new t(Math.max(un*2,on));fn.set(C),C=fn}},se=N.f||0,D=N.p||0,H=N.b||0,fe=N.l,ve=N.d,be=N.m,Ze=N.n,Vt=F*8;do{if(!fe){se=m(y,D,1);var Qt=m(y,D+1,3);if(D+=3,Qt)if(Qt==1)fe=_,ve=S,be=9,Ze=5;else if(Qt==2){var $t=m(y,D,31)+257,Jr=m(y,D+10,15)+4,en=$t+m(y,D+5,31)+1;D+=14;for(var $e=new t(en),Jt=new t(19),ne=0;ne<Jr;++ne)Jt[s[ne]]=m(y,D+ne*3,7);D+=Jr*3;for(var tn=R(Jt),Co=(1<<tn)-1,Io=g(Jt,tn,1),ne=0;ne<en;){var rn=Io[m(y,D,Co)];D+=rn&15;var ce=rn>>>4;if(ce<16)$e[ne++]=ce;else{var De=0,St=0;for(ce==16?(St=3+m(y,D,3),D+=2,De=$e[ne-1]):ce==17?(St=3+m(y,D,7),D+=3):ce==18&&(St=11+m(y,D,127),D+=7);St--;)$e[ne++]=De}}var nn=$e.subarray(0,$t),me=$e.subarray($t);be=R(nn),Ze=R(me),fe=g(nn,be,1),ve=g(me,Ze,1)}else L(1);else{var ce=O(D)+4,Xt=y[ce-4]|y[ce-3]<<8,Zt=ce+Xt;if(Zt>F){V&&L(0);break}M&&ge(H+Xt),C.set(y.subarray(ce,Zt),H),N.b=H+=Xt,N.p=D=Zt*8,N.f=se;continue}if(D>Vt){V&&L(0);break}}M&&ge(H+131072);for(var Ao=(1<<be)-1,bo=(1<<Ze)-1,er=D;;er=D){var De=fe[I(y,D)&Ao],we=De>>>4;if(D+=De&15,D>Vt){V&&L(0);break}if(De||L(2),we<256)C[H++]=we;else if(we==256){er=D,fe=null;break}else{var an=we-254;if(we>264){var ne=we-257,Je=i[ne];an=m(y,D,(1<<Je)-1)+u[ne],D+=Je}var tr=ve[I(y,D)&bo],rr=tr>>>4;tr||L(3),D+=tr&15;var me=l[rr];if(rr>3){var Je=a[rr];me+=I(y,D)&(1<<Je)-1,D+=Je}if(D>Vt){V&&L(0);break}M&&ge(H+131072);for(var sn=H+an;H<sn;H+=4)C[H]=C[H-me],C[H+1]=C[H+1-me],C[H+2]=C[H+2-me],C[H+3]=C[H+3-me];H=sn}}N.l=fe,N.p=er,N.b=H,N.f=se,fe&&(se=1,N.m=be,N.d=ve,N.n=Ze)}while(!se);return H==C.length?C:w(C,0,H)},A=function(y){(y[0]!=31||y[1]!=139||y[2]!=8)&&L(6,"invalid gzip data");var C=y[3],N=10;C&4&&(N+=y[10]|(y[11]<<8)+2);for(var F=(C>>3&1)+(C>>4&1);F>0;F-=!y[N++]);return N+(C&2)},k=function(y){var C=y.length;return(y[C-4]|y[C-3]<<8|y[C-2]<<16|y[C-1]<<24)>>>0},K=function(y){((y[0]&15)!=8||y[0]>>>4>7||(y[0]<<8|y[1])%31)&&L(6,"invalid zlib data"),y[1]&32&&L(6,"invalid zlib data: preset dictionaries not supported")};return{gunzipSync:function(y,C){return b(y.subarray(A(y),-8),C||new t(k(y)))},unzlibSync:function(y,C){return b((K(y),y.subarray(2,-4)),C)}}}(),Af=1,bf=2;function Of(e){return String.fromCharCode.apply(null,e)}function Ff(e){var t=e.split("").map(function(r){return r.charCodeAt(0)});return new Uint8Array(t)}function Ks(e,t){var r=Vr(e),n=Ff(r);if(typeof _t=="string")throw new Error(_t);if(t===Af)return _t.gunzipSync(n);if(t===bf)return _t.unzlibSync(n);throw new Error("Invalid compression algorithm #"+t)}function Bs(e,t,r){r===void 0&&(r=!0);var n=Ks(e,t),i=Of(n);return r&&(i=i.replace(/\d+/g,'"$&"')),JSON.parse(i)}function Lf(e,t){return Ks(e,t)}function Mf(e,t){var r=parseInt(t.slice(8),16)%(e.length*8),n=Math.floor(r/8),i=r%8;return(e[n]&1<<i)>0}function Df(e,t){var r=!1;return e>0?Bs(t,e,r):JSON.parse(Vr(t))}var Ws=function(){function e(t){var r=this;this.__setData__=[],Array.isArray(t)&&t.forEach(function(n){r.add(n)})}return e.prototype.clear=function(){this.__setData__.length&&(this.__setData__.length=0)},e.prototype.add=function(t){return this.has(t)?this:(this.__setData__.push(t),this)},e.prototype.delete=function(t){var r=this.__setData__.indexOf(t);return r===-1?!1:(this.__setData__.splice(r,1),!0)},e.prototype.has=function(t){return this.__setData__.indexOf(t)!==-1},e.prototype.forEach=function(t,r){if(typeof t!="function")throw new TypeError(t+" is not a function");for(var n=0;n<this.__setData__.length;n++){var i=this.__setData__[n];t.call(r,i,i,this)}},Object.defineProperty(e.prototype,"size",{get:function(){return this.__setData__.length},enumerable:!1,configurable:!0}),e}();function Le(e){return e instanceof Ws?e.__setData__.slice():Array.from(e)}function wf(){return typeof Array.from=="function"&&typeof Set=="function"&&Set.prototype&&Set.prototype.values?Set:Ws}var re=wf();function kf(e,t){var r=new re(Le(e));return t.forEach(function(n){r.add(n)}),r}function Ee(e,t){e=[e[0]>>>16,e[0]&65535,e[1]>>>16,e[1]&65535],t=[t[0]>>>16,t[0]&65535,t[1]>>>16,t[1]&65535];var r=[0,0,0,0];return r[3]+=e[3]+t[3],r[2]+=r[3]>>>16,r[3]&=65535,r[2]+=e[2]+t[2],r[1]+=r[2]>>>16,r[2]&=65535,r[1]+=e[1]+t[1],r[0]+=r[1]>>>16,r[1]&=65535,r[0]+=e[0]+t[0],r[0]&=65535,[r[0]<<16|r[1],r[2]<<16|r[3]]}function ie(e,t){e=[e[0]>>>16,e[0]&65535,e[1]>>>16,e[1]&65535],t=[t[0]>>>16,t[0]&65535,t[1]>>>16,t[1]&65535];var r=[0,0,0,0];return r[3]+=e[3]*t[3],r[2]+=r[3]>>>16,r[3]&=65535,r[2]+=e[2]*t[3],r[1]+=r[2]>>>16,r[2]&=65535,r[2]+=e[3]*t[2],r[1]+=r[2]>>>16,r[2]&=65535,r[1]+=e[1]*t[3],r[0]+=r[1]>>>16,r[1]&=65535,r[1]+=e[2]*t[2],r[0]+=r[1]>>>16,r[1]&=65535,r[1]+=e[3]*t[1],r[0]+=r[1]>>>16,r[1]&=65535,r[0]+=e[0]*t[3]+e[1]*t[2]+e[2]*t[1]+e[3]*t[0],r[0]&=65535,[r[0]<<16|r[1],r[2]<<16|r[3]]}function ke(e,t){return t%=64,t===32?[e[1],e[0]]:t<32?[e[0]<<t|e[1]>>>32-t,e[1]<<t|e[0]>>>32-t]:(t-=32,[e[1]<<t|e[0]>>>32-t,e[0]<<t|e[1]>>>32-t])}function $(e,t){return t%=64,t===0?e:t<32?[e[0]<<t|e[1]>>>32-t,e[1]<<t]:[e[1]<<t-32,0]}function B(e,t){return[e[0]^t[0],e[1]^t[1]]}function In(e){return e=B(e,[0,e[0]>>>1]),e=ie(e,[4283543511,3981806797]),e=B(e,[0,e[0]>>>1]),e=ie(e,[3301882366,444984403]),e=B(e,[0,e[0]>>>1]),e}function xf(e,t){e=e||"",t=t||0;for(var r=e.length%16,n=e.length-r,i=[0,t],a=[0,t],s=[0,0],o=[0,0],f=[2277735313,289559509],u=[1291169091,658871167],c=0;c<n;c=c+16)s=[e.charCodeAt(c+4)&255|(e.charCodeAt(c+5)&255)<<8|(e.charCodeAt(c+6)&255)<<16|(e.charCodeAt(c+7)&255)<<24,e.charCodeAt(c)&255|(e.charCodeAt(c+1)&255)<<8|(e.charCodeAt(c+2)&255)<<16|(e.charCodeAt(c+3)&255)<<24],o=[e.charCodeAt(c+12)&255|(e.charCodeAt(c+13)&255)<<8|(e.charCodeAt(c+14)&255)<<16|(e.charCodeAt(c+15)&255)<<24,e.charCodeAt(c+8)&255|(e.charCodeAt(c+9)&255)<<8|(e.charCodeAt(c+10)&255)<<16|(e.charCodeAt(c+11)&255)<<24],s=ie(s,f),s=ke(s,31),s=ie(s,u),i=B(i,s),i=ke(i,27),i=Ee(i,a),i=Ee(ie(i,[0,5]),[0,1390208809]),o=ie(o,u),o=ke(o,33),o=ie(o,f),a=B(a,o),a=ke(a,31),a=Ee(a,i),a=Ee(ie(a,[0,5]),[0,944331445]);switch(s=[0,0],o=[0,0],r){case 15:o=B(o,$([0,e.charCodeAt(c+14)],48));case 14:o=B(o,$([0,e.charCodeAt(c+13)],40));case 13:o=B(o,$([0,e.charCodeAt(c+12)],32));case 12:o=B(o,$([0,e.charCodeAt(c+11)],24));case 11:o=B(o,$([0,e.charCodeAt(c+10)],16));case 10:o=B(o,$([0,e.charCodeAt(c+9)],8));case 9:o=B(o,[0,e.charCodeAt(c+8)]),o=ie(o,u),o=ke(o,33),o=ie(o,f),a=B(a,o);case 8:s=B(s,$([0,e.charCodeAt(c+7)],56));case 7:s=B(s,$([0,e.charCodeAt(c+6)],48));case 6:s=B(s,$([0,e.charCodeAt(c+5)],40));case 5:s=B(s,$([0,e.charCodeAt(c+4)],32));case 4:s=B(s,$([0,e.charCodeAt(c+3)],24));case 3:s=B(s,$([0,e.charCodeAt(c+2)],16));case 2:s=B(s,$([0,e.charCodeAt(c+1)],8));case 1:s=B(s,[0,e.charCodeAt(c)]),s=ie(s,f),s=ke(s,31),s=ie(s,u),i=B(i,s)}return i=B(i,[0,e.length]),a=B(a,[0,e.length]),i=Ee(i,a),a=Ee(a,i),i=In(i),a=In(a),i=Ee(i,a),a=Ee(a,i),("00000000"+(i[0]>>>0).toString(16)).slice(-8)+("00000000"+(i[1]>>>0).toString(16)).slice(-8)+("00000000"+(a[0]>>>0).toString(16)).slice(-8)+("00000000"+(a[1]>>>0).toString(16)).slice(-8)}function Pf(e,t){return xf(Ps(e),t>>>0)}function Uf(e){var t,r,n=[0],i;for(t=0;t<e.length;t+=1){for(i=parseInt(e.charAt(t),16),r=n.length-1;r>=0;r-=1)n[r]=n[r]*16+i,i=n[r]/10|0,n[r]%=10;for(;i>0;)n.unshift(i%10),i=i/10|0}return n.join("")}function Gf(e){var t=Pf(e).slice(0,16);return{hex:t,dec:Uf(t)}}function Kf(e,t){var r=e.settings,n=e.storage,i=e.splitApi,a=e.readiness,s=e.platform,o=e.telemetryTracker,f=r.core.key?qe(r.core.key):void 0,u=r.log,c;try{c=new Cf(r,!f,s.getEventSource)}catch(b){u.warn(Ta,[b]);return}var v=Tf(i.fetchAuth),l=new s.EventEmitter,p=uf(u,l,o);c.setEventHandler(p);var h=f?void 0:cf(u,t.segmentsSyncTask,n.segments),E=lf(u,n.splits,t.splitsSyncTask,a.splits,o,f?void 0:t.segmentsSyncTask),g={},d={},T=!1,_,S,R=new Ht(w,r.scheduler.pushRetryBackoffBase),m,I;function O(b){m&&clearTimeout(m),I&&clearTimeout(I);var A=b.decodedToken,k=A.exp-A.iat-ef,K=typeof b.connDelay=="number"&&b.connDelay>=0?b.connDelay:60;u.info(Ji,[k,K]),m=setTimeout(w,k*1e3),I=setTimeout(function(){_||c.open(b)},K*1e3),o.streamingEvent(Ss,A.exp)}function w(){if(!_){u.info(ta),_=!1;var b=f?Object.keys(d):void 0;v(b).then(function(A){if(!_){if(!A.pushEnabled){u.info(ra),l.emit(ft);return}b&&b.length<Object.keys(d).length||O(A)}}).catch(function(A){if(!_){if(u.error(qa,[A.message]),A.statusCode>=400&&A.statusCode<500){o.streamingEvent(ys),l.emit(ft);return}l.emit(Or)}})}}function x(){_||(_=!0,c.close(),u.info(na),m&&clearTimeout(m),I&&clearTimeout(I),R.reset(),L())}function L(){E.stop(),f?oe(d,function(b){var A=b.worker;return A.stop()}):h.stop()}return l.on(Ke,L),l.on(ct,function(){R.reset()}),l.on(ft,function(){S=!0,x(),l.emit(Ke)}),l.on(Or,function(){c.close();var A=R.scheduleCall();u.info(ea,[A/1e3]),l.emit(Ke)}),l.on(Te.STREAMING_RESET,function(){_||(m&&clearTimeout(m),w())}),l.on(Ls,E.killSplit),l.on(Ms,function(b){if(b.d&&b.c!==void 0)try{var A=Df(b.c,b.d);if(A){E.put(b,A);return}}catch(k){u.warn(wa,[k])}E.put(b)}),f?(l.on(bs,function(A,k){var K=k.split("_")[2],y=g[K];y&&d[y]&&d[y].worker.put(A.changeNumber,A.includesPayload?A.segmentList?A.segmentList:[]:void 0)}),l.on(Os,function(A){switch(A.u){case lt.BoundedFetchRequest:{var k;try{k=Lf(A.d,A.c)}catch(N){u.warn(Rt,["BoundedFetchRequest",N]);break}oe(d,function(N){var F=N.hash64,M=N.worker;Mf(k,F.hex)&&M.put(A.changeNumber)});return}case lt.KeyList:{var K=void 0,y,C;try{K=Bs(A.d,A.c),y=new re(K.a),C=new re(K.r)}catch(N){u.warn(Rt,["KeyList",N]);break}oe(d,function(N){var F=N.hash64,M=N.worker,V=y.has(F.dec)?!0:C.has(F.dec)?!1:void 0;V!==void 0&&M.put(A.changeNumber,{name:A.segmentName,add:V})});return}case lt.SegmentRemoval:if(!A.segmentName){u.warn(Rt,["SegmentRemoval","No segment name was provided"]);break}oe(d,function(N){var F=N.worker;return F.put(A.changeNumber,{name:A.segmentName,add:!1})});return}oe(d,function(N){var F=N.worker;F.put(A.changeNumber)})})):l.on(Fs,h.put),P(Object.create(l),{stop:function(){x(),f&&this.remove(f)},start:function(){S||_===!1||(_=!1,f?this.add(f,t.segmentsSyncTask):setTimeout(w))},isRunning:function(){return _===!1},add:function(b,A){var k=Nn(b);g[k]||(g[k]=b,d[b]={hash64:Gf(b),worker:ff(A,o)},T=!0,setTimeout(function(){T&&(T=!1,w())},0))},remove:function(b){var A=Nn(b);delete g[A],delete d[b]}})}function Bf(e){return function(r,n,i){var a=e(r,n);return i&&(a=i(a)),a.then(function(s){return s.json()}).then(function(s){return s.mySegments.map(function(o){return o.name})})}}function Hs(e,t){return e<1?t:new Promise(function(r,n){var i=setTimeout(function(){n(new Error("Operation timed out because it exceeded the configured time limit of "+e+" ms."))},e);t.then(function(a){clearTimeout(i),r(a)},function(a){clearTimeout(i),n(a)})})}function Wf(e,t,r,n,i,a,s,o){var f=!0,u=!0;function c(p){return u&&(p=Hs(a,p)),p}function v(p){var h;if(Array.isArray(p))h=n.resetSegments(p);else{var E=p.name,g=p.add;n.isInSegment(E)!==g?(h=!0,g?n.addToSegment(E):n.removeFromSegment(E)):h=!1}r.usesSegments()&&(h||f)&&(f=!1,i.emit(Ae))}function l(p,h,E){var g=h?new Promise(function(d){v(h),d(!0)}):t(o,E,c).then(function(d){return u=!1,v(d),!0});return g.catch(function(d){return u&&s>p?(p+=1,e.warn(ma,[p,d]),l(p)):(u=!1,!1)})}return function(h,E){return l(0,h,E)}}function Hf(e,t,r,n,i){return Gt(n.log,Wf(n.log,Bf(e),t.splits,t.segments,r.segments,n.startup.requestTimeoutBeforeReady,n.startup.retriesOnFailureBeforeReady,i),n.scheduler.segmentsRefreshRate,"mySegmentsUpdater")}function Yf(e){return function(r,n,i,a){var s=e(r,n,i);return a&&(s=a(s)),s.then(function(o){return o.json()})}}function qf(e){var t=Promise.resolve(e.getRegisteredSegments());return t.then(function(r){return Promise.all(r.map(function(n){return e.getChangeNumber(n)})).then(function(n){return n.every(function(i){return i!==-1})})})}function jf(e){for(var t=e.conditions,r=new re,n=0;n<t.length;n++){var i=t[n].matcherGroup.matchers;i.forEach(function(a){a.matcherType==="IN_SEGMENT"&&r.add(a.userDefinedSegmentMatcherData.segmentName)})}return r}function zf(e,t){var r=t.groupedFilters,n=r.bySet,i=r.byName,a=r.byPrefix;if(n.length>0)return e.sets&&e.sets.some(function(c){return n.indexOf(c)>-1});var s=i.length>0,o=a.length>0;if(!s&&!o)return!0;var f=s&&i.indexOf(e.name)>-1,u=o&&a.some(function(c){return Ye(e.name,c)});return f||u}function Vf(e,t){var r=new re,n=e.reduce(function(i,a){return a.status==="ACTIVE"&&zf(a,t)?(i.added.push([a.name,a]),jf(a).forEach(function(s){r.add(s)})):i.removed.push(a.name),i},{added:[],removed:[],segments:[]});return n.segments=Le(r),n}function Qf(e,t,r,n,i,a,s,o,f){s===void 0&&(s=0),o===void 0&&(o=0);var u=!0;function c(l){return u&&s&&(l=Hs(s,l)),l}function v(l){var p=l[1],h=l[2];return!!(p&&p.some(function(E){return E})||h&&h.some(function(E){return E}))}return function(p,h,E){function g(T,_){_===void 0&&(_=0),e.debug(wi,[T]);var S=Promise.resolve(E?{splits:[E.payload],till:E.changeNumber}:t(T,p,h,c)).then(function(R){u=!1;var m=Vf(R.splits,i);return e.debug(ki,[m.added.length]),e.debug(xi,[m.removed.length]),e.debug(Pi,[m.segments.length]),Promise.all([r.setChangeNumber(R.till),r.addSplits(m.added),r.removeSplits(m.removed),n.registerSegments(m.segments)]).then(function(I){return a?Promise.resolve(!a.splitsArrived||T!==R.till&&v(I)&&(f||qf(n))).catch(function(){return!1}).then(function(O){return O&&a.emit(Ce),!0}):!0})}).catch(function(R){return e.warn(Ea,[R]),u&&o>_?(_+=1,e.info($i,[_,R]),g(T,_)):(u=!1,!1)});return a&&u&&Promise.resolve(r.checkCache()).then(function(R){R&&a.emit(Bt)}),S}var d=Promise.resolve(r.getChangeNumber());return d.then(g)}}function Xf(e,t,r,n,i){return Gt(n.log,Qf(n.log,Yf(e),t.splits,t.segments,n.sync.__splitFiltersValidation,r.splits,n.startup.requestTimeoutBeforeReady,n.startup.retriesOnFailureBeforeReady,i),n.scheduler.featuresRefreshRate,"splitChangesUpdater")}function Zf(e){var t=e.splitApi,r=e.storage,n=e.readiness,i=e.settings,a=i.log,s=Xf(t.fetchSplitChanges,r,n,i,!0),o={},f=qe(i.core.key),u=l(f,n,r);function c(){oe(o,function(p){p.start()})}function v(){oe(o,function(p){p.isRunning()&&p.stop()})}n.splits.on(Ce,function(){if(s.isRunning()){var p=r.splits.usesSegments();p!==u.isRunning()&&(a.info(Qi,[p?"ON":"OFF"]),p?c():v())}});function l(p,h,E){var g=Hf(t.fetchMySegments,E,h,i,p);function d(){!h.isReady()&&!E.splits.usesSegments()&&h.segments.emit(Ae)}return E.splits.usesSegments()?h.splits.once(Ce,d):setTimeout(d,0),o[p]=g,g}return{splitsSyncTask:s,segmentsSyncTask:u,start:function(){a.info(Xi),s.start(),r.splits.usesSegments()&&c()},stop:function(){a.info(Zi),s.isRunning()&&s.stop(),v()},isRunning:s.isRunning,syncAll:function(){var p=[s.execute()];return oe(o,function(h){p.push(h.execute())}),Promise.all(p)},add:l,remove:function(p){delete o[p]},get:function(p){return o[p]}}}var Ys=function(){function e(t){t===void 0&&(t=0),this.maxQueue=t,this.queue=[]}return e.prototype.setOnFullQueueCb=function(t){this.onFullQueue=t},e.prototype.track=function(t){var r;(r=this.queue).push.apply(r,t),this.maxQueue>0&&this.queue.length>=this.maxQueue&&this.onFullQueue&&this.onFullQueue()},e.prototype.clear=function(){this.queue=[]},e.prototype.pop=function(t){var r=this.queue;return this.clear(),t?t.concat(r):r},e.prototype.isEmpty=function(){return this.queue.length===0},e}(),$f=3600*1e3;function qs(e){return e-e%$f}var js=3e4,zs=function(){function e(t){t===void 0&&(t=js),this.cache={},this.cacheSize=0,this.maxStorage=t}return e.prototype._makeKey=function(t,r){return t+"::"+qs(r)},e.prototype.track=function(t,r,n){var i=this._makeKey(t,r),a=this.cache[i];this.cache[i]=a?a+n:n,this.onFullQueue&&(this.cacheSize=this.cacheSize+n,this.cacheSize>=this.maxStorage&&this.onFullQueue())},e.prototype.pop=function(t){var r=this.cache;return this.clear(),t?(Object.keys(r).forEach(function(n){t[n]?t[n]+=r[n]:t[n]=r[n]}),t):r},e.prototype.clear=function(){this.cache={},this.cacheSize=0},e.prototype.isEmpty=function(){return Object.keys(this.cache).length===0},e}(),Jf=5*1024*1024,Vs=function(){function e(t){t===void 0&&(t=0),this.maxQueue=t,this.queue=[],this.queueByteSize=0}return e.prototype.setOnFullQueueCb=function(t){this.onFullQueue=t},e.prototype.track=function(t,r){return r===void 0&&(r=0),this.queueByteSize+=r,this.queue.push(t),this._checkForFlush(),!0},e.prototype.clear=function(){this.queue=[],this.queueByteSize=0},e.prototype.pop=function(t){var r=this.queue;return this.clear(),t?t.concat(r):r},e.prototype.isEmpty=function(){return this.queue.length===0},e.prototype._checkForFlush=function(){(this.queueByteSize>Jf||this.maxQueue>0&&this.queue.length>=this.maxQueue)&&this.onFullQueue&&this.onFullQueue()},e}(),ec=/[^.]+$/,tc="SPLITIO";function rc(e){return e?e+".SPLITIO":"SPLITIO"}var nc=function(){function e(t){t===void 0&&(t=tc),this.prefix=t}return e.prototype.buildTrafficTypeKey=function(t){return this.prefix+".trafficType."+t},e.prototype.buildFlagSetKey=function(t){return this.prefix+".flagSet."+t},e.prototype.buildSplitKey=function(t){return this.prefix+".split."+t},e.prototype.buildSplitsTillKey=function(){return this.prefix+".splits.till"},e.prototype.isSplitKey=function(t){return Ye(t,this.prefix+".split.")},e.prototype.buildSplitKeyPrefix=function(){return this.prefix+".split."},e.prototype.buildSplitsWithSegmentCountKey=function(){return this.prefix+".splits.usingSegments"},e.prototype.buildSegmentNameKey=function(t){return this.prefix+".segment."+t},e.prototype.buildSegmentTillKey=function(t){return this.prefix+".segment."+t+".till"},e.prototype.extractKey=function(t){var r=t.match(ec);if(r&&r.length)return r[0];throw new Error("Invalid latency key provided")},e.prototype.buildHashKey=function(){return this.prefix+".hash"},e}();function ic(e){return Yt(e.core.authorizationKey+"::"+e.sync.__splitFiltersValidation.queryString).toString(16)}var An=function(e){je(t,e);function t(r,n){var i=e.call(this,r)||this;return i.matchingKey=n,i.regexSplitsCacheKey=new RegExp("^"+r+"\\.(splits?|trafficType|flagSet)\\."),i}return t.prototype.buildSegmentNameKey=function(r){return this.prefix+"."+this.matchingKey+".segment."+r},t.prototype.extractSegmentName=function(r){var n=this.prefix+"."+this.matchingKey+".segment.";if(Ye(r,n))return r.substr(n.length)},t.prototype.buildOldSegmentNameKey=function(r){return this.matchingKey+"."+this.prefix+".segment."+r},t.prototype.extractOldSegmentKey=function(r){var n=this.matchingKey+"."+this.prefix+".segment.";if(Ye(r,n))return r.substr(n.length)},t.prototype.buildLastUpdatedKey=function(){return this.prefix+".splits.lastUpdated"},t.prototype.isSplitsCacheKey=function(r){return this.regexSplitsCacheKey.test(r)},t}(nc);function Qr(){var e="__SPLITSOFTWARE__";try{return localStorage.setItem(e,e),localStorage.removeItem(e),!0}catch{return!1}}var Qs=function(){function e(){}return e.prototype.addSplits=function(t){var r=this;return t.map(function(n){return r.addSplit(n[0],n[1])})},e.prototype.removeSplits=function(t){var r=this;return t.map(function(n){return r.removeSplit(n)})},e.prototype.getSplits=function(t){var r=this,n={};return t.forEach(function(i){n[i]=r.getSplit(i)}),n},e.prototype.getAll=function(){var t=this;return this.getSplitNames().map(function(r){return t.getSplit(r)})},e.prototype.checkCache=function(){return!1},e.prototype.killLocally=function(t,r,n){var i=this.getSplit(t);if(i&&(!i.changeNumber||i.changeNumber<n)){var a=P({},i);return a.killed=!0,a.defaultTreatment=r,a.changeNumber=n,this.addSplit(t,a)}return!1},e}();function ht(e){for(var t=e.conditions||[],r=0;r<t.length;r++)for(var n=t[r].matcherGroup.matchers,i=0;i<n.length;i++)if(n[i].matcherType==="IN_SEGMENT")return!0;return!1}var J="storage:localstorage: ",vr="1",ac=function(e){je(t,e);function t(r,n,i){var a=e.call(this)||this;return a.keys=n,a.log=r.log,a.storageHash=ic(r),a.flagSetsFilter=r.sync.__splitFiltersValidation.groupedFilters.bySet,a._checkExpiration(i),a._checkFilterQuery(),a}return t.prototype._decrementCount=function(r){var n=Pe(localStorage.getItem(r))-1;n>0?localStorage.setItem(r,n):localStorage.removeItem(r)},t.prototype._decrementCounts=function(r){try{if(r){var n=this.keys.buildTrafficTypeKey(r.trafficTypeName);if(this._decrementCount(n),ht(r)){var i=this.keys.buildSplitsWithSegmentCountKey();this._decrementCount(i)}}}catch(a){this.log.error(J+a)}},t.prototype._incrementCounts=function(r){try{if(r){var n=this.keys.buildTrafficTypeKey(r.trafficTypeName);if(localStorage.setItem(n,Pe(localStorage.getItem(n))+1),ht(r)){var i=this.keys.buildSplitsWithSegmentCountKey();localStorage.setItem(i,Pe(localStorage.getItem(i))+1)}}}catch(a){this.log.error(J+a)}},t.prototype.clear=function(){this.log.info(J+"Flushing Splits data from localStorage");for(var r=localStorage.length,n=[],i=0;i<r;i++){var a=localStorage.key(i);a!=null&&this.keys.isSplitsCacheKey(a)&&n.push(a)}n.forEach(function(s){localStorage.removeItem(s)}),this.hasSync=!1},t.prototype.addSplit=function(r,n){try{var i=this.keys.buildSplitKey(r),a=localStorage.getItem(i),s=a?JSON.parse(a):null;return localStorage.setItem(i,JSON.stringify(n)),this._incrementCounts(n),this._decrementCounts(s),s&&this.removeFromFlagSets(s.name,s.sets),this.addToFlagSets(n),!0}catch(o){return this.log.error(J+o),!1}},t.prototype.removeSplit=function(r){try{var n=this.getSplit(r);return localStorage.removeItem(this.keys.buildSplitKey(r)),this._decrementCounts(n),n&&this.removeFromFlagSets(n.name,n.sets),!0}catch(i){return this.log.error(J+i),!1}},t.prototype.getSplit=function(r){var n=localStorage.getItem(this.keys.buildSplitKey(r));return n&&JSON.parse(n)},t.prototype.setChangeNumber=function(r){if(this.updateNewFilter){this.log.info(J+"SDK key or feature flag filter criteria was modified. Updating cache");var n=this.keys.buildHashKey();try{localStorage.setItem(n,this.storageHash)}catch(i){this.log.error(J+i)}this.updateNewFilter=!1}try{return localStorage.setItem(this.keys.buildSplitsTillKey(),r+""),localStorage.setItem(this.keys.buildLastUpdatedKey(),Date.now()+""),this.hasSync=!0,!0}catch(i){return this.log.error(J+i),!1}},t.prototype.getChangeNumber=function(){var r=-1,n=localStorage.getItem(this.keys.buildSplitsTillKey());return n!==null?(n=parseInt(n,10),br(n)?r:n):r},t.prototype.getSplitNames=function(){for(var r=localStorage.length,n=[],i=0;i<r;){var a=localStorage.key(i);a!=null&&this.keys.isSplitKey(a)&&n.push(this.keys.extractKey(a)),i++}return n},t.prototype.trafficTypeExists=function(r){var n=Pe(localStorage.getItem(this.keys.buildTrafficTypeKey(r)));return de(n)&&n>0},t.prototype.usesSegments=function(){if(!this.hasSync)return!0;var r=localStorage.getItem(this.keys.buildSplitsWithSegmentCountKey()),n=r===null?0:Pe(r);return de(n)?n>0:!0},t.prototype.checkCache=function(){return this.getChangeNumber()>-1},t.prototype._checkExpiration=function(r){var n=localStorage.getItem(this.keys.buildLastUpdatedKey());n!==null&&(n=parseInt(n,10),!br(n)&&r&&n<r&&this.clear())},t.prototype._checkFilterQuery=function(){var r=this.keys.buildHashKey(),n=localStorage.getItem(r);if(n!==this.storageHash)try{this.updateNewFilter=!0,this.checkCache()&&this.clear()}catch(i){this.log.error(J+i)}},t.prototype.getNamesByFlagSets=function(r){var n=this;return r.map(function(i){var a=n.keys.buildFlagSetKey(i),s=localStorage.getItem(a);return new re(s?JSON.parse(s):[])})},t.prototype.addToFlagSets=function(r){var n=this;r.sets&&r.sets.forEach(function(i){if(!(n.flagSetsFilter.length>0&&!n.flagSetsFilter.some(function(f){return f===i}))){var a=n.keys.buildFlagSetKey(i),s=localStorage.getItem(a),o=new re(s?JSON.parse(s):[]);o.add(r.name),localStorage.setItem(a,JSON.stringify(Le(o)))}})},t.prototype.removeFromFlagSets=function(r,n){var i=this;n&&n.forEach(function(a){i.removeNames(a,r)})},t.prototype.removeNames=function(r,n){var i=this.keys.buildFlagSetKey(r),a=localStorage.getItem(i);if(a){var s=new re(JSON.parse(a));if(s.delete(n),s.size===0){localStorage.removeItem(i);return}localStorage.setItem(i,JSON.stringify(Le(s)))}},t}(Qs),Xs=function(){function e(){}return e.prototype.registerSegments=function(t){return!1},e.prototype.setChangeNumber=function(t,r){return!0},e.prototype.getChangeNumber=function(t){return-1},e.prototype.resetSegments=function(t){return!0},e}(),bn=function(e){je(t,e);function t(r,n){var i=e.call(this)||this;return i.log=r,i.keys=n,i}return t.prototype.clear=function(){this.log.info(J+"Flushing MySegments data from localStorage"),this.resetSegments([])},t.prototype.addToSegment=function(r){var n=this.keys.buildSegmentNameKey(r);try{return localStorage.setItem(n,vr),!0}catch(i){return this.log.error(J+i),!1}},t.prototype.removeFromSegment=function(r){var n=this.keys.buildSegmentNameKey(r);try{return localStorage.removeItem(n),!0}catch(i){return this.log.error(J+i),!1}},t.prototype.isInSegment=function(r){return localStorage.getItem(this.keys.buildSegmentNameKey(r))===vr},t.prototype.resetSegments=function(r){var n=this,i=!1,a,s=Object.keys(localStorage).reduce(function(o,f){var u=n.keys.extractSegmentName(f);if(u)o.push(u);else if(u=n.keys.extractOldSegmentKey(f),u){var c=n.keys.buildSegmentNameKey(u);try{!localStorage.getItem(c)&&r.indexOf(u)>-1&&(localStorage.setItem(c,vr),o.push(u)),localStorage.removeItem(f)}catch(v){n.log.error(v)}}return o},[]);if(r.length===0&&s.length===r.length)return i;if(s.length!==r.length)i=!0,s.forEach(function(o){return n.removeFromSegment(o)}),r.forEach(function(o){return n.addToSegment(o)});else{for(a=0;a<r.length&&s.indexOf(r[a])!==-1;a++);a<r.length&&(i=!0,s.forEach(function(o){return n.removeFromSegment(o)}),r.forEach(function(o){return n.addToSegment(o)}))}return i},t.prototype.getRegisteredSegments=function(){var r=this;return Object.keys(localStorage).reduce(function(n,i){var a=r.keys.extractSegmentName(i);return a&&n.push(a),n},[])},t.prototype.getKeysCount=function(){return 1},t}(Xs),kt=function(e){je(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.segmentCache={},r}return t.prototype.clear=function(){this.segmentCache={}},t.prototype.addToSegment=function(r){return this.segmentCache[r]=!0,!0},t.prototype.removeFromSegment=function(r){return delete this.segmentCache[r],!0},t.prototype.isInSegment=function(r){return this.segmentCache[r]===!0},t.prototype.resetSegments=function(r){var n=this,i=!1,a,s=Object.keys(this.segmentCache);if(r.length===0&&s.length===r.length)return i;if(s.length!==r.length)i=!0,this.segmentCache={},r.forEach(function(o){n.addToSegment(o)});else{for(a=0;a<r.length&&this.isInSegment(r[a]);a++);a<r.length&&(i=!0,this.segmentCache={},r.forEach(function(o){n.addToSegment(o)}))}return i},t.prototype.getRegisteredSegments=function(){return Object.keys(this.segmentCache)},t.prototype.getKeysCount=function(){return 1},t}(Xs),xt=function(e){je(t,e);function t(r){var n=e.call(this)||this;return n.splitsCache={},n.ttCache={},n.changeNumber=-1,n.splitsWithSegmentsCount=0,n.flagSetsCache={},n.flagSetsFilter=r?r.groupedFilters.bySet:[],n}return t.prototype.clear=function(){this.splitsCache={},this.ttCache={},this.changeNumber=-1,this.splitsWithSegmentsCount=0},t.prototype.addSplit=function(r,n){var i=this.getSplit(r);if(i){var a=i.trafficTypeName;this.ttCache[a]--,this.ttCache[a]||delete this.ttCache[a],this.removeFromFlagSets(i.name,i.sets),ht(i)&&this.splitsWithSegmentsCount--}if(n){this.splitsCache[r]=n;var s=n.trafficTypeName;return this.ttCache[s]=(this.ttCache[s]||0)+1,this.addToFlagSets(n),ht(n)&&this.splitsWithSegmentsCount++,!0}else return!1},t.prototype.removeSplit=function(r){var n=this.getSplit(r);if(n){delete this.splitsCache[r];var i=n.trafficTypeName;return this.ttCache[i]--,this.ttCache[i]||delete this.ttCache[i],this.removeFromFlagSets(n.name,n.sets),ht(n)&&this.splitsWithSegmentsCount--,!0}else return!1},t.prototype.getSplit=function(r){return this.splitsCache[r]||null},t.prototype.setChangeNumber=function(r){return this.changeNumber=r,!0},t.prototype.getChangeNumber=function(){return this.changeNumber},t.prototype.getSplitNames=function(){return Object.keys(this.splitsCache)},t.prototype.trafficTypeExists=function(r){return de(this.ttCache[r])&&this.ttCache[r]>0},t.prototype.usesSegments=function(){return this.getChangeNumber()===-1||this.splitsWithSegmentsCount>0},t.prototype.getNamesByFlagSets=function(r){var n=this;return r.map(function(i){return n.flagSetsCache[i]||new re})},t.prototype.addToFlagSets=function(r){var n=this;r.sets&&r.sets.forEach(function(i){n.flagSetsFilter.length>0&&!n.flagSetsFilter.some(function(a){return a===i})||(n.flagSetsCache[i]||(n.flagSetsCache[i]=new re([])),n.flagSetsCache[i].add(r.name))})},t.prototype.removeFromFlagSets=function(r,n){var i=this;n&&n.forEach(function(a){i.removeNames(a,r)})},t.prototype.removeNames=function(r,n){this.flagSetsCache[r]&&(this.flagSetsCache[r].delete(n),this.flagSetsCache[r].size===0&&delete this.flagSetsCache[r])},t}(Qs),Zs="GOOGLE_ANALYTICS_TO_SPLIT",$s="SPLIT_TO_GOOGLE_ANALYTICS",sc=864e6,oc=0,uc=22,fc=1.5;function On(e){var t=Math.min(uc,Math.max(oc,Math.ceil(Math.log(e)/Math.log(fc))));return br(t)?0:t}var cc=20,lc=10;function Fn(){return[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}var hc=.001;function Js(e){var t=e.settings;return t.mode!==Me&&(t.core.key===void 0||Math.random()<=hc)}var eo=function(){function e(t,r){this.splits=t,this.segments=r,this.e=!0,this.notReadyUsage=0,this.impressionStats=[0,0,0],this.eventStats=[0,0],this.lastSync={},this.httpErrors={},this.httpLatencies={},this.authRejections=0,this.tokenRefreshes=0,this.streamingEvents=[],this.tags=[],this.exceptions={},this.latencies={},this.updatesFromSSE={sp:0,ms:0}}return e.prototype.isEmpty=function(){return this.e},e.prototype.clear=function(){},e.prototype.pop=function(){return this.e=!0,{lS:this.getLastSynchronization(),mL:this.popLatencies(),mE:this.popExceptions(),hE:this.popHttpErrors(),hL:this.popHttpLatencies(),tR:this.popTokenRefreshes(),aR:this.popAuthRejections(),iQ:this.getImpressionStats(Mt),iDe:this.getImpressionStats(gs),iDr:this.getImpressionStats(Ir),spC:this.splits&&this.splits.getSplitNames().length,seC:this.segments&&this.segments.getRegisteredSegments().length,skC:this.segments&&this.segments.getKeysCount(),sL:this.getSessionLength(),eQ:this.getEventStats(Mt),eD:this.getEventStats(Ir),sE:this.popStreamingEvents(),t:this.popTags(),ufs:this.popUpdatesFromSSE()}},e.prototype.getTimeUntilReady=function(){return this.timeUntilReady},e.prototype.recordTimeUntilReady=function(t){this.timeUntilReady=t},e.prototype.getTimeUntilReadyFromCache=function(){return this.timeUntilReadyFromCache},e.prototype.recordTimeUntilReadyFromCache=function(t){this.timeUntilReadyFromCache=t},e.prototype.getNonReadyUsage=function(){return this.notReadyUsage},e.prototype.recordNonReadyUsage=function(){this.notReadyUsage++},e.prototype.getImpressionStats=function(t){return this.impressionStats[t]},e.prototype.recordImpressionStats=function(t,r){this.impressionStats[t]+=r,this.e=!1},e.prototype.getEventStats=function(t){return this.eventStats[t]},e.prototype.recordEventStats=function(t,r){this.eventStats[t]+=r,this.e=!1},e.prototype.getLastSynchronization=function(){return this.lastSync},e.prototype.recordSuccessfulSync=function(t,r){this.lastSync[t]=r,this.e=!1},e.prototype.popHttpErrors=function(){var t=this.httpErrors;return this.httpErrors={},t},e.prototype.recordHttpError=function(t,r){var n=this.httpErrors[t]=this.httpErrors[t]||{};n[r]=(n[r]||0)+1,this.e=!1},e.prototype.popHttpLatencies=function(){var t=this.httpLatencies;return this.httpLatencies={},t},e.prototype.recordHttpLatency=function(t,r){var n=this.httpLatencies[t]=this.httpLatencies[t]||Fn();n[On(r)]++,this.e=!1},e.prototype.popAuthRejections=function(){var t=this.authRejections;return this.authRejections=0,t},e.prototype.recordAuthRejections=function(){this.authRejections++,this.e=!1},e.prototype.popTokenRefreshes=function(){var t=this.tokenRefreshes;return this.tokenRefreshes=0,t},e.prototype.recordTokenRefreshes=function(){this.tokenRefreshes++,this.e=!1},e.prototype.popStreamingEvents=function(){return this.streamingEvents.splice(0)},e.prototype.recordStreamingEvents=function(t){this.streamingEvents.length<cc&&this.streamingEvents.push(t),this.e=!1},e.prototype.popTags=function(){return this.tags.splice(0)},e.prototype.addTag=function(t){this.tags.length<lc&&this.tags.push(t),this.e=!1},e.prototype.getSessionLength=function(){return this.sessionLength},e.prototype.recordSessionLength=function(t){this.sessionLength=t,this.e=!1},e.prototype.popExceptions=function(){var t=this.exceptions;return this.exceptions={},t},e.prototype.recordException=function(t){this.exceptions[t]=(this.exceptions[t]||0)+1,this.e=!1},e.prototype.popLatencies=function(){var t=this.latencies;return this.latencies={},t},e.prototype.recordLatency=function(t,r){var n=this.latencies[t]=this.latencies[t]||Fn();n[On(r)]++,this.e=!1},e.prototype.popUpdatesFromSSE=function(){var t=this.updatesFromSSE;return this.updatesFromSSE={sp:0,ms:0},t},e.prototype.recordUpdatesFromSSE=function(t){this.updatesFromSSE[t]++,this.e=!1},e}(),to=function(){function e(t){t===void 0&&(t=js),this.uniqueTrackerSize=0,this.uniqueKeysTracker={},this.maxStorage=t}return e.prototype.setOnFullQueueCb=function(t){this.onFullQueue=t},e.prototype.track=function(t,r){this.uniqueKeysTracker[t]||(this.uniqueKeysTracker[t]=new re);var n=this.uniqueKeysTracker[t];n.has(r)||(n.add(r),this.uniqueTrackerSize++),this.uniqueTrackerSize>=this.maxStorage&&this.onFullQueue&&this.onFullQueue()},e.prototype.clear=function(){this.uniqueTrackerSize=0,this.uniqueKeysTracker={}},e.prototype.pop=function(){var t=this.uniqueKeysTracker;return this.clear(),this.fromUniqueKeysCollector(t)},e.prototype.isEmpty=function(){return Object.keys(this.uniqueKeysTracker).length===0},e.prototype.fromUniqueKeysCollector=function(t){for(var r=[],n=Object.keys(t),i=0;i<n.length;i++){var a=n[i],s=Le(t[a]),o={k:a,fs:s};r.push(o)}return{keys:r}},e}();function qt(e){var t=e.settings,r=t.scheduler,n=r.impressionsQueueSize,i=r.eventsQueueSize,a=t.sync,s=a.impressionsMode,o=a.__splitFiltersValidation,f=new xt(o),u=new kt,c={splits:f,segments:u,impressions:new Ys(n),impressionCounts:s!==_e?new zs:void 0,events:new Vs(i),telemetry:Js(e)?new eo(f,u):void 0,uniqueKeys:s===Re?new to:void 0,destroy:function(){this.splits.clear(),this.segments.clear(),this.impressions.clear(),this.impressionCounts&&this.impressionCounts.clear(),this.events.clear(),this.uniqueKeys&&this.uniqueKeys.clear()},shared:function(){return{splits:this.splits,segments:new kt,impressions:this.impressions,impressionCounts:this.impressionCounts,events:this.events,telemetry:this.telemetry,destroy:function(){this.splits=new xt(o),this.segments.clear()}}}};if(e.settings.mode===Me){var v=function(){return!0};c.impressions.track=v,c.events.track=v,c.impressionCounts&&(c.impressionCounts.track=v),c.uniqueKeys&&(c.uniqueKeys.track=v)}return c}qt.type=ut;function vc(e){e===void 0&&(e={});var t=rc(e.prefix);function r(n){if(!Qr())return n.settings.log.warn(J+"LocalStorage API is unavailable. Falling back to default MEMORY storage"),qt(n);var i=n.settings,a=n.settings,s=a.log,o=a.scheduler,f=o.impressionsQueueSize,u=o.eventsQueueSize,c=a.sync,v=c.impressionsMode,l=c.__splitFiltersValidation,p=qe(i.core.key),h=new An(t,p),E=Date.now()-sc,g=new ac(i,h,E),d=new bn(s,h);return{splits:g,segments:d,impressions:new Ys(f),impressionCounts:v!==_e?new zs:void 0,events:new Vs(u),telemetry:Js(n)?new eo(g,d):void 0,uniqueKeys:v===Re?new to:void 0,destroy:function(){var T;this.splits=new xt(l),this.segments=new kt,this.impressions.clear(),this.impressionCounts&&this.impressionCounts.clear(),this.events.clear(),(T=this.uniqueKeys)===null||T===void 0||T.clear()},shared:function(T){var _=new An(t,T);return{splits:this.splits,segments:new bn(s,_),impressions:this.impressions,impressionCounts:this.impressionCounts,events:this.events,telemetry:this.telemetry,destroy:function(){this.splits=new xt(l),this.segments=new kt}}}}}return r.type=Nr,r}function Y(e){return e!=null&&typeof e.then=="function"}function pc(e,t,r,n){if(!G(t)||t.length===0)return e.warn(n+": you passed an invalid attribute name, attribute name must be a non-empty string."),!1;var i=G(r),a=de(r),s=Yr(r),o=Array.isArray(r);return i||a||s||o?!0:(e.warn(n+": you passed an invalid attribute value for "+t+". Acceptable types are: string, number, boolean and array of strings."),!1)}function ro(e,t,r){return t==null||Z(t)?t:(e.error(Pr,[r,"attributes"]),!1)}function Ln(e,t,r){if(!ro(e,t,r))return!1;var n=!0;return Object.keys(t).forEach(function(i){pc(e,i,t[i],r)||(n=!1)}),n}var dc=/^[a-zA-Z0-9][-_.:a-zA-Z0-9]{0,79}$/,pr="event_type";function no(e,t,r){if(t==null)e.error(ze,[r,pr]);else if(!G(t))e.error(Ve,[r,pr]);else if(t.length===0)e.error(Qe,[r,pr]);else if(!dc.test(t))e.error(Qa,[r,t]);else return t;return!1}function io(e,t,r){return de(t)||t==null?t:(e.error(Za,[r]),!1)}var it={NULL:0,STRING:2,BOOLEAN:4,NUMBER:8},gc=300,mc=1024*32,dr=1024;function ao(e,t,r){if(t==null)return{properties:null,size:dr};if(!Z(t))return e.error(Pr,[r,"properties"]),{properties:!1,size:dr};var n=Object.keys(t),i=P({},t),a={properties:i,size:dr};n.length>gc&&e.warn(Na,[r]);for(var s=0;s<n.length;s++){a.size+=n[s].length*it.STRING;var o=i[n[s]],f=G(o),u=de(o),c=Yr(o),v=o===null;if(f||u||c||v||(i[n[s]]=null,o=null,v=!0,e.warn(Ra,[r,n[s]])),v?a.size+=it.NULL:u?a.size+=it.NUMBER:c?a.size+=it.BOOLEAN:f&&(a.size+=o.length*it.STRING),a.size>mc){e.error(Xa,[r]),a.properties=!1;break}}return a}function vt(e,t,r){return t.isDestroyed()?(e.error($a,[r]),!1):!0}function bt(e,t,r,n){return t.isReady()||t.isReadyFromCache()?!0:(e.warn(ga,[r,n?" for feature flag "+n.toString():""]),!1)}var Ec="killed",Sc="default rule",so="definition not found",oo="not ready",jt="exception",yc="archived",Tc="not in split";function Lr(e,t,r,n,i){return t.isReady()&&(n===so||n==null)?(e.warn(Aa,[i,r]),!1):!0}function Mn(e,t,r){e.warn(Oa,[r,t])}function _c(e,t,r,n,i,a){if(!t.isReady()||n===Me)return!0;var s=r.trafficTypeExists(i);return Y(s)?s.then(function(o){return o||Mn(e,i,a),o}):(s||Mn(e,i,a),s)}function Rc(e){var t=e.conditions,r=Hr(t,function(n){return n.conditionType==="ROLLOUT"});return r||(r=t[0]),r?r.partitions.map(function(n){return n.treatment}):[]}function Mr(e){return e?{name:e.name,trafficType:e.trafficTypeName,killed:e.killed,changeNumber:e.changeNumber||0,treatments:Rc(e),configs:e.configurations||{},sets:e.sets||[],defaultTreatment:e.defaultTreatment}:null}function Dn(e){var t=[];return e.forEach(function(r){var n=Mr(r);n&&t.push(n)}),t}function Nc(e,t,r){var n=r.readinessManager,i=r.sdkStatus,a=e.log,s=e.mode,o=Et(s);return P(Object.create(i),{split:function(f){var u=qr(a,f,et);if(!vt(a,n,et)||!bt(a,n,et)||!u)return o?Promise.resolve(null):null;var c=t.getSplit(u);return Y(c)?c.catch(function(){return null}).then(function(v){return Lr(a,n,u,v,et),Mr(v)}):(Lr(a,n,u,c,et),Mr(c))},splits:function(){if(!vt(a,n,pn)||!bt(a,n,pn))return o?Promise.resolve([]):[];var f=t.getAll();return Y(f)?f.catch(function(){return[]}).then(Dn):Dn(f)},names:function(){if(!vt(a,n,dn)||!bt(a,n,dn))return o?Promise.resolve([]):[];var f=t.getSplitNames();return Y(f)?f.catch(function(){return[]}):f}})}var Cc=function(){function e(){this.attributesCache={}}return e.prototype.setAttribute=function(t,r){return this.attributesCache[t]=r,!0},e.prototype.getAttribute=function(t){return this.attributesCache[t]},e.prototype.setAttributes=function(t){return this.attributesCache=P(this.attributesCache,t),!0},e.prototype.getAll=function(){return this.attributesCache},e.prototype.removeAttribute=function(t){return Object.keys(this.attributesCache).indexOf(t)>=0?(delete this.attributesCache[t],!0):!1},e.prototype.clear=function(){return this.attributesCache={},!0},e}();function Ic(e,t){var r=new Cc,n=t.getTreatment,i=t.getTreatmentWithConfig,a=t.getTreatments,s=t.getTreatmentsWithConfig,o=t.getTreatmentsByFlagSets,f=t.getTreatmentsWithConfigByFlagSets,u=t.getTreatmentsByFlagSet,c=t.getTreatmentsWithConfigByFlagSet,v=t.track;function l(m,I,O){return n(m,I,R(O))}function p(m,I,O){return i(m,I,R(O))}function h(m,I,O){return a(m,I,R(O))}function E(m,I,O){return s(m,I,R(O))}function g(m,I,O){return o(m,I,R(O))}function d(m,I,O){return f(m,I,R(O))}function T(m,I,O){return u(m,I,R(O))}function _(m,I,O){return c(m,I,R(O))}function S(m,I,O,w,x){return v(m,I,O,w,x)}function R(m){var I=r.getAll();return Object.keys(I).length>0?P({},I,m):m}return P(t,{getTreatment:l,getTreatmentWithConfig:p,getTreatments:h,getTreatmentsWithConfig:E,getTreatmentsByFlagSets:g,getTreatmentsWithConfigByFlagSets:d,getTreatmentsByFlagSet:T,getTreatmentsWithConfigByFlagSet:_,track:S,setAttribute:function(m,I){var O={};return O[m]=I,Ln(e,O,"setAttribute")?(e.debug("stored "+I+" for attribute "+m),r.setAttribute(m,I)):!1},getAttribute:function(m){return e.debug("retrieved attribute "+m),r.getAttribute(m+"")},setAttributes:function(m){return Ln(e,m,"setAttributes")?r.setAttributes(m):!1},getAttributes:function(){return r.getAll()},removeAttribute:function(m){return e.debug("removed attribute "+m),r.removeAttribute(m+"")},clearAttributes:function(){return r.clear()}})}function wn(e,t,r,n){var i=Ic(e,t);return P(i,{getTreatment:i.getTreatment.bind(i,r),getTreatmentWithConfig:i.getTreatmentWithConfig.bind(i,r),getTreatments:i.getTreatments.bind(i,r),getTreatmentsWithConfig:i.getTreatmentsWithConfig.bind(i,r),getTreatmentsByFlagSets:i.getTreatmentsByFlagSets.bind(i,r),getTreatmentsWithConfigByFlagSets:i.getTreatmentsWithConfigByFlagSets.bind(i,r),getTreatmentsByFlagSet:i.getTreatmentsByFlagSet.bind(i,r),getTreatmentsWithConfigByFlagSet:i.getTreatmentsWithConfigByFlagSet.bind(i,r),track:n?i.track.bind(i,r,n):i.track.bind(i,r),isClientSide:!0,key:r,trafficType:n})}var W={UNDEFINED:0,ALL_KEYS:1,IN_SEGMENT:2,WHITELIST:3,EQUAL_TO:4,GREATER_THAN_OR_EQUAL_TO:5,LESS_THAN_OR_EQUAL_TO:6,BETWEEN:7,EQUAL_TO_SET:8,CONTAINS_ANY_OF_SET:9,CONTAINS_ALL_OF_SET:10,PART_OF_SET:11,ENDS_WITH:12,STARTS_WITH:13,CONTAINS_STRING:14,IN_SPLIT_TREATMENT:15,EQUAL_TO_BOOLEAN:16,MATCHES_STRING:17},j={BOOLEAN:"BOOLEAN",STRING:"STRING",NUMBER:"NUMBER",SET:"SET",DATETIME:"DATETIME",NOT_SPECIFIED:"NOT_SPECIFIED"};function Ac(e){var t=W[e];return t||W.UNDEFINED}function bc(e){return e?e.segmentName:void 0}function Oc(e){return new re(e.whitelist)}function kn(e){return e.whitelist}function xn(e){return e.value}function uo(e){return new Date(e).setUTCHours(0,0,0,0)}function Ot(e){return new Date(e).setUTCSeconds(0,0)}function Fc(e){var t=e.map(function(r){var n=r.matcherType,i=r.negate,a=r.keySelector,s=r.userDefinedSegmentMatcherData,o=r.whitelistMatcherData,f=r.unaryNumericMatcherData,u=r.betweenMatcherData,c=r.dependencyMatcherData,v=r.booleanMatcherData,l=r.stringMatcherData,p=a&&a.attribute,h=Ac(n),E=j.STRING,g=void 0;return h===W.IN_SEGMENT?g=bc(s):h===W.WHITELIST?g=Oc(o):h===W.EQUAL_TO?(g=xn(f),E=j.NUMBER,f.dataType==="DATETIME"&&(g=uo(g),E=j.DATETIME)):h===W.GREATER_THAN_OR_EQUAL_TO||h===W.LESS_THAN_OR_EQUAL_TO?(g=xn(f),E=j.NUMBER,f.dataType==="DATETIME"&&(g=Ot(g),E=j.DATETIME)):h===W.BETWEEN?(g=u,E=j.NUMBER,g.dataType==="DATETIME"&&(g.start=Ot(g.start),g.end=Ot(g.end),E=j.DATETIME)):h===W.EQUAL_TO_SET||h===W.CONTAINS_ANY_OF_SET||h===W.CONTAINS_ALL_OF_SET||h===W.PART_OF_SET?(g=kn(o),E=j.SET):h===W.STARTS_WITH||h===W.ENDS_WITH||h===W.CONTAINS_STRING?g=kn(o):h===W.IN_SPLIT_TREATMENT?(g=c,E=j.NOT_SPECIFIED):h===W.EQUAL_TO_BOOLEAN?(E=j.BOOLEAN,g=v):h===W.MATCHES_STRING&&(g=l),{attribute:p,negate:i,type:h,value:g,dataType:E}});return Ie(t,function(r){return r.type===W.UNDEFINED})===-1?t:[]}var Lc=function(){function e(t,r){if(t[t.length-1]!==100)throw new RangeError("Provided invalid dataset as input");this._ranges=t,this._treatments=r}return e.parse=function(t){var r=t.reduce(function(a,s){var o=s.size,f=s.treatment;return a.ranges.push(a.inc+=o),a.treatments.push(f),a},{inc:0,ranges:[],treatments:[]}),n=r.ranges,i=r.treatments;return new e(n,i)},e.prototype.getTreatmentFor=function(t){if(t<0||t>100)throw new RangeError("Please provide a value between 0 and 100");var r=Ie(this._ranges,function(i){return t<=i}),n=this._treatments[r];return n},e}();function Mc(e){return function(r){return e.debug(ui),r!=null}}function Dc(e,t,r){return function(i){var a=r.segments.isInSegment(t,i);return Y(a)?a.then(function(s){return e.debug(Er,[t,i,a]),s}):e.debug(Er,[t,i,a]),a}}function wc(e,t){return function(n){var i=t.has(n);return e.debug(Ci,[n,Le(t).join(","),i]),i}}function kc(e,t){return function(n){var i=n===t;return e.debug(gi,[n,t,i]),i}}function xc(e,t){return function(n){var i=n>=t;return e.debug(Si,[n,t,i]),i}}function Pc(e,t){return function(n){var i=n<=t;return e.debug(yi,[n,t,i]),i}}function Uc(e,t){return function(n){var i=n>=t.start&&n<=t.end;return e.debug(fi,[n,t.start,t.end,i]),i}}function Gc(e,t){return function(n){for(var i=n.length===t.length,a=function(o){Ie(t,function(f){return f===n[o]})<0&&(i=!1)},s=0;s<n.length&&i;s++)a(s);return e.debug(mi,[n,t,i]),i}}function Kc(e,t){return function(n){for(var i=!1,a=function(o){Ie(n,function(f){return f===t[o]})>=0&&(i=!0)},s=0;s<t.length&&!i;s++)a(s);return e.debug(hi,[n,t,i]),i}}function Bc(e,t){return function(n){var i=!0;if(n.length<t.length)i=!1;else for(var a=function(o){Ie(n,function(f){return f===t[o]})<0&&(i=!1)},s=0;s<t.length&&i;s++)a(s);return e.debug(li,[n,t,i]),i}}function Wc(e,t){return function(n){for(var i=n.length<=t.length,a=function(o){Ie(t,function(f){return f===n[o]})<0&&(i=!1)},s=0;s<n.length&&i;s++)a(s);return e.debug(Ti,[n,t,i]),i}}function Hc(e,t){return function(n){var i=t.some(function(a){return _u(n,a)});return e.debug(Ei,[n,t,i]),i}}function Yc(e,t){return function(n){var i=t.some(function(a){return Ye(n,a)});return e.debug(Ni,[n,t,i]),i}}function qc(e,t){return function(n){var i=t.some(function(a){return G(n)&&n.indexOf(a)>-1});return e.debug(vi,[n,t,i]),i}}function jc(e,t,r){var n=t.split,i=t.treatments;function a(s,o,f){var u=!1;return Array.isArray(o)&&(u=o.indexOf(s.treatment)!==-1),e.debug(pi,[f,s.treatment,s.label,f,o,u]),u}return function(o,f){var u=o.key,c=o.attributes;e.debug(di,[n,JSON.stringify(u),c?`
17
- attributes: `+JSON.stringify(c):""]);var v=f(e,u,n,c,r);return Y(v)?v.then(function(l){return a(l,i,n)}):a(v,i,n)}}function zc(e,t){return function(n){var i=t===n;return e.debug(ci,[t,n]),i}}function Vc(e,t){return function(n){var i;try{i=new RegExp(t)}catch{return e.debug(Ri,[t]),!1}var a=i.test(n);return e.debug(_i,[n,t,a?"yes":"no"]),a}}var Pn=[void 0,Mc,Dc,wc,kc,xc,Pc,Uc,Gc,Kc,Bc,Wc,Hc,Yc,qc,jc,zc,Vc];function Qc(e,t,r){var n=t.type,i=t.value,a;return Pn[n]&&(a=Pn[n](e,i,r)),a}function Xc(e){var t=Pe(e);return isNaN(t)?void 0:t}function Zc(e){var t=e;Z(e)&&(t=e.matchingKey?e.matchingKey:void 0);var r=Rs(t);return r||void 0}function $c(e){var t=Array.isArray(e)?Kt(e.map(function(r){return r+""})):[];return t.length?t:void 0}function Jc(e){if(e===!0||e===!1)return e;if(typeof e=="string"){var t=e.toLocaleLowerCase();if(t==="true")return!0;if(t==="false")return!1}}function el(e,t){return{key:e,attributes:t}}function tl(e,t){switch(e){case W.EQUAL_TO:return t==="DATETIME"?uo:void 0;case W.GREATER_THAN_OR_EQUAL_TO:case W.LESS_THAN_OR_EQUAL_TO:case W.BETWEEN:return t==="DATETIME"?Ot:void 0;case W.IN_SPLIT_TREATMENT:return el;default:return}}function rl(e,t,r,n,i){var a=tl(t,n),s;switch(n){case j.NUMBER:case j.DATETIME:s=Xc(r);break;case j.STRING:s=Zc(r);break;case j.SET:s=$c(r);break;case j.BOOLEAN:s=Jc(r);break;case j.NOT_SPECIFIED:s=r;break;default:s=void 0}return a&&(s=a(s,i)),e.debug(Ai,[r,n,s instanceof Object?JSON.stringify(s):s]),s}function nl(e,t,r,n){var i=void 0;return r?n?(i=n[r],e.debug(Ii,[r,i])):e.warn(pa,[r]):i=t,i}function il(e,t,r,n){var i=r.attribute,a=nl(e,t,i,n),s=rl(e,r.type,a,r.dataType,n);if(s!==void 0)return s;e.warn(va,[a+(i?" for attribute "+i:"")])}function al(e,t,r,n){var i=Us(t,r),a=n.getTreatmentFor(i);return e.debug(oi,[i,t,r,a]),a}function sl(e,t,r){if(e<100){var n=Us(t,r);if(n>e)return!1}return!0}function Un(e,t,r,n,i,a){if(t){var s=al(e,r,n,i);return{treatment:s,label:a}}}function ol(e,t,r,n,i){return function(s,o,f,u,c,v){if(i==="ROLLOUT"&&!sl(f,s.bucketingKey,u))return{treatment:void 0,label:Tc};var l=t(s,c,v);return Y(l)?l.then(function(p){return Un(e,p,s.bucketingKey,o,r,n)}):Un(e,l,s.bucketingKey,o,r,n)}}function ul(e,t){function r(){return e.error(Ga),{treatment:ue,label:jt}}function n(a){for(var s=a.length,o=0;o<s;o++){var f=a[o];if(f!==void 0)return e.debug(ai,[f.treatment]),f}e.debug(si)}function i(a,s,o,f,u,c){var v=t.map(function(l){return l(a,s,o,f,u,c)});return Ie(v,Y)!==-1?Promise.all(v).then(function(l){return n(l)}):n(v)}return!Array.isArray(t)||Array.isArray(t)&&t.length===0?r:i}function fl(e,t){function r(n){var i=n.every(function(a){return a});return e.debug(ii,[i]),i}return function(){for(var i=[],a=0;a<arguments.length;a++)i[a]=arguments[a];var s=t.map(function(o){return o.apply(void 0,i)});return Ie(s,Y)!==-1?Promise.all(s).then(r):r(s)}}function cl(e,t,r){for(var n=[],i=0;i<t.length;i++){var a=t[i],s=a.matcherGroup,o=a.partitions,f=a.label,u=a.conditionType,c=Fc(s.matchers),v=c.map(function(l){var p=Qc(e,l,r);return function(h,E,g){var d=il(e,h,l,E),T=d!==void 0&&p?p(d,g):!1;return Y(T)?T.then(function(_){return!!(_^l.negate)}):!!(T^l.negate)}});if(v.length===0){n=[];break}n.push(ol(e,fl(e,v),Lc.parse(o),f,u))}return ul(e,n)}function Gn(e,t){return{treatment:Ar(e,"treatment",t),label:Ar(e,"label",Sc)}}var ll=function(){function e(t,r){this.baseInfo=t,this.evaluator=r,typeof this.baseInfo.defaultTreatment!="string"&&(this.baseInfo.defaultTreatment=ue)}return e.parse=function(t,r,n){var i=r.conditions,a=cl(t,i,n);return new e(r,a)},e.prototype.getKey=function(){return this.baseInfo.name},e.prototype.getTreatment=function(t,r,n){var i=this.baseInfo,a=i.killed,s=i.seed,o=i.defaultTreatment,f=i.trafficAllocation,u=i.trafficAllocationSeed,c,v,l;try{c=Gs(t)}catch{return{treatment:ue,label:jt}}if(this.isGarbage())v=ue,l=yc;else if(a)v=o,l=Ec;else{var p=this.evaluator(c,s,f,u,r,n);return Y(p)?p.then(function(h){return Gn(h,o)}):Gn(p,o)}return{treatment:v,label:l}},e.prototype.isGarbage=function(){return this.baseInfo.status==="ARCHIVED"},e.prototype.getChangeNumber=function(){return this.baseInfo.changeNumber},e}(),Dr={treatment:ue,label:jt,config:null};function Kn(e){var t={};return e.forEach(function(r){t[r]=Dr}),t}function fo(e,t,r,n,i){var a;try{a=i.splits.getSplit(r)}catch{return Dr}return Y(a)?a.then(function(s){return wr(e,s,t,n,i)}).catch(function(){return Dr}):wr(e,a,t,n,i)}function co(e,t,r,n,i){var a;try{a=i.splits.getSplits(r)}catch{return Kn(r)}return Y(a)?a.then(function(s){return Bn(e,r,s,t,n,i)}).catch(function(){return Kn(r)}):Bn(e,r,a,t,n,i)}function hl(e,t,r,n,i,a){var s;function o(f){for(var u=new re,c=0;c<r.length;c++){var v=f[c];v.size?u=kf(u,v):e.warn(Ua,[a,r[c]])}return u.size?co(e,t,Le(u),n,i):{}}try{s=i.splits.getNamesByFlagSets(r)}catch{return{}}return Y(s)?s.then(function(f){return o(f)}).catch(function(){return{}}):o(s)}function wr(e,t,r,n,i){var a={treatment:ue,label:so,config:null};if(t){var s=ll.parse(e,t,i);if(a=s.getTreatment(r,n,fo),Y(a))return a.then(function(o){return o.changeNumber=s.getChangeNumber(),o.config=t.configurations&&t.configurations[o.treatment]||null,o});a.changeNumber=s.getChangeNumber(),a.config=t.configurations&&t.configurations[a.treatment]||null}return a}function Bn(e,t,r,n,i,a){var s={},o=[];return t.forEach(function(f){var u=wr(e,r[f],n,i,a);Y(u)?o.push(u.then(function(c){s[f]=c})):s[f]=u}),o.length>0?Promise.all(o).then(function(){return s}):s}var kr={treatment:ue,label:oo};function Wn(e){var t={};return e.forEach(function(r){t[r]=kr}),t}function vl(e){var t=e.sdkReadinessManager.readinessManager,r=e.storage,n=e.settings,i=e.impressionsTracker,a=e.eventTracker,s=e.telemetryTracker,o=n.log,f=n.mode,u=Et(f);function c(S,R,m,I,O){I===void 0&&(I=!1),O===void 0&&(O=fs);var w=s.trackEval(I?tu:Jo),x=function(b){var A=[],k=T(b,R,S,m,I,O,A);return i.track(A,m),w(A[0]&&A[0].label),k},L=t.isReady()||t.isReadyFromCache()?fo(o,S,R,m,r):u?Promise.resolve(kr):kr;return Y(L)?L.then(function(b){return x(b)}):x(L)}function v(S,R,m){return c(S,R,m,!0,cs)}function l(S,R,m,I,O){I===void 0&&(I=!1),O===void 0&&(O=Cr);var w=s.trackEval(I?ru:eu),x=function(b){var A=[],k={};return Object.keys(b).forEach(function(K){k[K]=T(b[K],K,S,m,I,O,A)}),i.track(A,m),w(A[0]&&A[0].label),k},L=t.isReady()||t.isReadyFromCache()?co(o,S,R,m,r):u?Promise.resolve(Wn(R)):Wn(R);return Y(L)?L.then(function(b){return x(b)}):x(L)}function p(S,R,m){return l(S,R,m,!0,ls)}function h(S,R,m,I,O,w){I===void 0&&(I=!1),O===void 0&&(O=iu),w===void 0&&(w=vs);var x=s.trackEval(O),L=function(A){var k=[],K={},y=A;return Object.keys(y).forEach(function(C){K[C]=T(y[C],C,S,m,I,w,k)}),i.track(k,m),x(k[0]&&k[0].label),K},b=t.isReady()||t.isReadyFromCache()?hl(o,S,R,m,r,w):u?Promise.resolve({}):{};return Y(b)?b.then(function(A){return L(A)}):L(b)}function E(S,R,m){return h(S,R,m,!0,su,ds)}function g(S,R,m){return h(S,[R],m,!1,nu,hs)}function d(S,R,m){return h(S,[R],m,!0,au,ps)}function T(S,R,m,I,O,w,x){var L=qe(m),b=If(m),A=S.treatment,k=S.label,K=S.changeNumber,y=S.config,C=y===void 0?null:y;return o.info(qi,[R,L,A,k]),Lr(o,t,R,k,w)&&(o.info(ji),x.push({feature:R,keyName:L,treatment:A,time:Date.now(),bucketingKey:b,label:k,changeNumber:K})),O?{treatment:A,config:C}:A}function _(S,R,m,I,O,w){w===void 0&&(w=1024);var x=s.trackEval(ou),L=qe(S),b=Date.now(),A={eventTypeId:m,trafficTypeName:R,value:I,timestamp:b,key:L,properties:O};_c(o,t,r.splits,f,R,Oe);var k=a.track(A,w);return Y(k)?k.then(function(K){return x(),K}):(x(),k)}return{getTreatment:c,getTreatmentWithConfig:v,getTreatments:l,getTreatmentsWithConfig:p,getTreatmentsByFlagSets:h,getTreatmentsWithConfigByFlagSets:E,getTreatmentsByFlagSet:g,getTreatmentsWithConfigByFlagSet:d,track:_,isClientSide:!1}}function pl(e,t,r){var n=e.log,i=e.mode,a=Et(i);function s(d,T,_,S,R){var m=Ye(S,Cr),I=mt(n,d,S),O=!1,w=[];T&&(O=m?jr(n,T,S):qr(n,T,S));var x=ro(n,_,S),L=vt(n,r,S);R&&(w=ku(n,S,R,e.sync.__splitFiltersValidation.groupedFilters.bySet)),bt(n,r,S,O);var b=L&&I&&(O||w.length>0)&&x!==!1;return{valid:b,key:I,splitOrSplits:O,flagSetOrFlagSets:w,attributes:x}}function o(d){return a?Promise.resolve(d):d}function f(d,T,_){var S=s(d,T,_,fs);return S.valid?t.getTreatment(S.key,S.splitOrSplits,S.attributes):o(ue)}function u(d,T,_){var S=s(d,T,_,cs);return S.valid?t.getTreatmentWithConfig(S.key,S.splitOrSplits,S.attributes):o(P({},vn))}function c(d,T,_){var S=s(d,T,_,Cr);if(S.valid)return t.getTreatments(S.key,S.splitOrSplits,S.attributes);var R={};return S.splitOrSplits&&S.splitOrSplits.forEach(function(m){return R[m]=ue}),o(R)}function v(d,T,_){var S=s(d,T,_,ls);if(S.valid)return t.getTreatmentsWithConfig(S.key,S.splitOrSplits,S.attributes);var R={};return S.splitOrSplits&&S.splitOrSplits.forEach(function(m){return R[m]=P({},vn)}),o(R)}function l(d,T,_){var S=s(d,void 0,_,vs,T);return S.valid?t.getTreatmentsByFlagSets(S.key,S.flagSetOrFlagSets,S.attributes):o({})}function p(d,T,_){var S=s(d,void 0,_,ds,T);return S.valid?t.getTreatmentsWithConfigByFlagSets(S.key,S.flagSetOrFlagSets,S.attributes):o({})}function h(d,T,_){var S=s(d,void 0,_,hs,[T]);return S.valid?t.getTreatmentsByFlagSet(S.key,S.flagSetOrFlagSets[0],S.attributes):o({})}function E(d,T,_){var S=s(d,void 0,_,ps,[T]);return S.valid?t.getTreatmentsWithConfigByFlagSet(S.key,S.flagSetOrFlagSets[0],S.attributes):o({})}function g(d,T,_,S,R){var m=mt(n,d,Oe),I=Wt(n,T,Oe),O=no(n,_,Oe),w=io(n,S,Oe),x=ao(n,R,Oe),L=x.properties,b=x.size,A=vt(n,r,Oe);return A&&m&&I&&O&&w!==!1&&L!==!1?t.track(m,I,O,w,L,b):a?Promise.resolve(!1):!1}return{getTreatment:f,getTreatmentWithConfig:u,getTreatments:c,getTreatmentsWithConfig:v,getTreatmentsByFlagSets:l,getTreatmentsWithConfigByFlagSets:p,getTreatmentsByFlagSet:h,getTreatmentsWithConfigByFlagSet:E,track:g}}var dl=1e3;function Hn(e,t){var r=e.sdkReadinessManager,n=e.syncManager,i=e.storage,a=e.signalListener,s=e.settings,o=e.telemetryTracker,f=e.uniqueKeysTracker,u=0;function c(l,p){var h=Date.now(),E=h-u;return E<p?(s.log.warn("Flush cooldown, remaining time "+(p-E)/1e3+" seconds"),Promise.resolve()):(u=h,l())}function v(){return n?n.flush():Promise.resolve()}return P(Object.create(r.sdkStatus),pl(s,vl(e),r.readinessManager),{flush:function(){return c(v,dl)},destroy:function(){return r.readinessManager.destroy(),t||(Bu(s.core.authorizationKey),o.sessionLength()),n&&n.stop(),v().then(function(){return a&&a.stop(),f&&f.stop(),i.destroy()})}})}function Yn(e,t){return(e.matchingKey?e.matchingKey:e)+"-"+(e.bucketingKey?e.bucketingKey:e)+"-"+(t!==void 0?t:"")}var qn="Client instantiation";function gl(e){var t=e.storage,r=e.syncManager,n=e.sdkReadinessManager,i=e.settings,a=i.core,s=a.key,o=a.trafficType,f=i.startup.readyTimeout,u=i.log,c=wn(u,Hn(e),s,o),v=Gs(s),l=Yn(v,o),p={};return p[l]=c,function(E,g){if(E===void 0)return u.debug(Fi),c;var d=mt(u,E,"Shared "+qn);if(d===!1)throw new Error("Shared Client needs a valid key.");var T;if(g!==void 0&&(T=Wt(u,g,"Shared "+qn),T===!1))throw new Error("Shared Client needs a valid traffic type or no traffic type at all.");var _=Yn(d,T);if(p[_])u.debug(Li);else{var S=qe(d),R=n.shared(f),m=t.shared&&t.shared(S,function(O){if(O){R.readinessManager.timeout();return}R.readinessManager.segments.emit(Ae)}),I=r&&m&&r.shared(S,R.readinessManager,m);p[_]=wn(u,Hn(P({},e,{sdkReadinessManager:R,storage:m||t,syncManager:I,signalListener:void 0}),!0),d,T),I&&I.start(),u.info(zi)}return p[_]}}var ml=function(){function e(t){var r=this;this.__mapKeysData__=[],this.__mapValuesData__=[],Array.isArray(t)&&t.forEach(function(n){r.set(n[0],n[1])})}return e.prototype.clear=function(){this.__mapKeysData__.length&&(this.__mapKeysData__.length=0,this.__mapValuesData__.length=0)},e.prototype.delete=function(t){var r=this.__mapKeysData__.indexOf(t);return r===-1?!1:(this.__mapKeysData__.splice(r,1),this.__mapValuesData__.splice(r,1),!0)},e.prototype.forEach=function(t,r){for(var n=0;n<this.__mapKeysData__.length;n++)t.call(r,this.__mapValuesData__[n],this.__mapKeysData__[n],this)},e.prototype.get=function(t){var r=this.__mapKeysData__.indexOf(t);if(r!==-1)return this.__mapValuesData__[r]},e.prototype.has=function(t){return this.__mapKeysData__.indexOf(t)!==-1},e.prototype.set=function(t,r){var n=this.__mapKeysData__.indexOf(t);return n===-1&&(n=this.__mapKeysData__.push(t)-1),this.__mapValuesData__[n]=r,this},Object.defineProperty(e.prototype,"size",{get:function(){return this.__mapKeysData__.length},enumerable:!1,configurable:!0}),e}();function El(){return typeof Array.from=="function"&&typeof Map=="function"&&Map.prototype&&Map.prototype.values?Map:ml}var Xr=El(),pt=function(){function e(t,r,n,i){this.list=i,this.value=t,r?(r.next=this,this.prev=r):this.prev=null,n?(n.prev=this,this.next=n):this.next=null}return e}(),Sl=function(){function e(){this.tail=null,this.head=null,this.length=0}return e.prototype.removeNode=function(t){if(!(!t||!(t instanceof pt))){if(t.list!==this)throw new Error("removing node which does not belong to this list");var r=t.next,n=t.prev;return r&&(r.prev=n),n&&(n.next=r),t===this.head&&(this.head=r),t===this.tail&&(this.tail=n),t.list.length--,t.next=null,t.prev=null,t.list=null,r}},e.prototype.unshiftNode=function(t){if(!(!t||!(t instanceof pt))&&t!==this.head){t.list&&t.list.removeNode(t);var r=this.head;t.list=this,t.next=r,r&&(r.prev=t),this.head=t,this.tail||(this.tail=t),this.length++}},e.prototype.unshift=function(){for(var t=0,r=arguments.length;t<r;t++)this.head=new pt(arguments[t],null,this.head,this),this.tail||(this.tail=this.head),this.length++;return this.length},e}(),yl=function(){function e(t){this.maxLen=t||1,this.items=new Xr,this.lru=new Sl}return e.prototype.get=function(t){var r=this.items.get(t);if(!(!r||!(r instanceof pt)))return this.lru.unshiftNode(r),r.value.value},e.prototype.set=function(t,r){var n=this.items.get(t);if(n){if(!(n instanceof pt))return!1;this.lru.unshiftNode(n),this.lru.head.value.value=r}else{if(this.lru.length===this.maxLen){var i=this.lru.tail;if(!i)return!1;this.items.delete(i.value.key),this.lru.removeNode(this.lru.tail)}this.lru.unshift({key:t,value:r}),this.items.set(t,this.lru.head)}return!0},e}(),Tl=function(){function e(t,r){this.cache=new yl(t),this.hasher=r}return e.prototype.testAndSet=function(t){var r=this.hasher(t),n=this.cache.get(r);return this.cache.set(r,t.time),n},e}();function _l(e){return e.keyName+":"+e.feature+":"+e.treatment+":"+e.label+":"+e.changeNumber}function Rl(e){return Yt(_l(e))}var Nl=500;function Cl(){return new Tl(Nl,Rl)}function Il(e,t){var r=[];if(e.forEach(function(n){var i=n(t);i&&i.queue&&r.push(i)}),r.length!==0)return{handleImpression:function(n){r.forEach(function(i){return i.queue({type:_r,payload:n})})},handleEvent:function(n){r.forEach(function(i){return i.queue({type:Rr,payload:n})})}}}var ye="ga-to-split: ",at="ga-to-split:mapper";function Al(e,t,r,n,i,a){var s=e.GoogleAnalyticsObject||"ga";e[s]=e[s]||function(){(e[s].q=e[s].q||[]).push(arguments)},e[s]("provide",t,r);var o=e[s].q&&e[s].q.push!==[].push;i&&!o&&n.error(ye+"integration is configured to autorequire the splitTracker plugin, but the necessary script does not seem to have run. Please check the docs."),a&&o&&a.addTag("integration:ga-autorequire")}var bl={eventTypeId:{event:"eventAction",social:"socialAction"},eventValue:{event:"eventValue",timing:"timingValue"},eventProperties:{pageview:["page"],screenview:["screenName"],event:["eventCategory","eventLabel"],social:["socialNetwork","socialTarget"],timing:["timingCategory","timingVar","timingLabel"],exception:["exDescription","exFatal"]}};function Ol(e){return function(t){var r=t.get("hitType"),n=t.get(e.eventTypeId[r]||"hitType"),i=t.get(e.eventValue[r]),a={},s=e.eventProperties[r];if(s)for(var o=0;o<s.length;o++){var f=t.get(s[o]);f!==void 0&&(a[s[o]]=f)}return{eventTypeId:n,value:i,properties:a,timestamp:Date.now()}}}var Fl=Ol(bl),Ll="ga";function Ml(e){if(!Array.isArray(e))return[];var t=Nu(e);return t.filter(function(r){if(!r)return!1;var n=r.key,i=r.trafficType;return!(!G(n)&&!de(n)||!G(i))})}function Dl(e,t){if(!no(e,t.eventTypeId,at)||io(e,t.value,at)===!1)return!1;var r=ao(e,t.properties,at).properties;return!(r===!1||t.timestamp&&!de(t.timestamp)||t.key&&mt(e,t.key,at)===!1||t.trafficTypeName&&Wt(e,t.trafficTypeName,at)===!1)}var wl=/^[^a-zA-Z0-9]+/,kl=/[^-_.:a-zA-Z0-9]+/g;function xl(e,t){if(!G(t)||t.length===0)return t;var r=t.replace(wl,"").replace(kl,"_"),n=r.slice(0,80);return n.length<r.length&&e.warn(ye+"EventTypeId was truncated because it cannot be more than 80 characters long."),n}function Pl(e,t){var r=t.storage,n=t.settings,i=n.core,a=n.log,s=t.telemetryTracker,o={prefix:Ll,identities:i.key&&i.trafficType?[{key:i.key,trafficType:i.trafficType}]:void 0},f=function(){function u(c,v){var l=P({},o,e,v);this.tracker=c;var p=Ml(l.identities);if(p.length===0){a.warn(ye+"No valid identities were provided. Please check that you are passing a valid list of identities or providing a traffic type at the SDK configuration.");return}var h=p.length-l.identities.length;h&&a.warn(ye+(h+" identities were discarded because they are invalid or duplicated. Identities must be an array of objects with key and trafficType.")),l.identities=p,G(l.prefix)||(a.warn(ye+"The provided `prefix` was ignored since it is invalid. Please check that you are passing a string object as `prefix`."),l.prefix=void 0);var E=c.get("sendHitTask");c.set("sendHitTask",function(g){if(E(g),!(l.hits===!1||g.get("splitHit"))){try{if(l.filter&&!l.filter(g))return}catch(T){a.warn(ye+("custom filter threw: "+T));return}var d=Fl(g);if(l.mapper){try{d=l.mapper(g,d)}catch(T){a.warn(ye+("custom mapper threw: "+T));return}if(!d)return}l.prefix&&(d.eventTypeId=l.prefix+"."+d.eventTypeId),d.eventTypeId=xl(a,d.eventTypeId),Dl(a,d)&&(d.key&&d.trafficTypeName?r.events.track(d):l.identities.forEach(function(T){var _=P({key:T.key,trafficTypeName:T.trafficType},d);r.events.track(_)}))}}),a.info(ye+"integration started")}return u}();Al(window,"splitTracker",f,a,e.autoRequire===!0,s)}function Ul(e){e===void 0&&(e={});function t(r){return Pl(e,r)}return t.type="GOOGLE_ANALYTICS_TO_SPLIT",t}var st="split-to-ga: ",jn="`ga` command queue not found.",zn="No hit was sent.",Gl=function(){function e(t,r){this.trackerNames=e.defaultTrackerNames,this.log=t,r&&(typeof r.filter=="function"&&(this.filter=r.filter),typeof r.mapper=="function"&&(this.mapper=r.mapper),Array.isArray(r.trackerNames)&&(this.trackerNames=Kt(r.trackerNames)),this.impressions=r.impressions,this.events=r.events),t.info(st+"integration started"),typeof e.getGa()!="function"&&t.warn(st+(jn+" No hits will be sent until it is available."))}return e.defaultMapper=function(t){var r=t.type,n=t.payload;switch(r){case _r:return{hitType:"event",eventCategory:"split-impression",eventAction:"Evaluate "+n.impression.feature,eventLabel:"Treatment: "+n.impression.treatment+". Targeting rule: "+n.impression.label+".",nonInteraction:!0};case Rr:return{hitType:"event",eventCategory:"split-event",eventAction:n.eventTypeId,eventValue:n.value,nonInteraction:!0}}},e.getGa=function(){return typeof window<"u"?window[window.GoogleAnalyticsObject||"ga"]:void 0},e.validateFieldsObject=function(t,r){return r&&r.hitType?!0:(t.warn(st+"your custom mapper returned an invalid FieldsObject instance. It must be an object with at least a `hitType` field."),!1)},e.prototype.queue=function(t){var r=e.getGa();if(r){if(this.impressions===!1&&t.type===_r||this.events===!1&&t.type===Rr)return;var n;try{if(this.filter&&!this.filter(t)||(n=e.defaultMapper(t),this.mapper&&(n=this.mapper(t,n),!n||!e.validateFieldsObject(this.log,n))))return}catch(i){this.log.warn(st+("queue method threw: "+i+". "+zn));return}this.trackerNames.forEach(function(i){var a=i?i+".send":"send";n.splitHit=!0,r(a,n)})}else this.log.warn(st+(jn+" "+zn))},e.defaultTrackerNames=[""],e}();function Kl(e){e===void 0&&(e={});function t(r){return new Gl(r.settings.log,e)}return t.type="SPLIT_TO_GOOGLE_ANALYTICS",t}function Bl(e,t){var r=e.map(function(n){switch(n.type){case Zs:return Ul(n);case $s:return Kl(n)}}).filter(function(n){return n&&typeof n=="function"});return Il(r,t)}function lo(e){var t=qt(e);return t.splits.checkCache=function(){return!0},t}lo.type=ut;function Vn(e,t){var r=!1,n=!1;function i(s){var o=new Promise(function(u,c){return s.then(u,function(v){n?c(v):t(v)})}),f=o.then;return Object.defineProperty(o,"then",{value:function(u,c){var v=f.call(o,u,c);return typeof u=="function"&&(r=!0),typeof c=="function"?(n=!0,v):i(v)}}),o}var a=i(e);return a.hasOnFulfilled=function(){return r},a}function Wl(e){var t=P(new e,{splitsArrived:!1,splitsCacheLoaded:!1});return t.on(Ce,function(r){r||(t.splitsArrived=!0)}),t.once(Bt,function(){t.splitsCacheLoaded=!0}),t}function Hl(e){var t=P(new e,{segmentsArrived:!1});return t.once(Ae,function(){t.segmentsArrived=!0}),t}function ho(e,t,r){t===void 0&&(t=0),r===void 0&&(r=Wl(e));var n=Hl(e),i=new e,a=!1;r.splitsCacheLoaded?a=!0:r.once(Bt,v);var s=!1;function o(){s||(s=!0,i.emit(It,"Split SDK emitted SDK_READY_TIMED_OUT event."))}var f;t>0&&(f=setTimeout(o,t));var u=!1;r.on(Ce,l),n.on(Ae,l);var c=!1;function v(){if(a=!0,!u)try{i.emit(Dt)}catch(h){setTimeout(function(){throw h},0)}}function l(h){if(u)try{i.emit(Is,h)}catch(E){setTimeout(function(){throw E},0)}else if(r.splitsArrived&&n.segmentsArrived){clearTimeout(f),u=!0;try{i.emit(Se)}catch(E){setTimeout(function(){throw E},0)}}}var p=1;return{splits:r,segments:n,gate:i,shared:function(h){return h===void 0&&(h=0),p++,ho(e,h,r)},timeout:o,setDestroyed:function(){c=!0},destroy:function(){c=!0,n.removeAllListeners(),i.removeAllListeners(),clearTimeout(f),p>0&&p--,p===0&&r.removeAllListeners()},isReady:function(){return u},hasTimedout:function(){return s},isReadyFromCache:function(){return a},isDestroyed:function(){return c},isOperational:function(){return(u||a)&&!c}}}var Yl="newListener",ql="removeListener";function vo(e,t,r,n){r===void 0&&(r=0),n===void 0&&(n=ho(t,r));var i=0,a=0;n.gate.on(ql,function(u){u===Se&&a--}),n.gate.on(Yl,function(u){(u===Se||u===It)&&(n.isReady()?e.error(Ba,[u===Se?"SDK_READY":"SDK_READY_TIMED_OUT"]):u===Se&&a++)});var s=f();n.gate.once(Dt,function(){e.info(Hi)});function o(u){e.error(u&&u.message)}function f(){var u=Vn(new Promise(function(c,v){n.gate.once(Se,function(){e.info(Yi),a===i&&!u.hasOnFulfilled()&&e.warn(da),c()}),n.gate.once(It,function(l){v(new Error(l))})}),o);return u}return{readinessManager:n,shared:function(u){return u===void 0&&(u=0),vo(e,t,u,n.shared(u))},incInternalReadyCbCount:function(){i++},sdkStatus:P(Object.create(n.gate),{Event:{SDK_READY:Se,SDK_READY_FROM_CACHE:Dt,SDK_UPDATE:Is,SDK_READY_TIMED_OUT:It},ready:function(){return n.hasTimedout()?n.isReady()?Promise.resolve():Vn(Promise.reject(new Error("Split SDK has emitted SDK_READY_TIMED_OUT event.")),o):s},__getStatus:function(){return{isReady:n.isReady(),isReadyFromCache:n.isReadyFromCache(),isOperational:n.isOperational(),hasTimedout:n.hasTimedout(),isDestroyed:n.isDestroyed()}}})}}function jl(e,t,r,n,i){var a=e.log,s=e.impressionListener,o=e.runtime,f=o.ip,u=o.hostname,c=e.version;return{track:function(v,l){if(e.userConsent!==Xe){var p=v.length,h=r.process(v),E=h.impressionsToStore,g=h.impressionsToListener,d=h.deduped,T=g.length;if(E.length>0){var _=t.track(E);Y(_)?_.then(function(){a.info(fa,[p])}).catch(function(m){a.error(ja,[p,m])}):i&&(i.recordImpressionStats(Mt,E.length),i.recordImpressionStats(gs,d))}if(s||n)for(var S=function(m){var I={impression:P({},g[m]),attributes:l,ip:f,hostname:u,sdkLanguageVersion:c};setTimeout(function(){n&&n.handleImpression(I);try{s&&s.logImpression(I)}catch(O){a.error(za,[O])}},0)},R=0;R<T;R++)S(R)}}}}function zl(e,t,r,n){var i=e.log,a=e.mode,s=Et(a);function o(f,u){var c=f.eventTypeId,v=f.trafficTypeName,l=f.key,p=f.value,h=f.timestamp,E=f.properties,g='event of type "'+c+'" for traffic type "'+v+'". Key: '+l+". Value: "+p+". Timestamp: "+h+". "+(E?"With properties.":"With no properties.");return u?(i.info(ua,[g]),r&&setTimeout(function(){var d=P({},f);E&&(d.properties=P({},E)),r.handleEvent(d)},0)):i.error(Va,[g]),u}return{track:function(f,u){if(e.userConsent===Xe)return s?Promise.resolve(!1):!1;var c=t.track(f,u);return Y(c)?c.then(o.bind(null,f)):(n&&n.recordEventStats(c?Mt:Ir,1),o(f,c))}}}function Vl(e,t){if(e&&t){var r=At(t);return{trackEval:function(i){var a=At(t);return function(s){switch(s){case jt:e.recordException(i);return;case oo:e.recordNonReadyUsage&&e.recordNonReadyUsage()}e.recordLatency(i,a())}},trackHttp:function(i){var a=At(t);return function(s){e.recordHttpLatency(i,a()),s&&s.statusCode?e.recordHttpError(i,s.statusCode):e.recordSuccessfulSync(i,Date.now())}},sessionLength:function(){e.recordSessionLength&&e.recordSessionLength(r())},streamingEvent:function(i,a){i===ys?e.recordAuthRejections():(e.recordStreamingEvents({e:i,d:a,t:Date.now()}),i===Ss&&e.recordTokenRefreshes())},addTag:function(i){e.addTag&&e.addTag(i)},trackUpdatesFromSSE:function(i){e.recordUpdatesFromSSE(i)}}}else{var n=function(){return function(){}};return{trackEval:n,trackHttp:n,sessionLength:function(){},streamingEvent:function(){},addTag:function(){},trackUpdatesFromSSE:function(){}}}}var z={DEBUG:"DEBUG",INFO:"INFO",WARN:"WARN",ERROR:"ERROR",NONE:"NONE"},xe={DEBUG:1,INFO:2,WARN:3,ERROR:4,NONE:5};function Zr(e){return!!Hr(z,function(t){return e===t})}function Qn(e,t){e===void 0&&(e=""),t===void 0&&(t=[]);var r=0;return e.replace(/%s/g,function(){return t[r++]})}var Ql={prefix:"splitio",logLevel:z.NONE,showLevel:!0},Xl=function(){function e(t,r){this.options=P({},Ql,t),this.codes=r||new Xr,this.logLevel=xe[this.options.logLevel]}return e.prototype.setLogLevel=function(t){this.options.logLevel=t,this.logLevel=xe[t]},e.prototype.debug=function(t,r){this._shouldLog(xe.DEBUG)&&this._log(z.DEBUG,t,r)},e.prototype.info=function(t,r){this._shouldLog(xe.INFO)&&this._log(z.INFO,t,r)},e.prototype.warn=function(t,r){this._shouldLog(xe.WARN)&&this._log(z.WARN,t,r)},e.prototype.error=function(t,r){this._shouldLog(xe.ERROR)&&this._log(z.ERROR,t,r)},e.prototype._log=function(t,r,n){if(typeof r=="number"){var i=this.codes.get(r);r=i?Qn(i,n):"Message code "+r+(n?", with args: "+n.toString():"")}else n&&(r=Qn(r,n));var a=this._generateLogMessage(t,r);console.log(a)},e.prototype._generateLogMessage=function(t,r){var n=" => ",i="";return this.options.showLevel&&(i+="["+t+"]"+(t===z.INFO||t===z.WARN?" ":"")+" "),this.options.prefix&&(i+=this.options.prefix+n),i+=r},e.prototype._shouldLog=function(t){return t>=this.logLevel},e}();function Zl(e){function t(r){Zr(r)?e.setLogLevel(r):e.error(Ka)}return{enable:function(){t(z.DEBUG)},setLogLevel:t,disable:function(){t(z.NONE)},LogLevel:z}}function $l(e){return{process:function(t){return t.forEach(function(r){r.pt=e.testAndSet(r)}),{impressionsToStore:t,impressionsToListener:t,deduped:0}}}}function Jl(e,t){return{process:function(r){var n=[];return r.forEach(function(i){i.pt=e.testAndSet(i);var a=Date.now();i.pt&&t.track(i.feature,a,1),(!i.pt||i.pt<qs(a))&&n.push(i)}),{impressionsToStore:n,impressionsToListener:r,deduped:r.length-n.length}}}}function eh(e,t){return{process:function(r){return r.forEach(function(n){var i=Date.now();e.track(n.feature,i,1),t.track(n.keyName,n.feature)}),{impressionsToStore:[],impressionsToListener:r,deduped:0}}}}var th={add:function(){return!0},contains:function(){return!0},clear:function(){}};function rh(e,t,r){r===void 0&&(r=th);var n;return r.refreshRate&&(n=setInterval(r.clear,r.refreshRate)),{track:function(i,a){if(!r.add(i,a)){e.debug(Go+"The feature "+a+" and key "+i+" exist in the filter");return}t.track(i,a)},stop:function(){clearInterval(n)}}}function nh(e){var t=e.settings,r=e.platform,n=e.storageFactory,i=e.splitApiFactory,a=e.extraProps,s=e.syncManagerFactory,o=e.SignalListener,f=e.impressionsObserverFactory,u=e.integrationsManagerFactory,c=e.sdkManagerFactory,v=e.sdkClientMethodFactory,l=e.filterAdapterFactory,p=t.log,h=t.sync.impressionsMode;Ku(p,t.core.authorizationKey);var E=vo(p,r.EventEmitter,t.startup.readyTimeout),g=E.readinessManager,d=n({settings:t,onReadyCb:function(K){if(K){g.timeout();return}g.splits.emit(Ce),g.segments.emit(Ae)}}),T=Vl(d.telemetry,r.now),_=u&&u({settings:t,storage:d,telemetryTracker:T}),S=f(),R=h===Re?rh(p,d.uniqueKeys,l&&l()):void 0,m;switch(h){case pe:m=Jl(S,d.impressionCounts);break;case Re:m=eh(d.impressionCounts,R);break;default:m=$l(S)}var I=jl(t,d.impressions,m,_,d.telemetry),O=zl(t,d.events,_,d.telemetry),w=i&&i(t,r,T),x={splitApi:w,eventTracker:O,impressionsTracker:I,telemetryTracker:T,uniqueKeysTracker:R,sdkReadinessManager:E,readiness:g,settings:t,storage:d,platform:r},L=s&&s(x);x.syncManager=L;var b=o&&new o(L,t,d,w);x.signalListener=b;var A=v(x),k=c(t,d.splits,E);return L&&L.start(),b&&b.start(),p.info(Vi),P({client:A,manager:function(){return p.debug(Mi),k},Logger:Zl(p),settings:t},a&&a(x))}var ih={GRANTED:Ne,DECLINED:Xe,UNKNOWN:Wr};function ah(e){var t=e.settings,r=e.settings.log,n=e.syncManager,i=e.storage,a=i.events,s=i.impressions,o=i.impressionCounts;return wt(t)||r.info(ha,[t.userConsent]),{setStatus:function(f){var u,c;if(!Yr(f))return r.warn(ns,["UserConsent.setStatus"]),!1;var v=f?Ne:Xe;return t.userConsent!==v?(r.info(ca,[t.userConsent,v]),t.userConsent=v,f?(u=n==null?void 0:n.submitterManager)===null||u===void 0||u.start():((c=n==null?void 0:n.submitterManager)===null||c===void 0||c.stop(!0),a.clear&&a.clear(),s.clear&&s.clear(),o&&o.clear&&o.clear())):r.info(la,[v]),!0},getStatus:function(){return t.userConsent},Status:ih}}function sh(){return{ip:!1,hostname:!1}}var oh=!!(typeof process<"u"&&typeof process.version<"u"&&process.version),uh=[[Ga,Nt+"Invalid feature flag, no valid rules found"],[Ka,"logger: Invalid Log Level - No changes to the logs will be applied."],[Wa,"The SDK will not get ready. Reason: %s"],[ja,ot+"Could not store impressions bulk with %s impression(s). Error: %s"],[za,ot+"Impression listener logImpression method threw: %s."],[Va,us+"Failed to queue %s"],[Ha,os+"There was an issue loading the mock feature flags data. No changes will be applied to the current cache. %s"],[Ya,ee+"Failed to connect or error on streaming connection, with error message: %s"],[qa,ee+"Failed to authenticate for streaming. Error: %s."],[rs,"Response status is not OK. Status: %s. URL: %s. Message: %s"],[Ba,"A listener was added for %s on the SDK, which has already fired and won't be emitted again. The callback won't be executed."],[$a,"%s: Client has already been destroyed - no calls possible."],[Qa,'%s: you passed "%s", event_type must adhere to the regular expression /^[a-zA-Z0-9][-_.:a-zA-Z0-9]{0,79}$/g. This means an event_type must be alphanumeric, cannot be more than 80 characters long, and can only include a dash, underscore, period, or colon as separators of alphanumeric characters.'],[Pr,"%s: %s must be a plain object."],[Xa,"%s: the maximum size allowed for the properties is 32768 bytes, which was exceeded. Event not queued."],[Za,"%s: value must be a finite number."],[ze,"%s: you passed a null or undefined %s. It must be a non-empty string."],[Ja,"%s: %s too long. It must have 250 characters or less."],[es,"%s: Key must be an object with bucketingKey and matchingKey with valid string properties."],[Ve,"%s: you passed an invalid %s. It must be a non-empty string."],[Qe,"%s: you passed an empty %s. It must be a non-empty string."],[ts,"%s: %s must be a non-empty array."],[ns,"%s: provided param must be a boolean value."],[Ur,X+': you passed an invalid "%s" config param. It should be one of the following values: %s. Defaulting to "%s".'],[xo,X+': an invalid value was received for "sync.localhostMode" config. A valid entity should be provided for localhost mode.'],[Po,X+": the provided storage is invalid.%s Falling back into default MEMORY storage"],[is,X+': the provided "%s" config param is lower than allowed. Setting to the minimum value %s seconds'],[as,X+": the amount of flag sets provided are big causing uri length error."],[ss,X+": the Set filter is exclusive and cannot be used simultaneously with names or prefix filters. Ignoring names and prefixes."]],fh=uh.concat([[va,Tr+"Value %s doesn't match with expected type."],[pa,Tr+"Defined attribute [%s], no attributes received."],[ma,Uo+"Retrying download of segments #%s. Reason: %s"],[Ea,Ge+"Error while doing fetch of feature flags. %s"],[Sa,ee+"Error parsing SSE error notification: %s"],[ya,ee+"Error parsing SSE message notification: %s"],[Ta,ee+"Falling back to polling mode. Reason: %s"],[Sr,Lt+"Dropping %s after retry. Reason: %s."],[_a,Lt+"Failed to push %s, keeping data to retry on next iteration. Reason: %s."],[ga,"%s: the SDK is not ready, results may be incorrect%s. Make sure to wait for SDK readiness before using this method."],[da,"No listeners for SDK Readiness detected. Incorrect control treatments could have been logged if you called getTreatment/s while the SDK was not yet ready."],[Ra,'%s: Property "%s" is of invalid type. Setting value to null.'],[Na,"%s: Event has more than 300 properties. Some of them will be trimmed when processed."],[Ca,'%s: %s "%s" is not of type string, converting.'],[Ia,'%s: %s "%s" has extra whitespace, trimming.'],[Aa,'%s: feature flag "%s" does not exist in this environment. Please double check what feature flags exist in the Split user interface.'],[ba,"%s: traffic_type_name should be all lowercase - converting string to lowercase."],[Oa,`%s: traffic type "%s" does not have any corresponding feature flag in this environment, make sure you're tracking your events to a valid traffic type defined in the Split user interface.`],[Pa,"%s: you passed %s which is not part of the configured FlagSetsFilter, ignoring Flag Set."],[Fa,X+": %s integration item(s) at settings is invalid. %s"],[La,X+": feature flag filters are not applicable for Consumer modes where the SDK does not keep rollout data in sync. Filters were discarded"],[Ma,X+': feature flag filter at position %s is invalid. It must be an object with a valid filter type ("bySet", "byName" or "byPrefix") and a list of "values".'],[Da,X+": feature flag filter configuration must be a non-empty array of filter objects."],[yr,X+": You already have %s. We recommend keeping only one instance of the factory at all times (Singleton pattern) and reusing it throughout your application"],[Rt,ee+"Fetching MySegments due to an error processing %s notification: %s"],[wa,ee+"Fetching SplitChanges due to an error processing SPLIT_UPDATE notification: %s"],[ka,"%s: you passed %s, flag set must adhere to the regular expressions %s. This means a flag set must start with a letter or number, be in lowercase, alphanumeric and have a max length of 50 characters. %s was discarded."],[xa,"%s: flag set %s should be all lowercase - converting string to lowercase."],[Ua,"%s: you passed %s flag set that does not contain cached feature flag names. Please double check what flag sets are in use in the Split user interface."]]),Xn="Split SDK client is ready",ch=fh.concat([[Hi,Xn+" from cache"],[Yi,Xn],[qi,ot+"Feature flag: %s. Key: %s. Evaluation: %s. Label: %s"],[ji,ot+"Queueing corresponding impression."],[zi,"New shared client instance created."],[Vi,"New Split SDK instance created."],[ua,us+"Successfully queued %s"],[fa,ot+"Successfully stored %s impression(s)."],[ca,"UserConsent: consent status changed from %s to %s."],[la,"UserConsent: call had no effect because it was the current consent status (%s)."],[ha,"Starting the SDK with %s user consent. No data will be sent."],[Qi,ar+"Turning segments data polling %s."],[Xi,ar+"Starting polling"],[Zi,ar+"Stopping polling"],[$i,Ge+"Retrying download of feature flags #%s. Reason: %s"],[Ut,Lt+"Flushing full %s queue and reseting timer."],[ia,Lt+"Pushing %s."],[Ji,ee+"Refreshing streaming token in %s seconds, and connecting streaming in %s seconds."],[ea,ee+"Attempting to reconnect streaming in %s seconds."],[ta,ee+"Connecting streaming."],[ra,ee+"Streaming is disabled for given SDK key. Switching to polling mode."],[na,ee+"Disconnecting streaming."],[aa,ir+"Streaming not available. Starting polling."],[sa,ir+"Streaming couldn't connect. Continue polling."],[oa,ir+"Streaming connected. Syncing and stopping polling."]]),lh=ch.concat([[ii,Nt+"[andCombiner] evaluates to %s"],[ai,Nt+"Treatment found: %s"],[si,Nt+"All predicates evaluated, no treatment found."],[oi,gt+': using algo "murmur" bucket %s for key %s using seed %s - treatment %s'],[ui,q+"[allMatcher] is always true"],[fi,q+"[betweenMatcher] is %s between %s and %s? %s"],[ci,q+"[booleanMatcher] %s === %s"],[li,q+"[containsAllMatcher] %s contains all elements of %s? %s"],[hi,q+"[containsAnyMatcher] %s contains at least an element of %s? %s"],[vi,q+"[containsStringMatcher] %s contains %s? %s"],[pi,q+'[dependencyMatcher] parent feature flag "%s" evaluated to "%s" with label "%s". %s evaluated treatment is part of [%s] ? %s.'],[di,q+'[dependencyMatcher] will evaluate parent feature flag: "%s" with key: %s %s'],[gi,q+"[equalToMatcher] is %s equal to %s? %s"],[mi,q+"[equalToSetMatcher] is %s equal to set %s? %s"],[Ei,q+"[endsWithMatcher] %s ends with %s? %s"],[Si,q+"[greaterThanEqualMatcher] is %s greater than %s? %s"],[yi,q+"[lessThanEqualMatcher] is %s less than %s? %s"],[Ti,q+"[partOfMatcher] %s is part of %s? %s"],[Er,q+"[segmentMatcher] evaluated %s / %s => %s"],[_i,q+"[stringMatcher] does %s matches with %s? %s"],[Ri,q+"[stringMatcher] %s is an invalid regex"],[Ni,q+"[startsWithMatcher] %s starts with %s? %s"],[Ci,q+"[whitelistMatcher] evaluated %s in [%s] => %s"],[Ii,Tr+"Extracted attribute [%s], [%s] will be used for matching."],[Ai,gt+":sanitize: Attempted to sanitize [%s] which should be of type [%s]. Sanitized and processed value => [%s]"],[bi,ln+"Registering cleanup handler %s"],[Oi,ln+"Deregistering cleanup handler %s"],[Fi,"Retrieving default SDK client."],[Li,"Retrieving existing SDK client."],[Mi,"Retrieving manager instance."],[Di,os+`Feature flags data:
18
- %s`],[wi,Ge+"Spin up feature flags update using since = %s"],[ki,Ge+"New feature flags %s"],[xi,Ge+"Removed feature flags %s"],[Pi,Ge+"Segment names collected %s"],[Ui,ee+"New SSE message received, with data: %s."],[Gi,he+": Starting %s. Running each %s millis"],[Ki,he+": Running %s"],[Bi,he+": Stopping %s"],[Wi,X+': feature flags filtering criteria is "%s".']]);function hh(e){return typeof e=="boolean"?e?z.DEBUG:z.NONE:typeof e=="string"&&Zr(e)?e:void 0}var vh=new Xr(lh),ph="splitio_debug",dh="SPLITIO_DEBUG",gr=String(oh?process.env[dh]:Qr()?localStorage.getItem(ph):""),Pt=z.NONE;/^(enabled?|on)/i.test(gr)?Pt=z.DEBUG:Zr(gr)&&(Pt=gr);function gh(e){var t=e.debug,r=t!==void 0?hh(t):Pt,n=new Xl({logLevel:r||Pt},vh);return r||n._log(z.ERROR,"Invalid Log Level - No changes to the logs will be applied."),n}function mh(e){var t=e.treatment;return e.keys?{conditionType:"WHITELIST",matcherGroup:{combiner:"AND",matchers:[{keySelector:null,matcherType:"WHITELIST",negate:!1,whitelistMatcherData:{whitelist:G(e.keys)?[e.keys]:e.keys}}]},partitions:[{treatment:t,size:100}],label:"whitelisted "+t}:{conditionType:"ROLLOUT",matcherGroup:{combiner:"AND",matchers:[{keySelector:null,matcherType:"ALL_KEYS",negate:!1}]},partitions:[{treatment:t,size:100}],label:"default rule"}}function Eh(e,t){return typeof e!=typeof t?!0:typeof e=="string"?e!==t:e.treatment!==t.treatment||e.config!==t.config}function Sh(){var e={emptyMock:"1"};function t(r){var n=Object.keys(r);return n.length!==Object.keys(e).length?(e=r,!0):n.some(function(i){var a=!e[i],s=Eh(e[i],r[i]),o=a||s;return o&&(e=r),o})}return function(n){var i=n.features||{};if(!t(i))return!1;var a={};return oe(i,function(s,o){var f=s,u=null;Z(s)&&(f=s.treatment,u=s.config||u);var c={};u!==null&&(c[f]=u),a[o]={trafficTypeName:"localhost",conditions:[mh({treatment:f})],configurations:c}}),a}}function yh(e,t,r,n){var i=n.log,a=t.splits,s=!0;return function(){var f=[],u=null,c={};try{c=e(n)}catch(v){u=v,i.error(Ha,[v])}return!u&&c?(i.debug(Di,[JSON.stringify(c)]),oe(c,function(v,l){f.push([l,{name:l,status:"ACTIVE",killed:!1,trafficAllocation:100,defaultTreatment:ue,conditions:v.conditions||[],configurations:v.configurations,trafficTypeName:v.trafficTypeName}])}),Promise.all([a.clear(),a.addSplits(f)]).then(function(){return r.splits.emit(Ce),s&&(s=!1,Promise.resolve(a.checkCache()).then(function(v){v&&r.splits.emit(Bt),r.segments.emit(Ae)})),!0})):Promise.resolve(!0)}}function Th(e,t,r,n){return Gt(n.log,yh(e,t,r,n),n.scheduler.offlineRefreshRate,"offlineUpdater")}function Zn(){return Promise.resolve()}function _h(e){return function(t){var r=t.settings,n=t.readiness,i=t.storage;return P(Th(e(),i,n,r),{flush:Zn,shared:function(a,s){return{start:function(){setTimeout(function(){s.segments.emit(Ae)},0)},stop:function(){},isRunning:function(){return!0},flush:Zn}}})}}var po=_h(Sh);po.type="LocalhostFromObject";function Rh(){return po}var $n=[Xe,Ne,Wr];function Nh(e){var t=e.userConsent,r=e.log;return t=_s(t),$n.indexOf(t)>-1?t:(r.error(Ur,["userConsent",$n,Ne]),Ne)}var Ch="10.25.1",Ih={startup:{requestTimeoutBeforeReady:5,retriesOnFailureBeforeReady:1,readyTimeout:10,eventsFirstPushWindow:10},userConsent:Ne,version:"javascript-"+Ch},mr="LOCALSTORAGE";function Ah(e){var t=e.log,r=e.mode,n=e.storage,i=n===void 0?{type:ut}:n,a=i.type,s=i.options,o=s===void 0?{}:s,f=i.prefix,u,c=function(){u=a,a=ut};return r===Me&&a===mr&&c(),(a!==ut&&a!==mr||a===mr&&!Qr())&&(c(),t.error("Invalid or unavailable storage. Fallbacking into MEMORY storage")),{type:a,options:o,prefix:f,__originalType:u}}function bh(e,t,r){var n=e.integrations,i=e.log;if(!Array.isArray(n)||n.length===0)return[];var a=n.filter(t),s=n.length-a.length;return s&&i.warn(Fa,[s,r||""]),a}function Oh(e,t){return t===void 0&&(t=[]),bh(e,function(r){return r&&G(r.type)&&t.indexOf(r.type)>-1},'Integration items must have a valid "type" value')}function Fh(e){return Oh(e,[Zs,$s])}var Lh={defaults:Ih,acceptKey:!0,acceptTT:!0,runtime:sh,storage:Ah,integrations:Fh,logger:gh,localhost:function(){return Rh()},consent:Nh};function Mh(e){return Uu(e,Lh)}var Be=typeof Reflect=="object"?Reflect:null,Jn=Be&&typeof Be.apply=="function"?Be.apply:function(t,r,n){return Function.prototype.apply.call(t,r,n)},Ft;Be&&typeof Be.ownKeys=="function"?Ft=Be.ownKeys:Object.getOwnPropertySymbols?Ft=function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:Ft=function(t){return Object.getOwnPropertyNames(t)};function Dh(e){console&&console.warn&&console.warn(e)}var go=Number.isNaN||function(t){return t!==t};function U(){U.init.call(this)}U.prototype._events=void 0;U.prototype._eventsCount=0;U.prototype._maxListeners=void 0;var ei=10;function zt(e){if(typeof e!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}Object.defineProperty(U,"defaultMaxListeners",{enumerable:!0,get:function(){return ei},set:function(e){if(typeof e!="number"||e<0||go(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");ei=e}});U.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};U.prototype.setMaxListeners=function(t){if(typeof t!="number"||t<0||go(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this};function mo(e){return e._maxListeners===void 0?U.defaultMaxListeners:e._maxListeners}U.prototype.getMaxListeners=function(){return mo(this)};U.prototype.emit=function(t){for(var r=[],n=1;n<arguments.length;n++)r.push(arguments[n]);var i=t==="error",a=this._events;if(a!==void 0)i=i&&a.error===void 0;else if(!i)return!1;if(i){var s;if(r.length>0&&(s=r[0]),s instanceof Error)throw s;var o=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw o.context=s,o}var f=a[t];if(f===void 0)return!1;if(typeof f=="function")Jn(f,this,r);else for(var u=f.length,c=_o(f,u),n=0;n<u;++n)Jn(c[n],this,r);return!0};function Eo(e,t,r,n){var i,a,s;if(zt(r),a=e._events,a===void 0?(a=e._events=Object.create(null),e._eventsCount=0):(a.newListener!==void 0&&(e.emit("newListener",t,r.listener?r.listener:r),a=e._events),s=a[t]),s===void 0)s=a[t]=r,++e._eventsCount;else if(typeof s=="function"?s=a[t]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),i=mo(e),i>0&&s.length>i&&!s.warned){s.warned=!0;var o=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");o.name="MaxListenersExceededWarning",o.emitter=e,o.type=t,o.count=s.length,Dh(o)}return e}U.prototype.addListener=function(t,r){return Eo(this,t,r,!1)};U.prototype.on=U.prototype.addListener;U.prototype.prependListener=function(t,r){return Eo(this,t,r,!0)};function wh(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function So(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=wh.bind(n);return i.listener=r,n.wrapFn=i,i}U.prototype.once=function(t,r){return zt(r),this.on(t,So(this,t,r)),this};U.prototype.prependOnceListener=function(t,r){return zt(r),this.prependListener(t,So(this,t,r)),this};U.prototype.removeListener=function(t,r){var n,i,a,s,o;if(zt(r),i=this._events,i===void 0)return this;if(n=i[t],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[t],i.removeListener&&this.emit("removeListener",t,n.listener||r));else if(typeof n!="function"){for(a=-1,s=n.length-1;s>=0;s--)if(n[s]===r||n[s].listener===r){o=n[s].listener,a=s;break}if(a<0)return this;a===0?n.shift():kh(n,a),n.length===1&&(i[t]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",t,o||r)}return this};U.prototype.off=U.prototype.removeListener;U.prototype.removeAllListeners=function(t){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[t]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[t]),this;if(arguments.length===0){var a=Object.keys(n),s;for(i=0;i<a.length;++i)s=a[i],s!=="removeListener"&&this.removeAllListeners(s);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(r=n[t],typeof r=="function")this.removeListener(t,r);else if(r!==void 0)for(i=r.length-1;i>=0;i--)this.removeListener(t,r[i]);return this};function yo(e,t,r){var n=e._events;if(n===void 0)return[];var i=n[t];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?xh(i):_o(i,i.length)}U.prototype.listeners=function(t){return yo(this,t,!0)};U.prototype.rawListeners=function(t){return yo(this,t,!1)};U.listenerCount=function(e,t){return typeof e.listenerCount=="function"?e.listenerCount(t):To.call(e,t)};U.prototype.listenerCount=To;function To(e){var t=this._events;if(t!==void 0){var r=t[e];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}U.prototype.eventNames=function(){return this._eventsCount>0?Ft(this._events):[]};function _o(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function kh(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}function xh(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}function Ph(){return typeof fetch=="function"?fetch:Fo}function Uh(){return typeof EventSource=="function"?EventSource:void 0}var ti="visibilitychange",ri="pagehide",ni="for visibilitychange and pagehide events.",Gh=function(){function e(t,r,n,i){this.syncManager=t,this.settings=r,this.storage=n,this.serviceApi=i,this.flushData=this.flushData.bind(this),this.flushDataIfHidden=this.flushDataIfHidden.bind(this),this.fromImpressionsCollector=Ns.bind(void 0,r.core.labelsEnabled)}return e.prototype.start=function(){this.settings.log.debug(bi,[ni]),typeof document<"u"&&document.addEventListener&&document.addEventListener(ti,this.flushDataIfHidden),typeof window<"u"&&window.addEventListener&&window.addEventListener(ri,this.flushData)},e.prototype.stop=function(){this.settings.log.debug(Oi,[ni]),typeof document<"u"&&document.removeEventListener&&document.removeEventListener(ti,this.flushDataIfHidden),typeof window<"u"&&window.removeEventListener&&window.removeEventListener(ri,this.flushData)},e.prototype.flushData=function(){if(this.syncManager){var t=this.settings.urls,r=t.events,n=t.telemetry;if(wt(this.settings)){var i=this.settings.sync.impressionsMode,a={sim:i===pe?pe:i===_e?_e:Re};this._flushData(r+"/testImpressions/beacon",this.storage.impressions,this.serviceApi.postTestImpressionsBulk,this.fromImpressionsCollector,a),this._flushData(r+"/events/beacon",this.storage.events,this.serviceApi.postEventsBulk),this.storage.impressionCounts&&this._flushData(r+"/testImpressions/count/beacon",this.storage.impressionCounts,this.serviceApi.postTestImpressionsCount,Cs),this.storage.uniqueKeys&&this._flushData(n+"/v1/keys/cs/beacon",this.storage.uniqueKeys,this.serviceApi.postUniqueKeysBulkCs)}this.storage.telemetry&&this._flushData(n+"/v1/metrics/usage/beacon",this.storage.telemetry,this.serviceApi.postMetricsUsage)}},e.prototype.flushDataIfHidden=function(){document.visibilityState==="hidden"&&this.flushData()},e.prototype._flushData=function(t,r,n,i,a){if(!r.isEmpty()){var s=i?i(r.pop()):r.pop();this._sendBeacon(t,s,a)||n(JSON.stringify(s)).catch(function(){})}},e.prototype._sendBeacon=function(t,r,n){if(typeof navigator<"u"&&navigator.sendBeacon){var i={entries:r,token:this.settings.core.authorizationKey,sdk:this.settings.version};n&&P(i,n);var a=JSON.stringify(i);try{return navigator.sendBeacon(t,a)}catch{return!1}}return!1},e}();function Kh(){return typeof performance=="object"&&typeof performance.now=="function"?performance.now.bind(performance):Date.now}var Bh=Kh(),Wh={getFetch:Ph,getEventSource:Uh,EventEmitter:U,now:Bh},Hh=Gh,Yh=tf(Zf,Kf);function qh(e){return e.storage.type===Nr?vc(e.storage):e.storage.__originalType===Nr?lo:qt}function jh(e){var t={settings:e,platform:Wh,storageFactory:qh(e),splitApiFactory:yu,syncManagerFactory:Yh,sdkManagerFactory:Nc,sdkClientMethodFactory:gl,SignalListener:Hh,integrationsManagerFactory:e.integrations&&e.integrations.length>0?Bl.bind(null,e.integrations):void 0,impressionsObserverFactory:Cl,extraProps:function(r){return{UserConsent:ah(r)}}};switch(e.mode){case Me:t.splitApiFactory=void 0,t.syncManagerFactory=e.sync.localhostMode,t.SignalListener=void 0;break}return t}function zh(e,t){var r=Mh(e),n=jh(r);return t&&t(n),nh(n)}var Vh="react-1.11.0",Qh={treatment:"control",config:null},Xh="[WARN] Both a config and factory props were provided to SplitFactoryProvider. Config prop will be ignored.",Zh="React library is not available or its version is not supported. Check that it is properly installed or imported. Split SDK requires version 16.3.0+ of React.",$h="[WARN] Both names and flagSets properties were provided. flagSets will be ignored.";if(!te||!te.createContext)throw new Error(Zh);var Jh={client:null,factory:null,isReady:!1,isReadyFromCache:!1,isTimedout:!1,hasTimedout:!1,lastUpdate:0,isDestroyed:!1},Ro=te.createContext(Jh),dt=new Map;function ev(e){if(!dt.has(e)){var t=zh(e,function(r){r.settings.version=Vh});t.clientInstances=new Set,t.config=e,dt.set(e,t)}return dt.get(e)}function xr(e,t,r){var n=t!==void 0?e.client(t,r):e.client();if(n.lastUpdate===void 0){var i=function(){var a=Date.now();n.lastUpdate=a>n.lastUpdate?a:n.lastUpdate+1};n.lastUpdate=0,n.on(n.Event.SDK_READY,i),n.on(n.Event.SDK_READY_FROM_CACHE,i),n.on(n.Event.SDK_READY_TIMED_OUT,i),n.on(n.Event.SDK_UPDATE,i)}return e.clientInstances&&e.clientInstances.add(n),n}function tv(e){var t=[];return e.clientInstances.forEach(function(r){return t.push(r.destroy())}),e.clientInstances.clear(),dt.delete(e.config),Promise.all(t)}function We(e){var t=e&&e.__getStatus(),r=t?t.isReady:!1,n=t?t.hasTimedout:!1;return{isReady:r,isReadyFromCache:t?t.isReadyFromCache:!1,isTimedout:n&&!r,hasTimedout:n,isDestroyed:t?t.isDestroyed:!1,lastUpdate:e&&e.lastUpdate||0}}function No(e,t){e&&t&&e.setAttributes(t)}function rv(e,t){if(t===void 0&&(t="feature flag names"),Array.isArray(e)&&e.length>0){var r=[];if(e.forEach(function(n){var i=iv(n);i&&r.push(i)}),r.length)return sv(r)}return console.log("[ERROR] "+t+" must be a non-empty array."),!1}var nv=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/;function iv(e,t){if(t===void 0&&(t="feature flag name"),e==null)console.log("[ERROR] you passed a null or undefined "+t+", "+t+" must be a non-empty string.");else if(!ov(e))console.log("[ERROR] you passed an invalid "+t+", "+t+" must be a non-empty string.");else{if(nv.test(e)&&(console.log("[WARN] "+t+' "'+e+'" has extra whitespace, trimming.'),e=e.trim()),e.length>0)return e;console.log("[ERROR] you passed an empty "+t+", "+t+" must be a non-empty string.")}return!1}function av(e){var t=rv(e);return t?t.reduce(function(r,n){return r[n]=Qh,r},{}):{}}function sv(e){var t={};return e.filter(function(r){return Object.prototype.hasOwnProperty.call(t,r)?!1:t[r]=!0})}function ov(e){return typeof e=="string"||e instanceof String}function uv(){return Lo(cv,fv)}function fv(e,t){return e[0]===t[0]&&e[1]===t[1]&&yt(e[2],t[2])&&yt(e[3],t[3])&&yt(e[4],t[4])&&yt(e[5],t[5])}function cv(e,t,r,n,i,a){return r&&a&&console.log($h),e&&e.__getStatus().isOperational&&(r||a)?r?e.getTreatmentsWithConfig(r,n):e.getTreatmentsWithConfigByFlagSets(a,n):r?av(r):{}}var $r={updateOnSdkUpdate:!1,updateOnSdkTimedout:!1,updateOnSdkReady:!0,updateOnSdkReadyFromCache:!0};function lv(e){var t=Q(Q({},$r),e),r=t.updateOnSdkReady,n=t.updateOnSdkReadyFromCache,i=t.updateOnSdkTimedout,a=t.updateOnSdkUpdate,s=t.splitKey,o=t.trafficType,f=t.attributes,u=te.useContext(Ro),c=u.client,v=u.factory,l=c;s&&v&&(l=xr(v,s,o)),No(l,f);var p=We(l),h=te.useState(p.lastUpdate),E=h[1];return te.useEffect(function(){if(l){var g=function(){return E(l.lastUpdate)},d=We(l);return r&&(d.isReady?p.isReady||g():l.once(l.Event.SDK_READY,g)),n&&(d.isReadyFromCache?p.isReadyFromCache||g():l.once(l.Event.SDK_READY_FROM_CACHE,g)),i&&(d.hasTimedout?p.hasTimedout||g():l.once(l.Event.SDK_READY_TIMED_OUT,g)),a&&l.on(l.Event.SDK_UPDATE,g),function(){l.off(l.Event.SDK_READY,g),l.off(l.Event.SDK_READY_FROM_CACHE,g),l.off(l.Event.SDK_READY_TIMED_OUT,g),l.off(l.Event.SDK_UPDATE,g)}}},[l,r,n,i,a,p]),Q({factory:v,client:l},p)}var hv=function(e){je(t,e);function t(r){var n=e.call(this,r)||this;n.update=function(){n.setState({lastUpdate:n.state.client.lastUpdate})};var i=r.factory,a=r.client;return n.state=Q({factory:i,client:a},We(a)),n}return t.getDerivedStateFromProps=function(r,n){var i=r.client,a=r.factory,s=r.attributes;No(i,s);var o=We(i);return i!==n.client||o.isReady!==n.isReady||o.isReadyFromCache!==n.isReadyFromCache||o.hasTimedout!==n.hasTimedout||o.isDestroyed!==n.isDestroyed?Q({client:i,factory:a},o):null},t.prototype.subscribeToEvents=function(r){if(r){var n=We(r),i=this.state;this.props.updateOnSdkReady&&(n.isReady?i.isReady||this.update():r.once(r.Event.SDK_READY,this.update)),this.props.updateOnSdkReadyFromCache&&(n.isReadyFromCache?i.isReadyFromCache||this.update():r.once(r.Event.SDK_READY_FROM_CACHE,this.update)),this.props.updateOnSdkTimedout&&(n.hasTimedout?i.hasTimedout||this.update():r.once(r.Event.SDK_READY_TIMED_OUT,this.update)),this.props.updateOnSdkUpdate&&r.on(r.Event.SDK_UPDATE,this.update)}},t.prototype.unsubscribeFromEvents=function(r){r&&(r.off(r.Event.SDK_READY,this.update),r.off(r.Event.SDK_READY_FROM_CACHE,this.update),r.off(r.Event.SDK_READY_TIMED_OUT,this.update),r.off(r.Event.SDK_UPDATE,this.update))},t.prototype.componentDidMount=function(){this.subscribeToEvents(this.props.client)},t.prototype.componentDidUpdate=function(r){this.props.client!==r.client&&(this.unsubscribeFromEvents(r.client),this.subscribeToEvents(this.props.client))},t.prototype.componentWillUnmount=function(){this.unsubscribeFromEvents(this.props.client)},t.prototype.render=function(){var r=this.props.children;return te.createElement(Ro.Provider,{value:this.state},typeof r=="function"?r(Q({},this.state)):r)},t.defaultProps=Q({children:null,factory:null,client:null},$r),t}(te.Component);function pv(e){var t=Q(Q({},$r),e),r=t.config,n=t.factory,i=t.updateOnSdkReady,a=t.updateOnSdkReadyFromCache,s=t.updateOnSdkTimedout,o=t.updateOnSdkUpdate;r&&n&&(console.log(Xh),r=void 0);var f=te.useState(null),u=f[0],c=f[1],v=n||(u&&r===u.config?u:null),l=v?xr(v):null;return te.useEffect(function(){if(r){var p=ev(r);return function(){tv(p)}}},[r]),te.useEffect(function(){var p=r&&dt.get(r);if(p){var h=xr(p),E=We(h),g=function(){d(),c(p)},d=function(){h.off(h.Event.SDK_READY,g),h.off(h.Event.SDK_READY_FROM_CACHE,g),h.off(h.Event.SDK_READY_TIMED_OUT,g),h.off(h.Event.SDK_UPDATE,g)};return i&&(E.isReady?g():h.once(h.Event.SDK_READY,g)),a&&(E.isReadyFromCache?g():h.once(h.Event.SDK_READY_FROM_CACHE,g)),s&&(E.hasTimedout?g():h.once(h.Event.SDK_READY_TIMED_OUT,g)),o&&h.on(h.Event.SDK_UPDATE,g),d}},[r,i,a,s,o]),te.createElement(hv,Q({},e,{factory:v,client:l}))}function dv(e){var t=lv(Q(Q({},e),{attributes:void 0})),r=t.client,n=t.lastUpdate,i=e.names,a=e.flagSets,s=e.attributes,o=te.useMemo(uv,[]),f=o(r,n,i,s,r?Q({},r.getAttributes()):{},a);return Q(Q({},t),{treatments:f})}export{pv as S,dv as a,lv as u};