statsig-sidecar-v2-beta 2.5.0 → 2.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- (()=>{"use strict";var e={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},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}`)}},8683(e,t){Object.defineProperty(t,"__esModule",{value:!0})},5638(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})}},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)}}},4387(e,t){Object.defineProperty(t,"__esModule",{value:!0})},4358(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){}}}},3194(e,t){Object.defineProperty(t,"__esModule",{value:!0})},6913(e,t){Object.defineProperty(t,"__esModule",{value:!0})},5434(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}}},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}},7061(e,t){Object.defineProperty(t,"__esModule",{value:!0})},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},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={}))},4703(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)},2509(e,t){Object.defineProperty(t,"__esModule",{value:!0})},5025(e,t){Object.defineProperty(t,"__esModule",{value:!0})},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)}}},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}}},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)}}},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)}}},4351(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)}}},1180(e,t){Object.defineProperty(t,"__esModule",{value:!0})},2166(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.DataAdapterCachePrefix=void 0,t.DataAdapterCachePrefix="statsig.cached"},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)},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)}}},7754(e,t){Object.defineProperty(t,"__esModule",{value:!0})},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},9652(e,t){Object.defineProperty(t,"__esModule",{value:!0})},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}},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))}},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}},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)}},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)})}},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}`)}},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)})},6978(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})},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},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}`)}},2628(e,t){Object.defineProperty(t,"__esModule",{value:!0})},7043(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})}},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}}},9152(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))})}},7450(e,t){Object.defineProperty(t,"__esModule",{value:!0})},2403(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){}}}},3915(e,t){Object.defineProperty(t,"__esModule",{value:!0})},9344(e,t){Object.defineProperty(t,"__esModule",{value:!0})},2931(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},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}},9386(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},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}},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"}},8074(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))}},9361(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},4420(e,t){Object.defineProperty(t,"__esModule",{value:!0})},1952(e,t){Object.defineProperty(t,"__esModule",{value:!0})},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}}},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)}}},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"}},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)}}},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}},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}}},9234(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)}}}},637(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.ErrorTag=void 0,t.ErrorTag={NetworkError:"NetworkError"}},8709(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.DataAdapterCachePrefix=void 0,t.DataAdapterCachePrefix="statsig.cached"},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)},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)}}},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"}},9095(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},8495(e,t){Object.defineProperty(t,"__esModule",{value:!0})},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."}},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}},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))}},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}},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)}},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)})}},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)}}},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)})},7563(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})},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}}},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})}}},2944(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},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}}}},7686(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},2451(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},5138(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},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},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}`)}},1848(e,t){Object.defineProperty(t,"__esModule",{value:!0})},7791(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})}},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}}},8820(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))})}},5374(e,t){Object.defineProperty(t,"__esModule",{value:!0})},6599(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){}}}},3511(e,t){Object.defineProperty(t,"__esModule",{value:!0})},5804(e,t){Object.defineProperty(t,"__esModule",{value:!0})},3815(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},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}},3302(e,t){Object.defineProperty(t,"__esModule",{value:!0})},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},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}},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"}},790(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))}},621(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},6488(e,t){Object.defineProperty(t,"__esModule",{value:!0})},7700(e,t){Object.defineProperty(t,"__esModule",{value:!0})},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}}},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)}}},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"}},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)}}},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}},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}}},7142(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)}}}},2617(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.ErrorTag=void 0,t.ErrorTag={NetworkError:"NetworkError"}},3601(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.DataAdapterCachePrefix=void 0,t.DataAdapterCachePrefix="statsig.cached"},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)},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)}}},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"}},3347(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},5795(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."}},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}},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))}},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}},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)}},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)})}},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)}}},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)})},1719(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})},9950(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}}},8238(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)},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},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}},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__},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"})}}},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.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}();var i=n(8238),r=n(5138),o=n(1500);const s="data-statsig-element-id",a="sidecar-v2-beta",l="2.5.0",u={},d=window.StatsigSidecar||{};if(window.StatsigSidecar=Object.assign(d,{_statsigInstance:null,_queuedEvents:[],_clientInitialized:!1,_redirKey:"_stsgnoredir",_stableIdMap:u,_appliedInserts:new Set,activateExperiment:function(e){const t=this._getMatchingExperiments().find(t=>t.value.sidecarExperimentName===e);t&&StatsigSidecar._performExperiments([t.name])},findElementToObserve:function(e){for(;e;){try{const t=this.resolveElement(e);if(t)return t}catch(e){}e=e.substring(0,e.lastIndexOf(">"))}return document.body},applyStableIdMap:function(){const e=u||{};Object.keys(e).forEach(t=>{const n=e[t];if(!n)return;const i=document.querySelector(t);i&&!i.hasAttribute(s)&&i.setAttribute(s,n)})},resolveElement:function(e){const t=document.querySelector(e);if(t){const n=this._ensureStableId(t);u[e]=n}const n=u?.[e];if(n){const e=document.querySelector(`[${s}="${n}"]`);if(e)return e}return t},_mergeStableIdMap:function(e){e&&"object"==typeof e&&Object.assign(u,e)},_constructQueryString:function(e){if(e.id)return`[id="${e.id}"]`;const t=e.tagName.toLowerCase(),n=e.parentElement;if(!n||"body"===t)return"body";const i=Array.from(n.children).findIndex(t=>t===e);return`${this._constructQueryString(n)} > ${t}:nth-child(${i+1})`},_ensureStableId:function(e){let t=e.getAttribute(s);return t||(t=`statsig-element-${Math.random().toString(36).slice(2,10)}`,e.setAttribute(s,t)),t},_updateStableIdMapForElements:function(e){e.forEach(e=>{if(!e||1!==e.nodeType)return;const t=this._ensureStableId(e),n=this._constructQueryString(e);u[n]=t})},_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()},_getSidecarConfig:function(){const e=window?.statsigSidecarConfig;return e&&"object"==typeof e?e:{}},_emitExperimentEvaluation:function(e){if(!e)return;const t=this._getSidecarConfig().onExperimentEvaluation;if("function"==typeof t)try{t({name:"experiment_evaluation",experiment:e})}catch(e){console.error("Failed to run onExperimentEvaluation callback:",e)}},_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,{disableExposureLog:!0});i.value["!statsig_sidecar_directives"]&&this._isMatchingExperiment(n,i.value.sidecarURLFilters)&&e.push(i)}),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=this.resolveElement(e);r&&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=this.resolveElement(e);n&&n&&n.innerHTML!==t&&(n.innerHTML=t)})},_performDirective:function(e){switch(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(t=>{"style"===t.type?this.performStyleChange(e.selector,t.name,t.value):"attribute"===t.type&&this.performAttributeChange(e.selector,t.name,t.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,e.metadata?.after)});break;case"insert":this._performAfterLoad(()=>{this.performInsertElement(e.selector,e.value,e.metadata?.position)});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)&&(this._appliedInserts=new Set,e.forEach(e=>{const t=this._statsigInstance.getExperiment(e);this._emitExperimentEvaluation(t);const n=t.get("!statsig_sidecar_directives",[]),i=t.get("!statsig_sidecar_stable_id_map",{});this._mergeStableIdMap(i),n.forEach(e=>{this._mergeStableIdMap(e?.metadata?.stableIdMap),this._mergeStableIdMap(e?.stableIdMap)}),this.applyStableIdMap(),n.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,i){e&&this.setupMutationObserver(e,()=>{const r=this.resolveElement(e),o=this.resolveElement(n);if(!r||!o)return;const s=r.parentElement,a="first"===t||"last"===t?o:o.parentElement;let l=null;if(s&&a)if(s===a){const e=Array.from(a.children),t=e.indexOf(r),n=e.indexOf(o);if(-1!==t&&-1!==n){const i=Math.min(t,n),r=Math.max(t,n);l=e.slice(i,r+1),this._updateStableIdMapForElements(l)}}else l=[...Array.from(s.children),...Array.from(a.children)],this._updateStableIdMapForElements(l);if(void 0!==i)return i?o.insertAdjacentElement("afterend",r):o.insertAdjacentElement("beforebegin",r),void(l&&this._updateStableIdMapForElements(l));switch(t){case"before":o.before(r);break;case"after":o.after(r);break;case"first":o.prepend(r);break;case"last":o.append(r)}l&&this._updateStableIdMapForElements(l)})},performInsertElement:function(e,t,n){if(!e||!t||!n)return;const i=`${e}|${t}|${n}`;this.setupMutationObserver(e,()=>{if(this._appliedInserts.has(i))return;const r=this.resolveElement(e);if(!r)return;let o=null;if("beforebegin"===n||"afterend"===n){const e=r.parentElement;if(e){const t=Array.from(e.children),i=t.indexOf(r),s="beforebegin"===n?i:i+1;-1!==i&&(o=t.slice(s),this._updateStableIdMapForElements(o))}}else{const e=Array.from(r.children),t="afterbegin"===n?0:e.length;o=e.slice(t),this._updateStableIdMapForElements(o)}const s=document.createElement(t);r.insertAdjacentElement(n,s),o&&this._updateStableIdMapForElements(o),this._updateStableIdMapForElements([s]),this._appliedInserts.add(i)})},performStyleChange:function(e,t,n){e&&this.setupMutationObserver(e,()=>{const i=this.resolveElement(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.value.sidecarDisableAutoRun).map(e=>e.name)}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.value.sidecarPrerunScript&&this.performInjectScript(e.value.sidecarPrerunScript)})},setupMutationObserver:function(e,t){const n=this.findElementToObserve(e);n&&this._observeMutation(n,t)},setupStatsigSdk:async function(e,t,n,s,u){let d=null,c=null,g=null;try{const e=new URL(window.location.href);d=e.searchParams.get("overrideuser"),c=e.searchParams.get("overrideexp"),g=e.searchParams.get("overrideexpname")}catch(e){console.error("Failed to update user:",e)}try{const _=window?.statsigUser??{};d&&(_.userID=d,_.customIDs=_.customIDs||{},_.customIDs.stableID=d);const h=window?.statsigOptions??{};h.disableLogging=!n;const v=h?.networkConfig?.networkOverrideFunc,f=e=>{try{const t=new URL(e);return t.searchParams.set("st",a),t.searchParams.set("sv",l),t.toString()}catch(t){return e}};if((s||u)&&(h.networkConfig={...h.networkConfig??{},initializeUrl:s,logEventUrl:u}),h.networkConfig={...h.networkConfig??{},networkOverrideFunc:(e,t)=>{const n=f(e);return v?v(n,t):fetch(n,t)}},c&&g){const e=new i.LocalOverrideAdapter;h.overrideAdapter=e,e.overrideExperiment(g,JSON.parse(c))}r.StatsigMetadataProvider.add({sdkType:a,sdkVersion:l}),this._statsigInstance=new r.StatsigClient(e,_,h),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()})}}})();
1
+ (()=>{var e={10:(e,t)=>{"use strict";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)}},52:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))(function(s,r){function o(e){try{l(i.next(e))}catch(e){r(e)}}function a(e){try{l(i.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,a)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t._isDomainFailure=t.NetworkFallbackResolver=void 0;const s=n(457),r=n(3918),o=n(8024),a=n(1638),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 c(e){return`statsig.network_fallback.${(0,r._DJB2)(e)}`}function d(e,t){const n=c(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,d(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 s=this._fallbackInfo;null==s&&(s=null!==(n=function(e){const t=c(e),n=a.Storage.getItem(t);if(!n)return null;try{return JSON.parse(n)}catch(e){return o.Log.error("Failed to parse FallbackInfo"),null}}(e))&&void 0!==n?n:{},this._fallbackInfo=s);const r=s[t.endpoint];return!r||Date.now()>(null!==(i=r.expiryTime)&&void 0!==i?i:0)||t.getChecksum()!==r.urlConfigChecksum?(delete s[t.endpoint],this._fallbackInfo=s,d(e,this._fallbackInfo),null):r.url?r.url:null}tryFetchUpdatedFallbackInfo(e,t,n,s){return i(this,void 0,void 0,function*(){var i,r;try{if(!u(n,s))return!1;const r=null==t.customUrl&&null==t.fallbackUrls?yield this._tryFetchFallbackUrlsFromNetwork(t):t.fallbackUrls,o=this._pickNewFallbackUrl(null===(i=this._fallbackInfo)||void 0===i?void 0:i[t.endpoint],r);return!!o&&(this._updateFallbackInfoWithNewUrl(e,t,o),!0)}catch(e){return null===(r=this._errorBoundary)||void 0===r||r.logError("tryFetchUpdatedFallbackInfo",e),!1}})}_updateFallbackInfoWithNewUrl(e,t,n){var i,s,r;const o={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&&o.previous.push(...u.previous),o.previous.length>10&&(o.previous=[]);const c=null===(r=null===(s=this._fallbackInfo)||void 0===s?void 0:s[a])||void 0===r?void 0:r.url;null!=c&&o.previous.push(c),this._fallbackInfo=Object.assign(Object.assign({},this._fallbackInfo),{[a]:o}),d(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=[],r=yield(0,s._fetchTxtRecords)(null!==(t=this._networkOverrideFunc)&&void 0!==t?t:fetch),o=function(e){try{return new URL(e).pathname}catch(e){return null}}(e.defaultUrl);for(const t of r){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}${o}`)}}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:[]),s=null==e?void 0:e.url;let r=null;for(const e of t){const t=e.endsWith("/")?e.slice(0,-1):e;if(!i.has(e)&&t!==s){r=t;break}}return r}},t._isDomainFailure=u},414:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t._cloneObject=t._getUnloadEvent=t._getCurrentPageUrlSafe=t._addDocumentEventListenerSafe=t._addWindowEventListenerSafe=t._isServerEnv=t._getDocumentSafe=t._getWindowSafe=void 0;const i=n(8024);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"},t._cloneObject=(e,t)=>{try{return JSON.parse(JSON.stringify(t))}catch(t){return i.Log.error(`Failed to clone object ${e}`),null}}},457:function(e,t){"use strict";var n=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))(function(s,r){function o(e){try{l(i.next(e))}catch(e){r(e)}}function a(e){try{l(i.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,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]),s=["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)&&s.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))})}},652:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(){this._clicks=[]}isRageClick(e,t,n){return this._clicks=this._clicks.filter(e=>n-e.timestamp<1e3),this._clicks.length>0&&!(n=>{const i=e-n.x,s=t-n.y;return Math.abs(i)+Math.abs(s)<=30})(this._clicks[this._clicks.length-1])&&(this._clicks=[]),this._clicks.push({x:e,y:t,timestamp:n}),this._clicks.length>=3}}},686:(e,t)=>{"use strict";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)}}},843:(e,t)=>{"use strict";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,s){let r=`${e}|${t}`;if(!s)return r;for(const e of Object.keys(s)){if(i.has(e))return;n.has(e)?r+=`|${e}=true`:r+=`|${e}=${s[e]}`}return r}},882:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Diagnostics=void 0;const n=new Map,i="start",s="end";function r(e,t,n,i){return Object.assign({key:n,action:t,step:i,timestamp:Date.now()},e)}function o(e,t){var i;const s=null!==(i=n.get(e))&&void 0!==i?i:[];s.push(t),n.set(e,s)}function a(e,t){if(t in e)return e[t]}t.Diagnostics={_getMarkers:e=>n.get(e),_markInitOverallStart:e=>{o(e,r({},i,"overall"))},_markInitOverallEnd:(e,t,n)=>{o(e,r({success:t,error:t?void 0:{name:"InitializeError",message:"Failed to initialize"},evaluationDetails:n},s,"overall"))},_markInitNetworkReqStart:(e,t)=>{o(e,r(t,i,"initialize","network_request"))},_markInitNetworkReqEnd:(e,t)=>{o(e,r(t,s,"initialize","network_request"))},_markInitProcessStart:e=>{o(e,r({},i,"initialize","process"))},_markInitProcessEnd:(e,t)=>{o(e,r(t,s,"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,s){var r;return{success:!0===(null==e?void 0:e.ok),statusCode:null==e?void 0:e.status,sdkRegion:null===(r=null==e?void 0:e.headers)||void 0===r?void 0:r.get("x-statsig-region"),isDelta:!0===i.includes('"is_delta":true')||void 0,attempt:n,error:t.Diagnostics._formatError(s)}},_enqueueDiagnosticsEvent(e,n,i,s){const r=t.Diagnostics._getMarkers(i);if(null==r||r.length<=0)return-1;const o=r[r.length-1].timestamp-r[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:r.slice(),statsigOptions:s});return n.enqueue(a),o}}},1148:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UPDATE_DETAIL_ERROR_MESSAGES=t.createUpdateDetails=void 0,t.createUpdateDetails=(e,t,n,i,s,r)=>({duration:n,source:t,success:e,error:i,sourceUrl:s,warnings:r}),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."}},1180:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ErrorTag=void 0,t.ErrorTag={NetworkError:"NetworkError"}},1235:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DeadClickConfig=void 0;const i=n(6978),s=n(3439),r=n(7624),o=n(5641),a=n(3884);t.DeadClickConfig={CLICK_CHECK_TIMEOUT:1e3,SCROLL_DELAY_MS:100,SELECTION_CHANGE_DELAY_MS:100,MUTATION_DELAY_MS:2500,ABSOLUTE_DEAD_CLICK_TIMEOUT:2750},t.default=class{constructor(e,n){this._enqueueFn=e,this._errorBoundary=n,this._lastMutationTime=0,this._lastSelectionChangeTime=0,this._clicks=[],this._deadClickConfig=t.DeadClickConfig,this._handleScroll=(0,r.throttle)(()=>{const e=Date.now();this._clicks.forEach(t=>{t.scrollDelayMs||(t.scrollDelayMs=e-t.timestamp)})},50)}startTracking(){try{const e=(0,i._getWindowSafe)();if(!e)return;e.addEventListener("click",e=>this._handleClick(e),{capture:!0}),e.addEventListener("scroll",()=>this._handleScroll(),{capture:!0,passive:!0}),e.addEventListener("selectionchange",()=>this._handleSelectionChange()),this._setupMutationObserver()}catch(e){i.Log.error("Error starting dead click tracking",e),this._errorBoundary.logError("autoCapture:DeadClickManager",e)}}_handleClick(e){var t,n;const s=e.target;if(!s)return;const o={timestamp:Date.now(),eventTarget:s};r.interactiveElements.includes(null===(t=null==s?void 0:s.tagName)||void 0===t?void 0:t.toLowerCase())||this._clicks.push(o),this._clicks.length&&!this._clickCheckTimer&&(this._clickCheckTimer=null===(n=(0,i._getWindowSafe)())||void 0===n?void 0:n.setTimeout(()=>{this._checkForDeadClick()},this._deadClickConfig.CLICK_CHECK_TIMEOUT))}_handleSelectionChange(){this._lastSelectionChangeTime=Date.now()}_setupMutationObserver(){const e=(0,i._getDocumentSafe)();e&&(this._observer=new MutationObserver(()=>{this._lastMutationTime=Date.now()}),this._observer.observe(e.body,{childList:!0,subtree:!0,attributes:!0,characterData:!0}))}_checkForDeadClick(){var e;if(!this._clicks.length)return;clearTimeout(this._clickCheckTimer),this._clickCheckTimer=void 0;const t=this._clicks;this._clicks=[];for(const e of t){this._updateClickDelayMs(e);const t=null!=e.scrollDelayMs&&e.scrollDelayMs<this._deadClickConfig.SCROLL_DELAY_MS,n=null!=e.selectionChangeDelayMs&&e.selectionChangeDelayMs<this._deadClickConfig.SELECTION_CHANGE_DELAY_MS,i=null!=e.mutationDelayMs&&e.mutationDelayMs<this._deadClickConfig.MUTATION_DELAY_MS;if(t||n||i)continue;const s=null!=e.scrollDelayMs&&e.scrollDelayMs>this._deadClickConfig.SCROLL_DELAY_MS,r=null!=e.selectionChangeDelayMs&&e.selectionChangeDelayMs>this._deadClickConfig.SELECTION_CHANGE_DELAY_MS,o=null!=e.mutationDelayMs&&e.mutationDelayMs>this._deadClickConfig.MUTATION_DELAY_MS,a=null!=e.absoluteDelayMs&&e.absoluteDelayMs>this._deadClickConfig.ABSOLUTE_DEAD_CLICK_TIMEOUT;s||r||o||a?this._logDeadClick(e,{scrollTimeout:s,selectionChangeTimeout:r,mutationTimeout:o,absoluteTimeout:a}):null!=e.absoluteDelayMs&&e.absoluteDelayMs<this._deadClickConfig.ABSOLUTE_DEAD_CLICK_TIMEOUT&&this._clicks.push(e)}this._clicks.length&&!this._clickCheckTimer&&(this._clickCheckTimer=null===(e=(0,i._getWindowSafe)())||void 0===e?void 0:e.setTimeout(()=>{this._checkForDeadClick()},this._deadClickConfig.CLICK_CHECK_TIMEOUT))}_logDeadClick(e,t){const{value:n,metadata:i}=(0,o._gatherEventData)(e.eventTarget);n&&this._enqueueFn(s.AutoCaptureEventName.DEAD_CLICK,n,Object.assign(Object.assign(Object.assign(Object.assign({},i),t),(0,a._gatherCommonMetadata)((0,r._getSafeUrl)())),{scrollDelayMs:e.scrollDelayMs,selectionChangeDelayMs:e.selectionChangeDelayMs,mutationDelayMs:e.mutationDelayMs,absoluteDelayMs:e.absoluteDelayMs}))}_updateClickDelayMs(e){!e.mutationDelayMs&&this._lastMutationTime>0&&e.timestamp<=this._lastMutationTime&&(e.mutationDelayMs=Date.now()-this._lastMutationTime),!e.selectionChangeDelayMs&&this._lastSelectionChangeTime>0&&e.timestamp<=this._lastSelectionChangeTime&&(e.selectionChangeDelayMs=Date.now()-this._lastSelectionChangeTime),e.absoluteDelayMs=Date.now()-e.timestamp}}},1500:(e,t,n)=>{"use strict";t.gX=void 0;const i=n(6978),s=n(7463);Object.defineProperty(t,"gX",{enumerable:!0,get:function(){return s.runStatsigAutoCapture}});n(3439);Object.assign((0,i._getStatsigGlobal)(),{AutoCapture:s.AutoCapture,runStatsigAutoCapture:s.runStatsigAutoCapture,StatsigAutoCapturePlugin:s.StatsigAutoCapturePlugin})},1570:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t._getUnitIDFromUser=t._getFullUserHash=t._normalizeUser=void 0;const i=n(3918),s=n(8024),r=n(414);t._normalizeUser=function(e,t,n){const i=(0,r._cloneObject)("StatsigUser",e);return null==i?(s.Log.error("Failed to clone user"),{statsigEnvironment:void 0}):(null!=t&&null!=t.environment?i.statsigEnvironment=t.environment:null!=n&&(i.statsigEnvironment={tier:n}),i)},t._getFullUserHash=function(e){return e?(0,i._DJB2Object)(e):null},t._getUnitIDFromUser=function(e,t){var n,i,s;if("string"!=typeof t)return e.userID;const r=t.toLowerCase();return"userid"!==r?null!==(i=null===(n=e.customIDs)||void 0===n?void 0:n[t])&&void 0!==i?i:null===(s=e.customIDs)||void 0===s?void 0:s[r]:e.userID}},1638:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t._setObjectInStorage=t._getObjectFromStorage=t.Storage=void 0;const i=n(8024),s=n(414),r={},o={isReady:()=>!0,isReadyResolver:()=>null,getProviderName:()=>"InMemory",getItem:e=>r[e]?r[e]:null,setItem:(e,t)=>{r[e]=t},removeItem:e=>{delete r[e]},getAllKeys:()=>Object.keys(r)};let a=null;try{const e=(0,s._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:o,u=l;function c(e){try{return e()}catch(e){if(e instanceof Error&&"SecurityError"===e.name)return t.Storage._setProvider(o),null;throw e}}t.Storage={isReady:()=>u.isReady(),isReadyResolver:()=>u.isReadyResolver(),getProviderName:()=>u.getProviderName(),getItem:e=>c(()=>u.getItem(e)),setItem:(e,t)=>c(()=>u.setItem(e,t)),removeItem:e=>u.removeItem(e),getAllKeys:()=>u.getAllKeys(),_setProvider:e=>{l=e,u=e},_setDisabled:e=>{u=e?o:l}},t._getObjectFromStorage=function(e){const n=t.Storage.getItem(e);try{return JSON.parse(null!=n?n:"null")}catch(t){return i.Log.error(`Failed to parse value for key "${e}"`),null}},t._setObjectInStorage=function(e,n){t.Storage.setItem(e,JSON.stringify(n))}},2108:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PendingEvents=void 0;const i=n(8024);t.PendingEvents=class{constructor(e){this._pendingEvents=[],this._batchSize=e}addToPendingEventsQueue(e){this._pendingEvents.push(e),i.Log.debug("Enqueued Event:",e)}hasEventsForFullBatch(){return this._pendingEvents.length>=this._batchSize}takeAll(){const e=this._pendingEvents;return this._pendingEvents=[],e}isEmpty(){return 0===this._pendingEvents.length}}},2166:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DataAdapterCachePrefix=void 0,t.DataAdapterCachePrefix="statsig.cached"},2451:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))(function(s,r){function o(e){try{l(i.next(e))}catch(e){r(e)}}function a(e){try{l(i.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,a)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t.StatsigEvaluationsDataAdapter=void 0;const s=n(6978),r=n(2944);class o extends s.DataAdapterCore{constructor(){super("EvaluationsDataAdapter","evaluations"),this._network=null,this._options=null}attach(e,t,n){super.attach(e,t,n),null!==n&&n instanceof r.default?this._network=n:this._network=new r.default(null!=t?t:{})}getDataAsync(e,t,n){return this._getDataAsyncImpl(e,(0,s._normalizeUser)(t,this._options),n)}prefetchData(e,t){return this._prefetchDataImpl(e,t)}setData(e){const t=(0,s._typedJsonParse)(e,"has_updates","data");t&&"user"in t?super.setData(e,t.user):s.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,s){return i(this,void 0,void 0,function*(){var i;const r=yield null===(i=this._network)||void 0===i?void 0:i.fetchEvaluations(this._getSdkKey(),e,null==n?void 0:n.priority,t,s);return null!=r?r:null})}_getCacheKey(e){var t;const n=(0,s._getStorageKey)(this._getSdkKey(),e,null===(t=this._options)||void 0===t?void 0:t.customUserCacheKeyFunc);return`${s.DataAdapterCachePrefix}.${this._cacheSuffix}.${n}`}_isCachedResultValidFor204(e,t){return null!=e.fullUserHash&&e.fullUserHash===(0,s._getFullUserHash)(t)}}t.StatsigEvaluationsDataAdapter=o},2509:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},2610:(e,t)=>{"use strict";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"}},2626:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getCookieName=t.StableID=void 0;const i=n(4681),s=n(8024),r=n(414),o=n(1638),a=n(7047),l={},u={},c={};function d(e){return`statsig.stable_id.${(0,i._getStorageKey)(e)}`}function h(e,t){const n=d(t);try{(0,o._setObjectInStorage)(n,e)}catch(e){s.Log.warn("Failed to save StableID to storage")}}function _(e,t){if(!u[t]||null==(0,r._getDocumentSafe)())return;const n=new Date;n.setFullYear(n.getFullYear()+1),document.cookie=`${g(t)}=${encodeURIComponent(e)}; expires=${n.toUTCString()}; path=/`}function g(e){return`statsig.stable_id.${(0,i._getStorageKey)(e)}`}t.StableID={cookiesEnabled:!1,randomID:Math.random().toString(36),get:e=>{if(c[e])return null;if(null!=l[e])return l[e];let t=null;return t=function(e){if(!u[e]||null==(0,r._getDocumentSafe)())return null;const t=document.cookie.split(";");for(const n of t){const[t,i]=n.trim().split("=");if(t===g(e))return decodeURIComponent(i)}return null}(e),null!=t?(l[e]=t,h(t,e),t):(t=function(e){const t=d(e);return(0,o._getObjectFromStorage)(t)}(e),null==t&&(t=(0,a.getUUID)()),h(t,e),_(t,e),l[e]=t,t)},setOverride:(e,t)=>{l[t]=e,h(e,t),_(e,t)},_setCookiesEnabled:(e,t)=>{u[e]=t},_setDisabled:(e,t)=>{c[e]=t}},t.getCookieName=g},2701:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t._notifyVisibilityChanged=t._subscribeToVisiblityChanged=t._isUnloading=t._isCurrentlyVisible=void 0;const i=n(414),s="foreground",r="background",o=[];let a=s,l=!1;t._isCurrentlyVisible=()=>a===s,t._isUnloading=()=>l,t._subscribeToVisiblityChanged=e=>{o.unshift(e)},t._notifyVisibilityChanged=e=>{e!==a&&(a=e,o.forEach(t=>t(e)))},(0,i._addWindowEventListenerSafe)("focus",()=>{l=!1,(0,t._notifyVisibilityChanged)(s)}),(0,i._addWindowEventListenerSafe)("blur",()=>(0,t._notifyVisibilityChanged)(r)),(0,i._addDocumentEventListenerSafe)("visibilitychange",()=>{(0,t._notifyVisibilityChanged)("visible"===document.visibilityState?s:r)}),(0,i._addWindowEventListenerSafe)((0,i._getUnloadEvent)(),()=>{l=!0,(0,t._notifyVisibilityChanged)(r)})},2944:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))(function(s,r){function o(e){try{l(i.next(e))}catch(e){r(e)}}function a(e){try{l(i.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,a)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0});const s=n(6978),r=n(5694);class o extends s.NetworkCore{constructor(e,t){super(e,t);const n=null==e?void 0:e.networkConfig;this._option=e,this._initializeUrlConfig=new s.UrlConfiguration(s.Endpoint._initialize,null==n?void 0:n.initializeUrl,null==n?void 0:n.api,null==n?void 0:n.initializeFallbackUrls)}fetchEvaluations(e,t,n,r,o){return i(this,void 0,void 0,function*(){var i,a,l,u,c,d;const h=t?(0,s._typedJsonParse)(t,"has_updates","InitializeResponse"):null;let _={user:r,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==h?void 0:h.has_updates){const e=(null==h?void 0:h.hash_used)!==(null!==(d=null===(c=null===(u=this._option)||void 0===u?void 0:u.networkConfig)||void 0===c?void 0:c.initializeHashAlgorithm)&&void 0!==d?d:"djb2");_=Object.assign(Object.assign({},_),{sinceTime:o&&!e?h.time:0,previousDerivedFields:"derived_fields"in h&&o?h.derived_fields:{},deltasResponseRequested:!0,full_checksum:h.full_checksum,partialUserMatchSinceTime:e?0:h.time})}return this._fetchEvaluations(e,h,_,n)})}_fetchEvaluations(e,t,n,s){return i(this,void 0,void 0,function*(){var i,o;const a=yield this.post({sdkKey:e,urlConfig:this._initializeUrlConfig,data:n,retries:2,isStatsigEncodable:!0,priority:s});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===(o=a.body)||void 0===o?void 0:o.includes('"is_delta":true'))||!0!==n.deltasResponseRequested)return a.body;const l=(0,r._resolveDeltasResponse)(t,a.body);return"string"==typeof l?l:this._fetchEvaluations(e,t,Object.assign(Object.assign(Object.assign({},n),l),{deltasResponseRequested:!1}),s)})}}t.default=o},3127:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BatchQueue=void 0;const i=n(6420),s=n(6821);t.BatchQueue=class{constructor(e=s.EventRetryConstants.DEFAULT_BATCH_SIZE){this._batches=[],this._batchSize=e}batchSize(){return this._batchSize}requeueBatch(e){return this._enqueueBatch(e)}hasFullBatch(){return this._batches.some(e=>e.events.length>=this._batchSize)}takeNextBatch(){return this._batches.shift()}takeAllBatches(){const e=this._batches;return this._batches=[],e}createBatches(e){let t=0,n=0;for(;t<e.length;){const s=e.slice(t,t+this._batchSize);n+=this._enqueueBatch(new i.EventBatch(s)),t+=this._batchSize}return n}_enqueueBatch(e){this._batches.push(e);let t=0;for(;this._batches.length>s.EventRetryConstants.MAX_PENDING_BATCHES;){const e=this._batches.shift();e&&(t+=e.events.length)}return t}}},3194:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},3439:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isUserActionAutoCaptureEvent=t.AutoCaptureEventName=void 0,t.AutoCaptureEventName={PAGE_VIEW:"auto_capture::page_view",PAGE_VIEW_END:"auto_capture::page_view_end",ERROR:"auto_capture::error",SESSION_START:"auto_capture::session_start",PERFORMANCE:"auto_capture::performance",FORM_SUBMIT:"auto_capture::form_submit",CLICK:"auto_capture::click",RAGE_CLICK:"auto_capture::rage_click",WEB_VITALS:"auto_capture::web_vitals",DEAD_CLICK:"auto_capture::dead_click",COPY:"auto_capture::copy",CONSOLE_LOG:"statsig::log_line"};const n=new Set([t.AutoCaptureEventName.PAGE_VIEW,t.AutoCaptureEventName.PAGE_VIEW_END,t.AutoCaptureEventName.SESSION_START,t.AutoCaptureEventName.FORM_SUBMIT,t.AutoCaptureEventName.CLICK,t.AutoCaptureEventName.RAGE_CLICK,t.AutoCaptureEventName.COPY]);t.isUserActionAutoCaptureEvent=e=>n.has(e)},3509:(e,t,n)=>{"use strict";var i,s,r;Object.defineProperty(t,"__esModule",{value:!0}),t._getInstance=t._getStatsigGlobalFlag=t._getStatsigGlobal=void 0;const o=n(8024);t._getStatsigGlobal=()=>{try{return"undefined"!=typeof __STATSIG__?__STATSIG__:d}catch(e){return d}},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&&o.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:{},c="undefined"!=typeof globalThis?globalThis:{},d=null!==(r=null!==(s=null!==(i=l[a])&&void 0!==i?i:u[a])&&void 0!==s?s:c[a])&&void 0!==r?r:{instance:t._getInstance};l[a]=d,u[a]=d,c[a]=d},3705:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t._typedJsonParse=void 0;const i=n(8024);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}},3884:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t._getPossibleFirstTouchMetadata=t._getNetworkInfo=t._gatherAllMetadata=t._gatherCommonMetadata=void 0;const i=n(6978),s=n(7624);function r(e){var t,n,r,a,l,u,c,d;const h=(0,i._getDocumentSafe)(),_=(0,i._getWindowSafe)();return(0,s._stripEmptyValues)(Object.assign({title:null==h?void 0:h.title,current_url:null===(t=null==_?void 0:_.location)||void 0===t?void 0:t.href,user_agent:(null===(n=null==_?void 0:_.navigator)||void 0===n?void 0:n.userAgent)&&(null===(a=null===(r=null==_?void 0:_.navigator)||void 0===r?void 0:r.userAgent)||void 0===a?void 0:a.length)>200?_.navigator.userAgent.substring(0,200):null===(l=null==_?void 0:_.navigator)||void 0===l?void 0:l.userAgent,locale:null===(u=null==_?void 0:_.navigator)||void 0===u?void 0:u.language,hostname:e.hostname,pathname:e.pathname,screen_width:null===(c=null==_?void 0:_.screen)||void 0===c?void 0:c.width,screen_height:null===(d=null==_?void 0:_.screen)||void 0===d?void 0:d.height,viewport_width:null==_?void 0:_.innerWidth,viewport_height:null==_?void 0:_.innerHeight,viewport:`${null==_?void 0:_.innerWidth}x${null==_?void 0:_.innerHeight}`,timestamp:Date.now(),timezone:(0,s._getSafeTimezone)(),timezone_offset:(0,s._getSafeTimezoneOffset)(),navigation_type:(0,s._getSafeNavigationType)()},o()))}function o(){const e=(0,s._getSafeNetworkInformation)(),t={};return void 0!==(null==e?void 0:e.effectiveType)&&(t.effective_connection_type=e.effectiveType),void 0!==(null==e?void 0:e.rtt)&&(t.rtt_ms=e.rtt),void 0!==(null==e?void 0:e.downlink)&&(t.downlink_mbps=e.downlink,t.downlink_kbps=1e3*e.downlink),void 0!==(null==e?void 0:e.saveData)&&(t.save_data=e.saveData),t}function a(e){const t=(null==e?void 0:e.referrer)||"";if(!t)return{referrer:null,referrer_domain:null,referrer_path:null,searchEngine:"",searchQuery:""};try{const e=new URL(t),n=e.hostname,i=["google","bing","yahoo","duckduckgo","baidu"].find(e=>n.includes(e+"."))||"",s=e.searchParams.get("yahoo"===i?"p":"q")||"";return{referrer:t,referrer_domain:e.hostname,referrer_path:e.pathname,searchEngine:i,searchQuery:s}}catch(e){return{referrer:null,referrer_domain:null,referrer_path:null,searchEngine:"",searchQuery:""}}}function l(e){const t=e.searchParams,n={};return["utm_source","utm_medium","utm_campaign","utm_term","utm_content","msclkid","dclid","fbclid","gad_source","gclid","gclsrc","wbraid","utm_id","irclid","igshid","_kx","li_fat_id","mc_cid","mc_eid","epik","qclid","rdt_cid","sccid","ttc","ttclid","ttc_id","twclid"].forEach(e=>{const i=t.get(e);i&&(n[e]=i)}),n}t._gatherCommonMetadata=r,t._gatherAllMetadata=function(e){const t=(0,i._getDocumentSafe)(),n=(0,i._getWindowSafe)();if(!t||!n)return{};const o=a(t),u=r(e),c=l(e),d={};return e.searchParams.forEach((e,t)=>{d[t]=e}),Object.assign(Object.assign({},u),(0,s._stripEmptyValues)(Object.assign(Object.assign(Object.assign({},o),c),d)))},t._getNetworkInfo=o,t._getPossibleFirstTouchMetadata=function(e){const t=(0,i._getDocumentSafe)(),n=(0,i._getWindowSafe)();if(!t||!n)return{};const r=a(t),o=l(e),u=(0,s._stripEmptyValues)(Object.assign(Object.assign({},r),o)),c={};for(const[e,t]of Object.entries(u))c[`$s_${e}`]=t;return c}},3918:(e,t,n)=>{"use strict";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 s=Object.keys(e).sort(),r={};return s.forEach(s=>{const o=e[s];0!==n&&"object"===(0,i._typeOf)(o)?r[s]=(0,t._getSortedObject)(o,null!=n?n-1:n):r[s]=o}),r}},4351:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))(function(s,r){function o(e){try{l(i.next(e))}catch(e){r(e)}}function a(e){try{l(i.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,a)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t.StatsigClientBase=void 0,n(3509);const s=n(3509),r=n(4358),o=n(5434),a=n(8024),l=n(843),u=n(414),c=n(9839),d=n(2626),h=n(7754),_=n(1638);t.StatsigClientBase=class{constructor(e,t,n,i){var l,h,g,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)&&c.StatsigSession.overrideInitialSessionID(i.initialSessionID,e),(null==i?void 0:i.storageProvider)&&_.Storage._setProvider(i.storageProvider),(null==i?void 0:i.enableCookies)&&d.StableID._setCookiesEnabled(e,i.enableCookies),(null==i?void 0:i.disableStableID)&&d.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._errorBoundary=new r.ErrorBoundary(e,i,f),this._logger=new o.EventLogger(e,f,n,i,this._errorBoundary),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===(g=null===(h=this.overrideAdapter)||void 0===h?void 0:h.loadFromStorage)||void 0===g?void 0:g.call(h))||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,s._getStatsigGlobal)(),r=null!==(n=i.instances)&&void 0!==n?n:{},o=t;null!=r[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."),r[e]=o,i.firstInstance||(i.firstInstance=o),i.instances=r,__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,d.StableID._setCookiesEnabled(this._sdkKey,e.enableCookies)),e.logEventCompressionMode?this._logger.setLogEventCompressionMode(e.logEventCompressionMode):e.disableCompression&&this._logger.setLogEventCompressionMode(h.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 s=(0,l.createMemoKey)(e,n,i);return s?(s in this._memoCache||(Object.keys(this._memoCache).length>=3e3&&(this._memoCache={}),this._memoCache[s]=t(n,i)),this._memoCache[s]):t(n,i)}}}},4358:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))(function(s,r){function o(e){try{l(i.next(e))}catch(e){r(e)}}function a(e){try{l(i.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,a)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t.ErrorBoundary=t.EXCEPTION_ENDPOINT=void 0;const s=n(8024),r=n(686),o=n(6512);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.keys(e).forEach(n=>{const i=n,s=e[i];switch(typeof s){case"number":case"bigint":case"boolean":t[String(i)]=s;break;case"string":s.length<50?t[String(i)]=s:t[String(i)]="set";break;case"object":"environment"===i?t.environment=s:"networkConfig"===i?t.networkConfig=s:t[String(i)]=null!=s?"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,t){try{const n=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)})(n).forEach(i=>{const s=n[i];"$EB"in s||(n[i]=(...n)=>this._capture(t?`${t}:${i}`:i,()=>s.apply(e,n)),n[i].$EB=!0)})}catch(e){this._onError("eb:wrap",e)}}logError(e,t){this._onError(e,t)}logDroppedEvents(e,t,n){const i={eventCount:String(e),reason:t};n&&Object.keys(n).forEach(e=>{i[e]=String(n[e])}),this._onError("statsig::log_event_dropped_event_count",new Error(t),!0,i)}logEventRequestFailure(e,t,n,i,s,r,o,a,l){const u={eventCount:String(e),flushType:n,statusCode:String(i),reason:t,retries:String(s)};r&&(u.failurePath=r),"string"==typeof o&&o.length>0&&(u.failureErrorMessage=o),"string"==typeof a&&a.length>0&&(u.failureDiagnosticBucket=a),l&&Object.keys(l).forEach(e=>{const t=l[e];t.length>0&&(u[`failureDiagnostic_${e}`]=t)}),this._onError("statsig::log_event_failed",new Error(t),!0,u)}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,c=!1,d){try{s.Log.warn(`Caught error in ${e}`,{error:n}),(()=>i(this,void 0,void 0,function*(){var i,s,h,_,g,v,f;const p=n||Error(a),m=p instanceof Error,y=m?p.name:"No Name",b=l(p);if(this._lastSeenError=b,!c&&this._seen.has(y))return;if(this._seen.add(y),null===(s=null===(i=this._options)||void 0===i?void 0:i.networkConfig)||void 0===s?void 0:s.preventAllNetworkTraffic)return void(null===(h=this._emitter)||void 0===h||h.call(this,{name:"error",error:n,tag:e}));const S=r.SDKType._get(this._sdkKey),E=o.StatsigMetadataProvider.get(),C=m?p.stack:function(e){try{return JSON.stringify(e)}catch(e){return a}}(p),w=Object.assign(Object.assign({tag:e,exception:y,info:C,statsigOptions:u(this._options)},Object.assign(Object.assign({},E),{sdkType:S})),null!=d?d:{}),k=null===(_=this._options)||void 0===_?void 0:_.networkConfig,O=null!==(g=null==k?void 0:k.networkOverrideFunc)&&void 0!==g?g:fetch;yield O(null!==(v=null==k?void 0:k.sdkExceptionUrl)&&void 0!==v?v:t.EXCEPTION_ENDPOINT,{method:"POST",headers:{"STATSIG-API-KEY":this._sdkKey,"STATSIG-SDK-TYPE":String(S),"STATSIG-SDK-VERSION":String(E.sdkVersion),"Content-Type":"application/json"},body:JSON.stringify(w)}),null===(f=this._emitter)||void 0===f||f.call(this,{name:"error",error:n,tag:e})}))().then(()=>{}).catch(()=>{})}catch(e){}}}},4387:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},4600:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ConsoleLogManager=void 0;const i=n(6978),s=n(3439),r=n(7624),o=n(8711),a=n(3884),l={trace:10,debug:20,log:30,info:30,warn:40,error:50};t.ConsoleLogManager=class{constructor(e,t,n){var i,s,r,o;this._enqueueFn=e,this._errorBoundary=t,this._options=n,this._restoreFns=[],this._isTracking=!1,this._logLevel="info",this.__source="js-auto-capture",this._logLevel=null!==(i=this._options.logLevel)&&void 0!==i?i:"info",this._maxKeys=null!==(s=this._options.maxKeys)&&void 0!==s?s:50,this._maxDepth=null!==(r=this._options.maxDepth)&&void 0!==r?r:10,this._maxStringLength=null!==(o=this._options.maxStringLength)&&void 0!==o?o:2500}startTracking(){try{if(this._isTracking||!this._options.enabled)return;if(!(0,i._getWindowSafe)())return;this._patchConsole(),this._isTracking=!0}catch(e){i.Log.error("Error starting console log tracking",e),this._errorBoundary.logError("autoCapture:ConsoleLogManager",e)}}stopTracking(){this._isTracking&&(this._restoreFns.forEach(e=>e()),this._restoreFns=[],this._isTracking=!1)}_patchConsole(){Object.entries(l).forEach(([e,t])=>{if(t<l[this._logLevel])return;if(!console[e])return;const n=console[e].bind(console);let i=!1;const s=(0,r.wrapFunctionWithRestore)(console,e,t=>(...s)=>{if(t(...s),!i){i=!0;try{const t=s.map(e=>(0,o._safeStringify)(e,this._maxKeys,this._maxDepth,this._maxStringLength)),n=(0,o._getStackTrace)();this._enqueueConsoleLog(e,t,n)}catch(e){n("console observer error:",e,...s),this._errorBoundary.logError("autoCapture:ConsoleLogManager",e)}finally{i=!1}}});this._restoreFns.push(s)})}_enqueueConsoleLog(e,t,n){if(!this._shouldLog(t))return;const i=Object.assign({status:"log"===e?"info":e,log_level:e,payload:t,trace:n,timestamp:Date.now(),source:this.__source},(0,a._gatherAllMetadata)((0,r._getSafeUrl)()));this._enqueueFn(s.AutoCaptureEventName.CONSOLE_LOG,t.join(" "),i)}_shouldLog(e){for(const t of e)if(t.includes("[Statsig]"))return!1;return!this._options.sampleRate||"number"!=typeof this._options.sampleRate||this._options.sampleRate<=0||this._options.sampleRate>=1||Math.random()<this._options.sampleRate}}},4681:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t._getStorageKey=t._getUserStorageKey=void 0;const i=n(3918);function s(e,t,n){var s;if(n)return n(e,t);const r=t&&t.customIDs?t.customIDs:{},o=[`uid:${null!==(s=null==t?void 0:t.userID)&&void 0!==s?s:""}`,`cids:${Object.keys(r).sort((e,t)=>e.localeCompare(t)).map(e=>`${e}-${r[e]}`).join(",")}`,`k:${e}`];return(0,i._DJB2)(o.join("|"))}t._getUserStorageKey=s,t._getStorageKey=function(e,t,n){return t?s(e,t,n):(0,i._DJB2)(`k:${e}`)}},4703:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))(function(s,r){function o(e){try{l(i.next(e))}catch(e){r(e)}}function a(e){try{l(i.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,a)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t.NetworkCore=t.RETRYABLE_CODES=void 0,n(3509);const s=n(3509),r=n(882),o=n(8024),a=n(2610),l=n(52),u=n(5747),c=n(686),d=n(414),h=n(9839),_=n(2626),g=n(1180),v=n(6512),f=n(7754),p=n(2701);t.RETRYABLE_CODES=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,t){if(!m(e))return t&&(t.path="beacon_invalid_sdk_key"),!1;const n=this._getInternalRequestArgs("POST",e),i=this._getPopulatedURL(n),s=navigator;try{const e=s.sendBeacon.bind(s)(i,n.body);return e||t&&(t.path="beacon_send_false"),e}catch(e){throw t&&(t.path="beacon_send_exception"),e}}post(e,t){return i(this,void 0,void 0,function*(){const n=this._getInternalRequestArgs("POST",e);return this._tryEncodeBody(n),yield this._tryToCompressBody(n),this._sendRequest(n,t)})}get(e){const t=this._getInternalRequestArgs("GET",e);return this._sendRequest(t)}_sendRequest(e,n){return i(this,void 0,void 0,function*(){var s,l,u,c;if(!m(e))return n&&(n.path="network_invalid_sdk_key"),null;if(this._netConfig.preventAllNetworkTraffic)return n&&(n.path="network_prevent_all_network_traffic"),null;const{method:h,body:_,retries:v,attempt:f}=e,y=e.urlConfig.endpoint;if(this._isRateLimited(y))return o.Log.warn(`Request to ${y} was blocked because you are making requests too frequently.`),n&&(n.path="network_rate_limited"),null;const E=null!=f?f:1;let C=!1;const w=this._getPopulatedURL(e),k=Date.now();let O=null;const I=(0,p._isUnloading)();try{const t={method:h,body:_,headers:Object.assign({},e.headers),priority:e.priority,keepalive:I};!function(e,t){e.urlConfig.endpoint===a.Endpoint._initialize&&r.Diagnostics._markInitNetworkReqStart(e.sdkKey,{attempt:t})}(e,E);const n=this._leakyBucket[y];n&&(n.lastRequestTime=Date.now(),this._leakyBucket[y]=n);const i=null!==(s=this._netConfig.networkOverrideFunc)&&void 0!==s?s:fetch;let o;if(O=yield Promise.race([i(w,t).finally(()=>clearTimeout(o)),new Promise((e,t)=>{o=setTimeout(()=>{C=!0,t(new Error(`Timeout of ${this._timeout}ms expired.`))},this._timeout)})]),!O.ok){const e=yield O.text().catch(()=>"No Text"),t=new Error(`NetworkError: ${w} ${e}`);throw t.name="NetworkError",t}const l=yield O.text();return S(e,O,E,l),this._fallbackResolver.tryBumpExpiryTime(e.sdkKey,e.urlConfig),{body:l,code:O.status}}catch(s){const r=function(e){return"string"==typeof e?e:e instanceof Error?`${e.name}: ${e.message}`:"Unknown Error"}(s),a=(D=C,(null!=r?r:"").includes("Timeout")||D);if(S(e,O,E,"",s),(yield this._fallbackResolver.tryFetchUpdatedFallbackInfo(e.sdkKey,e.urlConfig,r,a))&&(e.fallbackUrl=this._fallbackResolver.getActiveFallbackUrl(e.sdkKey,e.urlConfig)),!v||E>v||!t.RETRYABLE_CODES.has(null!==(l=null==O?void 0:O.status)&&void 0!==l?l:500)){null===(u=this._emitter)||void 0===u||u.call(this,{name:"error",error:s,tag:g.ErrorTag.NetworkError,requestArgs:e});const t=`A networking error occurred during ${h} request to ${w}.`;if(o.Log.error(t,r,s),null===(c=this._errorBoundary)||void 0===c||c.attachErrorIfNoneExists(t),e.preserveFailedStatusCode&&null!=O)return{body:null,code:O.status};if(null==O&&n){n.path=a?"network_request_timed_out_no_response":"network_request_exception_no_response",r&&(n.errorMessage=r);try{const t=function(e,t,n,i){var s,r,o;const a=(0,d._getWindowSafe)(),l=null==a?void 0:a.document,u="undefined"!=typeof navigator?navigator:null,c=(0,p._isUnloading)(),h=u&&"boolean"==typeof u.onLine?String(u.onLine):"unknown",_=null!==(s=null==l?void 0:l.visibilityState)&&void 0!==s?s:"unknown",g=Object.keys(null!==(r=e.headers)&&void 0!==r?r:{}).length>0,v=(E=t,!(C=null===(o=null==a?void 0:a.location)||void 0===o?void 0:o.origin)||!E.startsWith(`${C}/`)&&!E.startsWith(`${C}?`)&&E!==C),f=null!=e.urlConfig.customUrl,m=null!=e.fallbackUrl,y=b(i,[250,1e3,5e3,1e4]),S=b(function(e){return null==e?0:"string"==typeof e?e.length:e instanceof Uint8Array?e.byteLength:"undefined"!=typeof Blob&&e instanceof Blob?e.size:-1}(e.body),[16384,65536,262144,1048576]);var E,C;let w="unknown_no_response";return n?w="timeout":"false"===h?w="browser_offline":c?w="page_unloading":"hidden"===_?w="page_hidden":v&&g?w="cross_origin_custom_headers_preflight_risk":f||m?w="custom_url_no_response":i<250&&(w="immediate_network_rejection"),{bucket:w,metadata:{elapsedMsBucket:y,bodySizeBucket:S,online:h,visibilityState:_,isUnloading:String(c),crossOrigin:String(v),hasCustomUrl:String(f)}}}(e,w,a,Date.now()-k);n.diagnosticBucket=t.bucket,n.diagnosticMetadata=t.metadata}catch(e){}}return 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)))})}(E),this._sendRequest(Object.assign(Object.assign({},e),{retries:v,attempt:E+1}),n)}var D})}_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},s=n-i.lastRequestTime,r=Math.floor(.05*s);return i.count=Math.max(0,i.count-r),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]:c.SDKType._get(e.sdkKey),[a.NetworkParam.SdkVersion]:v.SDK_VERSION,[a.NetworkParam.Time]:String(Date.now()),[a.NetworkParam.SessionID]:h.SessionID.get(e.sdkKey)},e.params),s=Object.keys(i).map(e=>`${encodeURIComponent(e)}=${encodeURIComponent(i[e])}`).join("&");return`${n}${s?`?${s}`:""}`}_tryEncodeBody(e){var t;const n=(0,d._getWindowSafe)(),i=e.body;if(e.isStatsigEncodable&&!this._options.disableStatsigEncoding&&"string"==typeof i&&null==(0,s._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){o.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,s._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),s=new CompressionStream("gzip"),r=s.writable.getWriter();r.write(i).catch(o.Log.error),r.close().catch(o.Log.error);const l=s.readable.getReader(),u=[];let c;for(;!(c=yield l.read()).done;)u.push(c.value);const d=u.reduce((e,t)=>e+t.length,0),h=new Uint8Array(d);let _=0;for(const e of u)h.set(e,_),_+=e.length;e.body=h,e.params=Object.assign(Object.assign({},null!==(t=e.params)&&void 0!==t?t:{}),{[a.NetworkParam.IsGzipped]:"1"})}catch(t){o.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&&y(i,t.data),i}};const m=e=>!!e.sdkKey||(o.Log.warn("Unable to make request without an SDK key"),!1),y=(e,t)=>{const{sdkKey:n,fallbackUrl:i}=e,s=_.StableID.get(n),r=h.SessionID.get(n),o=c.SDKType._get(n);e.body=JSON.stringify(Object.assign(Object.assign({},t),{statsigMetadata:Object.assign(Object.assign({},v.StatsigMetadataProvider.get()),{stableID:s,sessionID:r,sdkType:o,fallbackUrl:i})}))};function b(e,t){if(e<0)return"unknown";for(const n of t)if(e<n)return`<${n}`;return`>=${t[t.length-1]}`}function S(e,t,n,i,s){e.urlConfig.endpoint===a.Endpoint._initialize&&r.Diagnostics._markInitNetworkReqEnd(e.sdkKey,r.Diagnostics._getDiagnosticsData(t,n,i,s))}},5025:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},5138:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var s=Object.getOwnPropertyDescriptor(t,n);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,s)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=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 r=n(6978),o=n(7686);t.StatsigClient=o.default,s(n(6978),t);const a=Object.assign((0,r._getStatsigGlobal)(),{StatsigClient:o.default});t.default=a},5434:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))(function(s,r){function o(e){try{l(i.next(e))}catch(e){r(e)}}function a(e){try{l(i.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,a)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t.EventLogger=void 0;const s=n(3127),r=n(4681),o=n(6821),a=n(8056),l=n(3918),u=n(8024),c=n(2610),d=n(2108),h=n(414),_=n(7253),g=n(7754),v=n(1638),f=n(8873),p=n(2701),m={};class y{static _safeFlushAndForget(e){var t;null===(t=m[e])||void 0===t||t.flush().catch(()=>{})}constructor(e,t,n,i,s){var r;this._sdkKey=e,this._emitter=t,this._network=n,this._options=i,this._errorBoundary=s,this._pendingEvents=null,this._batchQueue=null,this._flushCoordinator=null,this._lastExposureTimeMap={},this._nonExposedChecks={},this._isShuttingDown=!1,this._storageKey=null,this._pendingCompressionMode=null,this._loggingEnabled=null!==(r=null==i?void 0:i.loggingEnabled)&&void 0!==r?r:!0===(null==i?void 0:i.disableLogging)?g.LoggingEnabledOption.disabled:g.LoggingEnabledOption.browserOnly,(null==i?void 0:i.loggingEnabled)&&void 0!==i.disableLogging&&u.Log.warn("Detected both loggingEnabled and disableLogging options. loggingEnabled takes precedence - please remove disableLogging.");const o=null==i?void 0:i.networkConfig;this._logEventUrlConfig=new f.UrlConfiguration(c.Endpoint._rgstr,null==o?void 0:o.logEventUrl,null==o?void 0:o.api,null==o?void 0:o.logEventFallbackUrls)}setLogEventCompressionMode(e){this._flushCoordinator?this._flushCoordinator.setLogEventCompressionMode(e):this._pendingCompressionMode=e}setLoggingEnabled(e){const t="disabled"===this._loggingEnabled,n="disabled"!==e;if(this._loggingEnabled=e,this._flushCoordinator&&this._flushCoordinator.setLoggingEnabled(e),t&&n){const e=this._loadStoredEvents();u.Log.debug(`Loaded ${e.length} stored event(s) from storage`),e.length>0&&(e.forEach(e=>{this._initFlushCoordinator().addEvent(e)}),this.flush().catch(e=>{u.Log.warn("Failed to flush events after enabling logging:",e)}))}}enqueue(e){var t;if(!this._shouldLogEvent(e))return;const n=this._normalizeEvent(e);"disabled"!==this._loggingEnabled?(this._initFlushCoordinator().addEvent(n),null===(t=this._flushCoordinator)||void 0===t||t.checkQuickFlush()):this._storeEventToStorage(n)}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,h._isServerEnv)();if(t&&"always"!==(null===(e=this._options)||void 0===e?void 0:e.loggingEnabled))return;const n=this._initFlushCoordinator();m[this._sdkKey]=this,t||(0,p._subscribeToVisiblityChanged)(e=>{"background"===e?y._safeFlushAndForget(this._sdkKey):"foreground"===e&&n.startScheduledFlushCycle()}),n.loadAndRetryShutdownFailedEvents().catch(e=>{u.Log.warn("Failed to load failed shutdown events:",e)}),n.startScheduledFlushCycle()}stop(){return i(this,void 0,void 0,function*(){this._isShuttingDown=!0,this._flushCoordinator&&(yield this._flushCoordinator.processShutdown()),delete m[this._sdkKey],this._flushCoordinator=null,this._pendingEvents=null,this._batchQueue=null})}flush(){return i(this,void 0,void 0,function*(){if(this._flushCoordinator)return this._flushCoordinator.processManualFlush()})}appendAndResetNonExposedChecks(){if(0===Object.keys(this._nonExposedChecks).length)return;const e=Object.assign({},this._nonExposedChecks);this._nonExposedChecks={};const t=this._normalizeEvent({eventName:"statsig::non_exposed_checks",user:null,time:Date.now(),metadata:{checks:e}});this._flushCoordinator&&this._flushCoordinator.addEvent(t)}_shouldLogEvent(e){var t;if("always"!==(null===(t=this._options)||void 0===t?void 0:t.loggingEnabled)&&(0,h._isServerEnv)())return!1;if(!(0,_._isExposureEvent)(e))return!0;const n=e.user?e.user:{statsigEnvironment:void 0},i=(0,r._getUserStorageKey)(this._sdkKey,n),s=e.metadata?e.metadata:{},o=[e.eventName,i,s.gate,s.config,s.ruleID,s.allocatedExperiment,s.parameterName,String(s.isExplicitParameter),s.reason].join("|"),a=this._lastExposureTimeMap[o],l=Date.now();return!(a&&l-a<6e5||(Object.keys(this._lastExposureTimeMap).length>1e3&&(this._lastExposureTimeMap={}),this._lastExposureTimeMap[o]=l,0))}_getCurrentPageUrl(){var e;if(!1!==(null===(e=this._options)||void 0===e?void 0:e.includeCurrentPageUrlWithEvents))return(0,h._getCurrentPageUrlSafe)()}_getStorageKey(){return this._storageKey||(this._storageKey=`statsig.pending_events.${(0,l._DJB2)(this._sdkKey)}`),this._storageKey}_initFlushCoordinator(){var e,t;if(this._flushCoordinator)return this._flushCoordinator;const n=null!==(t=null===(e=this._options)||void 0===e?void 0:e.loggingBufferMaxSize)&&void 0!==t?t:o.EventRetryConstants.DEFAULT_BATCH_SIZE;return this._pendingEvents=new d.PendingEvents(n),this._batchQueue=new s.BatchQueue(n),this._flushCoordinator=new a.FlushCoordinator(this._batchQueue,this._pendingEvents,()=>this.appendAndResetNonExposedChecks(),this._sdkKey,this._network,this._emitter,this._logEventUrlConfig,this._options,this._loggingEnabled,this._errorBoundary),this._pendingCompressionMode&&(this._flushCoordinator.setLogEventCompressionMode(this._pendingCompressionMode),this._pendingCompressionMode=null),this._flushCoordinator}_storeEventToStorage(e){const t=this._getStorageKey();try{let n=this._getEventsFromStorage(t);n.push(e),n.length>o.EventRetryConstants.MAX_LOCAL_STORAGE&&(n=n.slice(-o.EventRetryConstants.MAX_LOCAL_STORAGE)),(0,v._setObjectInStorage)(t,n)}catch(e){u.Log.warn("Unable to save events to storage")}}_getEventsFromStorage(e){try{const t=(0,v._getObjectFromStorage)(e);return Array.isArray(t)?t:[]}catch(e){return[]}}_loadStoredEvents(){const e=this._getStorageKey(),t=this._getEventsFromStorage(e);return t.length>0&&v.Storage.removeItem(e),t}_normalizeEvent(e){e.user&&(e.user=Object.assign({},e.user),delete e.user.privateAttributes);const t={},n=this._getCurrentPageUrl();return n&&(t.statsigMetadata={currentPage:n}),Object.assign(Object.assign({},e),t)}}t.EventLogger=y},5638:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))(function(s,r){function o(e){try{l(i.next(e))}catch(e){r(e)}}function a(e){try{l(i.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,a)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t._makeDataAdapterResult=t.DataAdapterCore=void 0;const s=n(8024),r=n(2626),o=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,o._getFullUserHash)(i)}}t.DataAdapterCore=class{constructor(e,t){this._adapterName=e,this._cacheSuffix=t,this._options=null,this._sdkKey=null,this._cacheLimit=10,this._lastModifiedStoreKey=`statsig.last_modified_time.${t}`,this._inMemoryCache=new c}attach(e,t,n){this._sdkKey=e,this._options=t}getDataSync(e){const t=e&&(0,o._normalizeUser)(e,this._options),n=this._getCacheKey(t),i=this._inMemoryCache.get(n,t);if(i&&this._getIsCacheValueValid(i))return i;const s=this._loadFromCache(n);return s&&this._getIsCacheValueValid(s)?(this._inMemoryCache.add(n,s,this._cacheLimit),this._inMemoryCache.get(n,t)):null}setData(e,t){const n=t&&(0,o._normalizeUser)(t,this._options),i=this._getCacheKey(n);this._inMemoryCache.add(i,u("Bootstrap",e,null,n),this._cacheLimit)}_getIsCacheValueValid(e){return null==e.stableID||e.stableID===r.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),r=[this._fetchAndPrepFromNetwork(i,t,n)];return(null==n?void 0:n.timeoutMs)&&r.push(new Promise(e=>setTimeout(e,n.timeoutMs)).then(()=>(s.Log.debug("Fetching latest value timed out"),null))),yield Promise.race(r)})}_prefetchDataImpl(e,t){return i(this,void 0,void 0,function*(){const n=e&&(0,o._normalizeUser)(e,this._options),i=this._getCacheKey(n),s=yield this._getDataAsyncImpl(null,n,t);s&&this._inMemoryCache.add(i,Object.assign(Object.assign({},s),{source:"Prefetch"}),this._cacheLimit)})}_fetchAndPrepFromNetwork(e,t,n){return i(this,void 0,void 0,function*(){var i;const o=null!==(i=null==e?void 0:e.data)&&void 0!==i?i:null,a=null!=e&&this._isCachedResultValidFor204(e,t),c=yield this._fetchFromNetwork(o,t,n,a);if(!c)return s.Log.debug("No response returned for latest value"),null;const d=(0,l._typedJsonParse)(c,"has_updates","Response"),h=this._getSdkKey(),_=r.StableID.get(h);let g=null;if(!0===(null==d?void 0:d.has_updates))g=u("Network",c,_,t);else{if(!o||!1!==(null==d?void 0:d.has_updates))return null;g=u("NetworkNotModified",o,_,t)}const v=this._getCacheKey(t);return this._inMemoryCache.add(v,g,this._cacheLimit),this._writeToCache(v,g),g})}_getSdkKey(){return null!=this._sdkKey?this._sdkKey:(s.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){const n=JSON.stringify(t);for(let t=0;t<8;t++)try{a.Storage.setItem(e,n);break}catch(t){if(!(t instanceof Error)||!t.toString().includes("QuotaExceededError")&&!t.toString().includes("QUOTA_EXCEEDED_ERR")||this._cacheLimit<=1)throw t;this._cacheLimit=Math.ceil(this._cacheLimit/2),this._runLocalStorageCacheEviction(e,this._cacheLimit-1)}this._runLocalStorageCacheEviction(e)}_runLocalStorageCacheEviction(e,t=this._cacheLimit){var n;const i=null!==(n=(0,a._getObjectFromStorage)(this._lastModifiedStoreKey))&&void 0!==n?n:{};i[e]=Date.now();const s=d(i,t);for(const e of s)delete i[e],a.Storage.removeItem(e);(0,a._setObjectInStorage)(this._lastModifiedStoreKey,i)}},t._makeDataAdapterResult=u;class c{constructor(){this._data={}}get(e,t){var n;const i=this._data[e],r=null==i?void 0:i.stableID,o=null===(n=null==t?void 0:t.customIDs)||void 0===n?void 0:n.stableID;return o&&r&&o!==r?(s.Log.warn("'StatsigUser.customIDs.stableID' mismatch"),null):i}add(e,t,n){const i=d(this._data,n-1);for(const e of i)delete this._data[e];this._data[e]=t}merge(e){this._data=Object.assign(Object.assign({},this._data),e)}}function d(e,t){const n=Object.keys(e);return n.length<=t?[]:0===t?n:n.sort((t,n)=>{const i=e[t],s=e[n];return"object"==typeof i&&"object"==typeof s?i.receivedAt-s.receivedAt:i-s}).slice(0,n.length-t)}},5641:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t._getMetadataFromElement=t._gatherCopyEventData=t._gatherEventData=void 0;const i=n(6978),s=n(7624),r=1e3;function o(e,t){return e?e.length>t?e.substring(0,t)+"...":e:null}function a(e){const t={};return t.class=(o(e.getAttribute("class"),r)||"").replace(/\s+/g," ").trim(),t.id=o(e.getAttribute("id"),r),t.ariaLabel=o(e.getAttribute("aria-label"),r),t.name=o(e.getAttribute("name"),r),t}function l(e){const t={},n=a(e);Object.assign(t,n);const i=Array.from(e.classList);return t.classList=i.length>0?i.slice(0,100):null,t.selector=function(e){if(!e)return"";if(!e.parentNode){const t=e.tagName.toLowerCase();if(e.id)return`#${e.id}`;let n=t;if(e.className&&"string"==typeof e.className){const t=e.className.trim().split(/\s+/);t.length>0&&""!==t[0]&&(n+="."+t.join("."))}return n}const t=[];let n=e,i=0;for(;n&&n.nodeType===Node.ELEMENT_NODE&&i<50;){const e=u(n);if(t.unshift(e),n.id)break;if(n=n.parentElement,n&&"body"===n.tagName.toLowerCase())break;i++}return t.join(" > ")}(e),t}function u(e){const t=e.tagName.toLowerCase();if(e.id)return`#${e.id}`;let n=t;if(e.className&&"string"==typeof e.className){const t=e.className.trim().split(/\s+/);t.length>0&&""!==t[0]&&(n+="."+t.join("."))}const i=e.parentElement;if(i&&i.children.length>1){let t=1,i=1,s=e.previousElementSibling;for(;s;)t++,s.tagName===e.tagName&&i++,s=s.previousElementSibling;n+=`:nth-child(${t})`,(i>1||function(e){let t=e.nextElementSibling;for(;t;){if(t.tagName===e.tagName)return!0;t=t.nextElementSibling}return!1}(e))&&(n+=`:nth-of-type(${i})`)}return n}t._gatherEventData=function(e){const t=(0,s._getSanitizedPageUrl)()||"",n=e.tagName.toLowerCase();if(function(e){return"input"===e.tagName.toLowerCase()&&["button","checkbox","submit","reset"].includes(e.getAttribute("type")||"")||"textarea"===e.tagName.toLowerCase()||"select"===e.tagName.toLowerCase()||"true"===e.getAttribute("contenteditable")}(e))return{value:t,metadata:a(e)};const i={};i.tagName=n;const r=l(e);Object.assign(i,r),"form"===n&&Object.assign(i,function(e){var t;const n={};return n.action=e.getAttribute("action"),n.method=null!==(t=e.getAttribute("method"))&&void 0!==t?t:"GET",n.formName=e.getAttribute("name"),n.formId=e.getAttribute("id"),n}(e)),"input"===n&&Object.assign(i,function(e){const t={};return t.content=e.value,t.inputName=e.getAttribute("name"),t}(e));const o=(0,s._getAnchorNodeInHierarchy)(e);return o&&Object.assign(i,function(e){const t={};return t.href=e.getAttribute("href"),t}(o)),("button"===n||o)&&Object.assign(i,function(e){const t={};t.content=(e.textContent||"").trim();const n=function(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}(e);return Object.assign(t,n),t}(o||e)),function(e){var t;if(Array.isArray(e.classList)&&(null===(t=e.classList)||void 0===t?void 0:t.includes("statsig-ctr-capture")))return!0;const n=e.href;if(n)try{const e=(0,s._getSafeUrl)(),t=new URL(n);return e.host!==t.host}catch(e){return!1}return!1}(i)&&(i.isOutbound="true"),{value:t,metadata:i}},t._gatherCopyEventData=function(e){var t,n;const r=null===(n=null===(t=(0,i._getWindowSafe)())||void 0===t?void 0:t.getSelection())||void 0===n?void 0:n.toString(),o={};o.selectedText=(0,s._sanitizeString)(r);const a=e.type||"clipboard";return o.clipType=a,o},t._getMetadataFromElement=l},5694:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t._resolveDeltasResponse=void 0;const i=n(6978);function s(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 r=function(e){const t=e;return s(e.deleted_gates,t.feature_gates),delete t.deleted_gates,s(e.deleted_configs,t.dynamic_configs),delete t.deleted_configs,s(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)),o=(0,i._DJB2Object)({feature_gates:r.feature_gates,dynamic_configs:r.dynamic_configs,layer_configs:r.layer_configs},2);return o===n.checksumV2?JSON.stringify(r):{hadBadDeltaChecksum:!0,badChecksum:o,badMergedConfigs:r,badFullResponse:n.deltas_full_response}}},5747:(e,t)=>{"use strict";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,s;return null!==(s=null===(i=n[e])||void 0===i?void 0:i[t])&&void 0!==s&&s}}},6272:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t._fastApproxSizeOf=void 0,t._fastApproxSizeOf=(e,n)=>{let i=0;const s=Object.keys(e);for(let r=0;r<s.length;r++){const o=s[r],a=e[o];if(i+=o.length,i+="object"==typeof a&&null!==a?(0,t._fastApproxSizeOf)(a,n)+2:String(a).length+1,i>=n)return i}return i}},6420:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EventBatch=void 0,t.EventBatch=class{constructor(e){this.attempts=0,this.createdAt=Date.now(),this.events=e}incrementAttempts(){this.attempts++}}},6512:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StatsigMetadataProvider=t.SDK_VERSION=void 0,t.SDK_VERSION="3.33.0";let n={sdkVersion:t.SDK_VERSION,sdkType:"js-mono"};t.StatsigMetadataProvider={get:()=>n,add:e=>{n=Object.assign(Object.assign({},n),e)}}},6697:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FlushInterval=void 0;const n=1e3,i=6e4;t.FlushInterval=class{constructor(){this._currentIntervalMs=n,this._lastFlushAttemptTime=Date.now()}getCurrentIntervalMs(){return this._currentIntervalMs}markFlushAttempt(){this._lastFlushAttemptTime=Date.now()}getTimeSinceLastAttempt(){return Date.now()-this._lastFlushAttemptTime}hasReachedMaxInterval(){return this.getTimeSinceLastAttempt()>=i}getTimeTillMaxInterval(){return i-this.getTimeSinceLastAttempt()}hasCompletelyRecoveredFromBackoff(){return this._currentIntervalMs<=n}adjustForSuccess(){const e=this._currentIntervalMs;e!==n&&(this._currentIntervalMs=Math.max(n,Math.floor(e/2)))}adjustForFailure(){const e=this._currentIntervalMs;this._currentIntervalMs=Math.min(i,2*e)}getTimeUntilNextFlush(){return this.getCurrentIntervalMs()-this.getTimeSinceLastAttempt()}}},6821:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EventRetryConstants=void 0,t.EventRetryConstants={MAX_RETRY_ATTEMPTS:8,DEFAULT_BATCH_SIZE:100,MAX_PENDING_BATCHES:40,TICK_INTERVAL_MS:1e3,QUICK_FLUSH_WINDOW_MS:200,MAX_LOCAL_STORAGE:500,get MAX_QUEUED_EVENTS(){return this.DEFAULT_BATCH_SIZE*this.MAX_PENDING_BATCHES}}},6913:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},6978:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var s=Object.getOwnPropertyDescriptor(t,n);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,s)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=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(3509);const r=n(3509),o=n(882);Object.defineProperty(t,"Diagnostics",{enumerable:!0,get:function(){return o.Diagnostics}});const a=n(5434);Object.defineProperty(t,"EventLogger",{enumerable:!0,get:function(){return a.EventLogger}});const l=n(8024);Object.defineProperty(t,"Log",{enumerable:!0,get:function(){return l.Log}});const u=n(6512),c=n(1638);Object.defineProperty(t,"Storage",{enumerable:!0,get:function(){return c.Storage}}),s(n(3509),t),s(n(4681),t),s(n(8683),t),s(n(5638),t),s(n(882),t),s(n(4387),t),s(n(4358),t),s(n(3194),t),s(n(6913),t),s(n(3918),t),s(n(7061),t),s(n(8024),t),s(n(843),t),s(n(2610),t),s(n(4703),t),s(n(2509),t),s(n(5025),t),s(n(414),t),s(n(686),t),s(n(9839),t),s(n(6272),t),s(n(2626),t),s(n(4351),t),s(n(1180),t),s(n(2166),t),s(n(7253),t),s(n(6512),t),s(n(7754),t),s(n(8474),t),s(n(9851),t),s(n(9652),t),s(n(1570),t),s(n(1638),t),s(n(3705),t),s(n(10),t),s(n(8873),t),s(n(7047),t),s(n(2701),t),s(n(1148),t),s(n(5747),t),Object.assign((0,r._getStatsigGlobal)(),{Log:l.Log,SDK_VERSION:u.SDK_VERSION})},7002:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EngagementManager=void 0;const i=n(6978);t.EngagementManager=class{constructor(){this._lastScrollY=0,this._maxScrollY=0,this._lastScrollPercentage=0,this._maxScrollPercentage=0,this._lastPageViewTime=Date.now(),this._inactiveTimer=null,this._onInactivityCallback=null,this._meaningfulEngagementOccurred=!1,this._lastBumpTime=0,this._initializeScrollTracking()}_initializeScrollTracking(){const e=(0,i._getWindowSafe)();e&&(e.addEventListener("scroll",()=>this._handleScroll()),e.addEventListener("scrollend",()=>this._handleScroll()),e.addEventListener("resize",()=>this._handleScroll()))}_handleScroll(){const e=(0,i._getWindowSafe)(),t=(0,i._getDocumentSafe)();if(!e||!t)return;const n=t.body.scrollHeight,s=e.scrollY||t.documentElement.scrollTop||0,r=e.innerHeight;this._lastScrollY=s,this._maxScrollY=Math.max(this._maxScrollY,s);const o=Math.min(100,Math.round((s+r)/n*100));this._lastScrollPercentage=o,this._maxScrollPercentage=Math.max(this._maxScrollPercentage,o),this.bumpInactiveTimer()}getScrollMetrics(){return{lastScrollY:this._lastScrollY,maxScrollY:this._maxScrollY,lastScrollPercentage:this._lastScrollPercentage,maxScrollPercentage:this._maxScrollPercentage,scrollDepth:this._maxScrollPercentage}}getPageViewLength(){return Date.now()-this._lastPageViewTime}setLastPageViewTime(e){this._lastPageViewTime=e}startInactivityTracking(e){this._onInactivityCallback=e}bumpInactiveTimer(){const e=(0,i._getWindowSafe)();if(!e)return;const t=Date.now();t-this._lastBumpTime<1e3||(this._lastBumpTime=t,this._inactiveTimer&&clearTimeout(this._inactiveTimer),this._inactiveTimer=e.setTimeout(()=>{this._onInactivityCallback&&this._onInactivityCallback()},6e5))}setMeaningfulEngagementOccurred(e){this._meaningfulEngagementOccurred=e}getPageViewEndMetadata(){const e=Object.assign(Object.assign({},this.getScrollMetrics()),{pageViewLength:this.getPageViewLength(),meaningfulEngagementOccurred:this._meaningfulEngagementOccurred});return this.setMeaningfulEngagementOccurred(!1),e}}},7047:(e,t)=>{"use strict";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)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},7103:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))(function(s,r){function o(e){try{l(i.next(e))}catch(e){r(e)}}function a(e){try{l(i.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,a)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t.EventSender=void 0;const s=n(8024),r=n(2610),o=n(686),a=n(6512),l=n(2701);t.EventSender=class{constructor(e,t,n,i,s){this._sdkKey=e,this._network=t,this._emitter=n,this._options=s,this._logEventUrlConfig=i}setLogEventCompressionMode(e){this._network.setLogEventCompressionMode(e)}sendBatch(e){return i(this,void 0,void 0,function*(){var t,n,i;let r="event_sender_unexpected_exception";const o={};try{const i=(0,l._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);r="event_sender_pre_logs_flushed_emitter_exception",this._emitter({name:"pre_logs_flushed",events:e.events}),r=i?"event_sender_unexpected_exception":"event_sender_post_exception";const s=i?this._sendEventsViaBeacon(e,o):yield this._sendEventsViaPost(e,o);return s.success?(r="event_sender_logs_flushed_emitter_exception",this._emitter({name:"logs_flushed",events:e.events}),s):Object.assign(Object.assign(Object.assign({success:!1,statusCode:s.statusCode,failurePath:s.failurePath},s.failureErrorMessage?{failureErrorMessage:s.failureErrorMessage}:{}),s.failureDiagnosticBucket?{failureDiagnosticBucket:s.failureDiagnosticBucket}:{}),s.failureDiagnosticMetadata?{failureDiagnosticMetadata:s.failureDiagnosticMetadata}:{})}catch(e){return s.Log.warn("Failed to send batch:",e),Object.assign(Object.assign(Object.assign({success:!1,statusCode:-1,failurePath:null!==(i=o.path)&&void 0!==i?i:r},o.errorMessage?{failureErrorMessage:o.errorMessage}:{}),o.diagnosticBucket?{failureDiagnosticBucket:o.diagnosticBucket}:{}),o.diagnosticMetadata?{failureDiagnosticMetadata:o.diagnosticMetadata}:{})}})}_sendEventsViaPost(e,t){return i(this,void 0,void 0,function*(){var n,i;const s=yield this._network.post(this._getRequestData(e),t),r=null!==(n=null==s?void 0:s.code)&&void 0!==n?n:-1;return-1===r?Object.assign(Object.assign(Object.assign({success:!1,statusCode:-1,failurePath:null!==(i=t.path)&&void 0!==i?i:void 0===s?"event_sender_post_returned_undefined":"event_sender_post_returned_null"},t.errorMessage?{failureErrorMessage:t.errorMessage}:{}),t.diagnosticBucket?{failureDiagnosticBucket:t.diagnosticBucket}:{}),t.diagnosticMetadata?{failureDiagnosticMetadata:t.diagnosticMetadata}:{}):{success:r>=200&&r<300,statusCode:r}})}_sendEventsViaBeacon(e,t){var n;const i=this._network.beacon(this._getRequestData(e),t);return Object.assign(Object.assign(Object.assign({success:i,statusCode:i?200:-1,failurePath:i?void 0:null!==(n=t.path)&&void 0!==n?n:"beacon_send_false"},!i&&t.errorMessage?{failureErrorMessage:t.errorMessage}:{}),!i&&t.diagnosticBucket?{failureDiagnosticBucket:t.diagnosticBucket}:{}),!i&&t.diagnosticMetadata?{failureDiagnosticMetadata:t.diagnosticMetadata}:{})}_getRequestData(e){return{sdkKey:this._sdkKey,data:{events:e.events},urlConfig:this._logEventUrlConfig,retries:3,preserveFailedStatusCode:!0,isCompressable:!0,params:{[r.NetworkParam.EventCount]:String(e.events.length)},headers:{"statsig-event-count":String(e.events.length),"statsig-retry-count":String(e.attempts),"statsig-sdk-type":o.SDKType._get(this._sdkKey),"statsig-sdk-version":a.SDK_VERSION},credentials:"same-origin"}}}},7187:(e,t)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.FlushType=void 0,function(e){e.ScheduledMaxTime="scheduled:max_time",e.ScheduledFullBatch="scheduled:full_batch",e.Limit="limit",e.Manual="manual",e.Shutdown="shutdown"}(n||(t.FlushType=n={}))},7253:(e,t)=>{"use strict";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",s="statsig::layer_exposure",r=(e,t,n,i,s)=>(n.bootstrapMetadata&&(i.bootstrapMetadata=n.bootstrapMetadata),{eventName:e,user:t,value:null,metadata:a(n,i),secondaryExposures:s,time:Date.now()});function o(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===s,t._createGateExposure=(e,t,n)=>{var s,a,l;const u={gate:t.name,gateValue:String(t.value),ruleID:t.ruleID};return null!=(null===(s=t.__evaluation)||void 0===s?void 0:s.version)&&(u.configVersion=t.__evaluation.version),r(i,e,t.details,u,o(null!==(l=null===(a=t.__evaluation)||void 0===a?void 0:a.secondary_exposures)&&void 0!==l?l:[],n))},t._mapExposures=o,t._createConfigExposure=(e,t,i)=>{var s,a,l,u;const c={config:t.name,ruleID:t.ruleID};return null!=(null===(s=t.__evaluation)||void 0===s?void 0:s.version)&&(c.configVersion=t.__evaluation.version),null!=(null===(a=t.__evaluation)||void 0===a?void 0:a.passed)&&(c.rulePassed=String(t.__evaluation.passed)),r(n,e,t.details,c,o(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,c,d,h,_;const g=t.__evaluation,v=!0===(null===(a=null==g?void 0:g.explicit_parameters)||void 0===a?void 0:a.includes(n));let f="",p=null!==(l=null==g?void 0:g.undelegated_secondary_exposures)&&void 0!==l?l:[];v&&(f=null!==(u=g.allocated_experiment_name)&&void 0!==u?u:"",p=null!==(c=g.secondary_exposures)&&void 0!==c?c:[]);const m=null===(d=t.__evaluation)||void 0===d?void 0:d.parameter_rule_ids,y={config:t.name,parameterName:n,ruleID:null!==(h=null==m?void 0:m[n])&&void 0!==h?h:t.ruleID,allocatedExperiment:f,isExplicitParameter:String(v)};return null!=(null===(_=t.__evaluation)||void 0===_?void 0:_.version)&&(y.configVersion=t.__evaluation.version),r(s,e,t.details,y,o(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)},7287:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.V2InitializeContainer=void 0;const i=n(6978);t.V2InitializeContainer=class{constructor(e){this._values=e}getGate(e){var t,n,i;const s=this._getResultFromLookup(this._values.feature_gates,e);return s?{name:e,value:!0===s.v,rule_id:null!==(t=s.r)&&void 0!==t?t:"default",secondary_exposures:null!==(n=s.s)&&void 0!==n?n:[],id_type:null!==(i=s.i)&&void 0!==i?i:""}:null}getConfig(e){var t,n,i,s;const r=this._getResultFromLookup(this._values.dynamic_configs,e);return r?{name:e,value:null!==(t=this._values.values[r.v])&&void 0!==t?t:{},rule_id:r.r,secondary_exposures:null!==(n=r.s)&&void 0!==n?n:[],id_type:null!==(i=r.i)&&void 0!==i?i:"",is_user_in_experiment:!0===r.ue,passed:!0===r.p,group_name:null!==(s=r.gn)&&void 0!==s?s:void 0,is_experiment_active:!0===r.ea,group:r.r,is_device_based:"stableID"===r.i}:null}getLayer(e){var t,n,i,s,r,o;const a=this._getResultFromLookup(this._values.layer_configs,e);return a?{name:e,value:null!==(t=this._values.values[a.v])&&void 0!==t?t:{},rule_id:a.r,secondary_exposures:null!==(n=a.s)&&void 0!==n?n:[],is_user_in_experiment:!0===a.ue,group_name:null!==(i=a.gn)&&void 0!==i?i:void 0,is_experiment_active:!0===a.ea,group:a.r,is_device_based:"stableID"===a.i,allocated_experiment_name:null!==(s=a.ae)&&void 0!==s?s:"",explicit_parameters:null!==(r=a.ep)&&void 0!==r?r:[],undelegated_secondary_exposures:null!==(o=a.us)&&void 0!==o?o:[],parameter_rule_ids:a.pr}:null}getParamStore(e){return this._getResultFromLookup(this._values.param_stores,e)}getConfigList(){return Object.keys(this._values.dynamic_configs)}getExposureMapping(){return this._values.exposures}_getResultFromLookup(e,t){var n,s;return e&&null!==(s=null!==(n=e[t])&&void 0!==n?n:e[(0,i._DJB2)(t)])&&void 0!==s?s:null}}},7463:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AutoCapture=t.runStatsigAutoCapture=t.StatsigAutoCapturePlugin=void 0;const i=n(6978),s=n(3439),r=n(4600),o=n(1235),a=n(7002),l=n(652),u=n(7958),c=n(7624),d=n(5641),h=n(3884),_={submit:s.AutoCaptureEventName.FORM_SUBMIT,click:s.AutoCaptureEventName.CLICK,copy:s.AutoCaptureEventName.COPY,cut:s.AutoCaptureEventName.COPY};function g(e,t){var n;if((0,i._isServerEnv)())return null;const{sdkKey:s}=e.getContextHandle();if(!(0,i._isServerEnv)()){const e=null!==(n=(0,i._getStatsigGlobal)().acInstances)&&void 0!==n?n:{};if(e[s])return e[s]}return new v(e,t)}t.StatsigAutoCapturePlugin=class{constructor(e){this._options=e,this.__plugin="auto-capture"}bind(e){g(e,this._options)}},t.runStatsigAutoCapture=g;class v{constructor(e,t){var n,s,c,d;this._client=e,this._disabledEvents={},this._previousLoggedPageViewUrl=null,this._hasLoggedPageViewEnd=!1,this._pageViewLogged=!1;const{sdkKey:h,errorBoundary:_,values:g}=e.getContextHandle();this._options=t,this._disabledEvents=null!==(s=null===(n=null==g?void 0:g.auto_capture_settings)||void 0===n?void 0:n.disabled_events)&&void 0!==s?s:{},this._errorBoundary=_,this._errorBoundary.wrap(this,"autoCapture:"),this._client.$on("values_updated",()=>{var e,t;const n=this._client.getContextHandle().values;this._disabledEvents=null!==(t=null===(e=null==n?void 0:n.auto_capture_settings)||void 0===e?void 0:e.disabled_events)&&void 0!==t?t:this._disabledEvents}),this._engagementManager=new a.EngagementManager,this._rageClickManager=new l.default,this._webVitalsManager=new u.WebVitalsManager(this._enqueueAutoCapture.bind(this),_),this._deadClickManager=new o.default(this._enqueueAutoCapture.bind(this),_),this._consoleLogManager=new r.ConsoleLogManager(this._enqueueAutoCapture.bind(this),_,null!==(c=null==t?void 0:t.consoleLogAutoCaptureSettings)&&void 0!==c?c:{enabled:!1}),this._eventFilterFunc=null==t?void 0:t.eventFilterFunc;const v=(0,i._getDocumentSafe)();if(!(0,i._isServerEnv)()){__STATSIG__=(0,i._getStatsigGlobal)();const e=null!==(d=__STATSIG__.acInstances)&&void 0!==d?d:{};e[h]=this,__STATSIG__.acInstances=e}"loading"!==(null==v?void 0:v.readyState)?this._initialize():v.addEventListener("DOMContentLoaded",()=>this._initialize())}_addEventHandlers(){const e=(0,i._getWindowSafe)(),t=(0,i._getDocumentSafe)();if(!e||!t)return;const n=(e,t=!0)=>{var n;const s=e||(null===(n=(0,i._getWindowSafe)())||void 0===n?void 0:n.event);this._autoLogEvent(s),t&&this._engagementManager.bumpInactiveTimer(),"click"===s.type&&s instanceof MouseEvent&&this._rageClickManager.isRageClick(s.clientX,s.clientY,Date.now())&&this._logRageClick(s)};(0,c._registerEventHandler)(t,"click",e=>n(e)),(0,c._registerEventHandler)(t,"submit",e=>n(e)),(0,c._registerEventHandler)(t,"copy",e=>n(e)),(0,c._registerEventHandler)(t,"cut",e=>n(e)),(0,c._registerEventHandler)(e,"error",e=>n(e,!1)),(0,c._registerEventHandler)(e,"pagehide",()=>this._tryLogPageViewEnd()),(0,c._registerEventHandler)(e,"beforeunload",()=>this._tryLogPageViewEnd())}_addPageViewTracking(){const e=(0,i._getWindowSafe)(),t=(0,i._getDocumentSafe)();if(e&&t){if((0,c._registerEventHandler)(e,"popstate",()=>this._tryLogPageView("popstate")),e.history&&"function"==typeof Proxy&&"function"==typeof e.history.pushState)try{const t=e.history.pushState;e.history.pushState=new Proxy(t,{apply:(e,t,[n,i,s])=>{const r=e.apply(t,[n,i,s]);return this._tryLogPageView("pushstate"),r}})}catch(e){}if(e.history&&"function"==typeof Proxy&&"function"==typeof e.history.replaceState)try{const t=e.history.replaceState;e.history.replaceState=new Proxy(t,{apply:(e,t,[n,i,s])=>{const r=e.apply(t,[n,i,s]);return this._tryLogPageView("replacestate"),r}})}catch(e){}this._tryLogPageView()}}_autoLogEvent(e){var t,n,r,o;const a=null===(t=e.type)||void 0===t?void 0:t.toLowerCase();if("error"===a&&e instanceof ErrorEvent)return void this._logError(e);const l=(0,c._getTargetNode)(e);if(!l)return;const u=_[a];if(!u)return;const g=u===s.AutoCaptureEventName.COPY;if(!(0,c._shouldLogEvent)(e,l,g))return;const v={};if(g){const t=null===(r=null===(n=(0,i._getWindowSafe)())||void 0===n?void 0:n.getSelection())||void 0===r?void 0:r.toString();if(!t)return;(null===(o=this._options)||void 0===o?void 0:o.captureCopyText)&&(v.selectedText=(0,c._sanitizeString)(t));const s=e.type||"clipboard";v.clipType=s}const{value:f,metadata:p}=(0,d._gatherEventData)(l);p.isOutbound&&this._engagementManager.setMeaningfulEngagementOccurred(!0),Object.assign(v,p);const m=(0,h._gatherAllMetadata)((0,c._getSafeUrl)());this._enqueueAutoCapture(u,f,Object.assign(Object.assign({},m),v))}_initialize(){this._webVitalsManager.startTracking(),this._deadClickManager.startTracking(),this._consoleLogManager.startTracking(),this._engagementManager.startInactivityTracking(()=>this._tryLogPageViewEnd(!0)),this._addEventHandlers(),this._addPageViewTracking(),this._logSessionStart(),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(s.AutoCaptureEventName.ERROR,e.message,{message:e.message,filename:e.filename,lineno:e.lineno,colno:e.colno,error_str:n})}_logSessionStart(){const e=this._client.getContextHandle().getSession();try{if(!this._isNewSession(e))return;this._enqueueAutoCapture(s.AutoCaptureEventName.SESSION_START,(0,c._getSanitizedPageUrl)(),Object.assign({sessionID:e.data.sessionID},(0,h._gatherAllMetadata)((0,c._getSafeUrl)())),{flushImmediately:!0})}catch(e){this._errorBoundary.logError("AC::logSession",e)}}_tryLogPageView(e){this._webVitalsManager.flushPendingMetrics()&&this._flushImmediately();const t=(0,c._getSafeUrl)(),n=this._previousLoggedPageViewUrl;if(n&&t.pathname===n.pathname)return;this._engagementManager.setLastPageViewTime(Date.now()),this._hasLoggedPageViewEnd=!1;const i=(0,h._gatherAllMetadata)(t);e&&(i.navigation_type=e),this._previousLoggedPageViewUrl&&(i.last_page_view_url=this._previousLoggedPageViewUrl.href),this._pageViewLogged||(this._updateClientWithPossibleFirstTouchMetadata(),this._pageViewLogged=!0),this._enqueueAutoCapture(s.AutoCaptureEventName.PAGE_VIEW,(0,c._getSanitizedPageUrl)(),i,{flushImmediately:!0,addNewSessionMetadata:!0}),this._previousLoggedPageViewUrl=t,this._engagementManager.bumpInactiveTimer()}_tryLogPageViewEnd(e=!1){this._webVitalsManager.flushPendingMetrics()&&this._flushImmediately(),this._hasLoggedPageViewEnd||(this._hasLoggedPageViewEnd=!0,this._enqueueAutoCapture(s.AutoCaptureEventName.PAGE_VIEW_END,(0,c._getSanitizedPageUrl)(),Object.assign(Object.assign({},this._engagementManager.getPageViewEndMetadata()),{dueToInactivity:e}),{flushImmediately:!0}))}_logRageClick(e){if(!(0,c._shouldLogEvent)(e,e.target))return;const{value:t,metadata:n}=(0,d._gatherEventData)(e.target);this._enqueueAutoCapture(s.AutoCaptureEventName.RAGE_CLICK,t,Object.assign(Object.assign({x:e.clientX,y:e.clientY,timestamp:Date.now()},(0,h._gatherAllMetadata)((0,c._getSafeUrl)())),n))}_logPerformance(){const e=(0,i._getWindowSafe)();e&&e.performance&&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),this._enqueueAutoCapture(s.AutoCaptureEventName.PERFORMANCE,(0,c._getSanitizedPageUrl)(),Object.assign(Object.assign({},t),(0,h._getNetworkInfo)()))},1)}_enqueueAutoCapture(e,t,n,r){var o,a,l;if(!t)return;const u=e.slice(14);if(this._disabledEvents[e]||this._disabledEvents[u])return;const c=(0,s.isUserActionAutoCaptureEvent)(e),d=this._client.getContextHandle().getSession(c);try{const s=Object.assign({sessionID:d.data.sessionID,page_url:null!==(l=null===(a=null===(o=(0,i._getWindowSafe)())||void 0===o?void 0:o.location)||void 0===a?void 0:a.href)&&void 0!==l?l:""},n);(null==r?void 0:r.addNewSessionMetadata)&&(s.isNewSession=String(this._isNewSession(d)));const u={eventName:e,value:t,metadata:s};if(this._eventFilterFunc&&!this._eventFilterFunc(u))return;this._client.logEvent(u),(null==r?void 0:r.flushImmediately)&&this._flushImmediately()}catch(e){this._errorBoundary.logError("AC::enqueue",e)}}_updateClientWithPossibleFirstTouchMetadata(){const e=this._client;e._possibleFirstTouchMetadata=(0,h._getPossibleFirstTouchMetadata)((0,c._getSafeUrl)()),Object.keys(e._possibleFirstTouchMetadata).length>0&&(e._user=Object.assign(Object.assign({},e._user),{analyticsOnlyMetadata:Object.assign(Object.assign({},e._possibleFirstTouchMetadata),e._user.analyticsOnlyMetadata)}))}_flushImmediately(){this._client.flush().catch(e=>{i.Log.error(e)})}_isNewSession(e){return Math.abs(e.data.startTime-Date.now())<1e3}static getAllMetadata(){return(0,h._gatherAllMetadata)((0,c._getSafeUrl)())}}t.AutoCapture=v},7624:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.wrapFunctionWithRestore=t.throttle=t._sanitizeString=t._getAnchorNodeInHierarchy=t._getSafeTimezoneOffset=t._getSafeTimezone=t._getSafeNavigationType=t._getSafeNetworkInformation=t._registerEventHandler=t._getSanitizedPageUrl=t._getSafeUrlString=t._getSafeUrl=t._shouldLogEvent=t._getTargetNode=t._stripEmptyValues=t.interactiveElements=void 0;const i=n(6978),s=new RegExp("^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$"),r=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$");function o(){var e,t,n;const s=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 r;try{r=new URL(s)}catch(e){r=new URL("error:")}return r}function a(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.interactiveElements=["button","a","input","select","textarea","form","select","label"],t._stripEmptyValues=function(e){return Object.fromEntries(Object.entries(e).filter(([e,t])=>null!=t&&""!==t&&void 0!==t))},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,n,i=!1){if(!e||!n||1!==n.nodeType)return!1;const s=n.tagName.toLowerCase(),r=e.type.toLowerCase();if(n.classList.contains("statsig-no-capture"))return!1;if(i)return!0;switch(s){case"html":return!1;case"form":return["submit"].indexOf(r)>=0;case"input":case"select":case"textarea":return["change","click"].indexOf(r)>=0;default:if("click"===r){const e=window.getComputedStyle(n);if(e&&"pointer"===e.getPropertyValue("cursor"))return!0;if(t.interactiveElements.includes(s))return!0;if("true"===n.getAttribute("contenteditable"))return!0;if(a(n))return!0}return!1}},t._getSafeUrl=o,t._getSafeUrlString=function(){const e=o().toString();return e.startsWith("error:")?"":e},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},t._getSafeNavigationType=function(){var e;const t=(0,i._getWindowSafe)();if(!t||!t.performance||"function"!=typeof t.performance.getEntriesByType)return null;try{const n=t.performance.getEntriesByType("navigation")[0];return null!==(e=null==n?void 0:n.type)&&void 0!==e?e:null}catch(e){return null}},t._getSafeTimezone=function(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return null}},t._getSafeTimezoneOffset=function(){try{return(new Date).getTimezoneOffset()}catch(e){return null}},t._getAnchorNodeInHierarchy=a,t._sanitizeString=function(e){return e?e.replace(/<[^>]*>/g,"").trim().split(/(\s+)/).filter(e=>{return t=e,!s.test((t||"").replace(/[- ]/g,""))&&!r.test((t||"").replace(/[- ]/g,""));var t}).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255):null},t.throttle=function(e,t){let n=0;return function(...i){const s=Date.now();s-n>=t&&(n=s,e(...i))}},t.wrapFunctionWithRestore=function(e,t,n){const i=e[t];if("function"!=typeof i)return()=>{};try{const s=n(i);return Object.defineProperty(s,"__statsig_original__",{enumerable:!1,value:i}),e[t]=s,()=>{e[t]=i}}catch(e){return()=>{}}}},7677:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(6978),s=n(8748),r=n(7287);t.default=class{constructor(e,t){this._sdkKey=e,this._options=t,this._valuesForExternalUse=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._valuesForExternalUse=null,this._source="Loading",this._lcut=0,this._receivedAt=0,this._bootstrapMetadata=null,this._warnings.clear()}finalize(){this._values||(this._source="NoValues")}getValues(){return this._valuesForExternalUse}setValues(e,t){var n,o;if(!e)return!1;const a=(0,i._typedJsonParse)(e.data,"has_updates","EvaluationResponse");return null!=a&&(this._source=e.source,!0!==(null==a?void 0:a.has_updates)||(null!==(n=a.time)&&void 0!==n?n:0)<this._lcut||(this._valuesForExternalUse=(0,i._typedJsonParse)(e.data,"has_updates","EvaluationResponse"),this._lcut=a.time,this._receivedAt=e.receivedAt,"init-v2"===a.response_format?this._values=new r.V2InitializeContainer(a):this._values=new s.V1InitializeContainer(a),this._bootstrapMetadata=this._extractBootstrapMetadata(e.source,a),e.source&&a.user&&this._setWarningState(t,a),i.SDKFlags.setFlags(this._sdkKey,null!==(o=a.sdk_flags)&&void 0!==o?o:{})),!0)}getWarnings(){if(0!==this._warnings.size)return Array.from(this._warnings)}getGate(e){const t=this._values?this._values.getGate(e):null;return this._getDetailedStoreResult(t)}getConfig(e){const t=this._values?this._values.getConfig(e):null;return this._getDetailedStoreResult(t)}getConfigList(){return this._values?this._values.getConfigList():[]}getLayer(e){const t=this._values?this._values.getLayer(e):null;return this._getDetailedStoreResult(t)}getParamStore(e){const t=this._values?this._values.getParamStore(e):null;return this._getDetailedStoreResult(t)}getSource(){return this._source}getExposureMapping(){var e;return null===(e=this._values)||void 0===e?void 0:e.getExposureMapping()}_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){return{result:e,details:this._getDetails(null==e)}}_setWarningState(e,t){var n,s,r;const o=i.StableID.get(this._sdkKey);if((null===(n=e.customIDs)||void 0===n?void 0:n.stableID)===o||!(null===(s=e.customIDs)||void 0===s?void 0:s.stableID)&&!o){if("user"in t){let n=t.user,s=Object.assign(Object.assign({},e),{analyticsOnlyMetadata:void 0,privateAttributes:void 0});(null===(r=this._options)||void 0===r?void 0:r.disableStableID)&&(s=Object.assign(Object.assign({},s),{customIDs:Object.assign(Object.assign({},s.customIDs),{stableID:void 0})}),n=Object.assign(Object.assign({},n),{customIDs:Object.assign(Object.assign({},n.customIDs),{stableID:void 0})})),(0,i._getFullUserHash)(s)!==(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 s=i.reason;const r=null!==(t=i.warnings)&&void 0!==t?t:[];"Bootstrap"===this._source&&r.length>0&&(s+=r[0]),"Uninitialized"!==s&&"NoValues"!==s&&(s=`${s}:${e?"Unrecognized":"Recognized"}`);const o="Bootstrap"===this._source&&null!==(n=this._bootstrapMetadata)&&void 0!==n?n:void 0;return o&&(i.bootstrapMetadata=o),Object.assign(Object.assign({},i),{reason:s})}}},7686:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))(function(s,r){function o(e){try{l(i.next(e))}catch(e){r(e)}}function a(e){try{l(i.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,a)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0});const s=n(6978),r=n(7677),o=n(2944),a=n(9999),l=n(2451);class u extends s.StatsigClientBase{static instance(e){const t=(0,s._getStatsigGlobal)().instance(e);return t instanceof u?t:(s.Log.warn((0,s._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;s.SDKType._setClientType(e,"javascript-client");const u=new o.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(s.MemoPrefix._gate,this._getFeatureGateImpl.bind(this)),this.getDynamicConfig=this._memoize(s.MemoPrefix._dynamicConfig,this._getDynamicConfigImpl.bind(this)),this.getExperiment=this._memoize(s.MemoPrefix._experiment,this._getExperimentImpl.bind(this)),this.getConfigList=this._memoize(s.MemoPrefix._configList,this._getConfigListImpl.bind(this)),this.getLayer=this._memoize(s.MemoPrefix._layer,this._getLayerImpl.bind(this)),this.getParameterStore=this._memoize(s.MemoPrefix._paramStore,this._getParameterStoreImpl.bind(this)),this._store=new r.default(e,null!=n?n:null),this._network=u,this._user=this._configureUser(t,n),this._sdkInstanceID=(0,s.getUUID)(),this._contextHandle=new s.PrecomputedEvaluationsContextHandle(e,()=>this._options,()=>this._errorBoundary,()=>this._store.getValues(),()=>this._user,()=>this._sdkInstanceID);const c=null!==(a=null==n?void 0:n.plugins)&&void 0!==a?a:[];for(const e of c)e.bind(this)}initializeSync(e){var t;return"Uninitialized"!==this.loadingStatus?(0,s.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 r=[...null!==(i=this._store.getWarnings())&&void 0!==i?i:[]];this._resetForUser(e);const o=this.dataAdapter.getDataSync(this._user);null==o&&r.push("NoCachedValues"),this._store.setValues(o,this._user),this._finalizeUpdate(o);const a=null==t?void 0:t.disableBackgroundCacheRefresh;return!0===a||null==a&&"Bootstrap"===(null==o?void 0:o.source)||this._runPostUpdate(null!=o?o:null,this._user),(0,s.createUpdateDetails)(!0,this._store.getSource(),performance.now()-n,this._errorBoundary.getLastSeenErrorAndReset(),this._network.getLastUsedInitUrlAndReset(),r)}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;s.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,s.createUpdateDetails)(!1,this._store.getSource(),-1,new Error("User changed during update"),this._network.getLastUsedInitUrlAndReset());let r=!1;null!=i&&(s.Diagnostics._markInitProcessStart(this._sdkKey),r=this._store.setValues(i,this._user),s.Diagnostics._markInitProcessEnd(this._sdkKey,{success:r})),this._finalizeUpdate(i),r||(this._errorBoundary.attachErrorIfNoneExists(s.UPDATE_DETAIL_ERROR_MESSAGES.NO_NETWORK_DATA),this.$emt({name:"initialization_failure"})),s.Diagnostics._markInitOverallEnd(this._sdkKey,r,this._store.getCurrentSourceDetails());const o=s.Diagnostics._enqueueDiagnosticsEvent(this._user,this._logger,this._sdkKey,this._options);return(0,s.createUpdateDetails)(r,this._store.getSource(),o,this._errorBoundary.getLastSeenErrorAndReset(),this._network.getLastUsedInitUrlAndReset(),this._store.getWarnings())})}getContext(){let e=(0,s._cloneObject)("StatsigUser",this._user);return null==e&&(s.Log.error("Failed to clone user"),e={}),{sdkKey:this._sdkKey,options:this._options,values:this._store.getValues(),user:e,errorBoundary:this._errorBoundary,session:s.StatsigSession.get(this._sdkKey),stableID:s.StableID.get(this._sdkKey),sdkInstanceID:this._sdkInstanceID}}getContextHandle(){return this._contextHandle}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 s.Storage.isReady()||(yield s.Storage.isReadyResolver()),this._logger.start(),this.updateUserAsync(this._user,e)})}_createErrorUpdateDetails(e,t){var n;return(0,s.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=>{s.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,i,r;const o=(0,s._normalizeUser)(e,t),a=null===(n=o.customIDs)||void 0===n?void 0:n.stableID;if(a){const e=null===(r=(i=this.storageProvider).isReadyResolver)||void 0===r?void 0:r.call(i);e?e.then(()=>s.StableID.setOverride(a,this._sdkKey),()=>s.StableID.setOverride(a,this._sdkKey)):s.StableID.setOverride(a,this._sdkKey)}return Object.keys(this._possibleFirstTouchMetadata).length>0&&(o.analyticsOnlyMetadata=Object.assign(Object.assign({},o.analyticsOnlyMetadata),this._possibleFirstTouchMetadata)),o}_getFeatureGateImpl(e,t){var n,i;const{result:r,details:o}=this._store.getGate(e);this._checkUserHasIdForEvaluation(null==r?void 0:r.id_type,e,"Gate"),this._checkInitializationStatus(o.reason);const a=(0,s._makeFeatureGate)(e,o,r),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,s._createGateExposure)(this._user,u,this._store.getExposureMapping()),t),this.$emt({name:"gate_evaluation",gate:u}),u}_getDynamicConfigImpl(e,t){var n,i;const{result:r,details:o}=this._store.getConfig(e);this._checkUserHasIdForEvaluation(null==r?void 0:r.id_type,e,"Dynamic config"),this._checkInitializationStatus(o.reason);const a=(0,s._makeDynamicConfig)(e,o,r),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,s._createConfigExposure)(this._user,u,this._store.getExposureMapping()),t),this.$emt({name:"dynamic_config_evaluation",dynamicConfig:u}),u}_getExperimentImpl(e,t){var n,i,r,o;const{result:a,details:l}=this._store.getConfig(e);this._checkUserHasIdForEvaluation(null==a?void 0:a.id_type,e,"Experiment"),this._checkInitializationStatus(l.reason);const u=(0,s._makeExperiment)(e,l,a);null!=u.__evaluation&&(u.__evaluation.secondary_exposures=(0,s._mapExposures)(null!==(i=null===(n=u.__evaluation)||void 0===n?void 0:n.secondary_exposures)&&void 0!==i?i:[],this._store.getExposureMapping()));const c=null===(o=null===(r=this.overrideAdapter)||void 0===r?void 0:r.getExperimentOverride)||void 0===o?void 0:o.call(r,u,this._user,t),d=null!=c?c:u;return this._enqueueExposure(e,(0,s._createConfigExposure)(this._user,d,this._store.getExposureMapping()),t),this.$emt({name:"experiment_evaluation",experiment:d}),d}_getConfigListImpl(){return this._store.getConfigList()}_getLayerImpl(e,t){var n,i,r;const{result:o,details:a}=this._store.getLayer(e),l=(0,s._makeLayer)(e,a,o),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 c=(0,s._mergeOverride)(l,u,null!==(r=null==u?void 0:u.__value)&&void 0!==r?r:l.__value,n=>{(null==t?void 0:t.disableExposureLog)||this._enqueueExposure(e,(0,s._createLayerParameterExposure)(this._user,c,n,this._store.getExposureMapping()),t)});return this.$emt({name:"layer_evaluation",layer:c}),c}_getParameterStoreImpl(e,t){var n,i;const{result:s,details:r}=this._store.getParamStore(e);this._logger.incrementNonExposureCount(e);const o={name:e,details:r,__configuration:s,get:(0,a._makeParamStoreGetter)(this,s,t)},l=null===(i=null===(n=this.overrideAdapter)||void 0===n?void 0:n.getParamStoreOverride)||void 0===i?void 0:i.call(n,o,t);return null!=l&&(o.__configuration=l.config,o.details=l.details,o.get=(0,a._makeParamStoreGetter)(this,l.config,t)),o}_checkUserHasIdForEvaluation(e,t,n){e&&((0,s._getUnitIDFromUser)(this._user,e)||s.Log.warn(`The user does not have the required id_type "${e}" for ${n} "${t}"`))}_checkInitializationStatus(e){("Uninitialized"===e||e.startsWith("Loading"))&&s.Log.warn(`SDK initialization has not completed. Reason: ${e}`)}}t.default=u},7754:(e,t)=>{"use strict";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"}},7958:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WebVitalsManager=void 0;const i=n(8796),s=n(6978),r=n(3439),o=n(7624),a=["CLS","FCP","INP","LCP","TTFB"];t.WebVitalsManager=class{constructor(e,t){this._enqueueFn=e,this._errorBoundary=t,this._isInitialized=!1,this._metricEvent={url:(0,o._getSafeUrlString)(),sanitizedUrl:(0,o._getSanitizedPageUrl)(),metrics:[],firstMetricTimestamp:void 0}}startTracking(){var e,t;try{if(this._isInitialized)return;const n=null===(t=null===(e=(0,s._getWindowSafe)())||void 0===e?void 0:e.location)||void 0===t?void 0:t.protocol;if("https:"!==n&&"http:"!==n)return;(0,i.onCLS)(e=>this._handleMetric(e)),(0,i.onFCP)(e=>this._handleMetric(e)),(0,i.onINP)(e=>this._handleMetric(e)),(0,i.onLCP)(e=>this._handleMetric(e)),(0,i.onTTFB)(e=>this._handleMetric(e)),this._isInitialized=!0}catch(e){s.Log.error("Error starting web vitals tracking",e),this._errorBoundary.logError("autoCapture:WebVitalsManager",e)}}flushPendingMetrics(){return 0!==this._metricEvent.metrics.length&&(this._enqueueWebVitalsAutoCaptureEvent(),!0)}_handleMetric(e){if(void 0===this._metricEvent.firstMetricTimestamp&&(this._metricEvent.firstMetricTimestamp=Date.now()),void 0===e||void 0===(null==e?void 0:e.name))return;const t=(0,o._getSafeUrlString)();if(""===t)return;if(!a.includes(e.name))return;t!==this._metricEvent.url&&(this._enqueueWebVitalsAutoCaptureEvent(),this._metricEvent.url=t);const n=e;this._metricEvent.metrics.push({name:n.name,value:n.value,delta:n.delta,id:n.id,rating:n.rating,navigationType:n.navigationType}),this._metricEvent.metrics.length===a.length&&this._enqueueWebVitalsAutoCaptureEvent()}_enqueueWebVitalsAutoCaptureEvent(){if(""===this._metricEvent.url||0===this._metricEvent.metrics.length)return;const e={};this._metricEvent.metrics.forEach(t=>{const n=t.name.toLowerCase();e[`${n}_value`]=t.value,e[`${n}_delta`]=t.delta,e[`${n}_id`]=t.id,e[`${n}_rating`]=t.rating,null!=t.navigationType&&(e.navigation_type=t.navigationType)}),this._enqueueFn(r.AutoCaptureEventName.WEB_VITALS,this._metricEvent.sanitizedUrl,Object.assign(Object.assign({},e),{first_metric_timestamp:this._metricEvent.firstMetricTimestamp})),this._metricEvent={url:(0,o._getSafeUrlString)(),sanitizedUrl:(0,o._getSanitizedPageUrl)(),metrics:[],firstMetricTimestamp:void 0}}}},8024:(e,t)=>{"use strict";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},8056:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))(function(s,r){function o(e){try{l(i.next(e))}catch(e){r(e)}}function a(e){try{l(i.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,a)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t.FlushCoordinator=void 0;const s=n(6821),r=n(7103),o=n(6697),a=n(7187),l=n(3918),u=n(8024),c=n(4703),d=n(414),h=n(9839),_=n(7754),g=n(1638),v=new Set(["network_request_timed_out_no_response","network_request_exception_no_response","event_sender_post_returned_null","event_sender_post_returned_undefined","event_sender_post_exception"]);t.FlushCoordinator=class{constructor(e,t,n,i,s,a,l,u,c,d){this._cooldownTimer=null,this._maxIntervalTimer=null,this._hasRunQuickFlush=!1,this._currentFlushPromise=null,this._creationTime=Date.now(),this._isShuttingDown=!1,this._storageKey=null,this._flushInterval=new o.FlushInterval,this._batchQueue=e,this._pendingEvents=t,this._onPrepareFlush=n,this._errorBoundary=d,this._sdkKey=i,this._loggingEnabled=c,this._eventSender=new r.EventSender(i,s,a,l,u)}setLoggingEnabled(e){this._loggingEnabled=e}setLogEventCompressionMode(e){this._eventSender.setLogEventCompressionMode(e)}startScheduledFlushCycle(){this._scheduleNextFlush()}stopScheduledFlushCycle(){this._clearAllTimers()}addEvent(e){this._pendingEvents.addToPendingEventsQueue(e),this._currentFlushPromise||this._pendingEvents.hasEventsForFullBatch()&&this.processLimitFlush()}processManualFlush(){return i(this,void 0,void 0,function*(){return this._currentFlushPromise&&(yield this._currentFlushPromise),this._currentFlushPromise=this._executeFlush(a.FlushType.Manual).finally(()=>{this._currentFlushPromise=null,this._scheduleNextFlush()}),this._currentFlushPromise})}processShutdown(){return i(this,void 0,void 0,function*(){return this._isShuttingDown=!0,this._clearAllTimers(),this._currentFlushPromise&&(yield this._currentFlushPromise),this._currentFlushPromise=this._executeFlush(a.FlushType.Shutdown).catch(e=>{u.Log.error(`Error during shutdown flush: ${e}`)}).finally(()=>{this._currentFlushPromise=null}),this._currentFlushPromise})}_executeFlush(e){return i(this,void 0,void 0,function*(){this._clearAllTimers();try{this._prepareQueueForFlush(e);const t=this._batchQueue.takeAllBatches();if(0===t.length)return;yield Promise.all(t.map(t=>this._processOneBatch(t,e)))}finally{this._isShuttingDown||this._scheduleNextFlush()}})}checkQuickFlush(){this._hasRunQuickFlush||Date.now()-this._creationTime>s.EventRetryConstants.QUICK_FLUSH_WINDOW_MS||(this._hasRunQuickFlush=!0,setTimeout(()=>{this.processManualFlush().catch(e=>{u.Log.warn("Quick flush failed:",e)})},s.EventRetryConstants.QUICK_FLUSH_WINDOW_MS))}_attemptScheduledFlush(){if(this._currentFlushPromise)return void this._scheduleNextFlush();const e=this.containsAtLeastOneFullBatch(),t=this._flushInterval.hasReachedMaxInterval();if(!e&&!t)return void this._scheduleNoopPollTick();let n;this._flushInterval.markFlushAttempt(),n=e?a.FlushType.ScheduledFullBatch:a.FlushType.ScheduledMaxTime,this._currentFlushPromise=this._processNextBatch(n).then(()=>{}).catch(e=>{u.Log.error("Error during scheduled flush:",e)}).finally(()=>{this._currentFlushPromise=null,this._scheduleNextFlush()})}processLimitFlush(){this._flushInterval.hasCompletelyRecoveredFromBackoff()&&(this._currentFlushPromise||(this._currentFlushPromise=this._processLimitFlushInternal().catch(e=>{u.Log.error("Error during limit flush",e)}).finally(()=>{this._currentFlushPromise=null,this._scheduleNextFlush()})))}_processLimitFlushInternal(){return i(this,void 0,void 0,function*(){if(yield this._processNextBatch(a.FlushType.Limit))for(;this._flushInterval.hasCompletelyRecoveredFromBackoff()&&this.containsAtLeastOneFullBatch()&&(yield this._processNextBatch(a.FlushType.Limit)););})}_scheduleNextFlush(){if(this._clearAllTimers(),this._isShuttingDown)return;const e=Math.max(0,this._flushInterval.getTimeUntilNextFlush());this._cooldownTimer=setTimeout(()=>{this._cooldownTimer=null,h.StatsigSession.checkForIdleSession(this._sdkKey),this._attemptScheduledFlush()},e);const t=Math.max(0,this._flushInterval.getTimeTillMaxInterval());this._maxIntervalTimer=setTimeout(()=>{this._maxIntervalTimer=null,h.StatsigSession.checkForIdleSession(this._sdkKey),this._attemptScheduledFlush()},t)}_clearAllTimers(){null!==this._cooldownTimer&&(clearTimeout(this._cooldownTimer),this._cooldownTimer=null),null!==this._maxIntervalTimer&&(clearTimeout(this._maxIntervalTimer),this._maxIntervalTimer=null)}_scheduleNoopPollTick(){if(this._clearAllTimers(),this._isShuttingDown)return;this._cooldownTimer=setTimeout(()=>{this._cooldownTimer=null,h.StatsigSession.checkForIdleSession(this._sdkKey),this._attemptScheduledFlush()},s.EventRetryConstants.TICK_INTERVAL_MS);const e=Math.max(0,this._flushInterval.getTimeTillMaxInterval());this._maxIntervalTimer=setTimeout(()=>{this._maxIntervalTimer=null,h.StatsigSession.checkForIdleSession(this._sdkKey),this._attemptScheduledFlush()},e)}_processNextBatch(e){return i(this,void 0,void 0,function*(){this._prepareQueueForFlush(e);const t=this._batchQueue.takeNextBatch();return!!t&&this._processOneBatch(t,e)})}_processOneBatch(e,t){return i(this,void 0,void 0,function*(){if(this._loggingEnabled!==_.LoggingEnabledOption.always&&(0,d._isServerEnv)())return this._flushInterval.adjustForSuccess(),!0;const n=yield this._eventSender.sendBatch(e);return n.success?(this._flushInterval.adjustForSuccess(),!0):(this._flushInterval.adjustForFailure(),this._handleFailure(e,t,n.statusCode,n.failurePath,n.failureErrorMessage,n.failureDiagnosticBucket,n.failureDiagnosticMetadata),!1)})}_prepareQueueForFlush(e){this._onPrepareFlush();const t=this.convertPendingEventsToBatches();t>0&&(u.Log.warn(`Dropped ${t} events`),this._errorBoundary.logDroppedEvents(t,"Batch queue limit reached during batching",{loggingInterval:this._flushInterval.getCurrentIntervalMs(),batchSize:this._batchQueue.batchSize(),maxPendingBatches:s.EventRetryConstants.MAX_PENDING_BATCHES,flushType:e,retries:"dropped before batching"}))}containsAtLeastOneFullBatch(){return this._pendingEvents.hasEventsForFullBatch()||this._batchQueue.hasFullBatch()}convertPendingEventsToBatches(){if(this._pendingEvents.isEmpty())return 0;const e=this._pendingEvents.takeAll();return this._batchQueue.createBatches(e)}_isRetryableBatch(e,t){return!!c.RETRYABLE_CODES.has(e)||!(-1!==e||!t||!v.has(t))}_handleFailure(e,t,n,i,r,o,l){if(t===a.FlushType.Shutdown)return u.Log.warn(`${t} flush failed during shutdown. ${e.events.length} event(s) will be saved to storage for retry in next session.`),void this._saveShutdownFailedEventsToStorage(e.events);if(!this._isRetryableBatch(n,i)){const s="non-retryable error";return u.Log.warn(`${t} flush failed after ${e.attempts} attempt(s). ${e.events.length} event(s) will be dropped. Non-retryable error: ${n}`),void this._errorBoundary.logEventRequestFailure(e.events.length,s,t,n,e.attempts,i,r,o,l)}if(e.attempts>=s.EventRetryConstants.MAX_RETRY_ATTEMPTS){const s="max retry attempts exceeded";return u.Log.warn(`${t} flush failed after ${e.attempts} attempt(s). ${e.events.length} event(s) will be dropped.`),void this._errorBoundary.logEventRequestFailure(e.events.length,s,t,n,e.attempts,i,r,o,l)}e.incrementAttempts();const c=this._batchQueue.requeueBatch(e);c>0&&(u.Log.warn(`Failed to requeue batch : dropped ${c} events due to full queue`),this._errorBoundary.logDroppedEvents(c,"Batch queue limit reached during requeue",{loggingInterval:this._flushInterval.getCurrentIntervalMs(),batchSize:this._batchQueue.batchSize(),maxPendingBatches:s.EventRetryConstants.MAX_PENDING_BATCHES,flushType:t,retries:e.attempts}))}loadAndRetryShutdownFailedEvents(){return i(this,void 0,void 0,function*(){const e=this._getStorageKey();try{g.Storage.isReady()||(yield g.Storage.isReadyResolver());const t=this._getShutdownFailedEventsFromStorage(e);if(0===t.length)return;u.Log.debug(`Loading ${t.length} failed shutdown event(s) from storage for retry`),g.Storage.removeItem(e),t.forEach(e=>{this.addEvent(e)}),yield this.processManualFlush()}catch(e){u.Log.warn("Failed to load and retry failed shutdown events:",e)}})}_getStorageKey(){return this._storageKey||(this._storageKey=`statsig.failed_shutdown_events.${(0,l._DJB2)(this._sdkKey)}`),this._storageKey}_saveShutdownFailedEventsToStorage(e){const t=this._getStorageKey();try{let n=[...this._getShutdownFailedEventsFromStorage(t),...e];n.length>s.EventRetryConstants.MAX_LOCAL_STORAGE&&(n=n.slice(-s.EventRetryConstants.MAX_LOCAL_STORAGE)),(0,g._setObjectInStorage)(t,n),u.Log.debug(`Saved ${e.length} failed shutdown event(s) to storage (total stored: ${n.length})`)}catch(e){u.Log.warn("Unable to save failed shutdown events to storage:",e)}}_getShutdownFailedEventsFromStorage(e){try{const t=(0,g._getObjectFromStorage)(e);return Array.isArray(t)?t:[]}catch(e){return[]}}}},8238:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var s=Object.getOwnPropertyDescriptor(t,n);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,s)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=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}),s(n(9950),t)},8474:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},8683:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PrecomputedEvaluationsContextHandle=void 0;const i=n(8024),s=n(414),r=n(9839),o=n(2626);t.PrecomputedEvaluationsContextHandle=class{constructor(e,t,n,i,s,r){this._sdkKey=e,this._getOptions=t,this._getErrorBoundary=n,this._getValues=i,this._getUser=s,this._getSdkInstanceID=r}get sdkKey(){return this._sdkKey}get options(){return this._getOptions()}get errorBoundary(){return this._getErrorBoundary()}get values(){return this._getValues()}get user(){let e=(0,s._cloneObject)("StatsigUser",this._getUser());return null==e&&(i.Log.error("Failed to clone user"),e={}),e}getSession(e=!0){return r.StatsigSession.get(this._sdkKey,e)}get stableID(){return o.StableID.get(this._sdkKey)}get sdkInstanceID(){return this._getSdkInstanceID()}toContext(e=!0){return{sdkKey:this.sdkKey,options:this.options,values:this.values,user:this.user,errorBoundary:this.errorBoundary,session:this.getSession(e),stableID:this.stableID,sdkInstanceID:this.sdkInstanceID}}}},8711:(e,t)=>{"use strict";function n(e,t){return e.length<=t?e:e.slice(0,t)+"..."}function i(e,t){return t<=0||"object"==typeof e&&null!==e&&Object.keys(e).some(n=>i(e[n],t-1))}Object.defineProperty(t,"__esModule",{value:!0}),t._getStackTrace=t._safeStringify=void 0,t._safeStringify=function(e,t,s,r){try{return function(e,t,n){if(s=e,"[object Object]"===Object.prototype.toString.call(s)){if(Object.keys(e).length>t)return!0;if(i(e,n))return!0}var s;return"function"==typeof e}(e,t,s)?function(e,t){return n(e.toString(),t)}(e,r):n("string"==typeof e?e:"object"==typeof e&&null!==e?JSON.stringify(e):String(e),r)}catch(e){return n("[Unserializable]",r)}},t._getStackTrace=function(){var e,t;try{return null!==(t=null===(e=(new Error).stack)||void 0===e?void 0:e.split("\n").slice(2))&&void 0!==t?t:[]}catch(e){return[]}}},8748:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.V1InitializeContainer=void 0;const i=n(6978);t.V1InitializeContainer=class{constructor(e){this._values=e}getGate(e){return this._getResultFromLookup(this._values.feature_gates,e)}getConfig(e){return this._getResultFromLookup(this._values.dynamic_configs,e)}getLayer(e){return this._getResultFromLookup(this._values.layer_configs,e)}getParamStore(e){return this._getResultFromLookup(this._values.param_stores,e)}getConfigList(){return Object.keys(this._values.dynamic_configs)}getExposureMapping(){return this._values.exposures}_getResultFromLookup(e,t){var n,s;return e&&null!==(s=null!==(n=e[t])&&void 0!==n?n:e[(0,i._DJB2)(t)])&&void 0!==s?s:null}}},8796:function(e,t){!function(e){"use strict";let t=-1;const n=e=>{addEventListener("pageshow",n=>{n.persisted&&(t=n.timeStamp,e(n))},!0)},i=(e,t,n,i)=>{let s,r;return o=>{t.value>=0&&(o||i)&&(r=t.value-(s??0),(r||void 0===s)&&(s=t.value,t.delta=r,t.rating=((e,t)=>e>t[1]?"poor":e>t[0]?"needs-improvement":"good")(t.value,n),e(t)))}},s=e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))},r=()=>{const e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},o=()=>{const e=r();return e?.activationStart??0},a=(e,n=-1)=>{const i=r();let s="navigate";return t>=0?s="back-forward-cache":i&&(document.prerendering||o()>0?s="prerender":document.wasDiscarded?s="restore":i.type&&(s=i.type.replace(/_/g,"-"))),{name:e,value:n,rating:"good",delta:0,entries:[],id:`v5-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:s}},l=new WeakMap;function u(e,t){return l.get(e)||l.set(e,new t),l.get(e)}class c{t;i=0;o=[];h(e){if(e.hadRecentInput)return;const t=this.o[0],n=this.o.at(-1);this.i&&t&&n&&e.startTime-n.startTime<1e3&&e.startTime-t.startTime<5e3?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),this.t?.(e)}}const d=(e,t,n={})=>{try{if(PerformanceObserver.supportedEntryTypes.includes(e)){const i=new PerformanceObserver(e=>{Promise.resolve().then(()=>{t(e.getEntries())})});return i.observe({type:e,buffered:!0,...n}),i}}catch{}},h=e=>{let t=!1;return()=>{t||(e(),t=!0)}};let _=-1;const g=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,v=e=>{"hidden"===document.visibilityState&&_>-1&&(_="visibilitychange"===e.type?e.timeStamp:0,p())},f=()=>{addEventListener("visibilitychange",v,!0),addEventListener("prerenderingchange",v,!0)},p=()=>{removeEventListener("visibilitychange",v,!0),removeEventListener("prerenderingchange",v,!0)},m=()=>{if(_<0){const e=o(),t=document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").filter(t=>"hidden"===t.name&&t.startTime>e)[0]?.startTime;_=t??g(),f(),n(()=>{setTimeout(()=>{_=g(),f()})})}return{get firstHiddenTime(){return _}}},y=e=>{document.prerendering?addEventListener("prerenderingchange",()=>e(),!0):e()},b=[1800,3e3],S=(e,t={})=>{y(()=>{const r=m();let l,u=a("FCP");const c=d("paint",e=>{for(const t of e)"first-contentful-paint"===t.name&&(c.disconnect(),t.startTime<r.firstHiddenTime&&(u.value=Math.max(t.startTime-o(),0),u.entries.push(t),l(!0)))});c&&(l=i(e,u,b,t.reportAllChanges),n(n=>{u=a("FCP"),l=i(e,u,b,t.reportAllChanges),s(()=>{u.value=performance.now()-n.timeStamp,l(!0)})}))})},E=[.1,.25];let C=0,w=1/0,k=0;const O=e=>{for(const t of e)t.interactionId&&(w=Math.min(w,t.interactionId),k=Math.max(k,t.interactionId),C=k?(k-w)/7+1:0)};let I;const D=()=>I?C:performance.interactionCount??0;let M=0;class T{u=[];l=new Map;m;p;v(){M=D(),this.u.length=0,this.l.clear()}T(){const e=Math.min(this.u.length-1,Math.floor((D()-M)/50));return this.u[e]}h(e){if(this.m?.(e),!e.interactionId&&"first-input"!==e.entryType)return;const t=this.u.at(-1);let n=this.l.get(e.interactionId);if(n||this.u.length<10||e.duration>t.P){if(n?e.duration>n.P?(n.entries=[e],n.P=e.duration):e.duration===n.P&&e.startTime===n.entries[0].startTime&&n.entries.push(e):(n={id:e.interactionId,entries:[e],P:e.duration},this.l.set(n.id,n),this.u.push(n)),this.u.sort((e,t)=>t.P-e.P),this.u.length>10){const e=this.u.splice(10);for(const t of e)this.l.delete(t.id)}this.p?.(n)}}}const L=e=>{const t=globalThis.requestIdleCallback||setTimeout;"hidden"===document.visibilityState?e():(e=h(e),document.addEventListener("visibilitychange",e,{once:!0}),t(()=>{e(),document.removeEventListener("visibilitychange",e)}))},P=[200,500];class A{m;h(e){this.m?.(e)}}const x=[2500,4e3],j=[800,1800],F=e=>{document.prerendering?y(()=>F(e)):"complete"!==document.readyState?addEventListener("load",()=>F(e),!0):setTimeout(e)};e.CLSThresholds=E,e.FCPThresholds=b,e.INPThresholds=P,e.LCPThresholds=x,e.TTFBThresholds=j,e.onCLS=(e,t={})=>{S(h(()=>{let r,o=a("CLS",0);const l=u(t,c),h=e=>{for(const t of e)l.h(t);l.i>o.value&&(o.value=l.i,o.entries=l.o,r())},_=d("layout-shift",h);_&&(r=i(e,o,E,t.reportAllChanges),document.addEventListener("visibilitychange",()=>{"hidden"===document.visibilityState&&(h(_.takeRecords()),r(!0))}),n(()=>{l.i=0,o=a("CLS",0),r=i(e,o,E,t.reportAllChanges),s(()=>r())}),setTimeout(r))}))},e.onFCP=S,e.onINP=(e,t={})=>{globalThis.PerformanceEventTiming&&"interactionId"in PerformanceEventTiming.prototype&&y(()=>{"interactionCount"in performance||I||(I=d("event",O,{type:"event",buffered:!0,durationThreshold:0}));let s,r=a("INP");const o=u(t,T),l=e=>{L(()=>{for(const t of e)o.h(t);const t=o.T();t&&t.P!==r.value&&(r.value=t.P,r.entries=t.entries,s())})},c=d("event",l,{durationThreshold:t.durationThreshold??40});s=i(e,r,P,t.reportAllChanges),c&&(c.observe({type:"first-input",buffered:!0}),document.addEventListener("visibilitychange",()=>{"hidden"===document.visibilityState&&(l(c.takeRecords()),s(!0))}),n(()=>{o.v(),r=a("INP"),s=i(e,r,P,t.reportAllChanges)}))})},e.onLCP=(e,t={})=>{y(()=>{const r=m();let l,c=a("LCP");const _=u(t,A),g=e=>{t.reportAllChanges||(e=e.slice(-1));for(const t of e)_.h(t),t.startTime<r.firstHiddenTime&&(c.value=Math.max(t.startTime-o(),0),c.entries=[t],l())},v=d("largest-contentful-paint",g);if(v){l=i(e,c,x,t.reportAllChanges);const r=h(()=>{g(v.takeRecords()),v.disconnect(),l(!0)});for(const e of["keydown","click","visibilitychange"])addEventListener(e,()=>L(r),{capture:!0,once:!0});n(n=>{c=a("LCP"),l=i(e,c,x,t.reportAllChanges),s(()=>{c.value=performance.now()-n.timeStamp,l(!0)})})}})},e.onTTFB=(e,t={})=>{let s=a("TTFB"),l=i(e,s,j,t.reportAllChanges);F(()=>{const u=r();u&&(s.value=Math.max(u.responseStart-o(),0),s.entries=[u],l(!0),n(()=>{s=a("TTFB",0),l=i(e,s,j,t.reportAllChanges),l(!0)}))})}}(t)},8873:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UrlConfiguration=void 0;const i=n(3918),s=n(2610),r={[s.Endpoint._initialize]:"i",[s.Endpoint._rgstr]:"e",[s.Endpoint._download_config_specs]:"d"};t.UrlConfiguration=class{constructor(e,t,n,i){this.customUrl=null,this.fallbackUrls=null,this.endpoint=e,this.endpointDnsKey=r[e],t&&(this.customUrl=t),!t&&n&&(this.customUrl=n.endsWith("/")?`${n}${e}`:`${n}/${e}`),i&&(this.fallbackUrls=i);const o=s.NetworkDefault[e];this.defaultUrl=`${o}/${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)}}},9652:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},9839:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StatsigSession=t.SessionID=void 0;const i=n(4681),s=n(8024),r=n(1638),o=n(7047),a=n(2701),l={};function u(e){var t;const n=e.data,i=function({lastUpdate:e}){return Date.now()-e>18e5}(n)||function({startTime:e}){return Date.now()-e>144e5}(n);return i&&(e.data=h(),null===(t=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instance(e.sdkKey))||void 0===t||t.$emt({name:"session_expired"})),i}function c(e){return`statsig.session_id.${(0,i._getStorageKey)(e)}`}function d(e){try{(0,r._setObjectInStorage)(e.storageKey,e.data),e.lastPersistedAt=Date.now()}catch(e){s.Log.warn("Failed to save SessionID")}}function h(){return{sessionID:(0,o.getUUID)(),startTime:Date.now(),lastUpdate:Date.now()}}(0,a._subscribeToVisiblityChanged)(e=>{"background"===e&&Object.values(l).forEach(e=>d(e))}),t.SessionID={get:e=>t.StatsigSession.get(e).data.sessionID},t.StatsigSession={get:(e,t=!0)=>(null==l[e]&&(l[e]=function(e){const t=c(e),n=function(e){return(0,r._getObjectFromStorage)(e)}(t);return n&&n.sessionID&&n.startTime&&n.lastUpdate?{data:n,sdkKey:e,lastPersistedAt:0,storageKey:t}:{data:h(),sdkKey:e,lastPersistedAt:0,storageKey:t}}(e)),function(e,t){const n=Date.now();return u(e)?d(e):t&&(e.data.lastUpdate=n,function(e){Date.now()-e.lastPersistedAt>15e3&&d(e)}(e)),e}(l[e],t)),overrideInitialSessionID:(e,t)=>{const n=Date.now(),i={data:{sessionID:e,startTime:n,lastUpdate:n},sdkKey:t,lastPersistedAt:Date.now(),storageKey:c(t)};d(i),l[t]=i},checkForIdleSession:e=>{const t=l[e];t&&u(t)&&d(t)}}},9851:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t._makeTypedGet=t._mergeOverride=t._makeLayer=t._makeExperiment=t._makeDynamicConfig=t._makeFeatureGate=void 0;const i=n(8024),s=n(10);function r(e,t,n,i){var s;return{name:e,details:t,ruleID:null!==(s=null==n?void 0:n.rule_id)&&void 0!==s?s:"",__evaluation:n,value:i}}function o(e,t,n){var i,s;const o=null!==(i=null==n?void 0:n.value)&&void 0!==i?i:{};return Object.assign(Object.assign({},r(e,t,n,o)),{idType:null!==(s=null==n?void 0:n.id_type)&&void 0!==s?s:null,get:a(e,null==n?void 0:n.value)})}function a(e,t,n){return(r,o)=>{var a;const l=null!==(a=null==t?void 0:t[r])&&void 0!==a?a:null;return null==l?null!=o?o:null:null==o||(0,s._isTypeMatch)(l,o)?(null==n||n(r),l):(i.Log.warn(`Parameter type mismatch. '${e}.${r}' was found to be type '${typeof l}' but fallback/return type is '${typeof o}'. See https://docs.statsig.com/client/javascript-sdk/#typed-getters`),null!=o?o:null)}}t._makeFeatureGate=function(e,t,n){var i;return Object.assign(Object.assign({},r(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=o,t._makeExperiment=function(e,t,n){var i;const s=o(e,t,n);return Object.assign(Object.assign({},s),{groupName:null!==(i=null==n?void 0:n.group_name)&&void 0!==i?i:null})},t._makeLayer=function(e,t,n,i){var s,o;return Object.assign(Object.assign({},r(e,t,n,void 0)),{get:a(e,null==n?void 0:n.value,i),groupName:null!==(s=null==n?void 0:n.group_name)&&void 0!==s?s:null,__value:null!==(o=null==n?void 0:n.value)&&void 0!==o?o:{}})},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},9950:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))(function(s,r){function o(e){try{l(i.next(e))}catch(e){r(e)}}function a(e){try{l(i.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,a)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t.LocalOverrideAdapter=void 0;const s=n(6978),r="LocalOverride:Recognized";t.LocalOverrideAdapter=class{constructor(e){this._overrides={gate:{},dynamicConfig:{},experiment:{},layer:{},paramStore:{}},this._sdkKey=null!=e?e:null}_getLocalOverridesStorageKey(e){return`statsig.local-overrides.${(0,s._getStorageKey)(e)}`}loadFromStorage(){return i(this,void 0,void 0,function*(){if(null==this._sdkKey)return;s.Storage.isReady()||(yield s.Storage.isReadyResolver());const e=this._getLocalOverridesStorageKey(this._sdkKey),t=s.Storage.getItem(e),n=t?(0,s._typedJsonParse)(t,"gate","LocalOverrideAdapter overrides"):null,i=this._hasInMemoryOverrides();var r,o;n&&(this._overrides=i?(r=n,o=this._overrides,{gate:Object.assign({},r.gate,o.gate),dynamicConfig:Object.assign({},r.dynamicConfig,o.dynamicConfig),experiment:Object.assign({},r.experiment,o.experiment),layer:Object.assign({},r.layer,o.layer),paramStore:Object.assign({},r.paramStore,o.paramStore)}):n),i&&this._saveOverridesToStorage()})}_saveOverridesToStorage(){if(null==this._sdkKey||!s.Storage.isReady())return;const e=this._getLocalOverridesStorageKey(this._sdkKey);s.Storage.setItem(e,JSON.stringify(this._overrides))}overrideGate(e,t){this._overrides.gate[e]=t,this._overrides.gate[(0,s._DJB2)(e)]=t,this._saveOverridesToStorage()}_warnIfStorageNotReady(){s.Storage.isReady()||s.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,s._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,s._DJB2)(e.name)];return null==i?null:Object.assign(Object.assign({},e),{value:i,details:Object.assign(Object.assign({},e.details),{reason:r})})}overrideDynamicConfig(e,t){this._overrides.dynamicConfig[e]=t,this._overrides.dynamicConfig[(0,s._DJB2)(e)]=t,this._saveOverridesToStorage()}removeDynamicConfigOverride(e){this._warnIfStorageNotReady(),delete this._overrides.dynamicConfig[e],delete this._overrides.dynamicConfig[(0,s._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,s._DJB2)(e)]=t,this._saveOverridesToStorage()}removeExperimentOverride(e){this._warnIfStorageNotReady(),delete this._overrides.experiment[e],delete this._overrides.experiment[(0,s._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,s._DJB2)(e)]=t,this._saveOverridesToStorage()}removeLayerOverride(e){this._warnIfStorageNotReady(),delete this._overrides.layer[e],delete this._overrides.layer[(0,s._DJB2)(e)],this._saveOverridesToStorage()}overrideParamStore(e,t){this._overrides.paramStore[e]=t,this._overrides.paramStore[(0,s._DJB2)(e)]=t,this._saveOverridesToStorage()}removeParamStoreOverride(e){this._warnIfStorageNotReady(),delete this._overrides.paramStore[e],delete this._overrides.paramStore[(0,s._DJB2)(e)],this._saveOverridesToStorage()}getParamStoreOverride(e){var t;const n=null!==(t=this._overrides.paramStore[e.name])&&void 0!==t?t:this._overrides.paramStore[(0,s._DJB2)(e.name)];if(null==n)return null;const i=Object.assign({},e.__configuration||{});for(const[e,t]of Object.entries(n)){const n=this._inferParamType(t);i[e]={ref_type:"static",param_type:n,value:t}}return{config:i,details:Object.assign(Object.assign({},e.details),{reason:r})}}getAllOverrides(){var e;return null!==(e=(0,s._typedJsonParse)(JSON.stringify(this._overrides),"gate","OverrideStore"))&&void 0!==e?e:{gate:{},dynamicConfig:{},experiment:{},layer:{},paramStore:{}}}removeAllOverrides(){this._warnIfStorageNotReady(),this._overrides={gate:{},dynamicConfig:{},experiment:{},layer:{},paramStore:{}},this._saveOverridesToStorage()}getLayerOverride(e,t){var n;const i=null!==(n=this._overrides.layer[e.name])&&void 0!==n?n:this._overrides.layer[(0,s._DJB2)(e.name)];return null==i?null:Object.assign(Object.assign({},e),{__value:i,get:(0,s._makeTypedGet)(e.name,i),details:Object.assign(Object.assign({},e.details),{reason:r})})}_getConfigOverride(e,t){var n;const i=null!==(n=t[e.name])&&void 0!==n?n:t[(0,s._DJB2)(e.name)];return null==i?null:Object.assign(Object.assign({},e),{value:i,get:(0,s._makeTypedGet)(e.name,i),details:Object.assign(Object.assign({},e.details),{reason:r})})}_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||Object.keys(this._overrides.paramStore).length>0}_inferParamType(e){return"string"==typeof e?"string":"boolean"==typeof e?"boolean":"number"==typeof e?"number":Array.isArray(e)?"array":"object"}}},9999:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t._makeParamStoreGetter=void 0;const i=n(6978),s={disableExposureLog:!0};function r(e){return null==e||!1===e.disableExposureLog}function o(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,r(n)?void 0:s).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,r(i)?void 0:s).get(t.param_name);return o(a,n)?n:a}(e,u,l,n);case"experiment":return function(e,t,n,i){const a=e.getExperiment(t.experiment_name,r(i)?void 0:s).get(t.param_name);return o(a,n)?n:a}(e,u,l,n);case"layer":return function(e,t,n,i){const a=e.getLayer(t.layer_name,r(i)?void 0:s).get(t.param_name);return o(a,n)?n:a}(e,u,l,n);default:return l}}}}},t={};function n(i){var s=t[i];if(void 0!==s)return s.exports;var r=t[i]={exports:{}};return e[i].call(r.exports,r,r.exports,n),r.exports}n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),(()=>{"use strict";var e=n(8238),t=n(5138),i=n(1500);const s="data-statsig-element-id",r="sidecar-v2-beta",o="2.6.1",a={},l=window.StatsigSidecar||{};if(window.StatsigSidecar=Object.assign(l,{_statsigInstance:null,_queuedEvents:[],_clientInitialized:!1,_redirKey:"_stsgnoredir",_stableIdMap:a,_appliedInserts:new Set,activateExperiment:function(e){const t=this._getMatchingExperiments().find(t=>t.value.sidecarExperimentName===e);t&&StatsigSidecar._performExperiments([t.name])},findElementToObserve:function(e){for(;e;){try{const t=this.resolveElement(e);if(t)return t}catch(e){}e=e.substring(0,e.lastIndexOf(">"))}return document.body},applyStableIdMap:function(){const e=a||{};Object.keys(e).forEach(t=>{const n=e[t];if(!n)return;const i=document.querySelector(t);i&&!i.hasAttribute(s)&&i.setAttribute(s,n)})},resolveElement:function(e){const t=document.querySelector(e);if(t){const n=this._ensureStableId(t);a[e]=n}const n=a?.[e];if(n){const e=document.querySelector(`[${s}="${n}"]`);if(e)return e}return t},_mergeStableIdMap:function(e){e&&"object"==typeof e&&Object.assign(a,e)},_constructQueryString:function(e){if(e.id)return`[id="${e.id}"]`;const t=e.tagName.toLowerCase(),n=e.parentElement;if(!n||"body"===t)return"body";const i=Array.from(n.children).findIndex(t=>t===e);return`${this._constructQueryString(n)} > ${t}:nth-child(${i+1})`},_ensureStableId:function(e){let t=e.getAttribute(s);return t||(t=`statsig-element-${Math.random().toString(36).slice(2,10)}`,e.setAttribute(s,t)),t},_updateStableIdMapForElements:function(e){e.forEach(e=>{if(!e||1!==e.nodeType)return;const t=this._ensureStableId(e),n=this._constructQueryString(e);a[n]=t})},_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()},_getSidecarConfig:function(){const e=window?.statsigSidecarConfig;return e&&"object"==typeof e?e:{}},_emitExperimentEvaluation:function(e){if(!e)return;const t=this._getSidecarConfig().onExperimentEvaluation;if("function"==typeof t)try{t({name:"experiment_evaluation",experiment:e,experimentName:e?.value?.sidecarExperimentName??e.name,groupName:e?.groupName??null})}catch(e){console.error("Failed to run onExperimentEvaluation callback:",e)}},_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,{disableExposureLog:!0});i.value["!statsig_sidecar_directives"]&&this._isMatchingExperiment(n,i.value.sidecarURLFilters)&&e.push(i)}),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 s=this.resolveElement(e);s&&s&&s.getAttribute(t)!==n&&(s.setAttribute(t,n),i?.forEach(e=>{s.removeAttribute(e)}))})},performContentChange:function(e,t){e&&this.setupMutationObserver(e,()=>{const n=this.resolveElement(e);n&&n&&n.innerHTML!==t&&(n.innerHTML=t)})},_performDirective:function(e){switch(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(t=>{"style"===t.type?this.performStyleChange(e.selector,t.name,t.value):"attribute"===t.type&&this.performAttributeChange(e.selector,t.name,t.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,e.metadata?.after)});break;case"insert":this._performAfterLoad(()=>{this.performInsertElement(e.selector,e.value,e.metadata?.position)});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)&&(this._appliedInserts=new Set,e.forEach(e=>{const t=this._statsigInstance.getExperiment(e);this._emitExperimentEvaluation(t);const n=t.get("!statsig_sidecar_directives",[]),i=t.get("!statsig_sidecar_stable_id_map",{});this._mergeStableIdMap(i),n.forEach(e=>{this._mergeStableIdMap(e?.metadata?.stableIdMap),this._mergeStableIdMap(e?.stableIdMap)}),this.applyStableIdMap(),n.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,i){e&&this.setupMutationObserver(e,()=>{const s=this.resolveElement(e),r=this.resolveElement(n);if(!s||!r)return;const o=s.parentElement,a="first"===t||"last"===t?r:r.parentElement;let l=null;if(o&&a)if(o===a){const e=Array.from(a.children),t=e.indexOf(s),n=e.indexOf(r);if(-1!==t&&-1!==n){const i=Math.min(t,n),s=Math.max(t,n);l=e.slice(i,s+1),this._updateStableIdMapForElements(l)}}else l=[...Array.from(o.children),...Array.from(a.children)],this._updateStableIdMapForElements(l);if(void 0!==i)return i?r.insertAdjacentElement("afterend",s):r.insertAdjacentElement("beforebegin",s),void(l&&this._updateStableIdMapForElements(l));switch(t){case"before":r.before(s);break;case"after":r.after(s);break;case"first":r.prepend(s);break;case"last":r.append(s)}l&&this._updateStableIdMapForElements(l)})},performInsertElement:function(e,t,n){if(!e||!t||!n)return;const i=`${e}|${t}|${n}`;this.setupMutationObserver(e,()=>{if(this._appliedInserts.has(i))return;const s=this.resolveElement(e);if(!s)return;let r=null;if("beforebegin"===n||"afterend"===n){const e=s.parentElement;if(e){const t=Array.from(e.children),i=t.indexOf(s),o="beforebegin"===n?i:i+1;-1!==i&&(r=t.slice(o),this._updateStableIdMapForElements(r))}}else{const e=Array.from(s.children),t="afterbegin"===n?0:e.length;r=e.slice(t),this._updateStableIdMapForElements(r)}const o=document.createElement(t);s.insertAdjacentElement(n,o),r&&this._updateStableIdMapForElements(r),this._updateStableIdMapForElements([o]),this._appliedInserts.add(i)})},performStyleChange:function(e,t,n){e&&this.setupMutationObserver(e,()=>{const i=this.resolveElement(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.value.sidecarDisableAutoRun).map(e=>e.name)}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.value.sidecarPrerunScript&&this.performInjectScript(e.value.sidecarPrerunScript)})},setupMutationObserver:function(e,t){const n=this.findElementToObserve(e);n&&this._observeMutation(n,t)},setupStatsigSdk:async function(n,s,a,l,u){let c=null,d=null,h=null;try{const e=new URL(window.location.href);c=e.searchParams.get("overrideuser"),d=e.searchParams.get("overrideexp"),h=e.searchParams.get("overrideexpname")}catch(e){console.error("Failed to update user:",e)}try{const _=window?.statsigUser??{};c&&(_.userID=c,_.customIDs=_.customIDs||{},_.customIDs.stableID=c);const g=window?.statsigOptions??{};g.disableLogging=!a;const v=g?.networkConfig?.networkOverrideFunc,f=e=>{try{const t=new URL(e);return t.searchParams.set("st",r),t.searchParams.set("sv",o),t.toString()}catch(t){return e}};if((l||u)&&(g.networkConfig={...g.networkConfig??{},initializeUrl:l,logEventUrl:u}),g.networkConfig={...g.networkConfig??{},networkOverrideFunc:(e,t)=>{const n=f(e);return v?v(n,t):fetch(n,t)}},d&&h){const t=new e.LocalOverrideAdapter;g.overrideAdapter=t,t.overrideExperiment(h,JSON.parse(d))}t.StatsigMetadataProvider.add({sdkType:r,sdkVersion:o}),this._statsigInstance=new t.StatsigClient(n,_,g),await this._statsigInstance.initializeAsync(),(0,i.gX)(this._statsigInstance),this._clientInitialized=!0,this._flushQueuedEvents(),this._observePageChanges(s),this.runAllExperiments(s)}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"),s=e.searchParams.get("logeventurl"),r="0"!==e.searchParams.get("autostart"),o="0"!==e.searchParams.get("reduceflicker");if(StatsigSidecar.scriptNonce=document.currentScript.nonce,t){o&&(document.write('<style id="__sbpd">body { display: none; }</style>\n'),setTimeout(()=>{StatsigSidecar.resetBody()},1e3));const e=n?n.split(","):null;StatsigSidecar.setupStatsigSdk(t,e,r,i,s),document.addEventListener(`sidecar_${t}`,e=>{StatsigSidecar.processEvent(e),e.preventDefault()})}}})()})();
2
2
  //# sourceMappingURL=index.js.map