statsig-sidecar-v2-beta 2.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,14 @@
1
+ ISC License (ISC)
2
+ Copyright (c) 2021, Statsig, Inc.
3
+
4
+ Permission to use, copy, modify, and/or distribute this software for any purpose
5
+ with or without fee is hereby granted, provided that the above copyright notice
6
+ and this permission notice appear in all copies.
7
+
8
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
9
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
10
+ FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
11
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
12
+ OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
13
+ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
14
+ THIS SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # Statsig Sidecar
2
+
3
+ Statsig sidecar helps marketing teams build and run experiments without needing to write or modify code.# sidecar-js-v2
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ (()=>{"use strict";var e={10:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._isTypeMatch=t._typeOf=void 0,t._typeOf=function(e){return Array.isArray(e)?"array":typeof e},t._isTypeMatch=function(e,t){const n=e=>Array.isArray(e)?"array":typeof e;return n(e)===n(t)}},12:(e,t,n)=>{var i,r,o;Object.defineProperty(t,"__esModule",{value:!0}),t._getInstance=t._getStatsigGlobalFlag=t._getStatsigGlobal=void 0;const s=n(25);t._getStatsigGlobal=()=>{try{return"undefined"!=typeof __STATSIG__?__STATSIG__:c}catch(e){return c}},t._getStatsigGlobalFlag=e=>(0,t._getStatsigGlobal)()[e],t._getInstance=e=>{const n=(0,t._getStatsigGlobal)();return e?n.instances&&n.instances[e]:(n.instances&&Object.keys(n.instances).length>1&&s.Log.warn("Call made to Statsig global instance without an SDK key but there is more than one client instance. If you are using mulitple clients, please specify the SDK key."),n.firstInstance)};const a="__STATSIG__",l="undefined"!=typeof window?window:{},u=void 0!==n.g?n.g:{},d="undefined"!=typeof globalThis?globalThis:{},c=null!==(o=null!==(r=null!==(i=l[a])&&void 0!==i?i:u[a])&&void 0!==r?r:d[a])&&void 0!==o?o:{instance:t._getInstance};l[a]=c,u[a]=c,d[a]=c},25:(e,t)=>{function n(e){return e.unshift("[Statsig]"),e}Object.defineProperty(t,"__esModule",{value:!0}),t.Log=t.LogLevel=void 0,t.LogLevel={None:0,Error:1,Warn:2,Info:3,Debug:4};class i{static info(...e){i.level>=t.LogLevel.Info&&console.info(" INFO ",...n(e))}static debug(...e){i.level>=t.LogLevel.Debug&&console.debug(" DEBUG ",...n(e))}static warn(...e){i.level>=t.LogLevel.Warn&&console.warn(" WARN ",...n(e))}static error(...e){i.level>=t.LogLevel.Error&&console.error(" ERROR ",...n(e))}}t.Log=i,i.level=t.LogLevel.Warn},27:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._getSortedObject=t._DJB2Object=t._DJB2=void 0;const i=n(5111);t._DJB2=e=>{let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t&=t;return String(t>>>0)},t._DJB2Object=(e,n)=>(0,t._DJB2)(JSON.stringify((0,t._getSortedObject)(e,n))),t._getSortedObject=(e,n)=>{if(null==e)return null;const r=Object.keys(e).sort(),o={};return r.forEach(r=>{const s=e[r];0!==n&&"object"===(0,i._typeOf)(s)?o[r]=(0,t._getSortedObject)(s,null!=n?n-1:n):o[r]=s}),o}},210:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._getStorageKey=t._getUserStorageKey=void 0;const i=n(3735);function r(e,t,n){var r;if(n)return n(e,t);const o=t&&t.customIDs?t.customIDs:{},s=[`uid:${null!==(r=null==t?void 0:t.userID)&&void 0!==r?r:""}`,`cids:${Object.keys(o).sort((e,t)=>e.localeCompare(t)).map(e=>`${e}-${o[e]}`).join(",")}`,`k:${e}`];return(0,i._DJB2)(s.join("|"))}t._getUserStorageKey=r,t._getStorageKey=function(e,t,n){return t?r(e,t,n):(0,i._DJB2)(`k:${e}`)}},400:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._notifyVisibilityChanged=t._subscribeToVisiblityChanged=t._isUnloading=t._isCurrentlyVisible=void 0;const i=n(4845),r="foreground",o="background",s=[];let a=r,l=!1;t._isCurrentlyVisible=()=>a===r,t._isUnloading=()=>l,t._subscribeToVisiblityChanged=e=>{s.unshift(e)},t._notifyVisibilityChanged=e=>{e!==a&&(a=e,s.forEach(t=>t(e)))},(0,i._addWindowEventListenerSafe)("focus",()=>{l=!1,(0,t._notifyVisibilityChanged)(r)}),(0,i._addWindowEventListenerSafe)("blur",()=>(0,t._notifyVisibilityChanged)(o)),(0,i._addDocumentEventListenerSafe)("visibilitychange",()=>{(0,t._notifyVisibilityChanged)("visible"===document.visibilityState?r:o)}),(0,i._addWindowEventListenerSafe)((0,i._getUnloadEvent)(),()=>{l=!0,(0,t._notifyVisibilityChanged)(o)})},414:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._getCurrentPageUrlSafe=t._addDocumentEventListenerSafe=t._addWindowEventListenerSafe=t._isServerEnv=t._getDocumentSafe=t._getWindowSafe=void 0,t._getWindowSafe=()=>"undefined"!=typeof window?window:null,t._getDocumentSafe=()=>{var e;const n=(0,t._getWindowSafe)();return null!==(e=null==n?void 0:n.document)&&void 0!==e?e:null},t._isServerEnv=()=>{if(null!==(0,t._getDocumentSafe)())return!1;const e="undefined"!=typeof process&&null!=process.versions&&null!=process.versions.node;return"string"==typeof EdgeRuntime||e},t._addWindowEventListenerSafe=(e,n)=>{const i=(0,t._getWindowSafe)();"function"==typeof(null==i?void 0:i.addEventListener)&&i.addEventListener(e,n)},t._addDocumentEventListenerSafe=(e,n)=>{const i=(0,t._getDocumentSafe)();"function"==typeof(null==i?void 0:i.addEventListener)&&i.addEventListener(e,n)},t._getCurrentPageUrlSafe=()=>{var e;try{return null===(e=(0,t._getWindowSafe)())||void 0===e?void 0:e.location.href.split(/[?#]/)[0]}catch(e){return}}},621:function(e,t,n){var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))(function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t._isDomainFailure=t.NetworkFallbackResolver=void 0;const r=n(8820),o=n(27),s=n(25),a=n(4203),l=6048e5;function u(e,t){var n;const i=null!==(n=null==e?void 0:e.toLowerCase())&&void 0!==n?n:"";return t||i.includes("uncaught exception")||i.includes("failed to fetch")||i.includes("networkerror when attempting to fetch resource")}function d(e){return`statsig.network_fallback.${(0,o._DJB2)(e)}`}function c(e,t){const n=d(e);t&&0!==Object.keys(t).length?a.Storage.setItem(n,JSON.stringify(t)):a.Storage.removeItem(n)}t.NetworkFallbackResolver=class{constructor(e){var t;this._fallbackInfo=null,this._errorBoundary=null,this._dnsQueryCooldowns={},this._networkOverrideFunc=null===(t=e.networkConfig)||void 0===t?void 0:t.networkOverrideFunc}setErrorBoundary(e){this._errorBoundary=e}tryBumpExpiryTime(e,t){var n;const i=null===(n=this._fallbackInfo)||void 0===n?void 0:n[t.endpoint];i&&(i.expiryTime=Date.now()+l,c(e,Object.assign(Object.assign({},this._fallbackInfo),{[t.endpoint]:i})))}getActiveFallbackUrl(e,t){var n,i;if(null!=t.customUrl&&null!=t.fallbackUrls)return null;let r=this._fallbackInfo;null==r&&(r=null!==(n=function(e){const t=d(e),n=a.Storage.getItem(t);if(!n)return null;try{return JSON.parse(n)}catch(e){return s.Log.error("Failed to parse FallbackInfo"),null}}(e))&&void 0!==n?n:{},this._fallbackInfo=r);const o=r[t.endpoint];return!o||Date.now()>(null!==(i=o.expiryTime)&&void 0!==i?i:0)||t.getChecksum()!==o.urlConfigChecksum?(delete r[t.endpoint],this._fallbackInfo=r,c(e,this._fallbackInfo),null):o.url?o.url:null}tryFetchUpdatedFallbackInfo(e,t,n,r){return i(this,void 0,void 0,function*(){var i,o;try{if(!u(n,r))return!1;const o=null==t.customUrl&&null==t.fallbackUrls?yield this._tryFetchFallbackUrlsFromNetwork(t):t.fallbackUrls,s=this._pickNewFallbackUrl(null===(i=this._fallbackInfo)||void 0===i?void 0:i[t.endpoint],o);return!!s&&(this._updateFallbackInfoWithNewUrl(e,t,s),!0)}catch(e){return null===(o=this._errorBoundary)||void 0===o||o.logError("tryFetchUpdatedFallbackInfo",e),!1}})}_updateFallbackInfoWithNewUrl(e,t,n){var i,r,o;const s={urlConfigChecksum:t.getChecksum(),url:n,expiryTime:Date.now()+l,previous:[]},a=t.endpoint,u=null===(i=this._fallbackInfo)||void 0===i?void 0:i[a];u&&s.previous.push(...u.previous),s.previous.length>10&&(s.previous=[]);const d=null===(o=null===(r=this._fallbackInfo)||void 0===r?void 0:r[a])||void 0===o?void 0:o.url;null!=d&&s.previous.push(d),this._fallbackInfo=Object.assign(Object.assign({},this._fallbackInfo),{[a]:s}),c(e,this._fallbackInfo)}_tryFetchFallbackUrlsFromNetwork(e){return i(this,void 0,void 0,function*(){var t;const n=this._dnsQueryCooldowns[e.endpoint];if(n&&Date.now()<n)return null;this._dnsQueryCooldowns[e.endpoint]=Date.now()+144e5;const i=[],o=yield(0,r._fetchTxtRecords)(null!==(t=this._networkOverrideFunc)&&void 0!==t?t:fetch),s=function(e){try{return new URL(e).pathname}catch(e){return null}}(e.defaultUrl);for(const t of o){if(!t.startsWith(e.endpointDnsKey+"="))continue;const n=t.split("=");if(n.length>1){let e=n[1];e.endsWith("/")&&(e=e.slice(0,-1)),i.push(`https://${e}${s}`)}}return i})}_pickNewFallbackUrl(e,t){var n;if(null==t)return null;const i=new Set(null!==(n=null==e?void 0:e.previous)&&void 0!==n?n:[]),r=null==e?void 0:e.url;let o=null;for(const e of t){const t=e.endsWith("/")?e.slice(0,-1):e;if(!i.has(e)&&t!==r){o=t;break}}return o}},t._isDomainFailure=u},637:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ErrorTag=void 0,t.ErrorTag={NetworkError:"NetworkError"}},686:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SDKType=void 0;const n={};let i;t.SDKType={_get:e=>{var t;return(null!==(t=n[e])&&void 0!==t?t:"js-mono")+(null!=i?i:"")},_setClientType(e,t){n[e]=t},_setBindingType(e){i&&"-react"!==i||(i="-"+e)}}},790:function(e,t,n){var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))(function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t.NetworkCore=void 0,n(12);const r=n(12),o=n(4319),s=n(25),a=n(3939),l=n(621),u=n(6296),d=n(4775),c=n(5737),g=n(5678),_=n(9069),h=n(2617),v=n(3285),f=n(4549),p=n(3508),m=new Set([408,500,502,503,504,522,524,599]);t.NetworkCore=class{constructor(e,t){this._emitter=t,this._errorBoundary=null,this._timeout=1e4,this._netConfig={},this._options={},this._leakyBucket={},this._lastUsedInitUrl=null,e&&(this._options=e),this._options.networkConfig&&(this._netConfig=this._options.networkConfig),this._netConfig.networkTimeoutMs&&(this._timeout=this._netConfig.networkTimeoutMs),this._fallbackResolver=new l.NetworkFallbackResolver(this._options),this.setLogEventCompressionMode(this._getLogEventCompressionMode(e))}setLogEventCompressionMode(e){this._options.logEventCompressionMode=e}setErrorBoundary(e){this._errorBoundary=e,this._errorBoundary.wrap(this),this._errorBoundary.wrap(this._fallbackResolver),this._fallbackResolver.setErrorBoundary(e)}isBeaconSupported(){return"undefined"!=typeof navigator&&"function"==typeof navigator.sendBeacon}getLastUsedInitUrlAndReset(){const e=this._lastUsedInitUrl;return this._lastUsedInitUrl=null,e}beacon(e){if(!y(e))return!1;const t=this._getInternalRequestArgs("POST",e),n=this._getPopulatedURL(t),i=navigator;return i.sendBeacon.bind(i)(n,t.body)}post(e){return i(this,void 0,void 0,function*(){const t=this._getInternalRequestArgs("POST",e);return this._tryEncodeBody(t),yield this._tryToCompressBody(t),this._sendRequest(t)})}get(e){const t=this._getInternalRequestArgs("GET",e);return this._sendRequest(t)}_sendRequest(e){return i(this,void 0,void 0,function*(){var t,n,r,l;if(!y(e))return null;if(this._netConfig.preventAllNetworkTraffic)return null;const{method:u,body:d,retries:c,attempt:g}=e,_=e.urlConfig.endpoint;if(this._isRateLimited(_))return s.Log.warn(`Request to ${_} was blocked because you are making requests too frequently.`),null;const v=null!=g?g:1,f="undefined"!=typeof AbortController?new AbortController:null,b=setTimeout(()=>{null==f||f.abort(`Timeout of ${this._timeout}ms expired.`)},this._timeout),E=this._getPopulatedURL(e);let k=null;const w=(0,p._isUnloading)();try{const n={method:u,body:d,headers:Object.assign({},e.headers),signal:null==f?void 0:f.signal,priority:e.priority,keepalive:w};!function(e,t){e.urlConfig.endpoint===a.Endpoint._initialize&&o.Diagnostics._markInitNetworkReqStart(e.sdkKey,{attempt:t})}(e,v);const i=this._leakyBucket[_];i&&(i.lastRequestTime=Date.now(),this._leakyBucket[_]=i);const r=null!==(t=this._netConfig.networkOverrideFunc)&&void 0!==t?t:fetch;if(k=yield r(E,n),clearTimeout(b),!k.ok){const e=yield k.text().catch(()=>"No Text"),t=new Error(`NetworkError: ${E} ${e}`);throw t.name="NetworkError",t}const s=yield k.text();return S(e,k,v,s),this._fallbackResolver.tryBumpExpiryTime(e.sdkKey,e.urlConfig),{body:s,code:k.status}}catch(t){const o=function(e,t){return(null==e?void 0:e.signal.aborted)&&"string"==typeof e.signal.reason?e.signal.reason:"string"==typeof t?t:t instanceof Error?`${t.name}: ${t.message}`:"Unknown Error"}(f,t),a=(null==(O=f)?void 0:O.signal.aborted)&&"string"==typeof O.signal.reason&&O.signal.reason.includes("Timeout")||!1;if(S(e,k,v,"",t),(yield this._fallbackResolver.tryFetchUpdatedFallbackInfo(e.sdkKey,e.urlConfig,o,a))&&(e.fallbackUrl=this._fallbackResolver.getActiveFallbackUrl(e.sdkKey,e.urlConfig)),!c||v>c||!m.has(null!==(n=null==k?void 0:k.status)&&void 0!==n?n:500)){null===(r=this._emitter)||void 0===r||r.call(this,{name:"error",error:t,tag:h.ErrorTag.NetworkError,requestArgs:e});const n=`A networking error occurred during ${u} request to ${E}.`;return s.Log.error(n,o,t),null===(l=this._errorBoundary)||void 0===l||l.attachErrorIfNoneExists(n),null}return yield function(e){return i(this,void 0,void 0,function*(){yield new Promise(t=>setTimeout(t,Math.min(e*e*500,3e4)))})}(v),this._sendRequest(Object.assign(Object.assign({},e),{retries:c,attempt:v+1}))}var O})}_getLogEventCompressionMode(e){let t=null==e?void 0:e.logEventCompressionMode;return t||!0!==(null==e?void 0:e.disableCompression)||(t=f.LogEventCompressionMode.Disabled),t||(t=f.LogEventCompressionMode.Enabled),t}_isRateLimited(e){var t;const n=Date.now(),i=null!==(t=this._leakyBucket[e])&&void 0!==t?t:{count:0,lastRequestTime:n},r=n-i.lastRequestTime,o=Math.floor(.05*r);return i.count=Math.max(0,i.count-o),i.count>=50||(i.count+=1,i.lastRequestTime=n,this._leakyBucket[e]=i,!1)}_getPopulatedURL(e){var t;const n=null!==(t=e.fallbackUrl)&&void 0!==t?t:e.urlConfig.getUrl();e.urlConfig.endpoint!==a.Endpoint._initialize&&e.urlConfig.endpoint!==a.Endpoint._download_config_specs||(this._lastUsedInitUrl=n);const i=Object.assign({[a.NetworkParam.SdkKey]:e.sdkKey,[a.NetworkParam.SdkType]:d.SDKType._get(e.sdkKey),[a.NetworkParam.SdkVersion]:v.SDK_VERSION,[a.NetworkParam.Time]:String(Date.now()),[a.NetworkParam.SessionID]:g.SessionID.get(e.sdkKey)},e.params),r=Object.keys(i).map(e=>`${encodeURIComponent(e)}=${encodeURIComponent(i[e])}`).join("&");return`${n}${r?`?${r}`:""}`}_tryEncodeBody(e){var t;const n=(0,c._getWindowSafe)(),i=e.body;if(e.isStatsigEncodable&&!this._options.disableStatsigEncoding&&"string"==typeof i&&null==(0,r._getStatsigGlobalFlag)("no-encode")&&(null==n?void 0:n.btoa))try{e.body=n.btoa(i).split("").reverse().join(""),e.params=Object.assign(Object.assign({},null!==(t=e.params)&&void 0!==t?t:{}),{[a.NetworkParam.StatsigEncoded]:"1"})}catch(t){s.Log.warn(`Request encoding failed for ${e.urlConfig.getUrl()}`,t)}}_tryToCompressBody(e){return i(this,void 0,void 0,function*(){var t;const n=e.body;if("string"==typeof n&&function(e,t){if(!e.isCompressable)return!1;if(null!=(0,r._getStatsigGlobalFlag)("no-compress")||"undefined"==typeof CompressionStream||"undefined"==typeof TextEncoder)return!1;const n=null!=e.urlConfig.customUrl||null!=e.urlConfig.fallbackUrls,i=!0===u.SDKFlags.get(e.sdkKey,"enable_log_event_compression");switch(t.logEventCompressionMode){case f.LogEventCompressionMode.Disabled:return!1;case f.LogEventCompressionMode.Enabled:return!(n&&!i);case f.LogEventCompressionMode.Forced:return!0;default:return!1}}(e,this._options))try{const i=(new TextEncoder).encode(n),r=new CompressionStream("gzip"),o=r.writable.getWriter();o.write(i).catch(s.Log.error),o.close().catch(s.Log.error);const l=r.readable.getReader(),u=[];let d;for(;!(d=yield l.read()).done;)u.push(d.value);const c=u.reduce((e,t)=>e+t.length,0),g=new Uint8Array(c);let _=0;for(const e of u)g.set(e,_),_+=e.length;e.body=g,e.params=Object.assign(Object.assign({},null!==(t=e.params)&&void 0!==t?t:{}),{[a.NetworkParam.IsGzipped]:"1"})}catch(t){s.Log.warn(`Request compression failed for ${e.urlConfig.getUrl()}`,t)}})}_getInternalRequestArgs(e,t){const n=this._fallbackResolver.getActiveFallbackUrl(t.sdkKey,t.urlConfig),i=Object.assign(Object.assign({},t),{method:e,fallbackUrl:n});return"data"in t&&b(i,t.data),i}};const y=e=>!!e.sdkKey||(s.Log.warn("Unable to make request without an SDK key"),!1),b=(e,t)=>{const{sdkKey:n,fallbackUrl:i}=e,r=_.StableID.get(n),o=g.SessionID.get(n),s=d.SDKType._get(n);e.body=JSON.stringify(Object.assign(Object.assign({},t),{statsigMetadata:Object.assign(Object.assign({},v.StatsigMetadataProvider.get()),{stableID:r,sessionID:o,sdkType:s,fallbackUrl:i})}))};function S(e,t,n,i,r){e.urlConfig.endpoint===a.Endpoint._initialize&&o.Diagnostics._markInitNetworkReqEnd(e.sdkKey,o.Diagnostics._getDiagnosticsData(t,n,i,r))}},882:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Diagnostics=void 0;const n=new Map,i="start",r="end";function o(e,t,n,i){return Object.assign({key:n,action:t,step:i,timestamp:Date.now()},e)}function s(e,t){var i;const r=null!==(i=n.get(e))&&void 0!==i?i:[];r.push(t),n.set(e,r)}function a(e,t){if(t in e)return e[t]}t.Diagnostics={_getMarkers:e=>n.get(e),_markInitOverallStart:e=>{s(e,o({},i,"overall"))},_markInitOverallEnd:(e,t,n)=>{s(e,o({success:t,error:t?void 0:{name:"InitializeError",message:"Failed to initialize"},evaluationDetails:n},r,"overall"))},_markInitNetworkReqStart:(e,t)=>{s(e,o(t,i,"initialize","network_request"))},_markInitNetworkReqEnd:(e,t)=>{s(e,o(t,r,"initialize","network_request"))},_markInitProcessStart:e=>{s(e,o({},i,"initialize","process"))},_markInitProcessEnd:(e,t)=>{s(e,o(t,r,"initialize","process"))},_clearMarkers:e=>{n.delete(e)},_formatError(e){if(e&&"object"==typeof e)return{code:a(e,"code"),name:a(e,"name"),message:a(e,"message")}},_getDiagnosticsData(e,n,i,r){var o;return{success:!0===(null==e?void 0:e.ok),statusCode:null==e?void 0:e.status,sdkRegion:null===(o=null==e?void 0:e.headers)||void 0===o?void 0:o.get("x-statsig-region"),isDelta:!0===i.includes('"is_delta":true')||void 0,attempt:n,error:t.Diagnostics._formatError(r)}},_enqueueDiagnosticsEvent(e,n,i,r){const o=t.Diagnostics._getMarkers(i);if(null==o||o.length<=0)return;t.Diagnostics._clearMarkers(i);const s=function(e,t){return{eventName:"statsig::diagnostics",user:e,value:null,metadata:t,time:Date.now()}}(e,{context:"initialize",markers:o.slice(),statsigOptions:r});n.enqueue(s)}}},1046:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UrlConfiguration=void 0;const i=n(3735),r=n(8871),o={[r.Endpoint._initialize]:"i",[r.Endpoint._rgstr]:"e",[r.Endpoint._download_config_specs]:"d"};t.UrlConfiguration=class{constructor(e,t,n,i){this.customUrl=null,this.fallbackUrls=null,this.endpoint=e,this.endpointDnsKey=o[e],t&&(this.customUrl=t),!t&&n&&(this.customUrl=n.endsWith("/")?`${n}${e}`:`${n}/${e}`),i&&(this.fallbackUrls=i);const s=r.NetworkDefault[e];this.defaultUrl=`${s}/${e}`}getUrl(){var e;return null!==(e=this.customUrl)&&void 0!==e?e:this.defaultUrl}getChecksum(){var e;const t=(null!==(e=this.fallbackUrls)&&void 0!==e?e:[]).sort().join(",");return(0,i._DJB2)(this.customUrl+t)}}},1130:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._createLayerParameterExposure=t._createConfigExposure=t._mapExposures=t._createGateExposure=t._isExposureEvent=void 0;const n="statsig::config_exposure",i="statsig::gate_exposure",r="statsig::layer_exposure",o=(e,t,n,i,r)=>(n.bootstrapMetadata&&(i.bootstrapMetadata=n.bootstrapMetadata),{eventName:e,user:t,value:null,metadata:a(n,i),secondaryExposures:r,time:Date.now()});function s(e,t){return e.map(e=>"string"==typeof e?(null!=t?t:{})[e]:e).filter(e=>null!=e)}t._isExposureEvent=({eventName:e})=>e===i||e===n||e===r,t._createGateExposure=(e,t,n)=>{var r,a,l;const u={gate:t.name,gateValue:String(t.value),ruleID:t.ruleID};return null!=(null===(r=t.__evaluation)||void 0===r?void 0:r.version)&&(u.configVersion=t.__evaluation.version),o(i,e,t.details,u,s(null!==(l=null===(a=t.__evaluation)||void 0===a?void 0:a.secondary_exposures)&&void 0!==l?l:[],n))},t._mapExposures=s,t._createConfigExposure=(e,t,i)=>{var r,a,l,u;const d={config:t.name,ruleID:t.ruleID};return null!=(null===(r=t.__evaluation)||void 0===r?void 0:r.version)&&(d.configVersion=t.__evaluation.version),null!=(null===(a=t.__evaluation)||void 0===a?void 0:a.passed)&&(d.rulePassed=String(t.__evaluation.passed)),o(n,e,t.details,d,s(null!==(u=null===(l=t.__evaluation)||void 0===l?void 0:l.secondary_exposures)&&void 0!==u?u:[],i))},t._createLayerParameterExposure=(e,t,n,i)=>{var a,l,u,d,c,g,_;const h=t.__evaluation,v=!0===(null===(a=null==h?void 0:h.explicit_parameters)||void 0===a?void 0:a.includes(n));let f="",p=null!==(l=null==h?void 0:h.undelegated_secondary_exposures)&&void 0!==l?l:[];v&&(f=null!==(u=h.allocated_experiment_name)&&void 0!==u?u:"",p=null!==(d=h.secondary_exposures)&&void 0!==d?d:[]);const m=null===(c=t.__evaluation)||void 0===c?void 0:c.parameter_rule_ids,y={config:t.name,parameterName:n,ruleID:null!==(g=null==m?void 0:m[n])&&void 0!==g?g:t.ruleID,allocatedExperiment:f,isExplicitParameter:String(v)};return null!=(null===(_=t.__evaluation)||void 0===_?void 0:_.version)&&(y.configVersion=t.__evaluation.version),o(r,e,t.details,y,s(p,i))};const a=(e,t)=>(t.reason=e.reason,e.lcut&&(t.lcut=String(e.lcut)),e.receivedAt&&(t.receivedAt=String(e.receivedAt)),t)},1180:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},1272:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._makeTypedGet=t._mergeOverride=t._makeLayer=t._makeExperiment=t._makeDynamicConfig=t._makeFeatureGate=void 0;const i=n(25),r=n(5111);function o(e,t,n,i){var r;return{name:e,details:t,ruleID:null!==(r=null==n?void 0:n.rule_id)&&void 0!==r?r:"",__evaluation:n,value:i}}function s(e,t,n){var i;const r=null!==(i=null==n?void 0:n.value)&&void 0!==i?i:{};return Object.assign(Object.assign({},o(e,t,n,r)),{get:a(e,null==n?void 0:n.value)})}function a(e,t,n){return(o,s)=>{var a;const l=null!==(a=null==t?void 0:t[o])&&void 0!==a?a:null;return null==l?null!=s?s:null:null==s||(0,r._isTypeMatch)(l,s)?(null==n||n(o),l):(i.Log.warn(`Parameter type mismatch. '${e}.${o}' was found to be type '${typeof l}' but fallback/return type is '${typeof s}'. See https://docs.statsig.com/client/javascript-sdk/#typed-getters`),null!=s?s:null)}}t._makeFeatureGate=function(e,t,n){var i;return Object.assign(Object.assign({},o(e,t,n,!0===(null==n?void 0:n.value))),{idType:null!==(i=null==n?void 0:n.id_type)&&void 0!==i?i:null})},t._makeDynamicConfig=s,t._makeExperiment=function(e,t,n){var i;const r=s(e,t,n);return Object.assign(Object.assign({},r),{groupName:null!==(i=null==n?void 0:n.group_name)&&void 0!==i?i:null})},t._makeLayer=function(e,t,n,i){var r,s;return Object.assign(Object.assign({},o(e,t,n,void 0)),{get:a(e,null==n?void 0:n.value,i),groupName:null!==(r=null==n?void 0:n.group_name)&&void 0!==r?r:null,__value:null!==(s=null==n?void 0:n.value)&&void 0!==s?s:{}})},t._mergeOverride=function(e,t,n,i){return Object.assign(Object.assign(Object.assign({},e),t),{get:a(e.name,n,i)})},t._makeTypedGet=a},1319:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UPDATE_DETAIL_ERROR_MESSAGES=t.createUpdateDetails=void 0,t.createUpdateDetails=(e,t,n,i,r,o)=>({duration:n,source:t,success:e,error:i,sourceUrl:r,warnings:o}),t.UPDATE_DETAIL_ERROR_MESSAGES={NO_NETWORK_DATA:"No data was returned from the network. This may be due to a network timeout if a timeout value was specified in the options or ad blocker error."}},1500:(e,t,n)=>{t.gX=void 0;const i=n(7463);Object.defineProperty(t,"gX",{enumerable:!0,get:function(){return i.runStatsigAutoCapture}}),__STATSIG__=Object.assign(Object.assign({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{AutoCapture:i.AutoCapture,runStatsigAutoCapture:i.runStatsigAutoCapture}),__STATSIG__},1570:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._getFullUserHash=t._normalizeUser=void 0;const i=n(3918),r=n(8024);t._normalizeUser=function(e,t){try{const n=JSON.parse(JSON.stringify(e));return null!=t&&null!=t.environment&&(n.statsigEnvironment=t.environment),n}catch(e){return r.Log.error("Failed to JSON.stringify user"),{statsigEnvironment:void 0}}},t._getFullUserHash=function(e){return e?(0,i._DJB2Object)(e):null}},1633:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StableID=void 0;const i=n(210),r=n(3421),o=n(4845),s=n(8743),a=n(4952),l={},u={},d={};function c(e){return`statsig.stable_id.${(0,i._getStorageKey)(e)}`}function g(e,t){const n=c(t);try{(0,s._setObjectInStorage)(n,e)}catch(e){r.Log.warn("Failed to save StableID to storage")}}function _(e,t){if(!u[t]||!document)return;const n=new Date;n.setFullYear(n.getFullYear()+1),document.cookie=`${h(t)}=${encodeURIComponent(e)}; expires=${n.toUTCString()}; path=/`}function h(e){return`statsig.stable_id.${(0,i._getStorageKey)(e)}`}t.StableID={cookiesEnabled:!1,randomID:Math.random().toString(36),get:e=>{if(d[e])return null;if(null!=l[e])return l[e];let t=null;return t=function(e){if(!u[e]||null==(0,o._getDocumentSafe)())return null;const t=document.cookie.split(";");for(const n of t){const[t,i]=n.trim().split("=");if(t===h(e))return decodeURIComponent(i)}return null}(e),null!=t?(l[e]=t,g(t,e),t):(t=function(e){const t=c(e);return(0,s._getObjectFromStorage)(t)}(e),null==t&&(t=(0,a.getUUID)()),g(t,e),_(t,e),l[e]=t,t)},setOverride:(e,t)=>{l[t]=e,g(e,t),_(e,t)},_setCookiesEnabled:(e,t)=>{u[e]=t},_setDisabled:(e,t)=>{d[e]=t}}},1638:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._setObjectInStorage=t._getObjectFromStorage=t.Storage=void 0;const i=n(8024),r=n(414),o={},s={isReady:()=>!0,isReadyResolver:()=>null,getProviderName:()=>"InMemory",getItem:e=>o[e]?o[e]:null,setItem:(e,t)=>{o[e]=t},removeItem:e=>{delete o[e]},getAllKeys:()=>Object.keys(o)};let a=null;try{const e=(0,r._getWindowSafe)();e&&e.localStorage&&"function"==typeof e.localStorage.getItem&&(a={isReady:()=>!0,isReadyResolver:()=>null,getProviderName:()=>"LocalStorage",getItem:t=>e.localStorage.getItem(t),setItem:(t,n)=>e.localStorage.setItem(t,n),removeItem:t=>e.localStorage.removeItem(t),getAllKeys:()=>Object.keys(e.localStorage)})}catch(e){i.Log.warn("Failed to setup localStorageProvider.")}let l=null!=a?a:s,u=l;t.Storage={isReady:()=>u.isReady(),isReadyResolver:()=>u.isReadyResolver(),getProviderName:()=>u.getProviderName(),getItem:e=>function(){try{return u.getItem(e)}catch(e){if(e instanceof Error&&"SecurityError"===e.name)return t.Storage._setProvider(s),null;throw e}}(),setItem:(e,t)=>u.setItem(e,t),removeItem:e=>u.removeItem(e),getAllKeys:()=>u.getAllKeys(),_setProvider:e=>{l=e,u=e},_setDisabled:e=>{u=e?s:l}},t._getObjectFromStorage=function(e){const n=t.Storage.getItem(e);return JSON.parse(null!=n?n:"null")},t._setObjectInStorage=function(e,n){t.Storage.setItem(e,JSON.stringify(n))}},1719:function(e,t,n){var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),r=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.Storage=t.Log=t.EventLogger=t.Diagnostics=void 0,n(12);const o=n(12),s=n(4319);Object.defineProperty(t,"Diagnostics",{enumerable:!0,get:function(){return s.Diagnostics}});const a=n(3815);Object.defineProperty(t,"EventLogger",{enumerable:!0,get:function(){return a.EventLogger}});const l=n(25);Object.defineProperty(t,"Log",{enumerable:!0,get:function(){return l.Log}});const u=n(3285),d=n(4203);Object.defineProperty(t,"Storage",{enumerable:!0,get:function(){return d.Storage}}),r(n(12),t),r(n(7566),t),r(n(1848),t),r(n(7791),t),r(n(4319),t),r(n(5374),t),r(n(6599),t),r(n(3511),t),r(n(5804),t),r(n(27),t),r(n(3302),t),r(n(25),t),r(n(7134),t),r(n(3939),t),r(n(790),t),r(n(6488),t),r(n(7700),t),r(n(5737),t),r(n(4775),t),r(n(5678),t),r(n(5535),t),r(n(9069),t),r(n(7142),t),r(n(2617),t),r(n(3601),t),r(n(5094),t),r(n(3285),t),r(n(4549),t),r(n(3347),t),r(n(1272),t),r(n(5795),t),r(n(4683),t),r(n(4203),t),r(n(2566),t),r(n(5111),t),r(n(7234),t),r(n(2092),t),r(n(3508),t),r(n(3323),t),r(n(6296),t),Object.assign((0,o._getStatsigGlobal)(),{Log:l.Log,SDK_VERSION:u.SDK_VERSION})},1848:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},1952:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},2092:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getUUID=void 0,t.getUUID=function(){if("undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID)return crypto.randomUUID();let e=(new Date).getTime(),t="undefined"!=typeof performance&&performance.now&&1e3*performance.now()||0;return`xxxxxxxx-xxxx-4xxx-${"89ab"[Math.floor(4*Math.random())]}xxx-xxxxxxxxxxxx`.replace(/[xy]/g,n=>{let i=16*Math.random();return e>0?(i=(e+i)%16|0,e=Math.floor(e/16)):(i=(t+i)%16|0,t=Math.floor(t/16)),("x"===n?i:7&i|8).toString(16)})}},2166:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DataAdapterCachePrefix=void 0,t.DataAdapterCachePrefix="statsig.cached"},2403:function(e,t,n){var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))(function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t.ErrorBoundary=t.EXCEPTION_ENDPOINT=void 0;const r=n(3421),o=n(5515),s=n(8225);t.EXCEPTION_ENDPOINT="https://statsigapi.net/v1/sdk_exception";const a="[Statsig] UnknownError";function l(e){return e instanceof Error?e:"string"==typeof e?new Error(e):new Error("An unknown error occurred.")}function u(e){if(!e)return{};const t={};return Object.entries(e).forEach(([e,n])=>{switch(typeof n){case"number":case"bigint":case"boolean":t[String(e)]=n;break;case"string":n.length<50?t[String(e)]=n:t[String(e)]="set";break;case"object":"environment"===e?t.environment=n:"networkConfig"===e?t.networkConfig=n:t[String(e)]=null!=n?"set":"unset"}}),t}t.ErrorBoundary=class{constructor(e,t,n,i){this._sdkKey=e,this._options=t,this._emitter=n,this._lastSeenError=i,this._seen=new Set}wrap(e){try{const t=e;(function(e){const t=new Set;let n=Object.getPrototypeOf(e);for(;n&&n!==Object.prototype;)Object.getOwnPropertyNames(n).filter(e=>"function"==typeof(null==n?void 0:n[e])).forEach(e=>t.add(e)),n=Object.getPrototypeOf(n);return Array.from(t)})(t).forEach(n=>{const i=t[n];"$EB"in i||(t[n]=(...t)=>this._capture(n,()=>i.apply(e,t)),t[n].$EB=!0)})}catch(e){this._onError("eb:wrap",e)}}logError(e,t){this._onError(e,t)}getLastSeenErrorAndReset(){const e=this._lastSeenError;return this._lastSeenError=void 0,null!=e?e:null}attachErrorIfNoneExists(e){this._lastSeenError||(this._lastSeenError=l(e))}_capture(e,t){try{const n=t();return n&&n instanceof Promise?n.catch(t=>this._onError(e,t)):n}catch(t){return this._onError(e,t),null}}_onError(e,n){try{r.Log.warn(`Caught error in ${e}`,{error:n}),(()=>i(this,void 0,void 0,function*(){var i,r,d,c,g,_,h;const v=n||Error(a),f=v instanceof Error,p=f?v.name:"No Name",m=l(v);if(this._lastSeenError=m,this._seen.has(p))return;if(this._seen.add(p),null===(r=null===(i=this._options)||void 0===i?void 0:i.networkConfig)||void 0===r?void 0:r.preventAllNetworkTraffic)return void(null===(d=this._emitter)||void 0===d||d.call(this,{name:"error",error:n,tag:e}));const y=o.SDKType._get(this._sdkKey),b=s.StatsigMetadataProvider.get(),S=f?v.stack:function(e){try{return JSON.stringify(e)}catch(e){return a}}(v),E=Object.assign({tag:e,exception:p,info:S,statsigOptions:u(this._options)},Object.assign(Object.assign({},b),{sdkType:y})),k=null!==(_=null===(g=null===(c=this._options)||void 0===c?void 0:c.networkConfig)||void 0===g?void 0:g.networkOverrideFunc)&&void 0!==_?_:fetch;yield k(t.EXCEPTION_ENDPOINT,{method:"POST",headers:{"STATSIG-API-KEY":this._sdkKey,"STATSIG-SDK-TYPE":String(y),"STATSIG-SDK-VERSION":String(b.sdkVersion),"Content-Type":"application/json"},body:JSON.stringify(E)}),null===(h=this._emitter)||void 0===h||h.call(this,{name:"error",error:n,tag:e})}))().then(()=>{}).catch(()=>{})}catch(e){}}}},2451:function(e,t,n){var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))(function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t.StatsigEvaluationsDataAdapter=void 0;const r=n(7563),o=n(2944);class s extends r.DataAdapterCore{constructor(){super("EvaluationsDataAdapter","evaluations"),this._network=null,this._options=null}attach(e,t,n){super.attach(e,t,n),null!==n&&n instanceof o.default?this._network=n:this._network=new o.default(null!=t?t:{})}getDataAsync(e,t,n){return this._getDataAsyncImpl(e,(0,r._normalizeUser)(t,this._options),n)}prefetchData(e,t){return this._prefetchDataImpl(e,t)}setData(e){const t=(0,r._typedJsonParse)(e,"has_updates","data");t&&"user"in t?super.setData(e,t.user):r.Log.error("StatsigUser not found. You may be using an older server SDK version. Please upgrade your SDK or use setDataLegacy.")}setDataLegacy(e,t){super.setData(e,t)}_fetchFromNetwork(e,t,n,r){return i(this,void 0,void 0,function*(){var i;const o=yield null===(i=this._network)||void 0===i?void 0:i.fetchEvaluations(this._getSdkKey(),e,null==n?void 0:n.priority,t,r);return null!=o?o:null})}_getCacheKey(e){var t;const n=(0,r._getStorageKey)(this._getSdkKey(),e,null===(t=this._options)||void 0===t?void 0:t.customUserCacheKeyFunc);return`${r.DataAdapterCachePrefix}.${this._cacheSuffix}.${n}`}_isCachedResultValidFor204(e,t){return null!=e.fullUserHash&&e.fullUserHash===(0,r._getFullUserHash)(t)}}t.StatsigEvaluationsDataAdapter=s},2509:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},2566:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._typedJsonParse=void 0;const i=n(25);t._typedJsonParse=function(e,t,n){try{const n=JSON.parse(e);if(n&&"object"==typeof n&&t in n)return n}catch(e){}return i.Log.error(`Failed to parse ${n}`),null}},2610:(e,t)=>{var n;Object.defineProperty(t,"__esModule",{value:!0}),t.NetworkParam=t.NetworkDefault=void 0,t.NetworkDefault={eventsApi:"https://prodregistryv2.org/v1",initializeApi:"https://featureassets.org/v1",specsApi:"https://assetsconfigcdn.org/v1"},function(e){e.EventCount="ec",e.SdkKey="k",e.SdkType="st",e.SdkVersion="sv",e.Time="t",e.SessionID="sid",e.StatsigEncoded="se",e.IsGzipped="gz"}(n||(t.NetworkParam=n={}))},2617:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ErrorTag=void 0,t.ErrorTag={NetworkError:"NetworkError"}},2626:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StableID=void 0;const i=n(4681),r=n(8024),o=n(1638),s=n(7047),a={};function l(e){return`statsig.stable_id.${(0,i._getStorageKey)(e)}`}function u(e,t){const n=l(t);try{(0,o._setObjectInStorage)(n,e)}catch(e){r.Log.warn("Failed to save StableID")}}t.StableID={get:e=>{if(null==a[e]){let t=function(e){const t=l(e);return(0,o._getObjectFromStorage)(t)}(e);null==t&&(t=(0,s.getUUID)(),u(t,e)),a[e]=t}return a[e]},setOverride:(e,t)=>{a[t]=e,u(e,t)}}},2628:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},2701:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._notifyVisibilityChanged=t._subscribeToVisiblityChanged=t._isUnloading=t._isCurrentlyVisible=void 0;const i=n(414),r="foreground",o="background",s=[];let a=r,l=!1;t._isCurrentlyVisible=()=>a===r,t._isUnloading=()=>l,t._subscribeToVisiblityChanged=e=>{s.unshift(e)},t._notifyVisibilityChanged=e=>{e!==a&&(a=e,s.forEach(t=>t(e)))},(0,i._addWindowEventListenerSafe)("focus",()=>{l=!1,(0,t._notifyVisibilityChanged)(r)}),(0,i._addWindowEventListenerSafe)("blur",()=>(0,t._notifyVisibilityChanged)(o)),(0,i._addWindowEventListenerSafe)("beforeunload",()=>{l=!0,(0,t._notifyVisibilityChanged)(o)}),(0,i._addDocumentEventListenerSafe)("visibilitychange",()=>{(0,t._notifyVisibilityChanged)("visible"===document.visibilityState?r:o)})},2714:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StatsigSession=t.SessionID=void 0;const i=n(4400),r=n(210),o=n(3421),s=n(8743),a=n(4952),l=18e5,u=144e5,d={};function c(e,t){return setTimeout(()=>{var t;const n=null===(t=(0,i._getStatsigGlobal)())||void 0===t?void 0:t.instance(e);n&&n.$emt({name:"session_expired"})},t)}function g(e){return`statsig.session_id.${(0,r._getStorageKey)(e)}`}t.SessionID={get:e=>t.StatsigSession.get(e).data.sessionID},t.StatsigSession={get:e=>(null==d[e]&&(d[e]=function(e){let t=function(e){const t=g(e);return(0,s._getObjectFromStorage)(t)}(e);const n=Date.now();return t||(t={sessionID:(0,a.getUUID)(),startTime:n,lastUpdate:n}),{data:t,sdkKey:e}}(e)),function(e){const t=Date.now(),n=e.data,i=e.sdkKey;if(function({lastUpdate:e}){return Date.now()-e>l}(n)||function({startTime:e}){return Date.now()-e>u}(n)){n.sessionID=(0,a.getUUID)(),n.startTime=t;const e=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instance(i);e&&e.$emt({name:"session_expired"})}n.lastUpdate=t,function(e,t){const n=g(t);try{(0,s._setObjectInStorage)(n,e)}catch(e){o.Log.warn("Failed to save SessionID")}}(n,e.sdkKey),clearTimeout(e.idleTimeoutID),clearTimeout(e.ageTimeoutID);const r=t-n.startTime;return e.idleTimeoutID=c(i,l),e.ageTimeoutID=c(i,u-r),e}(d[e])),overrideInitialSessionID:(e,t)=>{d[t]=function(e,t){const n=Date.now();return{data:{sessionID:e,startTime:n,lastUpdate:n},sdkKey:t}}(e,t)}}},2931:function(e,t,n){var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))(function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t.EventLogger=void 0;const r=n(210),o=n(3735),s=n(3421),a=n(8871),l=n(4845),u=n(1130),d=n(6521),c=n(8743),g=n(1046),_=n(400),h={},v="startup",f="gained_focus";class p{static _safeFlushAndForget(e){var t;null===(t=h[e])||void 0===t||t.flush().catch(()=>{})}static _safeRetryFailedLogs(e){var t;null===(t=h[e])||void 0===t||t._retryFailedLogs(f)}constructor(e,t,n,i){var r,o;this._sdkKey=e,this._emitter=t,this._network=n,this._options=i,this._queue=[],this._lastExposureTimeMap={},this._nonExposedChecks={},this._hasRunQuickFlush=!1,this._creationTime=Date.now(),this._loggingEnabled=null!==(r=null==i?void 0:i.loggingEnabled)&&void 0!==r?r:!0===(null==i?void 0:i.disableLogging)?d.LoggingEnabledOption.disabled:d.LoggingEnabledOption.browserOnly,(null==i?void 0:i.loggingEnabled)&&void 0!==i.disableLogging&&s.Log.warn("Detected both loggingEnabled and disableLogging options. loggingEnabled takes precedence - please remove disableLogging."),this._maxQueueSize=null!==(o=null==i?void 0:i.loggingBufferMaxSize)&&void 0!==o?o:100;const l=null==i?void 0:i.networkConfig;this._logEventUrlConfig=new g.UrlConfiguration(a.Endpoint._rgstr,null==l?void 0:l.logEventUrl,null==l?void 0:l.api,null==l?void 0:l.logEventFallbackUrls)}setLogEventCompressionMode(e){this._network.setLogEventCompressionMode(e)}setLoggingEnabled(e){this._loggingEnabled=e}enqueue(e){this._shouldLogEvent(e)&&(this._normalizeAndAppendEvent(e),this._quickFlushIfNeeded(),this._queue.length>this._maxQueueSize&&p._safeFlushAndForget(this._sdkKey))}incrementNonExposureCount(e){var t;const n=null!==(t=this._nonExposedChecks[e])&&void 0!==t?t:0;this._nonExposedChecks[e]=n+1}reset(){this.flush().catch(()=>{}),this._lastExposureTimeMap={}}start(){var e;const t=(0,l._isServerEnv)();t&&"always"!==(null===(e=this._options)||void 0===e?void 0:e.loggingEnabled)||(h[this._sdkKey]=this,t||(0,_._subscribeToVisiblityChanged)(e=>{"background"===e?p._safeFlushAndForget(this._sdkKey):"foreground"===e&&p._safeRetryFailedLogs(this._sdkKey)}),this._retryFailedLogs(v),this._startBackgroundFlushInterval())}stop(){return i(this,void 0,void 0,function*(){this._flushIntervalId&&(clearInterval(this._flushIntervalId),this._flushIntervalId=null),delete h[this._sdkKey],yield this.flush()})}flush(){return i(this,void 0,void 0,function*(){if(this._appendAndResetNonExposedChecks(),0===this._queue.length)return;const e=this._queue;this._queue=[],yield this._sendEvents(e)})}_quickFlushIfNeeded(){this._hasRunQuickFlush||(this._hasRunQuickFlush=!0,Date.now()-this._creationTime>200||setTimeout(()=>p._safeFlushAndForget(this._sdkKey),200))}_shouldLogEvent(e){var t;if("always"!==(null===(t=this._options)||void 0===t?void 0:t.loggingEnabled)&&(0,l._isServerEnv)())return!1;if(!(0,u._isExposureEvent)(e))return!0;const n=e.user?e.user:{statsigEnvironment:void 0},i=(0,r._getUserStorageKey)(this._sdkKey,n),o=e.metadata?e.metadata:{},s=[e.eventName,i,o.gate,o.config,o.ruleID,o.allocatedExperiment,o.parameterName,String(o.isExplicitParameter),o.reason].join("|"),a=this._lastExposureTimeMap[s],d=Date.now();return!(a&&d-a<6e5||(Object.keys(this._lastExposureTimeMap).length>1e3&&(this._lastExposureTimeMap={}),this._lastExposureTimeMap[s]=d,0))}_sendEvents(e){return i(this,void 0,void 0,function*(){var t,n;if("disabled"===this._loggingEnabled)return this._saveFailedLogsToStorage(e),!1;try{const i=(0,_._isUnloading)()&&this._network.isBeaconSupported()&&null==(null===(n=null===(t=this._options)||void 0===t?void 0:t.networkConfig)||void 0===n?void 0:n.networkOverrideFunc);return this._emitter({name:"pre_logs_flushed",events:e}),(i?this._sendEventsViaBeacon(e):yield this._sendEventsViaPost(e)).success?(this._emitter({name:"logs_flushed",events:e}),!0):(s.Log.warn("Failed to flush events."),this._saveFailedLogsToStorage(e),!1)}catch(e){return s.Log.warn("Failed to flush events."),!1}})}_sendEventsViaPost(e){return i(this,void 0,void 0,function*(){var t;const n=yield this._network.post(this._getRequestData(e)),i=null!==(t=null==n?void 0:n.code)&&void 0!==t?t:-1;return{success:i>=200&&i<300}})}_sendEventsViaBeacon(e){return{success:this._network.beacon(this._getRequestData(e))}}_getRequestData(e){return{sdkKey:this._sdkKey,data:{events:e},urlConfig:this._logEventUrlConfig,retries:3,isCompressable:!0,params:{[a.NetworkParam.EventCount]:String(e.length)},credentials:"same-origin"}}_saveFailedLogsToStorage(e){for(;e.length>500;)e.shift();const t=this._getStorageKey();try{(0,c._setObjectInStorage)(t,e)}catch(e){s.Log.warn("Unable to save failed logs to storage")}}_retryFailedLogs(e){const t=this._getStorageKey();(()=>i(this,void 0,void 0,function*(){c.Storage.isReady()||(yield c.Storage.isReadyResolver());const n=(0,c._getObjectFromStorage)(t);n&&(e===v&&c.Storage.removeItem(t),(yield this._sendEvents(n))&&e===f&&c.Storage.removeItem(t))}))().catch(()=>{s.Log.warn("Failed to flush stored logs")})}_getStorageKey(){return`statsig.failed_logs.${(0,o._DJB2)(this._sdkKey)}`}_normalizeAndAppendEvent(e){e.user&&(e.user=Object.assign({},e.user),delete e.user.privateAttributes);const t={},n=this._getCurrentPageUrl();n&&(t.statsigMetadata={currentPage:n});const i=Object.assign(Object.assign({},e),t);s.Log.debug("Enqueued Event:",i),this._queue.push(i)}_appendAndResetNonExposedChecks(){0!==Object.keys(this._nonExposedChecks).length&&(this._normalizeAndAppendEvent({eventName:"statsig::non_exposed_checks",user:null,time:Date.now(),metadata:{checks:Object.assign({},this._nonExposedChecks)}}),this._nonExposedChecks={})}_getCurrentPageUrl(){var e;if(!1!==(null===(e=this._options)||void 0===e?void 0:e.includeCurrentPageUrlWithEvents))return(0,l._getCurrentPageUrlSafe)()}_startBackgroundFlushInterval(){var e,t;const n=null!==(t=null===(e=this._options)||void 0===e?void 0:e.loggingIntervalMs)&&void 0!==t?t:1e4,i=setInterval(()=>{const e=h[this._sdkKey];e&&e._flushIntervalId===i?p._safeFlushAndForget(this._sdkKey):clearInterval(i)},n);this._flushIntervalId=i}}t.EventLogger=p},2944:function(e,t,n){var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))(function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0});const r=n(7563),o=n(5694);class s extends r.NetworkCore{constructor(e,t){super(e,t);const n=null==e?void 0:e.networkConfig;this._option=e,this._initializeUrlConfig=new r.UrlConfiguration(r.Endpoint._initialize,null==n?void 0:n.initializeUrl,null==n?void 0:n.api,null==n?void 0:n.initializeFallbackUrls)}fetchEvaluations(e,t,n,o,s){return i(this,void 0,void 0,function*(){var i,a,l,u,d,c;const g=t?(0,r._typedJsonParse)(t,"has_updates","InitializeResponse"):null;let _={user:o,hash:null!==(l=null===(a=null===(i=this._option)||void 0===i?void 0:i.networkConfig)||void 0===a?void 0:a.initializeHashAlgorithm)&&void 0!==l?l:"djb2",deltasResponseRequested:!1,full_checksum:null};if(null==g?void 0:g.has_updates){const e=(null==g?void 0:g.hash_used)!==(null!==(c=null===(d=null===(u=this._option)||void 0===u?void 0:u.networkConfig)||void 0===d?void 0:d.initializeHashAlgorithm)&&void 0!==c?c:"djb2");_=Object.assign(Object.assign({},_),{sinceTime:s&&!e?g.time:0,previousDerivedFields:"derived_fields"in g&&s?g.derived_fields:{},deltasResponseRequested:!0,full_checksum:g.full_checksum,partialUserMatchSinceTime:e?0:g.time})}return this._fetchEvaluations(e,g,_,n)})}_fetchEvaluations(e,t,n,r){return i(this,void 0,void 0,function*(){var i,s;const a=yield this.post({sdkKey:e,urlConfig:this._initializeUrlConfig,data:n,retries:2,isStatsigEncodable:!0,priority:r});if(204===(null==a?void 0:a.code))return'{"has_updates": false}';if(200!==(null==a?void 0:a.code))return null!==(i=null==a?void 0:a.body)&&void 0!==i?i:null;if(!0!==(null==t?void 0:t.has_updates)||!0!==(null===(s=a.body)||void 0===s?void 0:s.includes('"is_delta":true'))||!0!==n.deltasResponseRequested)return a.body;const l=(0,o._resolveDeltasResponse)(t,a.body);return"string"==typeof l?l:this._fetchEvaluations(e,t,Object.assign(Object.assign(Object.assign({},n),l),{deltasResponseRequested:!1}),r)})}}t.default=s},3194:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},3285:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StatsigMetadataProvider=t.SDK_VERSION=void 0,t.SDK_VERSION="3.20.3";let n={sdkVersion:t.SDK_VERSION,sdkType:"js-mono"};t.StatsigMetadataProvider={get:()=>n,add:e=>{n=Object.assign(Object.assign({},n),e)}}},3302:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},3323:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UPDATE_DETAIL_ERROR_MESSAGES=t.createUpdateDetails=void 0,t.createUpdateDetails=(e,t,n,i,r,o)=>({duration:n,source:t,success:e,error:i,sourceUrl:r,warnings:o}),t.UPDATE_DETAIL_ERROR_MESSAGES={NO_NETWORK_DATA:"No data was returned from the network. This may be due to a network timeout if a timeout value was specified in the options or ad blocker error."}},3347:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},3421:(e,t)=>{function n(e){return e.unshift("[Statsig]"),e}Object.defineProperty(t,"__esModule",{value:!0}),t.Log=t.LogLevel=void 0,t.LogLevel={None:0,Error:1,Warn:2,Info:3,Debug:4};class i{static info(...e){i.level>=t.LogLevel.Info&&console.info(" INFO ",...n(e))}static debug(...e){i.level>=t.LogLevel.Debug&&console.debug(" DEBUG ",...n(e))}static warn(...e){i.level>=t.LogLevel.Warn&&console.warn(" WARN ",...n(e))}static error(...e){i.level>=t.LogLevel.Error&&console.error(" ERROR ",...n(e))}}t.Log=i,i.level=t.LogLevel.Warn},3508:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._notifyVisibilityChanged=t._subscribeToVisiblityChanged=t._isUnloading=t._isCurrentlyVisible=void 0;const i=n(5737),r="foreground",o="background",s=[];let a=r,l=!1;t._isCurrentlyVisible=()=>a===r,t._isUnloading=()=>l,t._subscribeToVisiblityChanged=e=>{s.unshift(e)},t._notifyVisibilityChanged=e=>{e!==a&&(a=e,s.forEach(t=>t(e)))},(0,i._addWindowEventListenerSafe)("focus",()=>{l=!1,(0,t._notifyVisibilityChanged)(r)}),(0,i._addWindowEventListenerSafe)("blur",()=>(0,t._notifyVisibilityChanged)(o)),(0,i._addDocumentEventListenerSafe)("visibilitychange",()=>{(0,t._notifyVisibilityChanged)("visible"===document.visibilityState?r:o)}),(0,i._addWindowEventListenerSafe)((0,i._getUnloadEvent)(),()=>{l=!0,(0,t._notifyVisibilityChanged)(o)})},3509:(e,t,n)=>{var i,r,o;Object.defineProperty(t,"__esModule",{value:!0}),t._getInstance=t._getStatsigGlobalFlag=t._getStatsigGlobal=void 0,t._getStatsigGlobal=()=>__STATSIG__||d,t._getStatsigGlobalFlag=e=>(0,t._getStatsigGlobal)()[e],t._getInstance=e=>{const n=(0,t._getStatsigGlobal)();return e?n.instances&&n.instances[e]:n.lastInstance};const s="__STATSIG__",a="undefined"!=typeof window?window:{},l=void 0!==n.g?n.g:{},u="undefined"!=typeof globalThis?globalThis:{},d=null!==(o=null!==(r=null!==(i=a[s])&&void 0!==i?i:l[s])&&void 0!==r?r:u[s])&&void 0!==o?o:{instance:t._getInstance};a[s]=d,l[s]=d,u[s]=d},3511:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},3515:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._fastApproxSizeOf=void 0,t._fastApproxSizeOf=(e,n)=>{let i=0;const r=Object.keys(e);for(let o=0;o<r.length;o++){const s=r[o],a=e[s];if(i+=s.length,i+="object"==typeof a&&null!==a?(0,t._fastApproxSizeOf)(a,n)+2:String(a).length+1,i>=n)return i}return i}},3601:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DataAdapterCachePrefix=void 0,t.DataAdapterCachePrefix="statsig.cached"},3705:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._typedJsonParse=void 0;const i=n(8024);t._typedJsonParse=function(e,t,n){try{return JSON.parse(e)}catch(e){}return i.Log.error(`Failed to parse ${n}`),null}},3735:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._getSortedObject=t._DJB2Object=t._DJB2=void 0;const i=n(4227);t._DJB2=e=>{let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t&=t;return String(t>>>0)},t._DJB2Object=(e,n)=>(0,t._DJB2)(JSON.stringify((0,t._getSortedObject)(e,n))),t._getSortedObject=(e,n)=>{if(null==e)return null;const r=Object.keys(e).sort(),o={};return r.forEach(r=>{const s=e[r];0!==n&&"object"===(0,i._typeOf)(s)?o[r]=(0,t._getSortedObject)(s,null!=n?n-1:n):o[r]=s}),o}},3815:function(e,t,n){var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))(function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t.EventLogger=void 0;const r=n(7566),o=n(27),s=n(25),a=n(3939),l=n(5737),u=n(5094),d=n(4549),c=n(4203),g=n(7234),_=n(3508),h={},v="startup",f="gained_focus";class p{static _safeFlushAndForget(e){var t;null===(t=h[e])||void 0===t||t.flush().catch(()=>{})}static _safeRetryFailedLogs(e){var t;null===(t=h[e])||void 0===t||t._retryFailedLogs(f)}constructor(e,t,n,i){var r,o;this._sdkKey=e,this._emitter=t,this._network=n,this._options=i,this._queue=[],this._lastExposureTimeMap={},this._nonExposedChecks={},this._hasRunQuickFlush=!1,this._creationTime=Date.now(),this._loggingEnabled=null!==(r=null==i?void 0:i.loggingEnabled)&&void 0!==r?r:!0===(null==i?void 0:i.disableLogging)?d.LoggingEnabledOption.disabled:d.LoggingEnabledOption.browserOnly,(null==i?void 0:i.loggingEnabled)&&void 0!==i.disableLogging&&s.Log.warn("Detected both loggingEnabled and disableLogging options. loggingEnabled takes precedence - please remove disableLogging."),this._maxQueueSize=null!==(o=null==i?void 0:i.loggingBufferMaxSize)&&void 0!==o?o:100;const l=null==i?void 0:i.networkConfig;this._logEventUrlConfig=new g.UrlConfiguration(a.Endpoint._rgstr,null==l?void 0:l.logEventUrl,null==l?void 0:l.api,null==l?void 0:l.logEventFallbackUrls)}setLogEventCompressionMode(e){this._network.setLogEventCompressionMode(e)}setLoggingEnabled(e){this._loggingEnabled=e}enqueue(e){this._shouldLogEvent(e)&&(this._normalizeAndAppendEvent(e),this._quickFlushIfNeeded(),this._queue.length>this._maxQueueSize&&p._safeFlushAndForget(this._sdkKey))}incrementNonExposureCount(e){var t;const n=null!==(t=this._nonExposedChecks[e])&&void 0!==t?t:0;this._nonExposedChecks[e]=n+1}reset(){this.flush().catch(()=>{}),this._lastExposureTimeMap={}}start(){var e;const t=(0,l._isServerEnv)();t&&"always"!==(null===(e=this._options)||void 0===e?void 0:e.loggingEnabled)||(h[this._sdkKey]=this,t||(0,_._subscribeToVisiblityChanged)(e=>{"background"===e?p._safeFlushAndForget(this._sdkKey):"foreground"===e&&p._safeRetryFailedLogs(this._sdkKey)}),this._retryFailedLogs(v),this._startBackgroundFlushInterval())}stop(){return i(this,void 0,void 0,function*(){this._flushIntervalId&&(clearInterval(this._flushIntervalId),this._flushIntervalId=null),delete h[this._sdkKey],yield this.flush()})}flush(){return i(this,void 0,void 0,function*(){if(this._appendAndResetNonExposedChecks(),0===this._queue.length)return;const e=this._queue;this._queue=[],yield this._sendEvents(e)})}_quickFlushIfNeeded(){this._hasRunQuickFlush||(this._hasRunQuickFlush=!0,Date.now()-this._creationTime>200||setTimeout(()=>p._safeFlushAndForget(this._sdkKey),200))}_shouldLogEvent(e){var t;if("always"!==(null===(t=this._options)||void 0===t?void 0:t.loggingEnabled)&&(0,l._isServerEnv)())return!1;if(!(0,u._isExposureEvent)(e))return!0;const n=e.user?e.user:{statsigEnvironment:void 0},i=(0,r._getUserStorageKey)(this._sdkKey,n),o=e.metadata?e.metadata:{},s=[e.eventName,i,o.gate,o.config,o.ruleID,o.allocatedExperiment,o.parameterName,String(o.isExplicitParameter),o.reason].join("|"),a=this._lastExposureTimeMap[s],d=Date.now();return!(a&&d-a<6e5||(Object.keys(this._lastExposureTimeMap).length>1e3&&(this._lastExposureTimeMap={}),this._lastExposureTimeMap[s]=d,0))}_sendEvents(e){return i(this,void 0,void 0,function*(){var t,n;if("disabled"===this._loggingEnabled)return this._saveFailedLogsToStorage(e),!1;try{const i=(0,_._isUnloading)()&&this._network.isBeaconSupported()&&null==(null===(n=null===(t=this._options)||void 0===t?void 0:t.networkConfig)||void 0===n?void 0:n.networkOverrideFunc);return this._emitter({name:"pre_logs_flushed",events:e}),(i?this._sendEventsViaBeacon(e):yield this._sendEventsViaPost(e)).success?(this._emitter({name:"logs_flushed",events:e}),!0):(s.Log.warn("Failed to flush events."),this._saveFailedLogsToStorage(e),!1)}catch(e){return s.Log.warn("Failed to flush events."),!1}})}_sendEventsViaPost(e){return i(this,void 0,void 0,function*(){var t;const n=yield this._network.post(this._getRequestData(e)),i=null!==(t=null==n?void 0:n.code)&&void 0!==t?t:-1;return{success:i>=200&&i<300}})}_sendEventsViaBeacon(e){return{success:this._network.beacon(this._getRequestData(e))}}_getRequestData(e){return{sdkKey:this._sdkKey,data:{events:e},urlConfig:this._logEventUrlConfig,retries:3,isCompressable:!0,params:{[a.NetworkParam.EventCount]:String(e.length)},credentials:"same-origin"}}_saveFailedLogsToStorage(e){for(;e.length>500;)e.shift();const t=this._getStorageKey();try{(0,c._setObjectInStorage)(t,e)}catch(e){s.Log.warn("Unable to save failed logs to storage")}}_retryFailedLogs(e){const t=this._getStorageKey();(()=>i(this,void 0,void 0,function*(){c.Storage.isReady()||(yield c.Storage.isReadyResolver());const n=(0,c._getObjectFromStorage)(t);n&&(e===v&&c.Storage.removeItem(t),(yield this._sendEvents(n))&&e===f&&c.Storage.removeItem(t))}))().catch(()=>{s.Log.warn("Failed to flush stored logs")})}_getStorageKey(){return`statsig.failed_logs.${(0,o._DJB2)(this._sdkKey)}`}_normalizeAndAppendEvent(e){e.user&&(e.user=Object.assign({},e.user),delete e.user.privateAttributes);const t={},n=this._getCurrentPageUrl();n&&(t.statsigMetadata={currentPage:n});const i=Object.assign(Object.assign({},e),t);s.Log.debug("Enqueued Event:",i),this._queue.push(i)}_appendAndResetNonExposedChecks(){0!==Object.keys(this._nonExposedChecks).length&&(this._normalizeAndAppendEvent({eventName:"statsig::non_exposed_checks",user:null,time:Date.now(),metadata:{checks:Object.assign({},this._nonExposedChecks)}}),this._nonExposedChecks={})}_getCurrentPageUrl(){var e;if(!1!==(null===(e=this._options)||void 0===e?void 0:e.includeCurrentPageUrlWithEvents))return(0,l._getCurrentPageUrlSafe)()}_startBackgroundFlushInterval(){var e,t;const n=null!==(t=null===(e=this._options)||void 0===e?void 0:e.loggingIntervalMs)&&void 0!==t?t:1e4,i=setInterval(()=>{const e=h[this._sdkKey];e&&e._flushIntervalId===i?p._safeFlushAndForget(this._sdkKey):clearInterval(i)},n);this._flushIntervalId=i}}t.EventLogger=p},3915:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},3918:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._getSortedObject=t._DJB2Object=t._DJB2=void 0;const i=n(10);t._DJB2=e=>{let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t&=t;return String(t>>>0)},t._DJB2Object=(e,n)=>(0,t._DJB2)(JSON.stringify((0,t._getSortedObject)(e,n))),t._getSortedObject=(e,n)=>{if(null==e)return null;const r=Object.keys(e).sort(),o={};return r.forEach(r=>{const s=e[r];0!==n&&"object"===(0,i._typeOf)(s)?o[r]=(0,t._getSortedObject)(s,null!=n?n-1:n):o[r]=s}),o}},3939:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.NetworkParam=t.NetworkDefault=t.Endpoint=void 0,t.Endpoint={_initialize:"initialize",_rgstr:"rgstr",_download_config_specs:"download_config_specs"},t.NetworkDefault={[t.Endpoint._rgstr]:"https://prodregistryv2.org/v1",[t.Endpoint._initialize]:"https://featureassets.org/v1",[t.Endpoint._download_config_specs]:"https://api.statsigcdn.com/v1"},t.NetworkParam={EventCount:"ec",SdkKey:"k",SdkType:"st",SdkVersion:"sv",Time:"t",SessionID:"sid",StatsigEncoded:"se",IsGzipped:"gz"}},4181:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._gatherPageViewPayload=void 0;const i=n(6978);t._gatherPageViewPayload=function(e){var t,n;const r=(0,i._getDocumentSafe)(),o=(0,i._getWindowSafe)();if(!r||!o)return{};const s=null==o?void 0:o.navigator,a=(null==r?void 0:r.referrer)||"";let l=new URL("empty:");if(a)try{l=new URL(a||"empty:")}catch(e){}const u=function(e){const t=function(e){const t=e.hostname;return["google","bing","yahoo","duckduckgo","baidu"].find(e=>t.includes(e+"."))||""}(e);return{searchEngine:t,searchQuery:e.searchParams.get("yahoo"===t?"p":"q")||""}}(l),d=function(e){const t=e.searchParams,n={};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(e=>{const i=t.get(e);i&&(n[e]=i)}),n}(e),c={};return e.searchParams.forEach((e,t)=>{c[t]=e}),Object.assign(Object.assign(Object.assign(Object.assign({},u),d),c),{title:(null==r?void 0:r.title)||"",locale:(null==s?void 0:s.language)||"unknown",hostname:e.hostname||"unknown",pathname:e.pathname||"unknown",referrer:a,screen_width:(null===(t=null==o?void 0:o.screen)||void 0===t?void 0:t.width)||"unknown",screen_height:(null===(n=null==o?void 0:o.screen)||void 0===n?void 0:n.height)||"unknown",viewport_width:(null==o?void 0:o.innerWidth)||"unknown",viewport_height:(null==o?void 0:o.innerHeight)||"unknown"})}},4203:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._setObjectInStorage=t._getObjectFromStorage=t.Storage=void 0;const i=n(25),r=n(5737),o={},s={isReady:()=>!0,isReadyResolver:()=>null,getProviderName:()=>"InMemory",getItem:e=>o[e]?o[e]:null,setItem:(e,t)=>{o[e]=t},removeItem:e=>{delete o[e]},getAllKeys:()=>Object.keys(o)};let a=null;try{const e=(0,r._getWindowSafe)();e&&e.localStorage&&"function"==typeof e.localStorage.getItem&&(a={isReady:()=>!0,isReadyResolver:()=>null,getProviderName:()=>"LocalStorage",getItem:t=>e.localStorage.getItem(t),setItem:(t,n)=>e.localStorage.setItem(t,n),removeItem:t=>e.localStorage.removeItem(t),getAllKeys:()=>Object.keys(e.localStorage)})}catch(e){i.Log.warn("Failed to setup localStorageProvider.")}let l=null!=a?a:s,u=l;function d(e){try{return e()}catch(e){if(e instanceof Error&&"SecurityError"===e.name)return t.Storage._setProvider(s),null;if(e instanceof Error&&"QuotaExceededError"===e.name){const n=t.Storage.getAllKeys().filter(e=>e.startsWith("statsig."));e.message=`${e.message}. Statsig Keys: ${n.length}`}throw e}}t.Storage={isReady:()=>u.isReady(),isReadyResolver:()=>u.isReadyResolver(),getProviderName:()=>u.getProviderName(),getItem:e=>d(()=>u.getItem(e)),setItem:(e,t)=>d(()=>u.setItem(e,t)),removeItem:e=>u.removeItem(e),getAllKeys:()=>u.getAllKeys(),_setProvider:e=>{l=e,u=e},_setDisabled:e=>{u=e?s:l}},t._getObjectFromStorage=function(e){const n=t.Storage.getItem(e);return JSON.parse(null!=n?n:"null")},t._setObjectInStorage=function(e,n){t.Storage.setItem(e,JSON.stringify(n))}},4227:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._isTypeMatch=t._typeOf=void 0,t._typeOf=function(e){return Array.isArray(e)?"array":typeof e},t._isTypeMatch=function(e,t){const n=e=>Array.isArray(e)?"array":null===e?"null":typeof e;return n(e)===n(t)}},4319:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Diagnostics=void 0;const n=new Map,i="start",r="end";function o(e,t,n,i){return Object.assign({key:n,action:t,step:i,timestamp:Date.now()},e)}function s(e,t){var i;const r=null!==(i=n.get(e))&&void 0!==i?i:[];r.push(t),n.set(e,r)}function a(e,t){if(t in e)return e[t]}t.Diagnostics={_getMarkers:e=>n.get(e),_markInitOverallStart:e=>{s(e,o({},i,"overall"))},_markInitOverallEnd:(e,t,n)=>{s(e,o({success:t,error:t?void 0:{name:"InitializeError",message:"Failed to initialize"},evaluationDetails:n},r,"overall"))},_markInitNetworkReqStart:(e,t)=>{s(e,o(t,i,"initialize","network_request"))},_markInitNetworkReqEnd:(e,t)=>{s(e,o(t,r,"initialize","network_request"))},_markInitProcessStart:e=>{s(e,o({},i,"initialize","process"))},_markInitProcessEnd:(e,t)=>{s(e,o(t,r,"initialize","process"))},_clearMarkers:e=>{n.delete(e)},_formatError(e){if(e&&"object"==typeof e)return{code:a(e,"code"),name:a(e,"name"),message:a(e,"message")}},_getDiagnosticsData(e,n,i,r){var o;return{success:!0===(null==e?void 0:e.ok),statusCode:null==e?void 0:e.status,sdkRegion:null===(o=null==e?void 0:e.headers)||void 0===o?void 0:o.get("x-statsig-region"),isDelta:!0===i.includes('"is_delta":true')||void 0,attempt:n,error:t.Diagnostics._formatError(r)}},_enqueueDiagnosticsEvent(e,n,i,r){const o=t.Diagnostics._getMarkers(i);if(null==o||o.length<=0)return-1;const s=o[o.length-1].timestamp-o[0].timestamp;t.Diagnostics._clearMarkers(i);const a=function(e,t){return{eventName:"statsig::diagnostics",user:e,value:null,metadata:t,time:Date.now()}}(e,{context:"initialize",markers:o.slice(),statsigOptions:r});return n.enqueue(a),s}}},4351:function(e,t,n){var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))(function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t.StatsigClientBase=void 0,n(3509);const r=n(3509),o=n(4358),s=n(5434),a=n(8024),l=n(414),u=n(9839),d=n(1638);t.StatsigClientBase=class{constructor(e,t,n,i){var c,g;this.loadingStatus="Uninitialized",this._listeners={};const _=this.$emt.bind(this);if(null!=(null==i?void 0:i.logLevel)&&(a.Log.level=i.logLevel),(null==i?void 0:i.disableStorage)&&d.Storage._setDisabled(!0),(null==i?void 0:i.initialSessionID)&&u.StatsigSession.overrideInitialSessionID(i.initialSessionID,e),(null==i?void 0:i.storageProvider)&&d.Storage._setProvider(i.storageProvider),this._sdkKey=e,this._options=null!=i?i:{},this.overrideAdapter=null!==(c=null==i?void 0:i.overrideAdapter)&&void 0!==c?c:null,this._logger=new s.EventLogger(e,_,n,i),this._errorBoundary=new o.ErrorBoundary(e,i,_),this._errorBoundary.wrap(this),this._errorBoundary.wrap(n),this._errorBoundary.wrap(t),this._errorBoundary.wrap(this._logger),!(0,l._isServerEnv)()){const t=(0,r._getStatsigGlobal)(),n=null!==(g=t.instances)&&void 0!==g?g:{},i=this;null!=n[e]&&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[e]=i,t.lastInstance=i,t.instances=n,__STATSIG__=t}this.dataAdapter=t,this.dataAdapter.attach(e,i),this.storageProvider=d.Storage,this._primeReadyRipcord()}updateRuntimeOptions(e){null!=e.disableLogging&&(this._options.disableLogging=e.disableLogging,this._logger.setLoggingDisabled(e.disableLogging)),null!=e.disableStorage&&(this._options.disableStorage=e.disableStorage,d.Storage._setDisabled(e.disableStorage))}flush(){return this._logger.flush()}shutdown(){return i(this,void 0,void 0,function*(){this.$emt({name:"pre_shutdown"}),yield this._logger.stop()})}on(e,t){this._listeners[e]||(this._listeners[e]=[]),this._listeners[e].push(t)}off(e,t){if(this._listeners[e]){const n=this._listeners[e].indexOf(t);-1!==n&&this._listeners[e].splice(n,1)}}$on(e,t){t.__isInternal=!0,this.on(e,t)}$emt(e){var t;const n=t=>{try{t(e)}catch(n){if(!0===t.__isInternal)return void this._errorBoundary.logError(`__emit:${e.name}`,n);a.Log.error("An error occurred in a StatsigClientEvent listener. This is not an issue with Statsig.",e)}};this._listeners[e.name]&&this._listeners[e.name].forEach(e=>n(e)),null===(t=this._listeners["*"])||void 0===t||t.forEach(n)}_setStatus(e,t){this.loadingStatus=e,this.$emt({name:"values_updated",status:e,values:t})}_enqueueExposure(e,t,n){!0!==(null==n?void 0:n.disableExposureLog)?this._logger.enqueue(t):this._logger.incrementNonExposureCount(e)}}},4358:function(e,t,n){var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))(function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t.ErrorBoundary=t.EXCEPTION_ENDPOINT=void 0;const r=n(8024),o=n(686),s=n(6512);t.EXCEPTION_ENDPOINT="https://statsigapi.net/v1/sdk_exception";const a="[Statsig] UnknownError";t.ErrorBoundary=class{constructor(e,t,n){this._sdkKey=e,this._options=t,this._emitter=n,this._seen=new Set}wrap(e){try{const t=e;(function(e){const t=new Set;let n=Object.getPrototypeOf(e);for(;n&&n!==Object.prototype;)Object.getOwnPropertyNames(n).filter(e=>"function"==typeof(null==n?void 0:n[e])).forEach(e=>t.add(e)),n=Object.getPrototypeOf(n);return Array.from(t)})(t).forEach(n=>{const i=t[n];"$EB"in i||(t[n]=(...t)=>this._capture(n,()=>i.apply(e,t)),t[n].$EB=!0)})}catch(e){this._onError("eb:wrap",e)}}logError(e,t){this._onError(e,t)}_capture(e,t){try{const n=t();return n&&n instanceof Promise?n.catch(t=>this._onError(e,t)):n}catch(t){return this._onError(e,t),null}}_onError(e,n){try{r.Log.warn(`Caught error in ${e}`,{error:n}),(()=>i(this,void 0,void 0,function*(){var i,r,l,u,d,c,g;const _=n||Error(a),h=_ instanceof Error,v=h?_.name:"No Name";if(this._seen.has(v))return;if(this._seen.add(v),null===(r=null===(i=this._options)||void 0===i?void 0:i.networkConfig)||void 0===r?void 0:r.preventAllNetworkTraffic)return void(null===(l=this._emitter)||void 0===l||l.call(this,{name:"error",error:n}));const f=o.SDKType._get(this._sdkKey),p=s.StatsigMetadataProvider.get(),m=h?_.stack:function(e){try{return JSON.stringify(e)}catch(e){return a}}(_),y=JSON.stringify(Object.assign({tag:e,exception:v,info:m},Object.assign(Object.assign({},p),{sdkType:f}))),b=null!==(c=null===(d=null===(u=this._options)||void 0===u?void 0:u.networkConfig)||void 0===d?void 0:d.networkOverrideFunc)&&void 0!==c?c:fetch;yield b(t.EXCEPTION_ENDPOINT,{method:"POST",headers:{"STATSIG-API-KEY":this._sdkKey,"STATSIG-SDK-TYPE":String(f),"STATSIG-SDK-VERSION":String(p.sdkVersion),"Content-Type":"application/json"},body:y}),null===(g=this._emitter)||void 0===g||g.call(this,{name:"error",error:n})}))().then(()=>{}).catch(()=>{})}catch(e){}}}},4387:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},4400:(e,t,n)=>{var i,r,o;Object.defineProperty(t,"__esModule",{value:!0}),t._getInstance=t._getStatsigGlobalFlag=t._getStatsigGlobal=void 0;const s=n(3421);t._getStatsigGlobal=()=>{try{return"undefined"!=typeof __STATSIG__?__STATSIG__:c}catch(e){return c}},t._getStatsigGlobalFlag=e=>(0,t._getStatsigGlobal)()[e],t._getInstance=e=>{const n=(0,t._getStatsigGlobal)();return e?n.instances&&n.instances[e]:(n.instances&&Object.keys(n.instances).length>1&&s.Log.warn("Call made to Statsig global instance without an SDK key but there is more than one client instance. If you are using mulitple clients, please specify the SDK key."),n.firstInstance)};const a="__STATSIG__",l="undefined"!=typeof window?window:{},u=void 0!==n.g?n.g:{},d="undefined"!=typeof globalThis?globalThis:{},c=null!==(o=null!==(r=null!==(i=l[a])&&void 0!==i?i:u[a])&&void 0!==r?r:d[a])&&void 0!==o?o:{instance:t._getInstance};l[a]=c,u[a]=c,d[a]=c},4420:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},4436:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._makeTypedGet=t._mergeOverride=t._makeLayer=t._makeExperiment=t._makeDynamicConfig=t._makeFeatureGate=void 0;const i=n(3421),r=n(4227);function o(e,t,n,i){var r;return{name:e,details:t,ruleID:null!==(r=null==n?void 0:n.rule_id)&&void 0!==r?r:"",__evaluation:n,value:i}}function s(e,t,n){var i;const r=null!==(i=null==n?void 0:n.value)&&void 0!==i?i:{};return Object.assign(Object.assign({},o(e,t,n,r)),{get:a(e,null==n?void 0:n.value)})}function a(e,t,n){return(o,s)=>{var a;const l=null!==(a=null==t?void 0:t[o])&&void 0!==a?a:null;return null==l?null!=s?s:null:null==s||(0,r._isTypeMatch)(l,s)?(null==n||n(o),l):(i.Log.warn(`Parameter type mismatch. '${e}.${o}' was found to be type '${typeof l}' but fallback/return type is '${typeof s}'. See https://docs.statsig.com/client/javascript-sdk/#typed-getters`),null!=s?s:null)}}t._makeFeatureGate=function(e,t,n){var i;return Object.assign(Object.assign({},o(e,t,n,!0===(null==n?void 0:n.value))),{idType:null!==(i=null==n?void 0:n.id_type)&&void 0!==i?i:null})},t._makeDynamicConfig=s,t._makeExperiment=function(e,t,n){var i;const r=s(e,t,n);return Object.assign(Object.assign({},r),{groupName:null!==(i=null==n?void 0:n.group_name)&&void 0!==i?i:null})},t._makeLayer=function(e,t,n,i){var r,s;return Object.assign(Object.assign({},o(e,t,n,void 0)),{get:a(e,null==n?void 0:n.value,i),groupName:null!==(r=null==n?void 0:n.group_name)&&void 0!==r?r:null,__value:null!==(s=null==n?void 0:n.value)&&void 0!==s?s:{}})},t._mergeOverride=function(e,t,n,i){return Object.assign(Object.assign(Object.assign({},e),t),{get:a(e.name,n,i)})},t._makeTypedGet=a},4549:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LoggingEnabledOption=t.LogEventCompressionMode=void 0,t.LogEventCompressionMode={Disabled:"d",Enabled:"e",Forced:"f"},t.LoggingEnabledOption={disabled:"disabled",browserOnly:"browser-only",always:"always"}},4681:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._getStorageKey=t._getUserStorageKey=void 0;const i=n(3918);function r(e,t,n){var r;if(n)return n(e,t);const o=t&&t.customIDs?t.customIDs:{},s=[`uid:${null!==(r=null==t?void 0:t.userID)&&void 0!==r?r:""}`,`cids:${Object.keys(o).sort((e,t)=>e.localeCompare(t)).map(e=>`${e}-${o[e]}`).join(",")}`,`k:${e}`];return(0,i._DJB2)(s.join("|"))}t._getUserStorageKey=r,t._getStorageKey=function(e,t,n){return t?r(e,t,n):(0,i._DJB2)(`k:${e}`)}},4683:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._getFullUserHash=t._normalizeUser=void 0;const i=n(27),r=n(25);t._normalizeUser=function(e,t,n){try{const i=JSON.parse(JSON.stringify(e));return null!=t&&null!=t.environment?i.statsigEnvironment=t.environment:null!=n&&(i.statsigEnvironment={tier:n}),i}catch(e){return r.Log.error("Failed to JSON.stringify user"),{statsigEnvironment:void 0}}},t._getFullUserHash=function(e){return e?(0,i._DJB2Object)(e):null}},4703:function(e,t,n){var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))(function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t.NetworkCore=void 0,n(3509);const r=n(3509),o=n(882),s=n(8024),a=n(2610),l=n(686),u=n(414),d=n(9839),c=n(2626),g=n(6512),_=n(2701),h=new Set([408,500,502,503,504,522,524,599]);t.NetworkCore=class{constructor(e,t){this._emitter=t,this._timeout=1e4,this._netConfig={},this._options={},e&&(this._options=e),this._options.networkConfig&&(this._netConfig=this._options.networkConfig),this._netConfig.networkTimeoutMs&&(this._timeout=this._netConfig.networkTimeoutMs)}post(e){return i(this,void 0,void 0,function*(){let t=yield this._getPopulatedBody(e);return e.isStatsigEncodable&&(t=this._attemptToEncodeString(e,t)),this._sendRequest(Object.assign({method:"POST",body:t},e))})}get(e){return this._sendRequest(Object.assign({method:"GET"},e))}isBeaconSupported(){return"undefined"!=typeof navigator&&"function"==typeof navigator.sendBeacon}beacon(e){return i(this,void 0,void 0,function*(){if(!v(e))return!1;const t=yield this._getPopulatedBody(e),n=yield this._getPopulatedURL(e),i=navigator;return i.sendBeacon.bind(i)(n,t)})}_sendRequest(e){var t,n,r;return i(this,void 0,void 0,function*(){if(!v(e))return null;if(this._netConfig.preventAllNetworkTraffic)return null;const{method:i,body:a,retries:l,attempt:u}=e,d=null!=u?u:1,c="undefined"!=typeof AbortController?new AbortController:null,g=setTimeout(()=>null==c?void 0:c.abort(`Timeout of ${this._timeout}ms expired.`),this._timeout),f=yield this._getPopulatedURL(e);let p=null;const m=(0,_._isUnloading)();try{const n={method:i,body:a,headers:Object.assign({},e.headers),signal:null==c?void 0:c.signal,priority:e.priority,keepalive:m};e.isInitialize&&o.Diagnostics._markInitNetworkReqStart(e.sdkKey,{attempt:d});const r=null!==(t=this._netConfig.networkOverrideFunc)&&void 0!==t?t:fetch;if(p=yield r(f,n),clearTimeout(g),!p.ok){const e=yield p.text().catch(()=>"No Text"),t=new Error(`NetworkError: ${f} ${e}`);throw t.name="NetworkError",t}const s=yield p.text();return e.isInitialize&&o.Diagnostics._markInitNetworkReqEnd(e.sdkKey,o.Diagnostics._getDiagnosticsData(p,d,s)),{body:s,code:p.status}}catch(t){const a=function(e,t){return(null==e?void 0:e.signal.aborted)&&"string"==typeof e.signal.reason?e.signal.reason:"string"==typeof t?t:t instanceof Error?`${t.name}: ${t.message}`:"Unknown Error"}(c,t);return e.isInitialize&&o.Diagnostics._markInitNetworkReqEnd(e.sdkKey,o.Diagnostics._getDiagnosticsData(p,d,"",t)),!l||d>l||!h.has(null!==(n=null==p?void 0:p.status)&&void 0!==n?n:500)?(null===(r=this._emitter)||void 0===r||r.call(this,{name:"error",error:t}),s.Log.error(`A networking error occured during ${i} request to ${f}.`,a,t),null):this._sendRequest(Object.assign(Object.assign({},e),{retries:l,attempt:d+1}))}})}_getPopulatedURL(e){return i(this,void 0,void 0,function*(){const t=Object.assign({[a.NetworkParam.SdkKey]:e.sdkKey,[a.NetworkParam.SdkType]:l.SDKType._get(e.sdkKey),[a.NetworkParam.SdkVersion]:g.SDK_VERSION,[a.NetworkParam.Time]:String(Date.now()),[a.NetworkParam.SessionID]:yield d.SessionID.get(e.sdkKey)},e.params),n=Object.keys(t).map(e=>`${encodeURIComponent(e)}=${encodeURIComponent(t[e])}`).join("&");return`${e.url}${n?`?${n}`:""}`})}_getPopulatedBody(e){return i(this,void 0,void 0,function*(){const{data:t,sdkKey:n}=e,i=c.StableID.get(n),r=d.SessionID.get(n),o=l.SDKType._get(n);return JSON.stringify(Object.assign(Object.assign({},t),{statsigMetadata:Object.assign(Object.assign({},g.StatsigMetadataProvider.get()),{stableID:i,sessionID:r,sdkType:o})}))})}_attemptToEncodeString(e,t){var n,i;const o=(0,u._getWindowSafe)();if(!e.isStatsigEncodable||this._options.disableStatsigEncoding||null!=(0,r._getStatsigGlobalFlag)("no-encode")||!(null==o?void 0:o.btoa))return t;try{const r=null!==(n=o.btoa(t).split("").reverse().join(""))&&void 0!==n?n:t;return e.params=Object.assign(Object.assign({},null!==(i=e.params)&&void 0!==i?i:{}),{[a.NetworkParam.StatsigEncoded]:"1"}),r}catch(e){return s.Log.warn("/initialize request encoding failed"),t}}};const v=e=>!!e.sdkKey||(s.Log.warn("Unable to make request without an SDK key"),!1)},4775:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SDKType=void 0;const n={};let i;t.SDKType={_get:e=>{var t;return(null!==(t=n[e])&&void 0!==t?t:"js-mono")+(null!=i?i:"")},_setClientType(e,t){n[e]=t},_setBindingType(e){i&&"-react"!==i||(i="-"+e)}}},4845:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._getUnloadEvent=t._getCurrentPageUrlSafe=t._addDocumentEventListenerSafe=t._addWindowEventListenerSafe=t._isServerEnv=t._getDocumentSafe=t._getWindowSafe=void 0,t._getWindowSafe=()=>"undefined"!=typeof window?window:null,t._getDocumentSafe=()=>{var e;const n=(0,t._getWindowSafe)();return null!==(e=null==n?void 0:n.document)&&void 0!==e?e:null},t._isServerEnv=()=>{if(null!==(0,t._getDocumentSafe)())return!1;const e="undefined"!=typeof process&&null!=process.versions&&null!=process.versions.node;return"string"==typeof EdgeRuntime||e},t._addWindowEventListenerSafe=(e,n)=>{const i=(0,t._getWindowSafe)();"function"==typeof(null==i?void 0:i.addEventListener)&&i.addEventListener(e,n)},t._addDocumentEventListenerSafe=(e,n)=>{const i=(0,t._getDocumentSafe)();"function"==typeof(null==i?void 0:i.addEventListener)&&i.addEventListener(e,n)},t._getCurrentPageUrlSafe=()=>{var e;try{return null===(e=(0,t._getWindowSafe)())||void 0===e?void 0:e.location.href.split(/[?#]/)[0]}catch(e){return}},t._getUnloadEvent=()=>{const e=(0,t._getWindowSafe)();return e&&"onpagehide"in e?"pagehide":"beforeunload"}},4952:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getUUID=void 0,t.getUUID=function(){if("undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID)return crypto.randomUUID();let e=(new Date).getTime(),t="undefined"!=typeof performance&&performance.now&&1e3*performance.now()||0;return`xxxxxxxx-xxxx-4xxx-${"89ab"[Math.floor(4*Math.random())]}xxx-xxxxxxxxxxxx`.replace(/[xy]/g,n=>{let i=16*Math.random();return e>0?(i=(e+i)%16|0,e=Math.floor(e/16)):(i=(t+i)%16|0,t=Math.floor(t/16)),("x"===n?i:7&i|8).toString(16)})}},5025:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},5094:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._createLayerParameterExposure=t._createConfigExposure=t._mapExposures=t._createGateExposure=t._isExposureEvent=void 0;const n="statsig::config_exposure",i="statsig::gate_exposure",r="statsig::layer_exposure",o=(e,t,n,i,r)=>(n.bootstrapMetadata&&(i.bootstrapMetadata=n.bootstrapMetadata),{eventName:e,user:t,value:null,metadata:a(n,i),secondaryExposures:r,time:Date.now()});function s(e,t){return e.map(e=>"string"==typeof e?(null!=t?t:{})[e]:e).filter(e=>null!=e)}t._isExposureEvent=({eventName:e})=>e===i||e===n||e===r,t._createGateExposure=(e,t,n)=>{var r,a,l;const u={gate:t.name,gateValue:String(t.value),ruleID:t.ruleID};return null!=(null===(r=t.__evaluation)||void 0===r?void 0:r.version)&&(u.configVersion=t.__evaluation.version),o(i,e,t.details,u,s(null!==(l=null===(a=t.__evaluation)||void 0===a?void 0:a.secondary_exposures)&&void 0!==l?l:[],n))},t._mapExposures=s,t._createConfigExposure=(e,t,i)=>{var r,a,l,u;const d={config:t.name,ruleID:t.ruleID};return null!=(null===(r=t.__evaluation)||void 0===r?void 0:r.version)&&(d.configVersion=t.__evaluation.version),null!=(null===(a=t.__evaluation)||void 0===a?void 0:a.passed)&&(d.rulePassed=String(t.__evaluation.passed)),o(n,e,t.details,d,s(null!==(u=null===(l=t.__evaluation)||void 0===l?void 0:l.secondary_exposures)&&void 0!==u?u:[],i))},t._createLayerParameterExposure=(e,t,n,i)=>{var a,l,u,d,c,g,_;const h=t.__evaluation,v=!0===(null===(a=null==h?void 0:h.explicit_parameters)||void 0===a?void 0:a.includes(n));let f="",p=null!==(l=null==h?void 0:h.undelegated_secondary_exposures)&&void 0!==l?l:[];v&&(f=null!==(u=h.allocated_experiment_name)&&void 0!==u?u:"",p=null!==(d=h.secondary_exposures)&&void 0!==d?d:[]);const m=null===(c=t.__evaluation)||void 0===c?void 0:c.parameter_rule_ids,y={config:t.name,parameterName:n,ruleID:null!==(g=null==m?void 0:m[n])&&void 0!==g?g:t.ruleID,allocatedExperiment:f,isExplicitParameter:String(v)};return null!=(null===(_=t.__evaluation)||void 0===_?void 0:_.version)&&(y.configVersion=t.__evaluation.version),o(r,e,t.details,y,s(p,i))};const a=(e,t)=>(t.reason=e.reason,e.lcut&&(t.lcut=String(e.lcut)),e.receivedAt&&(t.receivedAt=String(e.receivedAt)),t)},5111:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._isTypeMatch=t._typeOf=void 0,t._typeOf=function(e){return Array.isArray(e)?"array":typeof e},t._isTypeMatch=function(e,t){const n=e=>Array.isArray(e)?"array":null===e?"null":typeof e;return n(e)===n(t)}},5138:function(e,t,n){var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),r=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.StatsigClient=void 0;const o=n(7563),s=n(7686);t.StatsigClient=s.default,r(n(7563),t);const a=Object.assign((0,o._getStatsigGlobal)(),{StatsigClient:s.default});t.default=a},5374:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},5434:function(e,t,n){var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))(function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t.EventLogger=void 0;const r=n(4681),o=n(3918),s=n(8024),a=n(2610),l=n(414),u=n(7253),d=n(1638),c=n(6678),g=n(2701),_={},h=e=>{var t;null===(t=_[e])||void 0===t||t.flush().catch(()=>{})};t.EventLogger=class{constructor(e,t,n,i){var r;this._sdkKey=e,this._emitter=t,this._network=n,this._options=i,this._queue=[],this._lastExposureTimeMap={},this._nonExposedChecks={},this._hasRunQuickFlush=!1,this._creationTime=Date.now(),this._isLoggingDisabled=!0===(null==i?void 0:i.disableLogging),this._maxQueueSize=null!==(r=null==i?void 0:i.loggingBufferMaxSize)&&void 0!==r?r:50;const o=null==i?void 0:i.networkConfig;this._logEventUrl=(0,c._getOverridableUrl)(null==o?void 0:o.logEventUrl,null==o?void 0:o.api,"/rgstr",a.NetworkDefault.eventsApi)}setLoggingDisabled(e){this._isLoggingDisabled=e}enqueue(e){this._shouldLogEvent(e)&&(this._normalizeAndAppendEvent(e),this._quickFlushIfNeeded(),this._queue.length>this._maxQueueSize&&h(this._sdkKey))}incrementNonExposureCount(e){var t;const n=null!==(t=this._nonExposedChecks[e])&&void 0!==t?t:0;this._nonExposedChecks[e]=n+1}reset(){this._lastExposureTimeMap={}}start(){(0,l._isServerEnv)()||(_[this._sdkKey]=this,(0,g._subscribeToVisiblityChanged)(e=>{"background"===e&&h(this._sdkKey)}),this._retryFailedLogs(),this._startBackgroundFlushInterval())}stop(){return i(this,void 0,void 0,function*(){this._flushIntervalId&&(clearInterval(this._flushIntervalId),this._flushIntervalId=null),yield this.flush()})}flush(){return i(this,void 0,void 0,function*(){if(this._appendAndResetNonExposedChecks(),0===this._queue.length)return;const e=this._queue;return this._queue=[],this._sendEvents(e)})}_quickFlushIfNeeded(){this._hasRunQuickFlush||(this._hasRunQuickFlush=!0,Date.now()-this._creationTime>200||setTimeout(()=>h(this._sdkKey),200))}_shouldLogEvent(e){if((0,l._isServerEnv)())return!1;if(!(0,u._isExposureEvent)(e))return!0;const t=e.user?e.user:{statsigEnvironment:void 0},n=(0,r._getUserStorageKey)(this._sdkKey,t),i=e.metadata?e.metadata:{},o=[e.eventName,n,i.gate,i.config,i.ruleID].join("|"),s=this._lastExposureTimeMap[o],a=Date.now();return!(s&&a-s<6e4||(Object.keys(this._lastExposureTimeMap).length>1e3&&(this._lastExposureTimeMap={}),this._lastExposureTimeMap[o]=a,0))}_sendEvents(e){var t,n;return i(this,void 0,void 0,function*(){if(this._isLoggingDisabled)this._saveFailedLogsToStorage(e);else try{(!(0,g._isCurrentlyVisible)()&&this._network.isBeaconSupported()&&null==(null===(n=null===(t=this._options)||void 0===t?void 0:t.networkConfig)||void 0===n?void 0:n.networkOverrideFunc)?yield this._sendEventsViaBeacon(e):yield this._sendEventsViaPost(e)).success?this._emitter({name:"logs_flushed",events:e}):this._saveFailedLogsToStorage(e)}catch(e){s.Log.warn("Failed to flush events.")}})}_sendEventsViaPost(e){var t;return i(this,void 0,void 0,function*(){const n=yield this._network.post(this._getRequestData(e)),i=null!==(t=null==n?void 0:n.code)&&void 0!==t?t:-1;return{success:i>=200&&i<300}})}_sendEventsViaBeacon(e){return i(this,void 0,void 0,function*(){return{success:yield this._network.beacon(this._getRequestData(e))}})}_getRequestData(e){return{sdkKey:this._sdkKey,data:{events:e},url:this._logEventUrl,retries:3,isCompressable:!0,params:{[a.NetworkParam.EventCount]:String(e.length)}}}_saveFailedLogsToStorage(e){for(;e.length>500;)e.shift();const t=this._getStorageKey();try{(0,d._setObjectInStorage)(t,e)}catch(e){s.Log.warn("Unable to save failed logs to storage")}}_retryFailedLogs(){const e=this._getStorageKey();(()=>i(this,void 0,void 0,function*(){d.Storage.isReady()||(yield d.Storage.isReadyResolver());const t=(0,d._getObjectFromStorage)(e);t&&(d.Storage.removeItem(e),yield this._sendEvents(t))}))().catch(()=>{s.Log.warn("Failed to flush stored logs")})}_getStorageKey(){return`statsig.failed_logs.${(0,o._DJB2)(this._sdkKey)}`}_normalizeAndAppendEvent(e){e.user&&(e.user=Object.assign({},e.user),delete e.user.privateAttributes);const t={},n=this._getCurrentPageUrl();n&&(t.statsigMetadata={currentPage:n});const i=Object.assign(Object.assign({},e),t);s.Log.debug("Enqueued Event:",i),this._queue.push(i)}_appendAndResetNonExposedChecks(){0!==Object.keys(this._nonExposedChecks).length&&(this._normalizeAndAppendEvent({eventName:"statsig::non_exposed_checks",user:null,time:Date.now(),metadata:{checks:Object.assign({},this._nonExposedChecks)}}),this._nonExposedChecks={})}_getCurrentPageUrl(){var e;if(!1!==(null===(e=this._options)||void 0===e?void 0:e.includeCurrentPageUrlWithEvents))return(0,l._getCurrentPageUrlSafe)()}_startBackgroundFlushInterval(){var e,t;const n=null!==(t=null===(e=this._options)||void 0===e?void 0:e.loggingIntervalMs)&&void 0!==t?t:1e4,i=setInterval(()=>{_[this._sdkKey]._flushIntervalId!==i?clearInterval(i):h(this._sdkKey)},n);this._flushIntervalId=i}}},5515:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SDKType=void 0;const n={};let i;t.SDKType={_get:e=>{var t;return(null!==(t=n[e])&&void 0!==t?t:"js-mono")+(null!=i?i:"")},_setClientType(e,t){n[e]=t},_setBindingType(e){i&&"-react"!==i||(i="-"+e)}}},5516:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SDKFlags=void 0;const n={};t.SDKFlags={setFlags:(e,t)=>{n[e]=t},get:(e,t)=>{var i,r;return null!==(r=null===(i=n[e])||void 0===i?void 0:i[t])&&void 0!==r&&r}}},5535:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._fastApproxSizeOf=void 0,t._fastApproxSizeOf=(e,n)=>{let i=0;const r=Object.keys(e);for(let o=0;o<r.length;o++){const s=r[o],a=e[s];if(i+=s.length,i+="object"==typeof a&&null!==a?(0,t._fastApproxSizeOf)(a,n)+2:String(a).length+1,i>=n)return i}return i}},5638:function(e,t,n){var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))(function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t.DataAdapterCore=void 0;const r=n(8024),o=n(2626),s=n(1570),a=n(1638),l=n(3705);function u(e,t,n,i){return{source:e,data:t,receivedAt:Date.now(),stableID:n,fullUserHash:(0,s._getFullUserHash)(i)}}t.DataAdapterCore=class{constructor(e,t){this._adapterName=e,this._cacheSuffix=t,this._options=null,this._sdkKey=null,this._lastModifiedStoreKey=`statsig.last_modified_time.${t}`,this._inMemoryCache=new d}attach(e,t){this._sdkKey=e,this._options=t}getDataSync(e){const t=e&&(0,s._normalizeUser)(e,this._options),n=this._getCacheKey(t),i=this._inMemoryCache.get(n,t);if(i)return i;const r=this._loadFromCache(n);return r?(this._inMemoryCache.add(n,r),this._inMemoryCache.get(n,t)):null}setData(e,t){const n=t&&(0,s._normalizeUser)(t,this._options),i=this._getCacheKey(n);this._inMemoryCache.add(i,u("Bootstrap",e,null,n))}_getDataAsyncImpl(e,t,n){return i(this,void 0,void 0,function*(){a.Storage.isReady()||(yield a.Storage.isReadyResolver());const i=null!=e?e:this.getDataSync(t),o=[this._fetchAndPrepFromNetwork(i,t,n)];return(null==n?void 0:n.timeoutMs)&&o.push(new Promise(e=>setTimeout(e,n.timeoutMs)).then(()=>(r.Log.debug("Fetching latest value timed out"),null))),yield Promise.race(o)})}_prefetchDataImpl(e,t){return i(this,void 0,void 0,function*(){const n=e&&(0,s._normalizeUser)(e,this._options),i=this._getCacheKey(n),r=yield this._getDataAsyncImpl(null,n,t);r&&this._inMemoryCache.add(i,Object.assign(Object.assign({},r),{source:"Prefetch"}))})}_fetchAndPrepFromNetwork(e,t,n){return i(this,void 0,void 0,function*(){let i=null;e&&this._isCachedResultValidFor204(e,t)&&(i=e.data);const s=yield this._fetchFromNetwork(i,t,n);if(!s)return r.Log.debug("No response returned for latest value"),null;const a=(0,l._typedJsonParse)(s,"has_updates","Response"),d=this._getSdkKey(),c=o.StableID.get(d);let g=null;if(!0===(null==a?void 0:a.has_updates))g=u("Network",s,c,t);else{if(!i||!1!==(null==a?void 0:a.has_updates))return null;g=u("NetworkNotModified",i,c,t)}const _=this._getCacheKey(t);return this._inMemoryCache.add(_,g),this._writeToCache(_,g),g})}_getSdkKey(){return null!=this._sdkKey?this._sdkKey:(r.Log.error(`${this._adapterName} is not attached to a Client`),"")}_loadFromCache(e){var t;const n=null===(t=a.Storage.getItem)||void 0===t?void 0:t.call(a.Storage,e);if(null==n)return null;const i=(0,l._typedJsonParse)(n,"source","Cached Result");return i?Object.assign(Object.assign({},i),{source:"Cache"}):null}_writeToCache(e,t){a.Storage.setItem(e,JSON.stringify(t)),this._runLocalStorageCacheEviction(e)}_runLocalStorageCacheEviction(e){var t;const n=null!==(t=(0,a._getObjectFromStorage)(this._lastModifiedStoreKey))&&void 0!==t?t:{};n[e]=Date.now();const i=c(n,10);i&&(delete n[i],a.Storage.removeItem(i)),(0,a._setObjectInStorage)(this._lastModifiedStoreKey,n)}};class d{constructor(){this._data={}}get(e,t){var n;const i=this._data[e],o=null==i?void 0:i.stableID,s=null===(n=null==t?void 0:t.customIDs)||void 0===n?void 0:n.stableID;return s&&o&&s!==o?(r.Log.warn("'StatsigUser.customIDs.stableID' mismatch"),null):i}add(e,t){const n=c(this._data,9);n&&delete this._data[n],this._data[e]=t}merge(e){this._data=Object.assign(Object.assign({},this._data),e)}}function c(e,t){const n=Object.keys(e);return n.length<=t?null:n.reduce((t,n)=>{const i=e[t],r=e[n];return"object"==typeof i&&"object"==typeof r?r.receivedAt<i.receivedAt?n:t:r<i?n:t})}},5678:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StatsigSession=t.SessionID=void 0;const i=n(12),r=n(7566),o=n(25),s=n(4203),a=n(2092),l=18e5,u=144e5,d={};function c(e,t){return setTimeout(()=>{var t;const n=null===(t=(0,i._getStatsigGlobal)())||void 0===t?void 0:t.instance(e);n&&n.$emt({name:"session_expired"})},t)}function g(e){return`statsig.session_id.${(0,r._getStorageKey)(e)}`}t.SessionID={get:e=>t.StatsigSession.get(e).data.sessionID},t.StatsigSession={get:e=>(null==d[e]&&(d[e]=function(e){let t=function(e){const t=g(e);return(0,s._getObjectFromStorage)(t)}(e);const n=Date.now();return t||(t={sessionID:(0,a.getUUID)(),startTime:n,lastUpdate:n}),{data:t,sdkKey:e}}(e)),function(e){const t=Date.now(),n=e.data,i=e.sdkKey;if(function({lastUpdate:e}){return Date.now()-e>l}(n)||function({startTime:e}){return Date.now()-e>u}(n)){n.sessionID=(0,a.getUUID)(),n.startTime=t;const e=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instance(i);e&&e.$emt({name:"session_expired"})}n.lastUpdate=t,function(e,t){const n=g(t);try{(0,s._setObjectInStorage)(n,e)}catch(e){o.Log.warn("Failed to save SessionID")}}(n,e.sdkKey),clearTimeout(e.idleTimeoutID),clearTimeout(e.ageTimeoutID);const r=t-n.startTime;return e.idleTimeoutID=c(i,l),e.ageTimeoutID=c(i,u-r),e}(d[e])),overrideInitialSessionID:(e,t)=>{d[t]=function(e,t){const n=Date.now();return{data:{sessionID:e,startTime:n,lastUpdate:n},sdkKey:t}}(e,t)}}},5694:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._resolveDeltasResponse=void 0;const i=n(7563);function r(e,t){null==e||e.forEach(e=>{delete t[e]})}t._resolveDeltasResponse=function(e,t){const n=(0,i._typedJsonParse)(t,"checksum","DeltasEvaluationResponse");if(!n)return{hadBadDeltaChecksum:!0};const o=function(e){const t=e;return r(e.deleted_gates,t.feature_gates),delete t.deleted_gates,r(e.deleted_configs,t.dynamic_configs),delete t.deleted_configs,r(e.deleted_layers,t.layer_configs),delete t.deleted_layers,t}(function(e,t){return Object.assign(Object.assign(Object.assign({},e),t),{feature_gates:Object.assign(Object.assign({},e.feature_gates),t.feature_gates),layer_configs:Object.assign(Object.assign({},e.layer_configs),t.layer_configs),dynamic_configs:Object.assign(Object.assign({},e.dynamic_configs),t.dynamic_configs)})}(e,n)),s=(0,i._DJB2Object)({feature_gates:o.feature_gates,dynamic_configs:o.dynamic_configs,layer_configs:o.layer_configs},2);return s===n.checksumV2?JSON.stringify(o):{hadBadDeltaChecksum:!0,badChecksum:s,badMergedConfigs:o,badFullResponse:n.deltas_full_response}}},5737:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._getUnloadEvent=t._getCurrentPageUrlSafe=t._addDocumentEventListenerSafe=t._addWindowEventListenerSafe=t._isServerEnv=t._getDocumentSafe=t._getWindowSafe=void 0,t._getWindowSafe=()=>"undefined"!=typeof window?window:null,t._getDocumentSafe=()=>{var e;const n=(0,t._getWindowSafe)();return null!==(e=null==n?void 0:n.document)&&void 0!==e?e:null},t._isServerEnv=()=>{if(null!==(0,t._getDocumentSafe)())return!1;const e="undefined"!=typeof process&&null!=process.versions&&null!=process.versions.node;return"string"==typeof EdgeRuntime||e},t._addWindowEventListenerSafe=(e,n)=>{const i=(0,t._getWindowSafe)();"function"==typeof(null==i?void 0:i.addEventListener)&&i.addEventListener(e,n)},t._addDocumentEventListenerSafe=(e,n)=>{const i=(0,t._getDocumentSafe)();"function"==typeof(null==i?void 0:i.addEventListener)&&i.addEventListener(e,n)},t._getCurrentPageUrlSafe=()=>{var e;try{return null===(e=(0,t._getWindowSafe)())||void 0===e?void 0:e.location.href.split(/[?#]/)[0]}catch(e){return}},t._getUnloadEvent=()=>{const e=(0,t._getWindowSafe)();return e&&"onpagehide"in e?"pagehide":"beforeunload"}},5795:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},5804:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},5823:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._getFullUserHash=t._normalizeUser=void 0;const i=n(3735),r=n(3421);t._normalizeUser=function(e,t,n){try{const i=JSON.parse(JSON.stringify(e));return null!=t&&null!=t.environment?i.statsigEnvironment=t.environment:null!=n&&(i.statsigEnvironment={tier:n}),i}catch(e){return r.Log.error("Failed to JSON.stringify user"),{statsigEnvironment:void 0}}},t._getFullUserHash=function(e){return e?(0,i._DJB2Object)(e):null}},6181:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._getSafeNetworkInformation=t._registerEventHandler=t._getSanitizedPageUrl=t._getSafeUrl=t._shouldLogEvent=t._getTargetNode=t._gatherEventData=t._gatherDatasetProperties=void 0;const i=n(6978);function r(e){const t={};if(!e)return t;const n=null==e?void 0:e.dataset;if(!n)return t;for(const e in n)t[`data-${e}`]=n[e]||"";return t}function o(e){if(!e)return null;let t=e;for(;t;){const e=t.tagName.toLowerCase();if(["body","document"].includes(e))return null;if("a"===t.tagName.toLowerCase())return t;t=t.parentElement}return null}t._gatherDatasetProperties=r,t._gatherEventData=function(e){var t;const n=e.tagName.toLowerCase(),s={},a=(0,i._getCurrentPageUrlSafe)()||"";s.tagName=n,"form"===n&&(s.action=e.getAttribute("action"),s.method=null!==(t=e.getAttribute("method"))&&void 0!==t?t:"GET",s.formName=e.getAttribute("name"),s.formId=e.getAttribute("id")),["input","select","textarea"].includes(n)&&"password"!==e.getAttribute("type")&&(s.content=e.value,s.inputName=e.getAttribute("name"));const l=o(e);if(l&&(s.href=l.getAttribute("href")),"button"===n||l){s.content=(e.textContent||"").trim();const t=r(l||e);Object.assign(s,t)}return{value:a,metadata:s}},t._getTargetNode=function(e){if(!e)return null;let t=e.target||e.srcElement;return t&&t instanceof Element?(3===t.nodeType&&(t=t.parentNode||null),t):null},t._shouldLogEvent=function(e,t){if(!e||!t||1!==t.nodeType)return!1;const n=t.tagName.toLowerCase(),i=e.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(o(t))return!0}return!1}},t._getSafeUrl=function(){var e,t,n;const r=null!==(n=null===(t=null===(e=(0,i._getWindowSafe)())||void 0===e?void 0:e.location)||void 0===t?void 0:t.href)&&void 0!==n?n:"";let o;try{o=new URL(r)}catch(e){o=new URL("error:")}return o},t._getSanitizedPageUrl=function(){return(0,i._getCurrentPageUrlSafe)()||""},t._registerEventHandler=function(e,t,n){e&&e.addEventListener&&e.addEventListener(t,n,!0)},t._getSafeNetworkInformation=function(){const e=(0,i._getWindowSafe)();if(!e||!e.navigator)return null;return e.navigator.connection||null}},6296:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SDKFlags=void 0;const n={};t.SDKFlags={setFlags:(e,t)=>{n[e]=t},get:(e,t)=>{var i,r;return null!==(r=null===(i=n[e])||void 0===i?void 0:i[t])&&void 0!==r&&r}}},6488:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},6512:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StatsigMetadataProvider=t.SDK_VERSION=void 0,t.SDK_VERSION="3.0.0";let n={sdkVersion:t.SDK_VERSION,sdkType:"js-mono"};t.StatsigMetadataProvider={get:()=>n,add:e=>{n=Object.assign(Object.assign({},n),e)}}},6521:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LoggingEnabledOption=t.LogEventCompressionMode=void 0,t.LogEventCompressionMode={Disabled:"d",Enabled:"e",Forced:"f"},t.LoggingEnabledOption={disabled:"disabled",browserOnly:"browser-only",always:"always"}},6599:function(e,t,n){var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))(function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t.ErrorBoundary=t.EXCEPTION_ENDPOINT=void 0;const r=n(25),o=n(4775),s=n(3285);t.EXCEPTION_ENDPOINT="https://statsigapi.net/v1/sdk_exception";const a="[Statsig] UnknownError";function l(e){return e instanceof Error?e:"string"==typeof e?new Error(e):new Error("An unknown error occurred.")}function u(e){if(!e)return{};const t={};return Object.entries(e).forEach(([e,n])=>{switch(typeof n){case"number":case"bigint":case"boolean":t[String(e)]=n;break;case"string":n.length<50?t[String(e)]=n:t[String(e)]="set";break;case"object":"environment"===e?t.environment=n:"networkConfig"===e?t.networkConfig=n:t[String(e)]=null!=n?"set":"unset"}}),t}t.ErrorBoundary=class{constructor(e,t,n,i){this._sdkKey=e,this._options=t,this._emitter=n,this._lastSeenError=i,this._seen=new Set}wrap(e){try{const t=e;(function(e){const t=new Set;let n=Object.getPrototypeOf(e);for(;n&&n!==Object.prototype;)Object.getOwnPropertyNames(n).filter(e=>"function"==typeof(null==n?void 0:n[e])).forEach(e=>t.add(e)),n=Object.getPrototypeOf(n);return Array.from(t)})(t).forEach(n=>{const i=t[n];"$EB"in i||(t[n]=(...t)=>this._capture(n,()=>i.apply(e,t)),t[n].$EB=!0)})}catch(e){this._onError("eb:wrap",e)}}logError(e,t){this._onError(e,t)}getLastSeenErrorAndReset(){const e=this._lastSeenError;return this._lastSeenError=void 0,null!=e?e:null}attachErrorIfNoneExists(e){this._lastSeenError||(this._lastSeenError=l(e))}_capture(e,t){try{const n=t();return n&&n instanceof Promise?n.catch(t=>this._onError(e,t)):n}catch(t){return this._onError(e,t),null}}_onError(e,n){try{r.Log.warn(`Caught error in ${e}`,{error:n}),(()=>i(this,void 0,void 0,function*(){var i,r,d,c,g,_,h;const v=n||Error(a),f=v instanceof Error,p=f?v.name:"No Name",m=l(v);if(this._lastSeenError=m,this._seen.has(p))return;if(this._seen.add(p),null===(r=null===(i=this._options)||void 0===i?void 0:i.networkConfig)||void 0===r?void 0:r.preventAllNetworkTraffic)return void(null===(d=this._emitter)||void 0===d||d.call(this,{name:"error",error:n,tag:e}));const y=o.SDKType._get(this._sdkKey),b=s.StatsigMetadataProvider.get(),S=f?v.stack:function(e){try{return JSON.stringify(e)}catch(e){return a}}(v),E=Object.assign({tag:e,exception:p,info:S,statsigOptions:u(this._options)},Object.assign(Object.assign({},b),{sdkType:y})),k=null!==(_=null===(g=null===(c=this._options)||void 0===c?void 0:c.networkConfig)||void 0===g?void 0:g.networkOverrideFunc)&&void 0!==_?_:fetch;yield k(t.EXCEPTION_ENDPOINT,{method:"POST",headers:{"STATSIG-API-KEY":this._sdkKey,"STATSIG-SDK-TYPE":String(y),"STATSIG-SDK-VERSION":String(b.sdkVersion),"Content-Type":"application/json"},body:JSON.stringify(E)}),null===(h=this._emitter)||void 0===h||h.call(this,{name:"error",error:n,tag:e})}))().then(()=>{}).catch(()=>{})}catch(e){}}}},6678:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._getOverridableUrl=void 0,t._getOverridableUrl=function(e,t,n,i){return e||(t?`${t}${n}`:`${i}${n}`)}},6913:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},6978:function(e,t,n){var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),r=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.Diagnostics=t.Log=t.Storage=t.EventLogger=void 0,n(3509);const o=n(882);Object.defineProperty(t,"Diagnostics",{enumerable:!0,get:function(){return o.Diagnostics}});const s=n(5434);Object.defineProperty(t,"EventLogger",{enumerable:!0,get:function(){return s.EventLogger}});const a=n(8024);Object.defineProperty(t,"Log",{enumerable:!0,get:function(){return a.Log}});const l=n(6512),u=n(1638);Object.defineProperty(t,"Storage",{enumerable:!0,get:function(){return u.Storage}}),r(n(3509),t),r(n(4681),t),r(n(8683),t),r(n(5638),t),r(n(882),t),r(n(4387),t),r(n(4358),t),r(n(3194),t),r(n(6913),t),r(n(3918),t),r(n(7061),t),r(n(8024),t),r(n(4703),t),r(n(2610),t),r(n(2509),t),r(n(5025),t),r(n(414),t),r(n(686),t),r(n(9839),t),r(n(2626),t),r(n(4351),t),r(n(1180),t),r(n(2166),t),r(n(7253),t),r(n(6512),t),r(n(7754),t),r(n(9851),t),r(n(9652),t),r(n(1570),t),r(n(1638),t),r(n(3705),t),r(n(10),t),r(n(6678),t),r(n(7047),t),r(n(2701),t),__STATSIG__=Object.assign(Object.assign({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{Log:a.Log,SDK_VERSION:l.SDK_VERSION})},7043:function(e,t,n){var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))(function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t._makeDataAdapterResult=t.DataAdapterCore=void 0;const r=n(3421),o=n(1633),s=n(5823),a=n(8743),l=n(9770);function u(e,t,n,i){return{source:e,data:t,receivedAt:Date.now(),stableID:n,fullUserHash:(0,s._getFullUserHash)(i)}}t.DataAdapterCore=class{constructor(e,t){this._adapterName=e,this._cacheSuffix=t,this._options=null,this._sdkKey=null,this._lastModifiedStoreKey=`statsig.last_modified_time.${t}`,this._inMemoryCache=new d}attach(e,t,n){this._sdkKey=e,this._options=t}getDataSync(e){const t=e&&(0,s._normalizeUser)(e,this._options),n=this._getCacheKey(t),i=this._inMemoryCache.get(n,t);if(i&&this._getIsCacheValueValid(i))return i;const r=this._loadFromCache(n);return r&&this._getIsCacheValueValid(r)?(this._inMemoryCache.add(n,r),this._inMemoryCache.get(n,t)):null}setData(e,t){const n=t&&(0,s._normalizeUser)(t,this._options),i=this._getCacheKey(n);this._inMemoryCache.add(i,u("Bootstrap",e,null,n))}_getIsCacheValueValid(e){return null==e.stableID||e.stableID===o.StableID.get(this._getSdkKey())}_getDataAsyncImpl(e,t,n){return i(this,void 0,void 0,function*(){a.Storage.isReady()||(yield a.Storage.isReadyResolver());const i=null!=e?e:this.getDataSync(t),o=[this._fetchAndPrepFromNetwork(i,t,n)];return(null==n?void 0:n.timeoutMs)&&o.push(new Promise(e=>setTimeout(e,n.timeoutMs)).then(()=>(r.Log.debug("Fetching latest value timed out"),null))),yield Promise.race(o)})}_prefetchDataImpl(e,t){return i(this,void 0,void 0,function*(){const n=e&&(0,s._normalizeUser)(e,this._options),i=this._getCacheKey(n),r=yield this._getDataAsyncImpl(null,n,t);r&&this._inMemoryCache.add(i,Object.assign(Object.assign({},r),{source:"Prefetch"}))})}_fetchAndPrepFromNetwork(e,t,n){return i(this,void 0,void 0,function*(){var i;const s=null!==(i=null==e?void 0:e.data)&&void 0!==i?i:null,a=null!=e&&this._isCachedResultValidFor204(e,t),d=yield this._fetchFromNetwork(s,t,n,a);if(!d)return r.Log.debug("No response returned for latest value"),null;const c=(0,l._typedJsonParse)(d,"has_updates","Response"),g=this._getSdkKey(),_=o.StableID.get(g);let h=null;if(!0===(null==c?void 0:c.has_updates))h=u("Network",d,_,t);else{if(!s||!1!==(null==c?void 0:c.has_updates))return null;h=u("NetworkNotModified",s,_,t)}const v=this._getCacheKey(t);return this._inMemoryCache.add(v,h),this._writeToCache(v,h),h})}_getSdkKey(){return null!=this._sdkKey?this._sdkKey:(r.Log.error(`${this._adapterName} is not attached to a Client`),"")}_loadFromCache(e){var t;const n=null===(t=a.Storage.getItem)||void 0===t?void 0:t.call(a.Storage,e);if(null==n)return null;const i=(0,l._typedJsonParse)(n,"source","Cached Result");return i?Object.assign(Object.assign({},i),{source:"Cache"}):null}_writeToCache(e,t){a.Storage.setItem(e,JSON.stringify(t)),this._runLocalStorageCacheEviction(e)}_runLocalStorageCacheEviction(e){var t;const n=null!==(t=(0,a._getObjectFromStorage)(this._lastModifiedStoreKey))&&void 0!==t?t:{};n[e]=Date.now();const i=c(n,10);i&&(delete n[i],a.Storage.removeItem(i)),(0,a._setObjectInStorage)(this._lastModifiedStoreKey,n)}},t._makeDataAdapterResult=u;class d{constructor(){this._data={}}get(e,t){var n;const i=this._data[e],o=null==i?void 0:i.stableID,s=null===(n=null==t?void 0:t.customIDs)||void 0===n?void 0:n.stableID;return s&&o&&s!==o?(r.Log.warn("'StatsigUser.customIDs.stableID' mismatch"),null):i}add(e,t){const n=c(this._data,9);n&&delete this._data[n],this._data[e]=t}merge(e){this._data=Object.assign(Object.assign({},this._data),e)}}function c(e,t){const n=Object.keys(e);return n.length<=t?null:n.reduce((t,n)=>{const i=e[t],r=e[n];return"object"==typeof i&&"object"==typeof r?r.receivedAt<i.receivedAt?n:t:r<i?n:t})}},7047:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getUUID=void 0,t.getUUID=function(){if("undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID)return crypto.randomUUID();let e=(new Date).getTime(),t="undefined"!=typeof performance&&performance.now&&1e3*performance.now()||0;return`xxxxxxxx-xxxx-4xxx-${"89ab"[Math.floor(4*Math.random())]}xxx-xxxxxxxxxxxx`.replace(/[xy]/g,n=>{let i=16*Math.random();return e>0?(i=(e+i)%16|0,e=Math.floor(e/16)):(i=(t+i)%16|0,t=Math.floor(t/16)),("x"===n?i:7&i|8).toString(16)})}},7061:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},7134:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createMemoKey=t.MemoPrefix=void 0,t.MemoPrefix={_gate:"g",_dynamicConfig:"c",_experiment:"e",_configList:"cl",_layer:"l",_paramStore:"p"};const n=new Set([]),i=new Set(["userPersistedValues"]);t.createMemoKey=function(e,t,r){let o=`${e}|${t}`;if(!r)return o;for(const e of Object.keys(r)){if(i.has(e))return;n.has(e)?o+=`|${e}=true`:o+=`|${e}=${r[e]}`}return o}},7142:function(e,t,n){var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))(function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t.StatsigClientBase=void 0,n(12);const r=n(12),o=n(6599),s=n(3815),a=n(25),l=n(7134),u=n(5737),d=n(5678),c=n(9069),g=n(4549),_=n(4203);t.StatsigClientBase=class{constructor(e,t,n,i){var l,g,h,v;this.loadingStatus="Uninitialized",this._initializePromise=null,this._listeners={};const f=this.$emt.bind(this);null!=(null==i?void 0:i.logLevel)&&(a.Log.level=i.logLevel),(null==i?void 0:i.disableStorage)&&_.Storage._setDisabled(!0),(null==i?void 0:i.initialSessionID)&&d.StatsigSession.overrideInitialSessionID(i.initialSessionID,e),(null==i?void 0:i.storageProvider)&&_.Storage._setProvider(i.storageProvider),(null==i?void 0:i.enableCookies)&&c.StableID._setCookiesEnabled(e,i.enableCookies),(null==i?void 0:i.disableStableID)&&c.StableID._setDisabled(e,!0),this._sdkKey=e,this._options=null!=i?i:{},this._memoCache={},this.overrideAdapter=null!==(l=null==i?void 0:i.overrideAdapter)&&void 0!==l?l:null,this._logger=new s.EventLogger(e,f,n,i),this._errorBoundary=new o.ErrorBoundary(e,i,f),this._errorBoundary.wrap(this),this._errorBoundary.wrap(t),this._errorBoundary.wrap(this._logger),n.setErrorBoundary(this._errorBoundary),this.dataAdapter=t,this.dataAdapter.attach(e,i,n),this.storageProvider=_.Storage,null===(v=null===(h=null===(g=this.overrideAdapter)||void 0===g?void 0:g.loadFromStorage)||void 0===h?void 0:h.call(g))||void 0===v||v.catch(e=>this._errorBoundary.logError("OA::loadFromStorage",e)),this._primeReadyRipcord(),function(e,t){var n;if((0,u._isServerEnv)())return;const i=(0,r._getStatsigGlobal)(),o=null!==(n=i.instances)&&void 0!==n?n:{},s=t;null!=o[e]&&a.Log.warn("Creating multiple Statsig clients with the same SDK key can lead to unexpected behavior. Multi-instance support requires different SDK keys."),o[e]=s,i.firstInstance||(i.firstInstance=s),i.instances=o,__STATSIG__=i}(e,this)}updateRuntimeOptions(e){e.loggingEnabled?(this._options.loggingEnabled=e.loggingEnabled,this._logger.setLoggingEnabled(e.loggingEnabled)):null!=e.disableLogging&&(this._options.disableLogging=e.disableLogging,this._logger.setLoggingEnabled(e.disableLogging?"disabled":"browser-only")),null!=e.disableStorage&&(this._options.disableStorage=e.disableStorage,_.Storage._setDisabled(e.disableStorage)),null!=e.enableCookies&&(this._options.enableCookies=e.enableCookies,c.StableID._setCookiesEnabled(this._sdkKey,e.enableCookies)),e.logEventCompressionMode?this._logger.setLogEventCompressionMode(e.logEventCompressionMode):e.disableCompression&&this._logger.setLogEventCompressionMode(g.LogEventCompressionMode.Disabled)}flush(){return this._logger.flush()}shutdown(){return i(this,void 0,void 0,function*(){this.$emt({name:"pre_shutdown"}),this._setStatus("Uninitialized",null),this._initializePromise=null,yield this._logger.stop()})}on(e,t){this._listeners[e]||(this._listeners[e]=[]),this._listeners[e].push(t)}off(e,t){if(this._listeners[e]){const n=this._listeners[e].indexOf(t);-1!==n&&this._listeners[e].splice(n,1)}}$on(e,t){t.__isInternal=!0,this.on(e,t)}$emt(e){var t;const n=t=>{try{t(e)}catch(n){if(!0===t.__isInternal)return void this._errorBoundary.logError(`__emit:${e.name}`,n);a.Log.error("An error occurred in a StatsigClientEvent listener. This is not an issue with Statsig.",e)}};this._listeners[e.name]&&this._listeners[e.name].forEach(e=>n(e)),null===(t=this._listeners["*"])||void 0===t||t.forEach(n)}_setStatus(e,t){this.loadingStatus=e,this._memoCache={},this.$emt({name:"values_updated",status:e,values:t})}_enqueueExposure(e,t,n){!0!==(null==n?void 0:n.disableExposureLog)?this._logger.enqueue(t):this._logger.incrementNonExposureCount(e)}_memoize(e,t){return(n,i)=>{if(this._options.disableEvaluationMemoization)return t(n,i);const r=(0,l.createMemoKey)(e,n,i);return r?(r in this._memoCache||(Object.keys(this._memoCache).length>=3e3&&(this._memoCache={}),this._memoCache[r]=t(n,i)),this._memoCache[r]):t(n,i)}}}},7234:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UrlConfiguration=void 0;const i=n(27),r=n(3939),o={[r.Endpoint._initialize]:"i",[r.Endpoint._rgstr]:"e",[r.Endpoint._download_config_specs]:"d"};t.UrlConfiguration=class{constructor(e,t,n,i){this.customUrl=null,this.fallbackUrls=null,this.endpoint=e,this.endpointDnsKey=o[e],t&&(this.customUrl=t),!t&&n&&(this.customUrl=n.endsWith("/")?`${n}${e}`:`${n}/${e}`),i&&(this.fallbackUrls=i);const s=r.NetworkDefault[e];this.defaultUrl=`${s}/${e}`}getUrl(){var e;return null!==(e=this.customUrl)&&void 0!==e?e:this.defaultUrl}getChecksum(){var e;const t=(null!==(e=this.fallbackUrls)&&void 0!==e?e:[]).sort().join(",");return(0,i._DJB2)(this.customUrl+t)}}},7253:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._createLayerParameterExposure=t._createConfigExposure=t._createGateExposure=t._isExposureEvent=void 0;const n="statsig::config_exposure",i="statsig::gate_exposure",r=(e,t,n,i,r)=>({eventName:e,user:t,value:null,metadata:o(n,i),secondaryExposures:r,time:Date.now()});t._isExposureEvent=({eventName:e})=>e===i||e===n,t._createGateExposure=(e,t)=>{var n,o;return r(i,e,t.details,{gate:t.name,gateValue:String(t.value),ruleID:t.ruleID},null!==(o=null===(n=t.__evaluation)||void 0===n?void 0:n.secondary_exposures)&&void 0!==o?o:[])},t._createConfigExposure=(e,t)=>{var i,o;return r(n,e,t.details,{config:t.name,ruleID:t.ruleID},null!==(o=null===(i=t.__evaluation)||void 0===i?void 0:i.secondary_exposures)&&void 0!==o?o:[])},t._createLayerParameterExposure=(e,t,n)=>{var i,o,s;const a=t.__evaluation,l=!0===(null===(i=null==a?void 0:a.explicit_parameters)||void 0===i?void 0:i.includes(n));let u="",d=null!==(o=null==a?void 0:a.undelegated_secondary_exposures)&&void 0!==o?o:[];return l&&(u=null!==(s=a.allocated_experiment_name)&&void 0!==s?s:"",d=a.secondary_exposures),r("statsig::layer_exposure",e,t.details,{config:t.name,parameterName:n,ruleID:t.ruleID,allocatedExperiment:u,isExplicitParameter:String(l)},d)};const o=(e,t)=>(t.reason=e.reason,e.lcut&&(t.lcut=String(e.lcut)),e.receivedAt&&(t.receivedAt=String(e.receivedAt)),t)},7450:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},7463:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AutoCapture=t.runStatsigAutoCapture=void 0;const i=n(6978),r=n(6181),o=n(4181);t.runStatsigAutoCapture=function(e){return new s(e)};class s{constructor(e){var t,n,r;this._client=e,this._startTime=Date.now(),this._deepestScroll=0,this._disabledEvents={};const{sdkKey:o,errorBoundary:s,values:a}=e.getContext();this._disabledEvents=null!==(n=null===(t=null==a?void 0:a.auto_capture_settings)||void 0===t?void 0:t.disabled_events)&&void 0!==n?n:{},this._errorBoundary=s,this._errorBoundary.wrap(this);const l=(0,i._getDocumentSafe)();if(!(0,i._isServerEnv)()){__STATSIG__=(0,i._getStatsigGlobal)();const e=null!==(r=__STATSIG__.acInstances)&&void 0!==r?r:{};e[o]=this,__STATSIG__.acInstances=e}"loading"!==(null==l?void 0:l.readyState)?this._initialize():l.addEventListener("DOMContentLoaded",()=>this._initialize())}_addEventHandlers(){const e=(0,i._getWindowSafe)(),t=(0,i._getDocumentSafe)();if(!e||!t)return;const n=t=>{this._autoLogEvent(t||e.event)};(0,r._registerEventHandler)(t,"click",n),(0,r._registerEventHandler)(t,"submit",n),(0,r._registerEventHandler)(e,"error",n),(0,r._registerEventHandler)(e,"beforeunload",()=>this._pageUnloadHandler()),(0,r._registerEventHandler)(e,"scroll",()=>this._scrollEventHandler())}_autoLogEvent(e){var t;let n=null===(t=e.type)||void 0===t?void 0:t.toLowerCase();if("error"===n&&e instanceof ErrorEvent)return void this._logError(e);const i=(0,r._getTargetNode)(e);if(!i)return;if(!(0,r._shouldLogEvent)(e,i))return;"submit"===n&&(n="form_submit");const{value:o,metadata:s}=(0,r._gatherEventData)(i);this._enqueueAutoCapture(n,o,s)}_initialize(){this._addEventHandlers(),this._logSessionStart(),this._logPageView(),this._logPerformance()}_logError(e){const t=(null==e?void 0:e.error)||{};let n=t;if("object"==typeof t)try{n=JSON.stringify(t)}catch(e){n="function"==typeof(null==t?void 0:t.toString)?t.toString():"Unknown Error"}this._enqueueAutoCapture("error",e.message,{message:e.message,filename:e.filename,lineno:e.lineno,colno:e.colno,error_str:n})}_logSessionStart(){const e=this._getSessionFromClient();try{if(!this._isNewSession(e))return;this._enqueueAutoCapture("session_start",(0,r._getSanitizedPageUrl)(),{sessionID:e.data.sessionID},{flushImmediately:!0})}catch(e){this._errorBoundary.logError("AC::logSession",e)}}_logPageView(){setTimeout(()=>{const e=(0,r._getSafeUrl)(),t=(0,o._gatherPageViewPayload)(e);this._enqueueAutoCapture("page_view",(0,r._getSanitizedPageUrl)(),t,{flushImmediately:!0,addNewSessionMetadata:!0})},1)}_logPerformance(){const e=(0,i._getWindowSafe)();void 0!==(null==e?void 0:e.performance)&&"function"==typeof e.performance.getEntriesByType&&"function"==typeof e.performance.getEntriesByName&&setTimeout(()=>{const t={},n=e.performance.getEntriesByType("navigation");if(n&&n.length>0&&n[0]instanceof PerformanceNavigationTiming){const e=n[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}const i=e.performance.getEntriesByName("first-contentful-paint");i&&i.length>0&&i[0]instanceof PerformancePaintTiming&&(t.first_contentful_paint_time_ms=i[0].startTime);const o=(0,r._getSafeNetworkInformation)();o&&(t.effective_connection_type=o.effectiveType,t.rtt_ms=o.rtt,t.downlink_kbps=o.downlink,t.save_data=o.saveData),this._enqueueAutoCapture("performance",(0,r._getSanitizedPageUrl)(),t)},1)}_pageUnloadHandler(){this._enqueueAutoCapture("page_view_end",(0,r._getSanitizedPageUrl)(),{scrollDepth:this._deepestScroll,pageViewLength:Date.now()-this._startTime},{flushImmediately:!0})}_enqueueAutoCapture(e,t,n,r){var o,s,a;if(this._disabledEvents[e])return;const l=this._getSessionFromClient();try{const u=Object.assign({sessionID:l.data.sessionID,page_url:null!==(a=null===(s=null===(o=(0,i._getWindowSafe)())||void 0===o?void 0:o.location)||void 0===s?void 0:s.href)&&void 0!==a?a:""},n);(null==r?void 0:r.addNewSessionMetadata)&&(u.isNewSession=String(this._isNewSession(l)));const d={eventName:`auto_capture::${e}`,value:t,metadata:u};this._client.logEvent(d),(null==r?void 0:r.flushImmediately)&&this._client.flush().catch(e=>{i.Log.error(e)})}catch(e){this._errorBoundary.logError("AC::enqueue",e)}}_scrollEventHandler(){var e,t,n,r;const o=null!==(t=null===(e=(0,i._getDocumentSafe)())||void 0===e?void 0:e.body.scrollHeight)&&void 0!==t?t:1,s=(0,i._getWindowSafe)(),a=null!==(n=null==s?void 0:s.scrollY)&&void 0!==n?n:1,l=null!==(r=null==s?void 0:s.innerHeight)&&void 0!==r?r:1;this._deepestScroll=Math.max(this._deepestScroll,Math.min(100,Math.round((a+l)/o*100)))}_isNewSession(e){return Math.abs(e.data.startTime-Date.now())<1e3}_getSessionFromClient(){return this._client.getContext().session}}t.AutoCapture=s},7563:function(e,t,n){var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),r=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.Storage=t.Log=t.EventLogger=t.Diagnostics=void 0,n(4400);const o=n(4400),s=n(9043);Object.defineProperty(t,"Diagnostics",{enumerable:!0,get:function(){return s.Diagnostics}});const a=n(2931);Object.defineProperty(t,"EventLogger",{enumerable:!0,get:function(){return a.EventLogger}});const l=n(3421);Object.defineProperty(t,"Log",{enumerable:!0,get:function(){return l.Log}});const u=n(8225),d=n(8743);Object.defineProperty(t,"Storage",{enumerable:!0,get:function(){return d.Storage}}),r(n(4400),t),r(n(210),t),r(n(2628),t),r(n(7043),t),r(n(9043),t),r(n(7450),t),r(n(2403),t),r(n(3915),t),r(n(9344),t),r(n(3735),t),r(n(9386),t),r(n(3421),t),r(n(9314),t),r(n(8871),t),r(n(8074),t),r(n(4420),t),r(n(1952),t),r(n(4845),t),r(n(5515),t),r(n(2714),t),r(n(3515),t),r(n(1633),t),r(n(9234),t),r(n(637),t),r(n(8709),t),r(n(1130),t),r(n(8225),t),r(n(6521),t),r(n(9095),t),r(n(4436),t),r(n(8495),t),r(n(5823),t),r(n(8743),t),r(n(9770),t),r(n(4227),t),r(n(1046),t),r(n(4952),t),r(n(400),t),r(n(1319),t),r(n(5516),t),Object.assign((0,o._getStatsigGlobal)(),{Log:l.Log,SDK_VERSION:u.SDK_VERSION})},7566:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._getStorageKey=t._getUserStorageKey=void 0;const i=n(27);function r(e,t,n){var r;if(n)return n(e,t);const o=t&&t.customIDs?t.customIDs:{},s=[`uid:${null!==(r=null==t?void 0:t.userID)&&void 0!==r?r:""}`,`cids:${Object.keys(o).sort((e,t)=>e.localeCompare(t)).map(e=>`${e}-${o[e]}`).join(",")}`,`k:${e}`];return(0,i._DJB2)(s.join("|"))}t._getUserStorageKey=r,t._getStorageKey=function(e,t,n){return t?r(e,t,n):(0,i._DJB2)(`k:${e}`)}},7677:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});const i=n(7563);t.default=class{constructor(e){this._sdkKey=e,this._rawValues=null,this._values=null,this._source="Uninitialized",this._lcut=0,this._receivedAt=0,this._bootstrapMetadata=null,this._warnings=new Set}reset(){this._values=null,this._rawValues=null,this._source="Loading",this._lcut=0,this._receivedAt=0,this._bootstrapMetadata=null}finalize(){this._values||(this._source="NoValues")}getValues(){return this._rawValues?(0,i._typedJsonParse)(this._rawValues,"has_updates","EvaluationStoreValues"):null}setValues(e,t){var n;if(!e)return!1;const r=(0,i._typedJsonParse)(e.data,"has_updates","EvaluationResponse");return null!=r&&(this._source=e.source,!0!==(null==r?void 0:r.has_updates)||(this._rawValues=e.data,this._lcut=r.time,this._receivedAt=e.receivedAt,this._values=r,this._bootstrapMetadata=this._extractBootstrapMetadata(e.source,r),e.source&&r.user&&this._setWarningState(t,r),i.SDKFlags.setFlags(this._sdkKey,null!==(n=r.sdk_flags)&&void 0!==n?n:{})),!0)}getWarnings(){if(0!==this._warnings.size)return Array.from(this._warnings)}getGate(e){var t;return this._getDetailedStoreResult(null===(t=this._values)||void 0===t?void 0:t.feature_gates,e)}getConfig(e){var t;return this._getDetailedStoreResult(null===(t=this._values)||void 0===t?void 0:t.dynamic_configs,e)}getConfigList(){var e;return(null===(e=this._values)||void 0===e?void 0:e.dynamic_configs)?Object.values(this._values.dynamic_configs).map(e=>e.name):[]}getLayer(e){var t;return this._getDetailedStoreResult(null===(t=this._values)||void 0===t?void 0:t.layer_configs,e)}getParamStore(e){var t;return this._getDetailedStoreResult(null===(t=this._values)||void 0===t?void 0:t.param_stores,e)}getSource(){return this._source}getExposureMapping(){var e;return null===(e=this._values)||void 0===e?void 0:e.exposures}_extractBootstrapMetadata(e,t){if("Bootstrap"!==e)return null;const n={};return t.user&&(n.user=t.user),t.sdkInfo&&(n.generatorSDKInfo=t.sdkInfo),n.lcut=t.time,n}_getDetailedStoreResult(e,t){let n=null;return e&&(n=e[t]?e[t]:e[(0,i._DJB2)(t)]),{result:n,details:this._getDetails(null==n)}}_setWarningState(e,t){var n,r;const o=i.StableID.get(this._sdkKey);if((null===(n=e.customIDs)||void 0===n?void 0:n.stableID)===o||!(null===(r=e.customIDs)||void 0===r?void 0:r.stableID)&&!o){if("user"in t){const n=t.user,r=Object.assign(Object.assign({},e),{analyticsOnlyMetadata:void 0});(0,i._getFullUserHash)(r)!==(0,i._getFullUserHash)(n)&&this._warnings.add("PartialUserMatch")}}else this._warnings.add("StableIDMismatch")}getCurrentSourceDetails(){if("Uninitialized"===this._source||"NoValues"===this._source)return{reason:this._source};const e={reason:this._source,lcut:this._lcut,receivedAt:this._receivedAt};return this._warnings.size>0&&(e.warnings=Array.from(this._warnings)),e}_getDetails(e){var t,n;const i=this.getCurrentSourceDetails();let r=i.reason;const o=null!==(t=i.warnings)&&void 0!==t?t:[];"Bootstrap"===this._source&&o.length>0&&(r+=o[0]),"Uninitialized"!==r&&"NoValues"!==r&&(r=`${r}:${e?"Unrecognized":"Recognized"}`);const s="Bootstrap"===this._source&&null!==(n=this._bootstrapMetadata)&&void 0!==n?n:void 0;return s&&(i.bootstrapMetadata=s),Object.assign(Object.assign({},i),{reason:r})}}},7686:function(e,t,n){var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))(function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0});const r=n(7563),o=n(7677),s=n(2944),a=n(9999),l=n(2451);class u extends r.StatsigClientBase{static instance(e){const t=(0,r._getStatsigGlobal)().instance(e);return t instanceof u?t:(r.Log.warn((0,r._isServerEnv)()?"StatsigClient.instance is not supported in server environments":"Unable to find StatsigClient instance"),new u(null!=e?e:"",{}))}constructor(e,t,n=null){var i,a;r.SDKType._setClientType(e,"javascript-client");const u=new s.default(n,e=>{this.$emt(e)});super(e,null!==(i=null==n?void 0:n.dataAdapter)&&void 0!==i?i:new l.StatsigEvaluationsDataAdapter,u,n),this._possibleFirstTouchMetadata={},this.getFeatureGate=this._memoize(r.MemoPrefix._gate,this._getFeatureGateImpl.bind(this)),this.getDynamicConfig=this._memoize(r.MemoPrefix._dynamicConfig,this._getDynamicConfigImpl.bind(this)),this.getExperiment=this._memoize(r.MemoPrefix._experiment,this._getExperimentImpl.bind(this)),this.getConfigList=this._memoize(r.MemoPrefix._configList,this._getConfigListImpl.bind(this)),this.getLayer=this._memoize(r.MemoPrefix._layer,this._getLayerImpl.bind(this)),this.getParameterStore=this._memoize(r.MemoPrefix._paramStore,this._getParameterStoreImpl.bind(this)),this._store=new o.default(e),this._network=u,this._user=this._configureUser(t,n),this._sdkInstanceID=(0,r.getUUID)();const d=null!==(a=null==n?void 0:n.plugins)&&void 0!==a?a:[];for(const e of d)e.bind(this)}initializeSync(e){var t;return"Uninitialized"!==this.loadingStatus?(0,r.createUpdateDetails)(!0,this._store.getSource(),-1,null,null,["MultipleInitializations",...null!==(t=this._store.getWarnings())&&void 0!==t?t:[]]):(this._logger.start(),this.updateUserSync(this._user,e))}initializeAsync(e){return i(this,void 0,void 0,function*(){return this._initializePromise||(this._initializePromise=this._initializeAsyncImpl(e)),this._initializePromise})}updateUserSync(e,t){const n=performance.now();try{return this._updateUserSyncImpl(e,t,n)}catch(e){const t=e instanceof Error?e:new Error(String(e));return this._createErrorUpdateDetails(t,n)}}_updateUserSyncImpl(e,t,n){var i;const o=[...null!==(i=this._store.getWarnings())&&void 0!==i?i:[]];this._resetForUser(e);const s=this.dataAdapter.getDataSync(this._user);null==s&&o.push("NoCachedValues"),this._store.setValues(s,this._user),this._finalizeUpdate(s);const a=null==t?void 0:t.disableBackgroundCacheRefresh;return!0===a||null==a&&"Bootstrap"===(null==s?void 0:s.source)||this._runPostUpdate(null!=s?s:null,this._user),(0,r.createUpdateDetails)(!0,this._store.getSource(),performance.now()-n,this._errorBoundary.getLastSeenErrorAndReset(),this._network.getLastUsedInitUrlAndReset(),o)}updateUserAsync(e,t){return i(this,void 0,void 0,function*(){const n=performance.now();try{return yield this._updateUserAsyncImpl(e,t)}catch(e){const t=e instanceof Error?e:new Error(String(e));return this._createErrorUpdateDetails(t,n)}})}_updateUserAsyncImpl(e,t){return i(this,void 0,void 0,function*(){this._resetForUser(e);const n=this._user;r.Diagnostics._markInitOverallStart(this._sdkKey);let i=this.dataAdapter.getDataSync(n);if(this._store.setValues(i,this._user),this._setStatus("Loading",i),i=yield this.dataAdapter.getDataAsync(i,n,t),n!==this._user)return(0,r.createUpdateDetails)(!1,this._store.getSource(),-1,new Error("User changed during update"),this._network.getLastUsedInitUrlAndReset());let o=!1;null!=i&&(r.Diagnostics._markInitProcessStart(this._sdkKey),o=this._store.setValues(i,this._user),r.Diagnostics._markInitProcessEnd(this._sdkKey,{success:o})),this._finalizeUpdate(i),o||(this._errorBoundary.attachErrorIfNoneExists(r.UPDATE_DETAIL_ERROR_MESSAGES.NO_NETWORK_DATA),this.$emt({name:"initialization_failure"})),r.Diagnostics._markInitOverallEnd(this._sdkKey,o,this._store.getCurrentSourceDetails());const s=r.Diagnostics._enqueueDiagnosticsEvent(this._user,this._logger,this._sdkKey,this._options);return(0,r.createUpdateDetails)(o,this._store.getSource(),s,this._errorBoundary.getLastSeenErrorAndReset(),this._network.getLastUsedInitUrlAndReset(),this._store.getWarnings())})}getContext(){return{sdkKey:this._sdkKey,options:this._options,values:this._store.getValues(),user:JSON.parse(JSON.stringify(this._user)),errorBoundary:this._errorBoundary,session:r.StatsigSession.get(this._sdkKey),stableID:r.StableID.get(this._sdkKey),sdkInstanceID:this._sdkInstanceID}}checkGate(e,t){return this.getFeatureGate(e,t).value}logEvent(e,t,n){const i="string"==typeof e?{eventName:e,value:t,metadata:n}:e;this.$emt({name:"log_event_called",event:i}),this._logger.enqueue(Object.assign(Object.assign({},i),{user:this._user,time:Date.now()}))}updateUserWithAnalyticsOnlyMetadata(e){this._user=this._configureUser(Object.assign(Object.assign({},this._user),{analyticsOnlyMetadata:e}),this._options)}_primeReadyRipcord(){this.$on("error",()=>{"Loading"===this.loadingStatus&&this._finalizeUpdate(null)})}_initializeAsyncImpl(e){return i(this,void 0,void 0,function*(){return r.Storage.isReady()||(yield r.Storage.isReadyResolver()),this._logger.start(),this.updateUserAsync(this._user,e)})}_createErrorUpdateDetails(e,t){var n;return(0,r.createUpdateDetails)(!1,this._store.getSource(),performance.now()-t,e,null,[...null!==(n=this._store.getWarnings())&&void 0!==n?n:[]])}_finalizeUpdate(e){this._store.finalize(),this._setStatus("Ready",e)}_runPostUpdate(e,t){this.dataAdapter.getDataAsync(e,t,{priority:"low"}).catch(e=>{r.Log.error("An error occurred after update.",e)})}_resetForUser(e){this._logger.reset(),this._store.reset(),this._user=this._configureUser(e,this._options)}_configureUser(e,t){var n;const i=(0,r._normalizeUser)(e,t),o=null===(n=i.customIDs)||void 0===n?void 0:n.stableID;return o&&r.StableID.setOverride(o,this._sdkKey),i.analyticsOnlyMetadata=Object.assign(Object.assign({},i.analyticsOnlyMetadata),this._possibleFirstTouchMetadata),i}_getFeatureGateImpl(e,t){var n,i;const{result:o,details:s}=this._store.getGate(e),a=(0,r._makeFeatureGate)(e,s,o),l=null===(i=null===(n=this.overrideAdapter)||void 0===n?void 0:n.getGateOverride)||void 0===i?void 0:i.call(n,a,this._user,t),u=null!=l?l:a;return this._enqueueExposure(e,(0,r._createGateExposure)(this._user,u,this._store.getExposureMapping()),t),this.$emt({name:"gate_evaluation",gate:u}),u}_getDynamicConfigImpl(e,t){var n,i;const{result:o,details:s}=this._store.getConfig(e),a=(0,r._makeDynamicConfig)(e,s,o),l=null===(i=null===(n=this.overrideAdapter)||void 0===n?void 0:n.getDynamicConfigOverride)||void 0===i?void 0:i.call(n,a,this._user,t),u=null!=l?l:a;return this._enqueueExposure(e,(0,r._createConfigExposure)(this._user,u,this._store.getExposureMapping()),t),this.$emt({name:"dynamic_config_evaluation",dynamicConfig:u}),u}_getExperimentImpl(e,t){var n,i,o,s;const{result:a,details:l}=this._store.getConfig(e),u=(0,r._makeExperiment)(e,l,a);null!=u.__evaluation&&(u.__evaluation.secondary_exposures=(0,r._mapExposures)(null!==(i=null===(n=u.__evaluation)||void 0===n?void 0:n.secondary_exposures)&&void 0!==i?i:[],this._store.getExposureMapping()));const d=null===(s=null===(o=this.overrideAdapter)||void 0===o?void 0:o.getExperimentOverride)||void 0===s?void 0:s.call(o,u,this._user,t),c=null!=d?d:u;return this._enqueueExposure(e,(0,r._createConfigExposure)(this._user,c,this._store.getExposureMapping()),t),this.$emt({name:"experiment_evaluation",experiment:c}),c}_getConfigListImpl(){return this._store.getConfigList()}_getLayerImpl(e,t){var n,i,o;const{result:s,details:a}=this._store.getLayer(e),l=(0,r._makeLayer)(e,a,s),u=null===(i=null===(n=this.overrideAdapter)||void 0===n?void 0:n.getLayerOverride)||void 0===i?void 0:i.call(n,l,this._user,t);(null==t?void 0:t.disableExposureLog)&&this._logger.incrementNonExposureCount(e);const d=(0,r._mergeOverride)(l,u,null!==(o=null==u?void 0:u.__value)&&void 0!==o?o:l.__value,n=>{(null==t?void 0:t.disableExposureLog)||this._enqueueExposure(e,(0,r._createLayerParameterExposure)(this._user,d,n,this._store.getExposureMapping()),t)});return this.$emt({name:"layer_evaluation",layer:d}),d}_getParameterStoreImpl(e,t){var n,i;const{result:r,details:o}=this._store.getParamStore(e);this._logger.incrementNonExposureCount(e);const s={name:e,details:o,__configuration:r,get:(0,a._makeParamStoreGetter)(this,r,t)},l=null===(i=null===(n=this.overrideAdapter)||void 0===n?void 0:n.getParamStoreOverride)||void 0===i?void 0:i.call(n,s,t);return null!=l&&(s.__configuration=l.config,s.details=l.details,s.get=(0,a._makeParamStoreGetter)(this,l.config,t)),s}}t.default=u},7700:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},7754:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},7791:function(e,t,n){var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))(function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t._makeDataAdapterResult=t.DataAdapterCore=void 0;const r=n(25),o=n(9069),s=n(4683),a=n(4203),l=n(2566);function u(e,t,n,i){return{source:e,data:t,receivedAt:Date.now(),stableID:n,fullUserHash:(0,s._getFullUserHash)(i)}}t.DataAdapterCore=class{constructor(e,t){this._adapterName=e,this._cacheSuffix=t,this._options=null,this._sdkKey=null,this._lastModifiedStoreKey=`statsig.last_modified_time.${t}`,this._inMemoryCache=new d}attach(e,t,n){this._sdkKey=e,this._options=t}getDataSync(e){const t=e&&(0,s._normalizeUser)(e,this._options),n=this._getCacheKey(t),i=this._inMemoryCache.get(n,t);if(i&&this._getIsCacheValueValid(i))return i;const r=this._loadFromCache(n);return r&&this._getIsCacheValueValid(r)?(this._inMemoryCache.add(n,r),this._inMemoryCache.get(n,t)):null}setData(e,t){const n=t&&(0,s._normalizeUser)(t,this._options),i=this._getCacheKey(n);this._inMemoryCache.add(i,u("Bootstrap",e,null,n))}_getIsCacheValueValid(e){return null==e.stableID||e.stableID===o.StableID.get(this._getSdkKey())}_getDataAsyncImpl(e,t,n){return i(this,void 0,void 0,function*(){a.Storage.isReady()||(yield a.Storage.isReadyResolver());const i=null!=e?e:this.getDataSync(t),o=[this._fetchAndPrepFromNetwork(i,t,n)];return(null==n?void 0:n.timeoutMs)&&o.push(new Promise(e=>setTimeout(e,n.timeoutMs)).then(()=>(r.Log.debug("Fetching latest value timed out"),null))),yield Promise.race(o)})}_prefetchDataImpl(e,t){return i(this,void 0,void 0,function*(){const n=e&&(0,s._normalizeUser)(e,this._options),i=this._getCacheKey(n),r=yield this._getDataAsyncImpl(null,n,t);r&&this._inMemoryCache.add(i,Object.assign(Object.assign({},r),{source:"Prefetch"}))})}_fetchAndPrepFromNetwork(e,t,n){return i(this,void 0,void 0,function*(){var i;const s=null!==(i=null==e?void 0:e.data)&&void 0!==i?i:null,a=null!=e&&this._isCachedResultValidFor204(e,t),d=yield this._fetchFromNetwork(s,t,n,a);if(!d)return r.Log.debug("No response returned for latest value"),null;const c=(0,l._typedJsonParse)(d,"has_updates","Response"),g=this._getSdkKey(),_=o.StableID.get(g);let h=null;if(!0===(null==c?void 0:c.has_updates))h=u("Network",d,_,t);else{if(!s||!1!==(null==c?void 0:c.has_updates))return null;h=u("NetworkNotModified",s,_,t)}const v=this._getCacheKey(t);return this._inMemoryCache.add(v,h),this._writeToCache(v,h),h})}_getSdkKey(){return null!=this._sdkKey?this._sdkKey:(r.Log.error(`${this._adapterName} is not attached to a Client`),"")}_loadFromCache(e){var t;const n=null===(t=a.Storage.getItem)||void 0===t?void 0:t.call(a.Storage,e);if(null==n)return null;const i=(0,l._typedJsonParse)(n,"source","Cached Result");return i?Object.assign(Object.assign({},i),{source:"Cache"}):null}_writeToCache(e,t){a.Storage.setItem(e,JSON.stringify(t)),this._runLocalStorageCacheEviction(e)}_runLocalStorageCacheEviction(e){var t;const n=null!==(t=(0,a._getObjectFromStorage)(this._lastModifiedStoreKey))&&void 0!==t?t:{};n[e]=Date.now();const i=c(n,10);i&&(delete n[i],a.Storage.removeItem(i)),(0,a._setObjectInStorage)(this._lastModifiedStoreKey,n)}},t._makeDataAdapterResult=u;class d{constructor(){this._data={}}get(e,t){var n;const i=this._data[e],o=null==i?void 0:i.stableID,s=null===(n=null==t?void 0:t.customIDs)||void 0===n?void 0:n.stableID;return s&&o&&s!==o?(r.Log.warn("'StatsigUser.customIDs.stableID' mismatch"),null):i}add(e,t){const n=c(this._data,9);n&&delete this._data[n],this._data[e]=t}merge(e){this._data=Object.assign(Object.assign({},this._data),e)}}function c(e,t){const n=Object.keys(e);return n.length<=t?null:n.reduce((t,n)=>{const i=e[t],r=e[n];return"object"==typeof i&&"object"==typeof r?r.receivedAt<i.receivedAt?n:t:r<i?n:t})}},8024:(e,t)=>{function n(e){return e.unshift("[Statsig]"),e}var i;Object.defineProperty(t,"__esModule",{value:!0}),t.Log=t.LogLevel=void 0,function(e){e[e.None=0]="None",e[e.Error=1]="Error",e[e.Warn=2]="Warn",e[e.Info=3]="Info",e[e.Debug=4]="Debug"}(i||(t.LogLevel=i={}));class r{static info(...e){this.level>=i.Info&&console.info("%s"," INFO ",...n(e))}static debug(...e){this.level>=i.Debug&&console.debug("%s"," DEBUG ",...n(e))}static warn(...e){this.level>=i.Warn&&console.warn("%s"," WARN ",...n(e))}static error(...e){this.level>=i.Error&&console.error("%s"," ERROR ",...n(e))}}t.Log=r,r.level=i.Warn},8074:function(e,t,n){var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))(function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t.NetworkCore=void 0,n(4400);const r=n(4400),o=n(9043),s=n(3421),a=n(8871),l=n(9361),u=n(5516),d=n(5515),c=n(4845),g=n(2714),_=n(1633),h=n(637),v=n(8225),f=n(6521),p=n(400),m=new Set([408,500,502,503,504,522,524,599]);t.NetworkCore=class{constructor(e,t){this._emitter=t,this._errorBoundary=null,this._timeout=1e4,this._netConfig={},this._options={},this._leakyBucket={},this._lastUsedInitUrl=null,e&&(this._options=e),this._options.networkConfig&&(this._netConfig=this._options.networkConfig),this._netConfig.networkTimeoutMs&&(this._timeout=this._netConfig.networkTimeoutMs),this._fallbackResolver=new l.NetworkFallbackResolver(this._options),this.setLogEventCompressionMode(this._getLogEventCompressionMode(e))}setLogEventCompressionMode(e){this._options.logEventCompressionMode=e}setErrorBoundary(e){this._errorBoundary=e,this._errorBoundary.wrap(this),this._errorBoundary.wrap(this._fallbackResolver),this._fallbackResolver.setErrorBoundary(e)}isBeaconSupported(){return"undefined"!=typeof navigator&&"function"==typeof navigator.sendBeacon}getLastUsedInitUrlAndReset(){const e=this._lastUsedInitUrl;return this._lastUsedInitUrl=null,e}beacon(e){if(!y(e))return!1;const t=this._getInternalRequestArgs("POST",e),n=this._getPopulatedURL(t),i=navigator;return i.sendBeacon.bind(i)(n,t.body)}post(e){return i(this,void 0,void 0,function*(){const t=this._getInternalRequestArgs("POST",e);return this._tryEncodeBody(t),yield this._tryToCompressBody(t),this._sendRequest(t)})}get(e){const t=this._getInternalRequestArgs("GET",e);return this._sendRequest(t)}_sendRequest(e){return i(this,void 0,void 0,function*(){var t,n,r,l;if(!y(e))return null;if(this._netConfig.preventAllNetworkTraffic)return null;const{method:u,body:d,retries:c,attempt:g}=e,_=e.urlConfig.endpoint;if(this._isRateLimited(_))return s.Log.warn(`Request to ${_} was blocked because you are making requests too frequently.`),null;const v=null!=g?g:1,f="undefined"!=typeof AbortController?new AbortController:null,b=setTimeout(()=>{null==f||f.abort(`Timeout of ${this._timeout}ms expired.`)},this._timeout),E=this._getPopulatedURL(e);let k=null;const w=(0,p._isUnloading)();try{const n={method:u,body:d,headers:Object.assign({},e.headers),signal:null==f?void 0:f.signal,priority:e.priority,keepalive:w};!function(e,t){e.urlConfig.endpoint===a.Endpoint._initialize&&o.Diagnostics._markInitNetworkReqStart(e.sdkKey,{attempt:t})}(e,v);const i=this._leakyBucket[_];i&&(i.lastRequestTime=Date.now(),this._leakyBucket[_]=i);const r=null!==(t=this._netConfig.networkOverrideFunc)&&void 0!==t?t:fetch;if(k=yield r(E,n),clearTimeout(b),!k.ok){const e=yield k.text().catch(()=>"No Text"),t=new Error(`NetworkError: ${E} ${e}`);throw t.name="NetworkError",t}const s=yield k.text();return S(e,k,v,s),this._fallbackResolver.tryBumpExpiryTime(e.sdkKey,e.urlConfig),{body:s,code:k.status}}catch(t){const o=function(e,t){return(null==e?void 0:e.signal.aborted)&&"string"==typeof e.signal.reason?e.signal.reason:"string"==typeof t?t:t instanceof Error?`${t.name}: ${t.message}`:"Unknown Error"}(f,t),a=(null==(O=f)?void 0:O.signal.aborted)&&"string"==typeof O.signal.reason&&O.signal.reason.includes("Timeout")||!1;if(S(e,k,v,"",t),(yield this._fallbackResolver.tryFetchUpdatedFallbackInfo(e.sdkKey,e.urlConfig,o,a))&&(e.fallbackUrl=this._fallbackResolver.getActiveFallbackUrl(e.sdkKey,e.urlConfig)),!c||v>c||!m.has(null!==(n=null==k?void 0:k.status)&&void 0!==n?n:500)){null===(r=this._emitter)||void 0===r||r.call(this,{name:"error",error:t,tag:h.ErrorTag.NetworkError,requestArgs:e});const n=`A networking error occurred during ${u} request to ${E}.`;return s.Log.error(n,o,t),null===(l=this._errorBoundary)||void 0===l||l.attachErrorIfNoneExists(n),null}return yield function(e){return i(this,void 0,void 0,function*(){yield new Promise(t=>setTimeout(t,Math.min(e*e*500,3e4)))})}(v),this._sendRequest(Object.assign(Object.assign({},e),{retries:c,attempt:v+1}))}var O})}_getLogEventCompressionMode(e){let t=null==e?void 0:e.logEventCompressionMode;return t||!0!==(null==e?void 0:e.disableCompression)||(t=f.LogEventCompressionMode.Disabled),t||(t=f.LogEventCompressionMode.Enabled),t}_isRateLimited(e){var t;const n=Date.now(),i=null!==(t=this._leakyBucket[e])&&void 0!==t?t:{count:0,lastRequestTime:n},r=n-i.lastRequestTime,o=Math.floor(.05*r);return i.count=Math.max(0,i.count-o),i.count>=50||(i.count+=1,i.lastRequestTime=n,this._leakyBucket[e]=i,!1)}_getPopulatedURL(e){var t;const n=null!==(t=e.fallbackUrl)&&void 0!==t?t:e.urlConfig.getUrl();e.urlConfig.endpoint!==a.Endpoint._initialize&&e.urlConfig.endpoint!==a.Endpoint._download_config_specs||(this._lastUsedInitUrl=n);const i=Object.assign({[a.NetworkParam.SdkKey]:e.sdkKey,[a.NetworkParam.SdkType]:d.SDKType._get(e.sdkKey),[a.NetworkParam.SdkVersion]:v.SDK_VERSION,[a.NetworkParam.Time]:String(Date.now()),[a.NetworkParam.SessionID]:g.SessionID.get(e.sdkKey)},e.params),r=Object.keys(i).map(e=>`${encodeURIComponent(e)}=${encodeURIComponent(i[e])}`).join("&");return`${n}${r?`?${r}`:""}`}_tryEncodeBody(e){var t;const n=(0,c._getWindowSafe)(),i=e.body;if(e.isStatsigEncodable&&!this._options.disableStatsigEncoding&&"string"==typeof i&&null==(0,r._getStatsigGlobalFlag)("no-encode")&&(null==n?void 0:n.btoa))try{e.body=n.btoa(i).split("").reverse().join(""),e.params=Object.assign(Object.assign({},null!==(t=e.params)&&void 0!==t?t:{}),{[a.NetworkParam.StatsigEncoded]:"1"})}catch(t){s.Log.warn(`Request encoding failed for ${e.urlConfig.getUrl()}`,t)}}_tryToCompressBody(e){return i(this,void 0,void 0,function*(){var t;const n=e.body;if("string"==typeof n&&function(e,t){if(!e.isCompressable)return!1;if(null!=(0,r._getStatsigGlobalFlag)("no-compress")||"undefined"==typeof CompressionStream||"undefined"==typeof TextEncoder)return!1;const n=null!=e.urlConfig.customUrl||null!=e.urlConfig.fallbackUrls,i=!0===u.SDKFlags.get(e.sdkKey,"enable_log_event_compression");switch(t.logEventCompressionMode){case f.LogEventCompressionMode.Disabled:return!1;case f.LogEventCompressionMode.Enabled:return!(n&&!i);case f.LogEventCompressionMode.Forced:return!0;default:return!1}}(e,this._options))try{const i=(new TextEncoder).encode(n),r=new CompressionStream("gzip"),o=r.writable.getWriter();o.write(i).catch(s.Log.error),o.close().catch(s.Log.error);const l=r.readable.getReader(),u=[];let d;for(;!(d=yield l.read()).done;)u.push(d.value);const c=u.reduce((e,t)=>e+t.length,0),g=new Uint8Array(c);let _=0;for(const e of u)g.set(e,_),_+=e.length;e.body=g,e.params=Object.assign(Object.assign({},null!==(t=e.params)&&void 0!==t?t:{}),{[a.NetworkParam.IsGzipped]:"1"})}catch(t){s.Log.warn(`Request compression failed for ${e.urlConfig.getUrl()}`,t)}})}_getInternalRequestArgs(e,t){const n=this._fallbackResolver.getActiveFallbackUrl(t.sdkKey,t.urlConfig),i=Object.assign(Object.assign({},t),{method:e,fallbackUrl:n});return"data"in t&&b(i,t.data),i}};const y=e=>!!e.sdkKey||(s.Log.warn("Unable to make request without an SDK key"),!1),b=(e,t)=>{const{sdkKey:n,fallbackUrl:i}=e,r=_.StableID.get(n),o=g.SessionID.get(n),s=d.SDKType._get(n);e.body=JSON.stringify(Object.assign(Object.assign({},t),{statsigMetadata:Object.assign(Object.assign({},v.StatsigMetadataProvider.get()),{stableID:r,sessionID:o,sdkType:s,fallbackUrl:i})}))};function S(e,t,n,i,r){e.urlConfig.endpoint===a.Endpoint._initialize&&o.Diagnostics._markInitNetworkReqEnd(e.sdkKey,o.Diagnostics._getDiagnosticsData(t,n,i,r))}},8225:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StatsigMetadataProvider=t.SDK_VERSION=void 0,t.SDK_VERSION="3.20.2";let n={sdkVersion:t.SDK_VERSION,sdkType:"js-mono"};t.StatsigMetadataProvider={get:()=>n,add:e=>{n=Object.assign(Object.assign({},n),e)}}},8238:function(e,t,n){var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),r=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),r(n(9950),t)},8495:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},8683:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},8709:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DataAdapterCachePrefix=void 0,t.DataAdapterCachePrefix="statsig.cached"},8743:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._setObjectInStorage=t._getObjectFromStorage=t.Storage=void 0;const i=n(3421),r=n(4845),o={},s={isReady:()=>!0,isReadyResolver:()=>null,getProviderName:()=>"InMemory",getItem:e=>o[e]?o[e]:null,setItem:(e,t)=>{o[e]=t},removeItem:e=>{delete o[e]},getAllKeys:()=>Object.keys(o)};let a=null;try{const e=(0,r._getWindowSafe)();e&&e.localStorage&&"function"==typeof e.localStorage.getItem&&(a={isReady:()=>!0,isReadyResolver:()=>null,getProviderName:()=>"LocalStorage",getItem:t=>e.localStorage.getItem(t),setItem:(t,n)=>e.localStorage.setItem(t,n),removeItem:t=>e.localStorage.removeItem(t),getAllKeys:()=>Object.keys(e.localStorage)})}catch(e){i.Log.warn("Failed to setup localStorageProvider.")}let l=null!=a?a:s,u=l;function d(e){try{return e()}catch(e){if(e instanceof Error&&"SecurityError"===e.name)return t.Storage._setProvider(s),null;if(e instanceof Error&&"QuotaExceededError"===e.name){const n=t.Storage.getAllKeys().filter(e=>e.startsWith("statsig."));e.message=`${e.message}. Statsig Keys: ${n.length}`}throw e}}t.Storage={isReady:()=>u.isReady(),isReadyResolver:()=>u.isReadyResolver(),getProviderName:()=>u.getProviderName(),getItem:e=>d(()=>u.getItem(e)),setItem:(e,t)=>d(()=>u.setItem(e,t)),removeItem:e=>u.removeItem(e),getAllKeys:()=>u.getAllKeys(),_setProvider:e=>{l=e,u=e},_setDisabled:e=>{u=e?s:l}},t._getObjectFromStorage=function(e){const n=t.Storage.getItem(e);return JSON.parse(null!=n?n:"null")},t._setObjectInStorage=function(e,n){t.Storage.setItem(e,JSON.stringify(n))}},8820:function(e,t){var n=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))(function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t._fetchTxtRecords=void 0;const i=new Uint8Array([0,0,1,0,0,1,0,0,0,0,0,0,13,102,101,97,116,117,114,101,97,115,115,101,116,115,3,111,114,103,0,0,16,0,1]),r=["i","e","d"];t._fetchTxtRecords=function(e){return n(this,void 0,void 0,function*(){const t=yield e("https://cloudflare-dns.com/dns-query",{method:"POST",headers:{"Content-Type":"application/dns-message",Accept:"application/dns-message"},body:i});if(!t.ok){const e=new Error("Failed to fetch TXT records from DNS");throw e.name="DnsTxtFetchError",e}const n=yield t.arrayBuffer();return function(e){const t=e.findIndex((t,n)=>n<200&&"="===String.fromCharCode(t)&&r.includes(String.fromCharCode(e[n-1])));if(-1===t){const e=new Error("Failed to parse TXT records from DNS");throw e.name="DnsTxtParseError",e}let n="";for(let i=t-1;i<e.length;i++)n+=String.fromCharCode(e[i]);return n.split(",")}(new Uint8Array(n))})}},8871:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.NetworkParam=t.NetworkDefault=t.Endpoint=void 0,t.Endpoint={_initialize:"initialize",_rgstr:"rgstr",_download_config_specs:"download_config_specs"},t.NetworkDefault={[t.Endpoint._rgstr]:"https://prodregistryv2.org/v1",[t.Endpoint._initialize]:"https://featureassets.org/v1",[t.Endpoint._download_config_specs]:"https://api.statsigcdn.com/v1"},t.NetworkParam={EventCount:"ec",SdkKey:"k",SdkType:"st",SdkVersion:"sv",Time:"t",SessionID:"sid",StatsigEncoded:"se",IsGzipped:"gz"}},9043:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Diagnostics=void 0;const n=new Map,i="start",r="end";function o(e,t,n,i){return Object.assign({key:n,action:t,step:i,timestamp:Date.now()},e)}function s(e,t){var i;const r=null!==(i=n.get(e))&&void 0!==i?i:[];r.push(t),n.set(e,r)}function a(e,t){if(t in e)return e[t]}t.Diagnostics={_getMarkers:e=>n.get(e),_markInitOverallStart:e=>{s(e,o({},i,"overall"))},_markInitOverallEnd:(e,t,n)=>{s(e,o({success:t,error:t?void 0:{name:"InitializeError",message:"Failed to initialize"},evaluationDetails:n},r,"overall"))},_markInitNetworkReqStart:(e,t)=>{s(e,o(t,i,"initialize","network_request"))},_markInitNetworkReqEnd:(e,t)=>{s(e,o(t,r,"initialize","network_request"))},_markInitProcessStart:e=>{s(e,o({},i,"initialize","process"))},_markInitProcessEnd:(e,t)=>{s(e,o(t,r,"initialize","process"))},_clearMarkers:e=>{n.delete(e)},_formatError(e){if(e&&"object"==typeof e)return{code:a(e,"code"),name:a(e,"name"),message:a(e,"message")}},_getDiagnosticsData(e,n,i,r){var o;return{success:!0===(null==e?void 0:e.ok),statusCode:null==e?void 0:e.status,sdkRegion:null===(o=null==e?void 0:e.headers)||void 0===o?void 0:o.get("x-statsig-region"),isDelta:!0===i.includes('"is_delta":true')||void 0,attempt:n,error:t.Diagnostics._formatError(r)}},_enqueueDiagnosticsEvent(e,n,i,r){const o=t.Diagnostics._getMarkers(i);if(null==o||o.length<=0)return-1;const s=o[o.length-1].timestamp-o[0].timestamp;t.Diagnostics._clearMarkers(i);const a=function(e,t){return{eventName:"statsig::diagnostics",user:e,value:null,metadata:t,time:Date.now()}}(e,{context:"initialize",markers:o.slice(),statsigOptions:r});return n.enqueue(a),s}}},9069:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StableID=void 0;const i=n(7566),r=n(25),o=n(5737),s=n(4203),a=n(2092),l={},u={},d={};function c(e){return`statsig.stable_id.${(0,i._getStorageKey)(e)}`}function g(e,t){const n=c(t);try{(0,s._setObjectInStorage)(n,e)}catch(e){r.Log.warn("Failed to save StableID to storage")}}function _(e,t){if(!u[t]||!document)return;const n=new Date;n.setFullYear(n.getFullYear()+1),document.cookie=`${h(t)}=${encodeURIComponent(e)}; expires=${n.toUTCString()}; path=/`}function h(e){return`statsig.stable_id.${(0,i._getStorageKey)(e)}`}t.StableID={cookiesEnabled:!1,randomID:Math.random().toString(36),get:e=>{if(d[e])return null;if(null!=l[e])return l[e];let t=null;return t=function(e){if(!u[e]||null==(0,o._getDocumentSafe)())return null;const t=document.cookie.split(";");for(const n of t){const[t,i]=n.trim().split("=");if(t===h(e))return decodeURIComponent(i)}return null}(e),null!=t?(l[e]=t,g(t,e),t):(t=function(e){const t=c(e);return(0,s._getObjectFromStorage)(t)}(e),null==t&&(t=(0,a.getUUID)()),g(t,e),_(t,e),l[e]=t,t)},setOverride:(e,t)=>{l[t]=e,g(e,t),_(e,t)},_setCookiesEnabled:(e,t)=>{u[e]=t},_setDisabled:(e,t)=>{d[e]=t}}},9095:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},9152:function(e,t){var n=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))(function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t._fetchTxtRecords=void 0;const i=new Uint8Array([0,0,1,0,0,1,0,0,0,0,0,0,13,102,101,97,116,117,114,101,97,115,115,101,116,115,3,111,114,103,0,0,16,0,1]),r=["i","e","d"];t._fetchTxtRecords=function(e){return n(this,void 0,void 0,function*(){const t=yield e("https://cloudflare-dns.com/dns-query",{method:"POST",headers:{"Content-Type":"application/dns-message",Accept:"application/dns-message"},body:i});if(!t.ok){const e=new Error("Failed to fetch TXT records from DNS");throw e.name="DnsTxtFetchError",e}const n=yield t.arrayBuffer();return function(e){const t=e.findIndex((t,n)=>n<200&&"="===String.fromCharCode(t)&&r.includes(String.fromCharCode(e[n-1])));if(-1===t){const e=new Error("Failed to parse TXT records from DNS");throw e.name="DnsTxtParseError",e}let n="";for(let i=t-1;i<e.length;i++)n+=String.fromCharCode(e[i]);return n.split(",")}(new Uint8Array(n))})}},9234:function(e,t,n){var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))(function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t.StatsigClientBase=void 0,n(4400);const r=n(4400),o=n(2403),s=n(2931),a=n(3421),l=n(9314),u=n(4845),d=n(2714),c=n(1633),g=n(6521),_=n(8743);t.StatsigClientBase=class{constructor(e,t,n,i){var l,g,h,v;this.loadingStatus="Uninitialized",this._initializePromise=null,this._listeners={};const f=this.$emt.bind(this);null!=(null==i?void 0:i.logLevel)&&(a.Log.level=i.logLevel),(null==i?void 0:i.disableStorage)&&_.Storage._setDisabled(!0),(null==i?void 0:i.initialSessionID)&&d.StatsigSession.overrideInitialSessionID(i.initialSessionID,e),(null==i?void 0:i.storageProvider)&&_.Storage._setProvider(i.storageProvider),(null==i?void 0:i.enableCookies)&&c.StableID._setCookiesEnabled(e,i.enableCookies),(null==i?void 0:i.disableStableID)&&c.StableID._setDisabled(e,!0),this._sdkKey=e,this._options=null!=i?i:{},this._memoCache={},this.overrideAdapter=null!==(l=null==i?void 0:i.overrideAdapter)&&void 0!==l?l:null,this._logger=new s.EventLogger(e,f,n,i),this._errorBoundary=new o.ErrorBoundary(e,i,f),this._errorBoundary.wrap(this),this._errorBoundary.wrap(t),this._errorBoundary.wrap(this._logger),n.setErrorBoundary(this._errorBoundary),this.dataAdapter=t,this.dataAdapter.attach(e,i,n),this.storageProvider=_.Storage,null===(v=null===(h=null===(g=this.overrideAdapter)||void 0===g?void 0:g.loadFromStorage)||void 0===h?void 0:h.call(g))||void 0===v||v.catch(e=>this._errorBoundary.logError("OA::loadFromStorage",e)),this._primeReadyRipcord(),function(e,t){var n;if((0,u._isServerEnv)())return;const i=(0,r._getStatsigGlobal)(),o=null!==(n=i.instances)&&void 0!==n?n:{},s=t;null!=o[e]&&a.Log.warn("Creating multiple Statsig clients with the same SDK key can lead to unexpected behavior. Multi-instance support requires different SDK keys."),o[e]=s,i.firstInstance||(i.firstInstance=s),i.instances=o,__STATSIG__=i}(e,this)}updateRuntimeOptions(e){e.loggingEnabled?(this._options.loggingEnabled=e.loggingEnabled,this._logger.setLoggingEnabled(e.loggingEnabled)):null!=e.disableLogging&&(this._options.disableLogging=e.disableLogging,this._logger.setLoggingEnabled(e.disableLogging?"disabled":"browser-only")),null!=e.disableStorage&&(this._options.disableStorage=e.disableStorage,_.Storage._setDisabled(e.disableStorage)),null!=e.enableCookies&&(this._options.enableCookies=e.enableCookies,c.StableID._setCookiesEnabled(this._sdkKey,e.enableCookies)),e.logEventCompressionMode?this._logger.setLogEventCompressionMode(e.logEventCompressionMode):e.disableCompression&&this._logger.setLogEventCompressionMode(g.LogEventCompressionMode.Disabled)}flush(){return this._logger.flush()}shutdown(){return i(this,void 0,void 0,function*(){this.$emt({name:"pre_shutdown"}),this._setStatus("Uninitialized",null),this._initializePromise=null,yield this._logger.stop()})}on(e,t){this._listeners[e]||(this._listeners[e]=[]),this._listeners[e].push(t)}off(e,t){if(this._listeners[e]){const n=this._listeners[e].indexOf(t);-1!==n&&this._listeners[e].splice(n,1)}}$on(e,t){t.__isInternal=!0,this.on(e,t)}$emt(e){var t;const n=t=>{try{t(e)}catch(n){if(!0===t.__isInternal)return void this._errorBoundary.logError(`__emit:${e.name}`,n);a.Log.error("An error occurred in a StatsigClientEvent listener. This is not an issue with Statsig.",e)}};this._listeners[e.name]&&this._listeners[e.name].forEach(e=>n(e)),null===(t=this._listeners["*"])||void 0===t||t.forEach(n)}_setStatus(e,t){this.loadingStatus=e,this._memoCache={},this.$emt({name:"values_updated",status:e,values:t})}_enqueueExposure(e,t,n){!0!==(null==n?void 0:n.disableExposureLog)?this._logger.enqueue(t):this._logger.incrementNonExposureCount(e)}_memoize(e,t){return(n,i)=>{if(this._options.disableEvaluationMemoization)return t(n,i);const r=(0,l.createMemoKey)(e,n,i);return r?(r in this._memoCache||(Object.keys(this._memoCache).length>=3e3&&(this._memoCache={}),this._memoCache[r]=t(n,i)),this._memoCache[r]):t(n,i)}}}},9314:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createMemoKey=t.MemoPrefix=void 0,t.MemoPrefix={_gate:"g",_dynamicConfig:"c",_experiment:"e",_configList:"cl",_layer:"l",_paramStore:"p"};const n=new Set([]),i=new Set(["userPersistedValues"]);t.createMemoKey=function(e,t,r){let o=`${e}|${t}`;if(!r)return o;for(const e of Object.keys(r)){if(i.has(e))return;n.has(e)?o+=`|${e}=true`:o+=`|${e}=${r[e]}`}return o}},9344:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},9361:function(e,t,n){var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))(function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t._isDomainFailure=t.NetworkFallbackResolver=void 0;const r=n(9152),o=n(3735),s=n(3421),a=n(8743),l=6048e5;function u(e,t){var n;const i=null!==(n=null==e?void 0:e.toLowerCase())&&void 0!==n?n:"";return t||i.includes("uncaught exception")||i.includes("failed to fetch")||i.includes("networkerror when attempting to fetch resource")}function d(e){return`statsig.network_fallback.${(0,o._DJB2)(e)}`}function c(e,t){const n=d(e);t&&0!==Object.keys(t).length?a.Storage.setItem(n,JSON.stringify(t)):a.Storage.removeItem(n)}t.NetworkFallbackResolver=class{constructor(e){var t;this._fallbackInfo=null,this._errorBoundary=null,this._dnsQueryCooldowns={},this._networkOverrideFunc=null===(t=e.networkConfig)||void 0===t?void 0:t.networkOverrideFunc}setErrorBoundary(e){this._errorBoundary=e}tryBumpExpiryTime(e,t){var n;const i=null===(n=this._fallbackInfo)||void 0===n?void 0:n[t.endpoint];i&&(i.expiryTime=Date.now()+l,c(e,Object.assign(Object.assign({},this._fallbackInfo),{[t.endpoint]:i})))}getActiveFallbackUrl(e,t){var n,i;if(null!=t.customUrl&&null!=t.fallbackUrls)return null;let r=this._fallbackInfo;null==r&&(r=null!==(n=function(e){const t=d(e),n=a.Storage.getItem(t);if(!n)return null;try{return JSON.parse(n)}catch(e){return s.Log.error("Failed to parse FallbackInfo"),null}}(e))&&void 0!==n?n:{},this._fallbackInfo=r);const o=r[t.endpoint];return!o||Date.now()>(null!==(i=o.expiryTime)&&void 0!==i?i:0)||t.getChecksum()!==o.urlConfigChecksum?(delete r[t.endpoint],this._fallbackInfo=r,c(e,this._fallbackInfo),null):o.url?o.url:null}tryFetchUpdatedFallbackInfo(e,t,n,r){return i(this,void 0,void 0,function*(){var i,o;try{if(!u(n,r))return!1;const o=null==t.customUrl&&null==t.fallbackUrls?yield this._tryFetchFallbackUrlsFromNetwork(t):t.fallbackUrls,s=this._pickNewFallbackUrl(null===(i=this._fallbackInfo)||void 0===i?void 0:i[t.endpoint],o);return!!s&&(this._updateFallbackInfoWithNewUrl(e,t,s),!0)}catch(e){return null===(o=this._errorBoundary)||void 0===o||o.logError("tryFetchUpdatedFallbackInfo",e),!1}})}_updateFallbackInfoWithNewUrl(e,t,n){var i,r,o;const s={urlConfigChecksum:t.getChecksum(),url:n,expiryTime:Date.now()+l,previous:[]},a=t.endpoint,u=null===(i=this._fallbackInfo)||void 0===i?void 0:i[a];u&&s.previous.push(...u.previous),s.previous.length>10&&(s.previous=[]);const d=null===(o=null===(r=this._fallbackInfo)||void 0===r?void 0:r[a])||void 0===o?void 0:o.url;null!=d&&s.previous.push(d),this._fallbackInfo=Object.assign(Object.assign({},this._fallbackInfo),{[a]:s}),c(e,this._fallbackInfo)}_tryFetchFallbackUrlsFromNetwork(e){return i(this,void 0,void 0,function*(){var t;const n=this._dnsQueryCooldowns[e.endpoint];if(n&&Date.now()<n)return null;this._dnsQueryCooldowns[e.endpoint]=Date.now()+144e5;const i=[],o=yield(0,r._fetchTxtRecords)(null!==(t=this._networkOverrideFunc)&&void 0!==t?t:fetch),s=function(e){try{return new URL(e).pathname}catch(e){return null}}(e.defaultUrl);for(const t of o){if(!t.startsWith(e.endpointDnsKey+"="))continue;const n=t.split("=");if(n.length>1){let e=n[1];e.endsWith("/")&&(e=e.slice(0,-1)),i.push(`https://${e}${s}`)}}return i})}_pickNewFallbackUrl(e,t){var n;if(null==t)return null;const i=new Set(null!==(n=null==e?void 0:e.previous)&&void 0!==n?n:[]),r=null==e?void 0:e.url;let o=null;for(const e of t){const t=e.endsWith("/")?e.slice(0,-1):e;if(!i.has(e)&&t!==r){o=t;break}}return o}},t._isDomainFailure=u},9386:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},9652:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},9770:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._typedJsonParse=void 0;const i=n(3421);t._typedJsonParse=function(e,t,n){try{const n=JSON.parse(e);if(n&&"object"==typeof n&&t in n)return n}catch(e){}return i.Log.error(`Failed to parse ${n}`),null}},9839:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StatsigSession=t.SessionID=void 0;const i=n(4681),r=n(8024),o=n(1638),s=n(7047),a=18e5,l=144e5,u={};function d(e,t){return setTimeout(()=>{const t=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instance(e);t&&t.$emt({name:"session_expired"})},t)}function c(e){return`statsig.session_id.${(0,i._getStorageKey)(e)}`}t.SessionID={get:e=>t.StatsigSession.get(e).data.sessionID},t.StatsigSession={get:e=>(null==u[e]&&(u[e]=function(e){let t=function(e){const t=c(e);return(0,o._getObjectFromStorage)(t)}(e);const n=Date.now();return t||(t={sessionID:(0,s.getUUID)(),startTime:n,lastUpdate:n}),{data:t,sdkKey:e}}(e)),function(e){const t=Date.now(),n=e.data;(function({lastUpdate:e}){return Date.now()-e>a}(n)||function({startTime:e}){return Date.now()-e>l}(n))&&(n.sessionID=(0,s.getUUID)(),n.startTime=t),n.lastUpdate=t,function(e,t){const n=c(t);try{(0,o._setObjectInStorage)(n,e)}catch(e){r.Log.warn("Failed to save SessionID")}}(n,e.sdkKey),clearTimeout(e.idleTimeoutID),clearTimeout(e.ageTimeoutID);const i=t-n.startTime,u=e.sdkKey;return e.idleTimeoutID=d(u,a),e.ageTimeoutID=d(u,l-i),e}(u[e])),overrideInitialSessionID:(e,t)=>{u[t]=function(e,t){const n=Date.now();return{data:{sessionID:e,startTime:n,lastUpdate:n},sdkKey:t}}(e,t)}}},9851:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._makeTypedGet=t._mergeOverride=t._makeLayer=t._makeExperiment=t._makeDynamicConfig=t._makeFeatureGate=void 0;const i=n(10);function r(e,t,n,i){var r;return{name:e,details:t,ruleID:null!==(r=null==n?void 0:n.rule_id)&&void 0!==r?r:"default",__evaluation:n,value:i}}function o(e,t,n){var i;const o=null!==(i=null==n?void 0:n.value)&&void 0!==i?i:{};return Object.assign(Object.assign({},r(e,t,n,o)),{get:s(null==n?void 0:n.value)})}function s(e,t){return(n,r)=>{var o;const s=null!==(o=null==e?void 0:e[n])&&void 0!==o?o:null;return null==s?null!=r?r:null:null==r||(0,i._isTypeMatch)(s,r)?(null==t||t(n),s):null!=r?r:null}}t._makeFeatureGate=function(e,t,n){return r(e,t,n,!0===(null==n?void 0:n.value))},t._makeDynamicConfig=o,t._makeExperiment=function(e,t,n){var i;const r=o(e,t,n);return Object.assign(Object.assign({},r),{groupName:null!==(i=null==n?void 0:n.group_name)&&void 0!==i?i:null})},t._makeLayer=function(e,t,n,i){var o,a;return Object.assign(Object.assign({},r(e,t,n,void 0)),{get:s(null==n?void 0:n.value,i),groupName:null!==(o=null==n?void 0:n.group_name)&&void 0!==o?o:null,__value:null!==(a=null==n?void 0:n.value)&&void 0!==a?a:{}})},t._mergeOverride=function(e,t,n,i){return Object.assign(Object.assign(Object.assign({},e),t),{get:s(n,i)})},t._makeTypedGet=s},9950:function(e,t,n){var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))(function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t.LocalOverrideAdapter=void 0;const r=n(1719),o="LocalOverride:Recognized";t.LocalOverrideAdapter=class{constructor(e){this._overrides={gate:{},dynamicConfig:{},experiment:{},layer:{}},this._sdkKey=null!=e?e:null}_getLocalOverridesStorageKey(e){return`statsig.local-overrides.${(0,r._getStorageKey)(e)}`}loadFromStorage(){return i(this,void 0,void 0,function*(){if(null==this._sdkKey)return;r.Storage.isReady()||(yield r.Storage.isReadyResolver());const e=this._getLocalOverridesStorageKey(this._sdkKey),t=r.Storage.getItem(e),n=t?(0,r._typedJsonParse)(t,"gate","LocalOverrideAdapter overrides"):null,i=this._hasInMemoryOverrides();var o,s;n&&(this._overrides=i?(o=n,s=this._overrides,{gate:Object.assign({},o.gate,s.gate),dynamicConfig:Object.assign({},o.dynamicConfig,s.dynamicConfig),experiment:Object.assign({},o.experiment,s.experiment),layer:Object.assign({},o.layer,s.layer)}):n),i&&this._saveOverridesToStorage()})}_saveOverridesToStorage(){if(null==this._sdkKey||!r.Storage.isReady())return;const e=this._getLocalOverridesStorageKey(this._sdkKey);r.Storage.setItem(e,JSON.stringify(this._overrides))}overrideGate(e,t){this._overrides.gate[e]=t,this._overrides.gate[(0,r._DJB2)(e)]=t,this._saveOverridesToStorage()}_warnIfStorageNotReady(){r.Storage.isReady()||r.Log.warn("Storage is not ready. Override removal may not persist.")}removeGateOverride(e){this._warnIfStorageNotReady(),delete this._overrides.gate[e],delete this._overrides.gate[(0,r._DJB2)(e)],this._saveOverridesToStorage()}getGateOverride(e,t){var n;const i=null!==(n=this._overrides.gate[e.name])&&void 0!==n?n:this._overrides.gate[(0,r._DJB2)(e.name)];return null==i?null:Object.assign(Object.assign({},e),{value:i,details:Object.assign(Object.assign({},e.details),{reason:o})})}overrideDynamicConfig(e,t){this._overrides.dynamicConfig[e]=t,this._overrides.dynamicConfig[(0,r._DJB2)(e)]=t,this._saveOverridesToStorage()}removeDynamicConfigOverride(e){this._warnIfStorageNotReady(),delete this._overrides.dynamicConfig[e],delete this._overrides.dynamicConfig[(0,r._DJB2)(e)],this._saveOverridesToStorage()}getDynamicConfigOverride(e,t){return this._getConfigOverride(e,this._overrides.dynamicConfig)}overrideExperiment(e,t){this._overrides.experiment[e]=t,this._overrides.experiment[(0,r._DJB2)(e)]=t,this._saveOverridesToStorage()}removeExperimentOverride(e){this._warnIfStorageNotReady(),delete this._overrides.experiment[e],delete this._overrides.experiment[(0,r._DJB2)(e)],this._saveOverridesToStorage()}getExperimentOverride(e,t){return this._getConfigOverride(e,this._overrides.experiment)}overrideLayer(e,t){this._overrides.layer[e]=t,this._overrides.layer[(0,r._DJB2)(e)]=t,this._saveOverridesToStorage()}removeLayerOverride(e){this._warnIfStorageNotReady(),delete this._overrides.layer[e],delete this._overrides.layer[(0,r._DJB2)(e)],this._saveOverridesToStorage()}getAllOverrides(){return JSON.parse(JSON.stringify(this._overrides))}removeAllOverrides(){this._warnIfStorageNotReady(),this._overrides={gate:{},dynamicConfig:{},experiment:{},layer:{}},this._saveOverridesToStorage()}getLayerOverride(e,t){var n;const i=null!==(n=this._overrides.layer[e.name])&&void 0!==n?n:this._overrides.layer[(0,r._DJB2)(e.name)];return null==i?null:Object.assign(Object.assign({},e),{__value:i,get:(0,r._makeTypedGet)(e.name,i),details:Object.assign(Object.assign({},e.details),{reason:o})})}_getConfigOverride(e,t){var n;const i=null!==(n=t[e.name])&&void 0!==n?n:t[(0,r._DJB2)(e.name)];return null==i?null:Object.assign(Object.assign({},e),{value:i,get:(0,r._makeTypedGet)(e.name,i),details:Object.assign(Object.assign({},e.details),{reason:o})})}_hasInMemoryOverrides(){return Object.keys(this._overrides.gate).length>0||Object.keys(this._overrides.dynamicConfig).length>0||Object.keys(this._overrides.experiment).length>0||Object.keys(this._overrides.layer).length>0}}},9999:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._makeParamStoreGetter=void 0;const i=n(7563),r={disableExposureLog:!0};function o(e){return null==e||!1===e.disableExposureLog}function s(e,t){return null!=t&&!(0,i._isTypeMatch)(e,t)}t._makeParamStoreGetter=function(e,t,n){return(a,l)=>{if(null==t)return l;const u=t[a];if(null==u||null!=l&&(0,i._typeOf)(l)!==u.param_type)return l;switch(u.ref_type){case"static":return function(e){return e.value}(u);case"gate":return function(e,t,n){return e.getFeatureGate(t.gate_name,o(n)?void 0:r).value?t.pass_value:t.fail_value}(e,u,n);case"dynamic_config":return function(e,t,n,i){const a=e.getDynamicConfig(t.config_name,o(i)?void 0:r).get(t.param_name);return s(a,n)?n:a}(e,u,l,n);case"experiment":return function(e,t,n,i){const a=e.getExperiment(t.experiment_name,o(i)?void 0:r).get(t.param_name);return s(a,n)?n:a}(e,u,l,n);case"layer":return function(e,t,n,i){const a=e.getLayer(t.layer_name,o(i)?void 0:r).get(t.param_name);return s(a,n)?n:a}(e,u,l,n);default:return l}}}}},t={};function n(i){var r=t[i];if(void 0!==r)return r.exports;var o=t[i]={exports:{}};return e[i].call(o.exports,o,o.exports,n),o.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var i=n(8238),r=n(5138),o=n(1500);if(window.StatsigSidecar=window.StatsigSidecar||{_statsigInstance:null,_queuedEvents:[],_clientInitialized:!1,_redirKey:"_stsgnoredir",activateExperiment:function(e){this._getMatchingExperiments().includes(e)&&StatsigSidecar._performExperiments([e])},findElementToObserve:function(e){for(;e;){try{const t=document.querySelector(e);if(t)return t}catch(e){}e=e.substring(0,e.lastIndexOf(">"))}return document.body},_flushQueuedEvents:function(){if(0===this._queuedEvents.length)return;if(!this._statsigInstance)return;const e=[...this._queuedEvents];this._queuedEvents=[],e.forEach(e=>{this._statsigInstance.logEvent(e.eventName,e.value,e.metadata)}),this._statsigInstance.flush&&this._statsigInstance.flush()},_getMatchingExperiments:function(){const e=[],t=this._statsigInstance.getConfigList();let n=window.location.href;try{const e=new URL(n);e.searchParams.has("overrideuser")&&e.searchParams.delete("overrideuser"),n=e.toString()}catch(e){}return t.forEach(t=>{const i=this._statsigInstance.getExperiment(t);i.value["!statsig_sidecar_directives"]&&this._isMatchingExperiment(n,i.value.sidecarURLFilters)&&e.push(i.name)}),e},getStatsigInstance:function(){return this._statsigInstance},_isMatchingExperiment:function(e,t){if(!t||0===t.length)return!0;for(const n of t)if("contains"===n.type){if(e.includes(n.value))return!0}else if("equals"===n.type){if(e===n.value)return!0}else if("regex"===n.type){if(RegExp(n.value).test(e))return!0}else if("path"===n.type&&new URL(e).pathname===n.value)return!0;return!1},_isIOS:function(){return/iPad|iPhone|iPod/.test(navigator?.userAgent??"")},logEvent:function(e,t,n){this._statsigInstance&&this._clientInitialized?(this._flushQueuedEvents(),this._statsigInstance.logEvent(e,t,n)):this._queuedEvents.push({eventName:e,value:t,metadata:n})},_observeMutation:function(e,t){new MutationObserver((e,n)=>{setTimeout(()=>{t()},0)}).observe(e,{attributes:!0,childList:!0,characterData:!0,subtree:!0,characterDataOldValue:!1}),t()},_observePageChanges:function(e){const t=history.pushState,n=history.replaceState,i=()=>{StatsigSidecar.runAllExperiments(e)};history.pushState=function(...e){t.apply(history,e),i()},history.replaceState=function(...e){n.apply(history,e),i()},window.addEventListener("hashchange",i),window.addEventListener("popstate",i)},_performAfterLoad:function(e){/complete|interactive|loaded/.test(document.readyState)?e():document.addEventListener("DOMContentLoaded",()=>{e()})},performAttributeChange:function(e,t,n,i=[]){e&&this.setupMutationObserver(e,()=>{const r=document.querySelector(e);r&&r.getAttribute(t)!==n&&(r.setAttribute(t,n),i?.forEach(e=>{r.removeAttribute(e)}))})},performContentChange:function(e,t){e&&this.setupMutationObserver(e,()=>{const n=document.querySelector(e);n&&n.innerHTML!==t&&(n.innerHTML=t)})},_performDirective:function(e){switch(console.log(e),e.type){case"content":this._performAfterLoad(()=>{this.performContentChange(e.selector,e.value)});break;case"style":this._performAfterLoad(()=>{this.performStyleChange(e.selector,e.key,e.value)});break;case"properties":this._performAfterLoad(()=>{e.metadata?.forEach(e=>{"style"===e.type?this.performStyleChange(e.selector,e.name,e.value):"attribute"===e.type&&this.performAttributeChange(e.selector,e.name,e.value)})});break;case"attribute":this._performAfterLoad(()=>{this.performAttributeChange(e.selector,e.key,e.value)});break;case"image":this._performAfterLoad(()=>{this.performAttributeChange(e.selector,"src",e.value,["srcset"])});break;case"reorder":this._performAfterLoad(()=>{this.performReorderElement(e.selector,e.operator,e.value)});break;case"code":this.performInjectScript(e.value);break;case"inject-style":this.performInjectStyle(e.value);break;case"redirect":this.redirectPage(e.value)}},_performExperiments:function(e){Array.isArray(e)&&e.forEach(e=>{this._statsigInstance.getExperiment(e).get("!statsig_sidecar_directives",[]).forEach(e=>{try{this._performDirective(e)}catch(e){console.error("Failed to perform directive:",e)}})})},performInjectScript:function(e){const t=document.createElement("script");t.setAttribute("nonce",this.scriptNonce),t.nonce=this.scriptNonce,t.innerHTML=e,document.head.appendChild(t)},performInjectStyle:function(e){const t=document.createElement("style");t.innerHTML=e,document.head.appendChild(t)},performReorderElement:function(e,t,n){e&&this.setupMutationObserver(e,()=>{const i=document.querySelector(e),r=document.querySelector(n);if(i&&r)switch(t){case"before":r.before(i);break;case"after":r.after(i);break;case"first":r.prepend(i);break;case"last":r.append(i)}})},performStyleChange:function(e,t,n){e&&this.setupMutationObserver(e,()=>{const i=document.querySelector(e);i&&i.style.setProperty(t,n)})},processEvent:function(e){if(!e||!e.detail)return!1;const t=e.detail;return"inject-script"===t.name?(this.performInjectScript(t.value),!1):void 0},redirectPage:async function(e){if(this._flushQueuedEvents(),window&&window.location&&e&&window.location.href!=e)try{const t=new URL(window.location.href);if(t.searchParams.has(this._redirKey))return;const n=new URL(e,t);for(const e of t.searchParams.keys())n.searchParams.has(e)||n.searchParams.set(e,t.searchParams.get(e));n.searchParams.set(this._redirKey,"1"),this._isIOS()&&await this._statsigInstance.flush(),window.location.href=n.toString()}catch(t){window.location.href=e}},resetBody:function(){const e=document.getElementById("__sbpd");e&&e.parentElement.removeChild(e)},runAllExperiments:function(e=null){if(!e){const t=this._getMatchingExperiments();this._runPreExperimentScripts(t),e=t.filter(e=>!e.disableAutoRun).map(e=>e.id)}if(e)try{this._performExperiments(e)}catch(e){console.error("Failed to perform experiments:",e)}this.resetBody(),window?.postExperimentCallback&&window.postExperimentCallback(this._statsigInstance,e)},_runPreExperimentScripts:function(e){e?.forEach(e=>{e.prerunScript&&"prestart"!==this._statsigInstance.getExperiment(e).ruleID&&this.performInjectScript(e.prerunScript)})},setupMutationObserver:function(e,t){const n=this.findElementToObserve(e);n&&this._observeMutation(n,t)},setupStatsigSdk:async function(e,t,n,s,a){let l=null,u=null;try{const e=new URL(window.location.href);l=e.searchParams.get("overrideuser"),u=e.searchParams.get("overrideexp")}catch(e){console.error("Failed to update user:",e)}try{const d=window?.statsigUser??{};l&&(d.userID=l,d.customIDs=d.customIDs||{},d.customIDs.stableID=l);const c=window?.statsigOptions??{};if(c.disableLogging=!n,(s||a)&&(c.networkConfig={initializeUrl:s,logEventUrl:a}),u){const e=new i.LocalOverrideAdapter;c.overrideAdapter=e,e.overrideExperiment("sidecar",JSON.parse(u))}this._statsigInstance=new r.StatsigClient(e,d,c),await this._statsigInstance.initializeAsync(),(0,o.gX)(this._statsigInstance),this._clientInitialized=!0,this._flushQueuedEvents(),this._observePageChanges(t),this.runAllExperiments(t)}catch(e){console.error("Failed to initialize Statsig:",e)}this.resetBody()}},document.currentScript&&document.currentScript.src){const e=new URL(document.currentScript.src),t=e.searchParams.get("apikey"),n=e.searchParams.get("multiexpids"),i=e.searchParams.get("initializeurl"),r=e.searchParams.get("logeventurl"),o="0"!==e.searchParams.get("autostart"),s="0"!==e.searchParams.get("reduceflicker");if(StatsigSidecar.scriptNonce=document.currentScript.nonce,t){s&&(document.write('<style id="__sbpd">body { display: none; }</style>\n'),setTimeout(()=>{StatsigSidecar.resetBody()},1e3));const e=n?n.split(","):null;StatsigSidecar.setupStatsigSdk(t,e,o,i,r),document.addEventListener(`sidecar_${t}`,e=>{StatsigSidecar.processEvent(e),e.preventDefault()})}}})();
2
+ //# sourceMappingURL=index.js.map