New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@statsig/js-client

Package Overview
Dependencies
Maintainers
4
Versions
105
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@statsig/js-client - npm Package Compare versions

Comparing version 1.8.0-beta.13 to 1.8.0-beta.14

2

build/statsig-js-client.min.js

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

!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 $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())})});var i={845:(t,i,e)=>{$Q2(i,"__esModule",{value:!0}),i.t=i.i=i.o=void 0,i.o=()=>__STATSIG__||u,i.i=t=>(0,i.o)()[t];i.t=t=>{var e=(0,i.o)();return t?e.instances&&e.instances[t]:e.lastInstance};var n,s="__STATSIG__",r="undefined"!=typeof window?window:{},e=void 0!==e.g?e.g:{},o="undefined"!=typeof globalThis?globalThis:{};const u=null!=(n=null!=(n=null!=(n=r[s])?n:e[s])?n:o[s])?n:{instance:i.t};r[s]=u,e[s]=u,o[s]=u},137:(t,e,i)=>{$Q(e),e.u=e.l=void 0;const s=i(406);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.l=n,e.u=function(t,e,i){return e?n(t,e,i):(0,s.h)("k:"+t)}},427:(t,e)=>{$Q(e)},694:function(t,e,i){var s=this&&this.__awaiter||$A();$Q(e),e.DataAdapterCore=void 0;const l=i(512),a=i(122),r=i(578),o=i(534),c=i(401);function h(t,e,i,n){return{source:t,data:e,receivedAt:Date.now(),stableID:i,fullUserHash:(0,r.v)(n)}}e.DataAdapterCore=class{constructor(t,e){this._=t,this.m=e,this.p=null,this.S=null,this.O="statsig.last_modified_time."+e,this.j=new n}attach(t,e){this.S=t,this.p=e}getDataSync(t){var t=t&&(0,r.A)(t,this.p),e=this.T(t),i=this.j.get(e,t);return i||((i=this.I(e))?(this.j.add(e,i),this.j.get(e,t)):null)}setData(t,e){var e=e&&(0,r.A)(e,this.p),i=this.T(e);this.j.add(i,h("Bootstrap",t,null,e))}__primeInMemoryCache(t){this.j.merge(t)}M(e,i,n){return s(this,void 0,void 0,function*(){var t=null!=e?e:this.getDataSync(i),t=[this.D(t,i,n)];return null!=n&&n.timeoutMs&&t.push(new Promise(t=>setTimeout(t,n.timeoutMs)).then(()=>(l.Log.debug("Fetching latest value timed out"),null))),yield Promise.race(t)})}k(i,n){return s(this,void 0,void 0,function*(){var t=i&&(0,r.A)(i,this.p),e=this.T(t),t=yield this.M(null,t,n);t&&this.j.add(e,$P($P({},t),{source:"Prefetch"}))})}D(r,o,u){return s(this,void 0,void 0,function*(){let t=null;r&&this.R(r,o)&&(t=r.data);var e=yield this.N(t,o,u);if(!e)return l.Log.debug("No response returned for latest value"),null;var i=(0,c.C)(e,"has_updates","Response"),n=this.P(),n=yield a.StableID.get(n);let s=null;if(!0===(null==i?void 0:i.has_updates))s=h("Network",e,n,o);else{if(!t||!1!==(null==i?void 0:i.has_updates))return null;s=h("NetworkNotModified",t,n,o)}e=this.T(o);return this.j.add(e,s),yield this.G(e,s),s})}P(){return null!=this.S?this.S:(l.Log.error(this._+" is not attached to a Client"),"")}I(t){var e=null==(e=o.Storage.ce)?void 0:e.call(o.Storage,t);return null!=e&&(t=(0,c.C)(e,"source","Cached Result"))?$P($P({},t),{source:"Cache"}):null}G(t,e){return s(this,void 0,void 0,function*(){yield o.Storage.L(t,JSON.stringify(e)),yield this.K(t)})}K(i){var n;return s(this,void 0,void 0,function*(){var t=null!=(n=yield(0,o.F)(this.O))?n:{},e=(t[i]=Date.now(),u(t,10));e&&(delete t[e],yield o.Storage.q(e)),yield(0,o.J)(this.O,t)})}};class n{constructor(){this.V={}}get(t,e){var t=this.V[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?(l.Log.warn("'StatsigUser.customIDs.stableID' mismatch"),null):t}add(t,e){var i=u(this.V,9);i&&delete this.V[i],this.V[t]=e}merge(t){this.V=$P($P({},this.V),t)}}function u(s,t){var e=Object.keys(s);return e.length<=t?null:e.reduce((t,e)=>{var i=s[t],n=s[e];return"object"==typeof i&&"object"==typeof n?n.receivedAt<i.receivedAt?e:t:n<i?e:t})}},962:(t,r)=>{$Q2(r,"__esModule",{value:!0}),r.Diagnostics=void 0;const n=new Map,i="start";function s(t,e){return $P({key:"initialize",action:e,timestamp:Date.now()},t)}function o(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]}r.Diagnostics={_i:t=>n.get(t),gi:t=>{o(t,s({},i))},bi:(t,e,i)=>{o(t,s({success:e,error:e?void 0:{name:"InitializeError",message:"Failed to initialize"},evaluationDetails:i},"end"))},mi:(t,e)=>{o(t,s(e,i))},pi:(t,e)=>{o(t,s(e,"end"))},yi:t=>{o(t,s({},i))},Oi:(t,e)=>{o(t,s(e,"end"))},Si:t=>{n.delete(t)},ji(t){if(t&&"object"==typeof t)return{code:e(t,"code"),name:e(t,"name"),message:e(t,"message")}},Ti(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:r.Diagnostics.ji(n)}},wi(t,e,i,n){var s=r.Diagnostics._i(i);null==s||s.length<=0||(r.Diagnostics.Si(i),i=function(t,e){t={eventName:"statsig::diagnostics",user:t,value:null,metadata:e,time:Date.now()};return t}(t,{context:"initialize",markers:s.slice(),statsigOptions:n}),e.enqueue(i))}}},539:(t,e)=>{$Q(e)},542:function(t,u,e){var i=this&&this.__awaiter||$A();$Q2(u,"__esModule",{value:!0}),u.ErrorBoundary=u.EXCEPTION_ENDPOINT=void 0;const n=e(512),l=e(902),a=e(0),c=(u.EXCEPTION_ENDPOINT="https://statsigapi.net/v1/sdk_exception","[Statsig] UnknownError");u.ErrorBoundary=class{constructor(t,e,i){this.S=t,this.p=e,this.B=i,this.$=new Set}wrap(n){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.H(e,()=>i.apply(n,t)),t[e].$EB=!0)})}catch(t){this.W("eb:wrap",t)}}logError(t,e){this.W(t,e)}H(e,t){try{var i=t();return i&&i instanceof Promise?i.catch(t=>this.W(e,t)):i}catch(t){return this.W(e,t),null}}W(r,o){try{n.Log.warn("Caught error in "+r,{error:o});i(this,void 0,void 0,function*(){var t,e,i=o||Error(c),n=i instanceof Error,s=n?i.name:"No Name";this.$.has(s)||(this.$.add(s),null!=(t=null==(t=this.p)?void 0:t.networkConfig)&&t.preventAllNetworkTraffic?null!=(t=this.B)&&t.call(this,{name:"error",error:o}):(t=l.SDKType.Y(this.S),e=a.StatsigMetadataProvider.get(),n=n?i.stack:function(t){try{return JSON.stringify(t)}catch(t){return c}}(i),i=JSON.stringify($P({tag:r,exception:s,info:n},$P($P({},e),{sdkType:t}))),yield(null!=(s=null==(n=null==(s=this.p)?void 0:s.networkConfig)?void 0:n.networkOverrideFunc)?s:fetch)(u.EXCEPTION_ENDPOINT,{method:"POST",headers:{"STATSIG-API-KEY":this.S,"STATSIG-SDK-TYPE":String(t),"STATSIG-SDK-VERSION":String(e.sdkVersion),"Content-Type":"application/json"},body:i}),null!=(n=this.B)&&n.call(this,{name:"error",error:o})))}).then(()=>{}).catch(()=>{})}catch(t){}}}},922:(t,e)=>{$Q(e)},417:(t,e)=>{$Q(e)},770:function(t,e,i){var n=this&&this.__awaiter||$A();$Q(e),e.EventLogger=void 0;const s=i(137),r=i(406),o=i(512),u=i(410),l=i(830),a=i(637),c=i(534),h=i(638),d=i(397),v={},f=t=>{null!=(t=v[t])&&t.flush().catch(()=>{})};e.EventLogger=class{constructor(t,e,i,n){this.S=t,this.B=e,this.X=i,this.p=n,this.Z=[],this.tt={},this.et={},this.it=!1,this.nt=Date.now(),this.st=!0===(null==n?void 0:n.disableLogging),this.rt=null!=(t=null==n?void 0:n.loggingBufferMaxSize)?t:50;e=null==n?void 0:n.networkConfig;this.ot=(0,h.ut)(null==e?void 0:e.logEventUrl,null==e?void 0:e.api,"/rgstr",u.NetworkDefault.eventsApi)}setLoggingDisabled(t){this.st=t}enqueue(t){this.dt(t)&&(this.vt(t),this.ft(),this.Z.length>this.rt)&&f(this.S)}incrementNonExposureCount(t){var e=null!=(e=this.et[t])?e:0;this.et[t]=e+1}reset(){this.tt={}}start(){(0,l.Mt)()||(v[this.S]=this,(0,d.lt)(t=>{"background"===t&&f(this.S)}),this.ct(),this.ht())}stop(){return n(this,void 0,void 0,function*(){this._t&&(clearInterval(this._t),this._t=null),yield this.flush()})}flush(){return n(this,void 0,void 0,function*(){var t;if(this.gt(),0!==this.Z.length)return t=this.Z,this.Z=[],this.bt(t)})}ft(){this.it||(this.it=!0,200<Date.now()-this.nt)||setTimeout(()=>f(this.S),200)}dt(t){if((0,l.Mt)())return!1;if((0,a.yt)(t)){var e=t.user||{statsigEnvironment:void 0},e=(0,s.l)(this.S,e),i=t.metadata||{},t=[t.eventName,e,i.gate,i.config,i.ruleID].join("|"),e=this.tt[t],i=Date.now();if(e&&i-e<6e4)return!1;1e3<Object.keys(this.tt).length&&(this.tt={}),this.tt[t]=i}return!0}bt(t){var e,i;return n(this,void 0,void 0,function*(){if(this.st)this.St(t);else try{(!(0,d.Ot)()&&this.X.isBeaconSupported()&&null==(null==(i=null==(e=this.p)?void 0:e.networkConfig)?void 0:i.networkOverrideFunc)?yield this.jt(t):yield this.Tt(t)).success?this.B({name:"logs_flushed",events:t}):this.St(t)}catch(t){o.Log.warn("Failed to flush events.")}})}Tt(e){var i;return n(this,void 0,void 0,function*(){var t=yield this.X.post(this.wt(e)),t=null!=(i=null==t?void 0:t.code)?i:-1;return{success:200<=t&&t<300}})}jt(t){return n(this,void 0,void 0,function*(){return{success:yield this.X.beacon(this.wt(t))}})}wt(t){return{sdkKey:this.S,data:{events:t},url:this.ot,retries:3,isCompressable:!0,params:{[u.NetworkParam.EventCount]:String(t.length)}}}St(t){for(;500<t.length;)t.shift();var e=this.u();try{(0,c.J)(e,t)}catch(t){o.Log.warn("Unable to save failed logs to storage")}}ct(){const e=this.u();n(this,void 0,void 0,function*(){var t=(0,c.F)(e);t&&(c.Storage.q(e),yield this.bt(t))}).catch(()=>{o.Log.warn("Failed to flush stored logs")})}u(){return"statsig.failed_logs."+(0,r.h)(this.S)}vt(t){t.user&&(t.user=$P({},t.user),delete t.user.privateAttributes);var e={},i=this.It(),i=(i&&(e.statsigMetadata={currentPage:i}),$P($P({},t),e));o.Log.debug("Enqueued Event:",i),this.Z.push(i)}gt(){0!==Object.keys(this.et).length&&(this.vt({eventName:"statsig::non_exposed_checks",user:null,time:Date.now(),metadata:{checks:$P({},this.et)}}),this.et={})}It(){var t;if(!1!==(null==(t=this.p)?void 0:t.includeCurrentPageUrlWithEvents))return(0,l.At)()}ht(){var t=null!=(t=null==(t=this.p)?void 0:t.loggingIntervalMs)?t:1e4;const e=setInterval(()=>{v[this.S]._t!==e?clearInterval(e):f(this.S)},t);this._t=e}}},406:(t,r,e)=>{$Q2(r,"__esModule",{value:!0}),r.xt=r.Dt=r.h=void 0;const o=e(634);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.Dt=(t,e)=>(0,r.h)(JSON.stringify((0,r.xt)(t,e)));r.xt=(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,o.kt)(e)?s[t]=e:s[t]=(0,r.xt)(e,null!=n?n-1:n)}),s}},333:(t,e)=>{$Q(e)},512:(t,e)=>{function i(t){return t.unshift("[Statsig]"),t}var n,s;$Q(e),e.Log=e.LogLevel=void 0,(s=n||(e.LogLevel=n={}))[s.None=0]="None",s[s.Error=1]="Error",s[s.Warn=2]="Warn",s[s.Info=3]="Info",s[s.Debug=4]="Debug";class r{static info(...t){this.level>=n.Info&&console.info(...i(t))}static debug(...t){this.level>=n.Debug&&console.debug(...i(t))}static warn(...t){this.level>=n.Warn&&console.warn(...i(t))}static error(...t){this.level>=n.Error&&console.error(...i(t))}}(e.Log=r).level=n.Error},410:(t,e)=>{$Q(e),e.NetworkParam=e.NetworkDefault=void 0,e.NetworkDefault={eventsApi:"https://statsigapi.net/v1",initializeApi:"https://statsigapi.net/v1",specsApi:"https://statsigapi.net/v1"},e.NetworkParam={EventCount:"ec",SdkKey:"k",SdkType:"st",SdkVersion:"sv",Time:"t",SessionID:"sid",StatsigEncoded:"se",IsGzipped:"gz"}},404:function(t,e,i){var r=this&&this.__awaiter||$A();$Q(e),e.NetworkCore=void 0,i(845);const o=i(845),b=i(962),m=i(512),u=i(410),n=i(894),l=i(902),a=i(830),c=i(143),h=i(122),d=i(0),O=i(397),j=new Set([408,500,502,503,504,522,524,599]);e.NetworkCore=class{constructor(t,e){this.B=e,this.Et=1e4,this.Rt={},this.p={},this.networkEvents=[],this.sdkKey=null,t&&(this.p=t),this.p.networkConfig&&(this.Rt=this.p.networkConfig),this.Rt.networkTimeoutMs&&(this.Et=this.Rt.networkTimeoutMs),this.Ii=new n.NetworkProxy(this.p),this._n()}post(i){return r(this,void 0,void 0,function*(){var t=this.ki(i);this.sdkKey||(this.sdkKey=i.sdkKey);let e=yield this.Nt($P($P({},i),t));return i.isStatsigEncodable&&(e=this.Ct(i,e)),this.Pt($P($P({method:"POST",body:e},t),i))})}get(t){return this.sdkKey||(this.sdkKey=t.sdkKey),this.Pt($P({method:"GET"},t))}isBeaconSupported(){return"undefined"!=typeof navigator&&"function"==typeof navigator.sendBeacon}beacon(n){return r(this,void 0,void 0,function*(){var t,e,i;return!!S(n)&&(e=this.ki(n),t=yield this.Nt($P($P({},n),e)),e=yield this.Gt($P($P({},n),e)),(i=navigator).sendBeacon.bind(i)(e,t))})}Pt(g){var p,y;return r(this,void 0,void 0,function*(){if(!S(g))return null;if(this.Rt.preventAllNetworkTraffic)return null;var{method:e,body:i,retries:n,attempt:s}=g,s=null!=s?s:1;const r="undefined"!=typeof AbortController?new AbortController:null;var t=setTimeout(()=>{null!==r&&void 0!==r&&r.abort(`Timeout of ${this.Et}ms expired.`)},this.Et),o=null!=(y=g.proxyUrl)?y:this.Ii.getProxyUrl(g.sdkKey,g.url),o=(console.log("1"),yield this.Gt($P({proxyUrl:o},g))),u=(console.log("2"),!o.includes("https://statsigapi.net/v1")),l=new URL(o).pathname;let a=null;var c=(0,O.Ut)();console.log("3");try{var h,d,v,f={method:e,body:i,headers:$P({},g.headers),signal:null===r||void 0===r?void 0:r.signal,priority:g.priority,keepalive:c},_=(console.log("3"),g.isInitialize&&b.Diagnostics.mi(g.sdkKey,{attempt:s}),null!=(p=this.Rt.networkOverrideFunc)?p:fetch);if(a=yield _(o,f),clearTimeout(t),console.log("4"),a.ok)return v=yield a.text(),g.isInitialize&&b.Diagnostics.pi(g.sdkKey,b.Diagnostics.Ti(a,s,v)),console.log("network success!!"),o.includes("https://prodregistryv2.org")||(console.log("pushing success network event!!"),this.networkEvents.push({value:u?"proxy":"statsig",eventName:"proxy::network_request_tracking",metadata:{url:o,success:!0,endpoint:l},time:Date.now(),user:null})),{body:v,code:a.status};throw h=yield a.text().catch(()=>"No Text"),d=new Error(`NetworkError: ${o} `+h),console.log("response not ok!!",d),d.name="NetworkError",d}catch(t){console.log("network error!!",t),o.includes("https://prodregistryv2.org")||(console.log("pushing failure network event!!"),this.networkEvents.push({value:u?"proxy":"statsig",eventName:"proxy::network_request_tracking",metadata:{url:o,success:!1,endpoint:l},time:Date.now(),user:null}));i=function(t,e){if(null!=t&&t.signal.aborted&&"string"==typeof t.signal.reason)return t.signal.reason;if("string"==typeof e)return e;if(e instanceof Error)return e.name+": "+e.message;return"Unknown Error"}(r,t),c=function(t){t=(null==t?void 0:t.signal.aborted)&&"string"==typeof t.signal.reason&&t.signal.reason.includes("Timeout");return t||!1}(r);return g.isInitialize&&b.Diagnostics.pi(g.sdkKey,b.Diagnostics.Ti(a,s,"",t)),yield this.Ii.attemptToUpdateProxyUrl(g.sdkKey,i,c),!n||n<s||!j.has(null!=(y=null===a||void 0===a?void 0:a.status)?y:500)?(null!=(y=this.B)&&y.call(this,{name:"error",error:t}),m.Log.error(`A networking error occured during ${e} request to ${o}.`,i,t),null):this.Pt($P($P({},g),{retries:n,attempt:s+1}))}})}Gt(n){var s;return r(this,void 0,void 0,function*(){var t=null!=(s=n.proxyUrl)?s:n.url;const e=$P({[u.NetworkParam.SdkKey]:n.sdkKey,[u.NetworkParam.SdkType]:l.SDKType.Y(n.sdkKey),[u.NetworkParam.SdkVersion]:d.SDK_VERSION,[u.NetworkParam.Time]:String(Date.now()),[u.NetworkParam.SessionID]:yield c.SessionID.get(n.sdkKey)},n.params);var i=Object.keys(e).map(t=>encodeURIComponent(t)+"="+encodeURIComponent(e[t])).join("&");return t+(i?"?"+i:"")})}Nt(s){return r(this,void 0,void 0,function*(){var{data:t,sdkKey:e}=s,i=yield h.StableID.get(e),n=yield c.SessionID.get(e),e=l.SDKType.Y(e);return JSON.stringify($P($P({},t),{statsigMetadata:$P($P({},d.StatsigMetadataProvider.get()),{stableID:i,sessionID:n,sdkType:e,proxyUrl:s.proxyUrl})}))})}Ct(t,e){var i,n,s=(0,a.Lt)();if(!t.isStatsigEncodable||this.p.disableStatsigEncoding||null!=(0,o.i)("no-encode")||null==s||!s.btoa)return e;try{var r=null!=(i=s.btoa(e).split("").reverse().join(""))?i:e;return t.params=$P($P({},null!=(n=t.params)?n:{}),{[u.NetworkParam.StatsigEncoded]:"1"}),r}catch(t){return m.Log.warn("/initialize request encoding failed"),e}}ki(t){t=this.Ii.getProxyUrl(t.sdkKey,t.url);return{proxyUrl:null!=t?t:null}}gn(){var t;console.log("flushing network events!!",this.networkEvents),0!==this.networkEvents.length&&(this.post({sdkKey:null!=(t=this.sdkKey)?t:"",url:"https://prodregistryv2.org/v1/rgstr",data:{events:[...this.networkEvents]}}),this.networkEvents=[])}_n(){setInterval(()=>{this.gn()},1e4)}};const S=t=>!!t.sdkKey||(m.Log.warn("Unable to make request without an SDK key"),!1)},894:function(t,e,i){var r=this&&this.__awaiter||$A();$Q(e),e.NetworkProxy=void 0;const n=i(406),s=i(410),o=i(534),u=i(401);function l(t){return"statsig.proxy."+(0,n.h)(t)}e.NetworkProxy=class{constructor(t){this.p=t,this.xi=null,this.Di=0,this.Ai=void 0,t.networkConfig&&(t=t.networkConfig,this.setOverrideFunc(t.networkOverrideFunc))}setOverrideFunc(t){this.Ai=t}getProxyUrl(t,e){return function(t){for(const e in s.NetworkDefault)if(t.startsWith(s.NetworkDefault[e]))return 1;return}(e)?(e=function(t){try{return new URL(t).pathname.substring(1)}catch(t){return""}}(e),0<this.Di&&Date.now()>this.Di?(this.xi=null,this.Di=0,this.xi):this.xi?this.xi+e:(t=function(t){t=o.Storage.ce(t);if(t){t=(0,u.C)(t,"url","cacheProxy");if(t&&Date.now()<t.expiryTime)return t}return null}(l(t)))?(this.xi=t.url,this.Di=t.expiryTime,this.xi+e):null):null}attemptToUpdateProxyUrl(i,n,s){return r(this,void 0,void 0,function*(){var t,e;(function(t,e){t=(null==t?void 0:t.toLowerCase())||"";return e||t.includes("uncaught exception")||t.includes("failed to fetch")||t.includes("networkerror when attempting to fetch resource")})(n,s)&&(t=l(i),e=yield this.Mi())&&(this.xi=e,this.Di=Date.now()+2592e5,o.Storage.L(t,JSON.stringify({url:this.xi,expiryTime:this.Di})))})}Mi(){return r(this,void 0,void 0,function*(){var t,e=yield this.Ei("featureregistry.org");return 0!==e.length&&([e,t]=function(t){let e=1440,i=0;var n=[],s=(new Date).getTimezoneOffset()+720;for(const u of t){var[r,o]=u.split("="),o=(n.push(o),null==r?void 0:r.split("_")[1]),r=parseInt(o);r&&!Number.isNaN(r)&&(o=Math.abs(r-s))<e&&(i=n.length-1,e=o)}return[n,i]}(e=e),0!==e.length)?e.length>t?e[t]:e[0]:null})}Ei(t){var u;return r(this,void 0,void 0,function*(){var e=function(t){var e=[0,0,1,0,0,1,0,0,0,0,0,0],t=t.split(".");for(const i of t){e.push(i.length);for(const n of i)e.push(n.charCodeAt(0))}return e.push(0,0,16,0,1),Uint8Array.from(e)}(t),e=yield(null!=(u=this.Ai)?u:fetch)("https://cloudflare-dns.com/dns-query",{method:"POST",headers:{"Content-Type":"application/dns-message",Accept:"application/dns-message"},body:e});if(e.ok){e=yield e.arrayBuffer();{var i=Array.from(new Uint8Array(e));let t=i.indexOf(192);for(var n=[];-1<t&&t<i.length-2;){var s=i[t+1];if(i.length<t+s+1)break;var r=i[t+s],o=i.slice(t+s+1,t+s+r+1);n.push(o.map(t=>String.fromCharCode(t)).join("")),t=i.indexOf(192,t+s+r)}return n}}return[]})}}},405:(t,e)=>{$Q(e)},361:(t,e)=>{$Q(e)},902:(t,e)=>{$Q(e),e.SDKType=void 0;const i={};let n;e.SDKType={Y:t=>{return(null!=(t=i[t])?t:"js-mono")+(null!==n&&void 0!==n?n:"")},Kt(t,e){i[t]=e},Ft(t){n&&"-react"!==n||(n="-"+t)}}},830:(t,n)=>{$Q2(n,"__esModule",{value:!0}),n.At=n.qt=n.zt=n.Mt=n.Jt=n.Lt=void 0;n.Lt=()=>"undefined"!=typeof window?window:null,n.Jt=()=>{var t=(0,n.Lt)();return null!=(t=null==t?void 0:t.document)?t:null},n.Mt=()=>{var t;return null===(0,n.Jt)()&&(t="undefined"!=typeof process&&null!=process.versions&&null!=process.versions.node,"string"==typeof EdgeRuntime||t)},n.zt=(t,e)=>{var i=(0,n.Lt)();"function"==typeof(null==i?void 0:i.addEventListener)&&i.addEventListener(t,e)},n.qt=(t,e)=>{var i=(0,n.Jt)();"function"==typeof(null==i?void 0:i.addEventListener)&&i.addEventListener(t,e)};n.At=()=>{var t;try{return null==(t=(0,n.Lt)())?void 0:t.location.href.split(/[?#]/)[0]}catch(t){}}},143:(t,e,i)=>{$Q(e),e.StatsigSession=e.SessionID=void 0;const n=i(137),r=i(512),o=i(534),u=i(23),l=18e5,a=144e5,c={};function h(e,t){return setTimeout(()=>{var t=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instance(e);t&&t.$emt({name:"session_expired"})},t)}function d(t){return"statsig.session_id."+(0,n.u)(t)}e.SessionID={get:t=>e.StatsigSession.get(t).data.sessionID},e.StatsigSession={get:t=>{null==c[t]&&(c[t]=function(t){let e=function(t){t=d(t);return(0,o.F)(t)}(t);var i=Date.now();e=e||{sessionID:(0,u.getUUID)(),startTime:i,lastUpdate:i};return{data:e,sdkKey:t}}(t));var t=c[t],e=Date.now(),i=t.data,n=((function({lastUpdate:t}){return Date.now()-t>l}(i)||function({startTime:t}){return Date.now()-t>a}(i))&&(i.sessionID=(0,u.getUUID)(),i.startTime=e),i.lastUpdate=e,i),s=t.sdkKey;s=d(s);try{(0,o.J)(s,n)}catch(t){r.Log.warn("Failed to save SessionID")}return clearTimeout(t.idleTimeoutID),clearTimeout(t.ageTimeoutID),e-=i.startTime,i=t.sdkKey,t.idleTimeoutID=h(i,l),t.ageTimeoutID=h(i,a-e),t},overrideInitialSessionID:(t,e)=>{var i;c[e]=(t=t,e=e,i=Date.now(),{data:{sessionID:t,startTime:i,lastUpdate:i},sdkKey:e})}}},122:(t,e,i)=>{$Q(e),e.StableID=void 0;const n=i(137),s=i(512),r=i(534),o=i(23),u={};function l(t){return"statsig.stable_id."+(0,n.u)(t)}function a(t,e){e=l(e);try{(0,r.J)(e,t)}catch(t){s.Log.warn("Failed to save StableID")}}e.StableID={get:e=>{if(null==u[e]){let t=function(t){t=l(t);return(0,r.F)(t)}(e);null==t&&a(t=(0,o.getUUID)(),e),u[e]=t}return u[e]},setOverride:(t,e)=>{a(u[e]=t,e)}}},375:function(t,e,i){var n=this&&this.__awaiter||$A();$Q(e),e.StatsigClientBase=void 0,i(845);const o=i(845),u=i(542),l=i(770),a=i(512),c=i(830),h=i(143),d=i(534);e.StatsigClientBase=class{constructor(t,e,i,n){this.loadingStatus="Uninitialized",this.Vt={};var s,r=this.$emt.bind(this);null!=(null==n?void 0:n.logLevel)&&(a.Log.level=n.logLevel),null!=n&&n.disableStorage&&d.Storage.Bt(!0),null!=n&&n.initialSessionID&&h.StatsigSession.overrideInitialSessionID(n.initialSessionID,t),this.S=t,this.p=null!=n?n:{},this.overrideAdapter=null!=(s=null==n?void 0:n.overrideAdapter)?s:null,this.Ht=new l.EventLogger(t,r,i,n),this.Wt=new u.ErrorBoundary(t,n,r),this.Wt.wrap(this),this.Wt.wrap(i),this.Wt.wrap(e),this.Wt.wrap(this.Ht),(0,c.Mt)()||(null!=(i=null!=(r=(s=(0,o.o)()).instances)?r:{})[t]&&a.Log.warn("Creating multiple Statsig clients with the same SDK key can lead to unexpected behavior. Multi-instance support requires different SDK keys."),i[t]=this,s.lastInstance=this,s.instances=i,__STATSIG__=s),this.dataAdapter=e,this.dataAdapter.attach(t,n),this.Yt()}updateRuntimeOptions(t){null!=t.disableLogging&&(this.p.disableLogging=t.disableLogging,this.Ht.setLoggingDisabled(t.disableLogging)),null!=t.disableStorage&&(this.p.disableStorage=t.disableStorage,d.Storage.Bt(t.disableStorage))}flush(){return this.Ht.flush()}shutdown(){return n(this,void 0,void 0,function*(){this.$emt({name:"pre_shutdown"}),yield this.Ht.stop()})}on(t,e){this.Vt[t]||(this.Vt[t]=[]),this.Vt[t].push(e)}off(t,e){this.Vt[t]&&-1!==(e=this.Vt[t].indexOf(e))&&this.Vt[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.Wt.logError("__emit:"+i.name,t):a.Log.error("An error occurred in a StatsigClientEvent listener. This is not an issue with Statsig.",i)}};this.Vt[i.name]&&this.Vt[i.name].forEach(t=>e(t)),null!=(t=this.Vt["*"])&&t.forEach(e)}Qt(t,e){this.loadingStatus=t,this.$emt({name:"values_updated",status:t,values:e})}Xt(t,e,i){!0===(null==i?void 0:i.disableExposureLog)?this.Ht.incrementNonExposureCount(t):this.Ht.enqueue(e)}}},636:(t,e)=>{$Q(e)},206:(t,e)=>{$Q(e),e.DataAdapterCachePrefix=void 0,e.DataAdapterCachePrefix="statsig.cached"},637:(t,e)=>{$Q(e),e.Zt=e.te=e.ee=e.yt=void 0;const i="statsig::config_exposure",n="statsig::gate_exposure",l=(t,e,i,n,s)=>({eventName:t,user:e,value:null,metadata:r(i,n),secondaryExposures:s,time:Date.now()});e.yt=({eventName:t})=>t===n||t===i,e.ee=(t,e)=>{return l(n,t,e.details,{gate:e.name,gateValue:String(e.value),ruleID:e.ruleID},null!=(e=null==(t=e.__evaluation)?void 0:t.secondary_exposures)?e:[])},e.te=(t,e)=>{return l(i,t,e.details,{config:e.name,ruleID:e.ruleID},null!=(e=null==(t=e.__evaluation)?void 0:t.secondary_exposures)?e:[])};e.Zt=(t,e,i)=>{var n,s=e.__evaluation,r=!0===(null==(r=null==s?void 0:s.explicit_parameters)?void 0:r.includes(i));let o="",u=null!=(n=null==s?void 0:s.undelegated_secondary_exposures)?n:[];return r&&(o=null!=(n=s.allocated_experiment_name)?n:"",u=s.secondary_exposures),l("statsig::layer_exposure",t,e.details,{config:e.name,parameterName:i,ruleID:e.ruleID,allocatedExperiment:o,isExplicitParameter:String(r)},u)};const r=(t,e)=>(e.reason=t.reason,t.lcut&&(e.lcut=String(t.lcut)),t.receivedAt&&(e.receivedAt=String(t.receivedAt)),e)},0:(t,e)=>{$Q(e),e.StatsigMetadataProvider=e.SDK_VERSION=void 0,e.SDK_VERSION="1.8.0-beta.13";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)},59:(t,e,i)=>{$Q(e),e.ie=e.ne=e.se=e.re=e.oe=e.ue=void 0;const r=i(634),s="default";function o(t,e,i,n){return{name:t,details:e,ruleID:null!=(t=null==i?void 0:i.rule_id)?t:s,__evaluation:i,value:n}}function n(t,e,i){var n=null!=(n=null==i?void 0:i.value)?n:{};return $P($P({},o(t,e,i,n)),{get:u(null==i?void 0:i.value)})}function u(n,s){return(t,e)=>{var i=null!=(i=null==n?void 0:n[t])?i:null;return null!=i&&(null==e||(0,r.le)(i,e))?(null!=s&&s(t),i):null!=e?e:null}}e.ue=function(t,e,i){return o(t,e,i,!0===(null==i?void 0:i.value))},e.oe=n,e.re=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.se=function(t,e,i,n){return $P($P({},o(t,e,i,void 0)),{get:u(null==i?void 0:i.value,n),groupName:null!=(t=null==i?void 0:i.group_name)?t:null,__value:null!=(e=null==i?void 0:i.value)?e:{}})},e.ne=function(t,e,i,n){return $P($P($P({},t),e),{get:u(i,n)})},e.ie=u},812:(t,e)=>{$Q(e)},578:(t,e,i)=>{$Q(e),e.v=e.A=void 0;const n=i(406),s=i(512);e.A=function(t,e){try{var i=JSON.parse(JSON.stringify(t));return null!=e&&null!=e.environment&&(i.statsigEnvironment=e.environment),i}catch(t){return s.Log.error("Failed to JSON.stringify user"),{statsigEnvironment:void 0}}},e.v=function(t){return t?(0,n.Dt)(t):null}},534:(t,i,e)=>{$Q2(i,"__esModule",{value:!0}),i.J=i.F=i.Storage=void 0;var n=e(512),e=e(830);const s={},r={ae:()=>"InMemory",ce:t=>s[t]||null,L:(t,e)=>{s[t]=e},q:t=>{delete s[t]},he:()=>Object.keys(s)};let o=null;try{const a=(0,e.Lt)();a&&a.localStorage&&"function"==typeof a.localStorage.getItem&&(o={ae:()=>"LocalStorage",ce:t=>a.localStorage.getItem(t),L:(t,e)=>a.localStorage.setItem(t,e),q:t=>a.localStorage.removeItem(t),he:()=>Object.keys(a.localStorage)})}catch(t){n.Log.warn("Failed to setup localStorageProvider.")}let u=null!==o&&void 0!==o?o:r,l=u;i.Storage={ae:()=>l.ae(),ce:t=>{var e=()=>l.ce(t);try{return e()}catch(t){if(t instanceof Error&&"SecurityError"===t.name)return i.Storage.de(r),null;throw t}},L:(t,e)=>l.L(t,e),q:t=>l.q(t),he:()=>l.he(),de:t=>{u=t,l=t},Bt:t=>{l=t?r:u}},i.F=function(t){return t=i.Storage.ce(t),JSON.parse(null!=t?t:"null")},i.J=function(t,e){i.Storage.L(t,JSON.stringify(e))}},401:(t,e,i)=>{$Q(e),e.C=void 0;const s=i(512);e.C=function(t,e,i){try{var n=JSON.parse(t);return"object"==typeof n&&0 in n,n}catch(t){}return s.Log.error("Failed to parse "+i),null}},634:(t,e)=>{$Q(e),e.le=e.kt=void 0,e.kt=function(t){return Array.isArray(t)?"array":typeof t},e.le=function(t,e){var i=t=>Array.isArray(t)?"array":typeof t;return i(t)===i(e)}},23:(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)})}},638:(t,e)=>{$Q(e),e.ut=void 0,e.ut=function(t,e,i,n){return t||(e?""+e+i:""+n+i)}},397:(t,e,i)=>{$Q(e),e.ve=e.lt=e.Ut=e.Ot=void 0;i=i(830);const n="foreground",s="background",r=[];let o=n,u=!1;e.Ot=()=>o===n,e.Ut=()=>u,e.lt=t=>{r.unshift(t)};e.ve=e=>{e!==o&&(o=e,r.forEach(t=>t(e)))},(0,i.zt)("focus",()=>{(u=!1,e.ve)(n)}),(0,i.zt)("blur",()=>(0,e.ve)(s)),(0,i.zt)("beforeunload",()=>{u=!0,(0,e.ve)(s)}),(0,i.qt)("visibilitychange",()=>{(0,e.ve)("visible"===document.visibilityState?n:s)})},914: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)};$Q(e),e.Diagnostics=e.Log=e.Storage=e.EventLogger=void 0,i(845);const r=i(962),o=($Q2(e,"Diagnostics",{enumerable:!0,get:function(){return r.Diagnostics}}),i(770)),u=($Q2(e,"EventLogger",{enumerable:!0,get:function(){return o.EventLogger}}),i(512));$Q2(e,"Log",{enumerable:!0,get:function(){return u.Log}});var l=i(0);const a=i(534);$Q2(e,"Storage",{enumerable:!0,get:function(){return a.Storage}}),s(i(845),e),s(i(137),e),s(i(427),e),s(i(694),e),s(i(962),e),s(i(539),e),s(i(542),e),s(i(922),e),s(i(417),e),s(i(406),e),s(i(333),e),s(i(512),e),s(i(404),e),s(i(410),e),s(i(405),e),s(i(361),e),s(i(830),e),s(i(902),e),s(i(143),e),s(i(122),e),s(i(375),e),s(i(636),e),s(i(206),e),s(i(637),e),s(i(0),e),s(i(586),e),s(i(59),e),s(i(812),e),s(i(578),e),s(i(534),e),s(i(401),e),s(i(634),e),s(i(638),e),s(i(23),e),s(i(397),e),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{Log:u.Log,SDK_VERSION:l.SDK_VERSION})},296: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)};$Q(e),s(i(18),e),e.default=__STATSIG__},262:(t,e,i)=>{$Q(e),e.fe=void 0;const n=i(914);function s(t,e){null!=t&&t.forEach(t=>{delete e[t]})}e.fe=function(t,e){var i;return(e=(0,n.C)(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.Dt)({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}}},226:(t,e,i)=>{$Q(e);const n=i(914);e.default=class{constructor(){this._e=null,this.ge=null,this.be="Uninitialized",this.ye=0,this.me=0}reset(){this.ge=null,this._e=null,this.be="Loading",this.ye=0,this.me=0}finalize(){this.ge||(this.be="NoValues")}getValues(){return this._e?(0,n.C)(this._e,"has_updates","EvaluationStoreValues"):null}setValues(t){var e;return!!t&&null!=(e=(0,n.C)(t.data,"has_updates","EvaluationResponse"))&&(this.be=t.source,!0===(null==e?void 0:e.has_updates)&&(this._e=t.data,this.ye=e.time,this.me=t.receivedAt,this.ge=e),!0)}getGate(t){var e;return this.pe(null==(e=this.ge)?void 0:e.feature_gates,t)}getConfig(t){var e;return this.pe(null==(e=this.ge)?void 0:e.dynamic_configs,t)}getLayer(t){var e;return this.pe(null==(e=this.ge)?void 0:e.layer_configs,t)}getParamStore(t){var e;return this.pe(null==(e=this.ge)?void 0:e.param_stores,t)}pe(t,e){let i=null;return{result:i=t?t[e]||t[(0,n.h)(e)]:i,details:this.Se(null==i)}}getCurrentSourceDetails(){return"Uninitialized"===this.be||"NoValues"===this.be?{reason:this.be}:{reason:this.be,lcut:this.ye,receivedAt:this.me}}Se(t){var e=this.getCurrentSourceDetails();let i=e.reason;return"Uninitialized"!==i&&"NoValues"!==i&&(i=i+":"+(t?"Unrecognized":"Recognized")),$P($P({},e),{reason:i})}}},448:function(t,e,i){var o=this&&this.__awaiter||$A();$Q(e);const u=i(914),l=i(262);class n extends u.NetworkCore{constructor(t,e){super(t,e);e=null==t?void 0:t.networkConfig;this.Oe=(0,u.ut)(null==e?void 0:e.initializeUrl,null==e?void 0:e.api,"/initialize",u.NetworkDefault.initializeApi)}fetchEvaluations(i,n,s,r){return o(this,void 0,void 0,function*(){var t=n?(0,u.C)(n,"has_updates","InitializeResponse"):null;let e={user:r,hash:"djb2",deltasResponseRequested:!1};return null!=t&&t.has_updates&&(e=$P($P({},e),{sinceTime:t.time,previousDerivedFields:"derived_fields"in t?t.derived_fields:{},deltasResponseRequested:!0})),this.je(i,t,e,s)})}je(e,i,n,s){var r;return o(this,void 0,void 0,function*(){var t=yield this.post({sdkKey:e,url:this.Oe,data:n,retries:2,isStatsigEncodable:!0,priority:s,isInitialize:!0});return 204===(null==t?void 0:t.code)?'{"has_updates": false}':200!==(null==t?void 0:t.code)?null!=(r=null==t?void 0:t.body)?r:null:!0!==(null==i?void 0:i.has_updates)||!0!==(null==(r=t.body)?void 0:r.includes('"is_delta":true'))||!0!==n.deltasResponseRequested?t.body:"string"==typeof(t=(0,l.fe)(i,t.body))?t:this.je(e,i,$P($P($P({},n),t),{deltasResponseRequested:!1}),s)})}}e.default=n},583:(t,e,i)=>{$Q(e),e.Te=void 0;const g=i(914),p={disableExposureLog:!0};function y(t){return null==t||!1===t.disableExposureLog}function b(t,e){return null!=e&&!(0,g.le)(t,e)}e.Te=function(v,f,_){return(t,e)=>{if(null==f)return e;var i,n,s,r,o,u,l,a,c,h,d=f[t];if(null==d||null!=e&&(0,g.kt)(e)!==d.param_type)return e;switch(d.ref_type){case"static":return d.value;case"gate":return h=d,v.getFeatureGate(h.gate_name,y(_)?void 0:p).value?h.pass_value:h.fail_value;case"dynamic_config":return h=d,l=e,a=_,b(c=(u=v).getDynamicConfig(h.config_name,p).get(h.param_name),l)?l:(y(a)&&u.getDynamicConfig(h.config_name),c);case"experiment":return l=d,a=e,u=_,b(o=(c=v).getExperiment(l.experiment_name,p).get(l.param_name),a)?a:(y(u)&&c.getExperiment(l.experiment_name),o);case"layer":return o=d,n=e,s=_,b(r=(i=v).getLayer(o.layer_name,p).get(o.param_name),n)?n:(y(s)&&i.getLayer(o.layer_name).get(o.param_name),r);default:return e}}}},198:function(t,e,i){var s=this&&this.__awaiter||$A();$Q(e);const o=i(914),r=i(226),u=i(448),l=i(583),a=i(131);class n extends o.StatsigClientBase{static instance(t){var e=(0,o.o)().instance(t);return e instanceof n?e:(o.Log.warn((0,o.Mt)()?"StatsigClient.instance is not supported in server environments":"Unable to find StatsigClient instance"),new n(null!=t?t:"",{}))}constructor(t,e,i=null){o.SDKType.Kt(t,"javascript-client");var n=new u.default(i,t=>{this.$emt(t)});super(t,null!=(t=null==i?void 0:i.dataAdapter)?t:new a.StatsigEvaluationsDataAdapter,n,i),this.we=new r.default,this.Ie=(0,o.A)(e,i)}initializeSync(){this.Ht.start(),this.updateUserSync(this.Ie)}initializeAsync(t){return this.Ht.start(),this.updateUserAsync(this.Ie,t)}updateUserSync(t){this.Ae(t);t=this.dataAdapter.getDataSync(this.Ie);this.we.setValues(t),this.Me(t),this.xe(null!=t?t:null,this.Ie)}updateUserAsync(i,n){return s(this,void 0,void 0,function*(){this.Ae(i);var t=this.Ie,e=(o.Diagnostics.gi(this.S),this.dataAdapter.getDataSync(t));if(this.we.setValues(e),this.Qt("Loading",e),e=yield this.dataAdapter.getDataAsync(e,t,n),t===this.Ie){let t=!1;null!=e&&(o.Diagnostics.yi(this.S),t=this.we.setValues(e),o.Diagnostics.Oi(this.S,{success:t})),this.Me(e),o.Diagnostics.bi(this.S,t,this.we.getCurrentSourceDetails()),o.Diagnostics.wi(this.Ie,this.Ht,this.S,this.p)}})}getContext(){return{sdkKey:this.S,options:this.p,values:this.we.getValues(),user:JSON.parse(JSON.stringify(this.Ie)),errorBoundary:this.Wt,session:o.StatsigSession.get(this.S),stableID:o.StableID.get(this.S)}}checkGate(t,e){return this.getFeatureGate(t,e).value}getFeatureGate(t,e){var{result:i,details:n}=this.we.getGate(t),n=(0,o.ue)(t,n,i),s=null==(s=null==(i=this.overrideAdapter)?void 0:i.getGateOverride)?void 0:s.call(i,n,this.Ie,e),i=null!=s?s:n;return this.Xt(t,(0,o.ee)(this.Ie,i),e),this.$emt({name:"gate_evaluation",gate:i}),i}getDynamicConfig(t,e){var{result:i,details:n}=this.we.getConfig(t),n=(0,o.oe)(t,n,i),s=null==(s=null==(i=this.overrideAdapter)?void 0:i.getDynamicConfigOverride)?void 0:s.call(i,n,this.Ie,e),i=null!=s?s:n;return this.Xt(t,(0,o.te)(this.Ie,i),e),this.$emt({name:"dynamic_config_evaluation",dynamicConfig:i}),i}getExperiment(t,e){var{result:i,details:n}=this.we.getConfig(t),n=(0,o.re)(t,n,i),s=null==(s=null==(i=this.overrideAdapter)?void 0:i.getExperimentOverride)?void 0:s.call(i,n,this.Ie,e),i=null!=s?s:n;return this.Xt(t,(0,o.te)(this.Ie,i),e),this.$emt({name:"experiment_evaluation",experiment:i}),i}getLayer(e,i){var{result:t,details:n}=this.we.getLayer(e),n=(0,o.se)(e,n,t),s=null==(s=null==(t=this.overrideAdapter)?void 0:t.getLayerOverride)?void 0:s.call(t,n,this.Ie,i);const r=(0,o.ne)(n,s,null!=(t=null==s?void 0:s.__value)?t:n.__value,t=>{this.Xt(e,(0,o.Zt)(this.Ie,r,t),i)});return this.$emt({name:"layer_evaluation",layer:r}),r}getParameterStore(t,e){var{result:i,details:n}=this.we.getParamStore(t);return this.Ht.incrementNonExposureCount(t),{name:t,details:n,__configuration:i,get:(0,l.Te)(this,i,e)}}logEvent(t,e,i){this.Ht.enqueue($P($P({},"string"==typeof t?{eventName:t,value:e,metadata:i}:t),{user:this.Ie,time:Date.now()}))}Yt(){this.$on("error",()=>{"Loading"===this.loadingStatus&&this.Me(null)})}Me(t){this.we.finalize(),this.Qt("Ready",t)}xe(t,e){this.dataAdapter.getDataAsync(t,e,{priority:"low"}).catch(t=>{o.Log.error("An error occurred after update.",t)})}Ae(t){this.Ht.reset(),this.we.reset(),this.Ie=(0,o.A)(t,this.p);t=null==(t=this.Ie.customIDs)?void 0:t.stableID;t&&o.StableID.setOverride(t,this.S)}}e.default=n},131:function(t,e,i){var r=this&&this.__awaiter||$A();$Q(e),e.StatsigEvaluationsDataAdapter=void 0;const n=i(914),s=i(448);class o extends n.DataAdapterCore{constructor(){super("EvaluationsDataAdapter","evaluations"),this.X=null,this.p=null}attach(t,e){super.attach(t,e),this.X=new s.default(null!=e?e:{})}getDataAsync(t,e,i){return this.M(t,(0,n.A)(e,this.p),i)}prefetchData(t,e){return this.k(t,e)}setData(t){var e=(0,n.C)(t,"has_updates","data");e&&"user"in e?super.setData(t,e.user):n.Log.error("StatsigUser not found")}setDataLegacy(t,e){super.setData(t,e)}N(e,i,n){var s;return r(this,void 0,void 0,function*(){var t=yield null==(s=this.X)?void 0:s.fetchEvaluations(this.P(),e,null==n?void 0:n.priority,i);return null!=t?t:null})}T(t){t=(0,n.u)(this.P(),t,null==(t=this.p)?void 0:t.customUserCacheKeyFunc);return`${n.DataAdapterCachePrefix}.${this.m}.`+t}R(t,e){return null!=t.fullUserHash&&t.fullUserHash===(0,n.v)(e)}}e.StatsigEvaluationsDataAdapter=o},18:(t,e,i)=>{$Q(e),e.StatsigClient=void 0;i=i(198);e.StatsigClient=i.default,__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{StatsigClient:i.default}),e.default=__STATSIG__}},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(296).default})());
!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 $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())})});var i={845:(t,i,e)=>{$Q2(i,"__esModule",{value:!0}),i.t=i.i=i.o=void 0,i.o=()=>__STATSIG__||u,i.i=t=>(0,i.o)()[t];i.t=t=>{var e=(0,i.o)();return t?e.instances&&e.instances[t]:e.lastInstance};var n,s="__STATSIG__",r="undefined"!=typeof window?window:{},e=void 0!==e.g?e.g:{},o="undefined"!=typeof globalThis?globalThis:{};const u=null!=(n=null!=(n=null!=(n=r[s])?n:e[s])?n:o[s])?n:{instance:i.t};r[s]=u,e[s]=u,o[s]=u},137:(t,e,i)=>{$Q(e),e.u=e.l=void 0;const s=i(406);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.l=n,e.u=function(t,e,i){return e?n(t,e,i):(0,s.h)("k:"+t)}},427:(t,e)=>{$Q(e)},694:function(t,e,i){var s=this&&this.__awaiter||$A();$Q(e),e.DataAdapterCore=void 0;const l=i(512),a=i(122),r=i(578),o=i(534),c=i(401);function h(t,e,i,n){return{source:t,data:e,receivedAt:Date.now(),stableID:i,fullUserHash:(0,r.v)(n)}}e.DataAdapterCore=class{constructor(t,e){this._=t,this.m=e,this.p=null,this.S=null,this.O="statsig.last_modified_time."+e,this.j=new n}attach(t,e){this.S=t,this.p=e}getDataSync(t){var t=t&&(0,r.A)(t,this.p),e=this.T(t),i=this.j.get(e,t);return i||((i=this.I(e))?(this.j.add(e,i),this.j.get(e,t)):null)}setData(t,e){var e=e&&(0,r.A)(e,this.p),i=this.T(e);this.j.add(i,h("Bootstrap",t,null,e))}__primeInMemoryCache(t){this.j.merge(t)}M(e,i,n){return s(this,void 0,void 0,function*(){var t=null!=e?e:this.getDataSync(i),t=[this.D(t,i,n)];return null!=n&&n.timeoutMs&&t.push(new Promise(t=>setTimeout(t,n.timeoutMs)).then(()=>(l.Log.debug("Fetching latest value timed out"),null))),yield Promise.race(t)})}k(i,n){return s(this,void 0,void 0,function*(){var t=i&&(0,r.A)(i,this.p),e=this.T(t),t=yield this.M(null,t,n);t&&this.j.add(e,$P($P({},t),{source:"Prefetch"}))})}D(r,o,u){return s(this,void 0,void 0,function*(){let t=null;r&&this.R(r,o)&&(t=r.data);var e=yield this.N(t,o,u);if(!e)return l.Log.debug("No response returned for latest value"),null;var i=(0,c.C)(e,"has_updates","Response"),n=this.P(),n=yield a.StableID.get(n);let s=null;if(!0===(null==i?void 0:i.has_updates))s=h("Network",e,n,o);else{if(!t||!1!==(null==i?void 0:i.has_updates))return null;s=h("NetworkNotModified",t,n,o)}e=this.T(o);return this.j.add(e,s),yield this.G(e,s),s})}P(){return null!=this.S?this.S:(l.Log.error(this._+" is not attached to a Client"),"")}I(t){var e=null==(e=o.Storage.ce)?void 0:e.call(o.Storage,t);return null!=e&&(t=(0,c.C)(e,"source","Cached Result"))?$P($P({},t),{source:"Cache"}):null}G(t,e){return s(this,void 0,void 0,function*(){yield o.Storage.L(t,JSON.stringify(e)),yield this.K(t)})}K(i){var n;return s(this,void 0,void 0,function*(){var t=null!=(n=yield(0,o.F)(this.O))?n:{},e=(t[i]=Date.now(),u(t,10));e&&(delete t[e],yield o.Storage.q(e)),yield(0,o.J)(this.O,t)})}};class n{constructor(){this.V={}}get(t,e){var t=this.V[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?(l.Log.warn("'StatsigUser.customIDs.stableID' mismatch"),null):t}add(t,e){var i=u(this.V,9);i&&delete this.V[i],this.V[t]=e}merge(t){this.V=$P($P({},this.V),t)}}function u(s,t){var e=Object.keys(s);return e.length<=t?null:e.reduce((t,e)=>{var i=s[t],n=s[e];return"object"==typeof i&&"object"==typeof n?n.receivedAt<i.receivedAt?e:t:n<i?e:t})}},962:(t,r)=>{$Q2(r,"__esModule",{value:!0}),r.Diagnostics=void 0;const n=new Map,i="start";function s(t,e){return $P({key:"initialize",action:e,timestamp:Date.now()},t)}function o(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]}r.Diagnostics={_i:t=>n.get(t),gi:t=>{o(t,s({},i))},bi:(t,e,i)=>{o(t,s({success:e,error:e?void 0:{name:"InitializeError",message:"Failed to initialize"},evaluationDetails:i},"end"))},mi:(t,e)=>{o(t,s(e,i))},pi:(t,e)=>{o(t,s(e,"end"))},yi:t=>{o(t,s({},i))},Oi:(t,e)=>{o(t,s(e,"end"))},Si:t=>{n.delete(t)},ji(t){if(t&&"object"==typeof t)return{code:e(t,"code"),name:e(t,"name"),message:e(t,"message")}},Ti(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:r.Diagnostics.ji(n)}},wi(t,e,i,n){var s=r.Diagnostics._i(i);null==s||s.length<=0||(r.Diagnostics.Si(i),i=function(t,e){t={eventName:"statsig::diagnostics",user:t,value:null,metadata:e,time:Date.now()};return t}(t,{context:"initialize",markers:s.slice(),statsigOptions:n}),e.enqueue(i))}}},539:(t,e)=>{$Q(e)},542:function(t,u,e){var i=this&&this.__awaiter||$A();$Q2(u,"__esModule",{value:!0}),u.ErrorBoundary=u.EXCEPTION_ENDPOINT=void 0;const n=e(512),l=e(902),a=e(0),c=(u.EXCEPTION_ENDPOINT="https://statsigapi.net/v1/sdk_exception","[Statsig] UnknownError");u.ErrorBoundary=class{constructor(t,e,i){this.S=t,this.p=e,this.B=i,this.$=new Set}wrap(n){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.H(e,()=>i.apply(n,t)),t[e].$EB=!0)})}catch(t){this.W("eb:wrap",t)}}logError(t,e){this.W(t,e)}H(e,t){try{var i=t();return i&&i instanceof Promise?i.catch(t=>this.W(e,t)):i}catch(t){return this.W(e,t),null}}W(r,o){try{n.Log.warn("Caught error in "+r,{error:o});i(this,void 0,void 0,function*(){var t,e,i=o||Error(c),n=i instanceof Error,s=n?i.name:"No Name";this.$.has(s)||(this.$.add(s),null!=(t=null==(t=this.p)?void 0:t.networkConfig)&&t.preventAllNetworkTraffic?null!=(t=this.B)&&t.call(this,{name:"error",error:o}):(t=l.SDKType.Y(this.S),e=a.StatsigMetadataProvider.get(),n=n?i.stack:function(t){try{return JSON.stringify(t)}catch(t){return c}}(i),i=JSON.stringify($P({tag:r,exception:s,info:n},$P($P({},e),{sdkType:t}))),yield(null!=(s=null==(n=null==(s=this.p)?void 0:s.networkConfig)?void 0:n.networkOverrideFunc)?s:fetch)(u.EXCEPTION_ENDPOINT,{method:"POST",headers:{"STATSIG-API-KEY":this.S,"STATSIG-SDK-TYPE":String(t),"STATSIG-SDK-VERSION":String(e.sdkVersion),"Content-Type":"application/json"},body:i}),null!=(n=this.B)&&n.call(this,{name:"error",error:o})))}).then(()=>{}).catch(()=>{})}catch(t){}}}},922:(t,e)=>{$Q(e)},417:(t,e)=>{$Q(e)},770:function(t,e,i){var n=this&&this.__awaiter||$A();$Q(e),e.EventLogger=void 0;const s=i(137),r=i(406),o=i(512),u=i(410),l=i(830),a=i(637),c=i(534),h=i(638),d=i(397),v={},f=t=>{null!=(t=v[t])&&t.flush().catch(()=>{})};e.EventLogger=class{constructor(t,e,i,n){this.S=t,this.B=e,this.X=i,this.p=n,this.Z=[],this.tt={},this.et={},this.it=!1,this.nt=Date.now(),this.st=!0===(null==n?void 0:n.disableLogging),this.rt=null!=(t=null==n?void 0:n.loggingBufferMaxSize)?t:50;e=null==n?void 0:n.networkConfig;this.ot=(0,h.ut)(null==e?void 0:e.logEventUrl,null==e?void 0:e.api,"/rgstr",u.NetworkDefault.eventsApi)}setLoggingDisabled(t){this.st=t}enqueue(t){this.dt(t)&&(this.vt(t),this.ft(),this.Z.length>this.rt)&&f(this.S)}incrementNonExposureCount(t){var e=null!=(e=this.et[t])?e:0;this.et[t]=e+1}reset(){this.tt={}}start(){(0,l.Mt)()||(v[this.S]=this,(0,d.lt)(t=>{"background"===t&&f(this.S)}),this.ct(),this.ht())}stop(){return n(this,void 0,void 0,function*(){this._t&&(clearInterval(this._t),this._t=null),yield this.flush()})}flush(){return n(this,void 0,void 0,function*(){var t;if(this.gt(),0!==this.Z.length)return t=this.Z,this.Z=[],this.bt(t)})}ft(){this.it||(this.it=!0,200<Date.now()-this.nt)||setTimeout(()=>f(this.S),200)}dt(t){if((0,l.Mt)())return!1;if((0,a.yt)(t)){var e=t.user||{statsigEnvironment:void 0},e=(0,s.l)(this.S,e),i=t.metadata||{},t=[t.eventName,e,i.gate,i.config,i.ruleID].join("|"),e=this.tt[t],i=Date.now();if(e&&i-e<6e4)return!1;1e3<Object.keys(this.tt).length&&(this.tt={}),this.tt[t]=i}return!0}bt(t){var e,i;return n(this,void 0,void 0,function*(){if(this.st)this.St(t);else try{(!(0,d.Ot)()&&this.X.isBeaconSupported()&&null==(null==(i=null==(e=this.p)?void 0:e.networkConfig)?void 0:i.networkOverrideFunc)?yield this.jt(t):yield this.Tt(t)).success?this.B({name:"logs_flushed",events:t}):this.St(t)}catch(t){o.Log.warn("Failed to flush events.")}})}Tt(e){var i;return n(this,void 0,void 0,function*(){var t=yield this.X.post(this.wt(e)),t=null!=(i=null==t?void 0:t.code)?i:-1;return{success:200<=t&&t<300}})}jt(t){return n(this,void 0,void 0,function*(){return{success:yield this.X.beacon(this.wt(t))}})}wt(t){return{sdkKey:this.S,data:{events:t},url:this.ot,retries:3,isCompressable:!0,params:{[u.NetworkParam.EventCount]:String(t.length)}}}St(t){for(;500<t.length;)t.shift();var e=this.u();try{(0,c.J)(e,t)}catch(t){o.Log.warn("Unable to save failed logs to storage")}}ct(){const e=this.u();n(this,void 0,void 0,function*(){var t=(0,c.F)(e);t&&(c.Storage.q(e),yield this.bt(t))}).catch(()=>{o.Log.warn("Failed to flush stored logs")})}u(){return"statsig.failed_logs."+(0,r.h)(this.S)}vt(t){t.user&&(t.user=$P({},t.user),delete t.user.privateAttributes);var e={},i=this.It(),i=(i&&(e.statsigMetadata={currentPage:i}),$P($P({},t),e));o.Log.debug("Enqueued Event:",i),this.Z.push(i)}gt(){0!==Object.keys(this.et).length&&(this.vt({eventName:"statsig::non_exposed_checks",user:null,time:Date.now(),metadata:{checks:$P({},this.et)}}),this.et={})}It(){var t;if(!1!==(null==(t=this.p)?void 0:t.includeCurrentPageUrlWithEvents))return(0,l.At)()}ht(){var t=null!=(t=null==(t=this.p)?void 0:t.loggingIntervalMs)?t:1e4;const e=setInterval(()=>{v[this.S]._t!==e?clearInterval(e):f(this.S)},t);this._t=e}}},406:(t,r,e)=>{$Q2(r,"__esModule",{value:!0}),r.xt=r.Dt=r.h=void 0;const o=e(634);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.Dt=(t,e)=>(0,r.h)(JSON.stringify((0,r.xt)(t,e)));r.xt=(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,o.kt)(e)?s[t]=e:s[t]=(0,r.xt)(e,null!=n?n-1:n)}),s}},333:(t,e)=>{$Q(e)},512:(t,e)=>{function i(t){return t.unshift("[Statsig]"),t}var n,s;$Q(e),e.Log=e.LogLevel=void 0,(s=n||(e.LogLevel=n={}))[s.None=0]="None",s[s.Error=1]="Error",s[s.Warn=2]="Warn",s[s.Info=3]="Info",s[s.Debug=4]="Debug";class r{static info(...t){this.level>=n.Info&&console.info(...i(t))}static debug(...t){this.level>=n.Debug&&console.debug(...i(t))}static warn(...t){this.level>=n.Warn&&console.warn(...i(t))}static error(...t){this.level>=n.Error&&console.error(...i(t))}}(e.Log=r).level=n.Error},410:(t,e)=>{$Q(e),e.NetworkParam=e.NetworkDefault=void 0,e.NetworkDefault={eventsApi:"https://statsigapi.net/v1",initializeApi:"https://statsigapi.net/v1",specsApi:"https://statsigapi.net/v1"},e.NetworkParam={EventCount:"ec",SdkKey:"k",SdkType:"st",SdkVersion:"sv",Time:"t",SessionID:"sid",StatsigEncoded:"se",IsGzipped:"gz"}},404:function(t,e,i){var r=this&&this.__awaiter||$A();$Q(e),e.NetworkCore=void 0,i(845);const o=i(845),b=i(962),m=i(512),u=i(410),n=i(894),l=i(902),a=i(830),c=i(143),h=i(122),d=i(0),O=i(397),j=new Set([408,500,502,503,504,522,524,599]);e.NetworkCore=class{constructor(t,e){this.B=e,this.Et=1e4,this.Rt={},this.p={},this.networkEvents=[],this.sdkKey=null,t&&(this.p=t),this.p.networkConfig&&(this.Rt=this.p.networkConfig),this.Rt.networkTimeoutMs&&(this.Et=this.Rt.networkTimeoutMs),this.Ii=new n.NetworkProxy(this.p),this._n()}post(i){return r(this,void 0,void 0,function*(){var t=this.ki(i);this.sdkKey||(this.sdkKey=i.sdkKey);let e=yield this.Nt($P($P({},i),t));return i.isStatsigEncodable&&(e=this.Ct(i,e)),this.Pt($P($P({method:"POST",body:e},t),i))})}get(t){return this.sdkKey||(this.sdkKey=t.sdkKey),this.Pt($P({method:"GET"},t))}isBeaconSupported(){return"undefined"!=typeof navigator&&"function"==typeof navigator.sendBeacon}beacon(n){return r(this,void 0,void 0,function*(){var t,e,i;return!!S(n)&&(e=this.ki(n),t=yield this.Nt($P($P({},n),e)),e=yield this.Gt($P($P({},n),e)),(i=navigator).sendBeacon.bind(i)(e,t))})}Pt(g){var y,p;return r(this,void 0,void 0,function*(){if(!S(g))return null;if(this.Rt.preventAllNetworkTraffic)return null;var{method:e,body:t,retries:i,attempt:n}=g,n=null!=n?n:1;const s="undefined"!=typeof AbortController?new AbortController:null;var r=setTimeout(()=>{null!==s&&void 0!==s&&s.abort(`Timeout of ${this.Et}ms expired.`)},this.Et),o=null!=(p=g.proxyUrl)?p:this.Ii.getProxyUrl(g.sdkKey,g.url),o=yield this.Gt($P({proxyUrl:o},g)),u=!o.includes("https://statsigapi.net/v1"),l=new URL(o).pathname;let a=null;var c=(0,O.Ut)();try{o.includes("https://prodregistryv2.org")||this.networkEvents.push({value:u?"proxy":"statsig",eventName:"proxy::network_request_tracking",metadata:{url:o,endpoint:l},time:Date.now(),user:null});var h,d,v,f={method:e,body:t,headers:$P({},g.headers),signal:null===s||void 0===s?void 0:s.signal,priority:g.priority,keepalive:c},_=(g.isInitialize&&b.Diagnostics.mi(g.sdkKey,{attempt:n}),null!=(y=this.Rt.networkOverrideFunc)?y:fetch);if(a=yield _(o,f),clearTimeout(r),a.ok)return v=yield a.text(),g.isInitialize&&b.Diagnostics.pi(g.sdkKey,b.Diagnostics.Ti(a,n,v)),{body:v,code:a.status};throw h=yield a.text().catch(()=>"No Text"),(d=new Error(`NetworkError: ${o} `+h)).name="NetworkError",d}catch(t){u=function(t,e){if(null!=t&&t.signal.aborted&&"string"==typeof t.signal.reason)return t.signal.reason;if("string"==typeof e)return e;if(e instanceof Error)return e.name+": "+e.message;return"Unknown Error"}(s,t),l=function(t){t=(null==t?void 0:t.signal.aborted)&&"string"==typeof t.signal.reason&&t.signal.reason.includes("Timeout");return t||!1}(s);return g.isInitialize&&b.Diagnostics.pi(g.sdkKey,b.Diagnostics.Ti(a,n,"",t)),yield this.Ii.attemptToUpdateProxyUrl(g.sdkKey,u,l),!i||i<n||!j.has(null!=(p=null===a||void 0===a?void 0:a.status)?p:500)?(null!=(p=this.B)&&p.call(this,{name:"error",error:t}),m.Log.error(`A networking error occured during ${e} request to ${o}.`,u,t),null):this.Pt($P($P({},g),{retries:i,attempt:n+1}))}})}Gt(n){var s;return r(this,void 0,void 0,function*(){var t=null!=(s=n.proxyUrl)?s:n.url;const e=$P({[u.NetworkParam.SdkKey]:n.sdkKey,[u.NetworkParam.SdkType]:l.SDKType.Y(n.sdkKey),[u.NetworkParam.SdkVersion]:d.SDK_VERSION,[u.NetworkParam.Time]:String(Date.now()),[u.NetworkParam.SessionID]:yield c.SessionID.get(n.sdkKey)},n.params);var i=Object.keys(e).map(t=>encodeURIComponent(t)+"="+encodeURIComponent(e[t])).join("&");return t+(i?"?"+i:"")})}Nt(s){return r(this,void 0,void 0,function*(){var{data:t,sdkKey:e}=s,i=yield h.StableID.get(e),n=yield c.SessionID.get(e),e=l.SDKType.Y(e);return JSON.stringify($P($P({},t),{statsigMetadata:$P($P({},d.StatsigMetadataProvider.get()),{stableID:i,sessionID:n,sdkType:e,proxyUrl:s.proxyUrl})}))})}Ct(t,e){var i,n,s=(0,a.Lt)();if(!t.isStatsigEncodable||this.p.disableStatsigEncoding||null!=(0,o.i)("no-encode")||null==s||!s.btoa)return e;try{var r=null!=(i=s.btoa(e).split("").reverse().join(""))?i:e;return t.params=$P($P({},null!=(n=t.params)?n:{}),{[u.NetworkParam.StatsigEncoded]:"1"}),r}catch(t){return m.Log.warn("/initialize request encoding failed"),e}}ki(t){t=this.Ii.getProxyUrl(t.sdkKey,t.url);return{proxyUrl:null!=t?t:null}}gn(){var t;0!==this.networkEvents.length&&(this.post({sdkKey:null!=(t=this.sdkKey)?t:"",url:"https://prodregistryv2.org/v1/rgstr",data:{events:[...this.networkEvents]}}),this.networkEvents=[])}_n(){setInterval(()=>{this.gn()},1e4)}};const S=t=>!!t.sdkKey||(m.Log.warn("Unable to make request without an SDK key"),!1)},894:function(t,e,i){var r=this&&this.__awaiter||$A();$Q(e),e.NetworkProxy=void 0;const n=i(406),s=i(410),o=i(534),u=i(401);function l(t){return"statsig.proxy."+(0,n.h)(t)}e.NetworkProxy=class{constructor(t){this.p=t,this.xi=null,this.Di=0,this.Ai=void 0,t.networkConfig&&(t=t.networkConfig,this.setOverrideFunc(t.networkOverrideFunc))}setOverrideFunc(t){this.Ai=t}getProxyUrl(t,e){return function(t){for(const e in s.NetworkDefault)if(t.startsWith(s.NetworkDefault[e]))return 1;return}(e)?(e=function(t){try{return new URL(t).pathname.substring(1)}catch(t){return""}}(e),0<this.Di&&Date.now()>this.Di?(this.xi=null,this.Di=0,this.xi):this.xi?this.xi+e:(t=function(t){t=o.Storage.ce(t);if(t){t=(0,u.C)(t,"url","cacheProxy");if(t&&Date.now()<t.expiryTime)return t}return null}(l(t)))?(this.xi=t.url,this.Di=t.expiryTime,this.xi+e):null):null}attemptToUpdateProxyUrl(i,n,s){return r(this,void 0,void 0,function*(){var t,e;(function(t,e){t=(null==t?void 0:t.toLowerCase())||"";return e||t.includes("uncaught exception")||t.includes("failed to fetch")||t.includes("networkerror when attempting to fetch resource")})(n,s)&&(t=l(i),e=yield this.Mi())&&(this.xi=e,this.Di=Date.now()+2592e5,o.Storage.L(t,JSON.stringify({url:this.xi,expiryTime:this.Di})))})}Mi(){return r(this,void 0,void 0,function*(){var t,e=yield this.Ei("featureregistry.org");return 0!==e.length&&([e,t]=function(t){let e=1440,i=0;var n=[],s=(new Date).getTimezoneOffset()+720;for(const u of t){var[r,o]=u.split("="),o=(n.push(o),null==r?void 0:r.split("_")[1]),r=parseInt(o);r&&!Number.isNaN(r)&&(o=Math.abs(r-s))<e&&(i=n.length-1,e=o)}return[n,i]}(e=e),0!==e.length)?e.length>t?e[t]:e[0]:null})}Ei(t){var u;return r(this,void 0,void 0,function*(){var e=function(t){var e=[0,0,1,0,0,1,0,0,0,0,0,0],t=t.split(".");for(const i of t){e.push(i.length);for(const n of i)e.push(n.charCodeAt(0))}return e.push(0,0,16,0,1),Uint8Array.from(e)}(t),e=yield(null!=(u=this.Ai)?u:fetch)("https://cloudflare-dns.com/dns-query",{method:"POST",headers:{"Content-Type":"application/dns-message",Accept:"application/dns-message"},body:e});if(e.ok){e=yield e.arrayBuffer();{var i=Array.from(new Uint8Array(e));let t=i.indexOf(192);for(var n=[];-1<t&&t<i.length-2;){var s=i[t+1];if(i.length<t+s+1)break;var r=i[t+s],o=i.slice(t+s+1,t+s+r+1);n.push(o.map(t=>String.fromCharCode(t)).join("")),t=i.indexOf(192,t+s+r)}return n}}return[]})}}},405:(t,e)=>{$Q(e)},361:(t,e)=>{$Q(e)},902:(t,e)=>{$Q(e),e.SDKType=void 0;const i={};let n;e.SDKType={Y:t=>{return(null!=(t=i[t])?t:"js-mono")+(null!==n&&void 0!==n?n:"")},Kt(t,e){i[t]=e},Ft(t){n&&"-react"!==n||(n="-"+t)}}},830:(t,n)=>{$Q2(n,"__esModule",{value:!0}),n.At=n.qt=n.zt=n.Mt=n.Jt=n.Lt=void 0;n.Lt=()=>"undefined"!=typeof window?window:null,n.Jt=()=>{var t=(0,n.Lt)();return null!=(t=null==t?void 0:t.document)?t:null},n.Mt=()=>{var t;return null===(0,n.Jt)()&&(t="undefined"!=typeof process&&null!=process.versions&&null!=process.versions.node,"string"==typeof EdgeRuntime||t)},n.zt=(t,e)=>{var i=(0,n.Lt)();"function"==typeof(null==i?void 0:i.addEventListener)&&i.addEventListener(t,e)},n.qt=(t,e)=>{var i=(0,n.Jt)();"function"==typeof(null==i?void 0:i.addEventListener)&&i.addEventListener(t,e)};n.At=()=>{var t;try{return null==(t=(0,n.Lt)())?void 0:t.location.href.split(/[?#]/)[0]}catch(t){}}},143:(t,e,i)=>{$Q(e),e.StatsigSession=e.SessionID=void 0;const n=i(137),r=i(512),o=i(534),u=i(23),l=18e5,a=144e5,c={};function h(e,t){return setTimeout(()=>{var t=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instance(e);t&&t.$emt({name:"session_expired"})},t)}function d(t){return"statsig.session_id."+(0,n.u)(t)}e.SessionID={get:t=>e.StatsigSession.get(t).data.sessionID},e.StatsigSession={get:t=>{null==c[t]&&(c[t]=function(t){let e=function(t){t=d(t);return(0,o.F)(t)}(t);var i=Date.now();e=e||{sessionID:(0,u.getUUID)(),startTime:i,lastUpdate:i};return{data:e,sdkKey:t}}(t));var t=c[t],e=Date.now(),i=t.data,n=((function({lastUpdate:t}){return Date.now()-t>l}(i)||function({startTime:t}){return Date.now()-t>a}(i))&&(i.sessionID=(0,u.getUUID)(),i.startTime=e),i.lastUpdate=e,i),s=t.sdkKey;s=d(s);try{(0,o.J)(s,n)}catch(t){r.Log.warn("Failed to save SessionID")}return clearTimeout(t.idleTimeoutID),clearTimeout(t.ageTimeoutID),e-=i.startTime,i=t.sdkKey,t.idleTimeoutID=h(i,l),t.ageTimeoutID=h(i,a-e),t},overrideInitialSessionID:(t,e)=>{var i;c[e]=(t=t,e=e,i=Date.now(),{data:{sessionID:t,startTime:i,lastUpdate:i},sdkKey:e})}}},122:(t,e,i)=>{$Q(e),e.StableID=void 0;const n=i(137),s=i(512),r=i(534),o=i(23),u={};function l(t){return"statsig.stable_id."+(0,n.u)(t)}function a(t,e){e=l(e);try{(0,r.J)(e,t)}catch(t){s.Log.warn("Failed to save StableID")}}e.StableID={get:e=>{if(null==u[e]){let t=function(t){t=l(t);return(0,r.F)(t)}(e);null==t&&a(t=(0,o.getUUID)(),e),u[e]=t}return u[e]},setOverride:(t,e)=>{a(u[e]=t,e)}}},375:function(t,e,i){var n=this&&this.__awaiter||$A();$Q(e),e.StatsigClientBase=void 0,i(845);const o=i(845),u=i(542),l=i(770),a=i(512),c=i(830),h=i(143),d=i(534);e.StatsigClientBase=class{constructor(t,e,i,n){this.loadingStatus="Uninitialized",this.Vt={};var s,r=this.$emt.bind(this);null!=(null==n?void 0:n.logLevel)&&(a.Log.level=n.logLevel),null!=n&&n.disableStorage&&d.Storage.Bt(!0),null!=n&&n.initialSessionID&&h.StatsigSession.overrideInitialSessionID(n.initialSessionID,t),this.S=t,this.p=null!=n?n:{},this.overrideAdapter=null!=(s=null==n?void 0:n.overrideAdapter)?s:null,this.Ht=new l.EventLogger(t,r,i,n),this.Wt=new u.ErrorBoundary(t,n,r),this.Wt.wrap(this),this.Wt.wrap(i),this.Wt.wrap(e),this.Wt.wrap(this.Ht),(0,c.Mt)()||(null!=(i=null!=(r=(s=(0,o.o)()).instances)?r:{})[t]&&a.Log.warn("Creating multiple Statsig clients with the same SDK key can lead to unexpected behavior. Multi-instance support requires different SDK keys."),i[t]=this,s.lastInstance=this,s.instances=i,__STATSIG__=s),this.dataAdapter=e,this.dataAdapter.attach(t,n),this.Yt()}updateRuntimeOptions(t){null!=t.disableLogging&&(this.p.disableLogging=t.disableLogging,this.Ht.setLoggingDisabled(t.disableLogging)),null!=t.disableStorage&&(this.p.disableStorage=t.disableStorage,d.Storage.Bt(t.disableStorage))}flush(){return this.Ht.flush()}shutdown(){return n(this,void 0,void 0,function*(){this.$emt({name:"pre_shutdown"}),yield this.Ht.stop()})}on(t,e){this.Vt[t]||(this.Vt[t]=[]),this.Vt[t].push(e)}off(t,e){this.Vt[t]&&-1!==(e=this.Vt[t].indexOf(e))&&this.Vt[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.Wt.logError("__emit:"+i.name,t):a.Log.error("An error occurred in a StatsigClientEvent listener. This is not an issue with Statsig.",i)}};this.Vt[i.name]&&this.Vt[i.name].forEach(t=>e(t)),null!=(t=this.Vt["*"])&&t.forEach(e)}Qt(t,e){this.loadingStatus=t,this.$emt({name:"values_updated",status:t,values:e})}Xt(t,e,i){!0===(null==i?void 0:i.disableExposureLog)?this.Ht.incrementNonExposureCount(t):this.Ht.enqueue(e)}}},636:(t,e)=>{$Q(e)},206:(t,e)=>{$Q(e),e.DataAdapterCachePrefix=void 0,e.DataAdapterCachePrefix="statsig.cached"},637:(t,e)=>{$Q(e),e.Zt=e.te=e.ee=e.yt=void 0;const i="statsig::config_exposure",n="statsig::gate_exposure",l=(t,e,i,n,s)=>({eventName:t,user:e,value:null,metadata:r(i,n),secondaryExposures:s,time:Date.now()});e.yt=({eventName:t})=>t===n||t===i,e.ee=(t,e)=>{return l(n,t,e.details,{gate:e.name,gateValue:String(e.value),ruleID:e.ruleID},null!=(e=null==(t=e.__evaluation)?void 0:t.secondary_exposures)?e:[])},e.te=(t,e)=>{return l(i,t,e.details,{config:e.name,ruleID:e.ruleID},null!=(e=null==(t=e.__evaluation)?void 0:t.secondary_exposures)?e:[])};e.Zt=(t,e,i)=>{var n,s=e.__evaluation,r=!0===(null==(r=null==s?void 0:s.explicit_parameters)?void 0:r.includes(i));let o="",u=null!=(n=null==s?void 0:s.undelegated_secondary_exposures)?n:[];return r&&(o=null!=(n=s.allocated_experiment_name)?n:"",u=s.secondary_exposures),l("statsig::layer_exposure",t,e.details,{config:e.name,parameterName:i,ruleID:e.ruleID,allocatedExperiment:o,isExplicitParameter:String(r)},u)};const r=(t,e)=>(e.reason=t.reason,t.lcut&&(e.lcut=String(t.lcut)),t.receivedAt&&(e.receivedAt=String(t.receivedAt)),e)},0:(t,e)=>{$Q(e),e.StatsigMetadataProvider=e.SDK_VERSION=void 0,e.SDK_VERSION="1.8.0-beta.14";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)},59:(t,e,i)=>{$Q(e),e.ie=e.ne=e.se=e.re=e.oe=e.ue=void 0;const r=i(634),s="default";function o(t,e,i,n){return{name:t,details:e,ruleID:null!=(t=null==i?void 0:i.rule_id)?t:s,__evaluation:i,value:n}}function n(t,e,i){var n=null!=(n=null==i?void 0:i.value)?n:{};return $P($P({},o(t,e,i,n)),{get:u(null==i?void 0:i.value)})}function u(n,s){return(t,e)=>{var i=null!=(i=null==n?void 0:n[t])?i:null;return null!=i&&(null==e||(0,r.le)(i,e))?(null!=s&&s(t),i):null!=e?e:null}}e.ue=function(t,e,i){return o(t,e,i,!0===(null==i?void 0:i.value))},e.oe=n,e.re=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.se=function(t,e,i,n){return $P($P({},o(t,e,i,void 0)),{get:u(null==i?void 0:i.value,n),groupName:null!=(t=null==i?void 0:i.group_name)?t:null,__value:null!=(e=null==i?void 0:i.value)?e:{}})},e.ne=function(t,e,i,n){return $P($P($P({},t),e),{get:u(i,n)})},e.ie=u},812:(t,e)=>{$Q(e)},578:(t,e,i)=>{$Q(e),e.v=e.A=void 0;const n=i(406),s=i(512);e.A=function(t,e){try{var i=JSON.parse(JSON.stringify(t));return null!=e&&null!=e.environment&&(i.statsigEnvironment=e.environment),i}catch(t){return s.Log.error("Failed to JSON.stringify user"),{statsigEnvironment:void 0}}},e.v=function(t){return t?(0,n.Dt)(t):null}},534:(t,i,e)=>{$Q2(i,"__esModule",{value:!0}),i.J=i.F=i.Storage=void 0;var n=e(512),e=e(830);const s={},r={ae:()=>"InMemory",ce:t=>s[t]||null,L:(t,e)=>{s[t]=e},q:t=>{delete s[t]},he:()=>Object.keys(s)};let o=null;try{const a=(0,e.Lt)();a&&a.localStorage&&"function"==typeof a.localStorage.getItem&&(o={ae:()=>"LocalStorage",ce:t=>a.localStorage.getItem(t),L:(t,e)=>a.localStorage.setItem(t,e),q:t=>a.localStorage.removeItem(t),he:()=>Object.keys(a.localStorage)})}catch(t){n.Log.warn("Failed to setup localStorageProvider.")}let u=null!==o&&void 0!==o?o:r,l=u;i.Storage={ae:()=>l.ae(),ce:t=>{var e=()=>l.ce(t);try{return e()}catch(t){if(t instanceof Error&&"SecurityError"===t.name)return i.Storage.de(r),null;throw t}},L:(t,e)=>l.L(t,e),q:t=>l.q(t),he:()=>l.he(),de:t=>{u=t,l=t},Bt:t=>{l=t?r:u}},i.F=function(t){return t=i.Storage.ce(t),JSON.parse(null!=t?t:"null")},i.J=function(t,e){i.Storage.L(t,JSON.stringify(e))}},401:(t,e,i)=>{$Q(e),e.C=void 0;const s=i(512);e.C=function(t,e,i){try{var n=JSON.parse(t);return"object"==typeof n&&0 in n,n}catch(t){}return s.Log.error("Failed to parse "+i),null}},634:(t,e)=>{$Q(e),e.le=e.kt=void 0,e.kt=function(t){return Array.isArray(t)?"array":typeof t},e.le=function(t,e){var i=t=>Array.isArray(t)?"array":typeof t;return i(t)===i(e)}},23:(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)})}},638:(t,e)=>{$Q(e),e.ut=void 0,e.ut=function(t,e,i,n){return t||(e?""+e+i:""+n+i)}},397:(t,e,i)=>{$Q(e),e.ve=e.lt=e.Ut=e.Ot=void 0;i=i(830);const n="foreground",s="background",r=[];let o=n,u=!1;e.Ot=()=>o===n,e.Ut=()=>u,e.lt=t=>{r.unshift(t)};e.ve=e=>{e!==o&&(o=e,r.forEach(t=>t(e)))},(0,i.zt)("focus",()=>{(u=!1,e.ve)(n)}),(0,i.zt)("blur",()=>(0,e.ve)(s)),(0,i.zt)("beforeunload",()=>{u=!0,(0,e.ve)(s)}),(0,i.qt)("visibilitychange",()=>{(0,e.ve)("visible"===document.visibilityState?n:s)})},914: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)};$Q(e),e.Diagnostics=e.Log=e.Storage=e.EventLogger=void 0,i(845);const r=i(962),o=($Q2(e,"Diagnostics",{enumerable:!0,get:function(){return r.Diagnostics}}),i(770)),u=($Q2(e,"EventLogger",{enumerable:!0,get:function(){return o.EventLogger}}),i(512));$Q2(e,"Log",{enumerable:!0,get:function(){return u.Log}});var l=i(0);const a=i(534);$Q2(e,"Storage",{enumerable:!0,get:function(){return a.Storage}}),s(i(845),e),s(i(137),e),s(i(427),e),s(i(694),e),s(i(962),e),s(i(539),e),s(i(542),e),s(i(922),e),s(i(417),e),s(i(406),e),s(i(333),e),s(i(512),e),s(i(404),e),s(i(410),e),s(i(405),e),s(i(361),e),s(i(830),e),s(i(902),e),s(i(143),e),s(i(122),e),s(i(375),e),s(i(636),e),s(i(206),e),s(i(637),e),s(i(0),e),s(i(586),e),s(i(59),e),s(i(812),e),s(i(578),e),s(i(534),e),s(i(401),e),s(i(634),e),s(i(638),e),s(i(23),e),s(i(397),e),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{Log:u.Log,SDK_VERSION:l.SDK_VERSION})},296: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)};$Q(e),s(i(18),e),e.default=__STATSIG__},262:(t,e,i)=>{$Q(e),e.fe=void 0;const n=i(914);function s(t,e){null!=t&&t.forEach(t=>{delete e[t]})}e.fe=function(t,e){var i;return(e=(0,n.C)(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.Dt)({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}}},226:(t,e,i)=>{$Q(e);const n=i(914);e.default=class{constructor(){this._e=null,this.ge=null,this.be="Uninitialized",this.ye=0,this.me=0}reset(){this.ge=null,this._e=null,this.be="Loading",this.ye=0,this.me=0}finalize(){this.ge||(this.be="NoValues")}getValues(){return this._e?(0,n.C)(this._e,"has_updates","EvaluationStoreValues"):null}setValues(t){var e;return!!t&&null!=(e=(0,n.C)(t.data,"has_updates","EvaluationResponse"))&&(this.be=t.source,!0===(null==e?void 0:e.has_updates)&&(this._e=t.data,this.ye=e.time,this.me=t.receivedAt,this.ge=e),!0)}getGate(t){var e;return this.pe(null==(e=this.ge)?void 0:e.feature_gates,t)}getConfig(t){var e;return this.pe(null==(e=this.ge)?void 0:e.dynamic_configs,t)}getLayer(t){var e;return this.pe(null==(e=this.ge)?void 0:e.layer_configs,t)}getParamStore(t){var e;return this.pe(null==(e=this.ge)?void 0:e.param_stores,t)}pe(t,e){let i=null;return{result:i=t?t[e]||t[(0,n.h)(e)]:i,details:this.Se(null==i)}}getCurrentSourceDetails(){return"Uninitialized"===this.be||"NoValues"===this.be?{reason:this.be}:{reason:this.be,lcut:this.ye,receivedAt:this.me}}Se(t){var e=this.getCurrentSourceDetails();let i=e.reason;return"Uninitialized"!==i&&"NoValues"!==i&&(i=i+":"+(t?"Unrecognized":"Recognized")),$P($P({},e),{reason:i})}}},448:function(t,e,i){var o=this&&this.__awaiter||$A();$Q(e);const u=i(914),l=i(262);class n extends u.NetworkCore{constructor(t,e){super(t,e);e=null==t?void 0:t.networkConfig;this.Oe=(0,u.ut)(null==e?void 0:e.initializeUrl,null==e?void 0:e.api,"/initialize",u.NetworkDefault.initializeApi)}fetchEvaluations(i,n,s,r){return o(this,void 0,void 0,function*(){var t=n?(0,u.C)(n,"has_updates","InitializeResponse"):null;let e={user:r,hash:"djb2",deltasResponseRequested:!1};return null!=t&&t.has_updates&&(e=$P($P({},e),{sinceTime:t.time,previousDerivedFields:"derived_fields"in t?t.derived_fields:{},deltasResponseRequested:!0})),this.je(i,t,e,s)})}je(e,i,n,s){var r;return o(this,void 0,void 0,function*(){var t=yield this.post({sdkKey:e,url:this.Oe,data:n,retries:2,isStatsigEncodable:!0,priority:s,isInitialize:!0});return 204===(null==t?void 0:t.code)?'{"has_updates": false}':200!==(null==t?void 0:t.code)?null!=(r=null==t?void 0:t.body)?r:null:!0!==(null==i?void 0:i.has_updates)||!0!==(null==(r=t.body)?void 0:r.includes('"is_delta":true'))||!0!==n.deltasResponseRequested?t.body:"string"==typeof(t=(0,l.fe)(i,t.body))?t:this.je(e,i,$P($P($P({},n),t),{deltasResponseRequested:!1}),s)})}}e.default=n},583:(t,e,i)=>{$Q(e),e.Te=void 0;const g=i(914),y={disableExposureLog:!0};function p(t){return null==t||!1===t.disableExposureLog}function b(t,e){return null!=e&&!(0,g.le)(t,e)}e.Te=function(v,f,_){return(t,e)=>{if(null==f)return e;var i,n,s,r,o,u,l,a,c,h,d=f[t];if(null==d||null!=e&&(0,g.kt)(e)!==d.param_type)return e;switch(d.ref_type){case"static":return d.value;case"gate":return h=d,v.getFeatureGate(h.gate_name,p(_)?void 0:y).value?h.pass_value:h.fail_value;case"dynamic_config":return h=d,l=e,a=_,b(c=(u=v).getDynamicConfig(h.config_name,y).get(h.param_name),l)?l:(p(a)&&u.getDynamicConfig(h.config_name),c);case"experiment":return l=d,a=e,u=_,b(o=(c=v).getExperiment(l.experiment_name,y).get(l.param_name),a)?a:(p(u)&&c.getExperiment(l.experiment_name),o);case"layer":return o=d,n=e,s=_,b(r=(i=v).getLayer(o.layer_name,y).get(o.param_name),n)?n:(p(s)&&i.getLayer(o.layer_name).get(o.param_name),r);default:return e}}}},198:function(t,e,i){var s=this&&this.__awaiter||$A();$Q(e);const o=i(914),r=i(226),u=i(448),l=i(583),a=i(131);class n extends o.StatsigClientBase{static instance(t){var e=(0,o.o)().instance(t);return e instanceof n?e:(o.Log.warn((0,o.Mt)()?"StatsigClient.instance is not supported in server environments":"Unable to find StatsigClient instance"),new n(null!=t?t:"",{}))}constructor(t,e,i=null){o.SDKType.Kt(t,"javascript-client");var n=new u.default(i,t=>{this.$emt(t)});super(t,null!=(t=null==i?void 0:i.dataAdapter)?t:new a.StatsigEvaluationsDataAdapter,n,i),this.we=new r.default,this.Ie=(0,o.A)(e,i)}initializeSync(){this.Ht.start(),this.updateUserSync(this.Ie)}initializeAsync(t){return this.Ht.start(),this.updateUserAsync(this.Ie,t)}updateUserSync(t){this.Ae(t);t=this.dataAdapter.getDataSync(this.Ie);this.we.setValues(t),this.Me(t),this.xe(null!=t?t:null,this.Ie)}updateUserAsync(i,n){return s(this,void 0,void 0,function*(){this.Ae(i);var t=this.Ie,e=(o.Diagnostics.gi(this.S),this.dataAdapter.getDataSync(t));if(this.we.setValues(e),this.Qt("Loading",e),e=yield this.dataAdapter.getDataAsync(e,t,n),t===this.Ie){let t=!1;null!=e&&(o.Diagnostics.yi(this.S),t=this.we.setValues(e),o.Diagnostics.Oi(this.S,{success:t})),this.Me(e),o.Diagnostics.bi(this.S,t,this.we.getCurrentSourceDetails()),o.Diagnostics.wi(this.Ie,this.Ht,this.S,this.p)}})}getContext(){return{sdkKey:this.S,options:this.p,values:this.we.getValues(),user:JSON.parse(JSON.stringify(this.Ie)),errorBoundary:this.Wt,session:o.StatsigSession.get(this.S),stableID:o.StableID.get(this.S)}}checkGate(t,e){return this.getFeatureGate(t,e).value}getFeatureGate(t,e){var{result:i,details:n}=this.we.getGate(t),n=(0,o.ue)(t,n,i),s=null==(s=null==(i=this.overrideAdapter)?void 0:i.getGateOverride)?void 0:s.call(i,n,this.Ie,e),i=null!=s?s:n;return this.Xt(t,(0,o.ee)(this.Ie,i),e),this.$emt({name:"gate_evaluation",gate:i}),i}getDynamicConfig(t,e){var{result:i,details:n}=this.we.getConfig(t),n=(0,o.oe)(t,n,i),s=null==(s=null==(i=this.overrideAdapter)?void 0:i.getDynamicConfigOverride)?void 0:s.call(i,n,this.Ie,e),i=null!=s?s:n;return this.Xt(t,(0,o.te)(this.Ie,i),e),this.$emt({name:"dynamic_config_evaluation",dynamicConfig:i}),i}getExperiment(t,e){var{result:i,details:n}=this.we.getConfig(t),n=(0,o.re)(t,n,i),s=null==(s=null==(i=this.overrideAdapter)?void 0:i.getExperimentOverride)?void 0:s.call(i,n,this.Ie,e),i=null!=s?s:n;return this.Xt(t,(0,o.te)(this.Ie,i),e),this.$emt({name:"experiment_evaluation",experiment:i}),i}getLayer(e,i){var{result:t,details:n}=this.we.getLayer(e),n=(0,o.se)(e,n,t),s=null==(s=null==(t=this.overrideAdapter)?void 0:t.getLayerOverride)?void 0:s.call(t,n,this.Ie,i);const r=(0,o.ne)(n,s,null!=(t=null==s?void 0:s.__value)?t:n.__value,t=>{this.Xt(e,(0,o.Zt)(this.Ie,r,t),i)});return this.$emt({name:"layer_evaluation",layer:r}),r}getParameterStore(t,e){var{result:i,details:n}=this.we.getParamStore(t);return this.Ht.incrementNonExposureCount(t),{name:t,details:n,__configuration:i,get:(0,l.Te)(this,i,e)}}logEvent(t,e,i){this.Ht.enqueue($P($P({},"string"==typeof t?{eventName:t,value:e,metadata:i}:t),{user:this.Ie,time:Date.now()}))}Yt(){this.$on("error",()=>{"Loading"===this.loadingStatus&&this.Me(null)})}Me(t){this.we.finalize(),this.Qt("Ready",t)}xe(t,e){this.dataAdapter.getDataAsync(t,e,{priority:"low"}).catch(t=>{o.Log.error("An error occurred after update.",t)})}Ae(t){this.Ht.reset(),this.we.reset(),this.Ie=(0,o.A)(t,this.p);t=null==(t=this.Ie.customIDs)?void 0:t.stableID;t&&o.StableID.setOverride(t,this.S)}}e.default=n},131:function(t,e,i){var r=this&&this.__awaiter||$A();$Q(e),e.StatsigEvaluationsDataAdapter=void 0;const n=i(914),s=i(448);class o extends n.DataAdapterCore{constructor(){super("EvaluationsDataAdapter","evaluations"),this.X=null,this.p=null}attach(t,e){super.attach(t,e),this.X=new s.default(null!=e?e:{})}getDataAsync(t,e,i){return this.M(t,(0,n.A)(e,this.p),i)}prefetchData(t,e){return this.k(t,e)}setData(t){var e=(0,n.C)(t,"has_updates","data");e&&"user"in e?super.setData(t,e.user):n.Log.error("StatsigUser not found")}setDataLegacy(t,e){super.setData(t,e)}N(e,i,n){var s;return r(this,void 0,void 0,function*(){var t=yield null==(s=this.X)?void 0:s.fetchEvaluations(this.P(),e,null==n?void 0:n.priority,i);return null!=t?t:null})}T(t){t=(0,n.u)(this.P(),t,null==(t=this.p)?void 0:t.customUserCacheKeyFunc);return`${n.DataAdapterCachePrefix}.${this.m}.`+t}R(t,e){return null!=t.fullUserHash&&t.fullUserHash===(0,n.v)(e)}}e.StatsigEvaluationsDataAdapter=o},18:(t,e,i)=>{$Q(e),e.StatsigClient=void 0;i=i(198);e.StatsigClient=i.default,__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{StatsigClient:i.default}),e.default=__STATSIG__}},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(296).default})());

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

!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 $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())})});var n={1845:(t,n,e)=>{$Q2(n,"__esModule",{value:!0}),n.t=n.i=n.o=void 0,n.o=()=>__STATSIG__||u,n.i=t=>(0,n.o)()[t];n.t=t=>{var e=(0,n.o)();return t?e.instances&&e.instances[t]:e.lastInstance};var i,r="__STATSIG__",s="undefined"!=typeof window?window:{},e=void 0!==e.g?e.g:{},o="undefined"!=typeof globalThis?globalThis:{};const u=null!=(i=null!=(i=null!=(i=s[r])?i:e[r])?i:o[r])?i:{instance:n.t};s[r]=u,e[r]=u,o[r]=u},2137:(t,e,n)=>{$Q(e),e.u=e.l=void 0;const r=n(1406);function i(t,e,n){if(n)return n(t,e);const i=e&&e.customIDs?e.customIDs:{};e=["uid:"+(null!=(n=null==e?void 0:e.userID)?n:""),"cids:"+Object.keys(i).sort((t,e)=>t.localeCompare(e)).map(t=>t+"-"+i[t]).join(","),"k:"+t];return(0,r.h)(e.join("|"))}e.l=i,e.u=function(t,e,n){return e?i(t,e,n):(0,r.h)("k:"+t)}},6427:(t,e)=>{$Q(e)},694:function(t,e,n){var r=this&&this.__awaiter||$A();$Q(e),e.DataAdapterCore=void 0;const l=n(7512),a=n(9122),s=n(8578),o=n(4534),c=n(3401);function h(t,e,n,i){return{source:t,data:e,receivedAt:Date.now(),stableID:n,fullUserHash:(0,s.v)(i)}}e.DataAdapterCore=class{constructor(t,e){this._=t,this.m=e,this.p=null,this.S=null,this.O="statsig.last_modified_time."+e,this.j=new i}attach(t,e){this.S=t,this.p=e}getDataSync(t){var t=t&&(0,s.A)(t,this.p),e=this.T(t),n=this.j.get(e,t);return n||((n=this.I(e))?(this.j.add(e,n),this.j.get(e,t)):null)}setData(t,e){var e=e&&(0,s.A)(e,this.p),n=this.T(e);this.j.add(n,h("Bootstrap",t,null,e))}__primeInMemoryCache(t){this.j.merge(t)}M(e,n,i){return r(this,void 0,void 0,function*(){var t=null!=e?e:this.getDataSync(n),t=[this.D(t,n,i)];return null!=i&&i.timeoutMs&&t.push(new Promise(t=>setTimeout(t,i.timeoutMs)).then(()=>(l.Log.debug("Fetching latest value timed out"),null))),yield Promise.race(t)})}k(n,i){return r(this,void 0,void 0,function*(){var t=n&&(0,s.A)(n,this.p),e=this.T(t),t=yield this.M(null,t,i);t&&this.j.add(e,$P($P({},t),{source:"Prefetch"}))})}D(s,o,u){return r(this,void 0,void 0,function*(){let t=null;s&&this.R(s,o)&&(t=s.data);var e=yield this.N(t,o,u);if(!e)return l.Log.debug("No response returned for latest value"),null;var n=(0,c.C)(e,"has_updates","Response"),i=this.P(),i=yield a.StableID.get(i);let r=null;if(!0===(null==n?void 0:n.has_updates))r=h("Network",e,i,o);else{if(!t||!1!==(null==n?void 0:n.has_updates))return null;r=h("NetworkNotModified",t,i,o)}e=this.T(o);return this.j.add(e,r),yield this.G(e,r),r})}P(){return null!=this.S?this.S:(l.Log.error(this._+" is not attached to a Client"),"")}I(t){var e=null==(e=o.Storage.ce)?void 0:e.call(o.Storage,t);return null!=e&&(t=(0,c.C)(e,"source","Cached Result"))?$P($P({},t),{source:"Cache"}):null}G(t,e){return r(this,void 0,void 0,function*(){yield o.Storage.L(t,JSON.stringify(e)),yield this.K(t)})}K(n){var i;return r(this,void 0,void 0,function*(){var t=null!=(i=yield(0,o.F)(this.O))?i:{},e=(t[n]=Date.now(),u(t,10));e&&(delete t[e],yield o.Storage.q(e)),yield(0,o.J)(this.O,t)})}};class i{constructor(){this.V={}}get(t,e){var t=this.V[t],n=null==t?void 0:t.stableID,e=null==(e=null==e?void 0:e.customIDs)?void 0:e.stableID;return e&&n&&e!==n?(l.Log.warn("'StatsigUser.customIDs.stableID' mismatch"),null):t}add(t,e){var n=u(this.V,9);n&&delete this.V[n],this.V[t]=e}merge(t){this.V=$P($P({},this.V),t)}}function u(r,t){var e=Object.keys(r);return e.length<=t?null:e.reduce((t,e)=>{var n=r[t],i=r[e];return"object"==typeof n&&"object"==typeof i?i.receivedAt<n.receivedAt?e:t:i<n?e:t})}},8962:(t,s)=>{$Q2(s,"__esModule",{value:!0}),s.Diagnostics=void 0;const i=new Map,n="start";function r(t,e){return $P({key:"initialize",action:e,timestamp:Date.now()},t)}function o(t,e){var n=null!=(n=i.get(t))?n:[];n.push(e),i.set(t,n)}function e(t,e){if(e in t)return t[e]}s.Diagnostics={_i:t=>i.get(t),gi:t=>{o(t,r({},n))},bi:(t,e,n)=>{o(t,r({success:e,error:e?void 0:{name:"InitializeError",message:"Failed to initialize"},evaluationDetails:n},"end"))},mi:(t,e)=>{o(t,r(e,n))},pi:(t,e)=>{o(t,r(e,"end"))},yi:t=>{o(t,r({},n))},Oi:(t,e)=>{o(t,r(e,"end"))},Si:t=>{i.delete(t)},ji(t){if(t&&"object"==typeof t)return{code:e(t,"code"),name:e(t,"name"),message:e(t,"message")}},Ti(t,e,n,i){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===n.includes('"is_delta":true')||void 0,attempt:e,error:s.Diagnostics.ji(i)}},wi(t,e,n,i){var r=s.Diagnostics._i(n);null==r||r.length<=0||(s.Diagnostics.Si(n),n=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:i}),e.enqueue(n))}}},3539:(t,e)=>{$Q(e)},5542:function(t,u,e){var n=this&&this.__awaiter||$A();$Q2(u,"__esModule",{value:!0}),u.ErrorBoundary=u.EXCEPTION_ENDPOINT=void 0;const i=e(7512),l=e(5902),a=e(8e3),c=(u.EXCEPTION_ENDPOINT="https://statsigapi.net/v1/sdk_exception","[Statsig] UnknownError");u.ErrorBoundary=class{constructor(t,e,n){this.S=t,this.p=e,this.B=n,this.$=new Set}wrap(i){try{const t=i;!function(t){const e=new Set;let n=Object.getPrototypeOf(t);for(;n&&n!==Object.prototype;)Object.getOwnPropertyNames(n).filter(t=>"function"==typeof(null===n||void 0===n?void 0:n[t])).forEach(t=>e.add(t)),n=Object.getPrototypeOf(n);return Array.from(e)}(t).forEach(e=>{const n=t[e];"$EB"in n||(t[e]=(...t)=>this.H(e,()=>n.apply(i,t)),t[e].$EB=!0)})}catch(t){this.W("eb:wrap",t)}}logError(t,e){this.W(t,e)}H(e,t){try{var n=t();return n&&n instanceof Promise?n.catch(t=>this.W(e,t)):n}catch(t){return this.W(e,t),null}}W(s,o){try{i.Log.warn("Caught error in "+s,{error:o});n(this,void 0,void 0,function*(){var t,e,n=o||Error(c),i=n instanceof Error,r=i?n.name:"No Name";this.$.has(r)||(this.$.add(r),null!=(t=null==(t=this.p)?void 0:t.networkConfig)&&t.preventAllNetworkTraffic?null!=(t=this.B)&&t.call(this,{name:"error",error:o}):(t=l.SDKType.Y(this.S),e=a.StatsigMetadataProvider.get(),i=i?n.stack:function(t){try{return JSON.stringify(t)}catch(t){return c}}(n),n=JSON.stringify($P({tag:s,exception:r,info:i},$P($P({},e),{sdkType:t}))),yield(null!=(r=null==(i=null==(r=this.p)?void 0:r.networkConfig)?void 0:i.networkOverrideFunc)?r:fetch)(u.EXCEPTION_ENDPOINT,{method:"POST",headers:{"STATSIG-API-KEY":this.S,"STATSIG-SDK-TYPE":String(t),"STATSIG-SDK-VERSION":String(e.sdkVersion),"Content-Type":"application/json"},body:n}),null!=(i=this.B)&&i.call(this,{name:"error",error:o})))}).then(()=>{}).catch(()=>{})}catch(t){}}}},2922:(t,e)=>{$Q(e)},2417:(t,e)=>{$Q(e)},7770:function(t,e,n){var i=this&&this.__awaiter||$A();$Q(e),e.EventLogger=void 0;const r=n(2137),s=n(1406),o=n(7512),u=n(7410),l=n(6830),a=n(1637),c=n(4534),h=n(9638),d=n(2397),v={},f=t=>{null!=(t=v[t])&&t.flush().catch(()=>{})};e.EventLogger=class{constructor(t,e,n,i){this.S=t,this.B=e,this.X=n,this.p=i,this.Z=[],this.tt={},this.et={},this.it=!1,this.nt=Date.now(),this.st=!0===(null==i?void 0:i.disableLogging),this.rt=null!=(t=null==i?void 0:i.loggingBufferMaxSize)?t:50;e=null==i?void 0:i.networkConfig;this.ot=(0,h.ut)(null==e?void 0:e.logEventUrl,null==e?void 0:e.api,"/rgstr",u.NetworkDefault.eventsApi)}setLoggingDisabled(t){this.st=t}enqueue(t){this.dt(t)&&(this.vt(t),this.ft(),this.Z.length>this.rt)&&f(this.S)}incrementNonExposureCount(t){var e=null!=(e=this.et[t])?e:0;this.et[t]=e+1}reset(){this.tt={}}start(){(0,l.Mt)()||(v[this.S]=this,(0,d.lt)(t=>{"background"===t&&f(this.S)}),this.ct(),this.ht())}stop(){return i(this,void 0,void 0,function*(){this._t&&(clearInterval(this._t),this._t=null),yield this.flush()})}flush(){return i(this,void 0,void 0,function*(){var t;if(this.gt(),0!==this.Z.length)return t=this.Z,this.Z=[],this.bt(t)})}ft(){this.it||(this.it=!0,200<Date.now()-this.nt)||setTimeout(()=>f(this.S),200)}dt(t){if((0,l.Mt)())return!1;if((0,a.yt)(t)){var e=t.user||{statsigEnvironment:void 0},e=(0,r.l)(this.S,e),n=t.metadata||{},t=[t.eventName,e,n.gate,n.config,n.ruleID].join("|"),e=this.tt[t],n=Date.now();if(e&&n-e<6e4)return!1;1e3<Object.keys(this.tt).length&&(this.tt={}),this.tt[t]=n}return!0}bt(t){var e,n;return i(this,void 0,void 0,function*(){if(this.st)this.St(t);else try{(!(0,d.Ot)()&&this.X.isBeaconSupported()&&null==(null==(n=null==(e=this.p)?void 0:e.networkConfig)?void 0:n.networkOverrideFunc)?yield this.jt(t):yield this.Tt(t)).success?this.B({name:"logs_flushed",events:t}):this.St(t)}catch(t){o.Log.warn("Failed to flush events.")}})}Tt(e){var n;return i(this,void 0,void 0,function*(){var t=yield this.X.post(this.wt(e)),t=null!=(n=null==t?void 0:t.code)?n:-1;return{success:200<=t&&t<300}})}jt(t){return i(this,void 0,void 0,function*(){return{success:yield this.X.beacon(this.wt(t))}})}wt(t){return{sdkKey:this.S,data:{events:t},url:this.ot,retries:3,isCompressable:!0,params:{[u.NetworkParam.EventCount]:String(t.length)}}}St(t){for(;500<t.length;)t.shift();var e=this.u();try{(0,c.J)(e,t)}catch(t){o.Log.warn("Unable to save failed logs to storage")}}ct(){const e=this.u();i(this,void 0,void 0,function*(){var t=(0,c.F)(e);t&&(c.Storage.q(e),yield this.bt(t))}).catch(()=>{o.Log.warn("Failed to flush stored logs")})}u(){return"statsig.failed_logs."+(0,s.h)(this.S)}vt(t){t.user&&(t.user=$P({},t.user),delete t.user.privateAttributes);var e={},n=this.It(),n=(n&&(e.statsigMetadata={currentPage:n}),$P($P({},t),e));o.Log.debug("Enqueued Event:",n),this.Z.push(n)}gt(){0!==Object.keys(this.et).length&&(this.vt({eventName:"statsig::non_exposed_checks",user:null,time:Date.now(),metadata:{checks:$P({},this.et)}}),this.et={})}It(){var t;if(!1!==(null==(t=this.p)?void 0:t.includeCurrentPageUrlWithEvents))return(0,l.At)()}ht(){var t=null!=(t=null==(t=this.p)?void 0:t.loggingIntervalMs)?t:1e4;const e=setInterval(()=>{v[this.S]._t!==e?clearInterval(e):f(this.S)},t);this._t=e}}},1406:(t,s,e)=>{$Q2(s,"__esModule",{value:!0}),s.xt=s.Dt=s.h=void 0;const o=e(6634);s.h=e=>{let n=0;for(let t=0;t<e.length;t++){var i=e.charCodeAt(t);n=(n<<5)-n+i,n&=n}return String(n>>>0)},s.Dt=(t,e)=>(0,s.h)(JSON.stringify((0,s.xt)(t,e)));s.xt=(n,i)=>{if(null==n)return null;var t=Object.keys(n).sort();const r={};return t.forEach(t=>{var e=n[t];0===i||"object"!==(0,o.kt)(e)?r[t]=e:r[t]=(0,s.xt)(e,null!=i?i-1:i)}),r}},1333:(t,e)=>{$Q(e)},7512:(t,e)=>{function n(t){return t.unshift("[Statsig]"),t}var i,r;$Q(e),e.Log=e.LogLevel=void 0,(r=i||(e.LogLevel=i={}))[r.None=0]="None",r[r.Error=1]="Error",r[r.Warn=2]="Warn",r[r.Info=3]="Info",r[r.Debug=4]="Debug";class s{static info(...t){this.level>=i.Info&&console.info(...n(t))}static debug(...t){this.level>=i.Debug&&console.debug(...n(t))}static warn(...t){this.level>=i.Warn&&console.warn(...n(t))}static error(...t){this.level>=i.Error&&console.error(...n(t))}}(e.Log=s).level=i.Error},7410:(t,e)=>{$Q(e),e.NetworkParam=e.NetworkDefault=void 0,e.NetworkDefault={eventsApi:"https://statsigapi.net/v1",initializeApi:"https://statsigapi.net/v1",specsApi:"https://statsigapi.net/v1"},e.NetworkParam={EventCount:"ec",SdkKey:"k",SdkType:"st",SdkVersion:"sv",Time:"t",SessionID:"sid",StatsigEncoded:"se",IsGzipped:"gz"}},7023:function(t,e,n){var s=this&&this.__awaiter||$A();$Q(e),e.NetworkCore=void 0,n(1845);const o=n(1845),y=n(8962),b=n(7512),u=n(7410),i=n(5894),l=n(5902),a=n(6830),c=n(4143),h=n(9122),d=n(8e3),O=n(2397),j=new Set([408,500,502,503,504,522,524,599]);e.NetworkCore=class{constructor(t,e){this.B=e,this.Et=1e4,this.Rt={},this.p={},this.networkEvents=[],this.sdkKey=null,t&&(this.p=t),this.p.networkConfig&&(this.Rt=this.p.networkConfig),this.Rt.networkTimeoutMs&&(this.Et=this.Rt.networkTimeoutMs),this.Ii=new i.NetworkProxy(this.p),this._n()}post(n){return s(this,void 0,void 0,function*(){var t=this.ki(n);this.sdkKey||(this.sdkKey=n.sdkKey);let e=yield this.Nt($P($P({},n),t));return n.isStatsigEncodable&&(e=this.Ct(n,e)),this.Pt($P($P({method:"POST",body:e},t),n))})}get(t){return this.sdkKey||(this.sdkKey=t.sdkKey),this.Pt($P({method:"GET"},t))}isBeaconSupported(){return"undefined"!=typeof navigator&&"function"==typeof navigator.sendBeacon}beacon(i){return s(this,void 0,void 0,function*(){var t,e,n;return!!S(i)&&(e=this.ki(i),t=yield this.Nt($P($P({},i),e)),e=yield this.Gt($P($P({},i),e)),(n=navigator).sendBeacon.bind(n)(e,t))})}Pt(g){var p,m;return s(this,void 0,void 0,function*(){if(!S(g))return null;if(this.Rt.preventAllNetworkTraffic)return null;var{method:e,body:n,retries:i,attempt:r}=g,r=null!=r?r:1;const s="undefined"!=typeof AbortController?new AbortController:null;var t=setTimeout(()=>{null!==s&&void 0!==s&&s.abort(`Timeout of ${this.Et}ms expired.`)},this.Et),o=null!=(m=g.proxyUrl)?m:this.Ii.getProxyUrl(g.sdkKey,g.url),o=(console.log("1"),yield this.Gt($P({proxyUrl:o},g))),u=(console.log("2"),!o.includes("https://statsigapi.net/v1")),l=new URL(o).pathname;let a=null;var c=(0,O.Ut)();console.log("3");try{var h,d,v,f={method:e,body:n,headers:$P({},g.headers),signal:null===s||void 0===s?void 0:s.signal,priority:g.priority,keepalive:c},_=(console.log("3"),g.isInitialize&&y.Diagnostics.mi(g.sdkKey,{attempt:r}),null!=(p=this.Rt.networkOverrideFunc)?p:fetch);if(a=yield _(o,f),clearTimeout(t),console.log("4"),a.ok)return v=yield a.text(),g.isInitialize&&y.Diagnostics.pi(g.sdkKey,y.Diagnostics.Ti(a,r,v)),console.log("network success!!"),o.includes("https://prodregistryv2.org")||(console.log("pushing success network event!!"),this.networkEvents.push({value:u?"proxy":"statsig",eventName:"proxy::network_request_tracking",metadata:{url:o,success:!0,endpoint:l},time:Date.now(),user:null})),{body:v,code:a.status};throw h=yield a.text().catch(()=>"No Text"),d=new Error(`NetworkError: ${o} `+h),console.log("response not ok!!",d),d.name="NetworkError",d}catch(t){console.log("network error!!",t),o.includes("https://prodregistryv2.org")||(console.log("pushing failure network event!!"),this.networkEvents.push({value:u?"proxy":"statsig",eventName:"proxy::network_request_tracking",metadata:{url:o,success:!1,endpoint:l},time:Date.now(),user:null}));n=function(t,e){if(null!=t&&t.signal.aborted&&"string"==typeof t.signal.reason)return t.signal.reason;if("string"==typeof e)return e;if(e instanceof Error)return e.name+": "+e.message;return"Unknown Error"}(s,t),c=function(t){t=(null==t?void 0:t.signal.aborted)&&"string"==typeof t.signal.reason&&t.signal.reason.includes("Timeout");return t||!1}(s);return g.isInitialize&&y.Diagnostics.pi(g.sdkKey,y.Diagnostics.Ti(a,r,"",t)),yield this.Ii.attemptToUpdateProxyUrl(g.sdkKey,n,c),!i||i<r||!j.has(null!=(m=null===a||void 0===a?void 0:a.status)?m:500)?(null!=(m=this.B)&&m.call(this,{name:"error",error:t}),b.Log.error(`A networking error occured during ${e} request to ${o}.`,n,t),null):this.Pt($P($P({},g),{retries:i,attempt:r+1}))}})}Gt(i){var r;return s(this,void 0,void 0,function*(){var t=null!=(r=i.proxyUrl)?r:i.url;const e=$P({[u.NetworkParam.SdkKey]:i.sdkKey,[u.NetworkParam.SdkType]:l.SDKType.Y(i.sdkKey),[u.NetworkParam.SdkVersion]:d.SDK_VERSION,[u.NetworkParam.Time]:String(Date.now()),[u.NetworkParam.SessionID]:yield c.SessionID.get(i.sdkKey)},i.params);var n=Object.keys(e).map(t=>encodeURIComponent(t)+"="+encodeURIComponent(e[t])).join("&");return t+(n?"?"+n:"")})}Nt(r){return s(this,void 0,void 0,function*(){var{data:t,sdkKey:e}=r,n=yield h.StableID.get(e),i=yield c.SessionID.get(e),e=l.SDKType.Y(e);return JSON.stringify($P($P({},t),{statsigMetadata:$P($P({},d.StatsigMetadataProvider.get()),{stableID:n,sessionID:i,sdkType:e,proxyUrl:r.proxyUrl})}))})}Ct(t,e){var n,i,r=(0,a.Lt)();if(!t.isStatsigEncodable||this.p.disableStatsigEncoding||null!=(0,o.i)("no-encode")||null==r||!r.btoa)return e;try{var s=null!=(n=r.btoa(e).split("").reverse().join(""))?n:e;return t.params=$P($P({},null!=(i=t.params)?i:{}),{[u.NetworkParam.StatsigEncoded]:"1"}),s}catch(t){return b.Log.warn("/initialize request encoding failed"),e}}ki(t){t=this.Ii.getProxyUrl(t.sdkKey,t.url);return{proxyUrl:null!=t?t:null}}gn(){var t;console.log("flushing network events!!",this.networkEvents),0!==this.networkEvents.length&&(this.post({sdkKey:null!=(t=this.sdkKey)?t:"",url:"https://prodregistryv2.org/v1/rgstr",data:{events:[...this.networkEvents]}}),this.networkEvents=[])}_n(){setInterval(()=>{this.gn()},1e4)}};const S=t=>!!t.sdkKey||(b.Log.warn("Unable to make request without an SDK key"),!1)},5894:function(t,e,n){var s=this&&this.__awaiter||$A();$Q(e),e.NetworkProxy=void 0;const i=n(1406),r=n(7410),o=n(4534),u=n(3401);function l(t){return"statsig.proxy."+(0,i.h)(t)}e.NetworkProxy=class{constructor(t){this.p=t,this.xi=null,this.Di=0,this.Ai=void 0,t.networkConfig&&(t=t.networkConfig,this.setOverrideFunc(t.networkOverrideFunc))}setOverrideFunc(t){this.Ai=t}getProxyUrl(t,e){return function(t){for(const e in r.NetworkDefault)if(t.startsWith(r.NetworkDefault[e]))return 1;return}(e)?(e=function(t){try{return new URL(t).pathname.substring(1)}catch(t){return""}}(e),0<this.Di&&Date.now()>this.Di?(this.xi=null,this.Di=0,this.xi):this.xi?this.xi+e:(t=function(t){t=o.Storage.ce(t);if(t){t=(0,u.C)(t,"url","cacheProxy");if(t&&Date.now()<t.expiryTime)return t}return null}(l(t)))?(this.xi=t.url,this.Di=t.expiryTime,this.xi+e):null):null}attemptToUpdateProxyUrl(n,i,r){return s(this,void 0,void 0,function*(){var t,e;(function(t,e){t=(null==t?void 0:t.toLowerCase())||"";return e||t.includes("uncaught exception")||t.includes("failed to fetch")||t.includes("networkerror when attempting to fetch resource")})(i,r)&&(t=l(n),e=yield this.Mi())&&(this.xi=e,this.Di=Date.now()+2592e5,o.Storage.L(t,JSON.stringify({url:this.xi,expiryTime:this.Di})))})}Mi(){return s(this,void 0,void 0,function*(){var t,e=yield this.Ei("featureregistry.org");return 0!==e.length&&([e,t]=function(t){let e=1440,n=0;var i=[],r=(new Date).getTimezoneOffset()+720;for(const u of t){var[s,o]=u.split("="),o=(i.push(o),null==s?void 0:s.split("_")[1]),s=parseInt(o);s&&!Number.isNaN(s)&&(o=Math.abs(s-r))<e&&(n=i.length-1,e=o)}return[i,n]}(e=e),0!==e.length)?e.length>t?e[t]:e[0]:null})}Ei(t){var u;return s(this,void 0,void 0,function*(){var e=function(t){var e=[0,0,1,0,0,1,0,0,0,0,0,0],t=t.split(".");for(const n of t){e.push(n.length);for(const i of n)e.push(i.charCodeAt(0))}return e.push(0,0,16,0,1),Uint8Array.from(e)}(t),e=yield(null!=(u=this.Ai)?u:fetch)("https://cloudflare-dns.com/dns-query",{method:"POST",headers:{"Content-Type":"application/dns-message",Accept:"application/dns-message"},body:e});if(e.ok){e=yield e.arrayBuffer();{var n=Array.from(new Uint8Array(e));let t=n.indexOf(192);for(var i=[];-1<t&&t<n.length-2;){var r=n[t+1];if(n.length<t+r+1)break;var s=n[t+r],o=n.slice(t+r+1,t+r+s+1);i.push(o.map(t=>String.fromCharCode(t)).join("")),t=n.indexOf(192,t+r+s)}return i}}return[]})}}},1405:(t,e)=>{$Q(e)},1361:(t,e)=>{$Q(e)},5902:(t,e)=>{$Q(e),e.SDKType=void 0;const n={};let i;e.SDKType={Y:t=>{return(null!=(t=n[t])?t:"js-mono")+(null!==i&&void 0!==i?i:"")},Kt(t,e){n[t]=e},Ft(t){i&&"-react"!==i||(i="-"+t)}}},6830:(t,i)=>{$Q2(i,"__esModule",{value:!0}),i.At=i.qt=i.zt=i.Mt=i.Jt=i.Lt=void 0;i.Lt=()=>"undefined"!=typeof window?window:null,i.Jt=()=>{var t=(0,i.Lt)();return null!=(t=null==t?void 0:t.document)?t:null},i.Mt=()=>{var t;return null===(0,i.Jt)()&&(t="undefined"!=typeof process&&null!=process.versions&&null!=process.versions.node,"string"==typeof EdgeRuntime||t)},i.zt=(t,e)=>{var n=(0,i.Lt)();"function"==typeof(null==n?void 0:n.addEventListener)&&n.addEventListener(t,e)},i.qt=(t,e)=>{var n=(0,i.Jt)();"function"==typeof(null==n?void 0:n.addEventListener)&&n.addEventListener(t,e)};i.At=()=>{var t;try{return null==(t=(0,i.Lt)())?void 0:t.location.href.split(/[?#]/)[0]}catch(t){}}},4143:(t,e,n)=>{$Q(e),e.StatsigSession=e.SessionID=void 0;const i=n(2137),s=n(7512),o=n(4534),u=n(8023),l=18e5,a=144e5,c={};function h(e,t){return setTimeout(()=>{var t=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instance(e);t&&t.$emt({name:"session_expired"})},t)}function d(t){return"statsig.session_id."+(0,i.u)(t)}e.SessionID={get:t=>e.StatsigSession.get(t).data.sessionID},e.StatsigSession={get:t=>{null==c[t]&&(c[t]=function(t){let e=function(t){t=d(t);return(0,o.F)(t)}(t);var n=Date.now();e=e||{sessionID:(0,u.getUUID)(),startTime:n,lastUpdate:n};return{data:e,sdkKey:t}}(t));var t=c[t],e=Date.now(),n=t.data,i=((function({lastUpdate:t}){return Date.now()-t>l}(n)||function({startTime:t}){return Date.now()-t>a}(n))&&(n.sessionID=(0,u.getUUID)(),n.startTime=e),n.lastUpdate=e,n),r=t.sdkKey;r=d(r);try{(0,o.J)(r,i)}catch(t){s.Log.warn("Failed to save SessionID")}return clearTimeout(t.idleTimeoutID),clearTimeout(t.ageTimeoutID),e-=n.startTime,n=t.sdkKey,t.idleTimeoutID=h(n,l),t.ageTimeoutID=h(n,a-e),t},overrideInitialSessionID:(t,e)=>{var n;c[e]=(t=t,e=e,n=Date.now(),{data:{sessionID:t,startTime:n,lastUpdate:n},sdkKey:e})}}},9122:(t,e,n)=>{$Q(e),e.StableID=void 0;const i=n(2137),r=n(7512),s=n(4534),o=n(8023),u={};function l(t){return"statsig.stable_id."+(0,i.u)(t)}function a(t,e){e=l(e);try{(0,s.J)(e,t)}catch(t){r.Log.warn("Failed to save StableID")}}e.StableID={get:e=>{if(null==u[e]){let t=function(t){t=l(t);return(0,s.F)(t)}(e);null==t&&a(t=(0,o.getUUID)(),e),u[e]=t}return u[e]},setOverride:(t,e)=>{a(u[e]=t,e)}}},1375:function(t,e,n){var i=this&&this.__awaiter||$A();$Q(e),e.StatsigClientBase=void 0,n(1845);const o=n(1845),u=n(5542),l=n(7770),a=n(7512),c=n(6830),h=n(4143),d=n(4534);e.StatsigClientBase=class{constructor(t,e,n,i){this.loadingStatus="Uninitialized",this.Vt={};var r,s=this.$emt.bind(this);null!=(null==i?void 0:i.logLevel)&&(a.Log.level=i.logLevel),null!=i&&i.disableStorage&&d.Storage.Bt(!0),null!=i&&i.initialSessionID&&h.StatsigSession.overrideInitialSessionID(i.initialSessionID,t),this.S=t,this.p=null!=i?i:{},this.overrideAdapter=null!=(r=null==i?void 0:i.overrideAdapter)?r:null,this.Ht=new l.EventLogger(t,s,n,i),this.Wt=new u.ErrorBoundary(t,i,s),this.Wt.wrap(this),this.Wt.wrap(n),this.Wt.wrap(e),this.Wt.wrap(this.Ht),(0,c.Mt)()||(null!=(n=null!=(s=(r=(0,o.o)()).instances)?s:{})[t]&&a.Log.warn("Creating multiple Statsig clients with the same SDK key can lead to unexpected behavior. Multi-instance support requires different SDK keys."),n[t]=this,r.lastInstance=this,r.instances=n,__STATSIG__=r),this.dataAdapter=e,this.dataAdapter.attach(t,i),this.Yt()}updateRuntimeOptions(t){null!=t.disableLogging&&(this.p.disableLogging=t.disableLogging,this.Ht.setLoggingDisabled(t.disableLogging)),null!=t.disableStorage&&(this.p.disableStorage=t.disableStorage,d.Storage.Bt(t.disableStorage))}flush(){return this.Ht.flush()}shutdown(){return i(this,void 0,void 0,function*(){this.$emt({name:"pre_shutdown"}),yield this.Ht.stop()})}on(t,e){this.Vt[t]||(this.Vt[t]=[]),this.Vt[t].push(e)}off(t,e){this.Vt[t]&&-1!==(e=this.Vt[t].indexOf(e))&&this.Vt[t].splice(e,1)}$on(t,e){e.__isInternal=!0,this.on(t,e)}$emt(n){var t;const e=e=>{try{e(n)}catch(t){!0===e.__isInternal?this.Wt.logError("__emit:"+n.name,t):a.Log.error("An error occurred in a StatsigClientEvent listener. This is not an issue with Statsig.",n)}};this.Vt[n.name]&&this.Vt[n.name].forEach(t=>e(t)),null!=(t=this.Vt["*"])&&t.forEach(e)}Qt(t,e){this.loadingStatus=t,this.$emt({name:"values_updated",status:t,values:e})}Xt(t,e,n){!0===(null==n?void 0:n.disableExposureLog)?this.Ht.incrementNonExposureCount(t):this.Ht.enqueue(e)}}},2636:(t,e)=>{$Q(e)},3206:(t,e)=>{$Q(e),e.DataAdapterCachePrefix=void 0,e.DataAdapterCachePrefix="statsig.cached"},1637:(t,e)=>{$Q(e),e.Zt=e.te=e.ee=e.yt=void 0;const n="statsig::config_exposure",i="statsig::gate_exposure",l=(t,e,n,i,r)=>({eventName:t,user:e,value:null,metadata:s(n,i),secondaryExposures:r,time:Date.now()});e.yt=({eventName:t})=>t===i||t===n,e.ee=(t,e)=>{return l(i,t,e.details,{gate:e.name,gateValue:String(e.value),ruleID:e.ruleID},null!=(e=null==(t=e.__evaluation)?void 0:t.secondary_exposures)?e:[])},e.te=(t,e)=>{return l(n,t,e.details,{config:e.name,ruleID:e.ruleID},null!=(e=null==(t=e.__evaluation)?void 0:t.secondary_exposures)?e:[])};e.Zt=(t,e,n)=>{var i,r=e.__evaluation,s=!0===(null==(s=null==r?void 0:r.explicit_parameters)?void 0:s.includes(n));let o="",u=null!=(i=null==r?void 0:r.undelegated_secondary_exposures)?i:[];return s&&(o=null!=(i=r.allocated_experiment_name)?i:"",u=r.secondary_exposures),l("statsig::layer_exposure",t,e.details,{config:e.name,parameterName:n,ruleID:e.ruleID,allocatedExperiment:o,isExplicitParameter:String(s)},u)};const s=(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="1.8.0-beta.13";let n={sdkVersion:e.SDK_VERSION,sdkType:"js-mono"};e.StatsigMetadataProvider={get:()=>n,add:t=>{n=$P($P({},n),t)}}},586:(t,e)=>{$Q(e)},2059:(t,e,n)=>{$Q(e),e.ie=e.ne=e.se=e.re=e.oe=e.ue=void 0;const s=n(6634),r="default";function o(t,e,n,i){return{name:t,details:e,ruleID:null!=(t=null==n?void 0:n.rule_id)?t:r,__evaluation:n,value:i}}function i(t,e,n){var i=null!=(i=null==n?void 0:n.value)?i:{};return $P($P({},o(t,e,n,i)),{get:u(null==n?void 0:n.value)})}function u(i,r){return(t,e)=>{var n=null!=(n=null==i?void 0:i[t])?n:null;return null!=n&&(null==e||(0,s.le)(n,e))?(null!=r&&r(t),n):null!=e?e:null}}e.ue=function(t,e,n){return o(t,e,n,!0===(null==n?void 0:n.value))},e.oe=i,e.re=function(t,e,n){return t=i(t,e,n),$P($P({},t),{groupName:null!=(e=null==n?void 0:n.group_name)?e:null})},e.se=function(t,e,n,i){return $P($P({},o(t,e,n,void 0)),{get:u(null==n?void 0:n.value,i),groupName:null!=(t=null==n?void 0:n.group_name)?t:null,__value:null!=(e=null==n?void 0:n.value)?e:{}})},e.ne=function(t,e,n,i){return $P($P($P({},t),e),{get:u(n,i)})},e.ie=u},1812:(t,e)=>{$Q(e)},8578:(t,e,n)=>{$Q(e),e.v=e.A=void 0;const i=n(1406),r=n(7512);e.A=function(t,e){try{var n=JSON.parse(JSON.stringify(t));return null!=e&&null!=e.environment&&(n.statsigEnvironment=e.environment),n}catch(t){return r.Log.error("Failed to JSON.stringify user"),{statsigEnvironment:void 0}}},e.v=function(t){return t?(0,i.Dt)(t):null}},4534:(t,n,e)=>{$Q2(n,"__esModule",{value:!0}),n.J=n.F=n.Storage=void 0;var i=e(7512),e=e(6830);const r={},s={ae:()=>"InMemory",ce:t=>r[t]||null,L:(t,e)=>{r[t]=e},q:t=>{delete r[t]},he:()=>Object.keys(r)};let o=null;try{const a=(0,e.Lt)();a&&a.localStorage&&"function"==typeof a.localStorage.getItem&&(o={ae:()=>"LocalStorage",ce:t=>a.localStorage.getItem(t),L:(t,e)=>a.localStorage.setItem(t,e),q:t=>a.localStorage.removeItem(t),he:()=>Object.keys(a.localStorage)})}catch(t){i.Log.warn("Failed to setup localStorageProvider.")}let u=null!==o&&void 0!==o?o:s,l=u;n.Storage={ae:()=>l.ae(),ce:t=>{var e=()=>l.ce(t);try{return e()}catch(t){if(t instanceof Error&&"SecurityError"===t.name)return n.Storage.de(s),null;throw t}},L:(t,e)=>l.L(t,e),q:t=>l.q(t),he:()=>l.he(),de:t=>{u=t,l=t},Bt:t=>{l=t?s:u}},n.F=function(t){return t=n.Storage.ce(t),JSON.parse(null!=t?t:"null")},n.J=function(t,e){n.Storage.L(t,JSON.stringify(e))}},3401:(t,e,n)=>{$Q(e),e.C=void 0;const r=n(7512);e.C=function(t,e,n){try{var i=JSON.parse(t);return"object"==typeof i&&0 in i,i}catch(t){}return r.Log.error("Failed to parse "+n),null}},6634:(t,e)=>{$Q(e),e.le=e.kt=void 0,e.kt=function(t){return Array.isArray(t)?"array":typeof t},e.le=function(t,e){var n=t=>Array.isArray(t)?"array":typeof t;return n(t)===n(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 n=(new Date).getTime(),i="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<n?(e=(n+e)%16|0,n=Math.floor(n/16)):(e=(i+e)%16|0,i=Math.floor(i/16)),("x"===t?e:7&e|8).toString(16)})}},9638:(t,e)=>{$Q(e),e.ut=void 0,e.ut=function(t,e,n,i){return t||(e?""+e+n:""+i+n)}},2397:(t,e,n)=>{$Q(e),e.ve=e.lt=e.Ut=e.Ot=void 0;n=n(6830);const i="foreground",r="background",s=[];let o=i,u=!1;e.Ot=()=>o===i,e.Ut=()=>u,e.lt=t=>{s.unshift(t)};e.ve=e=>{e!==o&&(o=e,s.forEach(t=>t(e)))},(0,n.zt)("focus",()=>{(u=!1,e.ve)(i)}),(0,n.zt)("blur",()=>(0,e.ve)(r)),(0,n.zt)("beforeunload",()=>{u=!0,(0,e.ve)(r)}),(0,n.qt)("visibilitychange",()=>{(0,e.ve)("visible"===document.visibilityState?i:r)})},6914:function(t,e,n){var i=this&&this.__createBinding||(Object.create?function(t,e,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(e,n);r&&("get"in r?e.__esModule:!r.writable&&!r.configurable)||(r={enumerable:!0,get:function(){return e[n]}}),$Q2(t,i,r)}:function(t,e,n,i){t[i=void 0===i?n:i]=e[n]}),r=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||i(e,t,n)};$Q(e),e.Diagnostics=e.Log=e.Storage=e.EventLogger=void 0,n(1845);const s=n(8962),o=($Q2(e,"Diagnostics",{enumerable:!0,get:function(){return s.Diagnostics}}),n(7770)),u=($Q2(e,"EventLogger",{enumerable:!0,get:function(){return o.EventLogger}}),n(7512));$Q2(e,"Log",{enumerable:!0,get:function(){return u.Log}});var l=n(8e3);const a=n(4534);$Q2(e,"Storage",{enumerable:!0,get:function(){return a.Storage}}),r(n(1845),e),r(n(2137),e),r(n(6427),e),r(n(694),e),r(n(8962),e),r(n(3539),e),r(n(5542),e),r(n(2922),e),r(n(2417),e),r(n(1406),e),r(n(1333),e),r(n(7512),e),r(n(7023),e),r(n(7410),e),r(n(1405),e),r(n(1361),e),r(n(6830),e),r(n(5902),e),r(n(4143),e),r(n(9122),e),r(n(1375),e),r(n(2636),e),r(n(3206),e),r(n(1637),e),r(n(8e3),e),r(n(586),e),r(n(2059),e),r(n(1812),e),r(n(8578),e),r(n(4534),e),r(n(3401),e),r(n(6634),e),r(n(9638),e),r(n(8023),e),r(n(2397),e),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{Log:u.Log,SDK_VERSION:l.SDK_VERSION})},2016:(t,e,n)=>{$Q(e),e.AutoInit=void 0;const v=n(6914),f=n(2018);function _(t,e){var n;return null!=(n=e.get(t))?n:e.get(t.toLowerCase())}e.AutoInit=class{static attempt(e){var t,n,i;try{var r=(0,v.Lt)(),s=(0,v.Jt)();if(r&&s&&s.currentScript){var o=s.currentScript.getAttribute("src"),u=null==(t=r.location)?void 0:t.href;if(o&&u){var l=new URL(o,u).searchParams,a=null!=(n=_("sdkKey",l))?n:_("apiKey",l);if(a){var c={},h=_("proxy",l),d=(h&&(c.networkConfig={api:h}),null==(i=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instances)?void 0:i[a]);let t=null;(t=d instanceof f.StatsigClient?d:t)||(t=new f.StatsigClient(a,function(){var t=(0,v.Lt)();if(!t)return{};let e=t.statsigUser||{};var n=(e="object"!=typeof e?{}:e).custom||{},i=e.customIDs||{};return $P($P({},e),{customIDs:$P({},i),custom:$P($P({},n),{useragent:t.navigator.userAgent,page_url:(0,v.At)()||"",language:null==(i=t.navigator)?void 0:i.language})})}(),c)).initializeAsync().catch(t=>{v.Log.error(t)}),e({sdkKey:a,client:t})}}}}catch(t){v.Log.error("AutoInit failed",t)}}}},7262:(t,e,n)=>{$Q(e),e.fe=void 0;const i=n(6914);function r(t,e){null!=t&&t.forEach(t=>{delete e[t]})}e.fe=function(t,e){var n;return(e=(0,i.C)(e,"checksum","DeltasEvaluationResponse"))?(t=t,n=e,t=$P($P($P({},t),n),{feature_gates:$P($P({},t.feature_gates),n.feature_gates),layer_configs:$P($P({},t.layer_configs),n.layer_configs),dynamic_configs:$P($P({},t.dynamic_configs),n.dynamic_configs)}),r((t=n=t).deleted_gates,t.feature_gates),delete t.deleted_gates,r(n.deleted_configs,t.dynamic_configs),delete t.deleted_configs,r(n.deleted_layers,t.layer_configs),delete t.deleted_layers,n=t,(t=(0,i.Dt)({feature_gates:n.feature_gates,dynamic_configs:n.dynamic_configs,layer_configs:n.layer_configs},2))===e.checksumV2?JSON.stringify(n):{hadBadDeltaChecksum:!0,badChecksum:t,badMergedConfigs:n,badFullResponse:e.deltas_full_response}):{hadBadDeltaChecksum:!0}}},4845:(t,e,n)=>{$Q(e);const i=n(6914);e.default=class{constructor(){this._e=null,this.ge=null,this.be="Uninitialized",this.ye=0,this.me=0}reset(){this.ge=null,this._e=null,this.be="Loading",this.ye=0,this.me=0}finalize(){this.ge||(this.be="NoValues")}getValues(){return this._e?(0,i.C)(this._e,"has_updates","EvaluationStoreValues"):null}setValues(t){var e;return!!t&&null!=(e=(0,i.C)(t.data,"has_updates","EvaluationResponse"))&&(this.be=t.source,!0===(null==e?void 0:e.has_updates)&&(this._e=t.data,this.ye=e.time,this.me=t.receivedAt,this.ge=e),!0)}getGate(t){var e;return this.pe(null==(e=this.ge)?void 0:e.feature_gates,t)}getConfig(t){var e;return this.pe(null==(e=this.ge)?void 0:e.dynamic_configs,t)}getLayer(t){var e;return this.pe(null==(e=this.ge)?void 0:e.layer_configs,t)}getParamStore(t){var e;return this.pe(null==(e=this.ge)?void 0:e.param_stores,t)}pe(t,e){let n=null;return{result:n=t?t[e]||t[(0,i.h)(e)]:n,details:this.Se(null==n)}}getCurrentSourceDetails(){return"Uninitialized"===this.be||"NoValues"===this.be?{reason:this.be}:{reason:this.be,lcut:this.ye,receivedAt:this.me}}Se(t){var e=this.getCurrentSourceDetails();let n=e.reason;return"Uninitialized"!==n&&"NoValues"!==n&&(n=n+":"+(t?"Unrecognized":"Recognized")),$P($P({},e),{reason:n})}}},8448:function(t,e,n){var o=this&&this.__awaiter||$A();$Q(e);const u=n(6914),l=n(7262);class i extends u.NetworkCore{constructor(t,e){super(t,e);e=null==t?void 0:t.networkConfig;this.Oe=(0,u.ut)(null==e?void 0:e.initializeUrl,null==e?void 0:e.api,"/initialize",u.NetworkDefault.initializeApi)}fetchEvaluations(n,i,r,s){return o(this,void 0,void 0,function*(){var t=i?(0,u.C)(i,"has_updates","InitializeResponse"):null;let e={user:s,hash:"djb2",deltasResponseRequested:!1};return null!=t&&t.has_updates&&(e=$P($P({},e),{sinceTime:t.time,previousDerivedFields:"derived_fields"in t?t.derived_fields:{},deltasResponseRequested:!0})),this.je(n,t,e,r)})}je(e,n,i,r){var s;return o(this,void 0,void 0,function*(){var t=yield this.post({sdkKey:e,url:this.Oe,data:i,retries:2,isStatsigEncodable:!0,priority:r,isInitialize:!0});return 204===(null==t?void 0:t.code)?'{"has_updates": false}':200!==(null==t?void 0:t.code)?null!=(s=null==t?void 0:t.body)?s:null:!0!==(null==n?void 0:n.has_updates)||!0!==(null==(s=t.body)?void 0:s.includes('"is_delta":true'))||!0!==i.deltasResponseRequested?t.body:"string"==typeof(t=(0,l.fe)(n,t.body))?t:this.je(e,n,$P($P($P({},i),t),{deltasResponseRequested:!1}),r)})}}e.default=i},3583:(t,e,n)=>{$Q(e),e.Te=void 0;const g=n(6914),p={disableExposureLog:!0};function m(t){return null==t||!1===t.disableExposureLog}function y(t,e){return null!=e&&!(0,g.le)(t,e)}e.Te=function(v,f,_){return(t,e)=>{if(null==f)return e;var n,i,r,s,o,u,l,a,c,h,d=f[t];if(null==d||null!=e&&(0,g.kt)(e)!==d.param_type)return e;switch(d.ref_type){case"static":return d.value;case"gate":return h=d,v.getFeatureGate(h.gate_name,m(_)?void 0:p).value?h.pass_value:h.fail_value;case"dynamic_config":return h=d,l=e,a=_,y(c=(u=v).getDynamicConfig(h.config_name,p).get(h.param_name),l)?l:(m(a)&&u.getDynamicConfig(h.config_name),c);case"experiment":return l=d,a=e,u=_,y(o=(c=v).getExperiment(l.experiment_name,p).get(l.param_name),a)?a:(m(u)&&c.getExperiment(l.experiment_name),o);case"layer":return o=d,i=e,r=_,y(s=(n=v).getLayer(o.layer_name,p).get(o.param_name),i)?i:(m(r)&&n.getLayer(o.layer_name).get(o.param_name),s);default:return e}}}},8198:function(t,e,n){var r=this&&this.__awaiter||$A();$Q(e);const o=n(6914),s=n(4845),u=n(8448),l=n(3583),a=n(4131);class i extends o.StatsigClientBase{static instance(t){var e=(0,o.o)().instance(t);return e instanceof i?e:(o.Log.warn((0,o.Mt)()?"StatsigClient.instance is not supported in server environments":"Unable to find StatsigClient instance"),new i(null!=t?t:"",{}))}constructor(t,e,n=null){o.SDKType.Kt(t,"javascript-client");var i=new u.default(n,t=>{this.$emt(t)});super(t,null!=(t=null==n?void 0:n.dataAdapter)?t:new a.StatsigEvaluationsDataAdapter,i,n),this.we=new s.default,this.Ie=(0,o.A)(e,n)}initializeSync(){this.Ht.start(),this.updateUserSync(this.Ie)}initializeAsync(t){return this.Ht.start(),this.updateUserAsync(this.Ie,t)}updateUserSync(t){this.Ae(t);t=this.dataAdapter.getDataSync(this.Ie);this.we.setValues(t),this.Me(t),this.xe(null!=t?t:null,this.Ie)}updateUserAsync(n,i){return r(this,void 0,void 0,function*(){this.Ae(n);var t=this.Ie,e=(o.Diagnostics.gi(this.S),this.dataAdapter.getDataSync(t));if(this.we.setValues(e),this.Qt("Loading",e),e=yield this.dataAdapter.getDataAsync(e,t,i),t===this.Ie){let t=!1;null!=e&&(o.Diagnostics.yi(this.S),t=this.we.setValues(e),o.Diagnostics.Oi(this.S,{success:t})),this.Me(e),o.Diagnostics.bi(this.S,t,this.we.getCurrentSourceDetails()),o.Diagnostics.wi(this.Ie,this.Ht,this.S,this.p)}})}getContext(){return{sdkKey:this.S,options:this.p,values:this.we.getValues(),user:JSON.parse(JSON.stringify(this.Ie)),errorBoundary:this.Wt,session:o.StatsigSession.get(this.S),stableID:o.StableID.get(this.S)}}checkGate(t,e){return this.getFeatureGate(t,e).value}getFeatureGate(t,e){var{result:n,details:i}=this.we.getGate(t),i=(0,o.ue)(t,i,n),r=null==(r=null==(n=this.overrideAdapter)?void 0:n.getGateOverride)?void 0:r.call(n,i,this.Ie,e),n=null!=r?r:i;return this.Xt(t,(0,o.ee)(this.Ie,n),e),this.$emt({name:"gate_evaluation",gate:n}),n}getDynamicConfig(t,e){var{result:n,details:i}=this.we.getConfig(t),i=(0,o.oe)(t,i,n),r=null==(r=null==(n=this.overrideAdapter)?void 0:n.getDynamicConfigOverride)?void 0:r.call(n,i,this.Ie,e),n=null!=r?r:i;return this.Xt(t,(0,o.te)(this.Ie,n),e),this.$emt({name:"dynamic_config_evaluation",dynamicConfig:n}),n}getExperiment(t,e){var{result:n,details:i}=this.we.getConfig(t),i=(0,o.re)(t,i,n),r=null==(r=null==(n=this.overrideAdapter)?void 0:n.getExperimentOverride)?void 0:r.call(n,i,this.Ie,e),n=null!=r?r:i;return this.Xt(t,(0,o.te)(this.Ie,n),e),this.$emt({name:"experiment_evaluation",experiment:n}),n}getLayer(e,n){var{result:t,details:i}=this.we.getLayer(e),i=(0,o.se)(e,i,t),r=null==(r=null==(t=this.overrideAdapter)?void 0:t.getLayerOverride)?void 0:r.call(t,i,this.Ie,n);const s=(0,o.ne)(i,r,null!=(t=null==r?void 0:r.__value)?t:i.__value,t=>{this.Xt(e,(0,o.Zt)(this.Ie,s,t),n)});return this.$emt({name:"layer_evaluation",layer:s}),s}getParameterStore(t,e){var{result:n,details:i}=this.we.getParamStore(t);return this.Ht.incrementNonExposureCount(t),{name:t,details:i,__configuration:n,get:(0,l.Te)(this,n,e)}}logEvent(t,e,n){this.Ht.enqueue($P($P({},"string"==typeof t?{eventName:t,value:e,metadata:n}:t),{user:this.Ie,time:Date.now()}))}Yt(){this.$on("error",()=>{"Loading"===this.loadingStatus&&this.Me(null)})}Me(t){this.we.finalize(),this.Qt("Ready",t)}xe(t,e){this.dataAdapter.getDataAsync(t,e,{priority:"low"}).catch(t=>{o.Log.error("An error occurred after update.",t)})}Ae(t){this.Ht.reset(),this.we.reset(),this.Ie=(0,o.A)(t,this.p);t=null==(t=this.Ie.customIDs)?void 0:t.stableID;t&&o.StableID.setOverride(t,this.S)}}e.default=i},4131:function(t,e,n){var s=this&&this.__awaiter||$A();$Q(e),e.StatsigEvaluationsDataAdapter=void 0;const i=n(6914),r=n(8448);class o extends i.DataAdapterCore{constructor(){super("EvaluationsDataAdapter","evaluations"),this.X=null,this.p=null}attach(t,e){super.attach(t,e),this.X=new r.default(null!=e?e:{})}getDataAsync(t,e,n){return this.M(t,(0,i.A)(e,this.p),n)}prefetchData(t,e){return this.k(t,e)}setData(t){var e=(0,i.C)(t,"has_updates","data");e&&"user"in e?super.setData(t,e.user):i.Log.error("StatsigUser not found")}setDataLegacy(t,e){super.setData(t,e)}N(e,n,i){var r;return s(this,void 0,void 0,function*(){var t=yield null==(r=this.X)?void 0:r.fetchEvaluations(this.P(),e,null==i?void 0:i.priority,n);return null!=t?t:null})}T(t){t=(0,i.u)(this.P(),t,null==(t=this.p)?void 0:t.customUserCacheKeyFunc);return`${i.DataAdapterCachePrefix}.${this.m}.`+t}R(t,e){return null!=t.fullUserHash&&t.fullUserHash===(0,i.v)(e)}}e.StatsigEvaluationsDataAdapter=o},2018:(t,e,n)=>{$Q(e),e.StatsigClient=void 0;n=n(8198);e.StatsigClient=n.default,__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{StatsigClient:n.default}),e.default=__STATSIG__},4535:(t,e,n)=>{$Q(e),e.AutoCapture=e.runStatsigAutoCapture=void 0;const c=n(6914),i=n(6325),r=n(6901);e.runStatsigAutoCapture=function(t){return new s(t)};class s{constructor(t){this.De=t,this.We=Date.now(),this.Ye=0,this.Ni={};var{sdkKey:t,errorBoundary:e,values:n}=t.getContext(),n=(this.Ni=null!=(n=null==(n=null==n?void 0:n.auto_capture_settings)?void 0:n.disabled_events)?n:{},this.Wt=e,this.Wt.wrap(this),(0,c.Jt)());(0,c.Mt)()||((e=null!=(e=(__STATSIG__=(0,c.o)()).acInstances)?e:{})[t]=this,__STATSIG__.acInstances=e),"loading"===(null==n?void 0:n.readyState)?n.addEventListener("DOMContentLoaded",()=>this.Qe()):this.Qe()}Xe(){const e=(0,c.Lt)();var t,n=(0,c.Jt)();e&&n&&(t=t=>{this.Ze(t||e.event)},(0,i.ti)(n,"click",t),(0,i.ti)(n,"submit",t),(0,i.ti)(e,"error",t),(0,i.ti)(e,"beforeunload",()=>this.ei()),(0,i.ti)(e,"scroll",()=>this.ii()))}Ze(t){var e;let n=null==(e=t.type)?void 0:e.toLowerCase();"error"===n&&t instanceof ErrorEvent?this.ni(t):(e=(0,i.si)(t))&&(0,i.dt)(t,e)&&("submit"===n&&(n="form_submit"),{value:t,metadata:e}=(0,i.ri)(e),this.oi(n,t,e))}Qe(){this.Xe(),this.ui(),this.li(),this.ai()}ni(t){var e=(null==t?void 0:t.error)||{};let n=e;if("object"==typeof e)try{n=JSON.stringify(e)}catch(t){n="function"==typeof(null==e?void 0:e.toString)?e.toString():"Unknown Error"}this.oi("error",t.message,{message:t.message,filename:t.filename,lineno:t.lineno,colno:t.colno,error_str:n})}ui(){var t=this.ci();try{this.hi(t)&&this.oi("session_start",(0,i.di)(),{sessionID:t.data.sessionID},{flushImmediately:!0})}catch(t){this.Wt.logError("AC::logSession",t)}}li(){setTimeout(()=>{var t=(0,i.vi)(),t=(0,r.fi)(t);this.oi("page_view",(0,i.di)(),t,{flushImmediately:!0,addNewSessionMetadata:!0})},1)}ai(){const n=(0,c.Lt)();void 0!==(null===n||void 0===n?void 0:n.performance)&&"function"==typeof n.performance.getEntriesByType&&"function"==typeof n.performance.getEntriesByName&&setTimeout(()=>{var t={},e=n.performance.getEntriesByType("navigation"),e=(e&&0<e.length&&e[0]instanceof PerformanceNavigationTiming&&(e=e[0],t.load_time_ms=e.duration,t.dom_interactive_time_ms=e.domInteractive-e.startTime,t.redirect_count=e.redirectCount,t.transfer_bytes=e.transferSize),n.performance.getEntriesByName("first-contentful-paint"));e&&0<e.length&&e[0]instanceof PerformancePaintTiming&&(t.first_contentful_paint_time_ms=e[0].startTime),this.oi("performance",(0,i.di)(),t)},1)}ei(){this.oi("page_view_end",(0,i.di)(),{scrollDepth:this.Ye,pageViewLength:Date.now()-this.We},{flushImmediately:!0})}oi(t,e,n,i){var r,s,o;if(!this.Ni[t]){var u=this.ci();try{var l=$P({sessionID:u.data.sessionID,page_url:null!=(o=null==(s=null==(r=(0,c.Lt)())?void 0:r.location)?void 0:s.href)?o:""},n),a=(null!=i&&i.addNewSessionMetadata&&(l.isNewSession=String(this.hi(u))),{eventName:"auto_capture::"+t,value:e,metadata:l});this.De.logEvent(a),null!=i&&i.flushImmediately&&this.De.flush().catch(t=>{c.Log.error(t)})}catch(t){this.Wt.logError("AC::enqueue",t)}}}ii(){var t=null!=(t=null==(t=(0,c.Jt)())?void 0:t.body.scrollHeight)?t:1,e=(0,c.Lt)(),n=null!=(n=null==e?void 0:e.scrollY)?n:1,e=null!=(e=null==e?void 0:e.innerHeight)?e:1;this.Ye=Math.max(this.Ye,Math.min(100,Math.round((n+e)/t*100)))}hi(t){return Math.abs(t.data.startTime-Date.now())<1e3}ci(){return this.De.getContext().session}}e.AutoCapture=s},6325:(t,e,n)=>{$Q(e),e.ti=e.di=e.vi=e.dt=e.si=e.ri=e.fn=void 0;const s=n(6914);function o(t){var e={};if(t){var n=null==t?void 0:t.dataset;if(n)for(const i in n)e["data-"+i]=n[i]||""}return e}function u(e){if(e){let t=e;for(;t;){var n=t.tagName.toLowerCase();if(["body","document"].includes(n))return null;if("a"===t.tagName.toLowerCase())return t;t=t.parentElement}}return null}e.fn=o,e.ri=function(t){var e=t.tagName.toLowerCase(),n={},i=(0,s.At)()||"",r=("form"===(n.tagName=e)&&(n.action=t.getAttribute("action"),n.method=null!=(r=t.getAttribute("method"))?r:"GET",n.formName=t.getAttribute("name"),n.formId=t.getAttribute("id")),["input","select","textarea"].includes(e)&&"password"!==t.getAttribute("type")&&(n.content=t.value,n.inputName=t.getAttribute("name")),u(t));return r&&(n.href=r.getAttribute("href")),"button"!==e&&!r||(n.content=(t.textContent||"").trim(),e=o(r||t),$P(n,e)),{value:i,metadata:n}},e.si=function(t){if(!t)return null;let e=t.target||t.srcElement;return e&&e instanceof Element?e=3===e.nodeType?e.parentNode||null:e:null},e.dt=function(t,e){if(!t||!e||1!==e.nodeType)return!1;var n=e.tagName.toLowerCase(),i=t.type.toLowerCase();switch(n){case"html":return!1;case"form":return"submit"===i;case"input":case"select":case"textarea":return["change"].includes(i);default:if("click"===i){if("button"===n)return!0;if(u(e))return!0}return!1}},e.vi=function(){var t=null!=(t=null==(t=null==(t=(0,s.Lt)())?void 0:t.location)?void 0:t.href)?t:"";let e;try{e=new URL(t)}catch(t){e=new URL("error:")}return e},e.di=function(){return(0,s.At)()||""},e.ti=function(t,e,n){t&&t.addEventListener&&t.addEventListener(e,n,!0)}},1964:(t,e,n)=>{$Q(e),e.runStatsigAutoCapture=e.AutoCapture=void 0;const i=n(4535);$Q2(e,"AutoCapture",{enumerable:!0,get:function(){return i.AutoCapture}}),$Q2(e,"runStatsigAutoCapture",{enumerable:!0,get:function(){return i.runStatsigAutoCapture}}),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{AutoCapture:i.AutoCapture,runStatsigAutoCapture:i.runStatsigAutoCapture}),e.default=__STATSIG__},6901:(t,e,n)=>{$Q(e),e.fi=void 0;const a=n(6914);e.fi=function(t){var e=(0,a.Jt)(),n=(0,a.Lt)();if(!e||!n)return{};var i=null==n?void 0:n.navigator,r=(null==e?void 0:e.referrer)||"";let s=new URL("empty:");if(r)try{s=new URL(r||"empty:")}catch(t){}u=s,o=function(t){const e=t.hostname,n=["google","bing","yahoo","duckduckgo","baidu"].find(t=>e.includes(t+"."));return n||""}(u),u=u.searchParams.get("yahoo"===o?"p":"q")||"";var o={searchEngine:o,searchQuery:u},u=function(t){const n=t.searchParams,i={};return["utm_source","utm_medium","utm_campaign","utm_term","utm_content","gclid","gclsrc","dclid","fbclid","msclkid","mc_eid","mc_cid","twclid","li_fat_id","igshid","utm_id","ttc","ttclid","ttc_id"].forEach(t=>{var e=n.get(t);e&&(i[t]=e)}),i}(t);const l={};return t.searchParams.forEach((t,e)=>{l[e]=t}),$P($P($P($P({},o),u),l),{title:(null==e?void 0:e.title)||"",locale:(null==i?void 0:i.language)||"unknown",hostname:t.hostname||"unknown",pathname:t.pathname||"unknown",referrer:r,screen_width:(null==(o=null==n?void 0:n.screen)?void 0:o.width)||"unknown",screen_height:(null==(u=null==n?void 0:n.screen)?void 0:u.height)||"unknown",viewport_width:(null==n?void 0:n.innerWidth)||"unknown",viewport_height:(null==n?void 0:n.innerHeight)||"unknown"})}}},i={};function r(t){var e=i[t];return void 0!==e||(e=i[t]={exports:{}},n[t].call(e.exports,e,e.exports,r)),e.exports}r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}();var t={};{var e=t;const o=r(1964);var s=r(2016);e.default=__STATSIG__,s.AutoInit.attempt(({client:t})=>{new o.AutoCapture(t)})}return t.default})());
!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 $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())})});var n={1845:(t,n,e)=>{$Q2(n,"__esModule",{value:!0}),n.t=n.i=n.o=void 0,n.o=()=>__STATSIG__||u,n.i=t=>(0,n.o)()[t];n.t=t=>{var e=(0,n.o)();return t?e.instances&&e.instances[t]:e.lastInstance};var i,r="__STATSIG__",s="undefined"!=typeof window?window:{},e=void 0!==e.g?e.g:{},o="undefined"!=typeof globalThis?globalThis:{};const u=null!=(i=null!=(i=null!=(i=s[r])?i:e[r])?i:o[r])?i:{instance:n.t};s[r]=u,e[r]=u,o[r]=u},2137:(t,e,n)=>{$Q(e),e.u=e.l=void 0;const r=n(1406);function i(t,e,n){if(n)return n(t,e);const i=e&&e.customIDs?e.customIDs:{};e=["uid:"+(null!=(n=null==e?void 0:e.userID)?n:""),"cids:"+Object.keys(i).sort((t,e)=>t.localeCompare(e)).map(t=>t+"-"+i[t]).join(","),"k:"+t];return(0,r.h)(e.join("|"))}e.l=i,e.u=function(t,e,n){return e?i(t,e,n):(0,r.h)("k:"+t)}},6427:(t,e)=>{$Q(e)},694:function(t,e,n){var r=this&&this.__awaiter||$A();$Q(e),e.DataAdapterCore=void 0;const l=n(7512),a=n(9122),s=n(8578),o=n(4534),c=n(3401);function h(t,e,n,i){return{source:t,data:e,receivedAt:Date.now(),stableID:n,fullUserHash:(0,s.v)(i)}}e.DataAdapterCore=class{constructor(t,e){this._=t,this.m=e,this.p=null,this.S=null,this.O="statsig.last_modified_time."+e,this.j=new i}attach(t,e){this.S=t,this.p=e}getDataSync(t){var t=t&&(0,s.A)(t,this.p),e=this.T(t),n=this.j.get(e,t);return n||((n=this.I(e))?(this.j.add(e,n),this.j.get(e,t)):null)}setData(t,e){var e=e&&(0,s.A)(e,this.p),n=this.T(e);this.j.add(n,h("Bootstrap",t,null,e))}__primeInMemoryCache(t){this.j.merge(t)}M(e,n,i){return r(this,void 0,void 0,function*(){var t=null!=e?e:this.getDataSync(n),t=[this.D(t,n,i)];return null!=i&&i.timeoutMs&&t.push(new Promise(t=>setTimeout(t,i.timeoutMs)).then(()=>(l.Log.debug("Fetching latest value timed out"),null))),yield Promise.race(t)})}k(n,i){return r(this,void 0,void 0,function*(){var t=n&&(0,s.A)(n,this.p),e=this.T(t),t=yield this.M(null,t,i);t&&this.j.add(e,$P($P({},t),{source:"Prefetch"}))})}D(s,o,u){return r(this,void 0,void 0,function*(){let t=null;s&&this.R(s,o)&&(t=s.data);var e=yield this.N(t,o,u);if(!e)return l.Log.debug("No response returned for latest value"),null;var n=(0,c.C)(e,"has_updates","Response"),i=this.P(),i=yield a.StableID.get(i);let r=null;if(!0===(null==n?void 0:n.has_updates))r=h("Network",e,i,o);else{if(!t||!1!==(null==n?void 0:n.has_updates))return null;r=h("NetworkNotModified",t,i,o)}e=this.T(o);return this.j.add(e,r),yield this.G(e,r),r})}P(){return null!=this.S?this.S:(l.Log.error(this._+" is not attached to a Client"),"")}I(t){var e=null==(e=o.Storage.ce)?void 0:e.call(o.Storage,t);return null!=e&&(t=(0,c.C)(e,"source","Cached Result"))?$P($P({},t),{source:"Cache"}):null}G(t,e){return r(this,void 0,void 0,function*(){yield o.Storage.L(t,JSON.stringify(e)),yield this.K(t)})}K(n){var i;return r(this,void 0,void 0,function*(){var t=null!=(i=yield(0,o.F)(this.O))?i:{},e=(t[n]=Date.now(),u(t,10));e&&(delete t[e],yield o.Storage.q(e)),yield(0,o.J)(this.O,t)})}};class i{constructor(){this.V={}}get(t,e){var t=this.V[t],n=null==t?void 0:t.stableID,e=null==(e=null==e?void 0:e.customIDs)?void 0:e.stableID;return e&&n&&e!==n?(l.Log.warn("'StatsigUser.customIDs.stableID' mismatch"),null):t}add(t,e){var n=u(this.V,9);n&&delete this.V[n],this.V[t]=e}merge(t){this.V=$P($P({},this.V),t)}}function u(r,t){var e=Object.keys(r);return e.length<=t?null:e.reduce((t,e)=>{var n=r[t],i=r[e];return"object"==typeof n&&"object"==typeof i?i.receivedAt<n.receivedAt?e:t:i<n?e:t})}},8962:(t,s)=>{$Q2(s,"__esModule",{value:!0}),s.Diagnostics=void 0;const i=new Map,n="start";function r(t,e){return $P({key:"initialize",action:e,timestamp:Date.now()},t)}function o(t,e){var n=null!=(n=i.get(t))?n:[];n.push(e),i.set(t,n)}function e(t,e){if(e in t)return t[e]}s.Diagnostics={_i:t=>i.get(t),gi:t=>{o(t,r({},n))},bi:(t,e,n)=>{o(t,r({success:e,error:e?void 0:{name:"InitializeError",message:"Failed to initialize"},evaluationDetails:n},"end"))},mi:(t,e)=>{o(t,r(e,n))},pi:(t,e)=>{o(t,r(e,"end"))},yi:t=>{o(t,r({},n))},Oi:(t,e)=>{o(t,r(e,"end"))},Si:t=>{i.delete(t)},ji(t){if(t&&"object"==typeof t)return{code:e(t,"code"),name:e(t,"name"),message:e(t,"message")}},Ti(t,e,n,i){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===n.includes('"is_delta":true')||void 0,attempt:e,error:s.Diagnostics.ji(i)}},wi(t,e,n,i){var r=s.Diagnostics._i(n);null==r||r.length<=0||(s.Diagnostics.Si(n),n=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:i}),e.enqueue(n))}}},3539:(t,e)=>{$Q(e)},5542:function(t,u,e){var n=this&&this.__awaiter||$A();$Q2(u,"__esModule",{value:!0}),u.ErrorBoundary=u.EXCEPTION_ENDPOINT=void 0;const i=e(7512),l=e(5902),a=e(8e3),c=(u.EXCEPTION_ENDPOINT="https://statsigapi.net/v1/sdk_exception","[Statsig] UnknownError");u.ErrorBoundary=class{constructor(t,e,n){this.S=t,this.p=e,this.B=n,this.$=new Set}wrap(i){try{const t=i;!function(t){const e=new Set;let n=Object.getPrototypeOf(t);for(;n&&n!==Object.prototype;)Object.getOwnPropertyNames(n).filter(t=>"function"==typeof(null===n||void 0===n?void 0:n[t])).forEach(t=>e.add(t)),n=Object.getPrototypeOf(n);return Array.from(e)}(t).forEach(e=>{const n=t[e];"$EB"in n||(t[e]=(...t)=>this.H(e,()=>n.apply(i,t)),t[e].$EB=!0)})}catch(t){this.W("eb:wrap",t)}}logError(t,e){this.W(t,e)}H(e,t){try{var n=t();return n&&n instanceof Promise?n.catch(t=>this.W(e,t)):n}catch(t){return this.W(e,t),null}}W(s,o){try{i.Log.warn("Caught error in "+s,{error:o});n(this,void 0,void 0,function*(){var t,e,n=o||Error(c),i=n instanceof Error,r=i?n.name:"No Name";this.$.has(r)||(this.$.add(r),null!=(t=null==(t=this.p)?void 0:t.networkConfig)&&t.preventAllNetworkTraffic?null!=(t=this.B)&&t.call(this,{name:"error",error:o}):(t=l.SDKType.Y(this.S),e=a.StatsigMetadataProvider.get(),i=i?n.stack:function(t){try{return JSON.stringify(t)}catch(t){return c}}(n),n=JSON.stringify($P({tag:s,exception:r,info:i},$P($P({},e),{sdkType:t}))),yield(null!=(r=null==(i=null==(r=this.p)?void 0:r.networkConfig)?void 0:i.networkOverrideFunc)?r:fetch)(u.EXCEPTION_ENDPOINT,{method:"POST",headers:{"STATSIG-API-KEY":this.S,"STATSIG-SDK-TYPE":String(t),"STATSIG-SDK-VERSION":String(e.sdkVersion),"Content-Type":"application/json"},body:n}),null!=(i=this.B)&&i.call(this,{name:"error",error:o})))}).then(()=>{}).catch(()=>{})}catch(t){}}}},2922:(t,e)=>{$Q(e)},2417:(t,e)=>{$Q(e)},7770:function(t,e,n){var i=this&&this.__awaiter||$A();$Q(e),e.EventLogger=void 0;const r=n(2137),s=n(1406),o=n(7512),u=n(7410),l=n(6830),a=n(1637),c=n(4534),h=n(9638),d=n(2397),v={},f=t=>{null!=(t=v[t])&&t.flush().catch(()=>{})};e.EventLogger=class{constructor(t,e,n,i){this.S=t,this.B=e,this.X=n,this.p=i,this.Z=[],this.tt={},this.et={},this.it=!1,this.nt=Date.now(),this.st=!0===(null==i?void 0:i.disableLogging),this.rt=null!=(t=null==i?void 0:i.loggingBufferMaxSize)?t:50;e=null==i?void 0:i.networkConfig;this.ot=(0,h.ut)(null==e?void 0:e.logEventUrl,null==e?void 0:e.api,"/rgstr",u.NetworkDefault.eventsApi)}setLoggingDisabled(t){this.st=t}enqueue(t){this.dt(t)&&(this.vt(t),this.ft(),this.Z.length>this.rt)&&f(this.S)}incrementNonExposureCount(t){var e=null!=(e=this.et[t])?e:0;this.et[t]=e+1}reset(){this.tt={}}start(){(0,l.Mt)()||(v[this.S]=this,(0,d.lt)(t=>{"background"===t&&f(this.S)}),this.ct(),this.ht())}stop(){return i(this,void 0,void 0,function*(){this._t&&(clearInterval(this._t),this._t=null),yield this.flush()})}flush(){return i(this,void 0,void 0,function*(){var t;if(this.gt(),0!==this.Z.length)return t=this.Z,this.Z=[],this.bt(t)})}ft(){this.it||(this.it=!0,200<Date.now()-this.nt)||setTimeout(()=>f(this.S),200)}dt(t){if((0,l.Mt)())return!1;if((0,a.yt)(t)){var e=t.user||{statsigEnvironment:void 0},e=(0,r.l)(this.S,e),n=t.metadata||{},t=[t.eventName,e,n.gate,n.config,n.ruleID].join("|"),e=this.tt[t],n=Date.now();if(e&&n-e<6e4)return!1;1e3<Object.keys(this.tt).length&&(this.tt={}),this.tt[t]=n}return!0}bt(t){var e,n;return i(this,void 0,void 0,function*(){if(this.st)this.St(t);else try{(!(0,d.Ot)()&&this.X.isBeaconSupported()&&null==(null==(n=null==(e=this.p)?void 0:e.networkConfig)?void 0:n.networkOverrideFunc)?yield this.jt(t):yield this.Tt(t)).success?this.B({name:"logs_flushed",events:t}):this.St(t)}catch(t){o.Log.warn("Failed to flush events.")}})}Tt(e){var n;return i(this,void 0,void 0,function*(){var t=yield this.X.post(this.wt(e)),t=null!=(n=null==t?void 0:t.code)?n:-1;return{success:200<=t&&t<300}})}jt(t){return i(this,void 0,void 0,function*(){return{success:yield this.X.beacon(this.wt(t))}})}wt(t){return{sdkKey:this.S,data:{events:t},url:this.ot,retries:3,isCompressable:!0,params:{[u.NetworkParam.EventCount]:String(t.length)}}}St(t){for(;500<t.length;)t.shift();var e=this.u();try{(0,c.J)(e,t)}catch(t){o.Log.warn("Unable to save failed logs to storage")}}ct(){const e=this.u();i(this,void 0,void 0,function*(){var t=(0,c.F)(e);t&&(c.Storage.q(e),yield this.bt(t))}).catch(()=>{o.Log.warn("Failed to flush stored logs")})}u(){return"statsig.failed_logs."+(0,s.h)(this.S)}vt(t){t.user&&(t.user=$P({},t.user),delete t.user.privateAttributes);var e={},n=this.It(),n=(n&&(e.statsigMetadata={currentPage:n}),$P($P({},t),e));o.Log.debug("Enqueued Event:",n),this.Z.push(n)}gt(){0!==Object.keys(this.et).length&&(this.vt({eventName:"statsig::non_exposed_checks",user:null,time:Date.now(),metadata:{checks:$P({},this.et)}}),this.et={})}It(){var t;if(!1!==(null==(t=this.p)?void 0:t.includeCurrentPageUrlWithEvents))return(0,l.At)()}ht(){var t=null!=(t=null==(t=this.p)?void 0:t.loggingIntervalMs)?t:1e4;const e=setInterval(()=>{v[this.S]._t!==e?clearInterval(e):f(this.S)},t);this._t=e}}},1406:(t,s,e)=>{$Q2(s,"__esModule",{value:!0}),s.xt=s.Dt=s.h=void 0;const o=e(6634);s.h=e=>{let n=0;for(let t=0;t<e.length;t++){var i=e.charCodeAt(t);n=(n<<5)-n+i,n&=n}return String(n>>>0)},s.Dt=(t,e)=>(0,s.h)(JSON.stringify((0,s.xt)(t,e)));s.xt=(n,i)=>{if(null==n)return null;var t=Object.keys(n).sort();const r={};return t.forEach(t=>{var e=n[t];0===i||"object"!==(0,o.kt)(e)?r[t]=e:r[t]=(0,s.xt)(e,null!=i?i-1:i)}),r}},1333:(t,e)=>{$Q(e)},7512:(t,e)=>{function n(t){return t.unshift("[Statsig]"),t}var i,r;$Q(e),e.Log=e.LogLevel=void 0,(r=i||(e.LogLevel=i={}))[r.None=0]="None",r[r.Error=1]="Error",r[r.Warn=2]="Warn",r[r.Info=3]="Info",r[r.Debug=4]="Debug";class s{static info(...t){this.level>=i.Info&&console.info(...n(t))}static debug(...t){this.level>=i.Debug&&console.debug(...n(t))}static warn(...t){this.level>=i.Warn&&console.warn(...n(t))}static error(...t){this.level>=i.Error&&console.error(...n(t))}}(e.Log=s).level=i.Error},7410:(t,e)=>{$Q(e),e.NetworkParam=e.NetworkDefault=void 0,e.NetworkDefault={eventsApi:"https://statsigapi.net/v1",initializeApi:"https://statsigapi.net/v1",specsApi:"https://statsigapi.net/v1"},e.NetworkParam={EventCount:"ec",SdkKey:"k",SdkType:"st",SdkVersion:"sv",Time:"t",SessionID:"sid",StatsigEncoded:"se",IsGzipped:"gz"}},7023:function(t,e,n){var s=this&&this.__awaiter||$A();$Q(e),e.NetworkCore=void 0,n(1845);const o=n(1845),b=n(8962),y=n(7512),u=n(7410),i=n(5894),l=n(5902),a=n(6830),c=n(4143),h=n(9122),d=n(8e3),O=n(2397),j=new Set([408,500,502,503,504,522,524,599]);e.NetworkCore=class{constructor(t,e){this.B=e,this.Et=1e4,this.Rt={},this.p={},this.networkEvents=[],this.sdkKey=null,t&&(this.p=t),this.p.networkConfig&&(this.Rt=this.p.networkConfig),this.Rt.networkTimeoutMs&&(this.Et=this.Rt.networkTimeoutMs),this.Ii=new i.NetworkProxy(this.p),this._n()}post(n){return s(this,void 0,void 0,function*(){var t=this.ki(n);this.sdkKey||(this.sdkKey=n.sdkKey);let e=yield this.Nt($P($P({},n),t));return n.isStatsigEncodable&&(e=this.Ct(n,e)),this.Pt($P($P({method:"POST",body:e},t),n))})}get(t){return this.sdkKey||(this.sdkKey=t.sdkKey),this.Pt($P({method:"GET"},t))}isBeaconSupported(){return"undefined"!=typeof navigator&&"function"==typeof navigator.sendBeacon}beacon(i){return s(this,void 0,void 0,function*(){var t,e,n;return!!S(i)&&(e=this.ki(i),t=yield this.Nt($P($P({},i),e)),e=yield this.Gt($P($P({},i),e)),(n=navigator).sendBeacon.bind(n)(e,t))})}Pt(g){var p,m;return s(this,void 0,void 0,function*(){if(!S(g))return null;if(this.Rt.preventAllNetworkTraffic)return null;var{method:e,body:t,retries:n,attempt:i}=g,i=null!=i?i:1;const r="undefined"!=typeof AbortController?new AbortController:null;var s=setTimeout(()=>{null!==r&&void 0!==r&&r.abort(`Timeout of ${this.Et}ms expired.`)},this.Et),o=null!=(m=g.proxyUrl)?m:this.Ii.getProxyUrl(g.sdkKey,g.url),o=yield this.Gt($P({proxyUrl:o},g)),u=!o.includes("https://statsigapi.net/v1"),l=new URL(o).pathname;let a=null;var c=(0,O.Ut)();try{o.includes("https://prodregistryv2.org")||this.networkEvents.push({value:u?"proxy":"statsig",eventName:"proxy::network_request_tracking",metadata:{url:o,endpoint:l},time:Date.now(),user:null});var h,d,v,f={method:e,body:t,headers:$P({},g.headers),signal:null===r||void 0===r?void 0:r.signal,priority:g.priority,keepalive:c},_=(g.isInitialize&&b.Diagnostics.mi(g.sdkKey,{attempt:i}),null!=(p=this.Rt.networkOverrideFunc)?p:fetch);if(a=yield _(o,f),clearTimeout(s),a.ok)return v=yield a.text(),g.isInitialize&&b.Diagnostics.pi(g.sdkKey,b.Diagnostics.Ti(a,i,v)),{body:v,code:a.status};throw h=yield a.text().catch(()=>"No Text"),(d=new Error(`NetworkError: ${o} `+h)).name="NetworkError",d}catch(t){u=function(t,e){if(null!=t&&t.signal.aborted&&"string"==typeof t.signal.reason)return t.signal.reason;if("string"==typeof e)return e;if(e instanceof Error)return e.name+": "+e.message;return"Unknown Error"}(r,t),l=function(t){t=(null==t?void 0:t.signal.aborted)&&"string"==typeof t.signal.reason&&t.signal.reason.includes("Timeout");return t||!1}(r);return g.isInitialize&&b.Diagnostics.pi(g.sdkKey,b.Diagnostics.Ti(a,i,"",t)),yield this.Ii.attemptToUpdateProxyUrl(g.sdkKey,u,l),!n||n<i||!j.has(null!=(m=null===a||void 0===a?void 0:a.status)?m:500)?(null!=(m=this.B)&&m.call(this,{name:"error",error:t}),y.Log.error(`A networking error occured during ${e} request to ${o}.`,u,t),null):this.Pt($P($P({},g),{retries:n,attempt:i+1}))}})}Gt(i){var r;return s(this,void 0,void 0,function*(){var t=null!=(r=i.proxyUrl)?r:i.url;const e=$P({[u.NetworkParam.SdkKey]:i.sdkKey,[u.NetworkParam.SdkType]:l.SDKType.Y(i.sdkKey),[u.NetworkParam.SdkVersion]:d.SDK_VERSION,[u.NetworkParam.Time]:String(Date.now()),[u.NetworkParam.SessionID]:yield c.SessionID.get(i.sdkKey)},i.params);var n=Object.keys(e).map(t=>encodeURIComponent(t)+"="+encodeURIComponent(e[t])).join("&");return t+(n?"?"+n:"")})}Nt(r){return s(this,void 0,void 0,function*(){var{data:t,sdkKey:e}=r,n=yield h.StableID.get(e),i=yield c.SessionID.get(e),e=l.SDKType.Y(e);return JSON.stringify($P($P({},t),{statsigMetadata:$P($P({},d.StatsigMetadataProvider.get()),{stableID:n,sessionID:i,sdkType:e,proxyUrl:r.proxyUrl})}))})}Ct(t,e){var n,i,r=(0,a.Lt)();if(!t.isStatsigEncodable||this.p.disableStatsigEncoding||null!=(0,o.i)("no-encode")||null==r||!r.btoa)return e;try{var s=null!=(n=r.btoa(e).split("").reverse().join(""))?n:e;return t.params=$P($P({},null!=(i=t.params)?i:{}),{[u.NetworkParam.StatsigEncoded]:"1"}),s}catch(t){return y.Log.warn("/initialize request encoding failed"),e}}ki(t){t=this.Ii.getProxyUrl(t.sdkKey,t.url);return{proxyUrl:null!=t?t:null}}gn(){var t;0!==this.networkEvents.length&&(this.post({sdkKey:null!=(t=this.sdkKey)?t:"",url:"https://prodregistryv2.org/v1/rgstr",data:{events:[...this.networkEvents]}}),this.networkEvents=[])}_n(){setInterval(()=>{this.gn()},1e4)}};const S=t=>!!t.sdkKey||(y.Log.warn("Unable to make request without an SDK key"),!1)},5894:function(t,e,n){var s=this&&this.__awaiter||$A();$Q(e),e.NetworkProxy=void 0;const i=n(1406),r=n(7410),o=n(4534),u=n(3401);function l(t){return"statsig.proxy."+(0,i.h)(t)}e.NetworkProxy=class{constructor(t){this.p=t,this.xi=null,this.Di=0,this.Ai=void 0,t.networkConfig&&(t=t.networkConfig,this.setOverrideFunc(t.networkOverrideFunc))}setOverrideFunc(t){this.Ai=t}getProxyUrl(t,e){return function(t){for(const e in r.NetworkDefault)if(t.startsWith(r.NetworkDefault[e]))return 1;return}(e)?(e=function(t){try{return new URL(t).pathname.substring(1)}catch(t){return""}}(e),0<this.Di&&Date.now()>this.Di?(this.xi=null,this.Di=0,this.xi):this.xi?this.xi+e:(t=function(t){t=o.Storage.ce(t);if(t){t=(0,u.C)(t,"url","cacheProxy");if(t&&Date.now()<t.expiryTime)return t}return null}(l(t)))?(this.xi=t.url,this.Di=t.expiryTime,this.xi+e):null):null}attemptToUpdateProxyUrl(n,i,r){return s(this,void 0,void 0,function*(){var t,e;(function(t,e){t=(null==t?void 0:t.toLowerCase())||"";return e||t.includes("uncaught exception")||t.includes("failed to fetch")||t.includes("networkerror when attempting to fetch resource")})(i,r)&&(t=l(n),e=yield this.Mi())&&(this.xi=e,this.Di=Date.now()+2592e5,o.Storage.L(t,JSON.stringify({url:this.xi,expiryTime:this.Di})))})}Mi(){return s(this,void 0,void 0,function*(){var t,e=yield this.Ei("featureregistry.org");return 0!==e.length&&([e,t]=function(t){let e=1440,n=0;var i=[],r=(new Date).getTimezoneOffset()+720;for(const u of t){var[s,o]=u.split("="),o=(i.push(o),null==s?void 0:s.split("_")[1]),s=parseInt(o);s&&!Number.isNaN(s)&&(o=Math.abs(s-r))<e&&(n=i.length-1,e=o)}return[i,n]}(e=e),0!==e.length)?e.length>t?e[t]:e[0]:null})}Ei(t){var u;return s(this,void 0,void 0,function*(){var e=function(t){var e=[0,0,1,0,0,1,0,0,0,0,0,0],t=t.split(".");for(const n of t){e.push(n.length);for(const i of n)e.push(i.charCodeAt(0))}return e.push(0,0,16,0,1),Uint8Array.from(e)}(t),e=yield(null!=(u=this.Ai)?u:fetch)("https://cloudflare-dns.com/dns-query",{method:"POST",headers:{"Content-Type":"application/dns-message",Accept:"application/dns-message"},body:e});if(e.ok){e=yield e.arrayBuffer();{var n=Array.from(new Uint8Array(e));let t=n.indexOf(192);for(var i=[];-1<t&&t<n.length-2;){var r=n[t+1];if(n.length<t+r+1)break;var s=n[t+r],o=n.slice(t+r+1,t+r+s+1);i.push(o.map(t=>String.fromCharCode(t)).join("")),t=n.indexOf(192,t+r+s)}return i}}return[]})}}},1405:(t,e)=>{$Q(e)},1361:(t,e)=>{$Q(e)},5902:(t,e)=>{$Q(e),e.SDKType=void 0;const n={};let i;e.SDKType={Y:t=>{return(null!=(t=n[t])?t:"js-mono")+(null!==i&&void 0!==i?i:"")},Kt(t,e){n[t]=e},Ft(t){i&&"-react"!==i||(i="-"+t)}}},6830:(t,i)=>{$Q2(i,"__esModule",{value:!0}),i.At=i.qt=i.zt=i.Mt=i.Jt=i.Lt=void 0;i.Lt=()=>"undefined"!=typeof window?window:null,i.Jt=()=>{var t=(0,i.Lt)();return null!=(t=null==t?void 0:t.document)?t:null},i.Mt=()=>{var t;return null===(0,i.Jt)()&&(t="undefined"!=typeof process&&null!=process.versions&&null!=process.versions.node,"string"==typeof EdgeRuntime||t)},i.zt=(t,e)=>{var n=(0,i.Lt)();"function"==typeof(null==n?void 0:n.addEventListener)&&n.addEventListener(t,e)},i.qt=(t,e)=>{var n=(0,i.Jt)();"function"==typeof(null==n?void 0:n.addEventListener)&&n.addEventListener(t,e)};i.At=()=>{var t;try{return null==(t=(0,i.Lt)())?void 0:t.location.href.split(/[?#]/)[0]}catch(t){}}},4143:(t,e,n)=>{$Q(e),e.StatsigSession=e.SessionID=void 0;const i=n(2137),s=n(7512),o=n(4534),u=n(8023),l=18e5,a=144e5,c={};function h(e,t){return setTimeout(()=>{var t=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instance(e);t&&t.$emt({name:"session_expired"})},t)}function d(t){return"statsig.session_id."+(0,i.u)(t)}e.SessionID={get:t=>e.StatsigSession.get(t).data.sessionID},e.StatsigSession={get:t=>{null==c[t]&&(c[t]=function(t){let e=function(t){t=d(t);return(0,o.F)(t)}(t);var n=Date.now();e=e||{sessionID:(0,u.getUUID)(),startTime:n,lastUpdate:n};return{data:e,sdkKey:t}}(t));var t=c[t],e=Date.now(),n=t.data,i=((function({lastUpdate:t}){return Date.now()-t>l}(n)||function({startTime:t}){return Date.now()-t>a}(n))&&(n.sessionID=(0,u.getUUID)(),n.startTime=e),n.lastUpdate=e,n),r=t.sdkKey;r=d(r);try{(0,o.J)(r,i)}catch(t){s.Log.warn("Failed to save SessionID")}return clearTimeout(t.idleTimeoutID),clearTimeout(t.ageTimeoutID),e-=n.startTime,n=t.sdkKey,t.idleTimeoutID=h(n,l),t.ageTimeoutID=h(n,a-e),t},overrideInitialSessionID:(t,e)=>{var n;c[e]=(t=t,e=e,n=Date.now(),{data:{sessionID:t,startTime:n,lastUpdate:n},sdkKey:e})}}},9122:(t,e,n)=>{$Q(e),e.StableID=void 0;const i=n(2137),r=n(7512),s=n(4534),o=n(8023),u={};function l(t){return"statsig.stable_id."+(0,i.u)(t)}function a(t,e){e=l(e);try{(0,s.J)(e,t)}catch(t){r.Log.warn("Failed to save StableID")}}e.StableID={get:e=>{if(null==u[e]){let t=function(t){t=l(t);return(0,s.F)(t)}(e);null==t&&a(t=(0,o.getUUID)(),e),u[e]=t}return u[e]},setOverride:(t,e)=>{a(u[e]=t,e)}}},1375:function(t,e,n){var i=this&&this.__awaiter||$A();$Q(e),e.StatsigClientBase=void 0,n(1845);const o=n(1845),u=n(5542),l=n(7770),a=n(7512),c=n(6830),h=n(4143),d=n(4534);e.StatsigClientBase=class{constructor(t,e,n,i){this.loadingStatus="Uninitialized",this.Vt={};var r,s=this.$emt.bind(this);null!=(null==i?void 0:i.logLevel)&&(a.Log.level=i.logLevel),null!=i&&i.disableStorage&&d.Storage.Bt(!0),null!=i&&i.initialSessionID&&h.StatsigSession.overrideInitialSessionID(i.initialSessionID,t),this.S=t,this.p=null!=i?i:{},this.overrideAdapter=null!=(r=null==i?void 0:i.overrideAdapter)?r:null,this.Ht=new l.EventLogger(t,s,n,i),this.Wt=new u.ErrorBoundary(t,i,s),this.Wt.wrap(this),this.Wt.wrap(n),this.Wt.wrap(e),this.Wt.wrap(this.Ht),(0,c.Mt)()||(null!=(n=null!=(s=(r=(0,o.o)()).instances)?s:{})[t]&&a.Log.warn("Creating multiple Statsig clients with the same SDK key can lead to unexpected behavior. Multi-instance support requires different SDK keys."),n[t]=this,r.lastInstance=this,r.instances=n,__STATSIG__=r),this.dataAdapter=e,this.dataAdapter.attach(t,i),this.Yt()}updateRuntimeOptions(t){null!=t.disableLogging&&(this.p.disableLogging=t.disableLogging,this.Ht.setLoggingDisabled(t.disableLogging)),null!=t.disableStorage&&(this.p.disableStorage=t.disableStorage,d.Storage.Bt(t.disableStorage))}flush(){return this.Ht.flush()}shutdown(){return i(this,void 0,void 0,function*(){this.$emt({name:"pre_shutdown"}),yield this.Ht.stop()})}on(t,e){this.Vt[t]||(this.Vt[t]=[]),this.Vt[t].push(e)}off(t,e){this.Vt[t]&&-1!==(e=this.Vt[t].indexOf(e))&&this.Vt[t].splice(e,1)}$on(t,e){e.__isInternal=!0,this.on(t,e)}$emt(n){var t;const e=e=>{try{e(n)}catch(t){!0===e.__isInternal?this.Wt.logError("__emit:"+n.name,t):a.Log.error("An error occurred in a StatsigClientEvent listener. This is not an issue with Statsig.",n)}};this.Vt[n.name]&&this.Vt[n.name].forEach(t=>e(t)),null!=(t=this.Vt["*"])&&t.forEach(e)}Qt(t,e){this.loadingStatus=t,this.$emt({name:"values_updated",status:t,values:e})}Xt(t,e,n){!0===(null==n?void 0:n.disableExposureLog)?this.Ht.incrementNonExposureCount(t):this.Ht.enqueue(e)}}},2636:(t,e)=>{$Q(e)},3206:(t,e)=>{$Q(e),e.DataAdapterCachePrefix=void 0,e.DataAdapterCachePrefix="statsig.cached"},1637:(t,e)=>{$Q(e),e.Zt=e.te=e.ee=e.yt=void 0;const n="statsig::config_exposure",i="statsig::gate_exposure",l=(t,e,n,i,r)=>({eventName:t,user:e,value:null,metadata:s(n,i),secondaryExposures:r,time:Date.now()});e.yt=({eventName:t})=>t===i||t===n,e.ee=(t,e)=>{return l(i,t,e.details,{gate:e.name,gateValue:String(e.value),ruleID:e.ruleID},null!=(e=null==(t=e.__evaluation)?void 0:t.secondary_exposures)?e:[])},e.te=(t,e)=>{return l(n,t,e.details,{config:e.name,ruleID:e.ruleID},null!=(e=null==(t=e.__evaluation)?void 0:t.secondary_exposures)?e:[])};e.Zt=(t,e,n)=>{var i,r=e.__evaluation,s=!0===(null==(s=null==r?void 0:r.explicit_parameters)?void 0:s.includes(n));let o="",u=null!=(i=null==r?void 0:r.undelegated_secondary_exposures)?i:[];return s&&(o=null!=(i=r.allocated_experiment_name)?i:"",u=r.secondary_exposures),l("statsig::layer_exposure",t,e.details,{config:e.name,parameterName:n,ruleID:e.ruleID,allocatedExperiment:o,isExplicitParameter:String(s)},u)};const s=(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="1.8.0-beta.14";let n={sdkVersion:e.SDK_VERSION,sdkType:"js-mono"};e.StatsigMetadataProvider={get:()=>n,add:t=>{n=$P($P({},n),t)}}},586:(t,e)=>{$Q(e)},2059:(t,e,n)=>{$Q(e),e.ie=e.ne=e.se=e.re=e.oe=e.ue=void 0;const s=n(6634),r="default";function o(t,e,n,i){return{name:t,details:e,ruleID:null!=(t=null==n?void 0:n.rule_id)?t:r,__evaluation:n,value:i}}function i(t,e,n){var i=null!=(i=null==n?void 0:n.value)?i:{};return $P($P({},o(t,e,n,i)),{get:u(null==n?void 0:n.value)})}function u(i,r){return(t,e)=>{var n=null!=(n=null==i?void 0:i[t])?n:null;return null!=n&&(null==e||(0,s.le)(n,e))?(null!=r&&r(t),n):null!=e?e:null}}e.ue=function(t,e,n){return o(t,e,n,!0===(null==n?void 0:n.value))},e.oe=i,e.re=function(t,e,n){return t=i(t,e,n),$P($P({},t),{groupName:null!=(e=null==n?void 0:n.group_name)?e:null})},e.se=function(t,e,n,i){return $P($P({},o(t,e,n,void 0)),{get:u(null==n?void 0:n.value,i),groupName:null!=(t=null==n?void 0:n.group_name)?t:null,__value:null!=(e=null==n?void 0:n.value)?e:{}})},e.ne=function(t,e,n,i){return $P($P($P({},t),e),{get:u(n,i)})},e.ie=u},1812:(t,e)=>{$Q(e)},8578:(t,e,n)=>{$Q(e),e.v=e.A=void 0;const i=n(1406),r=n(7512);e.A=function(t,e){try{var n=JSON.parse(JSON.stringify(t));return null!=e&&null!=e.environment&&(n.statsigEnvironment=e.environment),n}catch(t){return r.Log.error("Failed to JSON.stringify user"),{statsigEnvironment:void 0}}},e.v=function(t){return t?(0,i.Dt)(t):null}},4534:(t,n,e)=>{$Q2(n,"__esModule",{value:!0}),n.J=n.F=n.Storage=void 0;var i=e(7512),e=e(6830);const r={},s={ae:()=>"InMemory",ce:t=>r[t]||null,L:(t,e)=>{r[t]=e},q:t=>{delete r[t]},he:()=>Object.keys(r)};let o=null;try{const a=(0,e.Lt)();a&&a.localStorage&&"function"==typeof a.localStorage.getItem&&(o={ae:()=>"LocalStorage",ce:t=>a.localStorage.getItem(t),L:(t,e)=>a.localStorage.setItem(t,e),q:t=>a.localStorage.removeItem(t),he:()=>Object.keys(a.localStorage)})}catch(t){i.Log.warn("Failed to setup localStorageProvider.")}let u=null!==o&&void 0!==o?o:s,l=u;n.Storage={ae:()=>l.ae(),ce:t=>{var e=()=>l.ce(t);try{return e()}catch(t){if(t instanceof Error&&"SecurityError"===t.name)return n.Storage.de(s),null;throw t}},L:(t,e)=>l.L(t,e),q:t=>l.q(t),he:()=>l.he(),de:t=>{u=t,l=t},Bt:t=>{l=t?s:u}},n.F=function(t){return t=n.Storage.ce(t),JSON.parse(null!=t?t:"null")},n.J=function(t,e){n.Storage.L(t,JSON.stringify(e))}},3401:(t,e,n)=>{$Q(e),e.C=void 0;const r=n(7512);e.C=function(t,e,n){try{var i=JSON.parse(t);return"object"==typeof i&&0 in i,i}catch(t){}return r.Log.error("Failed to parse "+n),null}},6634:(t,e)=>{$Q(e),e.le=e.kt=void 0,e.kt=function(t){return Array.isArray(t)?"array":typeof t},e.le=function(t,e){var n=t=>Array.isArray(t)?"array":typeof t;return n(t)===n(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 n=(new Date).getTime(),i="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<n?(e=(n+e)%16|0,n=Math.floor(n/16)):(e=(i+e)%16|0,i=Math.floor(i/16)),("x"===t?e:7&e|8).toString(16)})}},9638:(t,e)=>{$Q(e),e.ut=void 0,e.ut=function(t,e,n,i){return t||(e?""+e+n:""+i+n)}},2397:(t,e,n)=>{$Q(e),e.ve=e.lt=e.Ut=e.Ot=void 0;n=n(6830);const i="foreground",r="background",s=[];let o=i,u=!1;e.Ot=()=>o===i,e.Ut=()=>u,e.lt=t=>{s.unshift(t)};e.ve=e=>{e!==o&&(o=e,s.forEach(t=>t(e)))},(0,n.zt)("focus",()=>{(u=!1,e.ve)(i)}),(0,n.zt)("blur",()=>(0,e.ve)(r)),(0,n.zt)("beforeunload",()=>{u=!0,(0,e.ve)(r)}),(0,n.qt)("visibilitychange",()=>{(0,e.ve)("visible"===document.visibilityState?i:r)})},6914:function(t,e,n){var i=this&&this.__createBinding||(Object.create?function(t,e,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(e,n);r&&("get"in r?e.__esModule:!r.writable&&!r.configurable)||(r={enumerable:!0,get:function(){return e[n]}}),$Q2(t,i,r)}:function(t,e,n,i){t[i=void 0===i?n:i]=e[n]}),r=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||i(e,t,n)};$Q(e),e.Diagnostics=e.Log=e.Storage=e.EventLogger=void 0,n(1845);const s=n(8962),o=($Q2(e,"Diagnostics",{enumerable:!0,get:function(){return s.Diagnostics}}),n(7770)),u=($Q2(e,"EventLogger",{enumerable:!0,get:function(){return o.EventLogger}}),n(7512));$Q2(e,"Log",{enumerable:!0,get:function(){return u.Log}});var l=n(8e3);const a=n(4534);$Q2(e,"Storage",{enumerable:!0,get:function(){return a.Storage}}),r(n(1845),e),r(n(2137),e),r(n(6427),e),r(n(694),e),r(n(8962),e),r(n(3539),e),r(n(5542),e),r(n(2922),e),r(n(2417),e),r(n(1406),e),r(n(1333),e),r(n(7512),e),r(n(7023),e),r(n(7410),e),r(n(1405),e),r(n(1361),e),r(n(6830),e),r(n(5902),e),r(n(4143),e),r(n(9122),e),r(n(1375),e),r(n(2636),e),r(n(3206),e),r(n(1637),e),r(n(8e3),e),r(n(586),e),r(n(2059),e),r(n(1812),e),r(n(8578),e),r(n(4534),e),r(n(3401),e),r(n(6634),e),r(n(9638),e),r(n(8023),e),r(n(2397),e),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{Log:u.Log,SDK_VERSION:l.SDK_VERSION})},2016:(t,e,n)=>{$Q(e),e.AutoInit=void 0;const v=n(6914),f=n(2018);function _(t,e){var n;return null!=(n=e.get(t))?n:e.get(t.toLowerCase())}e.AutoInit=class{static attempt(e){var t,n,i;try{var r=(0,v.Lt)(),s=(0,v.Jt)();if(r&&s&&s.currentScript){var o=s.currentScript.getAttribute("src"),u=null==(t=r.location)?void 0:t.href;if(o&&u){var l=new URL(o,u).searchParams,a=null!=(n=_("sdkKey",l))?n:_("apiKey",l);if(a){var c={},h=_("proxy",l),d=(h&&(c.networkConfig={api:h}),null==(i=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instances)?void 0:i[a]);let t=null;(t=d instanceof f.StatsigClient?d:t)||(t=new f.StatsigClient(a,function(){var t=(0,v.Lt)();if(!t)return{};let e=t.statsigUser||{};var n=(e="object"!=typeof e?{}:e).custom||{},i=e.customIDs||{};return $P($P({},e),{customIDs:$P({},i),custom:$P($P({},n),{useragent:t.navigator.userAgent,page_url:(0,v.At)()||"",language:null==(i=t.navigator)?void 0:i.language})})}(),c)).initializeAsync().catch(t=>{v.Log.error(t)}),e({sdkKey:a,client:t})}}}}catch(t){v.Log.error("AutoInit failed",t)}}}},7262:(t,e,n)=>{$Q(e),e.fe=void 0;const i=n(6914);function r(t,e){null!=t&&t.forEach(t=>{delete e[t]})}e.fe=function(t,e){var n;return(e=(0,i.C)(e,"checksum","DeltasEvaluationResponse"))?(t=t,n=e,t=$P($P($P({},t),n),{feature_gates:$P($P({},t.feature_gates),n.feature_gates),layer_configs:$P($P({},t.layer_configs),n.layer_configs),dynamic_configs:$P($P({},t.dynamic_configs),n.dynamic_configs)}),r((t=n=t).deleted_gates,t.feature_gates),delete t.deleted_gates,r(n.deleted_configs,t.dynamic_configs),delete t.deleted_configs,r(n.deleted_layers,t.layer_configs),delete t.deleted_layers,n=t,(t=(0,i.Dt)({feature_gates:n.feature_gates,dynamic_configs:n.dynamic_configs,layer_configs:n.layer_configs},2))===e.checksumV2?JSON.stringify(n):{hadBadDeltaChecksum:!0,badChecksum:t,badMergedConfigs:n,badFullResponse:e.deltas_full_response}):{hadBadDeltaChecksum:!0}}},4845:(t,e,n)=>{$Q(e);const i=n(6914);e.default=class{constructor(){this._e=null,this.ge=null,this.be="Uninitialized",this.ye=0,this.me=0}reset(){this.ge=null,this._e=null,this.be="Loading",this.ye=0,this.me=0}finalize(){this.ge||(this.be="NoValues")}getValues(){return this._e?(0,i.C)(this._e,"has_updates","EvaluationStoreValues"):null}setValues(t){var e;return!!t&&null!=(e=(0,i.C)(t.data,"has_updates","EvaluationResponse"))&&(this.be=t.source,!0===(null==e?void 0:e.has_updates)&&(this._e=t.data,this.ye=e.time,this.me=t.receivedAt,this.ge=e),!0)}getGate(t){var e;return this.pe(null==(e=this.ge)?void 0:e.feature_gates,t)}getConfig(t){var e;return this.pe(null==(e=this.ge)?void 0:e.dynamic_configs,t)}getLayer(t){var e;return this.pe(null==(e=this.ge)?void 0:e.layer_configs,t)}getParamStore(t){var e;return this.pe(null==(e=this.ge)?void 0:e.param_stores,t)}pe(t,e){let n=null;return{result:n=t?t[e]||t[(0,i.h)(e)]:n,details:this.Se(null==n)}}getCurrentSourceDetails(){return"Uninitialized"===this.be||"NoValues"===this.be?{reason:this.be}:{reason:this.be,lcut:this.ye,receivedAt:this.me}}Se(t){var e=this.getCurrentSourceDetails();let n=e.reason;return"Uninitialized"!==n&&"NoValues"!==n&&(n=n+":"+(t?"Unrecognized":"Recognized")),$P($P({},e),{reason:n})}}},8448:function(t,e,n){var o=this&&this.__awaiter||$A();$Q(e);const u=n(6914),l=n(7262);class i extends u.NetworkCore{constructor(t,e){super(t,e);e=null==t?void 0:t.networkConfig;this.Oe=(0,u.ut)(null==e?void 0:e.initializeUrl,null==e?void 0:e.api,"/initialize",u.NetworkDefault.initializeApi)}fetchEvaluations(n,i,r,s){return o(this,void 0,void 0,function*(){var t=i?(0,u.C)(i,"has_updates","InitializeResponse"):null;let e={user:s,hash:"djb2",deltasResponseRequested:!1};return null!=t&&t.has_updates&&(e=$P($P({},e),{sinceTime:t.time,previousDerivedFields:"derived_fields"in t?t.derived_fields:{},deltasResponseRequested:!0})),this.je(n,t,e,r)})}je(e,n,i,r){var s;return o(this,void 0,void 0,function*(){var t=yield this.post({sdkKey:e,url:this.Oe,data:i,retries:2,isStatsigEncodable:!0,priority:r,isInitialize:!0});return 204===(null==t?void 0:t.code)?'{"has_updates": false}':200!==(null==t?void 0:t.code)?null!=(s=null==t?void 0:t.body)?s:null:!0!==(null==n?void 0:n.has_updates)||!0!==(null==(s=t.body)?void 0:s.includes('"is_delta":true'))||!0!==i.deltasResponseRequested?t.body:"string"==typeof(t=(0,l.fe)(n,t.body))?t:this.je(e,n,$P($P($P({},i),t),{deltasResponseRequested:!1}),r)})}}e.default=i},3583:(t,e,n)=>{$Q(e),e.Te=void 0;const g=n(6914),p={disableExposureLog:!0};function m(t){return null==t||!1===t.disableExposureLog}function b(t,e){return null!=e&&!(0,g.le)(t,e)}e.Te=function(v,f,_){return(t,e)=>{if(null==f)return e;var n,i,r,s,o,u,l,a,c,h,d=f[t];if(null==d||null!=e&&(0,g.kt)(e)!==d.param_type)return e;switch(d.ref_type){case"static":return d.value;case"gate":return h=d,v.getFeatureGate(h.gate_name,m(_)?void 0:p).value?h.pass_value:h.fail_value;case"dynamic_config":return h=d,l=e,a=_,b(c=(u=v).getDynamicConfig(h.config_name,p).get(h.param_name),l)?l:(m(a)&&u.getDynamicConfig(h.config_name),c);case"experiment":return l=d,a=e,u=_,b(o=(c=v).getExperiment(l.experiment_name,p).get(l.param_name),a)?a:(m(u)&&c.getExperiment(l.experiment_name),o);case"layer":return o=d,i=e,r=_,b(s=(n=v).getLayer(o.layer_name,p).get(o.param_name),i)?i:(m(r)&&n.getLayer(o.layer_name).get(o.param_name),s);default:return e}}}},8198:function(t,e,n){var r=this&&this.__awaiter||$A();$Q(e);const o=n(6914),s=n(4845),u=n(8448),l=n(3583),a=n(4131);class i extends o.StatsigClientBase{static instance(t){var e=(0,o.o)().instance(t);return e instanceof i?e:(o.Log.warn((0,o.Mt)()?"StatsigClient.instance is not supported in server environments":"Unable to find StatsigClient instance"),new i(null!=t?t:"",{}))}constructor(t,e,n=null){o.SDKType.Kt(t,"javascript-client");var i=new u.default(n,t=>{this.$emt(t)});super(t,null!=(t=null==n?void 0:n.dataAdapter)?t:new a.StatsigEvaluationsDataAdapter,i,n),this.we=new s.default,this.Ie=(0,o.A)(e,n)}initializeSync(){this.Ht.start(),this.updateUserSync(this.Ie)}initializeAsync(t){return this.Ht.start(),this.updateUserAsync(this.Ie,t)}updateUserSync(t){this.Ae(t);t=this.dataAdapter.getDataSync(this.Ie);this.we.setValues(t),this.Me(t),this.xe(null!=t?t:null,this.Ie)}updateUserAsync(n,i){return r(this,void 0,void 0,function*(){this.Ae(n);var t=this.Ie,e=(o.Diagnostics.gi(this.S),this.dataAdapter.getDataSync(t));if(this.we.setValues(e),this.Qt("Loading",e),e=yield this.dataAdapter.getDataAsync(e,t,i),t===this.Ie){let t=!1;null!=e&&(o.Diagnostics.yi(this.S),t=this.we.setValues(e),o.Diagnostics.Oi(this.S,{success:t})),this.Me(e),o.Diagnostics.bi(this.S,t,this.we.getCurrentSourceDetails()),o.Diagnostics.wi(this.Ie,this.Ht,this.S,this.p)}})}getContext(){return{sdkKey:this.S,options:this.p,values:this.we.getValues(),user:JSON.parse(JSON.stringify(this.Ie)),errorBoundary:this.Wt,session:o.StatsigSession.get(this.S),stableID:o.StableID.get(this.S)}}checkGate(t,e){return this.getFeatureGate(t,e).value}getFeatureGate(t,e){var{result:n,details:i}=this.we.getGate(t),i=(0,o.ue)(t,i,n),r=null==(r=null==(n=this.overrideAdapter)?void 0:n.getGateOverride)?void 0:r.call(n,i,this.Ie,e),n=null!=r?r:i;return this.Xt(t,(0,o.ee)(this.Ie,n),e),this.$emt({name:"gate_evaluation",gate:n}),n}getDynamicConfig(t,e){var{result:n,details:i}=this.we.getConfig(t),i=(0,o.oe)(t,i,n),r=null==(r=null==(n=this.overrideAdapter)?void 0:n.getDynamicConfigOverride)?void 0:r.call(n,i,this.Ie,e),n=null!=r?r:i;return this.Xt(t,(0,o.te)(this.Ie,n),e),this.$emt({name:"dynamic_config_evaluation",dynamicConfig:n}),n}getExperiment(t,e){var{result:n,details:i}=this.we.getConfig(t),i=(0,o.re)(t,i,n),r=null==(r=null==(n=this.overrideAdapter)?void 0:n.getExperimentOverride)?void 0:r.call(n,i,this.Ie,e),n=null!=r?r:i;return this.Xt(t,(0,o.te)(this.Ie,n),e),this.$emt({name:"experiment_evaluation",experiment:n}),n}getLayer(e,n){var{result:t,details:i}=this.we.getLayer(e),i=(0,o.se)(e,i,t),r=null==(r=null==(t=this.overrideAdapter)?void 0:t.getLayerOverride)?void 0:r.call(t,i,this.Ie,n);const s=(0,o.ne)(i,r,null!=(t=null==r?void 0:r.__value)?t:i.__value,t=>{this.Xt(e,(0,o.Zt)(this.Ie,s,t),n)});return this.$emt({name:"layer_evaluation",layer:s}),s}getParameterStore(t,e){var{result:n,details:i}=this.we.getParamStore(t);return this.Ht.incrementNonExposureCount(t),{name:t,details:i,__configuration:n,get:(0,l.Te)(this,n,e)}}logEvent(t,e,n){this.Ht.enqueue($P($P({},"string"==typeof t?{eventName:t,value:e,metadata:n}:t),{user:this.Ie,time:Date.now()}))}Yt(){this.$on("error",()=>{"Loading"===this.loadingStatus&&this.Me(null)})}Me(t){this.we.finalize(),this.Qt("Ready",t)}xe(t,e){this.dataAdapter.getDataAsync(t,e,{priority:"low"}).catch(t=>{o.Log.error("An error occurred after update.",t)})}Ae(t){this.Ht.reset(),this.we.reset(),this.Ie=(0,o.A)(t,this.p);t=null==(t=this.Ie.customIDs)?void 0:t.stableID;t&&o.StableID.setOverride(t,this.S)}}e.default=i},4131:function(t,e,n){var s=this&&this.__awaiter||$A();$Q(e),e.StatsigEvaluationsDataAdapter=void 0;const i=n(6914),r=n(8448);class o extends i.DataAdapterCore{constructor(){super("EvaluationsDataAdapter","evaluations"),this.X=null,this.p=null}attach(t,e){super.attach(t,e),this.X=new r.default(null!=e?e:{})}getDataAsync(t,e,n){return this.M(t,(0,i.A)(e,this.p),n)}prefetchData(t,e){return this.k(t,e)}setData(t){var e=(0,i.C)(t,"has_updates","data");e&&"user"in e?super.setData(t,e.user):i.Log.error("StatsigUser not found")}setDataLegacy(t,e){super.setData(t,e)}N(e,n,i){var r;return s(this,void 0,void 0,function*(){var t=yield null==(r=this.X)?void 0:r.fetchEvaluations(this.P(),e,null==i?void 0:i.priority,n);return null!=t?t:null})}T(t){t=(0,i.u)(this.P(),t,null==(t=this.p)?void 0:t.customUserCacheKeyFunc);return`${i.DataAdapterCachePrefix}.${this.m}.`+t}R(t,e){return null!=t.fullUserHash&&t.fullUserHash===(0,i.v)(e)}}e.StatsigEvaluationsDataAdapter=o},2018:(t,e,n)=>{$Q(e),e.StatsigClient=void 0;n=n(8198);e.StatsigClient=n.default,__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{StatsigClient:n.default}),e.default=__STATSIG__},4535:(t,e,n)=>{$Q(e),e.AutoCapture=e.runStatsigAutoCapture=void 0;const c=n(6914),i=n(6325),r=n(6901);e.runStatsigAutoCapture=function(t){return new s(t)};class s{constructor(t){this.De=t,this.We=Date.now(),this.Ye=0,this.Ni={};var{sdkKey:t,errorBoundary:e,values:n}=t.getContext(),n=(this.Ni=null!=(n=null==(n=null==n?void 0:n.auto_capture_settings)?void 0:n.disabled_events)?n:{},this.Wt=e,this.Wt.wrap(this),(0,c.Jt)());(0,c.Mt)()||((e=null!=(e=(__STATSIG__=(0,c.o)()).acInstances)?e:{})[t]=this,__STATSIG__.acInstances=e),"loading"===(null==n?void 0:n.readyState)?n.addEventListener("DOMContentLoaded",()=>this.Qe()):this.Qe()}Xe(){const e=(0,c.Lt)();var t,n=(0,c.Jt)();e&&n&&(t=t=>{this.Ze(t||e.event)},(0,i.ti)(n,"click",t),(0,i.ti)(n,"submit",t),(0,i.ti)(e,"error",t),(0,i.ti)(e,"beforeunload",()=>this.ei()),(0,i.ti)(e,"scroll",()=>this.ii()))}Ze(t){var e;let n=null==(e=t.type)?void 0:e.toLowerCase();"error"===n&&t instanceof ErrorEvent?this.ni(t):(e=(0,i.si)(t))&&(0,i.dt)(t,e)&&("submit"===n&&(n="form_submit"),{value:t,metadata:e}=(0,i.ri)(e),this.oi(n,t,e))}Qe(){this.Xe(),this.ui(),this.li(),this.ai()}ni(t){var e=(null==t?void 0:t.error)||{};let n=e;if("object"==typeof e)try{n=JSON.stringify(e)}catch(t){n="function"==typeof(null==e?void 0:e.toString)?e.toString():"Unknown Error"}this.oi("error",t.message,{message:t.message,filename:t.filename,lineno:t.lineno,colno:t.colno,error_str:n})}ui(){var t=this.ci();try{this.hi(t)&&this.oi("session_start",(0,i.di)(),{sessionID:t.data.sessionID},{flushImmediately:!0})}catch(t){this.Wt.logError("AC::logSession",t)}}li(){setTimeout(()=>{var t=(0,i.vi)(),t=(0,r.fi)(t);this.oi("page_view",(0,i.di)(),t,{flushImmediately:!0,addNewSessionMetadata:!0})},1)}ai(){const n=(0,c.Lt)();void 0!==(null===n||void 0===n?void 0:n.performance)&&"function"==typeof n.performance.getEntriesByType&&"function"==typeof n.performance.getEntriesByName&&setTimeout(()=>{var t={},e=n.performance.getEntriesByType("navigation"),e=(e&&0<e.length&&e[0]instanceof PerformanceNavigationTiming&&(e=e[0],t.load_time_ms=e.duration,t.dom_interactive_time_ms=e.domInteractive-e.startTime,t.redirect_count=e.redirectCount,t.transfer_bytes=e.transferSize),n.performance.getEntriesByName("first-contentful-paint"));e&&0<e.length&&e[0]instanceof PerformancePaintTiming&&(t.first_contentful_paint_time_ms=e[0].startTime),this.oi("performance",(0,i.di)(),t)},1)}ei(){this.oi("page_view_end",(0,i.di)(),{scrollDepth:this.Ye,pageViewLength:Date.now()-this.We},{flushImmediately:!0})}oi(t,e,n,i){var r,s,o;if(!this.Ni[t]){var u=this.ci();try{var l=$P({sessionID:u.data.sessionID,page_url:null!=(o=null==(s=null==(r=(0,c.Lt)())?void 0:r.location)?void 0:s.href)?o:""},n),a=(null!=i&&i.addNewSessionMetadata&&(l.isNewSession=String(this.hi(u))),{eventName:"auto_capture::"+t,value:e,metadata:l});this.De.logEvent(a),null!=i&&i.flushImmediately&&this.De.flush().catch(t=>{c.Log.error(t)})}catch(t){this.Wt.logError("AC::enqueue",t)}}}ii(){var t=null!=(t=null==(t=(0,c.Jt)())?void 0:t.body.scrollHeight)?t:1,e=(0,c.Lt)(),n=null!=(n=null==e?void 0:e.scrollY)?n:1,e=null!=(e=null==e?void 0:e.innerHeight)?e:1;this.Ye=Math.max(this.Ye,Math.min(100,Math.round((n+e)/t*100)))}hi(t){return Math.abs(t.data.startTime-Date.now())<1e3}ci(){return this.De.getContext().session}}e.AutoCapture=s},6325:(t,e,n)=>{$Q(e),e.ti=e.di=e.vi=e.dt=e.si=e.ri=e.fn=void 0;const s=n(6914);function o(t){var e={};if(t){var n=null==t?void 0:t.dataset;if(n)for(const i in n)e["data-"+i]=n[i]||""}return e}function u(e){if(e){let t=e;for(;t;){var n=t.tagName.toLowerCase();if(["body","document"].includes(n))return null;if("a"===t.tagName.toLowerCase())return t;t=t.parentElement}}return null}e.fn=o,e.ri=function(t){var e=t.tagName.toLowerCase(),n={},i=(0,s.At)()||"",r=("form"===(n.tagName=e)&&(n.action=t.getAttribute("action"),n.method=null!=(r=t.getAttribute("method"))?r:"GET",n.formName=t.getAttribute("name"),n.formId=t.getAttribute("id")),["input","select","textarea"].includes(e)&&"password"!==t.getAttribute("type")&&(n.content=t.value,n.inputName=t.getAttribute("name")),u(t));return r&&(n.href=r.getAttribute("href")),"button"!==e&&!r||(n.content=(t.textContent||"").trim(),e=o(r||t),$P(n,e)),{value:i,metadata:n}},e.si=function(t){if(!t)return null;let e=t.target||t.srcElement;return e&&e instanceof Element?e=3===e.nodeType?e.parentNode||null:e:null},e.dt=function(t,e){if(!t||!e||1!==e.nodeType)return!1;var n=e.tagName.toLowerCase(),i=t.type.toLowerCase();switch(n){case"html":return!1;case"form":return"submit"===i;case"input":case"select":case"textarea":return["change"].includes(i);default:if("click"===i){if("button"===n)return!0;if(u(e))return!0}return!1}},e.vi=function(){var t=null!=(t=null==(t=null==(t=(0,s.Lt)())?void 0:t.location)?void 0:t.href)?t:"";let e;try{e=new URL(t)}catch(t){e=new URL("error:")}return e},e.di=function(){return(0,s.At)()||""},e.ti=function(t,e,n){t&&t.addEventListener&&t.addEventListener(e,n,!0)}},1964:(t,e,n)=>{$Q(e),e.runStatsigAutoCapture=e.AutoCapture=void 0;const i=n(4535);$Q2(e,"AutoCapture",{enumerable:!0,get:function(){return i.AutoCapture}}),$Q2(e,"runStatsigAutoCapture",{enumerable:!0,get:function(){return i.runStatsigAutoCapture}}),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{AutoCapture:i.AutoCapture,runStatsigAutoCapture:i.runStatsigAutoCapture}),e.default=__STATSIG__},6901:(t,e,n)=>{$Q(e),e.fi=void 0;const a=n(6914);e.fi=function(t){var e=(0,a.Jt)(),n=(0,a.Lt)();if(!e||!n)return{};var i=null==n?void 0:n.navigator,r=(null==e?void 0:e.referrer)||"";let s=new URL("empty:");if(r)try{s=new URL(r||"empty:")}catch(t){}u=s,o=function(t){const e=t.hostname,n=["google","bing","yahoo","duckduckgo","baidu"].find(t=>e.includes(t+"."));return n||""}(u),u=u.searchParams.get("yahoo"===o?"p":"q")||"";var o={searchEngine:o,searchQuery:u},u=function(t){const n=t.searchParams,i={};return["utm_source","utm_medium","utm_campaign","utm_term","utm_content","gclid","gclsrc","dclid","fbclid","msclkid","mc_eid","mc_cid","twclid","li_fat_id","igshid","utm_id","ttc","ttclid","ttc_id"].forEach(t=>{var e=n.get(t);e&&(i[t]=e)}),i}(t);const l={};return t.searchParams.forEach((t,e)=>{l[e]=t}),$P($P($P($P({},o),u),l),{title:(null==e?void 0:e.title)||"",locale:(null==i?void 0:i.language)||"unknown",hostname:t.hostname||"unknown",pathname:t.pathname||"unknown",referrer:r,screen_width:(null==(o=null==n?void 0:n.screen)?void 0:o.width)||"unknown",screen_height:(null==(u=null==n?void 0:n.screen)?void 0:u.height)||"unknown",viewport_width:(null==n?void 0:n.innerWidth)||"unknown",viewport_height:(null==n?void 0:n.innerHeight)||"unknown"})}}},i={};function r(t){var e=i[t];return void 0!==e||(e=i[t]={exports:{}},n[t].call(e.exports,e,e.exports,r)),e.exports}r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}();var t={};{var e=t;const o=r(1964);var s=r(2016);e.default=__STATSIG__,s.AutoInit.attempt(({client:t})=>{new o.AutoCapture(t)})}return t.default})());
{
"name": "@statsig/js-client",
"version": "1.8.0-beta.13",
"version": "1.8.0-beta.14",
"dependencies": {
"@statsig/client-core": "1.8.0-beta.13"
"@statsig/client-core": "1.8.0-beta.14"
},

@@ -7,0 +7,0 @@ "jsdelivr": "./build/statsig-js-client.min.js",

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc