@statsig/js-client 3.30.0 → 3.30.2
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
var $Q=(e)=>Object.defineProperty(e,"__esModule",{value:!0});var $Q2=(a,b,c)=>Object.defineProperty(a,b,c);var $P=(a,b)=>Object.assign(a,b);var $A=()=>((t,r,u,l)=>{return new(u=u||Promise)(function(n,e){function i(t){try{s(l.next(t))}catch(t){e(t)}}function o(t){try{s(l.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}s((l=l.apply(t,r||[])).next())})});!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Statsig=e():t.Statsig=e()}(this,()=>(()=>{"use strict";var i={1845:(t,i,e)=>{var n;$Q2(i,"__esModule",{value:!0}),i.t=i.i=i.l=void 0;const s=e(7512);i.l=()=>{try{return"undefined"!=typeof __STATSIG__?__STATSIG__:u}catch(t){return u}},i.i=t=>(0,i.l)()[t];i.t=t=>{var e=(0,i.l)();return t?e.instances&&e.instances[t]:(e.instances&&1<Object.keys(e.instances).length&&s.Log.warn("Call made to Statsig global instance without an SDK key but there is more than one client instance. If you are using mulitple clients, please specify the SDK key."),e.firstInstance)};var r="__STATSIG__",l="undefined"!=typeof window?window:{},e=void 0!==e.g?e.g:{},o="undefined"!=typeof globalThis?globalThis:{};const u=null!=(n=null!=(n=null!=(n=l[r])?n:e[r])?n:o[r])?n:{instance:i.t};l[r]=u,e[r]=u,o[r]=u},2137:(t,e,i)=>{$Q(e),e.o=e.u=void 0;const s=i(1406);function n(t,e,i){if(i)return i(t,e);const n=e&&e.customIDs?e.customIDs:{};e=["uid:"+(null!=(i=null==e?void 0:e.userID)?i:""),"cids:"+Object.keys(n).sort((t,e)=>t.localeCompare(e)).map(t=>t+"-"+n[t]).join(","),"k:"+t];return(0,s.h)(e.join("|"))}e.u=n,e.o=function(t,e,i){return e?n(t,e,i):(0,s.h)("k:"+t)}},6427:(t,e)=>{$Q(e)},694:function(t,e,i){var s=this&&this.__awaiter||$A();$Q(e),e.v=e.DataAdapterCore=void 0;const u=i(7512),a=i(9122),r=i(8578),l=i(4534),c=i(3401);function h(t,e,i,n){return{source:t,data:e,receivedAt:Date.now(),stableID:i,fullUserHash:(0,r._)(n)}}e.DataAdapterCore=class{constructor(t,e){this.p=t,this.m=e,this.O=null,this.j=null,this.gn=10,this.S="statsig.last_modified_time."+e,this.k=new n}attach(t,e,i){this.j=t,this.O=e}getDataSync(t){var t=t&&(0,r.D)(t,this.O),e=this.I(t),i=this.k.get(e,t);return i&&this.M(i)?i:(i=this.T(e))&&this.M(i)?(this.k.add(e,i,this.gn),this.k.get(e,t)):null}setData(t,e){var e=e&&(0,r.D)(e,this.O),i=this.I(e);this.k.add(i,h("Bootstrap",t,null,e),this.gn)}M(t){return null==t.stableID||t.stableID===a.StableID.get(this.N())}C(e,i,n){return s(this,void 0,void 0,function*(){l.Storage.isReady()||(yield l.Storage.isReadyResolver());var t=null!=e?e:this.getDataSync(i),t=[this.R(t,i,n)];return null!=n&&n.timeoutMs&&t.push(new Promise(t=>setTimeout(t,n.timeoutMs)).then(()=>(u.Log.debug("Fetching latest value timed out"),null))),yield Promise.race(t)})}U(i,n){return s(this,void 0,void 0,function*(){var t=i&&(0,r.D)(i,this.O),e=this.I(t),t=yield this.C(null,t,n);t&&this.k.add(e,$P($P({},t),{source:"Prefetch"}),this.gn)})}R(r,l,o){return s(this,void 0,void 0,function*(){var t=null!=(t=null==r?void 0:r.data)?t:null,e=null!=r&&this.A(r,l),e=yield this.F(t,l,o,e);if(!e)return u.Log.debug("No response returned for latest value"),null;var i=(0,c.P)(e,"has_updates","Response"),n=this.N(),n=a.StableID.get(n);let s=null;if(!0===(null==i?void 0:i.has_updates))s=h("Network",e,n,l);else{if(!t||!1!==(null==i?void 0:i.has_updates))return null;s=h("NetworkNotModified",t,n,l)}e=this.I(l);return this.k.add(e,s,this.gn),this.L(e,s),s})}N(){return null!=this.j?this.j:(u.Log.error(this.p+" is not attached to a Client"),"")}T(t){var e=null==(e=l.Storage.getItem)?void 0:e.call(l.Storage,t);return null!=e&&(t=(0,c.P)(e,"source","Cached Result"))?$P($P({},t),{source:"Cache"}):null}L(e,t){var i=JSON.stringify(t);for(let t=0;t<8;t++)try{l.Storage.setItem(e,i);break}catch(t){if(!(t instanceof Error)||!t.toString().includes("QuotaExceededError")&&!t.toString().includes("QUOTA_EXCEEDED_ERR")||this.gn<=1)throw t;this.gn=Math.ceil(this.gn/2),this.q(e,this.gn-1)}this.q(e)}q(t,e=this.gn){var i=null!=(n=(0,l.K)(this.S))?n:{},n=(i[t]=Date.now(),o(i,e));for(const s of n)delete i[s],l.Storage.removeItem(s);(0,l.B)(this.S,i)}},e.v=h;class n{constructor(){this.$={}}get(t,e){var t=this.$[t],i=null==t?void 0:t.stableID,e=null==(e=null==e?void 0:e.customIDs)?void 0:e.stableID;return e&&i&&e!==i?(u.Log.warn("'StatsigUser.customIDs.stableID' mismatch"),null):t}add(t,e,i){for(const n of o(this.$,i-1))delete this.$[n];this.$[t]=e}merge(t){this.$=$P($P({},this.$),t)}}function o(i,t){var e=Object.keys(i);return e.length<=t?[]:0===t?e:e.sort((t,e)=>{t=i[t],e=i[e];return"object"==typeof t&&"object"==typeof e?t.receivedAt-e.receivedAt:t-e}).slice(0,e.length-t)}},8962:(t,l)=>{$Q2(l,"__esModule",{value:!0}),l.Diagnostics=void 0;const n=new Map,i="start";function s(t,e,i,n){return $P({key:i,action:e,step:n,timestamp:Date.now()},t)}function r(t,e){var i=null!=(i=n.get(t))?i:[];i.push(e),n.set(t,i)}function e(t,e){if(e in t)return t[e]}l.Diagnostics={V:t=>n.get(t),G:t=>{r(t,s({},i,"overall"))},J:(t,e,i)=>{r(t,s({success:e,error:e?void 0:{name:"InitializeError",message:"Failed to initialize"},evaluationDetails:i},"end","overall"))},W:(t,e)=>{r(t,s(e,i,"initialize","network_request"))},Y:(t,e)=>{r(t,s(e,"end","initialize","network_request"))},X:t=>{r(t,s({},i,"initialize","process"))},H:(t,e)=>{r(t,s(e,"end","initialize","process"))},Z:t=>{n.delete(t)},tt(t){if(t&&"object"==typeof t)return{code:e(t,"code"),name:e(t,"name"),message:e(t,"message")}},et(t,e,i,n){return{success:!0===(null==t?void 0:t.ok),statusCode:null==t?void 0:t.status,sdkRegion:null==(t=null==t?void 0:t.headers)?void 0:t.get("x-statsig-region"),isDelta:!0===i.includes('"is_delta":true')||void 0,attempt:e,error:l.Diagnostics.tt(n)}},it(t,e,i,n){var s,r=l.Diagnostics.V(i);return null==r||r.length<=0?-1:(s=r[r.length-1].timestamp-r[0].timestamp,l.Diagnostics.Z(i),i=function(t,e){t={eventName:"statsig::diagnostics",user:t,value:null,metadata:e,time:Date.now()};return t}(t,{context:"initialize",markers:r.slice(),statsigOptions:n}),e.enqueue(i),s)}}},8809:function(t,e){var i=this&&this.__awaiter||$A();$Q(e),e.nt=void 0;const s=new Uint8Array([0,0,1,0,0,1,0,0,0,0,0,0,13,102,101,97,116,117,114,101,97,115,115,101,116,115,3,111,114,103,0,0,16,0,1]),r="https://cloudflare-dns.com/dns-query",l=["i","e","d"],o=200;e.nt=function(e){return i(this,void 0,void 0,function*(){var i=yield e(r,{method:"POST",headers:{"Content-Type":"application/dns-message",Accept:"application/dns-message"},body:s});if(i.ok){var t,i=yield i.arrayBuffer(),i=new Uint8Array(i);{var n=i,i=n.findIndex((t,e)=>e<o&&"="===String.fromCharCode(t)&&l.includes(String.fromCharCode(n[e-1])));if(-1===i)throw(t=new Error("Failed to parse TXT records from DNS")).name="DnsTxtParseError",t;let e="";for(let t=i-1;t<n.length;t++)e+=String.fromCharCode(n[t]);return e.split(",")}}throw(t=new Error("Failed to fetch TXT records from DNS")).name="DnsTxtFetchError",t})}},3539:(t,e)=>{$Q(e)},5542:function(t,o,e){var i=this&&this.__awaiter||$A();$Q2(o,"__esModule",{value:!0}),o.ErrorBoundary=o.EXCEPTION_ENDPOINT=void 0;const n=e(7512),u=e(5902),a=e(8e3),c=(o.EXCEPTION_ENDPOINT="https://statsigapi.net/v1/sdk_exception","[Statsig] UnknownError");function h(t){return t instanceof Error?t:"string"==typeof t?new Error(t):new Error("An unknown error occurred.")}o.ErrorBoundary=class{constructor(t,e,i,n){this.j=t,this.O=e,this.st=i,this.rt=n,this.lt=new Set}wrap(n,s){try{const t=n;!function(t){const e=new Set;let i=Object.getPrototypeOf(t);for(;i&&i!==Object.prototype;)Object.getOwnPropertyNames(i).filter(t=>"function"==typeof(null===i||void 0===i?void 0:i[t])).forEach(t=>e.add(t)),i=Object.getPrototypeOf(i);return Array.from(e)}(t).forEach(e=>{const i=t[e];"$EB"in i||(t[e]=(...t)=>this.ot(s?s+":"+e:e,()=>i.apply(n,t)),t[e].$EB=!0)})}catch(t){this.ut("eb:wrap",t)}}logError(t,e){this.ut(t,e)}getLastSeenErrorAndReset(){var t=this.rt;return this.rt=void 0,null!=t?t:null}attachErrorIfNoneExists(t){this.rt||(this.rt=h(t))}ot(e,t){try{var i=t();return i&&i instanceof Promise?i.catch(t=>this.ut(e,t)):i}catch(t){return this.ut(e,t),null}}ut(r,l){try{n.Log.warn("Caught error in "+r,{error:l});i(this,void 0,void 0,function*(){var t,e=l||Error(c),i=e instanceof Error,n=i?e.name:"No Name",s=h(e);this.rt=s,this.lt.has(n)||(this.lt.add(n),null!=(s=null==(s=this.O)?void 0:s.networkConfig)&&s.preventAllNetworkTraffic?null!=(s=this.st)&&s.call(this,{name:"error",error:l,tag:r}):(s=u.SDKType.ct(this.j),t=a.StatsigMetadataProvider.get(),i=i?e.stack:function(t){try{return JSON.stringify(t)}catch(t){return c}}(e),e=$P({tag:r,exception:n,info:i,statsigOptions:function(n){if(!n)return{};const s={};return Object.keys(n).forEach(t=>{var e=t,i=n[e];switch(typeof i){case"number":case"bigint":case"boolean":s[String(e)]=i;break;case"string":i.length<50?s[String(e)]=i:s[String(e)]="set";break;case"object":"environment"===e?s.environment=i:"networkConfig"===e?s.networkConfig=i:s[String(e)]=null!=i?"set":"unset"}}),s}(this.O)},$P($P({},t),{sdkType:s})),yield(null!=(n=null==(i=null==(n=this.O)?void 0:n.networkConfig)?void 0:i.networkOverrideFunc)?n:fetch)(o.EXCEPTION_ENDPOINT,{method:"POST",headers:{"STATSIG-API-KEY":this.j,"STATSIG-SDK-TYPE":String(s),"STATSIG-SDK-VERSION":String(t.sdkVersion),"Content-Type":"application/json"},body:JSON.stringify(e)}),null!=(i=this.st)&&i.call(this,{name:"error",error:l,tag:r})))}).then(()=>{}).catch(()=>{})}catch(t){}}}},2922:(t,e)=>{$Q(e)},2417:(t,e)=>{$Q(e)},7770:function(t,e,i){var n=this&&this.__awaiter||$A();$Q(e),e.EventLogger=void 0;const s=i(2137),r=i(1406),l=i(7512),o=i(7410),u=i(6830),a=i(1637),c=i(586),h=i(4534),d=i(1881),v=i(2397),f={};class _{static ht(t){null!=(t=f[t])&&t.flush().catch(()=>{})}static dt(t){null!=(t=f[t])&&t.vt()}constructor(t,e,i,n){this.j=t,this.st=e,this.ft=i,this.O=n,this.gt=[],this._t={},this.bt={},this.yt=!1,this.Ot=Date.now(),this.jt=null!=(t=null==n?void 0:n.loggingEnabled)?t:!0===(null==n?void 0:n.disableLogging)?c.LoggingEnabledOption.disabled:c.LoggingEnabledOption.browserOnly,null!=n&&n.loggingEnabled&&void 0!==n.disableLogging&&l.Log.warn("Detected both loggingEnabled and disableLogging options. loggingEnabled takes precedence - please remove disableLogging."),this.St=null!=(e=null==n?void 0:n.loggingBufferMaxSize)?e:100;i=null==n?void 0:n.networkConfig;this.wt=new d.UrlConfiguration(o.Endpoint.kt,null==i?void 0:i.logEventUrl,null==i?void 0:i.api,null==i?void 0:i.logEventFallbackUrls)}setLogEventCompressionMode(t){this.ft.setLogEventCompressionMode(t)}setLoggingEnabled(t){var e,i;"disabled"===this.jt&&"disabled"!==t&&(e=this.o(),(i=(0,h.K)(e))&&this.gt.push(...i),h.Storage.removeItem(e)),this.jt=t}enqueue(t){this.Et(t)&&(this.Dt(t),this.It(),this.gt.length>this.St)&&_.ht(this.j)}incrementNonExposureCount(t){var e=null!=(e=this.bt[t])?e:0;this.bt[t]=e+1}reset(){this.flush().catch(()=>{}),this._t={}}start(){var t,e=(0,u.Mt)();e&&"always"!==(null==(t=this.O)?void 0:t.loggingEnabled)||(f[this.j]=this,e||(0,v.xt)(t=>{"background"===t?_.ht(this.j):"foreground"===t&&_.dt(this.j)}),this.vt(),this.Tt())}stop(){return n(this,void 0,void 0,function*(){this.Nt&&(clearInterval(this.Nt),this.Nt=null),delete f[this.j],yield this.flush()})}flush(){return n(this,void 0,void 0,function*(){var t;this.Ct(),0!==this.gt.length&&(t=this.gt,this.gt=[],yield this.Rt(t))})}It(){this.yt||(this.yt=!0,200<Date.now()-this.Ot)||setTimeout(()=>_.ht(this.j),200)}Et(t){if("always"!==(null==(e=this.O)?void 0:e.loggingEnabled)&&(0,u.Mt)())return!1;if((0,a.Ut)(t)){var e=t.user||{statsigEnvironment:void 0},e=(0,s.u)(this.j,e),i=t.metadata||{},t=[t.eventName,e,i.gate,i.config,i.ruleID,i.allocatedExperiment,i.parameterName,String(i.isExplicitParameter),i.reason].join("|"),e=this._t[t],i=Date.now();if(e&&i-e<6e5)return!1;1e3<Object.keys(this._t).length&&(this._t={}),this._t[t]=i}return!0}Rt(s){return n(this,void 0,void 0,function*(){var t,e;if("disabled"===this.jt)return this.At(s),!1;try{var i=(0,v.Ft)()&&this.ft.isBeaconSupported()&&null==(null==(e=null==(t=this.O)?void 0:t.networkConfig)?void 0:e.networkOverrideFunc),n=(this.st({name:"pre_logs_flushed",events:s}),i?this.Pt(s):yield this.Lt(s));return n.success?(this.st({name:"logs_flushed",events:s}),!0):(l.Log.warn("Failed to flush events."),this.At(s),!1)}catch(t){return l.Log.warn("Failed to flush events."),!1}})}Lt(e){return n(this,void 0,void 0,function*(){var t=yield this.ft.post(this.zt(e)),t=null!=(t=null==t?void 0:t.code)?t:-1;return{success:200<=t&&t<300}})}Pt(t){return{success:this.ft.beacon(this.zt(t))}}zt(t){return{sdkKey:this.j,data:{events:t},urlConfig:this.wt,retries:3,isCompressable:!0,params:{[o.NetworkParam.EventCount]:String(t.length)},credentials:"same-origin"}}At(t){for(;500<t.length;)t.shift();var e=this.o();try{var i=this.pn(e);(0,h.B)(e,[...i,...t])}catch(t){l.Log.warn("Unable to save failed logs to storage")}}pn(t){let e=[];try{var i=(0,h.K)(t);return e=Array.isArray(i)?i:e}catch(t){return[]}}vt(){const e=this.o();n(this,void 0,void 0,function*(){h.Storage.isReady()||(yield h.Storage.isReadyResolver());var t=(0,h.K)(e);t&&(h.Storage.removeItem(e),yield this.Rt(t))}).catch(()=>{l.Log.warn("Failed to flush stored logs")})}o(){return"statsig.failed_logs."+(0,r.h)(this.j)}Dt(t){t.user&&(t.user=$P({},t.user),delete t.user.privateAttributes);var e={},i=this.qt(),i=(i&&(e.statsigMetadata={currentPage:i}),$P($P({},t),e));l.Log.debug("Enqueued Event:",i),this.gt.push(i)}Ct(){0!==Object.keys(this.bt).length&&(this.Dt({eventName:"statsig::non_exposed_checks",user:null,time:Date.now(),metadata:{checks:$P({},this.bt)}}),this.bt={})}qt(){var t;if(!1!==(null==(t=this.O)?void 0:t.includeCurrentPageUrlWithEvents))return(0,u.Kt)()}Tt(){var t=null!=(t=null==(t=this.O)?void 0:t.loggingIntervalMs)?t:1e4;const e=setInterval(()=>{var t=f[this.j];t&&t.Nt===e?_.ht(this.j):clearInterval(e)},t);this.Nt=e}}e.EventLogger=_},1406:(t,r,e)=>{$Q2(r,"__esModule",{value:!0}),r.Bt=r.$t=r.h=void 0;const l=e(6634);r.h=e=>{let i=0;for(let t=0;t<e.length;t++){var n=e.charCodeAt(t);i=(i<<5)-i+n,i&=i}return String(i>>>0)},r.$t=(t,e)=>(0,r.h)(JSON.stringify((0,r.Bt)(t,e)));r.Bt=(i,n)=>{if(null==i)return null;var t=Object.keys(i).sort();const s={};return t.forEach(t=>{var e=i[t];0===n||"object"!==(0,l.Vt)(e)?s[t]=e:s[t]=(0,r.Bt)(e,null!=n?n-1:n)}),s}},1333:(t,e)=>{$Q(e)},7512:(t,e)=>{$Q(e),e.Log=e.LogLevel=void 0;function i(t){return t.unshift("[Statsig]"),t}e.LogLevel={None:0,Error:1,Warn:2,Info:3,Debug:4};class n{static info(...t){n.level>=e.LogLevel.Info&&console.info(" INFO ",...i(t))}static debug(...t){n.level>=e.LogLevel.Debug&&console.debug(" DEBUG ",...i(t))}static warn(...t){n.level>=e.LogLevel.Warn&&console.warn(" WARN ",...i(t))}static error(...t){n.level>=e.LogLevel.Error&&console.error(" ERROR ",...i(t))}}(e.Log=n).level=e.LogLevel.Warn},7787:(t,e)=>{$Q(e),e.createMemoKey=e.MemoPrefix=void 0,e.MemoPrefix={Gt:"g",Jt:"c",Wt:"e",Yt:"cl",Xt:"l",Ht:"p"};const r=new Set([]),l=new Set(["userPersistedValues"]);e.createMemoKey=function(t,e,i){let n=t+"|"+e;if(i)for(const s of Object.keys(i)){if(l.has(s))return;r.has(s)?n+=`|${s}=true`:n+=`|${s}=`+i[s]}return n}},7410:(t,e)=>{$Q(e),e.NetworkParam=e.NetworkDefault=e.Endpoint=void 0,e.Endpoint={Qt:"initialize",kt:"rgstr",Zt:"download_config_specs"},e.NetworkDefault={[e.Endpoint.kt]:"https://prodregistryv2.org/v1",[e.Endpoint.Qt]:"https://featureassets.org/v1",[e.Endpoint.Zt]:"https://api.statsigcdn.com/v1"},e.NetworkParam={EventCount:"ec",SdkKey:"k",SdkType:"st",SdkVersion:"sv",Time:"t",SessionID:"sid",StatsigEncoded:"se",IsGzipped:"gz"}},7023:function(t,e,i){var m=this&&this.__awaiter||$A();$Q(e),e.NetworkCore=void 0,i(1845);const v=i(1845),y=i(8962),O=i(7512),j=i(7410),n=i(308),f=i(3091),l=i(5902),s=i(6830),o=i(4143),u=i(9122),S=i(2636),a=i(8e3),_=i(586),w=i(2397),E=500,k=3e4;const D=new Set([408,500,502,503,504,522,524,599]);e.NetworkCore=class{constructor(t,e){this.st=e,this.te=null,this.ee=1e4,this.ie={},this.O={},this.ne={},this.se=null,t&&(this.O=t),this.O.networkConfig&&(this.ie=this.O.networkConfig),this.ie.networkTimeoutMs&&(this.ee=this.ie.networkTimeoutMs),this.re=new n.NetworkFallbackResolver(this.O),this.setLogEventCompressionMode(this.le(t))}setLogEventCompressionMode(t){this.O.logEventCompressionMode=t}setErrorBoundary(t){this.te=t,this.te.wrap(this),this.te.wrap(this.re),this.re.setErrorBoundary(t)}isBeaconSupported(){return"undefined"!=typeof navigator&&"function"==typeof navigator.sendBeacon}getLastUsedInitUrlAndReset(){var t=this.se;return this.se=null,t}beacon(t){var e,i;return!!x(t)&&(t=this.oe("POST",t),e=this.ue(t),(i=navigator).sendBeacon.bind(i)(e,t.body))}post(e){return m(this,void 0,void 0,function*(){var t=this.oe("POST",e);return this.ae(t),yield this.ce(t),this.he(t)})}get(t){t=this.oe("GET",t);return this.he(t)}he(b){return m(this,void 0,void 0,function*(){var e;if(!x(b))return null;if(this.ie.preventAllNetworkTraffic)return null;var{method:n,body:s,retries:i,attempt:r}=b,l=b.urlConfig.endpoint;if(this.de(l))return O.Log.warn(`Request to ${l} was blocked because you are making requests too frequently.`),null;r=null!=r?r:1;let o=!1;var u=this.ue(b);let a=null;var c,h=(0,w.Ft)();try{var t,d,v,f={method:n,body:s,headers:$P({},b.headers),priority:b.priority,keepalive:h},_=(c=r,(p=b).urlConfig.endpoint===j.Endpoint.Qt&&y.Diagnostics.W(p.sdkKey,{attempt:c}),this.ne[l]),g=(_&&(_.lastRequestTime=Date.now(),this.ne[l]=_),null!=(e=this.ie.networkOverrideFunc)?e:fetch);let i;if((a=yield Promise.race([g(u,f).finally(()=>clearTimeout(i)),new Promise((t,e)=>{i=setTimeout(()=>{o=!0,e(new Error(`Timeout of ${this.ee}ms expired.`))},this.ee)})])).ok)return v=yield a.text(),I(b,a,r,v),this.re.tryBumpExpiryTime(b.sdkKey,b.urlConfig),{body:v,code:a.status};throw t=yield a.text().catch(()=>"No Text"),(d=new Error(`NetworkError: ${u} `+t)).name="NetworkError",d}catch(t){var s=function(t){if("string"==typeof t)return t;if(t instanceof Error)return t.name+": "+t.message;return"Unknown Error"}(t),h=function(t,e){t=t.includes("Timeout");return t||e}(null!=s?s:"",o),p=(I(b,a,r,"",t),yield this.re.tryFetchUpdatedFallbackInfo(b.sdkKey,b.urlConfig,s,h));return(p&&(b.fallbackUrl=this.re.getActiveFallbackUrl(b.sdkKey,b.urlConfig)),!i||i<r||!D.has(null!=(c=null===a||void 0===a?void 0:a.status)?c:500))?(null!=(l=this.st)&&l.call(this,{name:"error",error:t,tag:S.ErrorTag.NetworkError,requestArgs:b}),_=`A networking error occurred during ${n} request to ${u}.`,O.Log.error(_,s,t),null!=(e=this.te)&&e.attachErrorIfNoneExists(_),null):(yield function(e){return m(this,void 0,void 0,function*(){yield new Promise(t=>setTimeout(t,Math.min(E*(e*e),k)))})}(r),this.he($P($P({},b),{retries:i,attempt:r+1})))}})}le(t){let e=null==t?void 0:t.logEventCompressionMode;return e=(e=e||!0!==(null==t?void 0:t.disableCompression)?e:_.LogEventCompressionMode.Disabled)||_.LogEventCompressionMode.Enabled}de(t){var e=Date.now(),i=null!=(i=this.ne[t])?i:{count:0,lastRequestTime:e},n=e-i.lastRequestTime,n=Math.floor(.05*n);return i.count=Math.max(0,i.count-n),50<=i.count||(i.count+=1,i.lastRequestTime=e,this.ne[t]=i,!1)}ue(t){var e=null!=(e=t.fallbackUrl)?e:t.urlConfig.getUrl();t.urlConfig.endpoint!==j.Endpoint.Qt&&t.urlConfig.endpoint!==j.Endpoint.Zt||(this.se=e);const i=$P({[j.NetworkParam.SdkKey]:t.sdkKey,[j.NetworkParam.SdkType]:l.SDKType.ct(t.sdkKey),[j.NetworkParam.SdkVersion]:a.SDK_VERSION,[j.NetworkParam.Time]:String(Date.now()),[j.NetworkParam.SessionID]:o.SessionID.get(t.sdkKey)},t.params);t=Object.keys(i).map(t=>encodeURIComponent(t)+"="+encodeURIComponent(i[t])).join("&");return e+(t?"?"+t:"")}ae(e){var t,i=(0,s.ve)(),n=e.body;if(e.isStatsigEncodable&&!this.O.disableStatsigEncoding&&"string"==typeof n&&null==(0,v.i)("no-encode")&&null!=i&&i.btoa)try{e.body=i.btoa(n).split("").reverse().join(""),e.params=$P($P({},null!=(t=e.params)?t:{}),{[j.NetworkParam.StatsigEncoded]:"1"})}catch(t){O.Log.warn("Request encoding failed for "+e.urlConfig.getUrl(),t)}}ce(d){return m(this,void 0,void 0,function*(){var e,i=d.body;if("string"==typeof i&&function(t,e){if(!t.isCompressable)return;if(null!=(0,v.i)("no-compress")||"undefined"==typeof CompressionStream||"undefined"==typeof TextEncoder)return;var i=null!=t.urlConfig.customUrl||null!=t.urlConfig.fallbackUrls,n=!0===f.SDKFlags.get(t.sdkKey,"enable_log_event_compression");switch(e.logEventCompressionMode){case _.LogEventCompressionMode.Disabled:return;case _.LogEventCompressionMode.Enabled:return i&&!n?void 0:1;case _.LogEventCompressionMode.Forced:return 1;default:return}}(d,this.O))try{for(var n,s=(new TextEncoder).encode(i),r=new CompressionStream("gzip"),l=r.writable.getWriter(),o=(l.write(s).catch(O.Log.error),l.close().catch(O.Log.error),r.readable.getReader()),u=[];!(n=yield o.read()).done;)u.push(n.value);var a=u.reduce((t,e)=>t+e.length,0),c=new Uint8Array(a);let t=0;for(const h of u)c.set(h,t),t+=h.length;d.body=c,d.params=$P($P({},null!=(e=d.params)?e:{}),{[j.NetworkParam.IsGzipped]:"1"})}catch(t){O.Log.warn("Request compression failed for "+d.urlConfig.getUrl(),t)}})}oe(t,e){var i=this.re.getActiveFallbackUrl(e.sdkKey,e.urlConfig),t=$P($P({},e),{method:t,fallbackUrl:i});return"data"in e&&r(t,e.data),t}};const x=t=>!!t.sdkKey||(O.Log.warn("Unable to make request without an SDK key"),!1),r=(t,e)=>{var{sdkKey:i,fallbackUrl:n}=t,s=u.StableID.get(i),r=o.SessionID.get(i),i=l.SDKType.ct(i);t.body=JSON.stringify($P($P({},e),{statsigMetadata:$P($P({},a.StatsigMetadataProvider.get()),{stableID:s,sessionID:r,sdkType:i,fallbackUrl:n})}))};function I(t,e,i,n,s){t.urlConfig.endpoint===j.Endpoint.Qt&&y.Diagnostics.Y(t.sdkKey,y.Diagnostics.et(e,i,n,s))}},308:function(t,e,i){var o=this&&this.__awaiter||$A();$Q(e),e.fe=e.NetworkFallbackResolver=void 0;const l=i(8809),n=i(1406),r=i(7512),u=i(4534);function a(t,e){t=null!=(t=null==t?void 0:t.toLowerCase())?t:"";return e||t.includes("uncaught exception")||t.includes("failed to fetch")||t.includes("networkerror when attempting to fetch resource")}function c(t){return"statsig.network_fallback."+(0,n.h)(t)}function h(t,e){t=c(t);e&&0!==Object.keys(e).length?u.Storage.setItem(t,JSON.stringify(e)):u.Storage.removeItem(t)}e.NetworkFallbackResolver=class{constructor(t){this.ge=null,this.te=null,this._e={},this.pe=null==(t=t.networkConfig)?void 0:t.networkOverrideFunc}setErrorBoundary(t){this.te=t}tryBumpExpiryTime(t,e){var i=null==(i=this.ge)?void 0:i[e.endpoint];i&&(i.expiryTime=Date.now()+6048e5,h(t,$P($P({},this.ge),{[e.endpoint]:i})))}getActiveFallbackUrl(t,e){var i;if(null!=e.customUrl&&null!=e.fallbackUrls)return null;let n=this.ge;null==n&&(n=null!=(s=function(t){t=c(t),t=u.Storage.getItem(t);if(!t)return null;try{return JSON.parse(t)}catch(t){return r.Log.error("Failed to parse FallbackInfo"),null}}(t))?s:{},this.ge=n);var s=n[e.endpoint];return!s||Date.now()>(null!=(i=s.expiryTime)?i:0)||e.getChecksum()!==s.urlConfigChecksum?(delete n[e.endpoint],this.ge=n,h(t,this.ge),null):s.url||null}tryFetchUpdatedFallbackInfo(n,s,r,l){return o(this,void 0,void 0,function*(){var e,t,i;try{return a(r,l)?(t=null==s.customUrl&&null==s.fallbackUrls?yield this.be(s):s.fallbackUrls,!!(i=this.ye(null==(e=this.ge)?void 0:e[s.endpoint],t))&&(this.me(n,s,i),!0)):!1}catch(t){return null!=(e=this.te)&&e.logError("tryFetchUpdatedFallbackInfo",t),!1}})}me(t,e,i){var i={urlConfigChecksum:e.getChecksum(),url:i,expiryTime:Date.now()+6048e5,previous:[]},e=e.endpoint,n=null==(n=this.ge)?void 0:n[e],n=(n&&i.previous.push(...n.previous),10<i.previous.length&&(i.previous=[]),null==(n=null==(n=this.ge)?void 0:n[e])?void 0:n.url);null!=n&&i.previous.push(n),this.ge=$P($P({},this.ge),{[e]:i}),h(t,this.ge)}be(r){return o(this,void 0,void 0,function*(){var t=this._e[r.endpoint];if(t&&Date.now()<t)return null;this._e[r.endpoint]=Date.now()+144e5;var e=[],t=yield(0,l.nt)(null!=(t=this.pe)?t:fetch),i=function(t){try{return new URL(t).pathname}catch(t){return null}}(r.defaultUrl);for(const s of t)if(s.startsWith(r.endpointDnsKey+"=")){var n=s.split("=");if(1<n.length){let t=n[1];t.endsWith("/")&&(t=t.slice(0,-1)),e.push("https://"+t+i)}}return e})}ye(t,e){var i;if(null==e)return null;var n=new Set(null!=(i=null==t?void 0:t.previous)?i:[]),s=null==t?void 0:t.url;let r=null;for(const o of e){var l=o.endsWith("/")?o.slice(0,-1):o;if(!n.has(o)&&l!==s){r=l;break}}return r}},e.fe=a},1405:(t,e)=>{$Q(e)},1361:(t,e)=>{$Q(e)},3091:(t,e)=>{$Q(e),e.SDKFlags=void 0;const i={};e.SDKFlags={setFlags:(t,e)=>{i[t]=e},get:(t,e)=>{return null!=(t=null==(t=i[t])?void 0:t[e])&&t}}},5902:(t,e)=>{$Q(e),e.SDKType=void 0;const i={};let n;e.SDKType={ct:t=>{return(null!=(t=i[t])?t:"js-mono")+(null!==n&&void 0!==n?n:"")},Oe(t,e){i[t]=e},je(t){n&&"-react"!==n||(n="-"+t)}}},6830:(t,n)=>{$Q2(n,"__esModule",{value:!0}),n.Se=n.Kt=n.we=n.ke=n.Mt=n.Ee=n.ve=void 0;n.ve=()=>"undefined"!=typeof window?window:null,n.Ee=()=>{var t=(0,n.ve)();return null!=(t=null==t?void 0:t.document)?t:null},n.Mt=()=>{var t;return null===(0,n.Ee)()&&(t="undefined"!=typeof process&&null!=process.versions&&null!=process.versions.node,"string"==typeof EdgeRuntime||t)},n.ke=(t,e)=>{var i=(0,n.ve)();"function"==typeof(null==i?void 0:i.addEventListener)&&i.addEventListener(t,e)},n.we=(t,e)=>{var i=(0,n.Ee)();"function"==typeof(null==i?void 0:i.addEventListener)&&i.addEventListener(t,e)},n.Kt=()=>{var t;try{return null==(t=(0,n.ve)())?void 0:t.location.href.split(/[?#]/)[0]}catch(t){}};n.Se=()=>{var t=(0,n.ve)();return t&&"onpagehide"in t?"pagehide":"beforeunload"}},4143:(t,e,i)=>{$Q(e),e.StatsigSession=e.SessionID=void 0;const n=i(1845),s=i(2137),o=i(7512),u=i(4534),a=i(8023),c=18e5,h=144e5,d={};function v(e,t){return setTimeout(()=>{var t=null==(t=(0,n.l)())?void 0:t.instance(e);t&&t.$emt({name:"session_expired"})},t)}function f(t){return"statsig.session_id."+(0,s.o)(t)}e.SessionID={get:t=>e.StatsigSession.get(t).data.sessionID},e.StatsigSession={get:t=>{null==d[t]&&(d[t]=function(t){let e=function(t){t=f(t);return(0,u.K)(t)}(t);var i=Date.now();e=e||{sessionID:(0,a.getUUID)(),startTime:i,lastUpdate:i};return{data:e,sdkKey:t}}(t));var t=d[t],e=Date.now(),i=t.data,n=t.sdkKey,s=((function({lastUpdate:t}){return Date.now()-t>c}(i)||function({startTime:t}){return Date.now()-t>h}(i))&&(i.sessionID=(0,a.getUUID)(),i.startTime=e,l=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instance(n))&&l.$emt({name:"session_expired"}),i.lastUpdate=e,i),r=t.sdkKey;r=f(r);try{(0,u.B)(r,s)}catch(t){o.Log.warn("Failed to save SessionID")}clearTimeout(t.idleTimeoutID),clearTimeout(t.ageTimeoutID);var l=e-i.startTime;return t.idleTimeoutID=v(n,c),t.ageTimeoutID=v(n,h-l),t},overrideInitialSessionID:(t,e)=>{var i;d[e]=(t=t,e=e,i=Date.now(),{data:{sessionID:t,startTime:i,lastUpdate:i},sdkKey:e})}}},2176:(t,o)=>{$Q2(o,"__esModule",{value:!0}),o.De=void 0;o.De=(e,i)=>{let n=0;var s=Object.keys(e);for(let t=0;t<s.length;t++){var r=s[t],l=e[r];if((n=(n+=r.length)+("object"==typeof l&&null!==l?(0,o.De)(l,i)+2:String(l).length+1))>=i)return n}return n}},9122:(t,e,i)=>{$Q(e),e.getCookieName=e.StableID=void 0;const n=i(2137),s=i(7512),r=i(6830),l=i(4534),o=i(8023),u={},a={},c={};function h(t){return"statsig.stable_id."+(0,n.o)(t)}function d(t,e){e=h(e);try{(0,l.B)(e,t)}catch(t){s.Log.warn("Failed to save StableID to storage")}}function v(t,e){var i;a[e]&&null!=(0,r.Ee)()&&((i=new Date).setFullYear(i.getFullYear()+1),document.cookie=`${f(e)}=${encodeURIComponent(t)}; expires=${i.toUTCString()}; path=/`)}function f(t){return"statsig.stable_id."+(0,n.o)(t)}e.StableID={cookiesEnabled:!1,randomID:Math.random().toString(36),get:t=>{if(c[t])return null;if(null!=u[t])return u[t];let e=null;return null!=(e=function(t){if(a[t]&&null!=(0,r.Ee)())for(const n of document.cookie.split(";")){var[e,i]=n.trim().split("=");if(e===f(t))return decodeURIComponent(i)}return null}(t))?d(u[t]=e,t):(d(e=null==(e=function(t){t=h(t);return(0,l.K)(t)}(t))?(0,o.getUUID)():e,t),v(e,t),u[t]=e),e},setOverride:(t,e)=>{d(u[e]=t,e),v(t,e)},Ie:(t,e)=>{a[t]=e},Me:(t,e)=>{c[t]=e}},e.getCookieName=f},1375:function(t,e,i){var n=this&&this.__awaiter||$A();$Q(e),e.StatsigClientBase=void 0,i(1845);const l=i(1845),o=i(5542),u=i(7770),a=i(7512),r=i(7787),c=i(6830),h=i(4143),d=i(9122),s=i(586),v=i(4534);e.StatsigClientBase=class{constructor(t,e,i,n){this.loadingStatus="Uninitialized",this.xe=null,this.Te={};var s,r=this.$emt.bind(this);null!=(null==n?void 0:n.logLevel)&&(a.Log.level=n.logLevel),null!=n&&n.disableStorage&&v.Storage.Me(!0),null!=n&&n.initialSessionID&&h.StatsigSession.overrideInitialSessionID(n.initialSessionID,t),null!=n&&n.storageProvider&&v.Storage.Ne(n.storageProvider),null!=n&&n.enableCookies&&d.StableID.Ie(t,n.enableCookies),null!=n&&n.disableStableID&&d.StableID.Me(t,!0),this.j=t,this.O=null!=n?n:{},this.Ce={},this.overrideAdapter=null!=(s=null==n?void 0:n.overrideAdapter)?s:null,this.Re=new u.EventLogger(t,r,i,n),this.te=new o.ErrorBoundary(t,n,r),this.te.wrap(this),this.te.wrap(e),this.te.wrap(this.Re),i.setErrorBoundary(this.te),this.dataAdapter=e,this.dataAdapter.attach(t,n,i),this.storageProvider=v.Storage,null!=(e=null==(r=null==(s=this.overrideAdapter)?void 0:s.loadFromStorage)?void 0:r.call(s))&&e.catch(t=>this.te.logError("OA::loadFromStorage",t)),this.Ue(),n=t,i=this,(0,c.Mt)()||(r=(0,l.l)(),s=null!=(s=r.instances)?s:{},i=i,null!=s[n]&&a.Log.warn("Creating multiple Statsig clients with the same SDK key can lead to unexpected behavior. Multi-instance support requires different SDK keys."),s[n]=i,r.firstInstance||(r.firstInstance=i),r.instances=s,__STATSIG__=r)}updateRuntimeOptions(t){t.loggingEnabled?(this.O.loggingEnabled=t.loggingEnabled,this.Re.setLoggingEnabled(t.loggingEnabled)):null!=t.disableLogging&&(this.O.disableLogging=t.disableLogging,this.Re.setLoggingEnabled(t.disableLogging?"disabled":"browser-only")),null!=t.disableStorage&&(this.O.disableStorage=t.disableStorage,v.Storage.Me(t.disableStorage)),null!=t.enableCookies&&(this.O.enableCookies=t.enableCookies,d.StableID.Ie(this.j,t.enableCookies)),t.logEventCompressionMode?this.Re.setLogEventCompressionMode(t.logEventCompressionMode):t.disableCompression&&this.Re.setLogEventCompressionMode(s.LogEventCompressionMode.Disabled)}flush(){return this.Re.flush()}shutdown(){return n(this,void 0,void 0,function*(){this.$emt({name:"pre_shutdown"}),this.Ae("Uninitialized",null),this.xe=null,yield this.Re.stop()})}on(t,e){this.Te[t]||(this.Te[t]=[]),this.Te[t].push(e)}off(t,e){this.Te[t]&&-1!==(e=this.Te[t].indexOf(e))&&this.Te[t].splice(e,1)}$on(t,e){e.__isInternal=!0,this.on(t,e)}$emt(i){var t;const e=e=>{try{e(i)}catch(t){!0===e.__isInternal?this.te.logError("__emit:"+i.name,t):a.Log.error("An error occurred in a StatsigClientEvent listener. This is not an issue with Statsig.",i)}};this.Te[i.name]&&this.Te[i.name].forEach(t=>e(t)),null!=(t=this.Te["*"])&&t.forEach(e)}Ae(t,e){this.loadingStatus=t,this.Ce={},this.$emt({name:"values_updated",status:t,values:e})}Fe(t,e,i){!0===(null==i?void 0:i.disableExposureLog)?this.Re.incrementNonExposureCount(t):this.Re.enqueue(e)}Pe(n,s){return(t,e)=>{var i;return!this.O.disableEvaluationMemoization&&(i=(0,r.createMemoKey)(n,t,e))?(i in this.Ce||(3e3<=Object.keys(this.Ce).length&&(this.Ce={}),this.Ce[i]=s(t,e)),this.Ce[i]):s(t,e)}}}},2636:(t,e)=>{$Q(e),e.ErrorTag=void 0,e.ErrorTag={NetworkError:"NetworkError"}},3206:(t,e)=>{$Q(e),e.DataAdapterCachePrefix=void 0,e.DataAdapterCachePrefix="statsig.cached"},1637:(t,e)=>{$Q(e),e.Le=e.ze=e.qe=e.Ke=e.Ut=void 0;const r="statsig::config_exposure",l="statsig::gate_exposure",a="statsig::layer_exposure",c=(t,e,i,n,s)=>(i.bootstrapMetadata&&(n.bootstrapMetadata=i.bootstrapMetadata),{eventName:t,user:e,value:null,metadata:o(i,n),secondaryExposures:s,time:Date.now()});e.Ut=({eventName:t})=>t===l||t===r||t===a;function h(t,e){return t.map(t=>"string"==typeof t?(null!=e?e:{})[t]:t).filter(t=>null!=t)}e.Ke=(t,e,i)=>{var n,s={gate:e.name,gateValue:String(e.value),ruleID:e.ruleID};return null!=(null==(n=e.__evaluation)?void 0:n.version)&&(s.configVersion=e.__evaluation.version),c(l,t,e.details,s,h(null!=(t=null==(n=e.__evaluation)?void 0:n.secondary_exposures)?t:[],i))},e.qe=h;e.ze=(t,e,i)=>{var n,s={config:e.name,ruleID:e.ruleID};return null!=(null==(n=e.__evaluation)?void 0:n.version)&&(s.configVersion=e.__evaluation.version),null!=(null==(n=e.__evaluation)?void 0:n.passed)&&(s.rulePassed=String(e.__evaluation.passed)),c(r,t,e.details,s,h(null!=(t=null==(n=e.__evaluation)?void 0:n.secondary_exposures)?t:[],i))};e.Le=(t,e,i,n)=>{var s=e.__evaluation,r=!0===(null==(r=null==s?void 0:s.explicit_parameters)?void 0:r.includes(i));let l="",o=null!=(u=null==s?void 0:s.undelegated_secondary_exposures)?u:[];r&&(l=null!=(u=s.allocated_experiment_name)?u:"",o=null!=(u=s.secondary_exposures)?u:[]);var u=null==(s=e.__evaluation)?void 0:s.parameter_rule_ids,u={config:e.name,parameterName:i,ruleID:null!=(s=null==u?void 0:u[i])?s:e.ruleID,allocatedExperiment:l,isExplicitParameter:String(r)};return null!=(null==(i=e.__evaluation)?void 0:i.version)&&(u.configVersion=e.__evaluation.version),c(a,t,e.details,u,h(o,n))};const o=(t,e)=>(e.reason=t.reason,t.lcut&&(e.lcut=String(t.lcut)),t.receivedAt&&(e.receivedAt=String(t.receivedAt)),e)},8e3:(t,e)=>{$Q(e),e.StatsigMetadataProvider=e.SDK_VERSION=void 0,e.SDK_VERSION="3.30.0";let i={sdkVersion:e.SDK_VERSION,sdkType:"js-mono"};e.StatsigMetadataProvider={get:()=>i,add:t=>{i=$P($P({},i),t)}}},586:(t,e)=>{$Q(e),e.LoggingEnabledOption=e.LogEventCompressionMode=void 0,e.LogEventCompressionMode={Disabled:"d",Enabled:"e",Forced:"f"},e.LoggingEnabledOption={disabled:"disabled",browserOnly:"browser-only",always:"always"}},1098:(t,e)=>{$Q(e)},2059:(t,e,i)=>{$Q(e),e.Be=e.$e=e.Ve=e.Ge=e.Je=e.We=void 0;const l=i(7512),o=i(6634);function s(t,e,i,n){return{name:t,details:e,ruleID:null!=(t=null==i?void 0:i.rule_id)?t:"",__evaluation:i,value:n}}function n(t,e,i){var n=null!=(n=null==i?void 0:i.value)?n:{};return $P($P({},s(t,e,i,n)),{idType:null!=(e=null==i?void 0:i.id_type)?e:null,get:r(t,null==i?void 0:i.value)})}function r(n,s,r){return(t,e)=>{var i=null!=(i=null==s?void 0:s[t])?i:null;return null==i?null!=e?e:null:null==e||(0,o.Ye)(i,e)?(null!=r&&r(t),i):(l.Log.warn(`Parameter type mismatch. '${n}.${t}' was found to be type '${typeof i}' but fallback/return type is '${typeof e}'. See https://docs.statsig.com/client/javascript-sdk/#typed-getters`),null!=e?e:null)}}e.We=function(t,e,i){return $P($P({},s(t,e,i,!0===(null==i?void 0:i.value))),{idType:null!=(t=null==i?void 0:i.id_type)?t:null})},e.Je=n,e.Ge=function(t,e,i){return t=n(t,e,i),$P($P({},t),{groupName:null!=(e=null==i?void 0:i.group_name)?e:null})},e.Ve=function(t,e,i,n){return $P($P({},s(t,e,i,void 0)),{get:r(t,null==i?void 0:i.value,n),groupName:null!=(e=null==i?void 0:i.group_name)?e:null,__value:null!=(t=null==i?void 0:i.value)?t:{}})},e.$e=function(t,e,i,n){return $P($P($P({},t),e),{get:r(t.name,i,n)})},e.Be=r},1812:(t,e)=>{$Q(e)},3932:(t,e)=>{$Q(e),e.UPDATE_DETAIL_ERROR_MESSAGES=e.createUpdateDetails=void 0;e.createUpdateDetails=(t,e,i,n,s,r)=>({duration:i,source:e,success:t,error:n,sourceUrl:s,warnings:r}),e.UPDATE_DETAIL_ERROR_MESSAGES={NO_NETWORK_DATA:"No data was returned from the network. This may be due to a network timeout if a timeout value was specified in the options or ad blocker error."}},8578:(t,e,i)=>{$Q(e),e._=e.D=void 0;const n=i(1406),s=i(7512);e.D=function(t,e,i){try{var n=JSON.parse(JSON.stringify(t));return null!=e&&null!=e.environment?n.statsigEnvironment=e.environment:null!=i&&(n.statsigEnvironment={tier:i}),n}catch(t){return s.Log.error("Failed to JSON.stringify user"),{statsigEnvironment:void 0}}},e._=function(t){return t?(0,n.$t)(t):null}},4534:(t,i,e)=>{$Q2(i,"__esModule",{value:!0}),i.B=i.K=i.Storage=void 0;var n=e(7512),e=e(6830);const s={},r={isReady:()=>!0,isReadyResolver:()=>null,getProviderName:()=>"InMemory",getItem:t=>s[t]||null,setItem:(t,e)=>{s[t]=e},removeItem:t=>{delete s[t]},getAllKeys:()=>Object.keys(s)};let l=null;try{const c=(0,e.ve)();c&&c.localStorage&&"function"==typeof c.localStorage.getItem&&(l={isReady:()=>!0,isReadyResolver:()=>null,getProviderName:()=>"LocalStorage",getItem:t=>c.localStorage.getItem(t),setItem:(t,e)=>c.localStorage.setItem(t,e),removeItem:t=>c.localStorage.removeItem(t),getAllKeys:()=>Object.keys(c.localStorage)})}catch(t){n.Log.warn("Failed to setup localStorageProvider.")}let o=null!==l&&void 0!==l?l:r,u=o;function a(t){try{return t()}catch(t){if(t instanceof Error&&"SecurityError"===t.name)return i.Storage.Ne(r),null;throw t}}i.Storage={isReady:()=>u.isReady(),isReadyResolver:()=>u.isReadyResolver(),getProviderName:()=>u.getProviderName(),getItem:t=>a(()=>u.getItem(t)),setItem:(t,e)=>a(()=>u.setItem(t,e)),removeItem:t=>u.removeItem(t),getAllKeys:()=>u.getAllKeys(),Ne:t=>{o=t,u=t},Me:t=>{u=t?r:o}},i.K=function(t){return t=i.Storage.getItem(t),JSON.parse(null!=t?t:"null")},i.B=function(t,e){i.Storage.setItem(t,JSON.stringify(e))}},3401:(t,e,i)=>{$Q(e),e.P=void 0;const s=i(7512);e.P=function(t,e,i){try{var n=JSON.parse(t);if(n&&"object"==typeof n&&e in n)return n}catch(t){}return s.Log.error("Failed to parse "+i),null}},6634:(t,e)=>{$Q(e),e.Ye=e.Vt=void 0,e.Vt=function(t){return Array.isArray(t)?"array":typeof t},e.Ye=function(t,e){var i=t=>Array.isArray(t)?"array":null===t?"null":typeof t;return i(t)===i(e)}},8023:(t,e)=>{$Q(e),e.getUUID=void 0,e.getUUID=function(){if("undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID)return crypto.randomUUID();let i=(new Date).getTime(),n="undefined"!=typeof performance&&performance.now&&1e3*performance.now()||0;return`xxxxxxxx-xxxx-4xxx-${"89ab"[Math.floor(4*Math.random())]}xxx-xxxxxxxxxxxx`.replace(/[xy]/g,t=>{let e=16*Math.random();return 0<i?(e=(i+e)%16|0,i=Math.floor(i/16)):(e=(n+e)%16|0,n=Math.floor(n/16)),("x"===t?e:7&e|8).toString(16)})}},1881:(t,e,i)=>{$Q(e),e.UrlConfiguration=void 0;const n=i(1406),s=i(7410),r={[s.Endpoint.Qt]:"i",[s.Endpoint.kt]:"e",[s.Endpoint.Zt]:"d"};e.UrlConfiguration=class{constructor(t,e,i,n){this.customUrl=null,this.fallbackUrls=null,this.endpoint=t,this.endpointDnsKey=r[t],e&&(this.customUrl=e),!e&&i&&(this.customUrl=i.endsWith("/")?""+i+t:i+"/"+t),n&&(this.fallbackUrls=n);e=s.NetworkDefault[t];this.defaultUrl=e+"/"+t}getUrl(){var t;return null!=(t=this.customUrl)?t:this.defaultUrl}getChecksum(){var t=(null!=(t=this.fallbackUrls)?t:[]).sort().join(",");return(0,n.h)(this.customUrl+t)}}},2397:(t,e,i)=>{$Q(e),e.Xe=e.xt=e.Ft=e.He=void 0;i=i(6830);const n="foreground",s="background",r=[];let l=n,o=!1;e.He=()=>l===n,e.Ft=()=>o,e.xt=t=>{r.unshift(t)};e.Xe=e=>{e!==l&&(l=e,r.forEach(t=>t(e)))},(0,i.ke)("focus",()=>{(o=!1,e.Xe)(n)}),(0,i.ke)("blur",()=>(0,e.Xe)(s)),(0,i.we)("visibilitychange",()=>{(0,e.Xe)("visible"===document.visibilityState?n:s)}),(0,i.ke)((0,i.Se)(),()=>{o=!0,(0,e.Xe)(s)})},6914:function(t,e,i){var n=this&&this.__createBinding||(Object.create?function(t,e,i,n){void 0===n&&(n=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&("get"in s?e.__esModule:!s.writable&&!s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),$Q2(t,n,s)}:function(t,e,i,n){t[n=void 0===n?i:n]=e[i]}),s=this&&this.__exportStar||function(t,e){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(e,i)||n(e,t,i)},r=($Q(e),e.Storage=e.Log=e.EventLogger=e.Diagnostics=void 0,i(1845),i(1845));const l=i(8962),o=($Q2(e,"Diagnostics",{enumerable:!0,get:function(){return l.Diagnostics}}),i(7770)),u=($Q2(e,"EventLogger",{enumerable:!0,get:function(){return o.EventLogger}}),i(7512));$Q2(e,"Log",{enumerable:!0,get:function(){return u.Log}});var a=i(8e3);const c=i(4534);$Q2(e,"Storage",{enumerable:!0,get:function(){return c.Storage}}),s(i(1845),e),s(i(2137),e),s(i(6427),e),s(i(694),e),s(i(8962),e),s(i(3539),e),s(i(5542),e),s(i(2922),e),s(i(2417),e),s(i(1406),e),s(i(1333),e),s(i(7512),e),s(i(7787),e),s(i(7410),e),s(i(7023),e),s(i(1405),e),s(i(1361),e),s(i(6830),e),s(i(5902),e),s(i(4143),e),s(i(2176),e),s(i(9122),e),s(i(1375),e),s(i(2636),e),s(i(3206),e),s(i(1637),e),s(i(8e3),e),s(i(586),e),s(i(1098),e),s(i(2059),e),s(i(1812),e),s(i(8578),e),s(i(4534),e),s(i(3401),e),s(i(6634),e),s(i(1881),e),s(i(8023),e),s(i(2397),e),s(i(3932),e),s(i(3091),e),$P((0,r.l)(),{Log:u.Log,SDK_VERSION:a.SDK_VERSION})},9296:function(t,e,i){var n=this&&this.__createBinding||(Object.create?function(t,e,i,n){void 0===n&&(n=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&("get"in s?e.__esModule:!s.writable&&!s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),$Q2(t,n,s)}:function(t,e,i,n){t[n=void 0===n?i:n]=e[i]}),s=this&&this.__exportStar||function(t,e){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(e,i)||n(e,t,i)},r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}},r=($Q(e),r(i(2018)));s(i(2018),e),e.default=r.default},7262:(t,e,i)=>{$Q(e),e.Qe=void 0;const n=i(6914);function s(t,e){null!=t&&t.forEach(t=>{delete e[t]})}e.Qe=function(t,e){var i;return(e=(0,n.P)(e,"checksum","DeltasEvaluationResponse"))?(t=t,i=e,t=$P($P($P({},t),i),{feature_gates:$P($P({},t.feature_gates),i.feature_gates),layer_configs:$P($P({},t.layer_configs),i.layer_configs),dynamic_configs:$P($P({},t.dynamic_configs),i.dynamic_configs)}),s((t=i=t).deleted_gates,t.feature_gates),delete t.deleted_gates,s(i.deleted_configs,t.dynamic_configs),delete t.deleted_configs,s(i.deleted_layers,t.layer_configs),delete t.deleted_layers,i=t,(t=(0,n.$t)({feature_gates:i.feature_gates,dynamic_configs:i.dynamic_configs,layer_configs:i.layer_configs},2))===e.checksumV2?JSON.stringify(i):{hadBadDeltaChecksum:!0,badChecksum:t,badMergedConfigs:i,badFullResponse:e.deltas_full_response}):{hadBadDeltaChecksum:!0}}},4845:(t,e,i)=>{$Q(e);const s=i(6914),r=i(140),l=i(7095);e.default=class{constructor(t){this.j=t,this.Ze=null,this.ti=null,this.ei="Uninitialized",this.ii=0,this.ni=0,this.si=null,this.ri=new Set}reset(){this.ti=null,this.Ze=null,this.ei="Loading",this.ii=0,this.ni=0,this.si=null,this.ri.clear()}finalize(){this.ti||(this.ei="NoValues")}getValues(){return this.Ze?(0,s.P)(this.Ze,"has_updates","EvaluationStoreValues"):null}setValues(t,e){var i,n;return!!t&&null!=(n=(0,s.P)(t.data,"has_updates","EvaluationResponse"))&&(this.ei=t.source,!0!==(null==n?void 0:n.has_updates)||(null!=(i=n.time)?i:0)<this.ii||(this.Ze=t.data,this.ii=n.time,this.ni=t.receivedAt,"init-v2"===n.response_format?this.ti=new l.V2InitializeContainer(n):this.ti=new r.V1InitializeContainer(n),this.si=this.li(t.source,n),t.source&&n.user&&this.oi(e,n),s.SDKFlags.setFlags(this.j,null!=(i=n.sdk_flags)?i:{})),!0)}getWarnings(){if(0!==this.ri.size)return Array.from(this.ri)}getGate(t){t=this.ti?this.ti.getGate(t):null;return this.ui(t)}getConfig(t){t=this.ti?this.ti.getConfig(t):null;return this.ui(t)}getConfigList(){return this.ti?this.ti.getConfigList():[]}getLayer(t){t=this.ti?this.ti.getLayer(t):null;return this.ui(t)}getParamStore(t){t=this.ti?this.ti.getParamStore(t):null;return this.ui(t)}getSource(){return this.ei}getExposureMapping(){var t;return null==(t=this.ti)?void 0:t.getExposureMapping()}li(t,e){return"Bootstrap"!==t?null:(t={},e.user&&(t.user=e.user),e.sdkInfo&&(t.generatorSDKInfo=e.sdkInfo),t.lcut=e.time,t)}ui(t){return{result:t,details:this.ai(null==t)}}oi(t,e){var i,n=s.StableID.get(this.j);(null==(i=t.customIDs)?void 0:i.stableID)!==n&&(null!=(i=t.customIDs)&&i.stableID||n)?this.ri.add("StableIDMismatch"):"user"in e&&(i=e.user,n=$P($P({},t),{analyticsOnlyMetadata:void 0,privateAttributes:void 0}),(0,s._)(n)!==(0,s._)(i))&&this.ri.add("PartialUserMatch")}getCurrentSourceDetails(){var t;return"Uninitialized"===this.ei||"NoValues"===this.ei?{reason:this.ei}:(t={reason:this.ei,lcut:this.ii,receivedAt:this.ni},0<this.ri.size&&(t.warnings=Array.from(this.ri)),t)}ai(t){var e=this.getCurrentSourceDetails();let i=e.reason;var n=null!=(n=e.warnings)?n:[],t=("Bootstrap"===this.ei&&0<n.length&&(i+=n[0]),"Uninitialized"!==i&&"NoValues"!==i&&(i=i+":"+(t?"Unrecognized":"Recognized")),"Bootstrap"===this.ei&&null!=(n=this.si)?n:void 0);return t&&(e.bootstrapMetadata=t),$P($P({},e),{reason:i})}}},8448:function(t,e,i){var u=this&&this.__awaiter||$A();$Q(e);const a=i(6914),l=i(7262);class n extends a.NetworkCore{constructor(t,e){super(t,e);e=null==t?void 0:t.networkConfig;this.ci=t,this.hi=new a.UrlConfiguration(a.Endpoint.Qt,null==e?void 0:e.initializeUrl,null==e?void 0:e.api,null==e?void 0:e.initializeFallbackUrls)}fetchEvaluations(n,s,r,l,o){return u(this,void 0,void 0,function*(){var t,e=s?(0,a.P)(s,"has_updates","InitializeResponse"):null;let i={user:l,hash:null!=(t=null==(t=null==(t=this.ci)?void 0:t.networkConfig)?void 0:t.initializeHashAlgorithm)?t:"djb2",deltasResponseRequested:!1,full_checksum:null};return null!=e&&e.has_updates&&(t=(null==e?void 0:e.hash_used)!==(null!=(t=null==(t=null==(t=this.ci)?void 0:t.networkConfig)?void 0:t.initializeHashAlgorithm)?t:"djb2"),i=$P($P({},i),{sinceTime:o&&!t?e.time:0,previousDerivedFields:"derived_fields"in e&&o?e.derived_fields:{},deltasResponseRequested:!0,full_checksum:e.full_checksum,partialUserMatchSinceTime:t?0:e.time})),this.di(n,e,i,r)})}di(i,n,s,r){return u(this,void 0,void 0,function*(){var t,e=yield this.post({sdkKey:i,urlConfig:this.hi,data:s,retries:2,isStatsigEncodable:!0,priority:r});return 204===(null==e?void 0:e.code)?'{"has_updates": false}':200!==(null==e?void 0:e.code)?null!=(t=null==e?void 0:e.body)?t:null:!0!==(null==n?void 0:n.has_updates)||!0!==(null==(t=e.body)?void 0:t.includes('"is_delta":true'))||!0!==s.deltasResponseRequested?e.body:"string"==typeof(t=(0,l.Qe)(n,e.body))?t:this.di(i,n,$P($P($P({},s),t),{deltasResponseRequested:!1}),r)})}}e.default=n},3583:(t,e,i)=>{$Q(e),e.vi=void 0;const d=i(6914),v={disableExposureLog:!0};function f(t){return null==t||!1===t.disableExposureLog}function _(t,e){return null!=e&&!(0,d.Ye)(t,e)}e.vi=function(a,c,h){return(t,e)=>{if(null==c)return e;var i,n,s,r,l,o,u=c[t];if(null==u||null!=e&&(0,d.Vt)(e)!==u.param_type)return e;switch(u.ref_type){case"static":return u.value;case"gate":return o=u,a.getFeatureGate(o.gate_name,f(h)?void 0:v).value?o.pass_value:o.fail_value;case"dynamic_config":return o=u,l=e,_(r=(r=a).getDynamicConfig(o.config_name,f(h)?void 0:v).get(o.param_name),l)?l:r;case"experiment":return l=u,r=e,_(s=(s=a).getExperiment(l.experiment_name,f(h)?void 0:v).get(l.param_name),r)?r:s;case"layer":return s=u,n=e,_(i=(i=a).getLayer(s.layer_name,f(h)?void 0:v).get(s.param_name),n)?n:i;default:return e}}}},8198:function(t,e,i){var r=this&&this.__awaiter||$A();$Q(e);const l=i(6914),o=i(4845),u=i(8448),s=i(3583),a=i(4131);class n extends l.StatsigClientBase{static instance(t){var e=(0,l.l)().instance(t);return e instanceof n?e:(l.Log.warn((0,l.Mt)()?"StatsigClient.instance is not supported in server environments":"Unable to find StatsigClient instance"),new n(null!=t?t:"",{}))}constructor(t,e,i=null){l.SDKType.Oe(t,"javascript-client");var n,s=new u.default(i,t=>{this.$emt(t)}),t=(super(t,null!=(n=null==i?void 0:i.dataAdapter)?n:new a.StatsigEvaluationsDataAdapter,s,i),this.fi={},this.getFeatureGate=this.Pe(l.MemoPrefix.Gt,this.gi.bind(this)),this.getDynamicConfig=this.Pe(l.MemoPrefix.Jt,this._i.bind(this)),this.getExperiment=this.Pe(l.MemoPrefix.Wt,this.pi.bind(this)),this.getConfigList=this.Pe(l.MemoPrefix.Yt,this.bi.bind(this)),this.getLayer=this.Pe(l.MemoPrefix.Xt,this.yi.bind(this)),this.getParameterStore=this.Pe(l.MemoPrefix.Ht,this.mi.bind(this)),this.Oi=new o.default(t),this.ft=s,this.ji=this.Si(e,i),this.wi=(0,l.getUUID)(),null!=(n=null==i?void 0:i.plugins)?n:[]);for(const r of t)r.bind(this)}initializeSync(t){var e;return"Uninitialized"!==this.loadingStatus?(0,l.createUpdateDetails)(!0,this.Oi.getSource(),-1,null,null,["MultipleInitializations",...null!=(e=this.Oi.getWarnings())?e:[]]):(this.Re.start(),this.updateUserSync(this.ji,t))}initializeAsync(t){return r(this,void 0,void 0,function*(){return this.xe||(this.xe=this.ki(t)),this.xe})}updateUserSync(e,t){var i=performance.now();try{return this.Ei(e,t,i)}catch(t){e=t instanceof Error?t:new Error(String(t));return this.Di(e,i)}}Ei(t,e,i){var n=[...null!=(n=this.Oi.getWarnings())?n:[]],t=(this.Ii(t),this.dataAdapter.getDataSync(this.ji)),e=(null==t&&n.push("NoCachedValues"),this.Oi.setValues(t,this.ji),this.Mi(t),null==e?void 0:e.disableBackgroundCacheRefresh);return!0===e||null==e&&"Bootstrap"===(null==t?void 0:t.source)||this.xi(null!=t?t:null,this.ji),(0,l.createUpdateDetails)(!0,this.Oi.getSource(),performance.now()-i,this.te.getLastSeenErrorAndReset(),this.ft.getLastUsedInitUrlAndReset(),n)}updateUserAsync(t,n){return r(this,void 0,void 0,function*(){var e=performance.now();try{return yield this.Ti(t,n)}catch(t){var i=t instanceof Error?t:new Error(String(t));return this.Di(i,e)}})}Ti(n,s){return r(this,void 0,void 0,function*(){this.Ii(n);var t=this.ji,e=(l.Diagnostics.G(this.j),this.dataAdapter.getDataSync(t));if(this.Oi.setValues(e,this.ji),this.Ae("Loading",e),e=yield this.dataAdapter.getDataAsync(e,t,s),t!==this.ji)return(0,l.createUpdateDetails)(!1,this.Oi.getSource(),-1,new Error("User changed during update"),this.ft.getLastUsedInitUrlAndReset());let i=!1;null!=e&&(l.Diagnostics.X(this.j),i=this.Oi.setValues(e,this.ji),l.Diagnostics.H(this.j,{success:i})),this.Mi(e),i||(this.te.attachErrorIfNoneExists(l.UPDATE_DETAIL_ERROR_MESSAGES.NO_NETWORK_DATA),this.$emt({name:"initialization_failure"})),l.Diagnostics.J(this.j,i,this.Oi.getCurrentSourceDetails());t=l.Diagnostics.it(this.ji,this.Re,this.j,this.O);return(0,l.createUpdateDetails)(i,this.Oi.getSource(),t,this.te.getLastSeenErrorAndReset(),this.ft.getLastUsedInitUrlAndReset(),this.Oi.getWarnings())})}getContext(){return{sdkKey:this.j,options:this.O,values:this.Oi.getValues(),user:JSON.parse(JSON.stringify(this.ji)),errorBoundary:this.te,session:l.StatsigSession.get(this.j),stableID:l.StableID.get(this.j),sdkInstanceID:this.wi}}checkGate(t,e){return this.getFeatureGate(t,e).value}logEvent(t,e,i){e="string"==typeof t?{eventName:t,value:e,metadata:i}:t;this.$emt({name:"log_event_called",event:e}),this.Re.enqueue($P($P({},e),{user:this.ji,time:Date.now()}))}updateUserWithAnalyticsOnlyMetadata(t){this.ji=this.Si($P($P({},this.ji),{analyticsOnlyMetadata:t}),this.O)}Ue(){this.$on("error",()=>{"Loading"===this.loadingStatus&&this.Mi(null)})}ki(t){return r(this,void 0,void 0,function*(){return l.Storage.isReady()||(yield l.Storage.isReadyResolver()),this.Re.start(),this.updateUserAsync(this.ji,t)})}Di(t,e){return(0,l.createUpdateDetails)(!1,this.Oi.getSource(),performance.now()-e,t,null,[...null!=(e=this.Oi.getWarnings())?e:[]])}Mi(t){this.Oi.finalize(),this.Ae("Ready",t)}xi(t,e){this.dataAdapter.getDataAsync(t,e,{priority:"low"}).catch(t=>{l.Log.error("An error occurred after update.",t)})}Ii(t){this.Re.reset(),this.Oi.reset(),this.ji=this.Si(t,this.O)}Si(t,e){var i,t=(0,l.D)(t,e);const n=null==(e=t.customIDs)?void 0:e.stableID;return n&&((i=null==(i=(e=this.storageProvider).isReadyResolver)?void 0:i.call(e))?i.then(()=>l.StableID.setOverride(n,this.j),()=>l.StableID.setOverride(n,this.j)):l.StableID.setOverride(n,this.j)),0<Object.keys(this.fi).length&&(t.analyticsOnlyMetadata=$P($P({},t.analyticsOnlyMetadata),this.fi)),t}gi(t,e){var{result:i,details:n}=this.Oi.getGate(t),n=(0,l.We)(t,n,i),s=null==(s=null==(i=this.overrideAdapter)?void 0:i.getGateOverride)?void 0:s.call(i,n,this.ji,e),i=null!=s?s:n;return this.Fe(t,(0,l.Ke)(this.ji,i,this.Oi.getExposureMapping()),e),this.$emt({name:"gate_evaluation",gate:i}),i}_i(t,e){var{result:i,details:n}=this.Oi.getConfig(t),n=(0,l.Je)(t,n,i),s=null==(s=null==(i=this.overrideAdapter)?void 0:i.getDynamicConfigOverride)?void 0:s.call(i,n,this.ji,e),i=null!=s?s:n;return this.Fe(t,(0,l.ze)(this.ji,i,this.Oi.getExposureMapping()),e),this.$emt({name:"dynamic_config_evaluation",dynamicConfig:i}),i}pi(t,e){var{result:i,details:n}=this.Oi.getConfig(t),n=(0,l.Ge)(t,n,i),s=(null!=n.__evaluation&&(n.__evaluation.secondary_exposures=(0,l.qe)(null!=(i=null==(i=n.__evaluation)?void 0:i.secondary_exposures)?i:[],this.Oi.getExposureMapping())),null==(s=null==(i=this.overrideAdapter)?void 0:i.getExperimentOverride)?void 0:s.call(i,n,this.ji,e)),i=null!=s?s:n;return this.Fe(t,(0,l.ze)(this.ji,i,this.Oi.getExposureMapping()),e),this.$emt({name:"experiment_evaluation",experiment:i}),i}bi(){return this.Oi.getConfigList()}yi(e,i){var{result:t,details:n}=this.Oi.getLayer(e),n=(0,l.Ve)(e,n,t),s=null==(s=null==(t=this.overrideAdapter)?void 0:t.getLayerOverride)?void 0:s.call(t,n,this.ji,i);null!=i&&i.disableExposureLog&&this.Re.incrementNonExposureCount(e);const r=(0,l.$e)(n,s,null!=(t=null==s?void 0:s.__value)?t:n.__value,t=>{null!=i&&i.disableExposureLog||this.Fe(e,(0,l.Le)(this.ji,r,t,this.Oi.getExposureMapping()),i)});return this.$emt({name:"layer_evaluation",layer:r}),r}mi(t,e){var{result:i,details:n}=this.Oi.getParamStore(t),t=(this.Re.incrementNonExposureCount(t),{name:t,details:n,__configuration:i,get:(0,s.vi)(this,i,e)}),i=null==(i=null==(n=this.overrideAdapter)?void 0:n.getParamStoreOverride)?void 0:i.call(n,t,e);return null!=i&&(t.__configuration=i.config,t.details=i.details,t.get=(0,s.vi)(this,i.config,e)),t}}e.default=n},4131:function(t,e,i){var r=this&&this.__awaiter||$A();$Q(e),e.StatsigEvaluationsDataAdapter=void 0;const n=i(6914),s=i(8448);class l extends n.DataAdapterCore{constructor(){super("EvaluationsDataAdapter","evaluations"),this.ft=null,this.O=null}attach(t,e,i){super.attach(t,e,i),null!==i&&i instanceof s.default?this.ft=i:this.ft=new s.default(null!=e?e:{})}getDataAsync(t,e,i){return this.C(t,(0,n.D)(e,this.O),i)}prefetchData(t,e){return this.U(t,e)}setData(t){var e=(0,n.P)(t,"has_updates","data");e&&"user"in e?super.setData(t,e.user):n.Log.error("StatsigUser not found. You may be using an older server SDK version. Please upgrade your SDK or use setDataLegacy.")}setDataLegacy(t,e){super.setData(t,e)}F(e,i,n,s){return r(this,void 0,void 0,function*(){var t=yield null==(t=this.ft)?void 0:t.fetchEvaluations(this.N(),e,null==n?void 0:n.priority,i,s);return null!=t?t:null})}I(t){t=(0,n.o)(this.N(),t,null==(t=this.O)?void 0:t.customUserCacheKeyFunc);return`${n.DataAdapterCachePrefix}.${this.m}.`+t}A(t,e){return null!=t.fullUserHash&&t.fullUserHash===(0,n._)(e)}}e.StatsigEvaluationsDataAdapter=l},140:(t,e,i)=>{$Q(e),e.V1InitializeContainer=void 0;const n=i(6914);e.V1InitializeContainer=class{constructor(t){this.ti=t}getGate(t){return this.Ni(this.ti.feature_gates,t)}getConfig(t){return this.Ni(this.ti.dynamic_configs,t)}getLayer(t){return this.Ni(this.ti.layer_configs,t)}getParamStore(t){return this.Ni(this.ti.param_stores,t)}getConfigList(){return Object.keys(this.ti.dynamic_configs)}getExposureMapping(){return this.ti.exposures}Ni(t,e){var i;return t&&null!=(i=null!=(i=t[e])?i:t[(0,n.h)(e)])?i:null}}},7095:(t,e,i)=>{$Q(e),e.V2InitializeContainer=void 0;const n=i(6914);e.V2InitializeContainer=class{constructor(t){this.ti=t}getGate(t){var e=this.Ni(this.ti.feature_gates,t);return e?{name:t,value:!0===e.v,rule_id:null!=(t=e.r)?t:"default",secondary_exposures:null!=(t=e.s)?t:[],id_type:null!=(t=e.i)?t:""}:null}getConfig(t){var e=this.Ni(this.ti.dynamic_configs,t);return e?{name:t,value:null!=(t=this.ti.values[e.v])?t:{},rule_id:e.r,secondary_exposures:null!=(t=e.s)?t:[],id_type:null!=(t=e.i)?t:"",is_user_in_experiment:!0===e.ue,passed:!0===e.p,group_name:null!=(t=e.gn)?t:void 0,is_experiment_active:!0===e.ea,group:e.r,is_device_based:"stableID"===e.i}:null}getLayer(t){var e=this.Ni(this.ti.layer_configs,t);return e?{name:t,value:null!=(t=this.ti.values[e.v])?t:{},rule_id:e.r,secondary_exposures:null!=(t=e.s)?t:[],is_user_in_experiment:!0===e.ue,group_name:null!=(t=e.gn)?t:void 0,is_experiment_active:!0===e.ea,group:e.r,is_device_based:"stableID"===e.i,allocated_experiment_name:null!=(t=e.ae)?t:"",explicit_parameters:null!=(t=e.ep)?t:[],undelegated_secondary_exposures:null!=(t=e.us)?t:[],parameter_rule_ids:e.pr}:null}getParamStore(t){return this.Ni(this.ti.param_stores,t)}getConfigList(){return Object.keys(this.ti.dynamic_configs)}getExposureMapping(){return this.ti.exposures}Ni(t,e){var i;return t&&null!=(i=null!=(i=t[e])?i:t[(0,n.h)(e)])?i:null}}},2018:function(t,e,i){var n=this&&this.__createBinding||(Object.create?function(t,e,i,n){void 0===n&&(n=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&("get"in s?e.__esModule:!s.writable&&!s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),$Q2(t,n,s)}:function(t,e,i,n){t[n=void 0===n?i:n]=e[i]}),s=this&&this.__exportStar||function(t,e){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(e,i)||n(e,t,i)},r=($Q(e),e.StatsigClient=void 0,i(6914)),l=i(8198),s=(e.StatsigClient=l.default,s(i(6914),e),$P((0,r.l)(),{StatsigClient:l.default}));e.default=s}},n={};function s(t){var e=n[t];return void 0!==e||(e=n[t]={exports:{}},i[t].call(e.exports,e,e.exports,s)),e.exports}return s.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),s(9296).default})());
|
|
1
|
+
var $Q=(e)=>Object.defineProperty(e,"__esModule",{value:!0});var $Q2=(a,b,c)=>Object.defineProperty(a,b,c);var $P=(a,b)=>Object.assign(a,b);var $A=()=>((t,r,u,l)=>{return new(u=u||Promise)(function(n,e){function i(t){try{s(l.next(t))}catch(t){e(t)}}function o(t){try{s(l.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}s((l=l.apply(t,r||[])).next())})});!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Statsig=e():t.Statsig=e()}(this,()=>(()=>{"use strict";var i={1845:(t,i,e)=>{var n;$Q2(i,"__esModule",{value:!0}),i.t=i.i=i.l=void 0;const s=e(7512);i.l=()=>{try{return"undefined"!=typeof __STATSIG__?__STATSIG__:u}catch(t){return u}},i.i=t=>(0,i.l)()[t];i.t=t=>{var e=(0,i.l)();return t?e.instances&&e.instances[t]:(e.instances&&1<Object.keys(e.instances).length&&s.Log.warn("Call made to Statsig global instance without an SDK key but there is more than one client instance. If you are using mulitple clients, please specify the SDK key."),e.firstInstance)};var r="__STATSIG__",l="undefined"!=typeof window?window:{},e=void 0!==e.g?e.g:{},o="undefined"!=typeof globalThis?globalThis:{};const u=null!=(n=null!=(n=null!=(n=l[r])?n:e[r])?n:o[r])?n:{instance:i.t};l[r]=u,e[r]=u,o[r]=u},2137:(t,e,i)=>{$Q(e),e.o=e.u=void 0;const s=i(1406);function n(t,e,i){if(i)return i(t,e);const n=e&&e.customIDs?e.customIDs:{};e=["uid:"+(null!=(i=null==e?void 0:e.userID)?i:""),"cids:"+Object.keys(n).sort((t,e)=>t.localeCompare(e)).map(t=>t+"-"+n[t]).join(","),"k:"+t];return(0,s.h)(e.join("|"))}e.u=n,e.o=function(t,e,i){return e?n(t,e,i):(0,s.h)("k:"+t)}},6427:(t,e)=>{$Q(e)},694:function(t,e,i){var s=this&&this.__awaiter||$A();$Q(e),e.v=e.DataAdapterCore=void 0;const u=i(7512),a=i(9122),r=i(8578),l=i(4534),c=i(3401);function h(t,e,i,n){return{source:t,data:e,receivedAt:Date.now(),stableID:i,fullUserHash:(0,r._)(n)}}e.DataAdapterCore=class{constructor(t,e){this.p=t,this.m=e,this.O=null,this.j=null,this.gn=10,this.S="statsig.last_modified_time."+e,this.k=new n}attach(t,e,i){this.j=t,this.O=e}getDataSync(t){var t=t&&(0,r.D)(t,this.O),e=this.I(t),i=this.k.get(e,t);return i&&this.M(i)?i:(i=this.T(e))&&this.M(i)?(this.k.add(e,i,this.gn),this.k.get(e,t)):null}setData(t,e){var e=e&&(0,r.D)(e,this.O),i=this.I(e);this.k.add(i,h("Bootstrap",t,null,e),this.gn)}M(t){return null==t.stableID||t.stableID===a.StableID.get(this.N())}C(e,i,n){return s(this,void 0,void 0,function*(){l.Storage.isReady()||(yield l.Storage.isReadyResolver());var t=null!=e?e:this.getDataSync(i),t=[this.R(t,i,n)];return null!=n&&n.timeoutMs&&t.push(new Promise(t=>setTimeout(t,n.timeoutMs)).then(()=>(u.Log.debug("Fetching latest value timed out"),null))),yield Promise.race(t)})}U(i,n){return s(this,void 0,void 0,function*(){var t=i&&(0,r.D)(i,this.O),e=this.I(t),t=yield this.C(null,t,n);t&&this.k.add(e,$P($P({},t),{source:"Prefetch"}),this.gn)})}R(r,l,o){return s(this,void 0,void 0,function*(){var t=null!=(t=null==r?void 0:r.data)?t:null,e=null!=r&&this.A(r,l),e=yield this.F(t,l,o,e);if(!e)return u.Log.debug("No response returned for latest value"),null;var i=(0,c.P)(e,"has_updates","Response"),n=this.N(),n=a.StableID.get(n);let s=null;if(!0===(null==i?void 0:i.has_updates))s=h("Network",e,n,l);else{if(!t||!1!==(null==i?void 0:i.has_updates))return null;s=h("NetworkNotModified",t,n,l)}e=this.I(l);return this.k.add(e,s,this.gn),this.L(e,s),s})}N(){return null!=this.j?this.j:(u.Log.error(this.p+" is not attached to a Client"),"")}T(t){var e=null==(e=l.Storage.getItem)?void 0:e.call(l.Storage,t);return null!=e&&(t=(0,c.P)(e,"source","Cached Result"))?$P($P({},t),{source:"Cache"}):null}L(e,t){var i=JSON.stringify(t);for(let t=0;t<8;t++)try{l.Storage.setItem(e,i);break}catch(t){if(!(t instanceof Error)||!t.toString().includes("QuotaExceededError")&&!t.toString().includes("QUOTA_EXCEEDED_ERR")||this.gn<=1)throw t;this.gn=Math.ceil(this.gn/2),this.q(e,this.gn-1)}this.q(e)}q(t,e=this.gn){var i=null!=(n=(0,l.K)(this.S))?n:{},n=(i[t]=Date.now(),o(i,e));for(const s of n)delete i[s],l.Storage.removeItem(s);(0,l.B)(this.S,i)}},e.v=h;class n{constructor(){this.$={}}get(t,e){var t=this.$[t],i=null==t?void 0:t.stableID,e=null==(e=null==e?void 0:e.customIDs)?void 0:e.stableID;return e&&i&&e!==i?(u.Log.warn("'StatsigUser.customIDs.stableID' mismatch"),null):t}add(t,e,i){for(const n of o(this.$,i-1))delete this.$[n];this.$[t]=e}merge(t){this.$=$P($P({},this.$),t)}}function o(i,t){var e=Object.keys(i);return e.length<=t?[]:0===t?e:e.sort((t,e)=>{t=i[t],e=i[e];return"object"==typeof t&&"object"==typeof e?t.receivedAt-e.receivedAt:t-e}).slice(0,e.length-t)}},8962:(t,l)=>{$Q2(l,"__esModule",{value:!0}),l.Diagnostics=void 0;const n=new Map,i="start";function s(t,e,i,n){return $P({key:i,action:e,step:n,timestamp:Date.now()},t)}function r(t,e){var i=null!=(i=n.get(t))?i:[];i.push(e),n.set(t,i)}function e(t,e){if(e in t)return t[e]}l.Diagnostics={V:t=>n.get(t),G:t=>{r(t,s({},i,"overall"))},J:(t,e,i)=>{r(t,s({success:e,error:e?void 0:{name:"InitializeError",message:"Failed to initialize"},evaluationDetails:i},"end","overall"))},W:(t,e)=>{r(t,s(e,i,"initialize","network_request"))},Y:(t,e)=>{r(t,s(e,"end","initialize","network_request"))},X:t=>{r(t,s({},i,"initialize","process"))},H:(t,e)=>{r(t,s(e,"end","initialize","process"))},Z:t=>{n.delete(t)},tt(t){if(t&&"object"==typeof t)return{code:e(t,"code"),name:e(t,"name"),message:e(t,"message")}},et(t,e,i,n){return{success:!0===(null==t?void 0:t.ok),statusCode:null==t?void 0:t.status,sdkRegion:null==(t=null==t?void 0:t.headers)?void 0:t.get("x-statsig-region"),isDelta:!0===i.includes('"is_delta":true')||void 0,attempt:e,error:l.Diagnostics.tt(n)}},it(t,e,i,n){var s,r=l.Diagnostics.V(i);return null==r||r.length<=0?-1:(s=r[r.length-1].timestamp-r[0].timestamp,l.Diagnostics.Z(i),i=function(t,e){t={eventName:"statsig::diagnostics",user:t,value:null,metadata:e,time:Date.now()};return t}(t,{context:"initialize",markers:r.slice(),statsigOptions:n}),e.enqueue(i),s)}}},8809:function(t,e){var i=this&&this.__awaiter||$A();$Q(e),e.nt=void 0;const s=new Uint8Array([0,0,1,0,0,1,0,0,0,0,0,0,13,102,101,97,116,117,114,101,97,115,115,101,116,115,3,111,114,103,0,0,16,0,1]),r="https://cloudflare-dns.com/dns-query",l=["i","e","d"],o=200;e.nt=function(e){return i(this,void 0,void 0,function*(){var i=yield e(r,{method:"POST",headers:{"Content-Type":"application/dns-message",Accept:"application/dns-message"},body:s});if(i.ok){var t,i=yield i.arrayBuffer(),i=new Uint8Array(i);{var n=i,i=n.findIndex((t,e)=>e<o&&"="===String.fromCharCode(t)&&l.includes(String.fromCharCode(n[e-1])));if(-1===i)throw(t=new Error("Failed to parse TXT records from DNS")).name="DnsTxtParseError",t;let e="";for(let t=i-1;t<n.length;t++)e+=String.fromCharCode(n[t]);return e.split(",")}}throw(t=new Error("Failed to fetch TXT records from DNS")).name="DnsTxtFetchError",t})}},3539:(t,e)=>{$Q(e)},5542:function(t,o,e){var i=this&&this.__awaiter||$A();$Q2(o,"__esModule",{value:!0}),o.ErrorBoundary=o.EXCEPTION_ENDPOINT=void 0;const n=e(7512),u=e(5902),a=e(8e3),c=(o.EXCEPTION_ENDPOINT="https://statsigapi.net/v1/sdk_exception","[Statsig] UnknownError");function h(t){return t instanceof Error?t:"string"==typeof t?new Error(t):new Error("An unknown error occurred.")}o.ErrorBoundary=class{constructor(t,e,i,n){this.j=t,this.O=e,this.st=i,this.rt=n,this.lt=new Set}wrap(n,s){try{const t=n;!function(t){const e=new Set;let i=Object.getPrototypeOf(t);for(;i&&i!==Object.prototype;)Object.getOwnPropertyNames(i).filter(t=>"function"==typeof(null===i||void 0===i?void 0:i[t])).forEach(t=>e.add(t)),i=Object.getPrototypeOf(i);return Array.from(e)}(t).forEach(e=>{const i=t[e];"$EB"in i||(t[e]=(...t)=>this.ot(s?s+":"+e:e,()=>i.apply(n,t)),t[e].$EB=!0)})}catch(t){this.ut("eb:wrap",t)}}logError(t,e){this.ut(t,e)}getLastSeenErrorAndReset(){var t=this.rt;return this.rt=void 0,null!=t?t:null}attachErrorIfNoneExists(t){this.rt||(this.rt=h(t))}ot(e,t){try{var i=t();return i&&i instanceof Promise?i.catch(t=>this.ut(e,t)):i}catch(t){return this.ut(e,t),null}}ut(r,l){try{n.Log.warn("Caught error in "+r,{error:l});i(this,void 0,void 0,function*(){var t,e=l||Error(c),i=e instanceof Error,n=i?e.name:"No Name",s=h(e);this.rt=s,this.lt.has(n)||(this.lt.add(n),null!=(s=null==(s=this.O)?void 0:s.networkConfig)&&s.preventAllNetworkTraffic?null!=(s=this.st)&&s.call(this,{name:"error",error:l,tag:r}):(s=u.SDKType.ct(this.j),t=a.StatsigMetadataProvider.get(),i=i?e.stack:function(t){try{return JSON.stringify(t)}catch(t){return c}}(e),e=$P({tag:r,exception:n,info:i,statsigOptions:function(n){if(!n)return{};const s={};return Object.keys(n).forEach(t=>{var e=t,i=n[e];switch(typeof i){case"number":case"bigint":case"boolean":s[String(e)]=i;break;case"string":i.length<50?s[String(e)]=i:s[String(e)]="set";break;case"object":"environment"===e?s.environment=i:"networkConfig"===e?s.networkConfig=i:s[String(e)]=null!=i?"set":"unset"}}),s}(this.O)},$P($P({},t),{sdkType:s})),yield(null!=(n=null==(i=null==(n=this.O)?void 0:n.networkConfig)?void 0:i.networkOverrideFunc)?n:fetch)(o.EXCEPTION_ENDPOINT,{method:"POST",headers:{"STATSIG-API-KEY":this.j,"STATSIG-SDK-TYPE":String(s),"STATSIG-SDK-VERSION":String(t.sdkVersion),"Content-Type":"application/json"},body:JSON.stringify(e)}),null!=(i=this.st)&&i.call(this,{name:"error",error:l,tag:r})))}).then(()=>{}).catch(()=>{})}catch(t){}}}},2922:(t,e)=>{$Q(e)},2417:(t,e)=>{$Q(e)},7770:function(t,e,i){var n=this&&this.__awaiter||$A();$Q(e),e.EventLogger=void 0;const s=i(2137),r=i(1406),l=i(7512),o=i(7410),u=i(6830),a=i(1637),c=i(586),h=i(4534),d=i(1881),v=i(2397),f={};class _{static ht(t){null!=(t=f[t])&&t.flush().catch(()=>{})}static dt(t){null!=(t=f[t])&&t.vt()}constructor(t,e,i,n){this.j=t,this.st=e,this.ft=i,this.O=n,this.gt=[],this._t={},this.bt={},this.yt=!1,this.Ot=Date.now(),this.jt=null!=(t=null==n?void 0:n.loggingEnabled)?t:!0===(null==n?void 0:n.disableLogging)?c.LoggingEnabledOption.disabled:c.LoggingEnabledOption.browserOnly,null!=n&&n.loggingEnabled&&void 0!==n.disableLogging&&l.Log.warn("Detected both loggingEnabled and disableLogging options. loggingEnabled takes precedence - please remove disableLogging."),this.St=null!=(e=null==n?void 0:n.loggingBufferMaxSize)?e:100;i=null==n?void 0:n.networkConfig;this.wt=new d.UrlConfiguration(o.Endpoint.kt,null==i?void 0:i.logEventUrl,null==i?void 0:i.api,null==i?void 0:i.logEventFallbackUrls)}setLogEventCompressionMode(t){this.ft.setLogEventCompressionMode(t)}setLoggingEnabled(t){var e,i;"disabled"===this.jt&&"disabled"!==t&&(e=this.o(),(i=(0,h.K)(e))&&this.gt.push(...i),h.Storage.removeItem(e)),this.jt=t}enqueue(t){this.Et(t)&&(this.Dt(t),this.It(),this.gt.length>this.St)&&_.ht(this.j)}incrementNonExposureCount(t){var e=null!=(e=this.bt[t])?e:0;this.bt[t]=e+1}reset(){this.flush().catch(()=>{}),this._t={}}start(){var t,e=(0,u.Mt)();e&&"always"!==(null==(t=this.O)?void 0:t.loggingEnabled)||(f[this.j]=this,e||(0,v.xt)(t=>{"background"===t?_.ht(this.j):"foreground"===t&&_.dt(this.j)}),this.vt(),this.Tt())}stop(){return n(this,void 0,void 0,function*(){this.Nt&&(clearInterval(this.Nt),this.Nt=null),delete f[this.j],yield this.flush()})}flush(){return n(this,void 0,void 0,function*(){var t;this.Ct(),0!==this.gt.length&&(t=this.gt,this.gt=[],yield this.Rt(t))})}It(){this.yt||(this.yt=!0,200<Date.now()-this.Ot)||setTimeout(()=>_.ht(this.j),200)}Et(t){if("always"!==(null==(e=this.O)?void 0:e.loggingEnabled)&&(0,u.Mt)())return!1;if((0,a.Ut)(t)){var e=t.user||{statsigEnvironment:void 0},e=(0,s.u)(this.j,e),i=t.metadata||{},t=[t.eventName,e,i.gate,i.config,i.ruleID,i.allocatedExperiment,i.parameterName,String(i.isExplicitParameter),i.reason].join("|"),e=this._t[t],i=Date.now();if(e&&i-e<6e5)return!1;1e3<Object.keys(this._t).length&&(this._t={}),this._t[t]=i}return!0}Rt(s){return n(this,void 0,void 0,function*(){var t,e;if("disabled"===this.jt)return this.At(s),!1;try{var i=(0,v.Ft)()&&this.ft.isBeaconSupported()&&null==(null==(e=null==(t=this.O)?void 0:t.networkConfig)?void 0:e.networkOverrideFunc),n=(this.st({name:"pre_logs_flushed",events:s}),i?this.Pt(s):yield this.Lt(s));return n.success?(this.st({name:"logs_flushed",events:s}),!0):(l.Log.warn("Failed to flush events."),this.At(s),!1)}catch(t){return l.Log.warn("Failed to flush events."),!1}})}Lt(e){return n(this,void 0,void 0,function*(){var t=yield this.ft.post(this.zt(e)),t=null!=(t=null==t?void 0:t.code)?t:-1;return{success:200<=t&&t<300}})}Pt(t){return{success:this.ft.beacon(this.zt(t))}}zt(t){return{sdkKey:this.j,data:{events:t},urlConfig:this.wt,retries:3,isCompressable:!0,params:{[o.NetworkParam.EventCount]:String(t.length)},credentials:"same-origin"}}At(t){for(;500<t.length;)t.shift();var e=this.o();try{var i=this.pn(e);(0,h.B)(e,[...i,...t])}catch(t){l.Log.warn("Unable to save failed logs to storage")}}pn(t){let e=[];try{var i=(0,h.K)(t);return e=Array.isArray(i)?i:e}catch(t){return[]}}vt(){const e=this.o();n(this,void 0,void 0,function*(){h.Storage.isReady()||(yield h.Storage.isReadyResolver());var t=(0,h.K)(e);t&&(h.Storage.removeItem(e),yield this.Rt(t))}).catch(()=>{l.Log.warn("Failed to flush stored logs")})}o(){return"statsig.failed_logs."+(0,r.h)(this.j)}Dt(t){t.user&&(t.user=$P({},t.user),delete t.user.privateAttributes);var e={},i=this.qt(),i=(i&&(e.statsigMetadata={currentPage:i}),$P($P({},t),e));l.Log.debug("Enqueued Event:",i),this.gt.push(i)}Ct(){0!==Object.keys(this.bt).length&&(this.Dt({eventName:"statsig::non_exposed_checks",user:null,time:Date.now(),metadata:{checks:$P({},this.bt)}}),this.bt={})}qt(){var t;if(!1!==(null==(t=this.O)?void 0:t.includeCurrentPageUrlWithEvents))return(0,u.Kt)()}Tt(){var t=null!=(t=null==(t=this.O)?void 0:t.loggingIntervalMs)?t:1e4;const e=setInterval(()=>{var t=f[this.j];t&&t.Nt===e?_.ht(this.j):clearInterval(e)},t);this.Nt=e}}e.EventLogger=_},1406:(t,r,e)=>{$Q2(r,"__esModule",{value:!0}),r.Bt=r.$t=r.h=void 0;const l=e(6634);r.h=e=>{let i=0;for(let t=0;t<e.length;t++){var n=e.charCodeAt(t);i=(i<<5)-i+n,i&=i}return String(i>>>0)},r.$t=(t,e)=>(0,r.h)(JSON.stringify((0,r.Bt)(t,e)));r.Bt=(i,n)=>{if(null==i)return null;var t=Object.keys(i).sort();const s={};return t.forEach(t=>{var e=i[t];0===n||"object"!==(0,l.Vt)(e)?s[t]=e:s[t]=(0,r.Bt)(e,null!=n?n-1:n)}),s}},1333:(t,e)=>{$Q(e)},7512:(t,e)=>{$Q(e),e.Log=e.LogLevel=void 0;function i(t){return t.unshift("[Statsig]"),t}e.LogLevel={None:0,Error:1,Warn:2,Info:3,Debug:4};class n{static info(...t){n.level>=e.LogLevel.Info&&console.info(" INFO ",...i(t))}static debug(...t){n.level>=e.LogLevel.Debug&&console.debug(" DEBUG ",...i(t))}static warn(...t){n.level>=e.LogLevel.Warn&&console.warn(" WARN ",...i(t))}static error(...t){n.level>=e.LogLevel.Error&&console.error(" ERROR ",...i(t))}}(e.Log=n).level=e.LogLevel.Warn},7787:(t,e)=>{$Q(e),e.createMemoKey=e.MemoPrefix=void 0,e.MemoPrefix={Gt:"g",Jt:"c",Wt:"e",Yt:"cl",Xt:"l",Ht:"p"};const r=new Set([]),l=new Set(["userPersistedValues"]);e.createMemoKey=function(t,e,i){let n=t+"|"+e;if(i)for(const s of Object.keys(i)){if(l.has(s))return;r.has(s)?n+=`|${s}=true`:n+=`|${s}=`+i[s]}return n}},7410:(t,e)=>{$Q(e),e.NetworkParam=e.NetworkDefault=e.Endpoint=void 0,e.Endpoint={Qt:"initialize",kt:"rgstr",Zt:"download_config_specs"},e.NetworkDefault={[e.Endpoint.kt]:"https://prodregistryv2.org/v1",[e.Endpoint.Qt]:"https://featureassets.org/v1",[e.Endpoint.Zt]:"https://api.statsigcdn.com/v1"},e.NetworkParam={EventCount:"ec",SdkKey:"k",SdkType:"st",SdkVersion:"sv",Time:"t",SessionID:"sid",StatsigEncoded:"se",IsGzipped:"gz"}},7023:function(t,e,i){var y=this&&this.__awaiter||$A();$Q(e),e.NetworkCore=void 0,i(1845);const v=i(1845),m=i(8962),O=i(7512),j=i(7410),n=i(308),f=i(3091),l=i(5902),s=i(6830),o=i(4143),u=i(9122),S=i(2636),a=i(8e3),_=i(586),w=i(2397),E=500,k=3e4;const D=new Set([408,500,502,503,504,522,524,599]);e.NetworkCore=class{constructor(t,e){this.st=e,this.te=null,this.ee=1e4,this.ie={},this.O={},this.ne={},this.se=null,t&&(this.O=t),this.O.networkConfig&&(this.ie=this.O.networkConfig),this.ie.networkTimeoutMs&&(this.ee=this.ie.networkTimeoutMs),this.re=new n.NetworkFallbackResolver(this.O),this.setLogEventCompressionMode(this.le(t))}setLogEventCompressionMode(t){this.O.logEventCompressionMode=t}setErrorBoundary(t){this.te=t,this.te.wrap(this),this.te.wrap(this.re),this.re.setErrorBoundary(t)}isBeaconSupported(){return"undefined"!=typeof navigator&&"function"==typeof navigator.sendBeacon}getLastUsedInitUrlAndReset(){var t=this.se;return this.se=null,t}beacon(t){var e,i;return!!x(t)&&(t=this.oe("POST",t),e=this.ue(t),(i=navigator).sendBeacon.bind(i)(e,t.body))}post(e){return y(this,void 0,void 0,function*(){var t=this.oe("POST",e);return this.ae(t),yield this.ce(t),this.he(t)})}get(t){t=this.oe("GET",t);return this.he(t)}he(b){return y(this,void 0,void 0,function*(){var e;if(!x(b))return null;if(this.ie.preventAllNetworkTraffic)return null;var{method:n,body:s,retries:i,attempt:r}=b,l=b.urlConfig.endpoint;if(this.de(l))return O.Log.warn(`Request to ${l} was blocked because you are making requests too frequently.`),null;r=null!=r?r:1;let o=!1;var u=this.ue(b);let a=null;var c,h=(0,w.Ft)();try{var t,d,v,f={method:n,body:s,headers:$P({},b.headers),priority:b.priority,keepalive:h},_=(c=r,(p=b).urlConfig.endpoint===j.Endpoint.Qt&&m.Diagnostics.W(p.sdkKey,{attempt:c}),this.ne[l]),g=(_&&(_.lastRequestTime=Date.now(),this.ne[l]=_),null!=(e=this.ie.networkOverrideFunc)?e:fetch);let i;if((a=yield Promise.race([g(u,f).finally(()=>clearTimeout(i)),new Promise((t,e)=>{i=setTimeout(()=>{o=!0,e(new Error(`Timeout of ${this.ee}ms expired.`))},this.ee)})])).ok)return v=yield a.text(),I(b,a,r,v),this.re.tryBumpExpiryTime(b.sdkKey,b.urlConfig),{body:v,code:a.status};throw t=yield a.text().catch(()=>"No Text"),(d=new Error(`NetworkError: ${u} `+t)).name="NetworkError",d}catch(t){var s=function(t){if("string"==typeof t)return t;if(t instanceof Error)return t.name+": "+t.message;return"Unknown Error"}(t),h=function(t,e){t=t.includes("Timeout");return t||e}(null!=s?s:"",o),p=(I(b,a,r,"",t),yield this.re.tryFetchUpdatedFallbackInfo(b.sdkKey,b.urlConfig,s,h));return(p&&(b.fallbackUrl=this.re.getActiveFallbackUrl(b.sdkKey,b.urlConfig)),!i||i<r||!D.has(null!=(c=null===a||void 0===a?void 0:a.status)?c:500))?(null!=(l=this.st)&&l.call(this,{name:"error",error:t,tag:S.ErrorTag.NetworkError,requestArgs:b}),_=`A networking error occurred during ${n} request to ${u}.`,O.Log.error(_,s,t),null!=(e=this.te)&&e.attachErrorIfNoneExists(_),null):(yield function(e){return y(this,void 0,void 0,function*(){yield new Promise(t=>setTimeout(t,Math.min(E*(e*e),k)))})}(r),this.he($P($P({},b),{retries:i,attempt:r+1})))}})}le(t){let e=null==t?void 0:t.logEventCompressionMode;return e=(e=e||!0!==(null==t?void 0:t.disableCompression)?e:_.LogEventCompressionMode.Disabled)||_.LogEventCompressionMode.Enabled}de(t){var e=Date.now(),i=null!=(i=this.ne[t])?i:{count:0,lastRequestTime:e},n=e-i.lastRequestTime,n=Math.floor(.05*n);return i.count=Math.max(0,i.count-n),50<=i.count||(i.count+=1,i.lastRequestTime=e,this.ne[t]=i,!1)}ue(t){var e=null!=(e=t.fallbackUrl)?e:t.urlConfig.getUrl();t.urlConfig.endpoint!==j.Endpoint.Qt&&t.urlConfig.endpoint!==j.Endpoint.Zt||(this.se=e);const i=$P({[j.NetworkParam.SdkKey]:t.sdkKey,[j.NetworkParam.SdkType]:l.SDKType.ct(t.sdkKey),[j.NetworkParam.SdkVersion]:a.SDK_VERSION,[j.NetworkParam.Time]:String(Date.now()),[j.NetworkParam.SessionID]:o.SessionID.get(t.sdkKey)},t.params);t=Object.keys(i).map(t=>encodeURIComponent(t)+"="+encodeURIComponent(i[t])).join("&");return e+(t?"?"+t:"")}ae(e){var t,i=(0,s.ve)(),n=e.body;if(e.isStatsigEncodable&&!this.O.disableStatsigEncoding&&"string"==typeof n&&null==(0,v.i)("no-encode")&&null!=i&&i.btoa)try{e.body=i.btoa(n).split("").reverse().join(""),e.params=$P($P({},null!=(t=e.params)?t:{}),{[j.NetworkParam.StatsigEncoded]:"1"})}catch(t){O.Log.warn("Request encoding failed for "+e.urlConfig.getUrl(),t)}}ce(d){return y(this,void 0,void 0,function*(){var e,i=d.body;if("string"==typeof i&&function(t,e){if(!t.isCompressable)return;if(null!=(0,v.i)("no-compress")||"undefined"==typeof CompressionStream||"undefined"==typeof TextEncoder)return;var i=null!=t.urlConfig.customUrl||null!=t.urlConfig.fallbackUrls,n=!0===f.SDKFlags.get(t.sdkKey,"enable_log_event_compression");switch(e.logEventCompressionMode){case _.LogEventCompressionMode.Disabled:return;case _.LogEventCompressionMode.Enabled:return i&&!n?void 0:1;case _.LogEventCompressionMode.Forced:return 1;default:return}}(d,this.O))try{for(var n,s=(new TextEncoder).encode(i),r=new CompressionStream("gzip"),l=r.writable.getWriter(),o=(l.write(s).catch(O.Log.error),l.close().catch(O.Log.error),r.readable.getReader()),u=[];!(n=yield o.read()).done;)u.push(n.value);var a=u.reduce((t,e)=>t+e.length,0),c=new Uint8Array(a);let t=0;for(const h of u)c.set(h,t),t+=h.length;d.body=c,d.params=$P($P({},null!=(e=d.params)?e:{}),{[j.NetworkParam.IsGzipped]:"1"})}catch(t){O.Log.warn("Request compression failed for "+d.urlConfig.getUrl(),t)}})}oe(t,e){var i=this.re.getActiveFallbackUrl(e.sdkKey,e.urlConfig),t=$P($P({},e),{method:t,fallbackUrl:i});return"data"in e&&r(t,e.data),t}};const x=t=>!!t.sdkKey||(O.Log.warn("Unable to make request without an SDK key"),!1),r=(t,e)=>{var{sdkKey:i,fallbackUrl:n}=t,s=u.StableID.get(i),r=o.SessionID.get(i),i=l.SDKType.ct(i);t.body=JSON.stringify($P($P({},e),{statsigMetadata:$P($P({},a.StatsigMetadataProvider.get()),{stableID:s,sessionID:r,sdkType:i,fallbackUrl:n})}))};function I(t,e,i,n,s){t.urlConfig.endpoint===j.Endpoint.Qt&&m.Diagnostics.Y(t.sdkKey,m.Diagnostics.et(e,i,n,s))}},308:function(t,e,i){var o=this&&this.__awaiter||$A();$Q(e),e.fe=e.NetworkFallbackResolver=void 0;const l=i(8809),n=i(1406),r=i(7512),u=i(4534);function a(t,e){t=null!=(t=null==t?void 0:t.toLowerCase())?t:"";return e||t.includes("uncaught exception")||t.includes("failed to fetch")||t.includes("networkerror when attempting to fetch resource")}function c(t){return"statsig.network_fallback."+(0,n.h)(t)}function h(t,e){t=c(t);e&&0!==Object.keys(e).length?u.Storage.setItem(t,JSON.stringify(e)):u.Storage.removeItem(t)}e.NetworkFallbackResolver=class{constructor(t){this.ge=null,this.te=null,this._e={},this.pe=null==(t=t.networkConfig)?void 0:t.networkOverrideFunc}setErrorBoundary(t){this.te=t}tryBumpExpiryTime(t,e){var i=null==(i=this.ge)?void 0:i[e.endpoint];i&&(i.expiryTime=Date.now()+6048e5,h(t,$P($P({},this.ge),{[e.endpoint]:i})))}getActiveFallbackUrl(t,e){var i;if(null!=e.customUrl&&null!=e.fallbackUrls)return null;let n=this.ge;null==n&&(n=null!=(s=function(t){t=c(t),t=u.Storage.getItem(t);if(!t)return null;try{return JSON.parse(t)}catch(t){return r.Log.error("Failed to parse FallbackInfo"),null}}(t))?s:{},this.ge=n);var s=n[e.endpoint];return!s||Date.now()>(null!=(i=s.expiryTime)?i:0)||e.getChecksum()!==s.urlConfigChecksum?(delete n[e.endpoint],this.ge=n,h(t,this.ge),null):s.url||null}tryFetchUpdatedFallbackInfo(n,s,r,l){return o(this,void 0,void 0,function*(){var e,t,i;try{return a(r,l)?(t=null==s.customUrl&&null==s.fallbackUrls?yield this.be(s):s.fallbackUrls,!!(i=this.ye(null==(e=this.ge)?void 0:e[s.endpoint],t))&&(this.me(n,s,i),!0)):!1}catch(t){return null!=(e=this.te)&&e.logError("tryFetchUpdatedFallbackInfo",t),!1}})}me(t,e,i){var i={urlConfigChecksum:e.getChecksum(),url:i,expiryTime:Date.now()+6048e5,previous:[]},e=e.endpoint,n=null==(n=this.ge)?void 0:n[e],n=(n&&i.previous.push(...n.previous),10<i.previous.length&&(i.previous=[]),null==(n=null==(n=this.ge)?void 0:n[e])?void 0:n.url);null!=n&&i.previous.push(n),this.ge=$P($P({},this.ge),{[e]:i}),h(t,this.ge)}be(r){return o(this,void 0,void 0,function*(){var t=this._e[r.endpoint];if(t&&Date.now()<t)return null;this._e[r.endpoint]=Date.now()+144e5;var e=[],t=yield(0,l.nt)(null!=(t=this.pe)?t:fetch),i=function(t){try{return new URL(t).pathname}catch(t){return null}}(r.defaultUrl);for(const s of t)if(s.startsWith(r.endpointDnsKey+"=")){var n=s.split("=");if(1<n.length){let t=n[1];t.endsWith("/")&&(t=t.slice(0,-1)),e.push("https://"+t+i)}}return e})}ye(t,e){var i;if(null==e)return null;var n=new Set(null!=(i=null==t?void 0:t.previous)?i:[]),s=null==t?void 0:t.url;let r=null;for(const o of e){var l=o.endsWith("/")?o.slice(0,-1):o;if(!n.has(o)&&l!==s){r=l;break}}return r}},e.fe=a},1405:(t,e)=>{$Q(e)},1361:(t,e)=>{$Q(e)},3091:(t,e)=>{$Q(e),e.SDKFlags=void 0;const i={};e.SDKFlags={setFlags:(t,e)=>{i[t]=e},get:(t,e)=>{return null!=(t=null==(t=i[t])?void 0:t[e])&&t}}},5902:(t,e)=>{$Q(e),e.SDKType=void 0;const i={};let n;e.SDKType={ct:t=>{return(null!=(t=i[t])?t:"js-mono")+(null!==n&&void 0!==n?n:"")},Oe(t,e){i[t]=e},je(t){n&&"-react"!==n||(n="-"+t)}}},6830:(t,n)=>{$Q2(n,"__esModule",{value:!0}),n.Se=n.Kt=n.we=n.ke=n.Mt=n.Ee=n.ve=void 0;n.ve=()=>"undefined"!=typeof window?window:null,n.Ee=()=>{var t=(0,n.ve)();return null!=(t=null==t?void 0:t.document)?t:null},n.Mt=()=>{var t;return null===(0,n.Ee)()&&(t="undefined"!=typeof process&&null!=process.versions&&null!=process.versions.node,"string"==typeof EdgeRuntime||t)},n.ke=(t,e)=>{var i=(0,n.ve)();"function"==typeof(null==i?void 0:i.addEventListener)&&i.addEventListener(t,e)},n.we=(t,e)=>{var i=(0,n.Ee)();"function"==typeof(null==i?void 0:i.addEventListener)&&i.addEventListener(t,e)},n.Kt=()=>{var t;try{return null==(t=(0,n.ve)())?void 0:t.location.href.split(/[?#]/)[0]}catch(t){}};n.Se=()=>{var t=(0,n.ve)();return t&&"onpagehide"in t?"pagehide":"beforeunload"}},4143:(t,e,i)=>{$Q(e),e.StatsigSession=e.SessionID=void 0;const n=i(1845),s=i(2137),o=i(7512),u=i(4534),a=i(8023),c=18e5,h=144e5,d={};function v(e,t){return setTimeout(()=>{var t=null==(t=(0,n.l)())?void 0:t.instance(e);t&&t.$emt({name:"session_expired"})},t)}function f(t){return"statsig.session_id."+(0,s.o)(t)}e.SessionID={get:t=>e.StatsigSession.get(t).data.sessionID},e.StatsigSession={get:t=>{null==d[t]&&(d[t]=function(t){let e=function(t){t=f(t);return(0,u.K)(t)}(t);var i=Date.now();e=e||{sessionID:(0,a.getUUID)(),startTime:i,lastUpdate:i};return{data:e,sdkKey:t}}(t));var t=d[t],e=Date.now(),i=t.data,n=t.sdkKey,s=((function({lastUpdate:t}){return Date.now()-t>c}(i)||function({startTime:t}){return Date.now()-t>h}(i))&&(i.sessionID=(0,a.getUUID)(),i.startTime=e,l=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instance(n))&&l.$emt({name:"session_expired"}),i.lastUpdate=e,i),r=t.sdkKey;r=f(r);try{(0,u.B)(r,s)}catch(t){o.Log.warn("Failed to save SessionID")}clearTimeout(t.idleTimeoutID),clearTimeout(t.ageTimeoutID);var l=e-i.startTime;return t.idleTimeoutID=v(n,c),t.ageTimeoutID=v(n,h-l),t},overrideInitialSessionID:(t,e)=>{var i;d[e]=(t=t,e=e,i=Date.now(),{data:{sessionID:t,startTime:i,lastUpdate:i},sdkKey:e})}}},2176:(t,o)=>{$Q2(o,"__esModule",{value:!0}),o.De=void 0;o.De=(e,i)=>{let n=0;var s=Object.keys(e);for(let t=0;t<s.length;t++){var r=s[t],l=e[r];if((n=(n+=r.length)+("object"==typeof l&&null!==l?(0,o.De)(l,i)+2:String(l).length+1))>=i)return n}return n}},9122:(t,e,i)=>{$Q(e),e.getCookieName=e.StableID=void 0;const n=i(2137),s=i(7512),r=i(6830),l=i(4534),o=i(8023),u={},a={},c={};function h(t){return"statsig.stable_id."+(0,n.o)(t)}function d(t,e){e=h(e);try{(0,l.B)(e,t)}catch(t){s.Log.warn("Failed to save StableID to storage")}}function v(t,e){var i;a[e]&&null!=(0,r.Ee)()&&((i=new Date).setFullYear(i.getFullYear()+1),document.cookie=`${f(e)}=${encodeURIComponent(t)}; expires=${i.toUTCString()}; path=/`)}function f(t){return"statsig.stable_id."+(0,n.o)(t)}e.StableID={cookiesEnabled:!1,randomID:Math.random().toString(36),get:t=>{if(c[t])return null;if(null!=u[t])return u[t];let e=null;return null!=(e=function(t){if(a[t]&&null!=(0,r.Ee)())for(const n of document.cookie.split(";")){var[e,i]=n.trim().split("=");if(e===f(t))return decodeURIComponent(i)}return null}(t))?d(u[t]=e,t):(d(e=null==(e=function(t){t=h(t);return(0,l.K)(t)}(t))?(0,o.getUUID)():e,t),v(e,t),u[t]=e),e},setOverride:(t,e)=>{d(u[e]=t,e),v(t,e)},Ie:(t,e)=>{a[t]=e},Me:(t,e)=>{c[t]=e}},e.getCookieName=f},1375:function(t,e,i){var n=this&&this.__awaiter||$A();$Q(e),e.StatsigClientBase=void 0,i(1845);const l=i(1845),o=i(5542),u=i(7770),a=i(7512),r=i(7787),c=i(6830),h=i(4143),d=i(9122),s=i(586),v=i(4534);e.StatsigClientBase=class{constructor(t,e,i,n){this.loadingStatus="Uninitialized",this.xe=null,this.Te={};var s,r=this.$emt.bind(this);null!=(null==n?void 0:n.logLevel)&&(a.Log.level=n.logLevel),null!=n&&n.disableStorage&&v.Storage.Me(!0),null!=n&&n.initialSessionID&&h.StatsigSession.overrideInitialSessionID(n.initialSessionID,t),null!=n&&n.storageProvider&&v.Storage.Ne(n.storageProvider),null!=n&&n.enableCookies&&d.StableID.Ie(t,n.enableCookies),null!=n&&n.disableStableID&&d.StableID.Me(t,!0),this.j=t,this.O=null!=n?n:{},this.Ce={},this.overrideAdapter=null!=(s=null==n?void 0:n.overrideAdapter)?s:null,this.Re=new u.EventLogger(t,r,i,n),this.te=new o.ErrorBoundary(t,n,r),this.te.wrap(this),this.te.wrap(e),this.te.wrap(this.Re),i.setErrorBoundary(this.te),this.dataAdapter=e,this.dataAdapter.attach(t,n,i),this.storageProvider=v.Storage,null!=(e=null==(r=null==(s=this.overrideAdapter)?void 0:s.loadFromStorage)?void 0:r.call(s))&&e.catch(t=>this.te.logError("OA::loadFromStorage",t)),this.Ue(),n=t,i=this,(0,c.Mt)()||(r=(0,l.l)(),s=null!=(s=r.instances)?s:{},i=i,null!=s[n]&&a.Log.warn("Creating multiple Statsig clients with the same SDK key can lead to unexpected behavior. Multi-instance support requires different SDK keys."),s[n]=i,r.firstInstance||(r.firstInstance=i),r.instances=s,__STATSIG__=r)}updateRuntimeOptions(t){t.loggingEnabled?(this.O.loggingEnabled=t.loggingEnabled,this.Re.setLoggingEnabled(t.loggingEnabled)):null!=t.disableLogging&&(this.O.disableLogging=t.disableLogging,this.Re.setLoggingEnabled(t.disableLogging?"disabled":"browser-only")),null!=t.disableStorage&&(this.O.disableStorage=t.disableStorage,v.Storage.Me(t.disableStorage)),null!=t.enableCookies&&(this.O.enableCookies=t.enableCookies,d.StableID.Ie(this.j,t.enableCookies)),t.logEventCompressionMode?this.Re.setLogEventCompressionMode(t.logEventCompressionMode):t.disableCompression&&this.Re.setLogEventCompressionMode(s.LogEventCompressionMode.Disabled)}flush(){return this.Re.flush()}shutdown(){return n(this,void 0,void 0,function*(){this.$emt({name:"pre_shutdown"}),this.Ae("Uninitialized",null),this.xe=null,yield this.Re.stop()})}on(t,e){this.Te[t]||(this.Te[t]=[]),this.Te[t].push(e)}off(t,e){this.Te[t]&&-1!==(e=this.Te[t].indexOf(e))&&this.Te[t].splice(e,1)}$on(t,e){e.__isInternal=!0,this.on(t,e)}$emt(i){var t;const e=e=>{try{e(i)}catch(t){!0===e.__isInternal?this.te.logError("__emit:"+i.name,t):a.Log.error("An error occurred in a StatsigClientEvent listener. This is not an issue with Statsig.",i)}};this.Te[i.name]&&this.Te[i.name].forEach(t=>e(t)),null!=(t=this.Te["*"])&&t.forEach(e)}Ae(t,e){this.loadingStatus=t,this.Ce={},this.$emt({name:"values_updated",status:t,values:e})}Fe(t,e,i){!0===(null==i?void 0:i.disableExposureLog)?this.Re.incrementNonExposureCount(t):this.Re.enqueue(e)}Pe(n,s){return(t,e)=>{var i;return!this.O.disableEvaluationMemoization&&(i=(0,r.createMemoKey)(n,t,e))?(i in this.Ce||(3e3<=Object.keys(this.Ce).length&&(this.Ce={}),this.Ce[i]=s(t,e)),this.Ce[i]):s(t,e)}}}},2636:(t,e)=>{$Q(e),e.ErrorTag=void 0,e.ErrorTag={NetworkError:"NetworkError"}},3206:(t,e)=>{$Q(e),e.DataAdapterCachePrefix=void 0,e.DataAdapterCachePrefix="statsig.cached"},1637:(t,e)=>{$Q(e),e.Le=e.ze=e.qe=e.Ke=e.Ut=void 0;const r="statsig::config_exposure",l="statsig::gate_exposure",a="statsig::layer_exposure",c=(t,e,i,n,s)=>(i.bootstrapMetadata&&(n.bootstrapMetadata=i.bootstrapMetadata),{eventName:t,user:e,value:null,metadata:o(i,n),secondaryExposures:s,time:Date.now()});e.Ut=({eventName:t})=>t===l||t===r||t===a;function h(t,e){return t.map(t=>"string"==typeof t?(null!=e?e:{})[t]:t).filter(t=>null!=t)}e.Ke=(t,e,i)=>{var n,s={gate:e.name,gateValue:String(e.value),ruleID:e.ruleID};return null!=(null==(n=e.__evaluation)?void 0:n.version)&&(s.configVersion=e.__evaluation.version),c(l,t,e.details,s,h(null!=(t=null==(n=e.__evaluation)?void 0:n.secondary_exposures)?t:[],i))},e.qe=h;e.ze=(t,e,i)=>{var n,s={config:e.name,ruleID:e.ruleID};return null!=(null==(n=e.__evaluation)?void 0:n.version)&&(s.configVersion=e.__evaluation.version),null!=(null==(n=e.__evaluation)?void 0:n.passed)&&(s.rulePassed=String(e.__evaluation.passed)),c(r,t,e.details,s,h(null!=(t=null==(n=e.__evaluation)?void 0:n.secondary_exposures)?t:[],i))};e.Le=(t,e,i,n)=>{var s=e.__evaluation,r=!0===(null==(r=null==s?void 0:s.explicit_parameters)?void 0:r.includes(i));let l="",o=null!=(u=null==s?void 0:s.undelegated_secondary_exposures)?u:[];r&&(l=null!=(u=s.allocated_experiment_name)?u:"",o=null!=(u=s.secondary_exposures)?u:[]);var u=null==(s=e.__evaluation)?void 0:s.parameter_rule_ids,u={config:e.name,parameterName:i,ruleID:null!=(s=null==u?void 0:u[i])?s:e.ruleID,allocatedExperiment:l,isExplicitParameter:String(r)};return null!=(null==(i=e.__evaluation)?void 0:i.version)&&(u.configVersion=e.__evaluation.version),c(a,t,e.details,u,h(o,n))};const o=(t,e)=>(e.reason=t.reason,t.lcut&&(e.lcut=String(t.lcut)),t.receivedAt&&(e.receivedAt=String(t.receivedAt)),e)},8e3:(t,e)=>{$Q(e),e.StatsigMetadataProvider=e.SDK_VERSION=void 0,e.SDK_VERSION="3.30.2";let i={sdkVersion:e.SDK_VERSION,sdkType:"js-mono"};e.StatsigMetadataProvider={get:()=>i,add:t=>{i=$P($P({},i),t)}}},586:(t,e)=>{$Q(e),e.LoggingEnabledOption=e.LogEventCompressionMode=void 0,e.LogEventCompressionMode={Disabled:"d",Enabled:"e",Forced:"f"},e.LoggingEnabledOption={disabled:"disabled",browserOnly:"browser-only",always:"always"}},1098:(t,e)=>{$Q(e)},2059:(t,e,i)=>{$Q(e),e.Be=e.$e=e.Ve=e.Ge=e.Je=e.We=void 0;const l=i(7512),o=i(6634);function s(t,e,i,n){return{name:t,details:e,ruleID:null!=(t=null==i?void 0:i.rule_id)?t:"",__evaluation:i,value:n}}function n(t,e,i){var n=null!=(n=null==i?void 0:i.value)?n:{};return $P($P({},s(t,e,i,n)),{idType:null!=(e=null==i?void 0:i.id_type)?e:null,get:r(t,null==i?void 0:i.value)})}function r(n,s,r){return(t,e)=>{var i=null!=(i=null==s?void 0:s[t])?i:null;return null==i?null!=e?e:null:null==e||(0,o.Ye)(i,e)?(null!=r&&r(t),i):(l.Log.warn(`Parameter type mismatch. '${n}.${t}' was found to be type '${typeof i}' but fallback/return type is '${typeof e}'. See https://docs.statsig.com/client/javascript-sdk/#typed-getters`),null!=e?e:null)}}e.We=function(t,e,i){return $P($P({},s(t,e,i,!0===(null==i?void 0:i.value))),{idType:null!=(t=null==i?void 0:i.id_type)?t:null})},e.Je=n,e.Ge=function(t,e,i){return t=n(t,e,i),$P($P({},t),{groupName:null!=(e=null==i?void 0:i.group_name)?e:null})},e.Ve=function(t,e,i,n){return $P($P({},s(t,e,i,void 0)),{get:r(t,null==i?void 0:i.value,n),groupName:null!=(e=null==i?void 0:i.group_name)?e:null,__value:null!=(t=null==i?void 0:i.value)?t:{}})},e.$e=function(t,e,i,n){return $P($P($P({},t),e),{get:r(t.name,i,n)})},e.Be=r},1812:(t,e)=>{$Q(e)},3932:(t,e)=>{$Q(e),e.UPDATE_DETAIL_ERROR_MESSAGES=e.createUpdateDetails=void 0;e.createUpdateDetails=(t,e,i,n,s,r)=>({duration:i,source:e,success:t,error:n,sourceUrl:s,warnings:r}),e.UPDATE_DETAIL_ERROR_MESSAGES={NO_NETWORK_DATA:"No data was returned from the network. This may be due to a network timeout if a timeout value was specified in the options or ad blocker error."}},8578:(t,e,i)=>{$Q(e),e._=e.D=void 0;const n=i(1406),s=i(7512);e.D=function(t,e,i){try{var n=JSON.parse(JSON.stringify(t));return null!=e&&null!=e.environment?n.statsigEnvironment=e.environment:null!=i&&(n.statsigEnvironment={tier:i}),n}catch(t){return s.Log.error("Failed to JSON.stringify user"),{statsigEnvironment:void 0}}},e._=function(t){return t?(0,n.$t)(t):null}},4534:(t,i,e)=>{$Q2(i,"__esModule",{value:!0}),i.B=i.K=i.Storage=void 0;const n=e(7512);e=e(6830);const s={},r={isReady:()=>!0,isReadyResolver:()=>null,getProviderName:()=>"InMemory",getItem:t=>s[t]||null,setItem:(t,e)=>{s[t]=e},removeItem:t=>{delete s[t]},getAllKeys:()=>Object.keys(s)};let l=null;try{const c=(0,e.ve)();c&&c.localStorage&&"function"==typeof c.localStorage.getItem&&(l={isReady:()=>!0,isReadyResolver:()=>null,getProviderName:()=>"LocalStorage",getItem:t=>c.localStorage.getItem(t),setItem:(t,e)=>c.localStorage.setItem(t,e),removeItem:t=>c.localStorage.removeItem(t),getAllKeys:()=>Object.keys(c.localStorage)})}catch(t){n.Log.warn("Failed to setup localStorageProvider.")}let o=null!==l&&void 0!==l?l:r,u=o;function a(t){try{return t()}catch(t){if(t instanceof Error&&"SecurityError"===t.name)return i.Storage.Ne(r),null;throw t}}i.Storage={isReady:()=>u.isReady(),isReadyResolver:()=>u.isReadyResolver(),getProviderName:()=>u.getProviderName(),getItem:t=>a(()=>u.getItem(t)),setItem:(t,e)=>a(()=>u.setItem(t,e)),removeItem:t=>u.removeItem(t),getAllKeys:()=>u.getAllKeys(),Ne:t=>{o=t,u=t},Me:t=>{u=t?r:o}},i.K=function(e){var t=i.Storage.getItem(e);try{return JSON.parse(null!=t?t:"null")}catch(t){return n.Log.error(`Failed to parse value for key "${e}"`),null}},i.B=function(t,e){i.Storage.setItem(t,JSON.stringify(e))}},3401:(t,e,i)=>{$Q(e),e.P=void 0;const s=i(7512);e.P=function(t,e,i){try{var n=JSON.parse(t);if(n&&"object"==typeof n&&e in n)return n}catch(t){}return s.Log.error("Failed to parse "+i),null}},6634:(t,e)=>{$Q(e),e.Ye=e.Vt=void 0,e.Vt=function(t){return Array.isArray(t)?"array":typeof t},e.Ye=function(t,e){var i=t=>Array.isArray(t)?"array":null===t?"null":typeof t;return i(t)===i(e)}},8023:(t,e)=>{$Q(e),e.getUUID=void 0,e.getUUID=function(){if("undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID)return crypto.randomUUID();let i=(new Date).getTime(),n="undefined"!=typeof performance&&performance.now&&1e3*performance.now()||0;return`xxxxxxxx-xxxx-4xxx-${"89ab"[Math.floor(4*Math.random())]}xxx-xxxxxxxxxxxx`.replace(/[xy]/g,t=>{let e=16*Math.random();return 0<i?(e=(i+e)%16|0,i=Math.floor(i/16)):(e=(n+e)%16|0,n=Math.floor(n/16)),("x"===t?e:7&e|8).toString(16)})}},1881:(t,e,i)=>{$Q(e),e.UrlConfiguration=void 0;const n=i(1406),s=i(7410),r={[s.Endpoint.Qt]:"i",[s.Endpoint.kt]:"e",[s.Endpoint.Zt]:"d"};e.UrlConfiguration=class{constructor(t,e,i,n){this.customUrl=null,this.fallbackUrls=null,this.endpoint=t,this.endpointDnsKey=r[t],e&&(this.customUrl=e),!e&&i&&(this.customUrl=i.endsWith("/")?""+i+t:i+"/"+t),n&&(this.fallbackUrls=n);e=s.NetworkDefault[t];this.defaultUrl=e+"/"+t}getUrl(){var t;return null!=(t=this.customUrl)?t:this.defaultUrl}getChecksum(){var t=(null!=(t=this.fallbackUrls)?t:[]).sort().join(",");return(0,n.h)(this.customUrl+t)}}},2397:(t,e,i)=>{$Q(e),e.Xe=e.xt=e.Ft=e.He=void 0;i=i(6830);const n="foreground",s="background",r=[];let l=n,o=!1;e.He=()=>l===n,e.Ft=()=>o,e.xt=t=>{r.unshift(t)};e.Xe=e=>{e!==l&&(l=e,r.forEach(t=>t(e)))},(0,i.ke)("focus",()=>{(o=!1,e.Xe)(n)}),(0,i.ke)("blur",()=>(0,e.Xe)(s)),(0,i.we)("visibilitychange",()=>{(0,e.Xe)("visible"===document.visibilityState?n:s)}),(0,i.ke)((0,i.Se)(),()=>{o=!0,(0,e.Xe)(s)})},6914:function(t,e,i){var n=this&&this.__createBinding||(Object.create?function(t,e,i,n){void 0===n&&(n=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&("get"in s?e.__esModule:!s.writable&&!s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),$Q2(t,n,s)}:function(t,e,i,n){t[n=void 0===n?i:n]=e[i]}),s=this&&this.__exportStar||function(t,e){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(e,i)||n(e,t,i)},r=($Q(e),e.Storage=e.Log=e.EventLogger=e.Diagnostics=void 0,i(1845),i(1845));const l=i(8962),o=($Q2(e,"Diagnostics",{enumerable:!0,get:function(){return l.Diagnostics}}),i(7770)),u=($Q2(e,"EventLogger",{enumerable:!0,get:function(){return o.EventLogger}}),i(7512));$Q2(e,"Log",{enumerable:!0,get:function(){return u.Log}});var a=i(8e3);const c=i(4534);$Q2(e,"Storage",{enumerable:!0,get:function(){return c.Storage}}),s(i(1845),e),s(i(2137),e),s(i(6427),e),s(i(694),e),s(i(8962),e),s(i(3539),e),s(i(5542),e),s(i(2922),e),s(i(2417),e),s(i(1406),e),s(i(1333),e),s(i(7512),e),s(i(7787),e),s(i(7410),e),s(i(7023),e),s(i(1405),e),s(i(1361),e),s(i(6830),e),s(i(5902),e),s(i(4143),e),s(i(2176),e),s(i(9122),e),s(i(1375),e),s(i(2636),e),s(i(3206),e),s(i(1637),e),s(i(8e3),e),s(i(586),e),s(i(1098),e),s(i(2059),e),s(i(1812),e),s(i(8578),e),s(i(4534),e),s(i(3401),e),s(i(6634),e),s(i(1881),e),s(i(8023),e),s(i(2397),e),s(i(3932),e),s(i(3091),e),$P((0,r.l)(),{Log:u.Log,SDK_VERSION:a.SDK_VERSION})},9296:function(t,e,i){var n=this&&this.__createBinding||(Object.create?function(t,e,i,n){void 0===n&&(n=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&("get"in s?e.__esModule:!s.writable&&!s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),$Q2(t,n,s)}:function(t,e,i,n){t[n=void 0===n?i:n]=e[i]}),s=this&&this.__exportStar||function(t,e){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(e,i)||n(e,t,i)},r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}},r=($Q(e),r(i(2018)));s(i(2018),e),e.default=r.default},7262:(t,e,i)=>{$Q(e),e.Qe=void 0;const n=i(6914);function s(t,e){null!=t&&t.forEach(t=>{delete e[t]})}e.Qe=function(t,e){var i;return(e=(0,n.P)(e,"checksum","DeltasEvaluationResponse"))?(t=t,i=e,t=$P($P($P({},t),i),{feature_gates:$P($P({},t.feature_gates),i.feature_gates),layer_configs:$P($P({},t.layer_configs),i.layer_configs),dynamic_configs:$P($P({},t.dynamic_configs),i.dynamic_configs)}),s((t=i=t).deleted_gates,t.feature_gates),delete t.deleted_gates,s(i.deleted_configs,t.dynamic_configs),delete t.deleted_configs,s(i.deleted_layers,t.layer_configs),delete t.deleted_layers,i=t,(t=(0,n.$t)({feature_gates:i.feature_gates,dynamic_configs:i.dynamic_configs,layer_configs:i.layer_configs},2))===e.checksumV2?JSON.stringify(i):{hadBadDeltaChecksum:!0,badChecksum:t,badMergedConfigs:i,badFullResponse:e.deltas_full_response}):{hadBadDeltaChecksum:!0}}},4845:(t,e,i)=>{$Q(e);const s=i(6914),r=i(140),l=i(7095);e.default=class{constructor(t){this.j=t,this.Ze=null,this.ti=null,this.ei="Uninitialized",this.ii=0,this.ni=0,this.si=null,this.ri=new Set}reset(){this.ti=null,this.Ze=null,this.ei="Loading",this.ii=0,this.ni=0,this.si=null,this.ri.clear()}finalize(){this.ti||(this.ei="NoValues")}getValues(){return this.Ze?(0,s.P)(this.Ze,"has_updates","EvaluationStoreValues"):null}setValues(t,e){var i,n;return!!t&&null!=(n=(0,s.P)(t.data,"has_updates","EvaluationResponse"))&&(this.ei=t.source,!0!==(null==n?void 0:n.has_updates)||(null!=(i=n.time)?i:0)<this.ii||(this.Ze=t.data,this.ii=n.time,this.ni=t.receivedAt,"init-v2"===n.response_format?this.ti=new l.V2InitializeContainer(n):this.ti=new r.V1InitializeContainer(n),this.si=this.li(t.source,n),t.source&&n.user&&this.oi(e,n),s.SDKFlags.setFlags(this.j,null!=(i=n.sdk_flags)?i:{})),!0)}getWarnings(){if(0!==this.ri.size)return Array.from(this.ri)}getGate(t){t=this.ti?this.ti.getGate(t):null;return this.ui(t)}getConfig(t){t=this.ti?this.ti.getConfig(t):null;return this.ui(t)}getConfigList(){return this.ti?this.ti.getConfigList():[]}getLayer(t){t=this.ti?this.ti.getLayer(t):null;return this.ui(t)}getParamStore(t){t=this.ti?this.ti.getParamStore(t):null;return this.ui(t)}getSource(){return this.ei}getExposureMapping(){var t;return null==(t=this.ti)?void 0:t.getExposureMapping()}li(t,e){return"Bootstrap"!==t?null:(t={},e.user&&(t.user=e.user),e.sdkInfo&&(t.generatorSDKInfo=e.sdkInfo),t.lcut=e.time,t)}ui(t){return{result:t,details:this.ai(null==t)}}oi(t,e){var i,n=s.StableID.get(this.j);(null==(i=t.customIDs)?void 0:i.stableID)!==n&&(null!=(i=t.customIDs)&&i.stableID||n)?this.ri.add("StableIDMismatch"):"user"in e&&(i=e.user,n=$P($P({},t),{analyticsOnlyMetadata:void 0,privateAttributes:void 0}),(0,s._)(n)!==(0,s._)(i))&&this.ri.add("PartialUserMatch")}getCurrentSourceDetails(){var t;return"Uninitialized"===this.ei||"NoValues"===this.ei?{reason:this.ei}:(t={reason:this.ei,lcut:this.ii,receivedAt:this.ni},0<this.ri.size&&(t.warnings=Array.from(this.ri)),t)}ai(t){var e=this.getCurrentSourceDetails();let i=e.reason;var n=null!=(n=e.warnings)?n:[],t=("Bootstrap"===this.ei&&0<n.length&&(i+=n[0]),"Uninitialized"!==i&&"NoValues"!==i&&(i=i+":"+(t?"Unrecognized":"Recognized")),"Bootstrap"===this.ei&&null!=(n=this.si)?n:void 0);return t&&(e.bootstrapMetadata=t),$P($P({},e),{reason:i})}}},8448:function(t,e,i){var u=this&&this.__awaiter||$A();$Q(e);const a=i(6914),l=i(7262);class n extends a.NetworkCore{constructor(t,e){super(t,e);e=null==t?void 0:t.networkConfig;this.ci=t,this.hi=new a.UrlConfiguration(a.Endpoint.Qt,null==e?void 0:e.initializeUrl,null==e?void 0:e.api,null==e?void 0:e.initializeFallbackUrls)}fetchEvaluations(n,s,r,l,o){return u(this,void 0,void 0,function*(){var t,e=s?(0,a.P)(s,"has_updates","InitializeResponse"):null;let i={user:l,hash:null!=(t=null==(t=null==(t=this.ci)?void 0:t.networkConfig)?void 0:t.initializeHashAlgorithm)?t:"djb2",deltasResponseRequested:!1,full_checksum:null};return null!=e&&e.has_updates&&(t=(null==e?void 0:e.hash_used)!==(null!=(t=null==(t=null==(t=this.ci)?void 0:t.networkConfig)?void 0:t.initializeHashAlgorithm)?t:"djb2"),i=$P($P({},i),{sinceTime:o&&!t?e.time:0,previousDerivedFields:"derived_fields"in e&&o?e.derived_fields:{},deltasResponseRequested:!0,full_checksum:e.full_checksum,partialUserMatchSinceTime:t?0:e.time})),this.di(n,e,i,r)})}di(i,n,s,r){return u(this,void 0,void 0,function*(){var t,e=yield this.post({sdkKey:i,urlConfig:this.hi,data:s,retries:2,isStatsigEncodable:!0,priority:r});return 204===(null==e?void 0:e.code)?'{"has_updates": false}':200!==(null==e?void 0:e.code)?null!=(t=null==e?void 0:e.body)?t:null:!0!==(null==n?void 0:n.has_updates)||!0!==(null==(t=e.body)?void 0:t.includes('"is_delta":true'))||!0!==s.deltasResponseRequested?e.body:"string"==typeof(t=(0,l.Qe)(n,e.body))?t:this.di(i,n,$P($P($P({},s),t),{deltasResponseRequested:!1}),r)})}}e.default=n},3583:(t,e,i)=>{$Q(e),e.vi=void 0;const d=i(6914),v={disableExposureLog:!0};function f(t){return null==t||!1===t.disableExposureLog}function _(t,e){return null!=e&&!(0,d.Ye)(t,e)}e.vi=function(a,c,h){return(t,e)=>{if(null==c)return e;var i,n,s,r,l,o,u=c[t];if(null==u||null!=e&&(0,d.Vt)(e)!==u.param_type)return e;switch(u.ref_type){case"static":return u.value;case"gate":return o=u,a.getFeatureGate(o.gate_name,f(h)?void 0:v).value?o.pass_value:o.fail_value;case"dynamic_config":return o=u,l=e,_(r=(r=a).getDynamicConfig(o.config_name,f(h)?void 0:v).get(o.param_name),l)?l:r;case"experiment":return l=u,r=e,_(s=(s=a).getExperiment(l.experiment_name,f(h)?void 0:v).get(l.param_name),r)?r:s;case"layer":return s=u,n=e,_(i=(i=a).getLayer(s.layer_name,f(h)?void 0:v).get(s.param_name),n)?n:i;default:return e}}}},8198:function(t,e,i){var r=this&&this.__awaiter||$A();$Q(e);const l=i(6914),o=i(4845),u=i(8448),s=i(3583),a=i(4131);class n extends l.StatsigClientBase{static instance(t){var e=(0,l.l)().instance(t);return e instanceof n?e:(l.Log.warn((0,l.Mt)()?"StatsigClient.instance is not supported in server environments":"Unable to find StatsigClient instance"),new n(null!=t?t:"",{}))}constructor(t,e,i=null){l.SDKType.Oe(t,"javascript-client");var n,s=new u.default(i,t=>{this.$emt(t)}),t=(super(t,null!=(n=null==i?void 0:i.dataAdapter)?n:new a.StatsigEvaluationsDataAdapter,s,i),this.fi={},this.getFeatureGate=this.Pe(l.MemoPrefix.Gt,this.gi.bind(this)),this.getDynamicConfig=this.Pe(l.MemoPrefix.Jt,this._i.bind(this)),this.getExperiment=this.Pe(l.MemoPrefix.Wt,this.pi.bind(this)),this.getConfigList=this.Pe(l.MemoPrefix.Yt,this.bi.bind(this)),this.getLayer=this.Pe(l.MemoPrefix.Xt,this.yi.bind(this)),this.getParameterStore=this.Pe(l.MemoPrefix.Ht,this.mi.bind(this)),this.Oi=new o.default(t),this.ft=s,this.ji=this.Si(e,i),this.wi=(0,l.getUUID)(),null!=(n=null==i?void 0:i.plugins)?n:[]);for(const r of t)r.bind(this)}initializeSync(t){var e;return"Uninitialized"!==this.loadingStatus?(0,l.createUpdateDetails)(!0,this.Oi.getSource(),-1,null,null,["MultipleInitializations",...null!=(e=this.Oi.getWarnings())?e:[]]):(this.Re.start(),this.updateUserSync(this.ji,t))}initializeAsync(t){return r(this,void 0,void 0,function*(){return this.xe||(this.xe=this.ki(t)),this.xe})}updateUserSync(e,t){var i=performance.now();try{return this.Ei(e,t,i)}catch(t){e=t instanceof Error?t:new Error(String(t));return this.Di(e,i)}}Ei(t,e,i){var n=[...null!=(n=this.Oi.getWarnings())?n:[]],t=(this.Ii(t),this.dataAdapter.getDataSync(this.ji)),e=(null==t&&n.push("NoCachedValues"),this.Oi.setValues(t,this.ji),this.Mi(t),null==e?void 0:e.disableBackgroundCacheRefresh);return!0===e||null==e&&"Bootstrap"===(null==t?void 0:t.source)||this.xi(null!=t?t:null,this.ji),(0,l.createUpdateDetails)(!0,this.Oi.getSource(),performance.now()-i,this.te.getLastSeenErrorAndReset(),this.ft.getLastUsedInitUrlAndReset(),n)}updateUserAsync(t,n){return r(this,void 0,void 0,function*(){var e=performance.now();try{return yield this.Ti(t,n)}catch(t){var i=t instanceof Error?t:new Error(String(t));return this.Di(i,e)}})}Ti(n,s){return r(this,void 0,void 0,function*(){this.Ii(n);var t=this.ji,e=(l.Diagnostics.G(this.j),this.dataAdapter.getDataSync(t));if(this.Oi.setValues(e,this.ji),this.Ae("Loading",e),e=yield this.dataAdapter.getDataAsync(e,t,s),t!==this.ji)return(0,l.createUpdateDetails)(!1,this.Oi.getSource(),-1,new Error("User changed during update"),this.ft.getLastUsedInitUrlAndReset());let i=!1;null!=e&&(l.Diagnostics.X(this.j),i=this.Oi.setValues(e,this.ji),l.Diagnostics.H(this.j,{success:i})),this.Mi(e),i||(this.te.attachErrorIfNoneExists(l.UPDATE_DETAIL_ERROR_MESSAGES.NO_NETWORK_DATA),this.$emt({name:"initialization_failure"})),l.Diagnostics.J(this.j,i,this.Oi.getCurrentSourceDetails());t=l.Diagnostics.it(this.ji,this.Re,this.j,this.O);return(0,l.createUpdateDetails)(i,this.Oi.getSource(),t,this.te.getLastSeenErrorAndReset(),this.ft.getLastUsedInitUrlAndReset(),this.Oi.getWarnings())})}getContext(){let t={};try{t=JSON.parse(JSON.stringify(this.ji))}catch(t){l.Log.error("Failed to parse user")}return{sdkKey:this.j,options:this.O,values:this.Oi.getValues(),user:t,errorBoundary:this.te,session:l.StatsigSession.get(this.j),stableID:l.StableID.get(this.j),sdkInstanceID:this.wi}}checkGate(t,e){return this.getFeatureGate(t,e).value}logEvent(t,e,i){e="string"==typeof t?{eventName:t,value:e,metadata:i}:t;this.$emt({name:"log_event_called",event:e}),this.Re.enqueue($P($P({},e),{user:this.ji,time:Date.now()}))}updateUserWithAnalyticsOnlyMetadata(t){this.ji=this.Si($P($P({},this.ji),{analyticsOnlyMetadata:t}),this.O)}Ue(){this.$on("error",()=>{"Loading"===this.loadingStatus&&this.Mi(null)})}ki(t){return r(this,void 0,void 0,function*(){return l.Storage.isReady()||(yield l.Storage.isReadyResolver()),this.Re.start(),this.updateUserAsync(this.ji,t)})}Di(t,e){return(0,l.createUpdateDetails)(!1,this.Oi.getSource(),performance.now()-e,t,null,[...null!=(e=this.Oi.getWarnings())?e:[]])}Mi(t){this.Oi.finalize(),this.Ae("Ready",t)}xi(t,e){this.dataAdapter.getDataAsync(t,e,{priority:"low"}).catch(t=>{l.Log.error("An error occurred after update.",t)})}Ii(t){this.Re.reset(),this.Oi.reset(),this.ji=this.Si(t,this.O)}Si(t,e){var i,t=(0,l.D)(t,e);const n=null==(e=t.customIDs)?void 0:e.stableID;return n&&((i=null==(i=(e=this.storageProvider).isReadyResolver)?void 0:i.call(e))?i.then(()=>l.StableID.setOverride(n,this.j),()=>l.StableID.setOverride(n,this.j)):l.StableID.setOverride(n,this.j)),0<Object.keys(this.fi).length&&(t.analyticsOnlyMetadata=$P($P({},t.analyticsOnlyMetadata),this.fi)),t}gi(t,e){var{result:i,details:n}=this.Oi.getGate(t),n=(0,l.We)(t,n,i),s=null==(s=null==(i=this.overrideAdapter)?void 0:i.getGateOverride)?void 0:s.call(i,n,this.ji,e),i=null!=s?s:n;return this.Fe(t,(0,l.Ke)(this.ji,i,this.Oi.getExposureMapping()),e),this.$emt({name:"gate_evaluation",gate:i}),i}_i(t,e){var{result:i,details:n}=this.Oi.getConfig(t),n=(0,l.Je)(t,n,i),s=null==(s=null==(i=this.overrideAdapter)?void 0:i.getDynamicConfigOverride)?void 0:s.call(i,n,this.ji,e),i=null!=s?s:n;return this.Fe(t,(0,l.ze)(this.ji,i,this.Oi.getExposureMapping()),e),this.$emt({name:"dynamic_config_evaluation",dynamicConfig:i}),i}pi(t,e){var{result:i,details:n}=this.Oi.getConfig(t),n=(0,l.Ge)(t,n,i),s=(null!=n.__evaluation&&(n.__evaluation.secondary_exposures=(0,l.qe)(null!=(i=null==(i=n.__evaluation)?void 0:i.secondary_exposures)?i:[],this.Oi.getExposureMapping())),null==(s=null==(i=this.overrideAdapter)?void 0:i.getExperimentOverride)?void 0:s.call(i,n,this.ji,e)),i=null!=s?s:n;return this.Fe(t,(0,l.ze)(this.ji,i,this.Oi.getExposureMapping()),e),this.$emt({name:"experiment_evaluation",experiment:i}),i}bi(){return this.Oi.getConfigList()}yi(e,i){var{result:t,details:n}=this.Oi.getLayer(e),n=(0,l.Ve)(e,n,t),s=null==(s=null==(t=this.overrideAdapter)?void 0:t.getLayerOverride)?void 0:s.call(t,n,this.ji,i);null!=i&&i.disableExposureLog&&this.Re.incrementNonExposureCount(e);const r=(0,l.$e)(n,s,null!=(t=null==s?void 0:s.__value)?t:n.__value,t=>{null!=i&&i.disableExposureLog||this.Fe(e,(0,l.Le)(this.ji,r,t,this.Oi.getExposureMapping()),i)});return this.$emt({name:"layer_evaluation",layer:r}),r}mi(t,e){var{result:i,details:n}=this.Oi.getParamStore(t),t=(this.Re.incrementNonExposureCount(t),{name:t,details:n,__configuration:i,get:(0,s.vi)(this,i,e)}),i=null==(i=null==(n=this.overrideAdapter)?void 0:n.getParamStoreOverride)?void 0:i.call(n,t,e);return null!=i&&(t.__configuration=i.config,t.details=i.details,t.get=(0,s.vi)(this,i.config,e)),t}}e.default=n},4131:function(t,e,i){var r=this&&this.__awaiter||$A();$Q(e),e.StatsigEvaluationsDataAdapter=void 0;const n=i(6914),s=i(8448);class l extends n.DataAdapterCore{constructor(){super("EvaluationsDataAdapter","evaluations"),this.ft=null,this.O=null}attach(t,e,i){super.attach(t,e,i),null!==i&&i instanceof s.default?this.ft=i:this.ft=new s.default(null!=e?e:{})}getDataAsync(t,e,i){return this.C(t,(0,n.D)(e,this.O),i)}prefetchData(t,e){return this.U(t,e)}setData(t){var e=(0,n.P)(t,"has_updates","data");e&&"user"in e?super.setData(t,e.user):n.Log.error("StatsigUser not found. You may be using an older server SDK version. Please upgrade your SDK or use setDataLegacy.")}setDataLegacy(t,e){super.setData(t,e)}F(e,i,n,s){return r(this,void 0,void 0,function*(){var t=yield null==(t=this.ft)?void 0:t.fetchEvaluations(this.N(),e,null==n?void 0:n.priority,i,s);return null!=t?t:null})}I(t){t=(0,n.o)(this.N(),t,null==(t=this.O)?void 0:t.customUserCacheKeyFunc);return`${n.DataAdapterCachePrefix}.${this.m}.`+t}A(t,e){return null!=t.fullUserHash&&t.fullUserHash===(0,n._)(e)}}e.StatsigEvaluationsDataAdapter=l},140:(t,e,i)=>{$Q(e),e.V1InitializeContainer=void 0;const n=i(6914);e.V1InitializeContainer=class{constructor(t){this.ti=t}getGate(t){return this.Ni(this.ti.feature_gates,t)}getConfig(t){return this.Ni(this.ti.dynamic_configs,t)}getLayer(t){return this.Ni(this.ti.layer_configs,t)}getParamStore(t){return this.Ni(this.ti.param_stores,t)}getConfigList(){return Object.keys(this.ti.dynamic_configs)}getExposureMapping(){return this.ti.exposures}Ni(t,e){var i;return t&&null!=(i=null!=(i=t[e])?i:t[(0,n.h)(e)])?i:null}}},7095:(t,e,i)=>{$Q(e),e.V2InitializeContainer=void 0;const n=i(6914);e.V2InitializeContainer=class{constructor(t){this.ti=t}getGate(t){var e=this.Ni(this.ti.feature_gates,t);return e?{name:t,value:!0===e.v,rule_id:null!=(t=e.r)?t:"default",secondary_exposures:null!=(t=e.s)?t:[],id_type:null!=(t=e.i)?t:""}:null}getConfig(t){var e=this.Ni(this.ti.dynamic_configs,t);return e?{name:t,value:null!=(t=this.ti.values[e.v])?t:{},rule_id:e.r,secondary_exposures:null!=(t=e.s)?t:[],id_type:null!=(t=e.i)?t:"",is_user_in_experiment:!0===e.ue,passed:!0===e.p,group_name:null!=(t=e.gn)?t:void 0,is_experiment_active:!0===e.ea,group:e.r,is_device_based:"stableID"===e.i}:null}getLayer(t){var e=this.Ni(this.ti.layer_configs,t);return e?{name:t,value:null!=(t=this.ti.values[e.v])?t:{},rule_id:e.r,secondary_exposures:null!=(t=e.s)?t:[],is_user_in_experiment:!0===e.ue,group_name:null!=(t=e.gn)?t:void 0,is_experiment_active:!0===e.ea,group:e.r,is_device_based:"stableID"===e.i,allocated_experiment_name:null!=(t=e.ae)?t:"",explicit_parameters:null!=(t=e.ep)?t:[],undelegated_secondary_exposures:null!=(t=e.us)?t:[],parameter_rule_ids:e.pr}:null}getParamStore(t){return this.Ni(this.ti.param_stores,t)}getConfigList(){return Object.keys(this.ti.dynamic_configs)}getExposureMapping(){return this.ti.exposures}Ni(t,e){var i;return t&&null!=(i=null!=(i=t[e])?i:t[(0,n.h)(e)])?i:null}}},2018:function(t,e,i){var n=this&&this.__createBinding||(Object.create?function(t,e,i,n){void 0===n&&(n=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&("get"in s?e.__esModule:!s.writable&&!s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),$Q2(t,n,s)}:function(t,e,i,n){t[n=void 0===n?i:n]=e[i]}),s=this&&this.__exportStar||function(t,e){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(e,i)||n(e,t,i)},r=($Q(e),e.StatsigClient=void 0,i(6914)),l=i(8198),s=(e.StatsigClient=l.default,s(i(6914),e),$P((0,r.l)(),{StatsigClient:l.default}));e.default=s}},n={};function s(t){var e=n[t];return void 0!==e||(e=n[t]={exports:{}},i[t].call(e.exports,e,e.exports,s)),e.exports}return s.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),s(9296).default})());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@statsig/js-client",
|
|
3
|
-
"version": "3.30.
|
|
3
|
+
"version": "3.30.2",
|
|
4
4
|
"license": "ISC",
|
|
5
5
|
"homepage": "https://github.com/statsig-io/js-client-monorepo",
|
|
6
6
|
"repository": {
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"directory": "packages/js-client"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@statsig/client-core": "3.30.
|
|
12
|
+
"@statsig/client-core": "3.30.2"
|
|
13
13
|
},
|
|
14
14
|
"jsdelivr": "./build/statsig-js-client.min.js",
|
|
15
15
|
"type": "commonjs",
|
package/src/StatsigClient.js
CHANGED
|
@@ -235,11 +235,18 @@ class StatsigClient extends client_core_1.StatsigClientBase {
|
|
|
235
235
|
* @returns {PrecomputedEvaluationsContext} The current synchronous context for the this StatsigClient instance.
|
|
236
236
|
*/
|
|
237
237
|
getContext() {
|
|
238
|
+
let user = {};
|
|
239
|
+
try {
|
|
240
|
+
user = JSON.parse(JSON.stringify(this._user));
|
|
241
|
+
}
|
|
242
|
+
catch (_a) {
|
|
243
|
+
client_core_1.Log.error('Failed to parse user');
|
|
244
|
+
}
|
|
238
245
|
return {
|
|
239
246
|
sdkKey: this._sdkKey,
|
|
240
247
|
options: this._options,
|
|
241
248
|
values: this._store.getValues(),
|
|
242
|
-
user
|
|
249
|
+
user,
|
|
243
250
|
errorBoundary: this._errorBoundary,
|
|
244
251
|
session: client_core_1.StatsigSession.get(this._sdkKey),
|
|
245
252
|
stableID: client_core_1.StableID.get(this._sdkKey),
|